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;
}
示例#2
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;
}
示例#3
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;
}
示例#4
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;
}