From: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx> This patch adds support for Single Mic ECNS module, used for echo cancellation. It also makes use of audioreach_set_module_config to load the calibration data for this module from ASoC tplg file. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx> --- sound/soc/qcom/qdsp6/audioreach.c | 27 +++++++++++++++++++++++++++ sound/soc/qcom/qdsp6/audioreach.h | 1 + 2 files changed, 28 insertions(+) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index 4ebaaf736fb9..f4c53e84b4dc 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -811,6 +811,30 @@ static int audioreach_gapless_set_media_format(struct q6apm_graph *graph, EARLY_EOS_DELAY_MS); } +static int audioreach_set_module_config(struct q6apm_graph *graph, + struct audioreach_module *module, + struct audioreach_module_config *cfg) +{ + int payload_size = module->data->size; + struct gpr_pkt *pkt; + int rc; + void *p; + + pkt = audioreach_alloc_apm_cmd_pkt(payload_size, APM_CMD_SET_CFG, 0); + if (IS_ERR(pkt)) + return PTR_ERR(pkt); + + p = (void *)pkt + GPR_HDR_SIZE + APM_CMD_HDR_SIZE; + + memcpy(p, module->data->data, payload_size); + + rc = q6apm_send_cmd_sync(graph->apm, pkt, 0); + + kfree(pkt); + + return rc; +} + static int audioreach_mfc_set_media_format(struct q6apm_graph *graph, struct audioreach_module *module, struct audioreach_module_config *cfg) @@ -1247,6 +1271,9 @@ int audioreach_set_media_format(struct q6apm_graph *graph, struct audioreach_mod case MODULE_ID_DISPLAY_PORT_SINK: rc = audioreach_display_port_set_media_format(graph, module, cfg); break; + case MODULE_ID_SMECNS_V2: + rc = audioreach_set_module_config(graph, module, cfg); + break; case MODULE_ID_I2S_SOURCE: case MODULE_ID_I2S_SINK: rc = audioreach_i2s_set_media_format(graph, module, cfg); diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index 790fba96e34d..cc45c94f023f 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -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_SMECNS_V2 0x07001031 #define APM_CMD_GET_SPF_STATE 0x01001021 #define APM_CMD_RSP_GET_SPF_STATE 0x02001007 -- 2.50.0