linux-stable/sound/soc
Paweł Anikiel 6d1ecded01 ASoC: ssm2602: Add workaround for playback distortions
[ Upstream commit f63550e2b1 ]

Apply a workaround for what appears to be a hardware quirk.

The problem seems to happen when enabling "whole chip power" (bit D7
register R6) for the very first time after the chip receives power. If
either "output" (D4) or "DAC" (D3) aren't powered on at that time,
playback becomes very distorted later on.

This happens on the Google Chameleon v3, as well as on a ZYBO Z7-10:
https://ez.analog.com/audio/f/q-a/543726/solved-ssm2603-right-output-offset-issue/480229
I suspect this happens only when using an external MCLK signal (which
is the case for both of these boards).

Here are some experiments run on a Google Chameleon v3. These were run
in userspace using a wrapper around the i2cset utility:
ssmset() {
        i2cset -y 0 0x1a $(($1*2)) $2
}

For each of the following sequences, we apply power to the ssm2603
chip, set the configuration registers R0-R5 and R7-R8, run the selected
sequence, and check for distortions on playback.

  ssmset 0x09 0x01 # core
  ssmset 0x06 0x07 # chip, out, dac
  OK

  ssmset 0x09 0x01 # core
  ssmset 0x06 0x87 # out, dac
  ssmset 0x06 0x07 # chip
  OK

  (disable MCLK)
  ssmset 0x09 0x01 # core
  ssmset 0x06 0x1f # chip
  ssmset 0x06 0x07 # out, dac
  (enable MCLK)
  OK

  ssmset 0x09 0x01 # core
  ssmset 0x06 0x1f # chip
  ssmset 0x06 0x07 # out, dac
  NOT OK

  ssmset 0x06 0x1f # chip
  ssmset 0x09 0x01 # core
  ssmset 0x06 0x07 # out, dac
  NOT OK

  ssmset 0x09 0x01 # core
  ssmset 0x06 0x0f # chip, out
  ssmset 0x06 0x07 # dac
  NOT OK

  ssmset 0x09 0x01 # core
  ssmset 0x06 0x17 # chip, dac
  ssmset 0x06 0x07 # out
  NOT OK

For each of the following sequences, we apply power to the ssm2603
chip, run the selected sequence, issue a reset with R15, configure
R0-R5 and R7-R8, run one of the NOT OK sequences from above, and check
for distortions.

  ssmset 0x09 0x01 # core
  ssmset 0x06 0x07 # chip, out, dac
  OK

  (disable MCLK)
  ssmset 0x09 0x01 # core
  ssmset 0x06 0x07 # chip, out, dac
  (enable MCLK after reset)
  NOT OK

  ssmset 0x09 0x01 # core
  ssmset 0x06 0x17 # chip, dac
  NOT OK

  ssmset 0x09 0x01 # core
  ssmset 0x06 0x0f # chip, out
  NOT OK

  ssmset 0x06 0x07 # chip, out, dac
  NOT OK

Signed-off-by: Paweł Anikiel <pan@semihalf.com
Link: https://lore.kernel.org/r/20230508113037.137627-8-pan@semihalf.com
Signed-off-by: Mark Brown <broonie@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-09 10:22:50 +02:00
..
adi
amd
atmel ASoC: atmel: Add missing of_node_put() in at91sam9g20ek_audio_probe 2022-04-20 09:08:15 +02:00
au1x ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read() 2018-04-26 11:02:03 +02:00
bcm
blackfin
cirrus ASoC: cirrus: i2s: Fix {TX|RX}LinCtrlData setup 2018-07-03 11:24:48 +02:00
codecs ASoC: ssm2602: Add workaround for playback distortions 2023-06-09 10:22:50 +02:00
davinci ASoC: ti: davinci-i2s: Add check for clk_enable() 2022-04-20 09:08:14 +02:00
dwc ASoC: dwc: limit the number of overrun messages 2023-06-09 10:22:49 +02:00
fsl ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API 2022-10-26 13:17:01 +02:00
generic
hisilicon ASoC: hisilicon: fix missing clk_disable_unprepare() on error in hi6210_i2s_startup() 2021-07-20 16:17:39 +02:00
img
intel ASoC: Intel: Skylake: Fix declaration of enum skl_ch_cfg 2023-06-09 10:22:48 +02:00
jz4740 ASoC: jz4740-i2s: add missed checks for clk_get() 2020-12-29 13:46:58 +01:00
kirkwood ASoC: kirkwood: Iterate over array indexes instead of using pointer math 2023-03-11 16:26:43 +01:00
mediatek ASoC: mediatek: mt8173-rt5650-rt5514: fix refcount leak in mt8173_rt5650_rt5514_dev_probe() 2023-01-18 09:26:33 +01:00
mxs ASoC: mxs-saif: Fix refcount leak in mxs_saif_probe 2022-06-14 16:53:49 +02:00
nuc900
omap ASoC: omap-dmic: Add pm_qos handling to avoid overruns with CPU_IDLE 2018-12-17 09:28:50 +01:00
pxa ASoC: pxa: fix null-pointer dereference in filter() 2023-01-18 09:26:13 +01:00
qcom ASoC: qcom: lpass-platform: Fix memory leak 2020-11-24 13:05:49 +01:00
rockchip ASoC: rockchip: spdif: Add missing clk_disable_unprepare() in rk_spdif_runtime_resume() 2023-01-18 09:26:34 +01:00
samsung ASoC: samsung: idma: Check of ioremap return value 2022-01-27 09:00:53 +01:00
sh ASoC: fsi: Add check for clk_enable 2022-04-20 09:08:15 +02:00
sirf ASoC: sirf: Fix potential NULL pointer dereference 2018-09-05 09:26:39 +02:00
spear
sti ASoC: sti: fix possible sleep-in-atomic 2020-02-05 14:18:20 +00:00
stm ASoC: stm32: spdifrx: fix race condition in irq handler 2020-01-17 19:45:44 +01:00
sunxi ASoC: sunxi: sun4i-codec: fill ASoC card owner 2021-04-16 11:57:50 +02:00
tegra ASoC: tegra: Set driver_name=tegra for all machine drivers 2021-07-20 16:17:46 +02:00
txx9
ux500
xtensa
zte ASoC: zte: Fix incorrect PCM format bit usages 2018-09-05 09:26:39 +02:00
Kconfig
Makefile
soc-ac97.c
soc-cache.c
soc-compress.c ASoC: soc-compress.c: fixup private_data on snd_soc_new_compress() 2023-03-11 16:26:39 +01:00
soc-core.c ASoC: core: Fix use-after-free in snd_soc_exit() 2022-11-25 17:36:49 +01:00
soc-dapm.c ASoC: dapm: Don't fold register value changes into notifications 2022-06-14 16:53:45 +02:00
soc-devres.c
soc-generic-dmaengine-pcm.c ASoC: dmaengine: Restore NULL prepare_slave_config() callback 2022-05-12 12:17:10 +02:00
soc-io.c
soc-jack.c ASoC: Jack: Fix NULL pointer dereference in snd_soc_jack_report 2019-12-17 20:39:27 +01:00
soc-ops.c ASoC: ops: Correct bounds check for second channel on SX controls 2023-01-18 09:26:05 +01:00
soc-pcm.c ASoC: soc-pcm: Add NULL check in BE reparenting 2022-12-14 11:26:12 +01:00
soc-topology.c ASoC: topology: Allow TLV control to be either read or write 2022-04-20 09:08:25 +02:00
soc-utils.c ASoC: soc-utils: Remove __exit for snd_soc_util_exit() 2022-11-25 17:36:49 +01:00