summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.cirrus.com>2026-10-20 14:57:06 +0100
committerMark Brown <broonie@kernel.org>2026-10-20 15:54:26 +0100
commit6cc7db9fdd06c992ee38793b2d556524fc0cf574 (patch)
tree123fb496b689a7a14e22887ac3446be425252ab8 /include
parentff404ef11b975baf38c4472c51a6674c239e8021 (diff)
ASoC: cs35l56: Wait for firmware timer expiry before system suspend
On CS35L5x firmware older than 3.13.7 (B0 silicon) and 4.7.16 (B2 silicon) a SoundWire bus reset is not allowed within 250ms of the last firmware timer start. This is already avoided during runtime suspend by the various idle timeouts. System suspend can happen at any time so needs special protection. The driver cannot cancel the firmware timer, so it must wait long enough for the timer to expire. The delay is placed in the suspend stage because typically this has less impact on end users than delays in resuming. The amp is in PS3 power state when suspending and no new timers will be started in this state. An extra 10ms is added to the delay to avoid a race on the exact instant the firmware timer expires. There is no need to have the delay for every driver instance. The timers on each amp will expire in parallel, so the delay is only needed once. A global flag is used so that the first instance to reach its suspend() callback will delay and then clear the flag. The cs35l56_fw_idle_wait_lock mutex is to ensure this is still safe if async_suspend was ever enabled for SoundWire devices. Fixes: e496112529006 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56") Reported-by: Ferenc Lengyel <leferi99@gmail.com> Closes: https://github.com/thesofproject/linux/issues/5898 Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20261020135706.3573260-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/sound/cs35l56.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/sound/cs35l56.h b/include/sound/cs35l56.h
index 747e10ec1a27..ce6383c2c60c 100644
--- a/include/sound/cs35l56.h
+++ b/include/sound/cs35l56.h
@@ -209,6 +209,9 @@ struct snd_ctl_elem_value;
#define CS35L56_GPIO_FN_GPIO 0x00000001
+/* DSP1_FW_VER */
+#define CS35L56_FW_MAIN_VERSION_MASK GENMASK(19, 0)
+
/* Mixer input sources */
#define CS35L56_INPUT_SRC_NONE 0x00
#define CS35L56_INPUT_SRC_ASP1RX1 0x08
@@ -446,6 +449,7 @@ int cs35l56_cal_set_status_get(struct cs35l56_base *cs35l56_base,
int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base,
bool *fw_missing, unsigned int *fw_version);
void cs35l56_warn_if_firmware_missing(struct cs35l56_base *cs35l56_base);
+bool cs35l56_needs_wait_for_firmware_timer_expiry(struct cs35l56_base *cs35l56_base);
void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp);
int cs35l56_hw_init(struct cs35l56_base *cs35l56_base);
int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base);