twx-linux/include/sound
Richard Fitzgerald 769c1b7929
ASoC: cs35l56: Prevent races when soft-resetting using SPI control
When SPI is used for control, the driver must hold the SPI bus lock
while issuing the sequence of writes to perform a soft reset.

>From the time the driver writes the SYSTEM_RESET command until the
driver does a write to terminate the reset, there must not be any
activity on the SPI bus lines. If there is any SPI activity during the
soft-reset, another soft-reset will be triggered. The state of the SPI
chip select is irrelevant.

A repeated soft-reset does not in itself cause any problems, and it is
not an infinite loop. The problem is a race between these resets and
the driver polling for boot completion. There is a time window between
soft resets where the driver could read HALO_STATE as 2 (fully booted)
while the chip is actually soft-resetting. Although this window is
small, it is long enough that it is possible to hit it in normal
operation.

To prevent this race and ensure the chip really is fully booted, the
driver calls spi_bus_lock() to prevent other activity while resetting.
It then issues the SYSTEM_RESET mailbox command. After allowing
sufficient time for reset to take effect, the driver issues a PING
mailbox command, which will force completion of the full soft-reset
sequence. The SPI bus lock can then be released. The mailbox is
checked for any boot or wakeup response from the firmware, before the
value in HALO_STATE will be trusted.

This does not affect SoundWire or I2C control.

