From f36ffb140a5f77cdd912485c677592a043fe256a Mon Sep 17 00:00:00 2001 From: Ramu Gottipati Date: Thu, 26 Dec 2019 10:50:00 +0530 Subject: [PATCH] dsp: Add FFECNS Freeze event support Add support to send ffecns freeze event Change-Id: I73bc6ff8c091427ddb398ae11c95f19c36e904b6 Signed-off-by: Ramu Gottipati --- dsp/q6adm.c | 45 +++++++++++++++++++++++++++++++++++++- include/dsp/apr_audio-v2.h | 1 + include/dsp/q6adm-v2.h | 8 ++++++- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/dsp/q6adm.c b/dsp/q6adm.c index b161df90ae..97d2569ed6 100644 --- a/dsp/q6adm.c +++ b/dsp/q6adm.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #include #include @@ -4568,6 +4568,49 @@ int adm_set_ffecns_effect(int effect) } EXPORT_SYMBOL(adm_set_ffecns_effect); +/** + * adm_set_ffecns_freeze_event - + * command to set event for ffecns module + * + * @event: send ffecns freeze event true or false + * + * Returns 0 on success or error on failure + */ +int adm_set_ffecns_freeze_event(bool ffecns_freeze_event) +{ + struct ffv_spf_freeze_param_t ffv_param; + struct param_hdr_v3 param_hdr; + int rc = 0; + int copp_idx = 0; + + memset(¶m_hdr, 0, sizeof(param_hdr)); + memset(&ffv_param, 0, sizeof(ffv_param)); + + ffv_param.freeze = ffecns_freeze_event ? 1 : 0; + ffv_param.source_id = 0; /*default value*/ + + copp_idx = adm_get_default_copp_idx(this_adm.ffecns_port_id); + if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { + pr_err("%s, no active copp to query rms copp_idx:%d\n", + __func__, copp_idx); + return -EINVAL; + } + + param_hdr.module_id = FFECNS_MODULE_ID; + param_hdr.instance_id = INSTANCE_ID_0; + param_hdr.param_id = PARAM_ID_FFV_SPF_FREEZE; + param_hdr.param_size = sizeof(ffv_param); + + rc = adm_pack_and_set_one_pp_param(this_adm.ffecns_port_id, copp_idx, + param_hdr, (uint8_t *) &ffv_param); + if (rc) + pr_err("%s: Failed to set ffecns imc event, err %d\n", + __func__, rc); + + return rc; +} +EXPORT_SYMBOL(adm_set_ffecns_freeze_event); + /** * adm_param_enable - * command to send params to ADM for given module diff --git a/include/dsp/apr_audio-v2.h b/include/dsp/apr_audio-v2.h index 72b11e2fbd..740c93c7c7 100644 --- a/include/dsp/apr_audio-v2.h +++ b/include/dsp/apr_audio-v2.h @@ -849,6 +849,7 @@ struct audproc_softvolume_params { */ #define AUDPROC_MODULE_ID_MFC_EC_REF 0x0001092C +#define PARAM_ID_FFV_SPF_FREEZE 0x00010960 struct adm_cmd_set_pp_params_v5 { struct apr_hdr hdr; diff --git a/include/dsp/q6adm-v2.h b/include/dsp/q6adm-v2.h index 894bca40c8..9f5fef8cfb 100644 --- a/include/dsp/q6adm-v2.h +++ b/include/dsp/q6adm-v2.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #ifndef __Q6_ADM_V2_H__ #define __Q6_ADM_V2_H__ @@ -85,6 +85,11 @@ struct msm_pcm_channel_mixer { bool override_out_ch_map; }; +struct ffv_spf_freeze_param_t { + uint16_t freeze; + uint16_t source_id; +}; + int srs_trumedia_open(int port_id, int copp_idx, __s32 srs_tech_id, void *srs_params); @@ -221,4 +226,5 @@ int adm_programable_channel_mixer(int port_id, int copp_idx, int session_id, void msm_dts_srs_acquire_lock(void); void msm_dts_srs_release_lock(void); void adm_set_native_mode(int mode); +int adm_set_ffecns_freeze_event(bool ffecns_freeze_event); #endif /* __Q6_ADM_V2_H__ */