Skip to contentSkip to conversation

ASoC: wm8962: Correct the bit offset to enable mono speaker output

PATCH In review Nicolin Chen 5 participants 8 messages Aug 7, 2014 – Aug 13, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: wm8962: Correct the bit offset to enable mono speaker output

As WM8962 datasheet describes for SPK_MONO bit of R51: When SPK_MONO is set to '1', both speakers output the signal from the left channel.

So for mono speaker widget, we shall enable Left Channel whose enable bit is 6 instead of 7 (Right Channel).

This patches just simply corrects the bit offset.

---

@Peter
I cced you just to let you know that I'm merging your fix to upstream. And because you patch can't be applied to the upstream tree directly, I used my own commit with your signed-off. Thank you for the fix.

 sound/soc/codecs/wm8962.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8962.c +1 -1
index 1098ae3..105deec 100644
@@ -2185,7 +2185,7 @@ SND_SOC_DAPM_MIXER("Speaker Mixer", WM8962_MIXER_ENABLES, 1, 0,
 		   spkmixl, ARRAY_SIZE(spkmixl)),
 SND_SOC_DAPM_MUX_E("Speaker PGA", WM8962_PWR_MGMT_2, 4, 0, &spkoutl_mux,
 		   out_pga_event, SND_SOC_DAPM_POST_PMU),
-SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 7, 0, NULL, 0),
+SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 6, 0, NULL, 0),
 SND_SOC_DAPM_OUTPUT("SPKOUT"),
 };
 
Signature · 1 line
1.8.4
maintainer
#1 lore raw
Quoted 8 lines · Nicolin Chen

As WM8962 datasheet describes for SPK_MONO bit of R51: When SPK_MONO is set to '1', both speakers output the signal from the left channel.

So for mono speaker widget, we shall enable Left Channel whose enable bit is 6 instead of 7 (Right Channel).

This patches just simply corrects the bit offset.

sound/soc/codecs/wm8962.c SND_SOC_DAPM_MIXER("Speaker Mixer", WM8962_MIXER_ENABLES, 1, 0, · line 2190

Quoted 7 lines
sound/soc/codecs/wm8962.c +1 -1
 		   spkmixl, ARRAY_SIZE(spkmixl)),
 SND_SOC_DAPM_MUX_E("Speaker PGA", WM8962_PWR_MGMT_2, 4, 0, &spkoutl_mux,
 		   out_pga_event, SND_SOC_DAPM_POST_PMU),
-SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 7, 0, NULL, 0),
+SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 6, 0, NULL, 0),
 SND_SOC_DAPM_OUTPUT("SPKOUT"),
 };

Someone who's name I'd need to look up submitted an identical fix off list recently - I checked the datasheet and it seems that in mono mode the speaker output actually wants both left and right channels active so there is a bug here but this isn't the fix.

#2 lore raw
Quoted 9 lines · Mark Brown
Quoted 7 lines · Nicolin Chen

As WM8962 datasheet describes for SPK_MONO bit of R51: When SPK_MONO is set to '1', both speakers output the signal from the left channel.

So for mono speaker widget, we shall enable Left Channel whose enable bit is 6 instead of 7 (Right Channel).

This patches just simply corrects the bit offset.

Quoted 12 lines

sound/soc/codecs/wm8962.c SND_SOC_DAPM_MIXER("Speaker Mixer", WM8962_MIXER_ENABLES, 1, 0, · line 2190

Quoted 7 lines
sound/soc/codecs/wm8962.c +1 -1
 		   spkmixl, ARRAY_SIZE(spkmixl)),
 SND_SOC_DAPM_MUX_E("Speaker PGA", WM8962_PWR_MGMT_2, 4, 0, &spkoutl_mux,
 		   out_pga_event, SND_SOC_DAPM_POST_PMU),
-SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 7, 0, NULL, 0),
+SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 6, 0, NULL, 0),
 SND_SOC_DAPM_OUTPUT("SPKOUT"),
 };

Someone who's name I'd need to look up submitted an identical fix off list recently - I checked the datasheet and it seems that in mono mode the speaker output actually wants both left and right channels active so there is a bug here but this isn't the fix.

I rechecked the datasheet and found that the hardware needs to tie both outputs and enable both bits. So the patch should be invalid.

