]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ASoC: siu_pcm: Use managed buffer allocation
authorTakashi Iwai <tiwai@suse.de>
Tue, 10 Dec 2019 14:26:00 +0000 (15:26 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 11 Dec 2019 16:46:12 +0000 (16:46 +0000)
Clean up the driver with the new managed buffer allocation API.
The hw_params and hw_free callbacks became superfluous (the rest were
only debug prints) and got dropped.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191210142614.19405-10-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sh/siu_pcm.c

index a5e21e554da2d58ae1b3e7089ec7b4b43ef40af8..65637ad9363025c40b6ed49659b78c5969c99a6b 100644 (file)
@@ -281,41 +281,6 @@ static int siu_pcm_stmread_stop(struct siu_port *port_info)
        return 0;
 }
 
-static int siu_pcm_hw_params(struct snd_soc_component *component,
-                            struct snd_pcm_substream *ss,
-                            struct snd_pcm_hw_params *hw_params)
-{
-       struct siu_info *info = siu_i2s_data;
-       struct device *dev = ss->pcm->card->dev;
-       int ret;
-
-       dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id);
-
-       ret = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw_params));
-       if (ret < 0)
-               dev_err(dev, "snd_pcm_lib_malloc_pages() failed\n");
-
-       return ret;
-}
-
-static int siu_pcm_hw_free(struct snd_soc_component *component,
-                          struct snd_pcm_substream *ss)
-{
-       struct siu_info *info = siu_i2s_data;
-       struct siu_port *port_info = siu_port_info(ss);
-       struct device *dev = ss->pcm->card->dev;
-       struct siu_stream *siu_stream;
-
-       if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
-               siu_stream = &port_info->playback;
-       else
-               siu_stream = &port_info->capture;
-
-       dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id);
-
-       return snd_pcm_lib_free_pages(ss);
-}
-
 static bool filter(struct dma_chan *chan, void *slave)
 {
        struct sh_dmae_slave *param = slave;
@@ -548,7 +513,7 @@ static int siu_pcm_new(struct snd_soc_component *component,
                if (ret < 0)
                        return ret;
 
-               snd_pcm_lib_preallocate_pages_for_all(pcm,
+               snd_pcm_set_managed_buffer_all(pcm,
                                SNDRV_DMA_TYPE_DEV, card->dev,
                                SIU_BUFFER_BYTES_MAX, SIU_BUFFER_BYTES_MAX);
 
@@ -584,8 +549,6 @@ struct const snd_soc_component_driver siu_component = {
        .open           = siu_pcm_open,
        .close          = siu_pcm_close,
        .ioctl          = snd_soc_pcm_lib_ioctl,
-       .hw_params      = siu_pcm_hw_params,
-       .hw_free        = siu_pcm_hw_free,
        .prepare        = siu_pcm_prepare,
        .trigger        = siu_pcm_trigger,
        .pointer        = siu_pcm_pointer_dma,