mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
Merge "ASoC: add support for speaker protection 3.0"
This commit is contained in:
commit
8ad81f0d8a
4 changed files with 39 additions and 2 deletions
26
dsp/q6afe.c
26
dsp/q6afe.c
|
|
@ -1045,6 +1045,7 @@ static int afe_spk_prot_prepare(int src_port, int dst_port, int param_id,
|
|||
}
|
||||
switch (param_id) {
|
||||
case AFE_PARAM_ID_FBSP_MODE_RX_CFG:
|
||||
case AFE_PARAM_ID_SP_RX_LIMITER_TH:
|
||||
config.pdata.module_id = AFE_MODULE_FB_SPKR_PROT_V2_RX;
|
||||
break;
|
||||
case AFE_PARAM_ID_FEEDBACK_PATH_CFG:
|
||||
|
|
@ -1229,6 +1230,7 @@ static void afe_send_cal_spkr_prot_tx(int port_id)
|
|||
static void afe_send_cal_spkr_prot_rx(int port_id)
|
||||
{
|
||||
union afe_spkr_prot_config afe_spk_config;
|
||||
union afe_spkr_prot_config afe_spk_limiter_config;
|
||||
|
||||
if (this_afe.cal_data[AFE_FB_SPKR_PROT_CAL] == NULL)
|
||||
goto done;
|
||||
|
|
@ -1250,6 +1252,30 @@ static void afe_send_cal_spkr_prot_rx(int port_id)
|
|||
&afe_spk_config))
|
||||
pr_err("%s: RX MODE_VI_PROC_CFG failed\n",
|
||||
__func__);
|
||||
|
||||
if (afe_spk_config.mode_rx_cfg.mode ==
|
||||
Q6AFE_MSM_SPKR_PROCESSING) {
|
||||
if (this_afe.prot_cfg.sp_version >=
|
||||
AFE_API_VERSION_SUPPORT_SPV3) {
|
||||
afe_spk_limiter_config.limiter_th_cfg.
|
||||
minor_version = 1;
|
||||
afe_spk_limiter_config.limiter_th_cfg.
|
||||
lim_thr_per_calib_q27[SP_V2_SPKR_1] =
|
||||
this_afe.prot_cfg.limiter_th[SP_V2_SPKR_1];
|
||||
afe_spk_limiter_config.limiter_th_cfg.
|
||||
lim_thr_per_calib_q27[SP_V2_SPKR_2] =
|
||||
this_afe.prot_cfg.limiter_th[SP_V2_SPKR_2];
|
||||
if (afe_spk_prot_prepare(port_id, 0,
|
||||
AFE_PARAM_ID_SP_RX_LIMITER_TH,
|
||||
&afe_spk_limiter_config))
|
||||
pr_err("%s: SP_RX_LIMITER_TH failed.\n",
|
||||
__func__);
|
||||
} else {
|
||||
pr_debug("%s: SPv3 failed to apply on AFE API version=%d.\n",
|
||||
__func__,
|
||||
this_afe.prot_cfg.sp_version);
|
||||
}
|
||||
}
|
||||
}
|
||||
mutex_unlock(&this_afe.cal_data[AFE_FB_SPKR_PROT_CAL]->lock);
|
||||
done:
|
||||
|
|
|
|||
|
|
@ -8895,7 +8895,7 @@ struct cmd_set_topologies {
|
|||
|
||||
#define AFE_MODULE_FB_SPKR_PROT_RX 0x0001021C
|
||||
#define AFE_MODULE_FB_SPKR_PROT_V2_RX 0x0001025F
|
||||
|
||||
#define AFE_PARAM_ID_SP_RX_LIMITER_TH 0x000102B1
|
||||
#define AFE_PARAM_ID_FBSP_MODE_RX_CFG 0x0001021D
|
||||
#define AFE_PARAM_ID_FBSP_PTONE_RAMP_CFG 0x00010260
|
||||
|
||||
|
|
@ -9123,6 +9123,11 @@ struct afe_sp_ex_vi_get_param_resp {
|
|||
struct afe_sp_ex_vi_ftm_params param;
|
||||
} __packed;
|
||||
|
||||
struct afe_sp_rx_limiter_th_param {
|
||||
uint32_t minor_version;
|
||||
uint32_t lim_thr_per_calib_q27[SP_V2_NUM_MAX_SPKR];
|
||||
} __packed;
|
||||
|
||||
union afe_spkr_prot_config {
|
||||
struct asm_fbsp_mode_rx_cfg mode_rx_cfg;
|
||||
struct asm_spkr_calib_vi_proc_cfg vi_proc_cfg;
|
||||
|
|
@ -9132,6 +9137,7 @@ union afe_spkr_prot_config {
|
|||
struct afe_sp_th_vi_ftm_cfg th_vi_ftm_cfg;
|
||||
struct afe_sp_ex_vi_mode_cfg ex_vi_mode_cfg;
|
||||
struct afe_sp_ex_vi_ftm_cfg ex_vi_ftm_cfg;
|
||||
struct afe_sp_rx_limiter_th_param limiter_th_cfg;
|
||||
} __packed;
|
||||
|
||||
struct afe_spkr_prot_config_command {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#define AFE_CLK_VERSION_V1 1
|
||||
#define AFE_CLK_VERSION_V2 2
|
||||
|
||||
#define AFE_API_VERSION_SUPPORT_SPV3 2
|
||||
typedef int (*routing_cb)(int port);
|
||||
|
||||
enum {
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ enum {
|
|||
#define AFE_SIDETONE_IIR_CAL_TYPE AFE_SIDETONE_IIR_CAL_TYPE
|
||||
|
||||
#define TOPOLOGY_SPECIFIC_CHANNEL_INFO
|
||||
#define MSM_SPKR_PROT_SPV3
|
||||
|
||||
enum {
|
||||
VERSION_0_0,
|
||||
|
|
@ -301,6 +302,10 @@ struct audio_cal_info_spk_prot_cfg {
|
|||
* 1 - Start calib
|
||||
* 2 - Disable spk prot
|
||||
*/
|
||||
#ifdef MSM_SPKR_PROT_SPV3
|
||||
uint32_t sp_version;
|
||||
int32_t limiter_th[SP_V2_NUM_MAX_SPKRS];
|
||||
#endif
|
||||
};
|
||||
|
||||
struct audio_cal_info_sp_th_vi_ftm_cfg {
|
||||
|
|
|
|||
Loading…
Reference in a new issue