Ejemplo n.º 1
0
int msm_snddev_set_enc(int popp_id, int copp_id, int set,
					int rate, int mode)
{
	int topology;
	int tbl_idx;
	int rc = 0, i = 0;
	mutex_lock(&routing_info.adm_mutex);
	if (set) {
		mutex_lock(&adm_tx_topology_tbl.lock);
		tbl_idx = check_tx_copp_topology(popp_id);
		if (tbl_idx == -ENOENT)
			topology = DEFAULT_COPP_TOPOLOGY;
		else {
			topology = adm_tx_topology_tbl.topolog_id[tbl_idx];
			rate = 16000;
		}
		mutex_unlock(&adm_tx_topology_tbl.lock);
		rc = adm_open(copp_id, ADM_PATH_LIVE_REC, rate, mode, 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, ADM_PATH_LIVE_REC, 1,
					(unsigned int *)&copp_id, 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);
#ifdef CONFIG_MSM8X60_RTAC
	rtac_add_adm_device(copp_id, 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;
					goto fail_cmd;
				}
				msm_clear_copp_id(popp_id, copp_id);
				break;
			}
		}
	}
fail_cmd:
	mutex_unlock(&routing_info.adm_mutex);
	return rc;
}
Ejemplo n.º 2
0
int msm_snddev_set_enc(int popp_id, int copp_id, int set,
					int rate, int mode)
{
	int topology;
	int tbl_idx;
	int rc = 0, i = 0;
	mutex_lock(&routing_info.adm_mutex);
	if (set) {
		mutex_lock(&adm_tx_topology_tbl.lock);
		tbl_idx = check_tx_copp_topology(popp_id);
		if (tbl_idx == -ENOENT)
			topology = DEFAULT_COPP_TOPOLOGY;
		else {
			topology = adm_tx_topology_tbl.topolog_id[tbl_idx];
			rate = 16000;
		}
		mutex_unlock(&adm_tx_topology_tbl.lock);
		rc = adm_open(copp_id, popp_id, LIVE_RECORDING, rate, mode,
			topology);
		if (rc < 0) {
			pr_aud_err("%s: adm open fail rc[%d]\n", __func__, rc);
			rc = -EINVAL;
			goto fail_cmd;
		}
		msm_set_copp_id(popp_id, copp_id);
	} 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;
					goto fail_cmd;
				}
				msm_clear_copp_id(popp_id, copp_id);
				break;
			}
		}
	}
fail_cmd:
	mutex_unlock(&routing_info.adm_mutex);
	return rc;
}
Ejemplo n.º 3
0
int msm_snddev_set_dec(int popp_id, int copp_id, int set,
					int rate, int mode)
{
	int rc = 0, i = 0;

	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) {
		rc = adm_open(copp_id, popp_id, PLAYBACK, rate, mode,
			DEFAULT_COPP_TOPOLOGY);
		if (rc < 0) {
			pr_aud_err("%s: adm open fail rc[%d]\n", __func__, rc);
			rc = -EINVAL;
			goto fail_cmd;
		}
		msm_set_copp_id(popp_id, copp_id);
	} 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;
					goto fail_cmd;
				}
				msm_clear_copp_id(popp_id, copp_id);
				break;
			}
		}
	}
fail_cmd:
	mutex_unlock(&routing_info.adm_mutex);
	return rc;
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
int msm_disable_incall_recording(uint32_t popp_id, uint32_t rec_mode)
{
	int rc = 0;
	uint32_t port_id[2];
	port_id[0] = VOICE_RECORD_TX;
	port_id[1] = VOICE_RECORD_RX;

	pr_debug("%s: popp_id %d, rec_mode %d\n", __func__, popp_id, rec_mode);

	mutex_lock(&routing_info.adm_mutex);

	rc = voice_start_record(rec_mode, 0);
	if (rc < 0) {
		pr_err("%s: Error %d stopping record\n", __func__, rc);

		goto fail_cmd;
	}

	if (rec_mode == VOC_REC_UPLINK) {
		rc = adm_close(port_id[0]);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM close %d\n",
			       __func__, rc, port_id[0]);

			goto fail_cmd;
		}

		msm_clear_copp_id(popp_id, port_id[0]);

		rc = afe_stop_pseudo_port(port_id[0]);
		if (rc < 0) {
			pr_err("%s: Error %d in Tx pseudo port stop\n",
			       __func__, rc);
			goto fail_cmd;
		}

	} else if (rec_mode == VOC_REC_DOWNLINK) {
		rc = adm_close(port_id[1]);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM close %d\n",
			       __func__, rc, port_id[1]);

			goto fail_cmd;
		}

		msm_clear_copp_id(popp_id, port_id[1]);

		rc = afe_stop_pseudo_port(port_id[1]);
		if (rc < 0) {
			pr_err("%s: Error %d in Rx pseudo port stop\n",
			       __func__, rc);
			goto fail_cmd;
		}
	} else if (rec_mode == VOC_REC_BOTH) {
		rc = adm_close(port_id[0]);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM close %d\n",
			       __func__, rc, port_id[0]);

			goto fail_cmd;
		}

		msm_clear_copp_id(popp_id, port_id[0]);

		rc = afe_stop_pseudo_port(port_id[0]);
		if (rc < 0) {
			pr_err("%s: Error %d in Tx pseudo port stop\n",
			       __func__, rc);
			goto fail_cmd;
		}

		rc = adm_close(port_id[1]);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM close %d\n",
			       __func__, rc, port_id[1]);

			goto fail_cmd;
		}

		msm_clear_copp_id(popp_id, port_id[1]);

		rc = afe_stop_pseudo_port(port_id[1]);
		if (rc < 0) {
			pr_err("%s: Error %d in Rx pseudo port stop\n",
			       __func__, rc);
			goto fail_cmd;
		}
	} else {
		pr_err("%s Unknown rec_mode %d\n", __func__, rec_mode);

		goto fail_cmd;
	}

fail_cmd:
	mutex_unlock(&routing_info.adm_mutex);
	return rc;
}
Ejemplo n.º 6
0
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;
}
Ejemplo n.º 7
0
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;
	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;
}