But our customer reported that they did try to set both SPKOUTR_ENA and SPKOUTL_ENA bits in mono mode but the sound is lousy. If setting SPKOUTR_ENA alone, the speaker has no sound. Only setting SPKOUTL_ENA bit get the correct speaker output in mono mode.

And I just confirmed with our engineer who supports the customer that they are using the correct hardware design as the datasheet suggests. So I'm wondering if there's any other part we're missing.

Thank you
Nicolin

#3 lore raw

I have a question about the wm8962 mono speaker mode. In SPK_MONO description at table 73, it says "When SPK_MONO is enabled, both speakers output the signal from the left channel". Does it mean only the left channel control the output in mono speaker mode?

Thanks,
Peter

-----Original Message-----
From: Nicolin Chen [mailto:[email protected]]
Sent: Friday, August 08, 2014 4:21 PM
To: Mark Brown
Cc: Nicolin Chen; [email protected]; [email protected]; [email protected]; Wang Shengjiu-B02247; [email protected]; [email protected]; CHAN Peter-B18700; [email protected]; [email protected]
Subject: Re: [alsa-devel] [PATCH] ASoC: wm8962: Correct the bit offset to enable mono speaker output

Quoted 9 lines · Mark Brown
Quoted 7 lines · Nicolin Chen

As WM8962 datasheet describes for SPK_MONO bit of R51: When SPK_MONO is set to '1', both speakers output the signal from the left channel.

So for mono speaker widget, we shall enable Left Channel whose enable bit is 6 instead of 7 (Right Channel).

This patches just simply corrects the bit offset.

Quoted 14 lines

sound/soc/codecs/wm8962.c SND_SOC_DAPM_MIXER("Speaker Mixer", WM8962_MIXER_ENABLES, 1, 0, · line 2190

Quoted 9 lines

spkmixl, ARRAY_SIZE(spkmixl)), SND_SOC_DAPM_MUX_E("Speaker
PGA", WM8962_PWR_MGMT_2, 4, 0, &spkoutl_mux,

(quoted diff) +0 -1
 		   out_pga_event, SND_SOC_DAPM_POST_PMU), 
-SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 7, 0, 

NULL, 0),

sound/soc/codecs/wm8962.c +2 -0
+SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 6, 0, 
+NULL, 0),
 SND_SOC_DAPM_OUTPUT("SPKOUT"),
 };

Someone who's name I'd need to look up submitted an identical fix off list recently - I checked the datasheet and it seems that in mono mode the speaker output actually wants both left and right channels active so there is a bug here but this isn't the fix.

I rechecked the datasheet and found that the hardware needs to tie both outputs and enable both bits. So the patch should be invalid.

But our customer reported that they did try to set both SPKOUTR_ENA and SPKOUTL_ENA bits in mono mode but the sound is lousy. If setting SPKOUTR_ENA alone, the speaker has no sound. Only setting SPKOUTL_ENA bit get the correct speaker output in mono mode.

And I just confirmed with our engineer who supports the customer that they are using the correct hardware design as the datasheet suggests. So I'm wondering if there's any other part we're missing.

Thank you
Nicolin

#4 lore raw
Quoted 37 lines · Peter Chan

I have a question about the wm8962 mono speaker mode. In SPK_MONO description at table 73, it says "When SPK_MONO is enabled, both speakers output the signal from the left channel". Does it mean only the left channel control the output in mono speaker mode?

Thanks,
Peter

-----Original Message-----
From: Nicolin Chen [mailto:[email protected]]
Sent: Friday, August 08, 2014 4:21 PM
To: Mark Brown
Cc: Nicolin Chen; [email protected]; [email protected]; [email protected]; Wang Shengjiu-B02247; [email protected]; [email protected]; CHAN Peter-B18700; [email protected]; [email protected]
Subject: Re: [alsa-devel] [PATCH] ASoC: wm8962: Correct the bit offset to enable mono speaker output

Quoted 9 lines · Mark Brown
Quoted 7 lines · Nicolin Chen

As WM8962 datasheet describes for SPK_MONO bit of R51: When SPK_MONO is set to '1', both speakers output the signal from the left channel.

So for mono speaker widget, we shall enable Left Channel whose enable bit is 6 instead of 7 (Right Channel).

