aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-07-26 03:52:50 -0400
committerTakashi Iwai <tiwai@suse.de>2011-07-26 11:21:18 -0400
commit2a43952a99072f43c92355882b7965c8762ae3f3 (patch)
treed51d4f3623d5f9fd6682ed0823ed8bdf05b76b20 /sound
parent7df1ce1a8197a4afec78584f56e74ab84dcab97c (diff)
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: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/Kconfig1
-rw-r--r--sound/pci/hda/hda_codec.c16
-rw-r--r--sound/pci/hda/hda_codec.h12
-rw-r--r--sound/pci/hda/hda_local.h2
-rw-r--r--sound/pci/hda/patch_analog.c4
-rw-r--r--sound/pci/hda/patch_realtek.c10
-rw-r--r--sound/pci/hda/patch_sigmatel.c6
-rw-r--r--sound/pci/hda/patch_via.c4
8 files changed, 25 insertions, 30 deletions
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 7489b4608551..bb7e102d6726 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -243,6 +243,7 @@ config SND_HDA_GENERIC
243 243
244config SND_HDA_POWER_SAVE 244config SND_HDA_POWER_SAVE
245 bool "Aggressive power-saving on HD-audio" 245 bool "Aggressive power-saving on HD-audio"
246 depends on PM
246 help 247 help
247 Say Y here to enable more aggressive power-saving mode on 248 Say Y here to enable more aggressive power-saving mode on
248 HD-audio driver. The power-saving timeout can be configured 249 HD-audio driver. The power-saving timeout can be configured
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index c0e83ed0b351..27b0c78abb5b 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1101,7 +1101,7 @@ void snd_hda_shutup_pins(struct hda_codec *codec)
1101} 1101}
1102EXPORT_SYMBOL_HDA(snd_hda_shutup_pins); 1102EXPORT_SYMBOL_HDA(snd_hda_shutup_pins);
1103 1103
1104#ifdef SND_HDA_NEEDS_RESUME 1104#ifdef CONFIG_PM
1105/* Restore the pin controls cleared previously via snd_hda_shutup_pins() */ 1105/* Restore the pin controls cleared previously via snd_hda_shutup_pins() */
1106static void restore_shutup_pins(struct hda_codec *codec) 1106static void restore_shutup_pins(struct hda_codec *codec)
1107{ 1107{
@@ -1499,7 +1499,7 @@ static void purify_inactive_streams(struct hda_codec *codec)
1499 } 1499 }
1500} 1500}
1501 1501
1502#ifdef SND_HDA_NEEDS_RESUME 1502#ifdef CONFIG_PM
1503/* clean up all streams; called from suspend */ 1503/* clean up all streams; called from suspend */
1504static void hda_cleanup_all_streams(struct hda_codec *codec) 1504static void hda_cleanup_all_streams(struct hda_codec *codec)
1505{ 1505{
@@ -1838,7 +1838,7 @@ int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
1838} 1838}
1839EXPORT_SYMBOL_HDA(snd_hda_codec_amp_stereo); 1839EXPORT_SYMBOL_HDA(snd_hda_codec_amp_stereo);
1840 1840
1841#ifdef SND_HDA_NEEDS_RESUME 1841#ifdef CONFIG_PM
1842/** 1842/**
1843 * snd_hda_codec_resume_amp - Resume all AMP commands from the cache 1843 * snd_hda_codec_resume_amp - Resume all AMP commands from the cache
1844 * @codec: HD-audio codec 1844 * @codec: HD-audio codec
@@ -1868,7 +1868,7 @@ void snd_hda_codec_resume_amp(struct hda_codec *codec)
1868 } 1868 }
1869} 1869}
1870EXPORT_SYMBOL_HDA(snd_hda_codec_resume_amp); 1870EXPORT_SYMBOL_HDA(snd_hda_codec_resume_amp);
1871#endif /* SND_HDA_NEEDS_RESUME */ 1871#endif /* CONFIG_PM */
1872 1872
1873static u32 get_amp_max_value(struct hda_codec *codec, hda_nid_t nid, int dir, 1873static u32 get_amp_max_value(struct hda_codec *codec, hda_nid_t nid, int dir,
1874 unsigned int ofs) 1874 unsigned int ofs)
@@ -3082,7 +3082,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid)
3082} 3082}
3083EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls); 3083EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls);
3084 3084
3085#ifdef SND_HDA_NEEDS_RESUME 3085#ifdef CONFIG_PM
3086/* 3086/*
3087 * command cache 3087 * command cache
3088 */ 3088 */
@@ -3199,7 +3199,7 @@ void snd_hda_sequence_write_cache(struct hda_codec *codec,
3199 seq->param); 3199 seq->param);
3200} 3200}
3201EXPORT_SYMBOL_HDA(snd_hda_sequence_write_cache); 3201EXPORT_SYMBOL_HDA(snd_hda_sequence_write_cache);
3202#endif /* SND_HDA_NEEDS_RESUME */ 3202#endif /* CONFIG_PM */
3203 3203
3204/* 3204/*
3205 * set power state of the codec 3205 * set power state of the codec
@@ -3274,7 +3274,7 @@ static void hda_exec_init_verbs(struct hda_codec *codec)
3274static inline void hda_exec_init_verbs(struct hda_codec *codec) {} 3274static inline void hda_exec_init_verbs(struct hda_codec *codec) {}
3275#endif 3275#endif
3276 3276
3277#ifdef SND_HDA_NEEDS_RESUME 3277#ifdef CONFIG_PM
3278/* 3278/*
3279 * call suspend and power-down; used both from PM and power-save 3279 * call suspend and power-down; used both from PM and power-save
3280 */ 3280 */
@@ -3315,7 +3315,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3315 snd_hda_codec_resume_cache(codec); 3315 snd_hda_codec_resume_cache(codec);
3316 } 3316 }
3317} 3317}
3318#endif /* SND_HDA_NEEDS_RESUME */ 3318#endif /* CONFIG_PM */
3319 3319
3320 3320
3321/** 3321/**
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 82161466d3b0..663aa4fc384a 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -26,10 +26,6 @@
26#include <sound/pcm.h> 26#include <sound/pcm.h>
27#include <sound/hwdep.h> 27#include <sound/hwdep.h>
28 28
29#if defined(CONFIG_PM) || defined(CONFIG_SND_HDA_POWER_SAVE)
30#define SND_HDA_NEEDS_RESUME /* resume control code is required */
31#endif
32
33/* 29/*
34 * nodes 30 * nodes
35 */ 31 */
@@ -704,17 +700,15 @@ struct hda_codec_ops {
704 int (*init)(struct hda_codec *codec); 700 int (*init)(struct hda_codec *codec);
705 void (*free)(struct hda_codec *codec); 701 void (*free)(struct hda_codec *codec);
706 void (*unsol_event)(struct hda_codec *codec, unsigned int res); 702 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
707#ifdef SND_HDA_NEEDS_RESUME 703#ifdef CONFIG_PM
708 int (*suspend)(struct hda_codec *codec, pm_message_t state); 704 int (*suspend)(struct hda_codec *codec, pm_message_t state);
705 int (*pre_resume)(struct hda_codec *codec);
709 int (*resume)(struct hda_codec *codec); 706 int (*resume)(struct hda_codec *codec);
710#endif 707#endif
711#ifdef CONFIG_SND_HDA_POWER_SAVE 708#ifdef CONFIG_SND_HDA_POWER_SAVE
712 int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid); 709 int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid);
713#endif 710#endif
714 void (*reboot_notify)(struct hda_codec *codec); 711 void (*reboot_notify)(struct hda_codec *codec);
715#ifdef SND_HDA_NEEDS_RESUME
716 int (*pre_resume)(struct hda_codec *codec);
717#endif
718}; 712};
719 713
720/* record for amp information cache */ 714/* record for amp information cache */
@@ -930,7 +924,7 @@ void snd_hda_sequence_write(struct hda_codec *codec,
930int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex); 924int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex);
931 925
932/* cached write */ 926/* cached write */
933#ifdef SND_HDA_NEEDS_RESUME 927#ifdef CONFIG_PM
934int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, 928int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
935 int direct, unsigned int verb, unsigned int parm); 929 int direct, unsigned int verb, unsigned int parm);
936void snd_hda_sequence_write_cache(struct hda_codec *codec, 930void snd_hda_sequence_write_cache(struct hda_codec *codec,
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 88b277e97409..2e7ac31afa8d 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -131,7 +131,7 @@ int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
131 int direction, int idx, int mask, int val); 131 int direction, int idx, int mask, int val);
132int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid, 132int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
133 int dir, int idx, int mask, int val); 133 int dir, int idx, int mask, int val);
134#ifdef SND_HDA_NEEDS_RESUME 134#ifdef CONFIG_PM
135void snd_hda_codec_resume_amp(struct hda_codec *codec); 135void snd_hda_codec_resume_amp(struct hda_codec *codec);
136#endif 136#endif
137 137
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 1362c8ba4d1f..8648917acffb 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -563,7 +563,7 @@ static void ad198x_free(struct hda_codec *codec)
563 snd_hda_detach_beep_device(codec); 563 snd_hda_detach_beep_device(codec);
564} 564}
565 565
566#ifdef SND_HDA_NEEDS_RESUME 566#ifdef CONFIG_PM
567static int ad198x_suspend(struct hda_codec *codec, pm_message_t state) 567static int ad198x_suspend(struct hda_codec *codec, pm_message_t state)
568{ 568{
569 ad198x_shutup(codec); 569 ad198x_shutup(codec);
@@ -579,7 +579,7 @@ static const struct hda_codec_ops ad198x_patch_ops = {
579#ifdef CONFIG_SND_HDA_POWER_SAVE 579#ifdef CONFIG_SND_HDA_POWER_SAVE
580 .check_power_status = ad198x_check_power_status, 580 .check_power_status = ad198x_check_power_status,
581#endif 581#endif
582#ifdef SND_HDA_NEEDS_RESUME 582#ifdef CONFIG_PM
583 .suspend = ad198x_suspend, 583 .suspend = ad198x_suspend,
584#endif 584#endif
585 .reboot_notify = ad198x_shutup, 585 .reboot_notify = ad198x_shutup,
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 569d2aa4eeb5..694327ae8b71 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2386,7 +2386,7 @@ static int alc_suspend(struct hda_codec *codec, pm_message_t state)
2386} 2386}
2387#endif 2387#endif
2388 2388
2389#ifdef SND_HDA_NEEDS_RESUME 2389#ifdef CONFIG_PM
2390static int alc_resume(struct hda_codec *codec) 2390static int alc_resume(struct hda_codec *codec)
2391{ 2391{
2392 msleep(150); /* to avoid pop noise */ 2392 msleep(150); /* to avoid pop noise */
@@ -2406,7 +2406,7 @@ static const struct hda_codec_ops alc_patch_ops = {
2406 .init = alc_init, 2406 .init = alc_init,
2407 .free = alc_free, 2407 .free = alc_free,
2408 .unsol_event = alc_unsol_event, 2408 .unsol_event = alc_unsol_event,
2409#ifdef SND_HDA_NEEDS_RESUME 2409#ifdef CONFIG_PM
2410 .resume = alc_resume, 2410 .resume = alc_resume,
2411#endif 2411#endif
2412#ifdef CONFIG_SND_HDA_POWER_SAVE 2412#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -4413,7 +4413,7 @@ static void alc269_shutup(struct hda_codec *codec)
4413 } 4413 }
4414} 4414}
4415 4415
4416#ifdef SND_HDA_NEEDS_RESUME 4416#ifdef CONFIG_PM
4417static int alc269_resume(struct hda_codec *codec) 4417static int alc269_resume(struct hda_codec *codec)
4418{ 4418{
4419 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { 4419 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
@@ -4436,7 +4436,7 @@ static int alc269_resume(struct hda_codec *codec)
4436 hda_call_check_power_status(codec, 0x01); 4436 hda_call_check_power_status(codec, 0x01);
4437 return 0; 4437 return 0;
4438} 4438}
4439#endif /* SND_HDA_NEEDS_RESUME */ 4439#endif /* CONFIG_PM */
4440 4440
4441static void alc269_fixup_hweq(struct hda_codec *codec, 4441static void alc269_fixup_hweq(struct hda_codec *codec,
4442 const struct alc_fixup *fix, int action) 4442 const struct alc_fixup *fix, int action)
@@ -4728,7 +4728,7 @@ static int patch_alc269(struct hda_codec *codec)
4728 spec->vmaster_nid = 0x02; 4728 spec->vmaster_nid = 0x02;
4729 4729
4730 codec->patch_ops = alc_patch_ops; 4730 codec->patch_ops = alc_patch_ops;
4731#ifdef SND_HDA_NEEDS_RESUME 4731#ifdef CONFIG_PM
4732 codec->patch_ops.resume = alc269_resume; 4732 codec->patch_ops.resume = alc269_resume;
4733#endif 4733#endif
4734 if (board_config == ALC_MODEL_AUTO) 4734 if (board_config == ALC_MODEL_AUTO)
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 8f80796c366f..fcf4c7142103 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4934,7 +4934,7 @@ static void stac927x_proc_hook(struct snd_info_buffer *buffer,
4934#define stac927x_proc_hook NULL 4934#define stac927x_proc_hook NULL
4935#endif 4935#endif
4936 4936
4937#ifdef SND_HDA_NEEDS_RESUME 4937#ifdef CONFIG_PM
4938static int stac92xx_pre_resume(struct hda_codec *codec) 4938static int stac92xx_pre_resume(struct hda_codec *codec)
4939{ 4939{
4940 struct sigmatel_spec *spec = codec->spec; 4940 struct sigmatel_spec *spec = codec->spec;
@@ -5030,7 +5030,7 @@ static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
5030 stac92xx_shutup(codec); 5030 stac92xx_shutup(codec);
5031 return 0; 5031 return 0;
5032} 5032}
5033#endif 5033#endif /* CONFIG_PM */
5034 5034
5035static const struct hda_codec_ops stac92xx_patch_ops = { 5035static const struct hda_codec_ops stac92xx_patch_ops = {
5036 .build_controls = stac92xx_build_controls, 5036 .build_controls = stac92xx_build_controls,
@@ -5038,7 +5038,7 @@ static const struct hda_codec_ops stac92xx_patch_ops = {
5038 .init = stac92xx_init, 5038 .init = stac92xx_init,
5039 .free = stac92xx_free, 5039 .free = stac92xx_free,
5040 .unsol_event = stac92xx_unsol_event, 5040 .unsol_event = stac92xx_unsol_event,
5041#ifdef SND_HDA_NEEDS_RESUME 5041#ifdef CONFIG_PM
5042 .suspend = stac92xx_suspend, 5042 .suspend = stac92xx_suspend,
5043 .resume = stac92xx_resume, 5043 .resume = stac92xx_resume,
5044 .pre_resume = stac92xx_pre_resume, 5044 .pre_resume = stac92xx_pre_resume,
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index f38160b00e16..84d8798bf33a 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -1708,7 +1708,7 @@ static void via_unsol_event(struct hda_codec *codec,
1708 via_gpio_control(codec); 1708 via_gpio_control(codec);
1709} 1709}
1710 1710
1711#ifdef SND_HDA_NEEDS_RESUME 1711#ifdef CONFIG_PM
1712static int via_suspend(struct hda_codec *codec, pm_message_t state) 1712static int via_suspend(struct hda_codec *codec, pm_message_t state)
1713{ 1713{
1714 struct via_spec *spec = codec->spec; 1714 struct via_spec *spec = codec->spec;
@@ -1736,7 +1736,7 @@ static const struct hda_codec_ops via_patch_ops = {
1736 .init = via_init, 1736 .init = via_init,
1737 .free = via_free, 1737 .free = via_free,
1738 .unsol_event = via_unsol_event, 1738 .unsol_event = via_unsol_event,
1739#ifdef SND_HDA_NEEDS_RESUME 1739#ifdef CONFIG_PM
1740 .suspend = via_suspend, 1740 .suspend = via_suspend,
1741#endif 1741#endif
1742#ifdef CONFIG_SND_HDA_POWER_SAVE 1742#ifdef CONFIG_SND_HDA_POWER_SAVE