]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: qcom: audioreach: Add support for Speaker Protection module
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Wed, 17 Dec 2025 09:46:03 +0000 (10:46 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 17 Dec 2025 12:04:37 +0000 (12:04 +0000)
Speaker Protection is capability of ADSP to adjust the gain during
playback to different speakers and their temperature.  This allows good
playback without blowing the speakers up.

Implement parsing MODULE_ID_SPEAKER_PROTECTION from Audioreach topology
and sending it as command to the ADSP.

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20251217094602.55117-3-krzysztof.kozlowski@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/qcom/qdsp6/audioreach.c
sound/soc/qcom/qdsp6/audioreach.h

index f3fa0a5b4095af58623e01f48494d1177dad34b1..c32a5ee801e709e5d4835f8da42f9c551f1d8e19 100644 (file)
@@ -1192,6 +1192,15 @@ static int audioreach_gain_set(struct q6apm_graph *graph, struct audioreach_modu
        return q6apm_send_cmd_sync(graph->apm, pkt, 0);
 }
 
+static int audioreach_speaker_protection(struct q6apm_graph *graph,
+                                        struct audioreach_module *module,
+                                        uint32_t operation_mode)
+{
+       return audioreach_send_u32_param(graph, module, PARAM_ID_SP_OP_MODE,
+                                        operation_mode);
+}
+
+
 int audioreach_set_media_format(struct q6apm_graph *graph, struct audioreach_module *module,
                                struct audioreach_module_config *cfg)
 {
@@ -1241,6 +1250,10 @@ int audioreach_set_media_format(struct q6apm_graph *graph, struct audioreach_mod
        case MODULE_ID_GAPLESS:
                rc = audioreach_gapless_set_media_format(graph, module, cfg);
                break;
+       case MODULE_ID_SPEAKER_PROTECTION:
+               rc = audioreach_speaker_protection(graph, module,
+                                                  PARAM_ID_SP_OP_MODE_NORMAL);
+               break;
        default:
                rc = 0;
        }
index d1b60b36468a86301601b61a7f8e7f6051561c3e..19828b4acccea732be07718262582fb210a443bb 100644 (file)
@@ -31,6 +31,7 @@ struct q6apm_graph;
 #define MODULE_ID_MP3_DECODE           0x0700103B
 #define MODULE_ID_GAPLESS              0x0700104D
 #define MODULE_ID_DISPLAY_PORT_SINK    0x07001069
+#define MODULE_ID_SPEAKER_PROTECTION   0x070010E2
 #define MODULE_ID_OPUS_DEC             0x07001174
 
 #define APM_CMD_GET_SPF_STATE          0x01001021
@@ -559,6 +560,17 @@ struct data_logging_config {
        uint32_t mode;
 } __packed;
 
+/* Speaker Protection */
+#define PARAM_ID_SP_OP_MODE                    0x080011e9
+#define PARAM_ID_SP_OP_MODE_NORMAL             0
+#define PARAM_ID_SP_OP_MODE_CALIBRATION                1
+#define PARAM_ID_SP_OP_MODE_FACTORY_TEST       2
+#define PARAM_ID_SP_OP_MODE_VALIDATION         3
+
+struct param_id_sp_op_mode {
+       uint32_t operation_mode;
+} __packed;
+
 #define PARAM_ID_SAL_OUTPUT_CFG                        0x08001016
 struct param_id_sal_output_config {
        uint32_t bits_per_sample;