Re: [PATCH 5.3 112/112] ASoC: sgtl5000: add ADC mute control

From: Oleksandr Suvorov
Date: Thu Oct 17 2019 - 10:16:21 EST


On Thu, 2019-10-17 at 12:11 +0100, Mark Brown wrote:
> On Thu, Oct 17, 2019 at 09:49:27AM +0000, Oleksandr Suvorov wrote:
>
> > Mark, obviously this is not a NEW feature. This patch adds LOST
> > standard control.
>
> It's a new feature for this CODEC to have control over the capture
> mute,
> other devices have of course had control over it for a long time but
> for
> this device it's a new feature.


All versions of driver sgtl5000 (since creating in 2011) has a bug in
sgtl5000_probe():
...
snd_soc_write(codec, SGTL5000_CHIP_ANA_CTRL,
SGTL5000_HP_ZCD_EN |
SGTL5000_ADC_ZCD_EN);
...
This command rewrites the whole register value instead of just enabling
ZCD feature for headphone and adc.

This register has bits for HP/LineOut/ADC muting, thus sgtl5000_probe()
always unmutes HP/LineOut/ADC.

Because of this bug, HP/LineOut/ADC somehow worked several years: these
blocks unmuted upon the probing of device and never muted again.

And they could not be muted/unmuted - there were no controls for that.

[ IMHO unabling mute/unmute of main codec components is a bug too ].

On 2016, the commit 904a987345258 was introduced and added an ability
to mute/unmute HP/LineOut, but not ADC unfortunately.

On the other hand, the bug in sgtl5000_probe() (HP/LineOut/ADC
unmuting) leads to "pop" sound on driver loading (according to sgtl5000
manual, both HP/LineOut should be muted upon device initialization).

The bugfix 631bc8f0134ae should be applied only after 904a987345258 +
694b14554d75f.

So I see 3 ways:

1. drop this patch and revert 631bc8f0134ae in stable versions 4.19,
5.2, 5.3.
So the bug with unmuting all outputs and ADC on device probing will
still present in all kernel versions that include sgtl500 codec driver.

2. keep 631bc8f0134ae and add 694b14554d75f to 4.19, 5.2 and 5.3.

3. add 631bc8f0134ae to 4.4, 4.9 and 4.14
add 694b14554d75f to 4.4-5.3
add 904a987345258 to 4.4
So this bug will be fixed in all supported versions.