This patches just simply corrects the bit offset.

Quoted 14 lines

sound/soc/codecs/wm8962.c SND_SOC_DAPM_MIXER("Speaker Mixer", WM8962_MIXER_ENABLES, 1, 0, · line 2190

Quoted 9 lines

spkmixl, ARRAY_SIZE(spkmixl)), SND_SOC_DAPM_MUX_E("Speaker
PGA", WM8962_PWR_MGMT_2, 4, 0, &spkoutl_mux,

(quoted diff) +0 -1
 		   out_pga_event, SND_SOC_DAPM_POST_PMU), 
-SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 7, 0, 

NULL, 0),

sound/soc/codecs/wm8962.c +2 -0
+SND_SOC_DAPM_PGA("Speaker Output", WM8962_CLASS_D_CONTROL_1, 6, 0, 
+NULL, 0),
 SND_SOC_DAPM_OUTPUT("SPKOUT"),
 };

Someone who's name I'd need to look up submitted an identical fix off list recently - I checked the datasheet and it seems that in mono mode the speaker output actually wants both left and right channels active so there is a bug here but this isn't the fix.

Quoted 5 lines

I rechecked the datasheet and found that the hardware needs to tie both outputs and enable both bits. So the patch should be invalid.

But our customer reported that they did try to set both SPKOUTR_ENA and SPKOUTL_ENA bits in mono mode but the sound is lousy. If setting SPKOUTR_ENA alone, the speaker has no sound. Only setting SPKOUTL_ENA bit get the correct speaker output in mono mode.

From the wording of "tie both outputs together" in the datasheet

I would assume that means both should be fed the same audio? Was this done? I will try to give the hardware guys here a shout and see if I can get some clarification on mono mode on this device.

Thanks,
Charles

#5 lore raw
Quoted 8 lines · Charles Keepax
Quoted 2 lines · Peter Chan

But our customer reported that they did try to set both SPKOUTR_ENA and SPKOUTL_ENA bits in mono mode but the sound is lousy. If setting SPKOUTR_ENA alone, the speaker has no sound. Only setting SPKOUTL_ENA bit get the correct speaker output in mono mode.

From the wording of "tie both outputs together" in the datasheet I would assume that means both should be fed the same audio? Was this done? I will try to give the hardware guys here a shout and see if I can get some clarification on mono mode on this device.

I have had a word with the hardware team here and both channels do need to be enabled but audio should only be fed to the left channel. So the driver definitely needs updated for the mono case, but I am unclear as to what is causing your poor audio quality issue.

Thanks,
Charles

maintainer
#6 lore raw
Quoted 7 lines · Charles Keepax
Quoted 4 lines · Charles Keepax

From the wording of "tie both outputs together" in the datasheet I would assume that means both should be fed the same audio? Was this done? I will try to give the hardware guys here a shout and see if I can get some clarification on mono mode on this device.

Quoted 5 lines

I have had a word with the hardware team here and both channels do need to be enabled but audio should only be fed to the left channel. So the driver definitely needs updated for the mono case, but I am unclear as to what is causing your poor audio quality issue.

Overdriving the speaker perhaps?

#7 lore raw

I found that in mono speaker mode, only the left channel is enable. The SPKOUTR_PGA_ENA bit remains 0 in this case. Thus when SPKOUTR_ENA is set, poor sound quality results.

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Wednesday, August 13, 2014 5:58 AM
To: Charles Keepax
Cc: CHAN Peter-B18700; [email protected]; [email protected]; [email protected]; [email protected]; Wang Shengjiu-B02247; [email protected]; Nicolin Chen; Chen Guangyu-B42378; [email protected]
Subject: Re: [alsa-devel] [PATCH] ASoC: wm8962: Correct the bit offset to enable mono speaker output

Quoted 11 lines · Charles Keepax
Quoted 4 lines · Charles Keepax

From the wording of "tie both outputs together" in the datasheet I would assume that means both should be fed the same audio? Was this done? I will try to give the hardware guys here a shout and see if I can get some clarification on mono mode on this device.

I have had a word with the hardware team here and both channels do need to be enabled but audio should only be fed to the left channel. So the driver definitely needs updated for the mono case, but I am unclear as to what is causing your poor audio quality issue.

Overdriving the speaker perhaps?