diff options
Diffstat (limited to 'sound/soc/txx9/txx9aclc.c')
-rw-r--r-- | sound/soc/txx9/txx9aclc.c | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index 66044559f70f..985487cc3a55 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c @@ -47,18 +47,12 @@ static const struct snd_pcm_hardware txx9aclc_pcm_hardware = { .buffer_bytes_max = 32 * 1024, }; -static int txx9aclc_pcm_hw_params(struct snd_pcm_substream *substream, +static int txx9aclc_pcm_hw_params(struct snd_soc_component *component, + struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); struct txx9aclc_dmadata *dmadata = runtime->private_data; - int ret; - - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) - return ret; dev_dbg(component->dev, "runtime->dma_area = %#lx dma_addr = %#lx dma_bytes = %zd " @@ -76,12 +70,8 @@ static int txx9aclc_pcm_hw_params(struct snd_pcm_substream *substream, return 0; } -static int txx9aclc_pcm_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - -static int txx9aclc_pcm_prepare(struct snd_pcm_substream *substream) +static int txx9aclc_pcm_prepare(struct snd_soc_component *component, + struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct txx9aclc_dmadata *dmadata = runtime->private_data; @@ -203,7 +193,8 @@ static void txx9aclc_dma_tasklet(unsigned long data) spin_unlock_irqrestore(&dmadata->dma_lock, flags); } -static int txx9aclc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) +static int txx9aclc_pcm_trigger(struct snd_soc_component *component, + struct snd_pcm_substream *substream, int cmd) { struct txx9aclc_dmadata *dmadata = substream->runtime->private_data; struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; @@ -236,14 +227,16 @@ static int txx9aclc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) } static snd_pcm_uframes_t -txx9aclc_pcm_pointer(struct snd_pcm_substream *substream) +txx9aclc_pcm_pointer(struct snd_soc_component *component, + struct snd_pcm_substream *substream) { struct txx9aclc_dmadata *dmadata = substream->runtime->private_data; return bytes_to_frames(substream->runtime, dmadata->pos); } -static int txx9aclc_pcm_open(struct snd_pcm_substream *substream) +static int txx9aclc_pcm_open(struct snd_soc_component *component, + struct snd_pcm_substream *substream) { struct txx9aclc_soc_device *dev = &txx9aclc_soc_device; struct txx9aclc_dmadata *dmadata = &dev->dmadata[substream->stream]; @@ -261,7 +254,8 @@ static int txx9aclc_pcm_open(struct snd_pcm_substream *substream) return 0; } -static int txx9aclc_pcm_close(struct snd_pcm_substream *substream) +static int txx9aclc_pcm_close(struct snd_soc_component *component, + struct snd_pcm_substream *substream) { struct txx9aclc_dmadata *dmadata = substream->runtime->private_data; struct dma_chan *chan = dmadata->dma_chan; @@ -271,23 +265,12 @@ static int txx9aclc_pcm_close(struct snd_pcm_substream *substream) return 0; } -static const struct snd_pcm_ops txx9aclc_pcm_ops = { - .open = txx9aclc_pcm_open, - .close = txx9aclc_pcm_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = txx9aclc_pcm_hw_params, - .hw_free = txx9aclc_pcm_hw_free, - .prepare = txx9aclc_pcm_prepare, - .trigger = txx9aclc_pcm_trigger, - .pointer = txx9aclc_pcm_pointer, -}; - -static int txx9aclc_pcm_new(struct snd_soc_pcm_runtime *rtd) +static int txx9aclc_pcm_new(struct snd_soc_component *component, + struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); struct platform_device *pdev = to_platform_device(component->dev); struct txx9aclc_soc_device *dev; struct resource *r; @@ -311,7 +294,7 @@ static int txx9aclc_pcm_new(struct snd_soc_pcm_runtime *rtd) goto exit; } - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, 64 * 1024, 4 * 1024 * 1024); return 0; @@ -409,8 +392,13 @@ static const struct snd_soc_component_driver txx9aclc_soc_component = { .name = DRV_NAME, .probe = txx9aclc_pcm_probe, .remove = txx9aclc_pcm_remove, - .ops = &txx9aclc_pcm_ops, - .pcm_new = txx9aclc_pcm_new, + .open = txx9aclc_pcm_open, + .close = txx9aclc_pcm_close, + .hw_params = txx9aclc_pcm_hw_params, + .prepare = txx9aclc_pcm_prepare, + .trigger = txx9aclc_pcm_trigger, + .pointer = txx9aclc_pcm_pointer, + .pcm_construct = txx9aclc_pcm_new, }; static int txx9aclc_soc_platform_probe(struct platform_device *pdev) |