aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-03-13 09:47:21 -0400
committerTakashi Iwai <tiwai@suse.de>2013-03-13 13:07:05 -0400
commitba615b86d6a3ba6e244973672c63903c8b2831a3 (patch)
treea519ed1086a43f33036e3dc3d30b4892a1289835
parentbce0d2a80e428aac3b39bf19675f1f57126f9cb6 (diff)
ALSA: hda - Don't apply EAPD power filter as default
So far, the driver doesn't power down the widget at going down to D3 when the widget node has an EAPD capability and EAPD is actually set on all codecs unless codec->power_filter is set explicitly. This caused a problem on some Conexant codecs, leading to click noises, and we set it as NULL there. But it is very unlikely that the problem hits only these codecs. Looking back at the development history, this workaround for EAPD was introduced just for some laptops with STAC9200 codec, then we applied it blindly for all. Now, since it's revealed to have an ill effect, we should disable this workaround per default and apply only for the known requiring systems. The EAPD workaround is implemented now as snd_hda_codec_eapd_power_filter(), and this has to be set explicitly by the codec driver when needed. As of now, only patch_stac9200() sets this one. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_codec.c13
-rw-r--r--sound/pci/hda/hda_local.h4
-rw-r--r--sound/pci/hda/patch_conexant.c1
-rw-r--r--sound/pci/hda/patch_sigmatel.c1
4 files changed, 11 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index ea061b6c14f9..39a510699b86 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1296,8 +1296,6 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec,
1296 1296
1297static unsigned int hda_set_power_state(struct hda_codec *codec, 1297static unsigned int hda_set_power_state(struct hda_codec *codec,
1298 unsigned int power_state); 1298 unsigned int power_state);
1299static unsigned int default_power_filter(struct hda_codec *codec, hda_nid_t nid,
1300 unsigned int power_state);
1301 1299
1302/** 1300/**
1303 * snd_hda_codec_new - create a HDA codec 1301 * snd_hda_codec_new - create a HDA codec
@@ -1418,7 +1416,6 @@ int snd_hda_codec_new(struct hda_bus *bus,
1418#endif 1416#endif
1419 codec->epss = snd_hda_codec_get_supported_ps(codec, fg, 1417 codec->epss = snd_hda_codec_get_supported_ps(codec, fg,
1420 AC_PWRST_EPSS); 1418 AC_PWRST_EPSS);
1421 codec->power_filter = default_power_filter;
1422 1419
1423 /* power-up all before initialization */ 1420 /* power-up all before initialization */
1424 hda_set_power_state(codec, AC_PWRST_D0); 1421 hda_set_power_state(codec, AC_PWRST_D0);
@@ -3759,8 +3756,9 @@ static unsigned int hda_sync_power_state(struct hda_codec *codec,
3759} 3756}
3760 3757
3761/* don't power down the widget if it controls eapd and EAPD_BTLENABLE is set */ 3758/* don't power down the widget if it controls eapd and EAPD_BTLENABLE is set */
3762static unsigned int default_power_filter(struct hda_codec *codec, hda_nid_t nid, 3759unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,
3763 unsigned int power_state) 3760 hda_nid_t nid,
3761 unsigned int power_state)
3764{ 3762{
3765 if (power_state == AC_PWRST_D3 && 3763 if (power_state == AC_PWRST_D3 &&
3766 get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_PIN && 3764 get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_PIN &&
@@ -3772,6 +3770,7 @@ static unsigned int default_power_filter(struct hda_codec *codec, hda_nid_t nid,
3772 } 3770 }
3773 return power_state; 3771 return power_state;
3774} 3772}
3773EXPORT_SYMBOL_HDA(snd_hda_codec_eapd_power_filter);
3775 3774
3776/* 3775/*
3777 * set power state of the codec, and return the power state 3776 * set power state of the codec, and return the power state
@@ -3816,8 +3815,8 @@ static void sync_power_up_states(struct hda_codec *codec)
3816 hda_nid_t nid = codec->start_nid; 3815 hda_nid_t nid = codec->start_nid;
3817 int i; 3816 int i;
3818 3817
3819 /* don't care if no or standard filter is used */ 3818 /* don't care if no filter is used */
3820 if (!codec->power_filter || codec->power_filter == default_power_filter) 3819 if (!codec->power_filter)
3821 return; 3820 return;
3822 3821
3823 for (i = 0; i < codec->num_nodes; i++, nid++) { 3822 for (i = 0; i < codec->num_nodes; i++, nid++) {
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 83b7486c8eff..e0bf7534fa1f 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -670,6 +670,10 @@ snd_hda_check_power_state(struct hda_codec *codec, hda_nid_t nid,
670 return (state != target_state); 670 return (state != target_state);
671} 671}
672 672
673unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,
674 hda_nid_t nid,
675 unsigned int power_state);
676
673/* 677/*
674 * AMP control callbacks 678 * AMP control callbacks
675 */ 679 */
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 941bf6c766ec..7d941ef54172 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3350,7 +3350,6 @@ static int patch_conexant_auto(struct hda_codec *codec)
3350 switch (codec->vendor_id) { 3350 switch (codec->vendor_id) {
3351 case 0x14f15045: 3351 case 0x14f15045:
3352 codec->single_adc_amp = 1; 3352 codec->single_adc_amp = 1;
3353 codec->power_filter = NULL; /* Needs speaker amp to D3 to avoid click */
3354 break; 3353 break;
3355 case 0x14f15047: 3354 case 0x14f15047:
3356 codec->pin_amp_workaround = 1; 3355 codec->pin_amp_workaround = 1;
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 83d5335ac348..d57c81e79edd 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3774,6 +3774,7 @@ static int patch_stac9200(struct hda_codec *codec)
3774 spec->gen.own_eapd_ctl = 1; 3774 spec->gen.own_eapd_ctl = 1;
3775 3775
3776 codec->patch_ops = stac_patch_ops; 3776 codec->patch_ops = stac_patch_ops;
3777 codec->power_filter = snd_hda_codec_eapd_power_filter;
3777 3778
3778 snd_hda_add_verbs(codec, stac9200_eapd_init); 3779 snd_hda_add_verbs(codec, stac9200_eapd_init);
3779 3780