Commit 2a43952a authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Make CONFIG_SND_HDA_POWER_SAVE depending on CONFIG_PM

It makes little sense to enable power-saving without PM.
This removes SND_HDA_NEEDS_RESUME define so that we can use CONFIG_PM
in all places.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7df1ce1a
...@@ -243,6 +243,7 @@ config SND_HDA_GENERIC ...@@ -243,6 +243,7 @@ config SND_HDA_GENERIC
config SND_HDA_POWER_SAVE config SND_HDA_POWER_SAVE
bool "Aggressive power-saving on HD-audio" bool "Aggressive power-saving on HD-audio"
depends on PM
help help
Say Y here to enable more aggressive power-saving mode on Say Y here to enable more aggressive power-saving mode on
HD-audio driver. The power-saving timeout can be configured HD-audio driver. The power-saving timeout can be configured
......
...@@ -1101,7 +1101,7 @@ void snd_hda_shutup_pins(struct hda_codec *codec) ...@@ -1101,7 +1101,7 @@ void snd_hda_shutup_pins(struct hda_codec *codec)
} }
EXPORT_SYMBOL_HDA(snd_hda_shutup_pins); EXPORT_SYMBOL_HDA(snd_hda_shutup_pins);
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
/* Restore the pin controls cleared previously via snd_hda_shutup_pins() */ /* Restore the pin controls cleared previously via snd_hda_shutup_pins() */
static void restore_shutup_pins(struct hda_codec *codec) static void restore_shutup_pins(struct hda_codec *codec)
{ {
...@@ -1499,7 +1499,7 @@ static void purify_inactive_streams(struct hda_codec *codec) ...@@ -1499,7 +1499,7 @@ static void purify_inactive_streams(struct hda_codec *codec)
} }
} }
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
/* clean up all streams; called from suspend */ /* clean up all streams; called from suspend */
static void hda_cleanup_all_streams(struct hda_codec *codec) static void hda_cleanup_all_streams(struct hda_codec *codec)
{ {
...@@ -1838,7 +1838,7 @@ int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid, ...@@ -1838,7 +1838,7 @@ int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
} }
EXPORT_SYMBOL_HDA(snd_hda_codec_amp_stereo); EXPORT_SYMBOL_HDA(snd_hda_codec_amp_stereo);
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
/** /**
* snd_hda_codec_resume_amp - Resume all AMP commands from the cache * snd_hda_codec_resume_amp - Resume all AMP commands from the cache
* @codec: HD-audio codec * @codec: HD-audio codec
...@@ -1868,7 +1868,7 @@ void snd_hda_codec_resume_amp(struct hda_codec *codec) ...@@ -1868,7 +1868,7 @@ void snd_hda_codec_resume_amp(struct hda_codec *codec)
} }
} }
EXPORT_SYMBOL_HDA(snd_hda_codec_resume_amp); EXPORT_SYMBOL_HDA(snd_hda_codec_resume_amp);
#endif /* SND_HDA_NEEDS_RESUME */ #endif /* CONFIG_PM */
static u32 get_amp_max_value(struct hda_codec *codec, hda_nid_t nid, int dir, static u32 get_amp_max_value(struct hda_codec *codec, hda_nid_t nid, int dir,
unsigned int ofs) unsigned int ofs)
...@@ -3082,7 +3082,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) ...@@ -3082,7 +3082,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid)
} }
EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls); EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls);
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
/* /*
* command cache * command cache
*/ */
...@@ -3199,7 +3199,7 @@ void snd_hda_sequence_write_cache(struct hda_codec *codec, ...@@ -3199,7 +3199,7 @@ void snd_hda_sequence_write_cache(struct hda_codec *codec,
seq->param); seq->param);
} }
EXPORT_SYMBOL_HDA(snd_hda_sequence_write_cache); EXPORT_SYMBOL_HDA(snd_hda_sequence_write_cache);
#endif /* SND_HDA_NEEDS_RESUME */ #endif /* CONFIG_PM */
/* /*
* set power state of the codec * set power state of the codec
...@@ -3274,7 +3274,7 @@ static void hda_exec_init_verbs(struct hda_codec *codec) ...@@ -3274,7 +3274,7 @@ static void hda_exec_init_verbs(struct hda_codec *codec)
static inline void hda_exec_init_verbs(struct hda_codec *codec) {} static inline void hda_exec_init_verbs(struct hda_codec *codec) {}
#endif #endif
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
/* /*
* call suspend and power-down; used both from PM and power-save * call suspend and power-down; used both from PM and power-save
*/ */
...@@ -3315,7 +3315,7 @@ static void hda_call_codec_resume(struct hda_codec *codec) ...@@ -3315,7 +3315,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
snd_hda_codec_resume_cache(codec); snd_hda_codec_resume_cache(codec);
} }
} }
#endif /* SND_HDA_NEEDS_RESUME */ #endif /* CONFIG_PM */
/** /**
......
...@@ -26,10 +26,6 @@ ...@@ -26,10 +26,6 @@
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/hwdep.h> #include <sound/hwdep.h>
#if defined(CONFIG_PM) || defined(CONFIG_SND_HDA_POWER_SAVE)
#define SND_HDA_NEEDS_RESUME /* resume control code is required */
#endif
/* /*
* nodes * nodes
*/ */
...@@ -704,17 +700,15 @@ struct hda_codec_ops { ...@@ -704,17 +700,15 @@ struct hda_codec_ops {
int (*init)(struct hda_codec *codec); int (*init)(struct hda_codec *codec);
void (*free)(struct hda_codec *codec); void (*free)(struct hda_codec *codec);
void (*unsol_event)(struct hda_codec *codec, unsigned int res); void (*unsol_event)(struct hda_codec *codec, unsigned int res);
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
int (*suspend)(struct hda_codec *codec, pm_message_t state); int (*suspend)(struct hda_codec *codec, pm_message_t state);
int (*pre_resume)(struct hda_codec *codec);
int (*resume)(struct hda_codec *codec); int (*resume)(struct hda_codec *codec);
#endif #endif
#ifdef CONFIG_SND_HDA_POWER_SAVE #ifdef CONFIG_SND_HDA_POWER_SAVE
int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid); int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid);
#endif #endif
void (*reboot_notify)(struct hda_codec *codec); void (*reboot_notify)(struct hda_codec *codec);
#ifdef SND_HDA_NEEDS_RESUME
int (*pre_resume)(struct hda_codec *codec);
#endif
}; };
/* record for amp information cache */ /* record for amp information cache */
...@@ -930,7 +924,7 @@ void snd_hda_sequence_write(struct hda_codec *codec, ...@@ -930,7 +924,7 @@ void snd_hda_sequence_write(struct hda_codec *codec,
int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex); int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex);
/* cached write */ /* cached write */
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
int direct, unsigned int verb, unsigned int parm); int direct, unsigned int verb, unsigned int parm);
void snd_hda_sequence_write_cache(struct hda_codec *codec, void snd_hda_sequence_write_cache(struct hda_codec *codec,
......
...@@ -131,7 +131,7 @@ int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch, ...@@ -131,7 +131,7 @@ int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
int direction, int idx, int mask, int val); int direction, int idx, int mask, int val);
int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid, int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
int dir, int idx, int mask, int val); int dir, int idx, int mask, int val);
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
void snd_hda_codec_resume_amp(struct hda_codec *codec); void snd_hda_codec_resume_amp(struct hda_codec *codec);
#endif #endif
......
...@@ -563,7 +563,7 @@ static void ad198x_free(struct hda_codec *codec) ...@@ -563,7 +563,7 @@ static void ad198x_free(struct hda_codec *codec)
snd_hda_detach_beep_device(codec); snd_hda_detach_beep_device(codec);
} }
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
static int ad198x_suspend(struct hda_codec *codec, pm_message_t state) static int ad198x_suspend(struct hda_codec *codec, pm_message_t state)
{ {
ad198x_shutup(codec); ad198x_shutup(codec);
...@@ -579,7 +579,7 @@ static const struct hda_codec_ops ad198x_patch_ops = { ...@@ -579,7 +579,7 @@ static const struct hda_codec_ops ad198x_patch_ops = {
#ifdef CONFIG_SND_HDA_POWER_SAVE #ifdef CONFIG_SND_HDA_POWER_SAVE
.check_power_status = ad198x_check_power_status, .check_power_status = ad198x_check_power_status,
#endif #endif
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
.suspend = ad198x_suspend, .suspend = ad198x_suspend,
#endif #endif
.reboot_notify = ad198x_shutup, .reboot_notify = ad198x_shutup,
......
...@@ -2386,7 +2386,7 @@ static int alc_suspend(struct hda_codec *codec, pm_message_t state) ...@@ -2386,7 +2386,7 @@ static int alc_suspend(struct hda_codec *codec, pm_message_t state)
} }
#endif #endif
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
static int alc_resume(struct hda_codec *codec) static int alc_resume(struct hda_codec *codec)
{ {
msleep(150); /* to avoid pop noise */ msleep(150); /* to avoid pop noise */
...@@ -2406,7 +2406,7 @@ static const struct hda_codec_ops alc_patch_ops = { ...@@ -2406,7 +2406,7 @@ static const struct hda_codec_ops alc_patch_ops = {
.init = alc_init, .init = alc_init,
.free = alc_free, .free = alc_free,
.unsol_event = alc_unsol_event, .unsol_event = alc_unsol_event,
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
.resume = alc_resume, .resume = alc_resume,
#endif #endif
#ifdef CONFIG_SND_HDA_POWER_SAVE #ifdef CONFIG_SND_HDA_POWER_SAVE
...@@ -4413,7 +4413,7 @@ static void alc269_shutup(struct hda_codec *codec) ...@@ -4413,7 +4413,7 @@ static void alc269_shutup(struct hda_codec *codec)
} }
} }
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
static int alc269_resume(struct hda_codec *codec) static int alc269_resume(struct hda_codec *codec)
{ {
if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
...@@ -4436,7 +4436,7 @@ static int alc269_resume(struct hda_codec *codec) ...@@ -4436,7 +4436,7 @@ static int alc269_resume(struct hda_codec *codec)
hda_call_check_power_status(codec, 0x01); hda_call_check_power_status(codec, 0x01);
return 0; return 0;
} }
#endif /* SND_HDA_NEEDS_RESUME */ #endif /* CONFIG_PM */
static void alc269_fixup_hweq(struct hda_codec *codec, static void alc269_fixup_hweq(struct hda_codec *codec,
const struct alc_fixup *fix, int action) const struct alc_fixup *fix, int action)
...@@ -4728,7 +4728,7 @@ static int patch_alc269(struct hda_codec *codec) ...@@ -4728,7 +4728,7 @@ static int patch_alc269(struct hda_codec *codec)
spec->vmaster_nid = 0x02; spec->vmaster_nid = 0x02;
codec->patch_ops = alc_patch_ops; codec->patch_ops = alc_patch_ops;
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
codec->patch_ops.resume = alc269_resume; codec->patch_ops.resume = alc269_resume;
#endif #endif
if (board_config == ALC_MODEL_AUTO) if (board_config == ALC_MODEL_AUTO)
......
...@@ -4934,7 +4934,7 @@ static void stac927x_proc_hook(struct snd_info_buffer *buffer, ...@@ -4934,7 +4934,7 @@ static void stac927x_proc_hook(struct snd_info_buffer *buffer,
#define stac927x_proc_hook NULL #define stac927x_proc_hook NULL
#endif #endif
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
static int stac92xx_pre_resume(struct hda_codec *codec) static int stac92xx_pre_resume(struct hda_codec *codec)
{ {
struct sigmatel_spec *spec = codec->spec; struct sigmatel_spec *spec = codec->spec;
...@@ -5030,7 +5030,7 @@ static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) ...@@ -5030,7 +5030,7 @@ static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
stac92xx_shutup(codec); stac92xx_shutup(codec);
return 0; return 0;
} }
#endif #endif /* CONFIG_PM */
static const struct hda_codec_ops stac92xx_patch_ops = { static const struct hda_codec_ops stac92xx_patch_ops = {
.build_controls = stac92xx_build_controls, .build_controls = stac92xx_build_controls,
...@@ -5038,7 +5038,7 @@ static const struct hda_codec_ops stac92xx_patch_ops = { ...@@ -5038,7 +5038,7 @@ static const struct hda_codec_ops stac92xx_patch_ops = {
.init = stac92xx_init, .init = stac92xx_init,
.free = stac92xx_free, .free = stac92xx_free,
.unsol_event = stac92xx_unsol_event, .unsol_event = stac92xx_unsol_event,
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
.suspend = stac92xx_suspend, .suspend = stac92xx_suspend,
.resume = stac92xx_resume, .resume = stac92xx_resume,
.pre_resume = stac92xx_pre_resume, .pre_resume = stac92xx_pre_resume,
......
...@@ -1708,7 +1708,7 @@ static void via_unsol_event(struct hda_codec *codec, ...@@ -1708,7 +1708,7 @@ static void via_unsol_event(struct hda_codec *codec,
via_gpio_control(codec); via_gpio_control(codec);
} }
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
static int via_suspend(struct hda_codec *codec, pm_message_t state) static int via_suspend(struct hda_codec *codec, pm_message_t state)
{ {
struct via_spec *spec = codec->spec; struct via_spec *spec = codec->spec;
...@@ -1736,7 +1736,7 @@ static const struct hda_codec_ops via_patch_ops = { ...@@ -1736,7 +1736,7 @@ static const struct hda_codec_ops via_patch_ops = {
.init = via_init, .init = via_init,
.free = via_free, .free = via_free,
.unsol_event = via_unsol_event, .unsol_event = via_unsol_event,
#ifdef SND_HDA_NEEDS_RESUME #ifdef CONFIG_PM
.suspend = via_suspend, .suspend = via_suspend,
#endif #endif
#ifdef CONFIG_SND_HDA_POWER_SAVE #ifdef CONFIG_SND_HDA_POWER_SAVE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment