コード例 #1
0
ファイル: bf5xx-ac97-pcm.c プロジェクト: 454053205/linux
static int bf5xx_pcm_prepare(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct sport_device *sport = runtime->private_data;

	/* An intermediate buffer is introduced for implementing mmap for
	 * SPORT working in TMD mode(include AC97).
	 */
#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT)
	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		sport_set_tx_callback(sport, bf5xx_dma_irq, substream);
		sport_config_tx_dma(sport, sport->tx_dma_buf, runtime->periods,
			runtime->period_size * sizeof(struct ac97_frame));
	} else {
		sport_set_rx_callback(sport, bf5xx_dma_irq, substream);
		sport_config_rx_dma(sport, sport->rx_dma_buf, runtime->periods,
			runtime->period_size * sizeof(struct ac97_frame));
	}
#else
	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		sport_set_tx_callback(sport, bf5xx_dma_irq, substream);
		sport_config_tx_dma(sport, runtime->dma_area, runtime->periods,
			runtime->period_size * sizeof(struct ac97_frame));
	} else {
		sport_set_rx_callback(sport, bf5xx_dma_irq, substream);
		sport_config_rx_dma(sport, runtime->dma_area, runtime->periods,
			runtime->period_size * sizeof(struct ac97_frame));
	}
#endif
	return 0;
}
コード例 #2
0
static int bf5xx_pcm_prepare(struct snd_pcm_substream *substream)
{
    struct snd_pcm_runtime *runtime = substream->runtime;
    struct sport_device *sport = runtime->private_data;

#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT)
    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
        sport_set_tx_callback(sport, bf5xx_dma_irq, substream);
        sport_config_tx_dma(sport, sport->tx_dma_buf, runtime->periods,
                            runtime->period_size * sizeof(struct ac97_frame));
    } else {
        sport_set_rx_callback(sport, bf5xx_dma_irq, substream);
        sport_config_rx_dma(sport, sport->rx_dma_buf, runtime->periods,
                            runtime->period_size * sizeof(struct ac97_frame));
    }
#else
    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
        sport_set_tx_callback(sport, bf5xx_dma_irq, substream);
        sport_config_tx_dma(sport, runtime->dma_area, runtime->periods,
                            runtime->period_size * sizeof(struct ac97_frame));
    } else {
        sport_set_rx_callback(sport, bf5xx_dma_irq, substream);
        sport_config_rx_dma(sport, runtime->dma_area, runtime->periods,
                            runtime->period_size * sizeof(struct ac97_frame));
    }
#endif
    return 0;
}
コード例 #3
0
static int bf5xx_pcm_prepare(struct snd_pcm_substream *substream)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct sport_device *sport = runtime->private_data;
	int period_bytes = frames_to_bytes(runtime, runtime->period_size);
	struct bf5xx_i2s_pcm_data *dma_data;

	dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);

	if (dma_data->tdm_mode)
		period_bytes = period_bytes / runtime->channels * 8;

	pr_debug("%s enter\n", __func__);
	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		sport_set_tx_callback(sport, bf5xx_dma_irq, substream);
		sport_config_tx_dma(sport, runtime->dma_area,
			runtime->periods, period_bytes);
	} else {
		sport_set_rx_callback(sport, bf5xx_dma_irq, substream);
		sport_config_rx_dma(sport, runtime->dma_area,
			runtime->periods, period_bytes);
	}

	return 0;
}
コード例 #4
0
static int bf5xx_pcm_prepare(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct sport_device *sport = runtime->private_data;
	int period_bytes = frames_to_bytes(runtime, runtime->period_size);

	pr_debug("%s enter\n", __func__);
	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		sport_set_tx_callback(sport, bf5xx_dma_irq, substream);
		sport_config_tx_dma(sport, runtime->dma_area,
			runtime->periods, period_bytes);
	} else {
		sport_set_rx_callback(sport, bf5xx_dma_irq, substream);
		sport_config_rx_dma(sport, runtime->dma_area,
			runtime->periods, period_bytes);
	}

	return 0;
}
コード例 #5
0
static int bf5xx_pcm_prepare(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct sport_device *sport = runtime->private_data;
	int fragsize_bytes = frames_to_bytes(runtime, runtime->period_size);

	fragsize_bytes /= runtime->channels;
	/* inflate the fragsize to match the dma width of SPORT */
	fragsize_bytes *= 8;

	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		sport_set_tx_callback(sport, bf5xx_dma_irq, substream);
		sport_config_tx_dma(sport, runtime->dma_area,
			runtime->periods, fragsize_bytes);
	} else {
		sport_set_rx_callback(sport, bf5xx_dma_irq, substream);
		sport_config_rx_dma(sport, runtime->dma_area,
			runtime->periods, fragsize_bytes);
	}

	return 0;
}