예제 #1
0
/* must be called with audio->lock held */
static int audqcelp_in_enable(struct audio_qcelp_in *audio)
{
	struct audmgr_config cfg;
	int rc;

	if (audio->enabled)
		return 0;

	cfg.tx_rate = audio->samp_rate;
	cfg.rx_rate = RPC_AUD_DEF_SAMPLE_RATE_NONE;
	cfg.def_method = RPC_AUD_DEF_METHOD_RECORD;
	cfg.codec = RPC_AUD_DEF_CODEC_13K;
	cfg.snd_method = RPC_SND_METHOD_MIDI;

	if (audio->mode == MSM_AUD_ENC_MODE_TUNNEL) {
		rc = audmgr_enable(&audio->audmgr, &cfg);
		if (rc < 0)
			return rc;

		if (audpreproc_enable(audio->enc_id,
				&audpre_dsp_event, audio)) {
			MM_ERR("msm_adsp_enable(audpreproc) failed\n");
			audmgr_disable(&audio->audmgr);
			return -ENODEV;
		}

		/*update aurec session info in audpreproc layer*/
		audio->session_info.session_id = audio->enc_id;
		audio->session_info.sampling_freq =
			convert_samp_index(audio->samp_rate);
		audpreproc_update_audrec_info(&audio->session_info);
	}
	if (msm_adsp_enable(audio->audrec)) {
		if (audio->mode == MSM_AUD_ENC_MODE_TUNNEL) {
			audpreproc_disable(audio->enc_id, audio);
			audmgr_disable(&audio->audmgr);
		}
		MM_ERR("msm_adsp_enable(audrec) failed\n");
		return -ENODEV;
	}

	audio->enabled = 1;
	audqcelp_in_dsp_enable(audio, 1);

	return 0;
}
예제 #2
0
/* must be called with audio->lock held */
static int audqcelp_in_disable(struct audio_qcelp_in *audio)
{
	if (audio->enabled) {
		audio->enabled = 0;

		audqcelp_in_dsp_enable(audio, 0);

		wake_up(&audio->wait);
		wait_event_interruptible_timeout(audio->wait_enable,
				audio->running == 0, 1*HZ);
		msm_adsp_disable(audio->audrec);
		if (audio->mode == MSM_AUD_ENC_MODE_TUNNEL) {
			msm_adsp_disable(audio->audpre);
			audmgr_disable(&audio->audmgr);
		}
	}
	return 0;
}
예제 #3
0
/* must be called with audio->lock held */
static int audqcelp_in_enable(struct audio_qcelp_in *audio)
{
	struct audmgr_config cfg;
	int rc;

	if (audio->enabled)
		return 0;

	cfg.tx_rate = audio->samp_rate;
	cfg.rx_rate = RPC_AUD_DEF_SAMPLE_RATE_NONE;
	cfg.def_method = RPC_AUD_DEF_METHOD_RECORD;
	cfg.codec = RPC_AUD_DEF_CODEC_13K;
	cfg.snd_method = RPC_SND_METHOD_MIDI;

	if (audio->mode == MSM_AUD_ENC_MODE_TUNNEL) {
		rc = audmgr_enable(&audio->audmgr, &cfg);
		if (rc < 0)
			return rc;

		if (msm_adsp_enable(audio->audpre)) {
			audmgr_disable(&audio->audmgr);
			MM_ERR("msm_adsp_enable(audpre) failed\n");
			return -ENODEV;
		}
	}
	if (msm_adsp_enable(audio->audrec)) {
		if (audio->mode == MSM_AUD_ENC_MODE_TUNNEL) {
			audmgr_disable(&audio->audmgr);
			msm_adsp_disable(audio->audpre);
		}
		MM_ERR("msm_adsp_enable(audrec) failed\n");
		return -ENODEV;
	}

	audio->enabled = 1;
	audqcelp_in_dsp_enable(audio, 1);

	return 0;
}
예제 #4
0
/* must be called with audio->lock held */
static int audqcelp_in_disable(struct audio_qcelp_in *audio)
{
	if (audio->enabled) {
		audio->enabled = 0;

		audqcelp_in_dsp_enable(audio, 0);

		wait_event_interruptible_timeout(audio->wait_enable,
				audio->running == 0, 1*HZ);
		audio->stopped = 1;
		wake_up(&audio->wait);
		msm_adsp_disable(audio->audrec);
		if (audio->mode == MSM_AUD_ENC_MODE_TUNNEL) {
			audpreproc_disable(audio->enc_id, audio);
			audmgr_disable(&audio->audmgr);
			/*reset the sampling frequency information at
			  audpreproc layer*/
			audio->session_info.sampling_freq = 0;
			audpreproc_update_audrec_info(&audio->session_info);
		}
	}
	return 0;
}