Loading include/sound/apr_audio-v2.h +22 −0 Original line number Diff line number Diff line Loading @@ -9532,4 +9532,26 @@ struct adm_param_fluence_sourcetracking_t { #define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_MULTICHANNEL_INPUT 0x0001091D #define AUDPROC_PARAM_ID_AUDIOSPHERE_OPERATING_INPUT_MEDIA_INFO 0x0001091E #define AUDPROC_MODULE_ID_VOICE_TX_SECNS 0x10027059 #define AUDPROC_PARAM_IDX_SEC_PRIMARY_MIC_CH 0x10014444 struct admx_sec_primary_mic_ch { uint16_t version; /*version number*/ uint16_t reserved; uint16_t sec_primary_mic_ch; /*<primary channel number.*/ uint16_t reserved1; } __packed; struct adm_set_sec_primary_ch_params { struct adm_cmd_set_pp_params_v5 params; struct adm_param_data_v5 data; struct admx_sec_primary_mic_ch sec_primary_mic_ch_data; } __packed; #endif /*_APR_AUDIO_V2_H_ */ include/sound/q6adm-v2.h +3 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,9 @@ int adm_set_softvolume(int port_id, int copp_idx, int adm_set_mic_gain(int port_id, int copp_idx, int volume); int adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx, int primary_mic_ch); int adm_param_enable(int port_id, int copp_idx, int module_id, int enable); int adm_send_calibration(int port_id, int copp_idx, int path, int perf_mode, Loading sound/soc/msm/qdsp6v2/msm-qti-pp-config.c +42 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,8 @@ static int msm_route_sec_auxpcm_lb_vol_ctrl; static const DECLARE_TLV_DB_LINEAR(sec_auxpcm_lb_vol_gain, 0, INT_RX_VOL_MAX_STEPS); static int msm_multichannel_ec_primary_mic_ch; static void msm_qti_pp_send_eq_values_(int eq_idx) { int result; Loading Loading @@ -762,6 +764,43 @@ static int msm_qti_pp_asphere_set(struct snd_kcontrol *kcontrol, return 0; } static int msm_multichannel_ec_primary_mic_ch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int ret = 0; int copp_idx = 0; int port_id = AFE_PORT_ID_QUATERNARY_TDM_TX; msm_multichannel_ec_primary_mic_ch = ucontrol->value.integer.value[0]; pr_debug("%s: msm_multichannel_ec_primary_mic_ch = %u\n", __func__, msm_multichannel_ec_primary_mic_ch); copp_idx = adm_get_default_copp_idx(port_id); if ((copp_idx < 0) || (copp_idx > MAX_COPPS_PER_PORT)) { pr_err("%s : no active copp to query multichannel ec copp_idx: %u\n", __func__, copp_idx); return -EINVAL; } adm_send_set_multichannel_ec_primary_mic_ch(port_id, copp_idx, msm_multichannel_ec_primary_mic_ch); return ret; } static int msm_multichannel_ec_primary_mic_ch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { ucontrol->value.integer.value[0] = msm_multichannel_ec_primary_mic_ch; pr_debug("%s: msm_multichannel_ec_primary_mic_ch = %lu\n", __func__, ucontrol->value.integer.value[0]); return 0; } static const struct snd_kcontrol_new msm_multichannel_ec_controls[] = { SOC_SINGLE_EXT("Multichannel EC Primary Mic Ch", SND_SOC_NOPM, 0, 0xFFFFFFFF, 0, msm_multichannel_ec_primary_mic_ch_get, msm_multichannel_ec_primary_mic_ch_put), }; static const struct snd_kcontrol_new int_fm_vol_mixer_controls[] = { SOC_SINGLE_EXT_TLV("Internal FM RX Volume", SND_SOC_NOPM, 0, INT_RX_VOL_GAIN, 0, msm_qti_pp_get_fm_vol_mixer, Loading Loading @@ -1018,4 +1057,7 @@ void msm_qti_pp_add_controls(struct snd_soc_platform *platform) snd_soc_add_platform_controls(platform, asphere_mixer_controls, ARRAY_SIZE(asphere_mixer_controls)); snd_soc_add_platform_controls(platform, msm_multichannel_ec_controls, ARRAY_SIZE(msm_multichannel_ec_controls)); } sound/soc/msm/qdsp6v2/q6adm.c +88 −0 Original line number Diff line number Diff line Loading @@ -3671,6 +3671,94 @@ fail_cmd: return rc; } int adm_send_set_multichannel_ec_primary_mic_ch(int port_id , int copp_idx, int primary_mic_ch) { struct adm_set_sec_primary_ch_params sec_primary_ch_params; int rc = 0; int sz, port_idx; pr_debug("%s port_id 0x%x, copp_idx 0x%x, primary_mic_ch %d\n", __func__, port_id, copp_idx, primary_mic_ch); port_id = afe_convert_virtual_to_portid(port_id); port_idx = adm_validate_and_get_port_index(port_id); if (port_idx < 0) { pr_err("%s: Invalid port_id 0x%x\n", __func__, port_id); return -EINVAL; } if (copp_idx < 0 || copp_idx >= MAX_COPPS_PER_PORT) { pr_err("%s: Invalid copp_idx 0x%x\n", __func__, copp_idx); return -EINVAL; } sz = sizeof(struct adm_set_sec_primary_ch_params); sec_primary_ch_params.params.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); sec_primary_ch_params.params.hdr.pkt_size = sz; sec_primary_ch_params.params.hdr.src_svc = APR_SVC_ADM; sec_primary_ch_params.params.hdr.src_domain = APR_DOMAIN_APPS; sec_primary_ch_params.params.hdr.src_port = port_id; sec_primary_ch_params.params.hdr.dest_svc = APR_SVC_ADM; sec_primary_ch_params.params.hdr.dest_domain = APR_DOMAIN_ADSP; sec_primary_ch_params.params.hdr.dest_port = atomic_read(&this_adm.copp.id[port_idx][copp_idx]); sec_primary_ch_params.params.hdr.token = port_idx << 16 | copp_idx; sec_primary_ch_params.params.hdr.opcode = ADM_CMD_SET_PP_PARAMS_V5; sec_primary_ch_params.params.payload_addr_lsw = 0; sec_primary_ch_params.params.payload_addr_msw = 0; sec_primary_ch_params.params.mem_map_handle = 0; sec_primary_ch_params.params.payload_size = sizeof(struct adm_param_data_v5) + sizeof(struct admx_sec_primary_mic_ch); sec_primary_ch_params.data.module_id = AUDPROC_MODULE_ID_VOICE_TX_SECNS; sec_primary_ch_params.data.param_id = AUDPROC_PARAM_IDX_SEC_PRIMARY_MIC_CH; sec_primary_ch_params.data.param_size = sizeof(struct admx_sec_primary_mic_ch); sec_primary_ch_params.data.reserved = 0; sec_primary_ch_params.sec_primary_mic_ch_data.version = 0; sec_primary_ch_params.sec_primary_mic_ch_data.reserved = 0; sec_primary_ch_params.sec_primary_mic_ch_data.sec_primary_mic_ch = primary_mic_ch; sec_primary_ch_params.sec_primary_mic_ch_data.reserved1 = 0; atomic_set(&this_adm.copp.stat[port_idx][copp_idx], -1); rc = apr_send_pkt(this_adm.apr, (uint32_t *)&sec_primary_ch_params); if (rc < 0) { pr_err("%s: Set params failed port = %#x\n", __func__, port_id); rc = -EINVAL; goto fail_cmd; } /* Wait for the callback */ rc = wait_event_timeout(this_adm.copp.wait[port_idx][copp_idx], atomic_read(&this_adm.copp.stat[port_idx][copp_idx]) >= 0, msecs_to_jiffies(TIMEOUT_MS)); if (!rc) { pr_err("%s: Mic Set params timed out port = %#x\n", __func__, port_id); rc = -EINVAL; goto fail_cmd; } else if (atomic_read(&this_adm.copp.stat [port_idx][copp_idx]) > 0) { pr_err("%s: DSP returned error[%s]\n", __func__, adsp_err_get_err_str( atomic_read(&this_adm.copp.stat [port_idx][copp_idx]))); rc = adsp_err_get_lnx_err_code( atomic_read(&this_adm.copp.stat [port_idx][copp_idx])); goto fail_cmd; } rc = 0; fail_cmd: return rc; } int adm_param_enable(int port_id, int copp_idx, int module_id, int enable) { struct audproc_enable_param_t adm_mod_enable; Loading Loading
include/sound/apr_audio-v2.h +22 −0 Original line number Diff line number Diff line Loading @@ -9532,4 +9532,26 @@ struct adm_param_fluence_sourcetracking_t { #define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_MULTICHANNEL_INPUT 0x0001091D #define AUDPROC_PARAM_ID_AUDIOSPHERE_OPERATING_INPUT_MEDIA_INFO 0x0001091E #define AUDPROC_MODULE_ID_VOICE_TX_SECNS 0x10027059 #define AUDPROC_PARAM_IDX_SEC_PRIMARY_MIC_CH 0x10014444 struct admx_sec_primary_mic_ch { uint16_t version; /*version number*/ uint16_t reserved; uint16_t sec_primary_mic_ch; /*<primary channel number.*/ uint16_t reserved1; } __packed; struct adm_set_sec_primary_ch_params { struct adm_cmd_set_pp_params_v5 params; struct adm_param_data_v5 data; struct admx_sec_primary_mic_ch sec_primary_mic_ch_data; } __packed; #endif /*_APR_AUDIO_V2_H_ */
include/sound/q6adm-v2.h +3 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,9 @@ int adm_set_softvolume(int port_id, int copp_idx, int adm_set_mic_gain(int port_id, int copp_idx, int volume); int adm_send_set_multichannel_ec_primary_mic_ch(int port_id, int copp_idx, int primary_mic_ch); int adm_param_enable(int port_id, int copp_idx, int module_id, int enable); int adm_send_calibration(int port_id, int copp_idx, int path, int perf_mode, Loading
sound/soc/msm/qdsp6v2/msm-qti-pp-config.c +42 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,8 @@ static int msm_route_sec_auxpcm_lb_vol_ctrl; static const DECLARE_TLV_DB_LINEAR(sec_auxpcm_lb_vol_gain, 0, INT_RX_VOL_MAX_STEPS); static int msm_multichannel_ec_primary_mic_ch; static void msm_qti_pp_send_eq_values_(int eq_idx) { int result; Loading Loading @@ -762,6 +764,43 @@ static int msm_qti_pp_asphere_set(struct snd_kcontrol *kcontrol, return 0; } static int msm_multichannel_ec_primary_mic_ch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int ret = 0; int copp_idx = 0; int port_id = AFE_PORT_ID_QUATERNARY_TDM_TX; msm_multichannel_ec_primary_mic_ch = ucontrol->value.integer.value[0]; pr_debug("%s: msm_multichannel_ec_primary_mic_ch = %u\n", __func__, msm_multichannel_ec_primary_mic_ch); copp_idx = adm_get_default_copp_idx(port_id); if ((copp_idx < 0) || (copp_idx > MAX_COPPS_PER_PORT)) { pr_err("%s : no active copp to query multichannel ec copp_idx: %u\n", __func__, copp_idx); return -EINVAL; } adm_send_set_multichannel_ec_primary_mic_ch(port_id, copp_idx, msm_multichannel_ec_primary_mic_ch); return ret; } static int msm_multichannel_ec_primary_mic_ch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { ucontrol->value.integer.value[0] = msm_multichannel_ec_primary_mic_ch; pr_debug("%s: msm_multichannel_ec_primary_mic_ch = %lu\n", __func__, ucontrol->value.integer.value[0]); return 0; } static const struct snd_kcontrol_new msm_multichannel_ec_controls[] = { SOC_SINGLE_EXT("Multichannel EC Primary Mic Ch", SND_SOC_NOPM, 0, 0xFFFFFFFF, 0, msm_multichannel_ec_primary_mic_ch_get, msm_multichannel_ec_primary_mic_ch_put), }; static const struct snd_kcontrol_new int_fm_vol_mixer_controls[] = { SOC_SINGLE_EXT_TLV("Internal FM RX Volume", SND_SOC_NOPM, 0, INT_RX_VOL_GAIN, 0, msm_qti_pp_get_fm_vol_mixer, Loading Loading @@ -1018,4 +1057,7 @@ void msm_qti_pp_add_controls(struct snd_soc_platform *platform) snd_soc_add_platform_controls(platform, asphere_mixer_controls, ARRAY_SIZE(asphere_mixer_controls)); snd_soc_add_platform_controls(platform, msm_multichannel_ec_controls, ARRAY_SIZE(msm_multichannel_ec_controls)); }
sound/soc/msm/qdsp6v2/q6adm.c +88 −0 Original line number Diff line number Diff line Loading @@ -3671,6 +3671,94 @@ fail_cmd: return rc; } int adm_send_set_multichannel_ec_primary_mic_ch(int port_id , int copp_idx, int primary_mic_ch) { struct adm_set_sec_primary_ch_params sec_primary_ch_params; int rc = 0; int sz, port_idx; pr_debug("%s port_id 0x%x, copp_idx 0x%x, primary_mic_ch %d\n", __func__, port_id, copp_idx, primary_mic_ch); port_id = afe_convert_virtual_to_portid(port_id); port_idx = adm_validate_and_get_port_index(port_id); if (port_idx < 0) { pr_err("%s: Invalid port_id 0x%x\n", __func__, port_id); return -EINVAL; } if (copp_idx < 0 || copp_idx >= MAX_COPPS_PER_PORT) { pr_err("%s: Invalid copp_idx 0x%x\n", __func__, copp_idx); return -EINVAL; } sz = sizeof(struct adm_set_sec_primary_ch_params); sec_primary_ch_params.params.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER); sec_primary_ch_params.params.hdr.pkt_size = sz; sec_primary_ch_params.params.hdr.src_svc = APR_SVC_ADM; sec_primary_ch_params.params.hdr.src_domain = APR_DOMAIN_APPS; sec_primary_ch_params.params.hdr.src_port = port_id; sec_primary_ch_params.params.hdr.dest_svc = APR_SVC_ADM; sec_primary_ch_params.params.hdr.dest_domain = APR_DOMAIN_ADSP; sec_primary_ch_params.params.hdr.dest_port = atomic_read(&this_adm.copp.id[port_idx][copp_idx]); sec_primary_ch_params.params.hdr.token = port_idx << 16 | copp_idx; sec_primary_ch_params.params.hdr.opcode = ADM_CMD_SET_PP_PARAMS_V5; sec_primary_ch_params.params.payload_addr_lsw = 0; sec_primary_ch_params.params.payload_addr_msw = 0; sec_primary_ch_params.params.mem_map_handle = 0; sec_primary_ch_params.params.payload_size = sizeof(struct adm_param_data_v5) + sizeof(struct admx_sec_primary_mic_ch); sec_primary_ch_params.data.module_id = AUDPROC_MODULE_ID_VOICE_TX_SECNS; sec_primary_ch_params.data.param_id = AUDPROC_PARAM_IDX_SEC_PRIMARY_MIC_CH; sec_primary_ch_params.data.param_size = sizeof(struct admx_sec_primary_mic_ch); sec_primary_ch_params.data.reserved = 0; sec_primary_ch_params.sec_primary_mic_ch_data.version = 0; sec_primary_ch_params.sec_primary_mic_ch_data.reserved = 0; sec_primary_ch_params.sec_primary_mic_ch_data.sec_primary_mic_ch = primary_mic_ch; sec_primary_ch_params.sec_primary_mic_ch_data.reserved1 = 0; atomic_set(&this_adm.copp.stat[port_idx][copp_idx], -1); rc = apr_send_pkt(this_adm.apr, (uint32_t *)&sec_primary_ch_params); if (rc < 0) { pr_err("%s: Set params failed port = %#x\n", __func__, port_id); rc = -EINVAL; goto fail_cmd; } /* Wait for the callback */ rc = wait_event_timeout(this_adm.copp.wait[port_idx][copp_idx], atomic_read(&this_adm.copp.stat[port_idx][copp_idx]) >= 0, msecs_to_jiffies(TIMEOUT_MS)); if (!rc) { pr_err("%s: Mic Set params timed out port = %#x\n", __func__, port_id); rc = -EINVAL; goto fail_cmd; } else if (atomic_read(&this_adm.copp.stat [port_idx][copp_idx]) > 0) { pr_err("%s: DSP returned error[%s]\n", __func__, adsp_err_get_err_str( atomic_read(&this_adm.copp.stat [port_idx][copp_idx]))); rc = adsp_err_get_lnx_err_code( atomic_read(&this_adm.copp.stat [port_idx][copp_idx])); goto fail_cmd; } rc = 0; fail_cmd: return rc; } int adm_param_enable(int port_id, int copp_idx, int module_id, int enable) { struct audproc_enable_param_t adm_mod_enable; Loading