/* must be called with audio->lock held */ 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 (msm_adsp_enable(audio->audpre)) { MM_ERR("msm_adsp_enable(audpre) failed\n"); audmgr_disable(&audio->audmgr); return -ENODEV; } if (msm_adsp_enable(audio->audrec)) { audmgr_disable(&audio->audmgr); msm_adsp_disable(audio->audpre); MM_ERR("msm_adsp_enable(audrec) failed\n"); return -ENODEV; } audio->enabled = 1; audpcm_in_dsp_enable(audio, 1); return 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_dsp_enable(audio, 0); wake_up(&audio->wait); msm_adsp_disable(audio->audrec); msm_adsp_disable(audio->audpre); audmgr_disable(&audio->audmgr); } return 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; }
/* must be called with audio->lock held */ 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) { msm_adsp_dump(audio->audrec); 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; } if (msm_adsp_enable(audio->audrec)) { audpreproc_disable(audio->enc_id, audio); audmgr_disable(&audio->audmgr); MM_ERR("msm_adsp_enable(audrec) failed\n"); return -ENODEV; } audio->enabled = 1; audpcm_in_dsp_enable(audio, 1); /*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); 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; }