int msm_snddev_set_dec(int popp_id, int copp_id, int set, int rate, int mode) { int rc = 0, i = 0; int rc2 = 0; if ((popp_id >= MAX_SESSIONS) || (popp_id <= 0)) { pr_err("%s: Invalid session id %d\n", __func__, popp_id); return 0; } mutex_lock(&routing_info.adm_mutex); if (set) { rc = adm_open(copp_id, PLAYBACK, rate, mode, DEFAULT_COPP_TOPOLOGY); if (rc < 0) { pr_err("%s: adm open fail rc[%d]\n", __func__, rc); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } msm_set_copp_id(popp_id, copp_id); pr_debug("%s:Session id=%d copp_id=%d\n", __func__, popp_id, copp_id); rc = msm_check_multicopp_per_stream(popp_id); pr_err("rc = %d\n", rc); rc2 = msm_check_multistream_per_copp(copp_id); pr_err("rc2 = %d\n", rc2); if (rc == 1 && rc2 == 1) { pr_debug("Calling one to one routing\n"); rc = adm_matrix_map(popp_id, PLAYBACK, 1, &copp_id); if (rc < 0) { pr_err("%s: matrix map failed rc[%d]\n", __func__, rc); adm_close(copp_id); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } } else { if (rc > 1) { pr_debug("Calling one to many routing rc =%d\n", rc); pr_debug("No of copps = %d\n", payload.num_copps); rc = adm_route_mcopp(popp_id, (void *)&payload, PLAYBACK, ONE_TO_MANY); if (rc < 0) { pr_err("%s: adm_route_mcopp fail" "rc[%d]\n", __func__, rc); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } } else if (rc2 > 1) { pr_debug("Calling many to one routing rc2=%d\n", rc2); pr_debug("No of sessions = %d\n", payload.num_sessions); rc = adm_route_mcopp(popp_id, (void *)&payload, PLAYBACK, MANY_TO_ONE); if (rc < 0) { pr_err("%s: adm_route_mcopp fail" "rc[%d]\n", __func__, rc); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } } } } else { for (i = 0; i < AFE_MAX_PORTS; i++) { if (routing_info.copp_list[popp_id][i] == copp_id) { rc = adm_close(copp_id); if (rc < 0) { pr_err("%s: adm close fail copp[%d]" "rc[%d]\n", __func__, copp_id, rc); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } msm_clear_copp_id(popp_id, copp_id); break; } } } if (copp_id == VOICE_PLAYBACK_TX) { /* Signal uplink playback. */ rc = voice_start_playback(set); } mutex_unlock(&routing_info.adm_mutex); return rc; }
int msm_snddev_set_dec(int popp_id, int copp_id, int set, int rate, int mode) { int rc = 0, i = 0, num_copps; struct route_payload payload; if ((popp_id >= MAX_SESSIONS) || (popp_id <= 0)) { pr_err("%s: Invalid session id %d\n", __func__, popp_id); return 0; } mutex_lock(&routing_info.adm_mutex); if (set) { rc = adm_open(copp_id, ADM_PATH_PLAYBACK, rate, mode, DEFAULT_COPP_TOPOLOGY); if (rc < 0) { pr_err("%s: adm open fail rc[%d]\n", __func__, rc); rc = -EINVAL; goto fail_cmd; } rc = adm_matrix_map(popp_id, PLAYBACK, 1, &copp_id); if (rc < 0) { pr_err("%s: matrix map failed rc[%d]\n", __func__, rc); adm_close(copp_id); rc = -EINVAL; goto fail_cmd; msm_set_copp_id(popp_id, copp_id); pr_debug("%s:Session id=%d copp_id=%d\n", __func__, popp_id, copp_id); memset(payload.copp_ids, COPP_IGNORE, (sizeof(unsigned int) * AFE_MAX_PORTS)); num_copps = msm_check_multicopp_per_stream(popp_id, &payload); /* Multiple streams per copp is handled, one stream at a time */ rc = adm_matrix_map(popp_id, ADM_PATH_PLAYBACK, num_copps, payload.copp_ids, copp_id); if (rc < 0) { pr_err("%s: matrix map failed rc[%d]\n", __func__, rc); adm_close(copp_id); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } #ifdef CONFIG_MSM8X60_RTAC for (i = 0; i < num_copps; i++) rtac_add_adm_device(payload.copp_ids[i], popp_id); #endif } else { for (i = 0; i < AFE_MAX_PORTS; i++) { if (routing_info.copp_list[popp_id][i] == copp_id) { rc = adm_close(copp_id); if (rc < 0) { pr_err("%s: adm close fail copp[%d]" "rc[%d]\n", __func__, copp_id, rc); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } msm_clear_copp_id(popp_id, copp_id); break; } } } if (copp_id == VOICE_PLAYBACK_TX) { /* Signal uplink playback. */ rc = voice_start_playback(set); } mutex_unlock(&routing_info.adm_mutex); return rc; } EXPORT_SYMBOL(msm_snddev_set_dec); static int check_tx_copp_topology(int session_id) { int cnt; int ret_val = -ENOENT; cnt = adm_tx_topology_tbl.session_cnt; if (cnt) { do { if (adm_tx_topology_tbl.session_id[cnt-1] == session_id) ret_val = cnt-1; } while (--cnt); } return ret_val; }
int msm_snddev_set_dec(int popp_id, int copp_id, int set, int rate, int mode) { int rc = 0, i = 0, num_copps; struct route_payload payload; if ((popp_id >= MAX_SESSIONS) || (popp_id <= 0)) { pr_err("%s: Invalid session id %d\n", __func__, popp_id); return 0; } mutex_lock(&routing_info.adm_mutex); if (set) { rc = adm_open(copp_id, ADM_PATH_PLAYBACK, rate, mode, DEFAULT_COPP_TOPOLOGY); if (rc < 0) { pr_err("%s: adm open fail rc[%d]\n", __func__, rc); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } msm_set_copp_id(popp_id, copp_id); pr_debug("%s:Session id=%d copp_id=%d\n", __func__, popp_id, copp_id); memset(payload.copp_ids, COPP_IGNORE, (sizeof(unsigned int) * AFE_MAX_PORTS)); num_copps = msm_check_multicopp_per_stream(popp_id, &payload); rc = adm_matrix_map(popp_id, ADM_PATH_PLAYBACK, num_copps, payload.copp_ids, copp_id); if (rc < 0) { pr_err("%s: matrix map failed rc[%d]\n", __func__, rc); adm_close(copp_id); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } #ifdef CONFIG_MSM8X60_RTAC for (i = 0; i < num_copps; i++) rtac_add_adm_device(payload.copp_ids[i], popp_id); #endif } else { for (i = 0; i < AFE_MAX_PORTS; i++) { if (routing_info.copp_list[popp_id][i] == copp_id) { rc = adm_close(copp_id); if (rc < 0) { pr_err("%s: adm close fail copp[%d]" "rc[%d]\n", __func__, copp_id, rc); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } msm_clear_copp_id(popp_id, copp_id); break; } } } if (copp_id == VOICE_PLAYBACK_TX) { rc = voice_start_playback(set); } mutex_unlock(&routing_info.adm_mutex); return rc; }
int msm_snddev_set_dec(int popp_id, int copp_id, int set, int rate, int mode) { int rc = 0, i = 0; struct route_payload payload; int topology = DEFAULT_COPP_TOPOLOGY; if ((popp_id >= MAX_SESSIONS) || (popp_id <= 0)) { pr_aud_err("%s: Invalid session id %d\n", __func__, popp_id); return 0; } mutex_lock(&routing_info.adm_mutex); if (set) { if (ctrl_ops->support_opendsp) { if (ctrl_ops->support_opendsp()) topology = HTC_COPP_TOPOLOGY; } pr_aud_info("%s, topology = 0x%x\n", __func__, topology); rc = adm_open(copp_id, PLAYBACK, rate, mode, topology); if (rc < 0) { pr_aud_err("%s: adm open fail rc[%d]\n", __func__, rc); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } msm_set_copp_id(popp_id, copp_id); pr_debug("%s:Session id=%d copp_id=%d\n", __func__, popp_id, copp_id); memset(payload.copp_ids, DEVICE_IGNORE, (sizeof(unsigned int) * AFE_MAX_PORTS)); rc = msm_check_multicopp_per_stream(popp_id, &payload); /* Multiple streams per copp is handled, one stream at a time */ rc = adm_matrix_map(popp_id, PLAYBACK, rc, payload.copp_ids, copp_id); if (rc < 0) { pr_aud_err("%s: matrix map failed rc[%d]\n", __func__, rc); adm_close(copp_id); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } } else { for (i = 0; i < AFE_MAX_PORTS; i++) { if (routing_info.copp_list[popp_id][i] == copp_id) { rc = adm_close(copp_id); if (rc < 0) { pr_aud_err("%s: adm close fail copp[%d]" "rc[%d]\n", __func__, copp_id, rc); rc = -EINVAL; mutex_unlock(&routing_info.adm_mutex); return rc; } msm_clear_copp_id(popp_id, copp_id); break; } } } if (copp_id == VOICE_PLAYBACK_TX) { /* Signal uplink playback. */ rc = voice_start_playback(set); } mutex_unlock(&routing_info.adm_mutex); return rc; }