static int tegra_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, struct snd_pcm *pcm) { int ret = 0; if (!card->dev->dma_mask) card->dev->dma_mask = &tegra_dma_mask; if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = 0xffffffff; if (dai->driver->playback.channels_min) { ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto err; } if (dai->driver->capture.channels_min) { ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) goto err_free_play; } return 0; err_free_play: tegra_pcm_deallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); err: return ret; }
int tegra_pcm_dma_allocate(struct snd_soc_pcm_runtime *rtd, size_t size) { struct snd_card *card = rtd->card->snd_card; struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; if (!card->dev->dma_mask) card->dev->dma_mask = &tegra_dma_mask; if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = 0xffffffff; if (dai->driver->playback.channels_min) { ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK, size); if (ret) goto err; } if (dai->driver->capture.channels_min) { ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE, size); if (ret) goto err_free_play; } return 0; err_free_play: tegra_pcm_deallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); err: return ret; }
static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; struct snd_pcm *pcm = rtd->pcm; int ret = 0; if (!card->dev->dma_mask) card->dev->dma_mask = &tegra_dma_mask; if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = DMA_BIT_MASK(32); if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto err; } if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) goto err_free_play; } return 0; err_free_play: tegra_pcm_deallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); err: return ret; }
static int tegra_pcm_new(struct snd_card *card, struct snd_soc_dai *dai, struct snd_pcm *pcm) { struct tegra_audio_data *ptscx; int ret = 0; ptscx = kzalloc(sizeof(struct tegra_audio_data), GFP_KERNEL); if (ptscx == NULL) return -ENOMEM; ptscx->m_hRm = s_hRmGlobal; ptscx->device_id = pcm->device; mutex_init(&ptscx->lock); tegra_snd_cx[pcm->device] = ptscx; if (dai->playback.channels_min) { ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) { goto out; } } if (dai->capture.channels_min) { ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) goto out; } return 0; out: if (ptscx) kfree(ptscx); snd_printk(KERN_ERR "pcm_new failed\n"); return ret; }
int tegra_pcm_dma_allocate(struct snd_soc_pcm_runtime *rtd, size_t size) { struct snd_card *card = rtd->card->snd_card; struct snd_soc_dai *dai = rtd->cpu_dai; /*Olympus: Added codec_dai for checking what is present and what is not, detecting by cpu_dai was not correct*/ struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; if (!card->dev->dma_mask) card->dev->dma_mask = &tegra_dma_mask; if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = 0xffffffff; if (codec_dai->driver->playback.channels_min) { //dai -> codec_dai ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK, size); if (ret) goto err; } if (codec_dai->driver->capture.channels_min) { //dai -> codec_dai ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE, size); if (ret) goto err_free_play; } return 0; err_free_play: tegra_pcm_deallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); err: return ret; }