Skip to contentSkip to conversation

CS4206 and S/PDIF (again)

PATCH In review Arun Raghavan 4 participants 17 messages Mar 1, 2011 – Mar 4, 2011 Sound

lore
Share & tools
lore
#0 lore raw

Hello,
I saw an earlier thread where someone with a MacBook Pro 6.2 couldn't get S/PDIF working. I'm facing the same problem on my MacBook Pro 5.5. I know this used to work at some point because the LED from the digital out used to glow (but my last recollection of this is from ca. Jan 2010, so not too helpful).

I tried jiggling some controls in hda-analyzer, but I don't yet know enough about this to be sure what I was doing made any sense.

I've uploaded alsa-info [1] and codecgraph [2] outout, and would really appreciate help figuring out how I can go about debugging this problem.

[1] http://people.collabora.co.uk/~arun/alsa-info.txt
[2] http://people.collabora.co.uk/~arun/cs4206-mbp55.svg

Cheers,
Arun

p.s.: fwiw, I'm testing with a: aplay -v -D iec958:CARD=NVidia,DEV=0 SURROUNDTEST_011212.wav

#1 lore raw
Quoted 6 lines · Arun Raghavan

Hello,
I saw an earlier thread where someone with a MacBook Pro 6.2 couldn't get S/PDIF working. I'm facing the same problem on my MacBook Pro 5.5. I know this used to work at some point because the LED from the digital out used to glow (but my last recollection of this is from ca. Jan 2010, so not too helpful).

Another thing that's unlikely to be helpful. Occasionally, jiggling the headphone jack causes the light to blink once.

-- Arun

#2 lore raw
Quoted 10 lines · Arun Raghavan
Quoted 6 lines · Arun Raghavan

Hello,
I saw an earlier thread where someone with a MacBook Pro 6.2 couldn't get S/PDIF working. I'm facing the same problem on my MacBook Pro 5.5. I know this used to work at some point because the LED from the digital out used to glow (but my last recollection of this is from ca. Jan 2010, so not too helpful).

Another thing that's unlikely to be helpful. Occasionally, jiggling the headphone jack causes the light to blink once.

I meant headphone mixer control, sorry.

-- Arun

#3 lore raw
In reply to Arun Raghavan

I bisected this down to the erratum fix added in commit a769cbcf. From what I can tell, the erratum only applies to CS4207, so I'm attaching a patch to make the fix conditional. CC'ing the author of that commit to verify that this is correct.

Cheers,
Arun

#4 lore raw

PATCH 1/1 ALSA: hda - apply CS420X erratum fix for CS4207 only

From: Arun Raghavan <[email protected]>

The commit a769cbcf60cee51f4431c0938acd39e7e5b76b8d
ALSA: hda - Add errata initverb sequence for CS42xx codecs
applies a fix for a chip erratum that is specific to CS4207 unconditionally. On CS4206, this causes digital output to never be activated.

---
 sound/pci/hda/patch_cirrus.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
