Loading include/sound/q6adm-v2.h +27 −22 Original line number Diff line number Diff line Loading @@ -21,26 +21,29 @@ #include <sound/q6audio-v2.h> #define MAX_COPPS_PER_PORT 0x8 /* multiple copp per stream. */ struct route_payload { unsigned int copp_ids[AFE_MAX_PORTS]; unsigned int copp_idx[MAX_COPPS_PER_PORT]; unsigned int port_id[MAX_COPPS_PER_PORT]; int app_type; int acdb_dev_id; unsigned short num_copps; unsigned int session_id; }; int srs_trumedia_open(int port_id, int srs_tech_id, void *srs_params); int srs_trumedia_open(int port_id, int copp_idx, int srs_tech_id, void *srs_params); int adm_open(int port, int path, int rate, int mode, int topology, int perf_mode, uint16_t bits_per_sample); int adm_get_params(int port_id, uint32_t module_id, uint32_t param_id, uint32_t params_length, char *params); int adm_get_params(int port_id, int copp_idx, uint32_t module_id, uint32_t param_id, uint32_t params_length, char *params); int adm_dolby_dap_send_params(int port_id, char *params, int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params, uint32_t params_length); int adm_multi_ch_copp_open(int port, int path, int rate, int mode, int topology, int perf_mode, uint16_t bits_per_sample); int adm_open(int port, int path, int rate, int mode, int topology, int perf_mode, uint16_t bits_per_sample, int app_type); int adm_unmap_cal_blocks(void); Loading @@ -48,29 +51,31 @@ int adm_map_rtac_block(struct rtac_cal_block_data *cal_block); int adm_unmap_rtac_block(uint32_t *mem_map_handle); int adm_memory_map_regions(int port_id, phys_addr_t *buf_add, uint32_t mempool_id, uint32_t *bufsz, uint32_t bufcnt); int adm_memory_unmap_regions(int port_id); int adm_close(int port, int perf_mode); int adm_close(int port, int topology, int perf_mode); int adm_matrix_map(int session_id, int path, int num_copps, unsigned int *port_id, int copp_id, int perf_mode); int adm_matrix_map(int path, struct route_payload payload_map, int perf_mode); int adm_connect_afe_port(int mode, int session_id, int port_id); void adm_ec_ref_rx_id(int port_id); int adm_get_copp_id(int port_id); int adm_get_lowlatency_copp_id(int port_id); void adm_set_multi_ch_map(char *channel_map); void adm_get_multi_ch_map(char *channel_map); int adm_set_stereo_to_custom_stereo(int port_id, unsigned int session_id, int adm_validate_and_get_port_index(int port_id); int adm_get_default_copp_idx(int port_id); int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id); int adm_validate_copp_id(int copp_id); int adm_set_stereo_to_custom_stereo(int port_id, int copp_idx, unsigned int session_id, char *params, uint32_t params_length); #endif /* __Q6_ADM_V2_H__ */ sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c +5 −1 Original line number Diff line number Diff line Loading @@ -633,10 +633,14 @@ static int msm_compr_configure_dsp(struct snd_compr_stream *cstream) prtd->gapless_state.stream_opened[stream_index] = 1; pr_debug("%s be_id %d\n", __func__, soc_prtd->dai_link->be_id); msm_pcm_routing_reg_phy_stream(soc_prtd->dai_link->be_id, ret = msm_pcm_routing_reg_phy_stream(soc_prtd->dai_link->be_id, ac->perf_mode, prtd->session_id, SNDRV_PCM_STREAM_PLAYBACK); if (ret) { pr_err("%s: stream reg failed:%d\n", __func__, ret); return ret; } ret = msm_compr_set_volume(cstream, 0, 0); if (ret < 0) Loading sound/soc/msm/qdsp6v2/msm-dolby-dap-config.c +133 −68 Original line number Diff line number Diff line Loading @@ -324,7 +324,8 @@ struct dolby_dap_params_states_s { bool use_cache; bool auto_endp; bool enddep_params; int port_id; int port_id[AFE_MAX_PORTS]; int copp_idx[AFE_MAX_PORTS]; int port_open_count; int port_ids_dolby_can_be_enabled; int device; Loading @@ -333,8 +334,8 @@ struct dolby_dap_params_states_s { static struct dolby_dap_params_get_s dolby_dap_params_get = {-1, DEVICE_OUT_ALL, 0, 0, 0}; static struct dolby_dap_params_states_s dolby_dap_params_states = { true, true, true, DOLBY_INVALID_PORT_ID, 0, DEVICE_OUT_ALL, 0 }; true, {DOLBY_INVALID_PORT_ID}, {-1}, 0, DEVICE_OUT_ALL, 0 }; /* port_ids_dolby_can_be_enabled is set to 0x7FFFFFFF. this needs to be removed after interface validation Loading @@ -356,7 +357,7 @@ static int msm_dolby_dap_map_device_to_dolby_endpoint(int device) return dolby_dap_device; } static int msm_dolby_dap_send_end_point(int port_id) static int msm_dolby_dap_send_end_point(int port_id, int copp_idx) { int rc = 0; char *params_value; Loading @@ -377,7 +378,8 @@ static int msm_dolby_dap_send_end_point(int port_id) *update_params_value++ = msm_dolby_dap_map_device_to_dolby_endpoint( dolby_dap_params_states.device); rc = adm_dolby_dap_send_params(port_id, params_value, params_length); rc = adm_dolby_dap_send_params(port_id, copp_idx, params_value, params_length); if (rc) { pr_err("%s: send dolby params failed\n", __func__); rc = -EINVAL; Loading @@ -386,7 +388,8 @@ static int msm_dolby_dap_send_end_point(int port_id) return rc; } static int msm_dolby_dap_send_enddep_params(int port_id, int device_channels) static int msm_dolby_dap_send_enddep_params(int port_id, int copp_idx, int device_channels) { int i, j, rc = 0, idx, offset; char *params_value; Loading Loading @@ -433,7 +436,8 @@ static int msm_dolby_dap_send_enddep_params(int port_id, int device_channels) *update_params_value++ = dolby_dap_endp_params[idx].params_val[offset+j]; } rc = adm_dolby_dap_send_params(port_id, params_value, params_length); rc = adm_dolby_dap_send_params(port_id, copp_idx, params_value, params_length); if (rc) { pr_err("%s: send dolby params failed\n", __func__); rc = -EINVAL; Loading @@ -442,7 +446,8 @@ static int msm_dolby_dap_send_enddep_params(int port_id, int device_channels) return rc; } static int msm_dolby_dap_send_cached_params(int port_id, int commit) static int msm_dolby_dap_send_cached_params(int port_id, int copp_idx, int commit) { char *params_value; int *update_params_value, rc = 0; Loading Loading @@ -478,7 +483,7 @@ static int msm_dolby_dap_send_cached_params(int port_id, int commit) } pr_debug("%s, valid param length: %d", __func__, params_length); if (params_length) { rc = adm_dolby_dap_send_params(port_id, params_value, rc = adm_dolby_dap_send_params(port_id, copp_idx, params_value, params_length); if (rc) { pr_err("%s: send dolby params failed\n", __func__); Loading @@ -499,23 +504,31 @@ static int msm_dolby_dap_send_cached_params(int port_id, int commit) return 0; } int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on) int msm_dolby_dap_init(int port_id, int copp_idx, int channels, bool is_custom_stereo_on) { int ret = 0; int index = adm_validate_and_get_port_index(port_id); if (index < 0) { pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index, port_id); return -EINVAL; } if ((port_id != DOLBY_INVALID_PORT_ID) && (port_id & dolby_dap_params_states.port_ids_dolby_can_be_enabled)) { dolby_dap_params_states.port_id = port_id; (port_id & dolby_dap_params_states.port_ids_dolby_can_be_enabled)) { dolby_dap_params_states.port_id[index] = port_id; dolby_dap_params_states.copp_idx[index] = copp_idx; dolby_dap_params_states.port_open_count++; if (dolby_dap_params_states.auto_endp) { ret = msm_dolby_dap_send_end_point(port_id); ret = msm_dolby_dap_send_end_point(port_id, copp_idx); if (ret) { pr_err("%s: err sending endppoint\n", __func__); return ret; } } if (dolby_dap_params_states.use_cache) { ret = msm_dolby_dap_send_cached_params(port_id, 0); ret = msm_dolby_dap_send_cached_params(port_id, copp_idx, 0); if (ret) { pr_err("%s: err sending cached params\n", __func__); Loading @@ -523,7 +536,7 @@ int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on) } } if (dolby_dap_params_states.enddep_params) { msm_dolby_dap_send_enddep_params(port_id, msm_dolby_dap_send_enddep_params(port_id, copp_idx, channels); if (ret) { pr_err("%s: err sending endp dependent params\n", Loading @@ -532,7 +545,7 @@ int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on) } } if (is_custom_stereo_on) dolby_dap_set_custom_stereo_onoff(port_id, dolby_dap_set_custom_stereo_onoff(port_id, copp_idx, is_custom_stereo_on); } return ret; Loading @@ -540,13 +553,21 @@ int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on) void msm_dolby_dap_deinit(int port_id) { int index = adm_validate_and_get_port_index(port_id); if (index < 0) { pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index, port_id); return; } dolby_dap_params_states.port_open_count--; if ((dolby_dap_params_states.port_id == port_id) && (!dolby_dap_params_states.port_open_count)) dolby_dap_params_states.port_id = DOLBY_INVALID_PORT_ID; if ((dolby_dap_params_states.port_id[index] == port_id) && (!dolby_dap_params_states.port_open_count)) { dolby_dap_params_states.port_id[index] = DOLBY_INVALID_PORT_ID; dolby_dap_params_states.copp_idx[index] = -1; } } static int msm_dolby_dap_set_vspe_vdhe(int port_id, static int msm_dolby_dap_set_vspe_vdhe(int port_id, int copp_idx, bool is_custom_stereo_enabled) { char *params_value; Loading Loading @@ -586,7 +607,7 @@ static int msm_dolby_dap_set_vspe_vdhe(int port_id, } pr_debug("%s, valid param length: %d", __func__, params_length); if (params_length) { rc = adm_dolby_dap_send_params(port_id, params_value, rc = adm_dolby_dap_send_params(port_id, copp_idx, params_value, params_length); if (rc) { pr_err("%s: send vdhe/vspe params failed with rc=%d\n", Loading @@ -599,7 +620,7 @@ static int msm_dolby_dap_set_vspe_vdhe(int port_id, return 0; } int dolby_dap_set_custom_stereo_onoff(int port_id, int dolby_dap_set_custom_stereo_onoff(int port_id, int copp_idx, bool is_custom_stereo_enabled) { char *params_value; Loading @@ -610,7 +631,8 @@ int dolby_dap_set_custom_stereo_onoff(int port_id, if (port_id == DOLBY_INVALID_PORT_ID) return -EINVAL; msm_dolby_dap_set_vspe_vdhe(port_id, is_custom_stereo_enabled); msm_dolby_dap_set_vspe_vdhe(port_id, copp_idx, is_custom_stereo_enabled); params_value = kzalloc(params_length, GFP_KERNEL); if (!params_value) { pr_err("%s, params memory alloc failed\n", __func__); Loading @@ -628,7 +650,7 @@ int dolby_dap_set_custom_stereo_onoff(int port_id, params_length += (DOLBY_PARAM_PAYLOAD_SIZE + 1) * sizeof(uint32_t); pr_debug("%s, valid param length: %d", __func__, params_length); if (params_length) { rc = adm_dolby_dap_send_params(port_id, params_value, rc = adm_dolby_dap_send_params(port_id, copp_idx, params_value, params_length); if (rc) { pr_err("%s: setting ds1 custom stereo param failed with rc=%d\n", Loading Loading @@ -670,15 +692,13 @@ int msm_dolby_dap_param_to_set_control_get(struct snd_kcontrol *kcontrol, int msm_dolby_dap_param_to_set_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int rc = 0; int rc = 0, port_id, copp_idx; uint32_t idx, j; uint32_t device = ucontrol->value.integer.value[0]; uint32_t param_id = ucontrol->value.integer.value[1]; uint32_t offset = ucontrol->value.integer.value[2]; uint32_t length = ucontrol->value.integer.value[3]; int port_id = dolby_dap_params_states.port_id; dolby_dap_params_states.port_ids_dolby_can_be_enabled = msm_dolby_dap_map_device_to_port_id(device); for (idx = 0; idx < ALL_DOLBY_PARAMS; idx++) { Loading @@ -695,18 +715,36 @@ int msm_dolby_dap_param_to_set_control_put(struct snd_kcontrol *kcontrol, case DOLBY_COMMIT_ALL_IDX: { /* COMIIT ALL: Send all parameters to DSP */ pr_debug("%s: COMMIT_ALL recvd\n", __func__); if (port_id != DOLBY_INVALID_PORT_ID) rc = msm_dolby_dap_send_cached_params(port_id, for (idx = 0; idx < AFE_MAX_PORTS; idx++) { port_id = dolby_dap_params_states.port_id[idx]; copp_idx = dolby_dap_params_states.copp_idx[idx]; if ((copp_idx > 0) && (copp_idx < MAX_COPPS_PER_PORT) && (port_id != DOLBY_INVALID_PORT_ID)) rc |= msm_dolby_dap_send_cached_params( port_id, copp_idx, 0); } } break; case DOLBY_COMMIT_IDX: { pr_debug("%s: COMMIT recvd\n", __func__); /* COMMIT: Send only modified paramters to DSP */ if (port_id != DOLBY_INVALID_PORT_ID) rc = msm_dolby_dap_send_cached_params(port_id, for (idx = 0; idx < AFE_MAX_PORTS; idx++) { port_id = dolby_dap_params_states.port_id[idx]; copp_idx = dolby_dap_params_states.copp_idx[idx]; if ((copp_idx > 0) && (copp_idx < MAX_COPPS_PER_PORT) && (port_id == DOLBY_INVALID_PORT_ID)) rc |= msm_dolby_dap_send_cached_params( port_id, copp_idx, 1); } } break; case DOLBY_USE_CACHE_IDX: { pr_debug("%s: USE CACHE recvd val: %ld\n", __func__, Loading Loading @@ -752,30 +790,40 @@ int msm_dolby_dap_param_to_set_control_put(struct snd_kcontrol *kcontrol, int msm_dolby_dap_param_to_get_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int rc = 0, i; int rc = 0, i, index; char *params_value; int *update_params_value; uint32_t params_length = DOLBY_MAX_LENGTH_INDIVIDUAL_PARAM * sizeof(uint32_t); uint32_t param_payload_len = DOLBY_PARAM_PAYLOAD_SIZE * sizeof(uint32_t); int port_id = dolby_dap_params_states.port_id; int port_id = dolby_dap_params_get.port_id, copp_idx; if (port_id == DOLBY_INVALID_PORT_ID) { pr_err("%s, port_id not set, do not query ADM\n", __func__); return -EINVAL; } index = adm_validate_and_get_port_index(port_id); if (index < 0) { pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index, port_id); return -EINVAL; } copp_idx = dolby_dap_params_states.copp_idx[index]; if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_debug("%s: get params called before copp open.copp_idx:%d\n", __func__, copp_idx); return -EINVAL; } params_value = kzalloc(params_length, GFP_KERNEL); if (!params_value) { pr_err("%s, params memory alloc failed\n", __func__); return -ENOMEM; } if (DOLBY_PARAM_ID_VER == dolby_dap_params_get.param_id) { rc = adm_get_params(dolby_dap_params_get.port_id, DOLBY_BUNDLE_MODULE_ID, DOLBY_PARAM_ID_VER, params_length + param_payload_len, rc = adm_get_params(port_id, copp_idx, DOLBY_BUNDLE_MODULE_ID, DOLBY_PARAM_ID_VER, params_length + param_payload_len, params_value); } else { for (i = 0; i < MAX_DOLBY_PARAMS; i++) Loading @@ -789,17 +837,15 @@ int msm_dolby_dap_param_to_get_control_get(struct snd_kcontrol *kcontrol, params_length = (dolby_dap_params_length[i] + DOLBY_PARAM_PAYLOAD_SIZE) * sizeof(uint32_t); rc = adm_get_params( dolby_dap_params_get.port_id, rc = adm_get_params(port_id, copp_idx, DOLBY_BUNDLE_MODULE_ID, dolby_dap_params_id[i], params_length + param_payload_len, params_length + param_payload_len, params_value); } } if (rc) { pr_err("%s: get parameters failed\n", __func__); pr_err("%s: get parameters failed rc:%d\n", __func__, rc); kfree(params_value); return -EINVAL; } Loading Loading @@ -828,12 +874,23 @@ int msm_dolby_dap_param_to_get_control_get(struct snd_kcontrol *kcontrol, int msm_dolby_dap_param_to_get_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int port_id, idx, copp_idx; dolby_dap_params_get.device_id = ucontrol->value.integer.value[0]; dolby_dap_params_get.port_id = (dolby_dap_params_get.device_id == DEVICE_OUT_ALL) ? dolby_dap_params_states.port_id : msm_dolby_dap_map_device_to_port_id( port_id = msm_dolby_dap_map_device_to_port_id( dolby_dap_params_get.device_id); for (idx = 0; idx < AFE_MAX_PORTS; idx++) { port_id = dolby_dap_params_states.port_id[idx]; copp_idx = dolby_dap_params_states.copp_idx[idx]; if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT) || (port_id == DOLBY_INVALID_PORT_ID)) continue; else break; } if (idx == AFE_MAX_PORTS) port_id = SLIMBUS_0_RX; dolby_dap_params_get.port_id = port_id; dolby_dap_params_get.param_id = ucontrol->value.integer.value[1]; dolby_dap_params_get.offset = ucontrol->value.integer.value[2]; dolby_dap_params_get.length = ucontrol->value.integer.value[3]; Loading @@ -854,8 +911,18 @@ int msm_dolby_dap_param_visualizer_control_get(struct snd_kcontrol *kcontrol, (2*length + DOLBY_VIS_PARAM_HEADER_SIZE)*sizeof(uint32_t); uint32_t param_payload_len = DOLBY_PARAM_PAYLOAD_SIZE * sizeof(uint32_t); int port_id = dolby_dap_params_states.port_id; if (port_id == DOLBY_INVALID_PORT_ID) { int port_id, copp_idx, idx; for (idx = 0; idx < AFE_MAX_PORTS; idx++) { port_id = dolby_dap_params_states.port_id[idx]; copp_idx = dolby_dap_params_states.copp_idx[idx]; if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT) || (port_id == DOLBY_INVALID_PORT_ID)) continue; else break; } if (idx == AFE_MAX_PORTS) { pr_debug("%s, port_id not set, returning error", __func__); ucontrol->value.integer.value[0] = 0; return -EINVAL; Loading @@ -867,8 +934,7 @@ int msm_dolby_dap_param_visualizer_control_get(struct snd_kcontrol *kcontrol, } offset = 0; params_length = length * sizeof(uint32_t); rc = adm_get_params(dolby_dap_params_states.port_id, DOLBY_BUNDLE_MODULE_ID, rc = adm_get_params(port_id, copp_idx, DOLBY_BUNDLE_MODULE_ID, DOLBY_PARAM_ID_VCBG, params_length + param_payload_len, visualizer_data + offset); Loading @@ -879,8 +945,7 @@ int msm_dolby_dap_param_visualizer_control_get(struct snd_kcontrol *kcontrol, } offset = length * sizeof(uint32_t); rc = adm_get_params(dolby_dap_params_states.port_id, DOLBY_BUNDLE_MODULE_ID, rc = adm_get_params(port_id, copp_idx, DOLBY_BUNDLE_MODULE_ID, DOLBY_PARAM_ID_VCBE, params_length + param_payload_len, visualizer_data + offset); Loading sound/soc/msm/qdsp6v2/msm-dolby-dap-config.h +6 −4 Original line number Diff line number Diff line Loading @@ -300,20 +300,22 @@ struct dolby_dap_params { uint32_t value[TOTAL_LENGTH_DOLBY_PARAM + MAX_DOLBY_PARAMS]; } __packed; int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on); int msm_dolby_dap_init(int port_id, int copp_idx, int channels, bool is_custom_stereo_on); void msm_dolby_dap_deinit(int port_id); void msm_dolby_dap_add_controls(struct snd_soc_platform *platform); int dolby_dap_set_custom_stereo_onoff(int port_id, int dolby_dap_set_custom_stereo_onoff(int port_id, int copp_idx, bool is_custom_stereo_enabled); /* Dolby DOLBY end */ #else int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on) int msm_dolby_dap_init(int port_id, int copp_idx, int channels, bool is_custom_stereo_on) { return 0; } void msm_dolby_dap_deinit(int port_id) { } void msm_dolby_dap_add_controls(struct snd_soc_platform *platform) { } int dolby_dap_set_custom_stereo_onoff(int port_id, int dolby_dap_set_custom_stereo_onoff(int port_id, int copp_idx, bool is_custom_stereo_enabled) { return 0; Loading sound/soc/msm/qdsp6v2/msm-dts-srs-tm-config.c +64 −25 Original line number Diff line number Diff line Loading @@ -21,47 +21,68 @@ #include "msm-dts-srs-tm-config.h" #include "msm-pcm-routing-v2.h" static int srs_port_id = -1; static int srs_port_id[AFE_MAX_PORTS] = {-1}; static int srs_copp_idx[AFE_MAX_PORTS] = {-1}; static int srs_alsa_ctrl_ever_called; static union srs_trumedia_params_u msm_srs_trumedia_params[2]; void msm_dts_srs_tm_set_port_id(int port_id) static int set_port_id(int port_id, int copp_idx) { srs_port_id = port_id; int index = adm_validate_and_get_port_index(port_id); if (index < 0) { pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index, port_id); return -EINVAL; } srs_port_id[index] = port_id; srs_copp_idx[index] = copp_idx; return 0; } void msm_dts_srs_tm_send_params(int port_id, unsigned int techs, static void msm_dts_srs_tm_send_params(int port_id, unsigned int techs, int param_block_idx) { msm_dts_srs_tm_set_port_id(port_id); int index; /* only send commands to dsp if srs alsa ctrl was used at least one time */ if (!srs_alsa_ctrl_ever_called) return; pr_debug("SRS %s: called, port_id = %d, techs flags = %u, paramblockidx %d", index = adm_validate_and_get_port_index(port_id); if (index < 0) { pr_err("%s: Invalid port idx %d port_id 0x%x\n", __func__, index, port_id); return; } if ((srs_copp_idx[index] < 0) || (srs_copp_idx[index] >= MAX_COPPS_PER_PORT)) { pr_debug("%s: send params called before copp open. so, caching\n", __func__); return; } pr_debug("SRS %s: called, port_id = %d, techs flags = %u, paramblockidx %d\n", __func__, port_id, techs, param_block_idx); /* force all if techs is set to 1 */ if (techs == 1) techs = 0xFFFFFFFF; if (techs & (1 << SRS_ID_WOWHD)) srs_trumedia_open(port_id, SRS_ID_WOWHD, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_WOWHD, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.wowhd); if (techs & (1 << SRS_ID_CSHP)) srs_trumedia_open(port_id, SRS_ID_CSHP, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_CSHP, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.cshp); if (techs & (1 << SRS_ID_HPF)) srs_trumedia_open(port_id, SRS_ID_HPF, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_HPF, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.hpf); if (techs & (1 << SRS_ID_PEQ)) srs_trumedia_open(port_id, SRS_ID_PEQ, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_PEQ, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.peq); if (techs & (1 << SRS_ID_HL)) srs_trumedia_open(port_id, SRS_ID_HL, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_HL, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.hl); if (techs & (1 << SRS_ID_GLOBAL)) srs_trumedia_open(port_id, SRS_ID_GLOBAL, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_GLOBAL, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.global); } Loading @@ -73,7 +94,8 @@ static int msm_dts_srs_trumedia_control_get(struct snd_kcontrol *kcontrol, return 0; } static int msm_dts_srs_trumedia_control_set_(struct snd_kcontrol *kcontrol, static int msm_dts_srs_trumedia_control_set_(int port_id, struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { unsigned int techs = 0; Loading @@ -90,7 +112,7 @@ static int msm_dts_srs_trumedia_control_set_(struct snd_kcontrol *kcontrol, pr_debug("SRS %s: send params request, flags = %u", __func__, techs); if (srs_port_id >= 0 && techs) msm_dts_srs_tm_send_params(srs_port_id, techs, index); msm_dts_srs_tm_send_params(port_id, techs, index); return 0; } offset = (unsigned short)((ucontrol->value.integer.value[0] & Loading Loading @@ -129,12 +151,12 @@ static int msm_dts_srs_trumedia_control_set_(struct snd_kcontrol *kcontrol, static int msm_dts_srs_trumedia_control_set(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int ret; int ret, port_id; pr_debug("SRS control normal called"); msm_pcm_routing_acquire_lock(); srs_port_id = SLIMBUS_0_RX; ret = msm_dts_srs_trumedia_control_set_(kcontrol, ucontrol); port_id = SLIMBUS_0_RX; ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); msm_pcm_routing_release_lock(); return ret; } Loading @@ -142,12 +164,12 @@ static int msm_dts_srs_trumedia_control_set(struct snd_kcontrol *kcontrol, static int msm_dts_srs_trumedia_control_i2s_set(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int ret; int ret, port_id; pr_debug("SRS control I2S called"); msm_pcm_routing_acquire_lock(); srs_port_id = PRIMARY_I2S_RX; ret = msm_dts_srs_trumedia_control_set_(kcontrol, ucontrol); port_id = PRIMARY_I2S_RX; ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); msm_pcm_routing_release_lock(); return ret; } Loading @@ -155,12 +177,12 @@ static int msm_dts_srs_trumedia_control_i2s_set(struct snd_kcontrol *kcontrol, static int msm_dts_srs_trumedia_control_hdmi_set(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int ret; int ret, port_id; pr_debug("SRS control HDMI called"); msm_pcm_routing_acquire_lock(); srs_port_id = HDMI_RX; ret = msm_dts_srs_trumedia_control_set_(kcontrol, ucontrol); port_id = HDMI_RX; ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); msm_pcm_routing_release_lock(); return ret; } Loading Loading @@ -239,3 +261,20 @@ void msm_dts_srs_tm_add_controls(struct snd_soc_platform *platform) lpa_srs_trumedia_controls_i2s, ARRAY_SIZE(lpa_srs_trumedia_controls_i2s)); } void msm_dts_srs_tm_deinit(int port_id) { set_port_id(port_id, -1); return; } void msm_dts_srs_tm_init(int port_id, int copp_idx) { if (!set_port_id(port_id, copp_idx)) { pr_err("%s: Invalid port_id: %d\n", __func__, port_id); return; } msm_dts_srs_tm_send_params(port_id, 1, 0); return; } Loading
include/sound/q6adm-v2.h +27 −22 Original line number Diff line number Diff line Loading @@ -21,26 +21,29 @@ #include <sound/q6audio-v2.h> #define MAX_COPPS_PER_PORT 0x8 /* multiple copp per stream. */ struct route_payload { unsigned int copp_ids[AFE_MAX_PORTS]; unsigned int copp_idx[MAX_COPPS_PER_PORT]; unsigned int port_id[MAX_COPPS_PER_PORT]; int app_type; int acdb_dev_id; unsigned short num_copps; unsigned int session_id; }; int srs_trumedia_open(int port_id, int srs_tech_id, void *srs_params); int srs_trumedia_open(int port_id, int copp_idx, int srs_tech_id, void *srs_params); int adm_open(int port, int path, int rate, int mode, int topology, int perf_mode, uint16_t bits_per_sample); int adm_get_params(int port_id, uint32_t module_id, uint32_t param_id, uint32_t params_length, char *params); int adm_get_params(int port_id, int copp_idx, uint32_t module_id, uint32_t param_id, uint32_t params_length, char *params); int adm_dolby_dap_send_params(int port_id, char *params, int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params, uint32_t params_length); int adm_multi_ch_copp_open(int port, int path, int rate, int mode, int topology, int perf_mode, uint16_t bits_per_sample); int adm_open(int port, int path, int rate, int mode, int topology, int perf_mode, uint16_t bits_per_sample, int app_type); int adm_unmap_cal_blocks(void); Loading @@ -48,29 +51,31 @@ int adm_map_rtac_block(struct rtac_cal_block_data *cal_block); int adm_unmap_rtac_block(uint32_t *mem_map_handle); int adm_memory_map_regions(int port_id, phys_addr_t *buf_add, uint32_t mempool_id, uint32_t *bufsz, uint32_t bufcnt); int adm_memory_unmap_regions(int port_id); int adm_close(int port, int perf_mode); int adm_close(int port, int topology, int perf_mode); int adm_matrix_map(int session_id, int path, int num_copps, unsigned int *port_id, int copp_id, int perf_mode); int adm_matrix_map(int path, struct route_payload payload_map, int perf_mode); int adm_connect_afe_port(int mode, int session_id, int port_id); void adm_ec_ref_rx_id(int port_id); int adm_get_copp_id(int port_id); int adm_get_lowlatency_copp_id(int port_id); void adm_set_multi_ch_map(char *channel_map); void adm_get_multi_ch_map(char *channel_map); int adm_set_stereo_to_custom_stereo(int port_id, unsigned int session_id, int adm_validate_and_get_port_index(int port_id); int adm_get_default_copp_idx(int port_id); int adm_get_topology_for_port_from_copp_id(int port_id, int copp_id); int adm_validate_copp_id(int copp_id); int adm_set_stereo_to_custom_stereo(int port_id, int copp_idx, unsigned int session_id, char *params, uint32_t params_length); #endif /* __Q6_ADM_V2_H__ */
sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c +5 −1 Original line number Diff line number Diff line Loading @@ -633,10 +633,14 @@ static int msm_compr_configure_dsp(struct snd_compr_stream *cstream) prtd->gapless_state.stream_opened[stream_index] = 1; pr_debug("%s be_id %d\n", __func__, soc_prtd->dai_link->be_id); msm_pcm_routing_reg_phy_stream(soc_prtd->dai_link->be_id, ret = msm_pcm_routing_reg_phy_stream(soc_prtd->dai_link->be_id, ac->perf_mode, prtd->session_id, SNDRV_PCM_STREAM_PLAYBACK); if (ret) { pr_err("%s: stream reg failed:%d\n", __func__, ret); return ret; } ret = msm_compr_set_volume(cstream, 0, 0); if (ret < 0) Loading
sound/soc/msm/qdsp6v2/msm-dolby-dap-config.c +133 −68 Original line number Diff line number Diff line Loading @@ -324,7 +324,8 @@ struct dolby_dap_params_states_s { bool use_cache; bool auto_endp; bool enddep_params; int port_id; int port_id[AFE_MAX_PORTS]; int copp_idx[AFE_MAX_PORTS]; int port_open_count; int port_ids_dolby_can_be_enabled; int device; Loading @@ -333,8 +334,8 @@ struct dolby_dap_params_states_s { static struct dolby_dap_params_get_s dolby_dap_params_get = {-1, DEVICE_OUT_ALL, 0, 0, 0}; static struct dolby_dap_params_states_s dolby_dap_params_states = { true, true, true, DOLBY_INVALID_PORT_ID, 0, DEVICE_OUT_ALL, 0 }; true, {DOLBY_INVALID_PORT_ID}, {-1}, 0, DEVICE_OUT_ALL, 0 }; /* port_ids_dolby_can_be_enabled is set to 0x7FFFFFFF. this needs to be removed after interface validation Loading @@ -356,7 +357,7 @@ static int msm_dolby_dap_map_device_to_dolby_endpoint(int device) return dolby_dap_device; } static int msm_dolby_dap_send_end_point(int port_id) static int msm_dolby_dap_send_end_point(int port_id, int copp_idx) { int rc = 0; char *params_value; Loading @@ -377,7 +378,8 @@ static int msm_dolby_dap_send_end_point(int port_id) *update_params_value++ = msm_dolby_dap_map_device_to_dolby_endpoint( dolby_dap_params_states.device); rc = adm_dolby_dap_send_params(port_id, params_value, params_length); rc = adm_dolby_dap_send_params(port_id, copp_idx, params_value, params_length); if (rc) { pr_err("%s: send dolby params failed\n", __func__); rc = -EINVAL; Loading @@ -386,7 +388,8 @@ static int msm_dolby_dap_send_end_point(int port_id) return rc; } static int msm_dolby_dap_send_enddep_params(int port_id, int device_channels) static int msm_dolby_dap_send_enddep_params(int port_id, int copp_idx, int device_channels) { int i, j, rc = 0, idx, offset; char *params_value; Loading Loading @@ -433,7 +436,8 @@ static int msm_dolby_dap_send_enddep_params(int port_id, int device_channels) *update_params_value++ = dolby_dap_endp_params[idx].params_val[offset+j]; } rc = adm_dolby_dap_send_params(port_id, params_value, params_length); rc = adm_dolby_dap_send_params(port_id, copp_idx, params_value, params_length); if (rc) { pr_err("%s: send dolby params failed\n", __func__); rc = -EINVAL; Loading @@ -442,7 +446,8 @@ static int msm_dolby_dap_send_enddep_params(int port_id, int device_channels) return rc; } static int msm_dolby_dap_send_cached_params(int port_id, int commit) static int msm_dolby_dap_send_cached_params(int port_id, int copp_idx, int commit) { char *params_value; int *update_params_value, rc = 0; Loading Loading @@ -478,7 +483,7 @@ static int msm_dolby_dap_send_cached_params(int port_id, int commit) } pr_debug("%s, valid param length: %d", __func__, params_length); if (params_length) { rc = adm_dolby_dap_send_params(port_id, params_value, rc = adm_dolby_dap_send_params(port_id, copp_idx, params_value, params_length); if (rc) { pr_err("%s: send dolby params failed\n", __func__); Loading @@ -499,23 +504,31 @@ static int msm_dolby_dap_send_cached_params(int port_id, int commit) return 0; } int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on) int msm_dolby_dap_init(int port_id, int copp_idx, int channels, bool is_custom_stereo_on) { int ret = 0; int index = adm_validate_and_get_port_index(port_id); if (index < 0) { pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index, port_id); return -EINVAL; } if ((port_id != DOLBY_INVALID_PORT_ID) && (port_id & dolby_dap_params_states.port_ids_dolby_can_be_enabled)) { dolby_dap_params_states.port_id = port_id; (port_id & dolby_dap_params_states.port_ids_dolby_can_be_enabled)) { dolby_dap_params_states.port_id[index] = port_id; dolby_dap_params_states.copp_idx[index] = copp_idx; dolby_dap_params_states.port_open_count++; if (dolby_dap_params_states.auto_endp) { ret = msm_dolby_dap_send_end_point(port_id); ret = msm_dolby_dap_send_end_point(port_id, copp_idx); if (ret) { pr_err("%s: err sending endppoint\n", __func__); return ret; } } if (dolby_dap_params_states.use_cache) { ret = msm_dolby_dap_send_cached_params(port_id, 0); ret = msm_dolby_dap_send_cached_params(port_id, copp_idx, 0); if (ret) { pr_err("%s: err sending cached params\n", __func__); Loading @@ -523,7 +536,7 @@ int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on) } } if (dolby_dap_params_states.enddep_params) { msm_dolby_dap_send_enddep_params(port_id, msm_dolby_dap_send_enddep_params(port_id, copp_idx, channels); if (ret) { pr_err("%s: err sending endp dependent params\n", Loading @@ -532,7 +545,7 @@ int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on) } } if (is_custom_stereo_on) dolby_dap_set_custom_stereo_onoff(port_id, dolby_dap_set_custom_stereo_onoff(port_id, copp_idx, is_custom_stereo_on); } return ret; Loading @@ -540,13 +553,21 @@ int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on) void msm_dolby_dap_deinit(int port_id) { int index = adm_validate_and_get_port_index(port_id); if (index < 0) { pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index, port_id); return; } dolby_dap_params_states.port_open_count--; if ((dolby_dap_params_states.port_id == port_id) && (!dolby_dap_params_states.port_open_count)) dolby_dap_params_states.port_id = DOLBY_INVALID_PORT_ID; if ((dolby_dap_params_states.port_id[index] == port_id) && (!dolby_dap_params_states.port_open_count)) { dolby_dap_params_states.port_id[index] = DOLBY_INVALID_PORT_ID; dolby_dap_params_states.copp_idx[index] = -1; } } static int msm_dolby_dap_set_vspe_vdhe(int port_id, static int msm_dolby_dap_set_vspe_vdhe(int port_id, int copp_idx, bool is_custom_stereo_enabled) { char *params_value; Loading Loading @@ -586,7 +607,7 @@ static int msm_dolby_dap_set_vspe_vdhe(int port_id, } pr_debug("%s, valid param length: %d", __func__, params_length); if (params_length) { rc = adm_dolby_dap_send_params(port_id, params_value, rc = adm_dolby_dap_send_params(port_id, copp_idx, params_value, params_length); if (rc) { pr_err("%s: send vdhe/vspe params failed with rc=%d\n", Loading @@ -599,7 +620,7 @@ static int msm_dolby_dap_set_vspe_vdhe(int port_id, return 0; } int dolby_dap_set_custom_stereo_onoff(int port_id, int dolby_dap_set_custom_stereo_onoff(int port_id, int copp_idx, bool is_custom_stereo_enabled) { char *params_value; Loading @@ -610,7 +631,8 @@ int dolby_dap_set_custom_stereo_onoff(int port_id, if (port_id == DOLBY_INVALID_PORT_ID) return -EINVAL; msm_dolby_dap_set_vspe_vdhe(port_id, is_custom_stereo_enabled); msm_dolby_dap_set_vspe_vdhe(port_id, copp_idx, is_custom_stereo_enabled); params_value = kzalloc(params_length, GFP_KERNEL); if (!params_value) { pr_err("%s, params memory alloc failed\n", __func__); Loading @@ -628,7 +650,7 @@ int dolby_dap_set_custom_stereo_onoff(int port_id, params_length += (DOLBY_PARAM_PAYLOAD_SIZE + 1) * sizeof(uint32_t); pr_debug("%s, valid param length: %d", __func__, params_length); if (params_length) { rc = adm_dolby_dap_send_params(port_id, params_value, rc = adm_dolby_dap_send_params(port_id, copp_idx, params_value, params_length); if (rc) { pr_err("%s: setting ds1 custom stereo param failed with rc=%d\n", Loading Loading @@ -670,15 +692,13 @@ int msm_dolby_dap_param_to_set_control_get(struct snd_kcontrol *kcontrol, int msm_dolby_dap_param_to_set_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int rc = 0; int rc = 0, port_id, copp_idx; uint32_t idx, j; uint32_t device = ucontrol->value.integer.value[0]; uint32_t param_id = ucontrol->value.integer.value[1]; uint32_t offset = ucontrol->value.integer.value[2]; uint32_t length = ucontrol->value.integer.value[3]; int port_id = dolby_dap_params_states.port_id; dolby_dap_params_states.port_ids_dolby_can_be_enabled = msm_dolby_dap_map_device_to_port_id(device); for (idx = 0; idx < ALL_DOLBY_PARAMS; idx++) { Loading @@ -695,18 +715,36 @@ int msm_dolby_dap_param_to_set_control_put(struct snd_kcontrol *kcontrol, case DOLBY_COMMIT_ALL_IDX: { /* COMIIT ALL: Send all parameters to DSP */ pr_debug("%s: COMMIT_ALL recvd\n", __func__); if (port_id != DOLBY_INVALID_PORT_ID) rc = msm_dolby_dap_send_cached_params(port_id, for (idx = 0; idx < AFE_MAX_PORTS; idx++) { port_id = dolby_dap_params_states.port_id[idx]; copp_idx = dolby_dap_params_states.copp_idx[idx]; if ((copp_idx > 0) && (copp_idx < MAX_COPPS_PER_PORT) && (port_id != DOLBY_INVALID_PORT_ID)) rc |= msm_dolby_dap_send_cached_params( port_id, copp_idx, 0); } } break; case DOLBY_COMMIT_IDX: { pr_debug("%s: COMMIT recvd\n", __func__); /* COMMIT: Send only modified paramters to DSP */ if (port_id != DOLBY_INVALID_PORT_ID) rc = msm_dolby_dap_send_cached_params(port_id, for (idx = 0; idx < AFE_MAX_PORTS; idx++) { port_id = dolby_dap_params_states.port_id[idx]; copp_idx = dolby_dap_params_states.copp_idx[idx]; if ((copp_idx > 0) && (copp_idx < MAX_COPPS_PER_PORT) && (port_id == DOLBY_INVALID_PORT_ID)) rc |= msm_dolby_dap_send_cached_params( port_id, copp_idx, 1); } } break; case DOLBY_USE_CACHE_IDX: { pr_debug("%s: USE CACHE recvd val: %ld\n", __func__, Loading Loading @@ -752,30 +790,40 @@ int msm_dolby_dap_param_to_set_control_put(struct snd_kcontrol *kcontrol, int msm_dolby_dap_param_to_get_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int rc = 0, i; int rc = 0, i, index; char *params_value; int *update_params_value; uint32_t params_length = DOLBY_MAX_LENGTH_INDIVIDUAL_PARAM * sizeof(uint32_t); uint32_t param_payload_len = DOLBY_PARAM_PAYLOAD_SIZE * sizeof(uint32_t); int port_id = dolby_dap_params_states.port_id; int port_id = dolby_dap_params_get.port_id, copp_idx; if (port_id == DOLBY_INVALID_PORT_ID) { pr_err("%s, port_id not set, do not query ADM\n", __func__); return -EINVAL; } index = adm_validate_and_get_port_index(port_id); if (index < 0) { pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index, port_id); return -EINVAL; } copp_idx = dolby_dap_params_states.copp_idx[index]; if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_debug("%s: get params called before copp open.copp_idx:%d\n", __func__, copp_idx); return -EINVAL; } params_value = kzalloc(params_length, GFP_KERNEL); if (!params_value) { pr_err("%s, params memory alloc failed\n", __func__); return -ENOMEM; } if (DOLBY_PARAM_ID_VER == dolby_dap_params_get.param_id) { rc = adm_get_params(dolby_dap_params_get.port_id, DOLBY_BUNDLE_MODULE_ID, DOLBY_PARAM_ID_VER, params_length + param_payload_len, rc = adm_get_params(port_id, copp_idx, DOLBY_BUNDLE_MODULE_ID, DOLBY_PARAM_ID_VER, params_length + param_payload_len, params_value); } else { for (i = 0; i < MAX_DOLBY_PARAMS; i++) Loading @@ -789,17 +837,15 @@ int msm_dolby_dap_param_to_get_control_get(struct snd_kcontrol *kcontrol, params_length = (dolby_dap_params_length[i] + DOLBY_PARAM_PAYLOAD_SIZE) * sizeof(uint32_t); rc = adm_get_params( dolby_dap_params_get.port_id, rc = adm_get_params(port_id, copp_idx, DOLBY_BUNDLE_MODULE_ID, dolby_dap_params_id[i], params_length + param_payload_len, params_length + param_payload_len, params_value); } } if (rc) { pr_err("%s: get parameters failed\n", __func__); pr_err("%s: get parameters failed rc:%d\n", __func__, rc); kfree(params_value); return -EINVAL; } Loading Loading @@ -828,12 +874,23 @@ int msm_dolby_dap_param_to_get_control_get(struct snd_kcontrol *kcontrol, int msm_dolby_dap_param_to_get_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int port_id, idx, copp_idx; dolby_dap_params_get.device_id = ucontrol->value.integer.value[0]; dolby_dap_params_get.port_id = (dolby_dap_params_get.device_id == DEVICE_OUT_ALL) ? dolby_dap_params_states.port_id : msm_dolby_dap_map_device_to_port_id( port_id = msm_dolby_dap_map_device_to_port_id( dolby_dap_params_get.device_id); for (idx = 0; idx < AFE_MAX_PORTS; idx++) { port_id = dolby_dap_params_states.port_id[idx]; copp_idx = dolby_dap_params_states.copp_idx[idx]; if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT) || (port_id == DOLBY_INVALID_PORT_ID)) continue; else break; } if (idx == AFE_MAX_PORTS) port_id = SLIMBUS_0_RX; dolby_dap_params_get.port_id = port_id; dolby_dap_params_get.param_id = ucontrol->value.integer.value[1]; dolby_dap_params_get.offset = ucontrol->value.integer.value[2]; dolby_dap_params_get.length = ucontrol->value.integer.value[3]; Loading @@ -854,8 +911,18 @@ int msm_dolby_dap_param_visualizer_control_get(struct snd_kcontrol *kcontrol, (2*length + DOLBY_VIS_PARAM_HEADER_SIZE)*sizeof(uint32_t); uint32_t param_payload_len = DOLBY_PARAM_PAYLOAD_SIZE * sizeof(uint32_t); int port_id = dolby_dap_params_states.port_id; if (port_id == DOLBY_INVALID_PORT_ID) { int port_id, copp_idx, idx; for (idx = 0; idx < AFE_MAX_PORTS; idx++) { port_id = dolby_dap_params_states.port_id[idx]; copp_idx = dolby_dap_params_states.copp_idx[idx]; if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT) || (port_id == DOLBY_INVALID_PORT_ID)) continue; else break; } if (idx == AFE_MAX_PORTS) { pr_debug("%s, port_id not set, returning error", __func__); ucontrol->value.integer.value[0] = 0; return -EINVAL; Loading @@ -867,8 +934,7 @@ int msm_dolby_dap_param_visualizer_control_get(struct snd_kcontrol *kcontrol, } offset = 0; params_length = length * sizeof(uint32_t); rc = adm_get_params(dolby_dap_params_states.port_id, DOLBY_BUNDLE_MODULE_ID, rc = adm_get_params(port_id, copp_idx, DOLBY_BUNDLE_MODULE_ID, DOLBY_PARAM_ID_VCBG, params_length + param_payload_len, visualizer_data + offset); Loading @@ -879,8 +945,7 @@ int msm_dolby_dap_param_visualizer_control_get(struct snd_kcontrol *kcontrol, } offset = length * sizeof(uint32_t); rc = adm_get_params(dolby_dap_params_states.port_id, DOLBY_BUNDLE_MODULE_ID, rc = adm_get_params(port_id, copp_idx, DOLBY_BUNDLE_MODULE_ID, DOLBY_PARAM_ID_VCBE, params_length + param_payload_len, visualizer_data + offset); Loading
sound/soc/msm/qdsp6v2/msm-dolby-dap-config.h +6 −4 Original line number Diff line number Diff line Loading @@ -300,20 +300,22 @@ struct dolby_dap_params { uint32_t value[TOTAL_LENGTH_DOLBY_PARAM + MAX_DOLBY_PARAMS]; } __packed; int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on); int msm_dolby_dap_init(int port_id, int copp_idx, int channels, bool is_custom_stereo_on); void msm_dolby_dap_deinit(int port_id); void msm_dolby_dap_add_controls(struct snd_soc_platform *platform); int dolby_dap_set_custom_stereo_onoff(int port_id, int dolby_dap_set_custom_stereo_onoff(int port_id, int copp_idx, bool is_custom_stereo_enabled); /* Dolby DOLBY end */ #else int msm_dolby_dap_init(int port_id, int channels, bool is_custom_stereo_on) int msm_dolby_dap_init(int port_id, int copp_idx, int channels, bool is_custom_stereo_on) { return 0; } void msm_dolby_dap_deinit(int port_id) { } void msm_dolby_dap_add_controls(struct snd_soc_platform *platform) { } int dolby_dap_set_custom_stereo_onoff(int port_id, int dolby_dap_set_custom_stereo_onoff(int port_id, int copp_idx, bool is_custom_stereo_enabled) { return 0; Loading
sound/soc/msm/qdsp6v2/msm-dts-srs-tm-config.c +64 −25 Original line number Diff line number Diff line Loading @@ -21,47 +21,68 @@ #include "msm-dts-srs-tm-config.h" #include "msm-pcm-routing-v2.h" static int srs_port_id = -1; static int srs_port_id[AFE_MAX_PORTS] = {-1}; static int srs_copp_idx[AFE_MAX_PORTS] = {-1}; static int srs_alsa_ctrl_ever_called; static union srs_trumedia_params_u msm_srs_trumedia_params[2]; void msm_dts_srs_tm_set_port_id(int port_id) static int set_port_id(int port_id, int copp_idx) { srs_port_id = port_id; int index = adm_validate_and_get_port_index(port_id); if (index < 0) { pr_err("%s: Invalid port idx %d port_id %#x\n", __func__, index, port_id); return -EINVAL; } srs_port_id[index] = port_id; srs_copp_idx[index] = copp_idx; return 0; } void msm_dts_srs_tm_send_params(int port_id, unsigned int techs, static void msm_dts_srs_tm_send_params(int port_id, unsigned int techs, int param_block_idx) { msm_dts_srs_tm_set_port_id(port_id); int index; /* only send commands to dsp if srs alsa ctrl was used at least one time */ if (!srs_alsa_ctrl_ever_called) return; pr_debug("SRS %s: called, port_id = %d, techs flags = %u, paramblockidx %d", index = adm_validate_and_get_port_index(port_id); if (index < 0) { pr_err("%s: Invalid port idx %d port_id 0x%x\n", __func__, index, port_id); return; } if ((srs_copp_idx[index] < 0) || (srs_copp_idx[index] >= MAX_COPPS_PER_PORT)) { pr_debug("%s: send params called before copp open. so, caching\n", __func__); return; } pr_debug("SRS %s: called, port_id = %d, techs flags = %u, paramblockidx %d\n", __func__, port_id, techs, param_block_idx); /* force all if techs is set to 1 */ if (techs == 1) techs = 0xFFFFFFFF; if (techs & (1 << SRS_ID_WOWHD)) srs_trumedia_open(port_id, SRS_ID_WOWHD, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_WOWHD, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.wowhd); if (techs & (1 << SRS_ID_CSHP)) srs_trumedia_open(port_id, SRS_ID_CSHP, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_CSHP, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.cshp); if (techs & (1 << SRS_ID_HPF)) srs_trumedia_open(port_id, SRS_ID_HPF, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_HPF, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.hpf); if (techs & (1 << SRS_ID_PEQ)) srs_trumedia_open(port_id, SRS_ID_PEQ, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_PEQ, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.peq); if (techs & (1 << SRS_ID_HL)) srs_trumedia_open(port_id, SRS_ID_HL, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_HL, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.hl); if (techs & (1 << SRS_ID_GLOBAL)) srs_trumedia_open(port_id, SRS_ID_GLOBAL, srs_trumedia_open(port_id, srs_copp_idx[index], SRS_ID_GLOBAL, (void *)&msm_srs_trumedia_params[param_block_idx].srs_params.global); } Loading @@ -73,7 +94,8 @@ static int msm_dts_srs_trumedia_control_get(struct snd_kcontrol *kcontrol, return 0; } static int msm_dts_srs_trumedia_control_set_(struct snd_kcontrol *kcontrol, static int msm_dts_srs_trumedia_control_set_(int port_id, struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { unsigned int techs = 0; Loading @@ -90,7 +112,7 @@ static int msm_dts_srs_trumedia_control_set_(struct snd_kcontrol *kcontrol, pr_debug("SRS %s: send params request, flags = %u", __func__, techs); if (srs_port_id >= 0 && techs) msm_dts_srs_tm_send_params(srs_port_id, techs, index); msm_dts_srs_tm_send_params(port_id, techs, index); return 0; } offset = (unsigned short)((ucontrol->value.integer.value[0] & Loading Loading @@ -129,12 +151,12 @@ static int msm_dts_srs_trumedia_control_set_(struct snd_kcontrol *kcontrol, static int msm_dts_srs_trumedia_control_set(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int ret; int ret, port_id; pr_debug("SRS control normal called"); msm_pcm_routing_acquire_lock(); srs_port_id = SLIMBUS_0_RX; ret = msm_dts_srs_trumedia_control_set_(kcontrol, ucontrol); port_id = SLIMBUS_0_RX; ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); msm_pcm_routing_release_lock(); return ret; } Loading @@ -142,12 +164,12 @@ static int msm_dts_srs_trumedia_control_set(struct snd_kcontrol *kcontrol, static int msm_dts_srs_trumedia_control_i2s_set(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int ret; int ret, port_id; pr_debug("SRS control I2S called"); msm_pcm_routing_acquire_lock(); srs_port_id = PRIMARY_I2S_RX; ret = msm_dts_srs_trumedia_control_set_(kcontrol, ucontrol); port_id = PRIMARY_I2S_RX; ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); msm_pcm_routing_release_lock(); return ret; } Loading @@ -155,12 +177,12 @@ static int msm_dts_srs_trumedia_control_i2s_set(struct snd_kcontrol *kcontrol, static int msm_dts_srs_trumedia_control_hdmi_set(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int ret; int ret, port_id; pr_debug("SRS control HDMI called"); msm_pcm_routing_acquire_lock(); srs_port_id = HDMI_RX; ret = msm_dts_srs_trumedia_control_set_(kcontrol, ucontrol); port_id = HDMI_RX; ret = msm_dts_srs_trumedia_control_set_(port_id, kcontrol, ucontrol); msm_pcm_routing_release_lock(); return ret; } Loading Loading @@ -239,3 +261,20 @@ void msm_dts_srs_tm_add_controls(struct snd_soc_platform *platform) lpa_srs_trumedia_controls_i2s, ARRAY_SIZE(lpa_srs_trumedia_controls_i2s)); } void msm_dts_srs_tm_deinit(int port_id) { set_port_id(port_id, -1); return; } void msm_dts_srs_tm_init(int port_id, int copp_idx) { if (!set_port_id(port_id, copp_idx)) { pr_err("%s: Invalid port_id: %d\n", __func__, port_id); return; } msm_dts_srs_tm_send_params(port_id, 1, 0); return; }