int alsa_audio_configure(struct msm_audio *prtd)
{
	if (prtd->enabled)
		return 0;

	MM_DBG("\n");
	if (prtd->dir == SNDRV_PCM_STREAM_PLAYBACK) {
		prtd->out_weight = 100;
		if (audpp_enable(-1, alsa_dsp_event, prtd)) {
			MM_ERR("audpp_enable() failed\n");
			return -ENODEV;
		}
	}
	if (prtd->dir == SNDRV_PCM_STREAM_CAPTURE) {
		if (audpreproc_enable(prtd->session_id,
				&audpreproc_dsp_event, prtd)) {
			MM_ERR("audpreproc_enable failed\n");
			return -ENODEV;
		}

		if (msm_adsp_enable(prtd->audrec)) {
			MM_ERR("msm_adsp_enable(audrec) enable failed\n");
			audpreproc_disable(prtd->session_id, prtd);
			return -ENODEV;
		}
		alsa_in_enc_config(prtd, 1);

	}
	prtd->enabled = 1;
	return 0;
}
int alsa_audrec_disable(struct msm_audio *prtd)
{
	if (prtd->enabled) {
		prtd->enabled = 0;
		alsa_in_enc_config(prtd, 0);
		wake_up(&the_locks.read_wait);
		msm_adsp_disable(prtd->audrec);
		prtd->out_needed = 0;
		audpreproc_disable(prtd->session_id, prtd);
	}
	return 0;
}
示例#3
0
/* must be called with audio->lock held */
static int audpcm_in_disable(struct audio_in *audio)
{
	if (audio->enabled) {
		audio->enabled = 0;
		audpcm_in_enc_config(audio, 0);
		wake_up(&audio->wait);
		wait_event_interruptible_timeout(audio->wait_enable,
				audio->running == 0, 1*HZ);
		msm_adsp_disable(audio->audrec);
		audpreproc_disable(audio->enc_id, audio);
	}
	return 0;
}
示例#4
0
/* must be called with audio->lock held */
static int audevrc_in_enable(struct audio_evrc_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_EVRC;
	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;
	audevrc_in_dsp_enable(audio, 1);

	return 0;
}
示例#5
0
static int audpcm_in_disable(struct audio_in *audio)
{
	if (audio->enabled) {
		audio->enabled = 0;

		audpcm_in_dsp_enable(audio, 0);

		audio->stopped = 1;
		wake_up(&audio->wait);

		msm_adsp_disable(audio->audrec);
		audpreproc_disable(audio->enc_id, audio);
		
		audio->session_info.sampling_freq = 0;
		audpreproc_update_audrec_info(&audio->session_info);
		audmgr_disable(&audio->audmgr);
	}
	return 0;
}
示例#6
0
static int audpcm_in_enable(struct audio_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_PCM;
	cfg.snd_method = RPC_SND_METHOD_MIDI;

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

	if (audpreproc_enable(audio->enc_id, &audpre_dsp_event, audio)) {
		MM_AUD_ERR("audrec: msm_adsp_enable(audpre) failed\n");
		audmgr_disable(&audio->audmgr);
		return -ENODEV;
	}

	if (msm_adsp_enable(audio->audrec)) {
		audpreproc_disable(audio->enc_id, audio);
		audmgr_disable(&audio->audmgr);
		MM_AUD_ERR("audrec: msm_adsp_enable(audrec) failed\n");
		return -ENODEV;
	}

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

	
	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);

	return 0;
}
示例#7
0
/* must be called with audio->lock held */
static int audpcm_in_enable(struct audio_in *audio)
{
	if (audio->enabled)
		return 0;

	if (audpreproc_enable(audio->enc_id, &audpreproc_dsp_event, audio)) {
		MM_AUD_ERR("msm_adsp_enable(audpreproc) failed\n");
		return -ENODEV;
	}

	if (msm_adsp_enable(audio->audrec)) {
		MM_AUD_ERR("msm_adsp_enable(audrec) failed\n");
		audpreproc_disable(audio->enc_id, audio);
		return -ENODEV;
	}
	audio->enabled = 1;
	audpcm_in_enc_config(audio, 1);

	return 0;
}
示例#8
0
/* must be called with audio->lock held */
static int audamrnb_in_disable(struct audio_amrnb_in *audio)
{
	if (audio->enabled) {
		audio->enabled = 0;

		audamrnb_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) {
			/*reset the sampling frequency information at
			audpreproc layer*/
			audio->session_info.sampling_freq = 0;
			audpreproc_update_audrec_info(&audio->session_info);
			audpreproc_disable(audio->enc_id, audio);
			audmgr_disable(&audio->audmgr);
		}
	}
	return 0;
}
/* must be called with audio->lock held */
static int audpcm_in_disable(struct audio_in *audio)
{
	int rc;

	if (audio->enabled) {
		audio->enabled = 0;

		audpcm_in_dsp_enable(audio, 0);

		audio->stopped = 1;
		wake_up(&audio->wait);

		msm_adsp_disable(audio->audrec);
		audpreproc_disable(audio->enc_id, audio);
		/*reset the sampling frequency information at audpreproc layer*/
		audio->session_info.sampling_freq = 0;
		audpreproc_update_audrec_info(&audio->session_info);
		rc = audmgr_disable(&audio->audmgr);
		if (rc < 0)
			msm_adsp_dump(audio->audrec);
	}
	return 0;
}