Fixes: 8a731fd37f8b ("ASoC: cs35l56: Move utility functions to shared file")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20250225131843.113752-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-02-25 15:06:58 +00:00
..
ac97 driver core: have match() callback in struct bus_type take a const * 2024-07-03 15:16:54 +02:00
sof ASoC: SOF: ext_manifest: Add missing ext_manifest type for PROBE_INFO 2024-11-07 13:03:22 +00:00
ac97_codec.h ALSA: mark all struct bus_type as const 2023-12-30 10:10:41 +01:00
aci.h ALSA: opti9xx: Use standard print API 2024-08-08 07:49:45 +02:00
acp63_chip_offset_byte.h
ad1816a.h
ad1843.h
ak4xxx-adda.h
ak4113.h
ak4114.h
ak4117.h
ak4531_codec.h ALSA: ens137x: Replace with DEFINE_SIMPLE_DEV_PM_OPS() 2024-02-12 11:50:24 +01:00
ak4641.h
alc5623.h
asequencer.h
asound.h
asoundef.h ALSA: IEC958 definition for consumer status channel update 2024-09-07 10:42:17 +02:00
compress_driver.h ALSA: compress_offload: Add missing descriptions in structs 2024-11-13 13:54:27 +01:00
control.h Merge branch 'topic/control-lookup-rwlock' into for-next 2024-08-09 14:25:24 +02:00
core.h Merge branch 'topic/control-lookup-rwlock' into for-next 2024-08-09 14:25:24 +02:00
cs35l33.h
cs35l34.h
cs35l35.h
cs35l36.h
cs35l41.h ASoC: Constify channel mapping array arguments in set_channel_map() 2024-05-27 01:30:58 +01:00
cs35l56.h ASoC: cs35l56: Prevent races when soft-resetting using SPI control 2025-02-25 15:06:58 +00:00
cs42l42.h ASoC: cs42l42: Remove redundant delays in suspend(). 2024-02-19 17:02:18 +00:00
cs42l43.h
cs42l52.h
cs42l56.h
cs42l73.h
cs4231-regs.h
cs4271.h ASoC: cs4271: Convert to GPIO descriptors 2023-12-01 16:59:21 +00:00
cs8403.h
cs8427.h
cs-amp-lib.h ASoC: cs-amp-lib: Add KUnit test for calibration helpers 2024-03-04 20:27:35 +00:00
da7213.h
da7218.h
da7219-aad.h
da7219.h
da9055.h
designware_i2s.h
dmaengine_pcm.h ALSA: dmaengine: Synchronize dma channel after drop() 2024-06-11 17:13:31 +01:00
emu10k1_synth.h
emu10k1.h Merge branch 'topic/emu10k1-fix' into for-next 2024-04-28 12:00:57 +02:00
emu8000_reg.h
emu8000.h
emux_legacy.h
emux_synth.h ALSA: synth: Save a few bytes of memory when registering a 'snd_emux' 2024-01-22 13:04:22 +01:00
es1688.h ALSA: es1688: Use standard print API 2024-08-08 07:47:24 +02:00
graph_card.h
gus.h
hda_chmap.h
hda_codec.h ALSA: hda: codec: Reduce CONFIG_PM dependencies 2024-05-08 18:05:08 +02:00
hda_component.h
hda_hwdep.h
hda_i915.h
hda_register.h ALSA: hda: Fix all stream interrupts definition 2024-10-14 12:00:52 +02:00
hda_regmap.h
hda_verbs.h
hda-mlink.h ASoC: SOF: Intel: hda-mlink: expose unlocked interrupt enable routine 2024-10-11 12:06:56 +01:00
hdaudio_ext.h ALSA: hda: Fix compilation of snd_hdac_adsp_xxx() helpers 2025-01-10 17:46:09 +01:00
hdaudio.h ALSA: hda: fix trigger_tstamp_latched 2024-10-02 12:50:24 +02:00
hdmi-codec.h ASoC: hdmi-codec: move no_capture_mute to struct hdmi_codec_pdata 2025-01-04 08:47:10 +02:00
hwdep.h
i2c.h
info.h
initval.h
intel-dsp-config.h
intel-nhlt.h ALSA: hda: intel-nhlt: add intel_nhlt_ssp_device_type() function 2024-03-22 12:40:46 +01:00
jack.h
madera-pdata.h
max9768.h
max98088.h
max98090.h
max98095.h
memalloc.h ALSA: memalloc: Let IOMMU handle S/G primarily 2024-08-01 12:45:49 +02:00
minors.h
mixer_oss.h
mpu401.h
omap-hdmi-audio.h
opl3.h
opl4.h
pcm_drm_eld.h
pcm_iec958.h
pcm_oss.h
pcm_params.h ALSA: hda: Upgrade stream-format infrastructure 2023-11-27 17:27:41 +01:00
pcm-indirect.h
pcm.h ALSA: Align the syntax of iov_iter helpers with standard ones 2024-12-30 12:50:04 +01:00
pt2258.h
pxa2xx-lib.h
rawmidi.h ALSA: rawmidi: Make tied_device=0 as default / unknown 2025-01-14 16:52:07 +01:00
rt286.h
rt298.h
rt1015.h
rt1318.h ASoC: rt1318: Add RT1318 audio amplifier driver 2024-06-19 14:50:34 +01:00
rt5514.h
rt5659.h
rt5660.h
rt5663.h
rt5665.h
rt5668.h
rt5682.h
rt5682s.h
sb16_csp.h
sb.h ALSA: als4000: Replace with DEFINE_SIMPLE_DEV_PM_OPS() 2024-02-12 11:50:24 +01:00
sdca_function.h sound updates for 6.14-rc1 2025-01-24 07:54:34 -08:00
sdca.h ASoC: SDCA: Add bounds check for function address 2024-12-24 22:44:55 +00:00
sdw.h
seq_device.h
seq_kernel.h ALSA: seq: Remove unused declarations 2024-08-17 16:32:31 +02:00
seq_midi_emul.h
seq_midi_event.h
seq_oss_legacy.h
seq_oss.h
seq_virmidi.h
sh_dac_audio.h
sh_fsi.h
simple_card_utils.h ASoC: Updates for v6.14 2025-01-20 16:15:07 +01:00
simple_card.h
snd_wavefront.h ALSA: wavefront: Use standard print API 2024-08-08 07:49:46 +02:00
soc_sdw_utils.h ASoC: sdw_utils: cs_amp: Assign non-overlapping TDM masks for each codec on a bus 2024-12-03 12:36:28 +00:00
soc-acpi-intel-match.h ASoC: Intel: soc-acpi: add PTL match tables 2024-08-02 14:04:55 +01:00
soc-acpi-intel-ssp-common.h ASoC: Intel: ssp-common: get codec tplg suffix function 2024-03-28 13:58:14 +00:00
soc-acpi.h ASoC: soc-acpi: introduce new 'machine check' callback 2024-10-17 18:42:14 +01:00
soc-card.h ASoC: Drop snd_soc_*_get_kcontrol_locked() 2024-08-09 14:24:55 +02:00
soc-component.h ASoC: Drop snd_soc_*_get_kcontrol_locked() 2024-08-09 14:24:55 +02:00
soc-dai.h ASoC: soc-dai: add snd_soc_dai_prepare() and use it internally 2025-01-15 13:11:18 +00:00
soc-dapm.h ASoC: dapm: Use unsigned for number of widgets in snd_soc_dapm_new_controls() 2024-07-03 21:43:40 +01:00
soc-dpcm.h ASoC: soc-pcm: makes snd_soc_dpcm_can_be_xxx() local function 2024-08-28 13:02:20 +01:00
soc-jack.h ASoC: soc-jack: Get rid of legacy GPIO support 2024-03-26 17:13:45 +00:00
soc-link.h
soc-topology.h ASoC: topology: Constify an argument of snd_soc_tplg_component_load() 2024-05-27 01:31:15 +01:00
soc.h ASoC: soc-core: Enable to use extra format on each DAI 2025-01-13 14:16:55 +00:00
sof.h ASoC: SOF: sof-audio: add sof_dai_get_tdm_slots function 2024-05-29 11:10:54 +01:00
soundfont.h ALSA: emux: Use standard print API 2024-08-08 07:49:46 +02:00
spear_dma.h
spear_spdif.h
sta32x.h
sta350.h
tas2552-plat.h
tas2563-tlv.h ASoC: tas2781: mark const variables tas2563_dvc_table as __maybe_unused 2024-08-22 13:34:12 +01:00
tas2781-dsp.h ASoc: tas2781: Enable RCA-based playback without DSP firmware download 2024-06-18 16:45:53 +01:00
tas2781-tlv.h ASoC: tas2781: Fix a compiling warning reported by robot kernel test due to adding tas2563_dvc_table 2024-08-02 14:05:30 +01:00
tas2781.h ALSA: hda/tas2781: Add speaker id check for ASUS projects 2024-11-26 08:54:08 +01:00
tas5086.h
tea6330t.h
timer.h
tlv320aic32x4.h
tlv320dac33-plat.h
tlv.h
tpa6130a2-plat.h
uda1380.h
ump_convert.h ALSA: ump: Transmit RPN/NRPN message at each MSB/LSB data reception 2024-07-31 15:08:18 +02:00
ump_msg.h
ump.h ALSA: seq: Notify UMP EP and FB changes 2025-01-12 13:12:21 +01:00
util_mem.h
vx_core.h ALSA: vx_core: Drop unused dev field 2024-08-08 07:47:23 +02:00
wavefront.h
wm0010.h ASoC: wm0010: Convert to GPIO descriptors 2023-12-08 14:31:57 +00:00
wm2000.h
wm2200.h ASoC: wm2200: Convert to GPIO descriptors 2023-12-08 14:31:59 +00:00
wm5100.h ASoC: wm5100: Convert to GPIO descriptors 2023-12-08 14:31:59 +00:00
wm8903.h
wm8904.h
wm8955.h
wm8960.h
wm8962.h
wm8993.h
wm8996.h ASoC: wm8996: Convert to GPIO descriptors 2023-12-08 14:32:00 +00:00
wm9081.h
wm9090.h
wss.h