ALSA: hda - Remove speaker clicks on CX20549
PATCH 1/1 ALSA: hda - Remove speaker clicks on CX20549
This chip needs the speaker pin to go to D3 to avoid clicks, so default_power_filter does not work here.
This was found on Thinkpad R61i/T61i but I guess it applies to the entire chip. If not, quirks should be set for at least PCI SSID 17aa:20ac.
Thanks to c4pp4 for testing.
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -3350,6 +3350,7 @@ static int patch_conexant_auto(struct hda_codec *codec)switch (codec->vendor_id) {case 0x14f15045 : codec->single_adc_amp =1 ; + codec->power_filter =NULL ;/* Needs speaker amp to D3 to avoid click */ break ;case 0x14f15047 : codec->pin_amp_workaround =1 ;
Signature · 1 line
1.7.9.5
Takashi Iwai
AppliedAt Thu, 14 Feb 2013 11:36:39 +0100,
Quoted 4 lines · David Henningsson
This chip needs the speaker pin to go to D3 to avoid clicks, so
default_power_filterdoes not work here.
Quoted 8 lines
This was found on Thinkpad R61i/T61i but I guess it applies to the entire chip. If not, quirks should be set for at least PCI SSID 17aa:20ac.
Thanks to c4pp4 for testing.
Signed-off-by David Henningsson <[email protected]>
Thanks, applied now.
Just wonder, though, whether rather setting spec->gen.power_down_unused = 1 works. When it's set, the generic parser applies the own power filter, and it doesn't have the EAPD check either (plus it does more aggressive power-down of unused widgets).
Or, maybe we just drop the EAPD check, and move it to specific fixup. AFAIK, it was required only for old Gateway laptops.
Takashi
Quoted 19 lines
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)sound/pci/hda/patch_conexant.c +1
-0@@ -3350,6 +3350,7 @@ static int patch_conexant_auto(struct hda_codec *codec)switch (codec->vendor_id) {case 0x14f15045 : codec->single_adc_amp =1 ; + codec->power_filter =NULL ;/* Needs speaker amp to D3 to avoid click */ break ;case 0x14f15047 : codec->pin_amp_workaround =1 ;Signature · 1 line
1.7.9.5
Quoted 17 lines · Takashi Iwai
At Thu, 14 Feb 2013 11:36:39 +0100,
Quoted 4 lines · David Henningsson
This chip needs the speaker pin to go to D3 to avoid clicks, so
default_power_filterdoes not work here.Quoted 8 lines
This was found on Thinkpad R61i/T61i but I guess it applies to the entire chip. If not, quirks should be set for at least PCI SSID 17aa:20ac.
Thanks to c4pp4 for testing.
Signed-off-by David Henningsson <[email protected]>Thanks, applied now.
Quoted 8 lines
Just wonder, though, whether rather setting
spec->gen.power_down_unused= 1 works. When it's set, the generic parser applies the own power filter, and it doesn't have the EAPD check either (plus it does more aggressive power-down of unused widgets).Or, maybe we just drop the EAPD check, and move it to specific fixup. AFAIK, it was required only for old Gateway laptops.
If gen.power_down_unused is what is believed to get the best power savings (by powering down more sub-areas of the chip), maybe a reasonable strategy to be to carefully move towards making gen.power_down_unused the default, first for the stuff that we have hw for and can test, or the new chips that we add, and if that works out fine we could try activate it for older chips too.
What do you think?
Signature · 2 lines
David Henningsson, Canonical Ltd. https://launchpad.net/~diwic
At Mon, 18 Feb 2013 10:22:19 +0100,
Quoted 28 lines · David Henningsson
Quoted 17 lines · Takashi Iwai
At Thu, 14 Feb 2013 11:36:39 +0100,
Quoted 4 lines · David Henningsson
This chip needs the speaker pin to go to D3 to avoid clicks, so
default_power_filterdoes not work here.Quoted 8 lines
This was found on Thinkpad R61i/T61i but I guess it applies to the entire chip. If not, quirks should be set for at least PCI SSID 17aa:20ac.
Thanks to c4pp4 for testing.
Signed-off-by David Henningsson <[email protected]>Thanks, applied now.
Quoted 8 lines
Just wonder, though, whether rather setting
spec->gen.power_down_unused= 1 works. When it's set, the generic parser applies the own power filter, and it doesn't have the EAPD check either (plus it does more aggressive power-down of unused widgets).Or, maybe we just drop the EAPD check, and move it to specific fixup. AFAIK, it was required only for old Gateway laptops.
Quoted 6 lines
If gen.power_down_unused is what is believed to get the best power savings (by powering down more sub-areas of the chip), maybe a reasonable strategy to be to carefully move towards making gen.power_down_unused the default, first for the stuff that we have hw for and can test, or the new chips that we add, and if that works out fine we could try activate it for older chips too.
Yes, power_down_unused is pretty aggressive, and should be enabled selectively. (And this can be enabled even now with a hint string.)
OTOH, EAPD check we had was really a workaround for some old machines, AFAIK, only for Gateway machines. This can be disabled as default like the patch below. But it's the thing for post-3.9, just to be safer.
thanks,
Takashi
---
sound/pci/hda/hda_codec.c +6 -6
@@ -1296,8 +1296,6 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec,static unsigned int hda_set_power_state (struct hda_codec *codec,unsigned int power_state); -static unsigned int default_power_filter (struct hda_codec *codec,hda_nid_t nid, -unsigned int power_state);/** * snd_hda_codec_new - create a HDA codec
@@ -1418,7 +1416,6 @@ int snd_hda_codec_new(struct hda_bus *bus,#endif codec->epss =snd_hda_codec_get_supported_ps (codec, fg,AC_PWRST_EPSS ); - codec->power_filter = default_power_filter;/* power-up all before initialization */ hda_set_power_state (codec,AC_PWRST_D0 );
@@ -3759,8 +3756,9 @@ static unsigned int hda_sync_power_state(struct hda_codec *codec, }/* don't power down the widget if it controls eapd and EAPD_BTLENABLE is set */ -static unsigned int default_power_filter (struct hda_codec *codec,hda_nid_t nid, -unsigned int power_state) +unsigned int snd_hda_codec_eapd_power_filter (struct hda_codec *codec, +hda_nid_t nid, +unsigned int power_state) { if (power_state == AC_PWRST_D3 && 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, }return power_state; } +EXPORT_SYMBOL_HDA (snd_hda_codec_eapd_power_filter);/* * set power state of the codec, and return the power state
@@ -3817,7 +3816,8 @@ static void sync_power_up_states(struct hda_codec *codec)int i;/* don't care if no or standard filter is used */ -if (!codec->power_filter || codec->power_filter == default_power_filter) +if (!codec->power_filter || + codec->power_filter == snd_hda_codec_eapd_power_filter)return ;for (i =0 ; i < codec->num_nodes; i++, nid++) {
sound/pci/hda/hda_local.h +4 -0
@@ -670,6 +670,10 @@ snd_hda_check_power_state(struct hda_codec *codec, hda_nid_t nid,return (state != target_state); } +unsigned int snd_hda_codec_eapd_power_filter (struct hda_codec *codec, +hda_nid_t nid, +unsigned int power_state); +/* * AMP control callbacks */
sound/pci/hda/patch_conexant.c +0 -1
@@ -3350,7 +3350,6 @@ static int patch_conexant_auto(struct hda_codec *codec)switch (codec->vendor_id) {case 0x14f15045 : codec->single_adc_amp =1 ; - codec->power_filter =NULL ;/* Needs speaker amp to D3 to avoid click */ break ;case 0x14f15047 : codec->pin_amp_workaround =1 ;
sound/pci/hda/patch_sigmatel.c +1 -0
@@ -3774,6 +3774,7 @@ static int patch_stac9200(struct hda_codec *codec) spec->gen.own_eapd_ctl =1 ; codec->patch_ops = stac_patch_ops; + codec->power_filter = snd_hda_codec_eapd_power_filter;snd_hda_add_verbs (codec, stac9200_eapd_init);
Quoted 93 lines · Takashi Iwai
At Mon, 18 Feb 2013 10:22:19 +0100,
Quoted 28 lines · David Henningsson
Quoted 17 lines · Takashi Iwai
At Thu, 14 Feb 2013 11:36:39 +0100,
Quoted 4 lines · David Henningsson
This chip needs the speaker pin to go to D3 to avoid clicks, so
default_power_filterdoes not work here.Quoted 8 lines
This was found on Thinkpad R61i/T61i but I guess it applies to the entire chip. If not, quirks should be set for at least PCI SSID 17aa:20ac.
Thanks to c4pp4 for testing.
Signed-off-by David Henningsson <[email protected]>Thanks, applied now.
Quoted 8 lines
Just wonder, though, whether rather setting
spec->gen.power_down_unused= 1 works. When it's set, the generic parser applies the own power filter, and it doesn't have the EAPD check either (plus it does more aggressive power-down of unused widgets).Or, maybe we just drop the EAPD check, and move it to specific fixup. AFAIK, it was required only for old Gateway laptops.
Quoted 6 lines
If gen.power_down_unused is what is believed to get the best power savings (by powering down more sub-areas of the chip), maybe a reasonable strategy to be to carefully move towards making gen.power_down_unused the default, first for the stuff that we have hw for and can test, or the new chips that we add, and if that works out fine we could try activate it for older chips too.
Yes,
power_down_unusedis pretty aggressive, and should be enabled selectively. (And this can be enabled even now with a hint string.)OTOH, EAPD check we had was really a workaround for some old machines, AFAIK, only for Gateway machines. This can be disabled as default like the patch below. But it's the thing for post-3.9, just to be safer.
thanks,
Takashi
---
sound/pci/hda/hda_codec.c +4
-5@@ -1296,8 +1296,6 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec,static unsigned int hda_set_power_state (struct hda_codec *codec,unsigned int power_state); -static unsigned int default_power_filter (struct hda_codec *codec,hda_nid_t nid, -unsigned int power_state);/** * snd_hda_codec_new - create a HDA codec @@ -1418,7 +1416,6 @@ int snd_hda_codec_new(struct hda_bus *bus,#endif codec->epss =snd_hda_codec_get_supported_ps (codec, fg,AC_PWRST_EPSS ); - codec->power_filter = default_power_filter;/* power-up all before initialization */ hda_set_power_state (codec,AC_PWRST_D0 );@@ -3759,8 +3756,9 @@ static unsigned int hda_sync_power_state(struct hda_codec *codec, }/* don't power down the widget if it controls eapd and EAPD_BTLENABLE is set */ -static unsigned int default_power_filter (struct hda_codec *codec,hda_nid_t nid, -unsigned int power_state) +unsigned int snd_hda_codec_eapd_power_filter (struct hda_codec *codec, +hda_nid_t nid, +unsigned int power_state) { if (power_state == AC_PWRST_D3 && 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, }return power_state; } +EXPORT_SYMBOL_HDA (snd_hda_codec_eapd_power_filter);/* * set power state of the codec, and return the power state
sound/pci/hda/hda_codec.c static void sync_power_up_states(struct hda_codec *codec) · line 3818
Quoted 3 lines
sound/pci/hda/hda_codec.c +0
-0@@ -3817,7 +3816,8 @@ static void sync_power_up_states(struct hda_codec *codec)int i;/* don't care if no or standard filter is used */
I don't mind moving it into patch_stac9200 if you think it's the right thing to do, but if we do, perhaps the default_power_filter / snd_hda_codec_eapd_power_filter function should move there too, and become local to patch_sigmatel.c?
If so the below check has to be changed into yet another flag.
Quoted 46 lines
sound/pci/hda/hda_codec.c +2
-1-if (!codec->power_filter || codec->power_filter == default_power_filter) +if (!codec->power_filter || + codec->power_filter == snd_hda_codec_eapd_power_filter)return ;for (i =0 ; i < codec->num_nodes; i++, nid++) {sound/pci/hda/hda_local.h +4
-0@@ -670,6 +670,10 @@ snd_hda_check_power_state(struct hda_codec *codec, hda_nid_t nid,return (state != target_state); } +unsigned int snd_hda_codec_eapd_power_filter (struct hda_codec *codec, +hda_nid_t nid, +unsigned int power_state); +/* * AMP control callbacks */ sound/pci/hda/patch_conexant.c +0
-1@@ -3350,7 +3350,6 @@ static int patch_conexant_auto(struct hda_codec *codec)switch (codec->vendor_id) {case 0x14f15045 : codec->single_adc_amp =1 ; - codec->power_filter =NULL ;/* Needs speaker amp to D3 to avoid click */ break ;case 0x14f15047 : codec->pin_amp_workaround =1 ;sound/pci/hda/patch_sigmatel.c +1
-0@@ -3774,6 +3774,7 @@ static int patch_stac9200(struct hda_codec *codec) spec->gen.own_eapd_ctl =1 ; codec->patch_ops = stac_patch_ops; + codec->power_filter = snd_hda_codec_eapd_power_filter;snd_hda_add_verbs (codec, stac9200_eapd_init);
Signature · 2 lines
David Henningsson, Canonical Ltd. https://launchpad.net/~diwic
At Mon, 18 Feb 2013 10:40:55 +0100,
Quoted 97 lines · David Henningsson
Quoted 95 lines · Takashi Iwai
At Mon, 18 Feb 2013 10:22:19 +0100,
Quoted 28 lines · David Henningsson
Quoted 17 lines · Takashi Iwai
At Thu, 14 Feb 2013 11:36:39 +0100,
Quoted 4 lines · David Henningsson
This chip needs the speaker pin to go to D3 to avoid clicks, so
default_power_filterdoes not work here.Quoted 8 lines
This was found on Thinkpad R61i/T61i but I guess it applies to the entire chip. If not, quirks should be set for at least PCI SSID 17aa:20ac.
Thanks to c4pp4 for testing.
Signed-off-by David Henningsson <[email protected]>Thanks, applied now.
Quoted 8 lines
Just wonder, though, whether rather setting
spec->gen.power_down_unused= 1 works. When it's set, the generic parser applies the own power filter, and it doesn't have the EAPD check either (plus it does more aggressive power-down of unused widgets).Or, maybe we just drop the EAPD check, and move it to specific fixup. AFAIK, it was required only for old Gateway laptops.
Quoted 6 lines
If gen.power_down_unused is what is believed to get the best power savings (by powering down more sub-areas of the chip), maybe a reasonable strategy to be to carefully move towards making gen.power_down_unused the default, first for the stuff that we have hw for and can test, or the new chips that we add, and if that works out fine we could try activate it for older chips too.
Yes,
power_down_unusedis pretty aggressive, and should be enabled selectively. (And this can be enabled even now with a hint string.)OTOH, EAPD check we had was really a workaround for some old machines, AFAIK, only for Gateway machines. This can be disabled as default like the patch below. But it's the thing for post-3.9, just to be safer.
thanks,
Takashi
---
sound/pci/hda/hda_codec.c +4
-5@@ -1296,8 +1296,6 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec,static unsigned int hda_set_power_state (struct hda_codec *codec,unsigned int power_state); -static unsigned int default_power_filter (struct hda_codec *codec,hda_nid_t nid, -unsigned int power_state);/** * snd_hda_codec_new - create a HDA codec @@ -1418,7 +1416,6 @@ int snd_hda_codec_new(struct hda_bus *bus,#endif codec->epss =snd_hda_codec_get_supported_ps (codec, fg,AC_PWRST_EPSS ); - codec->power_filter = default_power_filter;/* power-up all before initialization */ hda_set_power_state (codec,AC_PWRST_D0 );@@ -3759,8 +3756,9 @@ static unsigned int hda_sync_power_state(struct hda_codec *codec, }/* don't power down the widget if it controls eapd and EAPD_BTLENABLE is set */ -static unsigned int default_power_filter (struct hda_codec *codec,hda_nid_t nid, -unsigned int power_state) +unsigned int snd_hda_codec_eapd_power_filter (struct hda_codec *codec, +hda_nid_t nid, +unsigned int power_state) { if (power_state == AC_PWRST_D3 && 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, }return power_state; } +EXPORT_SYMBOL_HDA (snd_hda_codec_eapd_power_filter);/* * set power state of the codec, and return the power state @@ -3817,7 +3816,8 @@ static void sync_power_up_states(struct hda_codec *codec)int i;
Quoted 6 lines
sound/pci/hda/hda_codec.c static void sync_power_up_states(struct hda_codec *codec) · line 3818
Quoted 1 line
sound/pci/hda/hda_codec.c +0
-0/* don't care if no or standard filter is used */ I don't mind moving it into
patch_stac9200if you think it's the right thing to do, but if we do, perhaps thedefault_power_filter/snd_hda_codec_eapd_power_filterfunction should move there too, and become local topatch_sigmatel.c?
I didn't move it yet, in case where any other codecs / models need the same stuff. Once after we confirm it's really only for Gateway, we can move the stuff to local.
Quoted 6 lines
If so the below check has to be changed into yet another flag.
sound/pci/hda/hda_codec.c static void sync_power_up_states(struct hda_codec *codec) · line 3821
Quoted 4 lines
sound/pci/hda/hda_codec.c +2
-1-if (!codec->power_filter || codec->power_filter == default_power_filter) +if (!codec->power_filter || + codec->power_filter == snd_hda_codec_eapd_power_filter)return ;
Yeah, but also we can omit the check of snd_hda_codec_eapd_power_filter, too. It's only for optimization.
Takashi
Quoted 48 lines
Quoted 41 lines
sound/pci/hda/hda_codec.c +0
-0for (i =0 ; i < codec->num_nodes; i++, nid++) {sound/pci/hda/hda_local.h +4
-0@@ -670,6 +670,10 @@ snd_hda_check_power_state(struct hda_codec *codec, hda_nid_t nid,return (state != target_state); } +unsigned int snd_hda_codec_eapd_power_filter (struct hda_codec *codec, +hda_nid_t nid, +unsigned int power_state); +/* * AMP control callbacks */ sound/pci/hda/patch_conexant.c +0
-1@@ -3350,7 +3350,6 @@ static int patch_conexant_auto(struct hda_codec *codec)switch (codec->vendor_id) {case 0x14f15045 : codec->single_adc_amp =1 ; - codec->power_filter =NULL ;/* Needs speaker amp to D3 to avoid click */ break ;case 0x14f15047 : codec->pin_amp_workaround =1 ;sound/pci/hda/patch_sigmatel.c +1
-0@@ -3774,6 +3774,7 @@ static int patch_stac9200(struct hda_codec *codec) spec->gen.own_eapd_ctl =1 ; codec->patch_ops = stac_patch_ops; + codec->power_filter = snd_hda_codec_eapd_power_filter;snd_hda_add_verbs (codec, stac9200_eapd_init);Signature · 2 lines
David Henningsson, Canonical Ltd. https://launchpad.net/~diwic