Ejemplo n.º 1
0
static int snddev_virtual_open(struct msm_snddev_info *dev_info)
{
	int rc = 0;

	pr_debug("%s\n", __func__);

	mutex_lock(&snddev_virtual_lock);

	if (!dev_info)  {
		pr_err("%s: NULL dev_info\n", __func__);

		rc = -EINVAL;
		goto done;
	}

	if (!dev_info->opened) {
		rc = afe_start_pseudo_port(dev_info->copp_id);
	} else {
		pr_err("%s: Pseudo port 0x%x is already open\n",
		       __func__, dev_info->copp_id);

		rc = -EBUSY;
	}

done:
	mutex_unlock(&snddev_virtual_lock);

	return rc;
}
Ejemplo n.º 2
0
int msm_enable_incall_recording(int popp_id, int rec_mode, int rate,
				int channel_mode)
{
	int rc = 0;
	int port_id[2];
	port_id[0] = VOICE_RECORD_TX;
	port_id[1] = VOICE_RECORD_RX;

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

	mutex_lock(&routing_info.adm_mutex);

	if (rec_mode == VOC_REC_UPLINK) {
		rc = afe_start_pseudo_port(port_id[0]);
		if (rc < 0) {
			pr_err("%s: Error %d in Tx pseudo port start\n",
			       __func__, rc);

			goto fail_cmd;
		}

		rc = adm_open(port_id[0], LIVE_RECORDING, rate, channel_mode,
				DEFAULT_COPP_TOPOLOGY);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM open %d\n",
			       __func__, rc, port_id[0]);

			goto fail_cmd;
		}

		rc = adm_matrix_map(popp_id, LIVE_RECORDING, 1, &port_id[0]);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM matrix map %d\n",
			       __func__, rc, port_id[0]);

			goto fail_cmd;
		}

		msm_set_copp_id(popp_id, port_id[0]);

	} else if (rec_mode == VOC_REC_DOWNLINK) {
		rc = afe_start_pseudo_port(port_id[1]);
		if (rc < 0) {
			pr_err("%s: Error %d in Rx pseudo port start\n",
			       __func__, rc);

			goto fail_cmd;
		}

		rc = adm_open(port_id[1], LIVE_RECORDING, rate, channel_mode,
				DEFAULT_COPP_TOPOLOGY);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM open %d\n",
			       __func__, rc, port_id[1]);

			goto fail_cmd;
		}

		rc = adm_matrix_map(popp_id, LIVE_RECORDING, 1, &port_id[1]);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM matrix map %d\n",
			       __func__, rc, port_id[1]);

			goto fail_cmd;
		}

		msm_set_copp_id(popp_id, port_id[1]);

	} else if (rec_mode == VOC_REC_BOTH) {
		rc = afe_start_pseudo_port(port_id[0]);
		if (rc < 0) {
			pr_err("%s: Error %d in Tx pseudo port start\n",
			       __func__, rc);

			goto fail_cmd;
		}

		rc = adm_open(port_id[0], LIVE_RECORDING, rate, channel_mode,
				DEFAULT_COPP_TOPOLOGY);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM open %d\n",
			       __func__, rc, port_id[0]);

			goto fail_cmd;
		}

		msm_set_copp_id(popp_id, port_id[0]);

		rc = afe_start_pseudo_port(port_id[1]);
		if (rc < 0) {
			pr_err("%s: Error %d in Rx pseudo port start\n",
			       __func__, rc);

			goto fail_cmd;
		}

		rc = adm_open(port_id[1], LIVE_RECORDING, rate, channel_mode,
				DEFAULT_COPP_TOPOLOGY);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM open %d\n",
			       __func__, rc, port_id[0]);

			goto fail_cmd;
		}

		rc = adm_matrix_map(popp_id, LIVE_RECORDING, 2, &port_id[0]);
		if (rc < 0) {
			pr_err("%s: Error %d in ADM matrix map\n",
			       __func__, rc);

			goto fail_cmd;
		}

		msm_set_copp_id(popp_id, port_id[1]);
	} else {
		pr_err("%s Unknown rec_mode %d\n", __func__, rec_mode);

		goto fail_cmd;
	}

	rc = voice_start_record(rec_mode, 1);

fail_cmd:
	mutex_unlock(&routing_info.adm_mutex);
	return rc;
}