[RFC PATCH 16/23] ASoC: qcom: audioreach: pin SPEAKER_PROTECTION_VI media format
From: Srinivas Kandagatla
Date: Fri Oct 23 2026 - 13:24:04 EST
With multi_direction_codecs the speaker protection VI subgraph is
opened with the playback stream's parameters, but the VI module and its
codec DMA source always run at 8 kHz and 32 bits.
Use those for the VI module and the codec DMA source in its subgraph,
and keep the channel count, which follows the number of speakers.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>
---
sound/soc/qcom/qdsp6/audioreach.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
index 089cc9dd76fc..d027c763eb25 100644
--- a/sound/soc/qcom/qdsp6/audioreach.c
+++ b/sound/soc/qcom/qdsp6/audioreach.c
@@ -2033,12 +2033,41 @@ static int audioreach_speaker_protection_vi_static_cfg(struct q6apm_graph *graph
return audioreach_speaker_protection_send_static_cfg(graph, module, "VI");
}
+static bool audioreach_sg_contains_sp_vi(const struct audioreach_sub_graph *sg)
+{
+ const struct audioreach_container *c;
+ const struct audioreach_module *m;
+
+ if (!sg)
+ return false;
+
+ list_for_each_entry(c, &sg->container_list, node)
+ list_for_each_entry(m, &c->modules_list, node)
+ if (m->module_id == MODULE_ID_SPEAKER_PROTECTION_VI)
+ return true;
+
+ return false;
+}
+
int audioreach_set_media_format(struct q6apm_graph *graph,
const struct audioreach_module *module,
const struct audioreach_module_config *cfg)
{
+ struct audioreach_module_config sp_vi_cfg;
int rc;
+ /* The VI module and its codec DMA source always run at 8 kHz, S32_LE */
+ if (module->module_id == MODULE_ID_SPEAKER_PROTECTION_VI ||
+ (module->module_id == MODULE_ID_CODEC_DMA_SOURCE &&
+ audioreach_sg_contains_sp_vi(module->container ?
+ module->container->sub_graph : NULL))) {
+ sp_vi_cfg = *cfg;
+ sp_vi_cfg.sample_rate = 8000;
+ sp_vi_cfg.bit_width = 32;
+ sp_vi_cfg.bits_per_sample = 32;
+ cfg = &sp_vi_cfg;
+ }
+
switch (module->module_id) {
case MODULE_ID_DATA_LOGGING:
rc = audioreach_module_enable(graph, module, true);
--
2.47.3