コード例 #1
0
ファイル: msm7k-pcm.c プロジェクト: Feeyo/htc-kernel-ace
static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct msm_audio *prtd = runtime->private_data;

	alsa_audio_disable(prtd);
	audmgr_close(&prtd->audmgr);
	kfree(prtd);

	return 0;
}
コード例 #2
0
ファイル: msm7k-pcm.c プロジェクト: mtuton/linux_u82x0
static int msm_pcm_capture_close(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct msm_audio *prtd = runtime->private_data;

	alsa_audrec_disable(prtd);
	audmgr_close(&prtd->audmgr);
	msm_adsp_put(prtd->audrec);
	msm_adsp_put(prtd->audpre);
	kfree(prtd);

	return 0;
}
コード例 #3
0
ファイル: msm7k-pcm.c プロジェクト: mtuton/linux_u82x0
static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct msm_audio *prtd = runtime->private_data;

	int rc = 0;

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

	/* pcm dmamiss message is sent continously
	 * when decoder is starved so no race
	 * condition concern
	 */
	if (prtd->enabled)
		rc = wait_event_interruptible(the_locks.eos_wait,
					prtd->eos_ack);

	alsa_audio_disable(prtd);
	audmgr_close(&prtd->audmgr);
	kfree(prtd);

	return 0;
}
コード例 #4
0
int audio_adsp_configure(struct msm_audio *prtd)
{
	int ret, i;

	if (prtd->dir == SNDRV_PCM_STREAM_PLAYBACK) {
		prtd->data = prtd->playback_substream->dma_buffer.area;
		prtd->phys = prtd->playback_substream->dma_buffer.addr;
	}
	if (prtd->dir == SNDRV_PCM_STREAM_CAPTURE) {
		prtd->data = prtd->capture_substream->dma_buffer.area;
		prtd->phys = prtd->capture_substream->dma_buffer.addr;
	}
	if (!prtd->data) {
		ret = -ENOMEM;
		goto err1;
	}

	ret = audmgr_open(&prtd->audmgr);
	if (ret)
		goto err2;
	if (prtd->dir == SNDRV_PCM_STREAM_PLAYBACK) {
		prtd->out_buffer_size = PLAYBACK_DMASZ;
		prtd->out_sample_rate = 44100;
		prtd->out_channel_mode = AUDPP_CMD_PCM_INTF_STEREO_V;
		prtd->out_weight = 100;

		prtd->out[0].data = prtd->data + 0;
		prtd->out[0].addr = prtd->phys + 0;
		prtd->out[0].size = BUFSZ;
		prtd->out[1].data = prtd->data + BUFSZ;
		prtd->out[1].addr = prtd->phys + BUFSZ;
		prtd->out[1].size = BUFSZ;
	}
	if (prtd->dir == SNDRV_PCM_STREAM_CAPTURE) {
		prtd->samp_rate = RPC_AUD_DEF_SAMPLE_RATE_44100;
		prtd->samp_rate_index = AUDREC_CMD_SAMP_RATE_INDX_44100;
		prtd->channel_mode = AUDREC_CMD_STEREO_MODE_STEREO;
		prtd->buffer_size = STEREO_DATA_SIZE;
		prtd->type = AUDREC_CMD_TYPE_0_INDEX_WAV;
		prtd->tx_agc_cfg.cmd_id = AUDPREPROC_CMD_CFG_AGC_PARAMS;
		prtd->ns_cfg.cmd_id = AUDPREPROC_CMD_CFG_NS_PARAMS;
		prtd->iir_cfg.cmd_id =
		    AUDPREPROC_CMD_CFG_IIR_TUNING_FILTER_PARAMS;

		ret = msm_adsp_get("AUDPREPROCTASK",
				   &prtd->audpre, &aud_pre_adsp_ops, prtd);
		if (ret)
			goto err3;
		ret = msm_adsp_get("AUDRECTASK",
				   &prtd->audrec, &aud_rec_adsp_ops, prtd);
		if (ret) {
			msm_adsp_put(prtd->audpre);
			goto err3;
		}
		prtd->dsp_cnt = 0;
		prtd->in_head = 0;
		prtd->in_tail = 0;
		prtd->in_count = 0;
		for (i = 0; i < FRAME_NUM; i++) {
			prtd->in[i].size = 0;
			prtd->in[i].read = 0;
		}
	}

	return 0;

err3:
	audmgr_close(&prtd->audmgr);

err2:
	prtd->data = NULL;
err1:
	return ret;
}