acrn-kernel/sound
Krzysztof Kozlowski cf49b2ff25 ASoC: codecs: wcd938x: fix accessing regmap on unattached devices
[ Upstream commit 84822215ac ]

The WCD938x comes with three devices on two Linux drivers:
1. RX Soundwire device (wcd938x-sdw.c driver),
2. TX Soundwire device, which is used to access devices via regmap (also
   wcd938x-sdw.c driver),
3. platform device (wcd938x.c driver) - glue and component master,
   actually having most of the code using TX Soundwire device regmap.

When RX and TX Soundwire devices probe, the component master (platform
device) bind tries to write micbias configuration via TX Soundwire
regmap.  This might happen before TX Soundwire enumerates, so the regmap
access fails.  On Qualcomm SM8550 board with WCD9385:

  qcom-soundwire 6d30000.soundwire-controller: Qualcomm Soundwire controller v2.0.0 Registered
  wcd938x_codec audio-codec: bound sdw:0:0217:010d:00:4 (ops wcd938x_sdw_component_ops)
  wcd938x_codec audio-codec: bound sdw:0:0217:010d:00:3 (ops wcd938x_sdw_component_ops)
  qcom-soundwire 6ad0000.soundwire-controller: swrm_wait_for_wr_fifo_avail err write overflow

Fix the issue by:
1. Moving the regmap creation from platform device to TX Soundwire
   device.  The regmap settings are moved as-is with one difference:
   making the wcd938x_regmap_config const.
2. Using regmap in cache only mode till the actual TX Soundwire device
   enumerates and then sync the regmap cache.

Cc: <stable@vger.kernel.org> # v3.14+
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Message-Id: <20230503144102.242240-1-krzysztof.kozlowski@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-17 11:53:55 +02:00
..
ac97
aoa
arm
atmel
core ALSA: usb-audio: Fix recursive locking at XRUN during syncing 2023-04-06 12:10:43 +02:00
drivers
firewire ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex() 2023-04-20 12:35:05 +02:00
hda
i2c ALSA: i2c/cs8427: fix iec958 mixer control deactivation 2023-04-20 12:35:05 +02:00
isa
mips
oss
parisc
pci ALSA: hda/realtek: Fix mute and micmute LEDs for an HP laptop 2023-05-11 23:03:39 +09:00
pcmcia
ppc
sh
soc ASoC: codecs: wcd938x: fix accessing regmap on unattached devices 2023-05-17 11:53:55 +02:00
sparc
spi
synth
usb ALSA: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init` 2023-05-17 11:53:37 +02:00
virtio
x86
xen
Kconfig
Makefile
ac97_bus.c
last.c
sound_core.c