Noises from CX20722 codec after reboot

Bug #1487345 reported by David Henningsson
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HWE Next
Fix Released
Undecided
David Henningsson
linux (Ubuntu)
Fix Released
Undecided
David Henningsson

Bug Description

This bug is meant for tracking purposes. Please do not triage.

On shutdown/reboot of CX20722, first shut down all EAPDs, then
shut down the afg node to D3.

Failure to do so can lead to spurious noises from the internal speaker
directly after reboot (and before the codec is reinitialized again, such as in BIOS setup or GRUB menus).

Revision history for this message
David Henningsson (diwic) wrote : [PATCH] ALSA: hda - Shutdown CX20722 on reboot/free to avoid spurious noises

On shutdown/reboot of CX20722, first shut down all EAPDs, then
shut down the afg node to D3.

Failure to do so can lead to spurious noises from the internal speaker
directly after reboot (and before the codec is reinitialized again, i e
in BIOS setup or GRUB menus).

BugLink: https://bugs.launchpad.net/bugs/1487345
Signed-off-by: David Henningsson <email address hidden>
---
 sound/pci/hda/patch_conexant.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index f788a91..ca03c40 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -200,12 +200,33 @@ static int cx_auto_init(struct hda_codec *codec)
  return 0;
 }

-#define cx_auto_free snd_hda_gen_free
+static void cx_auto_reboot_notify(struct hda_codec *codec)
+{
+ struct conexant_spec *spec = codec->spec;
+
+ if (codec->core.vendor_id != 0x14f150f2)
+ return;
+
+ /* Turn the CX20722 codec into D3 to avoid spurious noises
+ from the internal speaker during (and after) reboot */
+ cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
+
+ snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
+ snd_hda_codec_write(codec, codec->core.afg, 0,
+ AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
+}
+
+static void cx_auto_free(struct hda_codec *codec)
+{
+ cx_auto_reboot_notify(codec);
+ snd_hda_gen_free(codec);
+}

 static const struct hda_codec_ops cx_auto_patch_ops = {
  .build_controls = cx_auto_build_controls,
  .build_pcms = snd_hda_gen_build_pcms,
  .init = cx_auto_init,
+ .reboot_notify = cx_auto_reboot_notify,
  .free = cx_auto_free,
  .unsol_event = snd_hda_jack_unsol_event,
 #ifdef CONFIG_PM
--
1.9.1

description: updated
Changed in linux (Ubuntu):
status: New → In Progress
assignee: nobody → David Henningsson (diwic)
Revision history for this message
Takashi Iwai (tiwai) wrote :

On Fri, 21 Aug 2015 09:42:35 +0200,
David Henningsson wrote:
>
> On shutdown/reboot of CX20722, first shut down all EAPDs, then
> shut down the afg node to D3.
>
> Failure to do so can lead to spurious noises from the internal speaker
> directly after reboot (and before the codec is reinitialized again, i e
> in BIOS setup or GRUB menus).
>
> BugLink: https://bugs.launchpad.net/bugs/1487345
> Signed-off-by: David Henningsson <email address hidden>

It's worth for stable, right?

Takashi

> ---
> sound/pci/hda/patch_conexant.c | 23 ++++++++++++++++++++++-
> 1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
> index f788a91..ca03c40 100644
> --- a/sound/pci/hda/patch_conexant.c
> +++ b/sound/pci/hda/patch_conexant.c
> @@ -200,12 +200,33 @@ static int cx_auto_init(struct hda_codec *codec)
> return 0;
> }
>
> -#define cx_auto_free snd_hda_gen_free
> +static void cx_auto_reboot_notify(struct hda_codec *codec)
> +{
> + struct conexant_spec *spec = codec->spec;
> +
> + if (codec->core.vendor_id != 0x14f150f2)
> + return;
> +
> + /* Turn the CX20722 codec into D3 to avoid spurious noises
> + from the internal speaker during (and after) reboot */
> + cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
> +
> + snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
> + snd_hda_codec_write(codec, codec->core.afg, 0,
> + AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
> +}
> +
> +static void cx_auto_free(struct hda_codec *codec)
> +{
> + cx_auto_reboot_notify(codec);
> + snd_hda_gen_free(codec);
> +}
>
> static const struct hda_codec_ops cx_auto_patch_ops = {
> .build_controls = cx_auto_build_controls,
> .build_pcms = snd_hda_gen_build_pcms,
> .init = cx_auto_init,
> + .reboot_notify = cx_auto_reboot_notify,
> .free = cx_auto_free,
> .unsol_event = snd_hda_jack_unsol_event,
> #ifdef CONFIG_PM
> --
> 1.9.1
>

Revision history for this message
David Henningsson (diwic) wrote :

On 2015-08-21 10:26, Takashi Iwai wrote:
> On Fri, 21 Aug 2015 09:42:35 +0200,
> David Henningsson wrote:
>>
>> On shutdown/reboot of CX20722, first shut down all EAPDs, then
>> shut down the afg node to D3.
>>
>> Failure to do so can lead to spurious noises from the internal speaker
>> directly after reboot (and before the codec is reinitialized again, i e
>> in BIOS setup or GRUB menus).
>>
>> BugLink: https://bugs.launchpad.net/bugs/1487345
>> Signed-off-by: David Henningsson <email address hidden>
>
> It's worth for stable, right?

Right, just forgot it.

>
>
> Takashi
>
>> ---
>> sound/pci/hda/patch_conexant.c | 23 ++++++++++++++++++++++-
>> 1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
>> index f788a91..ca03c40 100644
>> --- a/sound/pci/hda/patch_conexant.c
>> +++ b/sound/pci/hda/patch_conexant.c
>> @@ -200,12 +200,33 @@ static int cx_auto_init(struct hda_codec *codec)
>> return 0;
>> }
>>
>> -#define cx_auto_free snd_hda_gen_free
>> +static void cx_auto_reboot_notify(struct hda_codec *codec)
>> +{
>> + struct conexant_spec *spec = codec->spec;
>> +
>> + if (codec->core.vendor_id != 0x14f150f2)
>> + return;
>> +
>> + /* Turn the CX20722 codec into D3 to avoid spurious noises
>> + from the internal speaker during (and after) reboot */
>> + cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
>> +
>> + snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
>> + snd_hda_codec_write(codec, codec->core.afg, 0,
>> + AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
>> +}
>> +
>> +static void cx_auto_free(struct hda_codec *codec)
>> +{
>> + cx_auto_reboot_notify(codec);
>> + snd_hda_gen_free(codec);
>> +}
>>
>> static const struct hda_codec_ops cx_auto_patch_ops = {
>> .build_controls = cx_auto_build_controls,
>> .build_pcms = snd_hda_gen_build_pcms,
>> .init = cx_auto_init,
>> + .reboot_notify = cx_auto_reboot_notify,
>> .free = cx_auto_free,
>> .unsol_event = snd_hda_jack_unsol_event,
>> #ifdef CONFIG_PM
>> --
>> 1.9.1
>>
>

--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

Revision history for this message
Takashi Iwai (tiwai) wrote :

On Fri, 21 Aug 2015 10:27:23 +0200,
David Henningsson wrote:
>
>
>
> On 2015-08-21 10:26, Takashi Iwai wrote:
> > On Fri, 21 Aug 2015 09:42:35 +0200,
> > David Henningsson wrote:
> >>
> >> On shutdown/reboot of CX20722, first shut down all EAPDs, then
> >> shut down the afg node to D3.
> >>
> >> Failure to do so can lead to spurious noises from the internal speaker
> >> directly after reboot (and before the codec is reinitialized again, i e
> >> in BIOS setup or GRUB menus).
> >>
> >> BugLink: https://bugs.launchpad.net/bugs/1487345
> >> Signed-off-by: David Henningsson <email address hidden>
> >
> > It's worth for stable, right?
>
> Right, just forgot it.

OK, applied now. Thanks.

Takashi

>
> >
> >
> > Takashi
> >
> >> ---
> >> sound/pci/hda/patch_conexant.c | 23 ++++++++++++++++++++++-
> >> 1 file changed, 22 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
> >> index f788a91..ca03c40 100644
> >> --- a/sound/pci/hda/patch_conexant.c
> >> +++ b/sound/pci/hda/patch_conexant.c
> >> @@ -200,12 +200,33 @@ static int cx_auto_init(struct hda_codec *codec)
> >> return 0;
> >> }
> >>
> >> -#define cx_auto_free snd_hda_gen_free
> >> +static void cx_auto_reboot_notify(struct hda_codec *codec)
> >> +{
> >> + struct conexant_spec *spec = codec->spec;
> >> +
> >> + if (codec->core.vendor_id != 0x14f150f2)
> >> + return;
> >> +
> >> + /* Turn the CX20722 codec into D3 to avoid spurious noises
> >> + from the internal speaker during (and after) reboot */
> >> + cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
> >> +
> >> + snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
> >> + snd_hda_codec_write(codec, codec->core.afg, 0,
> >> + AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
> >> +}
> >> +
> >> +static void cx_auto_free(struct hda_codec *codec)
> >> +{
> >> + cx_auto_reboot_notify(codec);
> >> + snd_hda_gen_free(codec);
> >> +}
> >>
> >> static const struct hda_codec_ops cx_auto_patch_ops = {
> >> .build_controls = cx_auto_build_controls,
> >> .build_pcms = snd_hda_gen_build_pcms,
> >> .init = cx_auto_init,
> >> + .reboot_notify = cx_auto_reboot_notify,
> >> .free = cx_auto_free,
> >> .unsol_event = snd_hda_jack_unsol_event,
> >> #ifdef CONFIG_PM
> >> --
> >> 1.9.1
> >>
> >
>
> --
> David Henningsson, Canonical Ltd.
> https://launchpad.net/~diwic
>

Changed in linux (Ubuntu):
status: In Progress → Fix Committed
Keng-Yu Lin (lexical)
Changed in hwe-next:
assignee: nobody → David Henningsson (diwic)
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 4.2.0-7.7

---------------
linux (4.2.0-7.7) wily; urgency=low

  [ Tim Gardner ]

  * Release Tracking Bug
    - LP: #1490564
  * rebase to v4.2

  [ Wen Xiong ]

  * SAUCE: ipr: Byte swapping for device_id attribute in sysfs
    - LP: #1453892

  [ Upstream Kernel Changes ]

  * rebase to v4.2
    - LP: #1487345

 -- Tim Gardner <email address hidden> Wed, 26 Aug 2015 07:06:10 -0600

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
Changed in hwe-next:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.