sound/pci/hda/patch_cirrus.c +3 -2
index a07b031..9804b09 100644
@@ -1065,8 +1065,9 @@ static int cs_init(struct hda_codec *codec)
 {
 	struct cs_spec *spec = codec->spec;
 
-	/* init_verb sequence for C0/C1/C2 errata*/
-	snd_hda_sequence_write(codec, cs_errata_init_verbs);
+	/* init_verb sequence for CS4207 C0/C1/C2 errata */
+	if (codec->vendor_id == 0x10134207)
+		snd_hda_sequence_write(codec, cs_errata_init_verbs);
 
 	snd_hda_sequence_write(codec, cs_coef_init_verbs);
 
Signature · 1 line
1.7.4.1
#5 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

That should not happen. This sequence was tested on all version of cs420x

Is there some output of the failure you can report?

Quoted 31 lines · Arun Raghavan

From: Arun Raghavan <[email protected]>

The commit a769cbcf60cee51f4431c0938acd39e7e5b76b8d
ALSA: hda - Add errata initverb sequence for CS42xx codecs
applies a fix for a chip erratum that is specific to CS4207 unconditionally. On CS4206, this causes digital output to never be activated.
---
sound/pci/hda/patch_cirrus.c | 5 +++--

1 files changed, 3 insertions(+), 2 deletions(-)
sound/pci/hda/patch_cirrus.c +3 -2
index a07b031..9804b09 100644
@@ -1065,8 +1065,9 @@ static int cs_init(struct hda_codec *codec)
 {
    struct cs_spec *spec = codec->spec;
 
-    /* init_verb sequence for C0/C1/C2 errata*/
-    snd_hda_sequence_write(codec, cs_errata_init_verbs);
+    /* init_verb sequence for CS4207 C0/C1/C2 errata */
+    if (codec->vendor_id == 0x10134207)
+        snd_hda_sequence_write(codec, cs_errata_init_verbs);
 
    snd_hda_sequence_write(codec, cs_coef_init_verbs);
 
Signature · 1 line
1.7.4.1
#6 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

Quoted 4 lines · Brian

That should not happen. This sequence was tested on all version of cs420x

Is there some output of the failure you can report?

Yes, no SPDIF out from my MBP 6,2 if the sequence is enabled. Then, MBP might be using special version of CS4206. :) If this is true, then, exclude MacBookPro6,2 from loading the errata code.

Thank you.

#7 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

In reply to Austin, Brian
Quoted 3 lines · Brian

That should not happen. This sequence was tested on all version of cs420x

Is there some output of the failure you can report?

I haven't seen any output on failure (other than the fact that the digital out never comes on if this sequence is used). My hardware is a MacBook Pro 5.5 (and another person sees this line causing the same issue for them on the MBP .62 as well).

-- Arun

#8 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

In reply to Arun Raghavan

At Thu, 3 Mar 2011 03:18:18 +0530,

Quoted 8 lines · Arun Raghavan

From: Arun Raghavan <[email protected]>

The commit a769cbcf60cee51f4431c0938acd39e7e5b76b8d
ALSA: hda - Add errata initverb sequence for CS42xx codecs
applies a fix for a chip erratum that is specific to CS4207 unconditionally. On CS4206, this causes digital output to never be activated.

It might be the power-state the verb table sets? Try to comment out only the line setting SPDIF Tx to D3,
{0x08, AC_VERB_SET_POWER_STATE, 0x03}
instead of disabling the whole verbs, just for testing.

thanks,

Takashi

#9 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

Quoted 11 lines · Takashi Iwai

At Thu, 3 Mar 2011 03:18:18 +0530,

Quoted 8 lines · Arun Raghavan

From: Arun Raghavan <[email protected]>

The commit a769cbcf60cee51f4431c0938acd39e7e5b76b8d
ALSA: hda - Add errata initverb sequence for CS42xx codecs
applies a fix for a chip erratum that is specific to CS4207 unconditionally. On CS4206, this causes digital output to never be activated.

Quoted 4 lines

It might be the power-state the verb table sets? Try to comment out only the line setting SPDIF Tx to D3,
{0x08, AC_VERB_SET_POWER_STATE, 0x03}
instead of disabling the whole verbs, just for testing.

Indeed, this also works.

-- Arun

#10 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

At Thu, 03 Mar 2011 17:50:22 +0530,

Quoted 13 lines · Arun Raghavan
Quoted 11 lines · Takashi Iwai

At Thu, 3 Mar 2011 03:18:18 +0530,

Quoted 8 lines · Arun Raghavan

From: Arun Raghavan <[email protected]>

The commit a769cbcf60cee51f4431c0938acd39e7e5b76b8d
ALSA: hda - Add errata initverb sequence for CS42xx codecs
applies a fix for a chip erratum that is specific to CS4207 unconditionally. On CS4206, this causes digital output to never be activated.

Quoted 6 lines
Quoted 4 lines

It might be the power-state the verb table sets? Try to comment out only the line setting SPDIF Tx to D3,
{0x08, AC_VERB_SET_POWER_STATE, 0x03}
instead of disabling the whole verbs, just for testing.

Indeed, this also works.

OK, to be sure, try the patch below.

thanks,

Takashi

---
From: Takashi Iwai <[email protected]>
Date: Thu, 3 Mar 2011 14:54:19 +0100
Subject: [PATCH] ALSA: hda - Don't set to D3 in Cirrus errata init verbs

The errata init verbs for CS42xx codecs contain the verbs to set the power-state of SPDIF nodes to D3, which seem to break the SPDIF output on some MacBooks. Since this is executed during the power-up initialization, we shouldn't turn them down there.

---
 sound/pci/hda/patch_cirrus.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
sound/pci/hda/patch_cirrus.c +2 -0
index a07b031..067982f 100644
@@ -1039,9 +1039,11 @@ static struct hda_verb cs_errata_init_verbs[] = {
 	{0x11, AC_VERB_SET_PROC_COEF, 0x0008},
 	{0x11, AC_VERB_SET_PROC_STATE, 0x00},
 
+#if 0 /* Don't to set to D3 as we are in power-up sequence */
 	{0x07, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Rx: D3 */
 	{0x08, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Tx: D3 */
 	/*{0x01, AC_VERB_SET_POWER_STATE, 0x03},*/ /* AFG: D3 This is already handled */
+#endif
 
 	{} /* terminator */
 };
Signature · 1 line
1.7.3.4
#11 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

Quoted 15 lines · Takashi Iwai

At Thu, 03 Mar 2011 17:50:22 +0530,

Quoted 13 lines · Arun Raghavan
Quoted 11 lines · Takashi Iwai

At Thu, 3 Mar 2011 03:18:18 +0530,

Quoted 8 lines · Arun Raghavan

From: Arun Raghavan <[email protected]>

The commit a769cbcf60cee51f4431c0938acd39e7e5b76b8d
ALSA: hda - Add errata initverb sequence for CS42xx codecs
applies a fix for a chip erratum that is specific to CS4207 unconditionally. On CS4206, this causes digital output to never be activated.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

It might be the power-state the verb table sets? Try to comment out only the line setting SPDIF Tx to D3,
{0x08, AC_VERB_SET_POWER_STATE, 0x03}
instead of disabling the whole verbs, just for testing.

Indeed, this also works.

OK, to be sure, try the patch below.

Yep, works just fine.

Thanks,
Arun

#12 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

At Thu, 03 Mar 2011 19:37:52 +0530,

Quoted 22 lines · Arun Raghavan
Quoted 20 lines · Takashi Iwai

At Thu, 03 Mar 2011 17:50:22 +0530,

Quoted 18 lines · Arun Raghavan
Quoted 15 lines · Takashi Iwai

At Thu, 3 Mar 2011 03:18:18 +0530,

Quoted 8 lines · Arun Raghavan

From: Arun Raghavan <[email protected]>

The commit a769cbcf60cee51f4431c0938acd39e7e5b76b8d
ALSA: hda - Add errata initverb sequence for CS42xx codecs
applies a fix for a chip erratum that is specific to CS4207 unconditionally. On CS4206, this causes digital output to never be activated.

It might be the power-state the verb table sets? Try to comment out only the line setting SPDIF Tx to D3,
{0x08, AC_VERB_SET_POWER_STATE, 0x03}
instead of disabling the whole verbs, just for testing.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Indeed, this also works.

OK, to be sure, try the patch below.

Yep, works just fine.

Thanks for checking. Merged now to sound git tree.

Takashi

#13 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

So the verb sequence that this refers to needs to be done _before_ the controls are built. If the controls are built, then this sequence can clobber some outputs and inputs. It's my fault, I didn¹t put this code in the correct place. This sequence should go into the beginning of cs_build_controls() so that it is run before build_output and build_input are called.

I can make the changes to fix this.

Thanks again for the help
Brian

Quoted 36 lines · Takashi Iwai

At Thu, 03 Mar 2011 19:37:52 +0530,

Quoted 23 lines · Arun Raghavan
Quoted 13 lines · Takashi Iwai

At Thu, 03 Mar 2011 17:50:22 +0530,

Quoted 11 lines · Arun Raghavan
Quoted 9 lines · Takashi Iwai

At Thu, 3 Mar 2011 03:18:18 +0530,

Quoted 7 lines · Arun Raghavan

From: Arun Raghavan <[email protected]>

The commit a769cbcf60cee51f4431c0938acd39e7e5b76b8d
ALSA: hda - Add errata initverb sequence for CS42xx codecs
applies a fix for a chip erratum that is specific to CS4207 unconditionally. On CS4206, this causes digital output to never

be

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

activated.

It might be the power-state the verb table sets? Try to comment out only the line setting SPDIF Tx to D3,
{0x08, AC_VERB_SET_POWER_STATE, 0x03}
instead of disabling the whole verbs, just for testing.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Indeed, this also works.

OK, to be sure, try the patch below.

Yep, works just fine.

Thanks for checking. Merged now to sound git tree.

Takashi

#14 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

At Thu, 3 Mar 2011 18:49:42 +0000,

Quoted 7 lines · Brian

So the verb sequence that this refers to needs to be done _before_ the controls are built. If the controls are built, then this sequence can clobber some outputs and inputs. It's my fault, I didn¹t put this code in the correct place. This sequence should go into the beginning of cs_build_controls() so that it is run before build_output and build_input are called.

The init is actually called before build_controls. So this should be fine as is.

The problem was that this verb is a part of initialization after the power-status change. The power-status change is done before calling the init (otherwise the tree-parsing might fail), and the power-status isn't changed in the init itself.

thanks,

Takashi

Quoted 46 lines

I can make the changes to fix this.

Thanks again for the help
Brian

Quoted 36 lines · Takashi Iwai

At Thu, 03 Mar 2011 19:37:52 +0530,

Quoted 23 lines · Arun Raghavan
Quoted 13 lines · Takashi Iwai

At Thu, 03 Mar 2011 17:50:22 +0530,

Quoted 11 lines · Arun Raghavan
Quoted 9 lines · Takashi Iwai

At Thu, 3 Mar 2011 03:18:18 +0530,

Quoted 7 lines · Arun Raghavan

From: Arun Raghavan <[email protected]>

The commit a769cbcf60cee51f4431c0938acd39e7e5b76b8d
ALSA: hda - Add errata initverb sequence for CS42xx codecs
applies a fix for a chip erratum that is specific to CS4207 unconditionally. On CS4206, this causes digital output to never

be

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

activated.

It might be the power-state the verb table sets? Try to comment out only the line setting SPDIF Tx to D3,
{0x08, AC_VERB_SET_POWER_STATE, 0x03}
instead of disabling the whole verbs, just for testing.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Indeed, this also works.

OK, to be sure, try the patch below.

Yep, works just fine.

Thanks for checking. Merged now to sound git tree.

Takashi

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#15 lore raw

Re: [PATCH] ALSA: hda - apply CS420X erratum fix for CS4207 only

In reply to Takashi Iwai

I am happy to report, that the patch works on my MacBookPro6,2 with vanilla Linux 2.6.37.

Arigatou Gozaimasita. :)
Thank you.

Quoted 39 lines · Takashi Iwai

OK, to be sure, try the patch below.

thanks,

Takashi

---
From: Takashi Iwai <[email protected]>
Date: Thu, 3 Mar 2011 14:54:19 +0100
Subject: [PATCH] ALSA: hda - Don't set to D3 in Cirrus errata init verbs

The errata init verbs for CS42xx codecs contain the verbs to set the power-state of SPDIF nodes to D3, which seem to break the SPDIF output on some MacBooks. Since this is executed during the power-up initialization, we shouldn't turn them down there.

---
 sound/pci/hda/patch_cirrus.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
sound/pci/hda/patch_cirrus.c +2 -0
index a07b031..067982f 100644
@@ -1039,9 +1039,11 @@ static struct hda_verb cs_errata_init_verbs[] = {
 	{0x11, AC_VERB_SET_PROC_COEF, 0x0008},
 	{0x11, AC_VERB_SET_PROC_STATE, 0x00},
 
+#if 0 /* Don't to set to D3 as we are in power-up sequence */
 	{0x07, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Rx: D3 */
 	{0x08, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Tx: D3 */
 	/*{0x01, AC_VERB_SET_POWER_STATE, 0x03},*/ /* AFG: D3 This is already handled */
+#endif
 
 	{} /* terminator */
 };
#16 lore raw
In reply to Arun Raghavan

The verb sequence works for all 420x versions and has no impact on which version it is applied to.

Brian

Quoted 9 lines · Arun Raghavan

I bisected this down to the erratum fix added in commit a769cbcf. From what I can tell, the erratum only applies to CS4207, so I'm attaching a patch to make the fix conditional. CC'ing the author of that commit to verify that this is correct.

Cheers,
Arun