ALSA: pmac: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-59-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
6dfa8fd598
commit
01001fa1c7
|
@ -107,24 +107,6 @@ static inline int another_stream(int stream)
|
||||||
SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
|
SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* allocate buffers
|
|
||||||
*/
|
|
||||||
static int snd_pmac_pcm_hw_params(struct snd_pcm_substream *subs,
|
|
||||||
struct snd_pcm_hw_params *hw_params)
|
|
||||||
{
|
|
||||||
return snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw_params));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* release buffers
|
|
||||||
*/
|
|
||||||
static int snd_pmac_pcm_hw_free(struct snd_pcm_substream *subs)
|
|
||||||
{
|
|
||||||
snd_pcm_lib_free_pages(subs);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get a stream of the opposite direction
|
* get a stream of the opposite direction
|
||||||
*/
|
*/
|
||||||
|
@ -672,8 +654,6 @@ static const struct snd_pcm_ops snd_pmac_playback_ops = {
|
||||||
.open = snd_pmac_playback_open,
|
.open = snd_pmac_playback_open,
|
||||||
.close = snd_pmac_playback_close,
|
.close = snd_pmac_playback_close,
|
||||||
.ioctl = snd_pcm_lib_ioctl,
|
.ioctl = snd_pcm_lib_ioctl,
|
||||||
.hw_params = snd_pmac_pcm_hw_params,
|
|
||||||
.hw_free = snd_pmac_pcm_hw_free,
|
|
||||||
.prepare = snd_pmac_playback_prepare,
|
.prepare = snd_pmac_playback_prepare,
|
||||||
.trigger = snd_pmac_playback_trigger,
|
.trigger = snd_pmac_playback_trigger,
|
||||||
.pointer = snd_pmac_playback_pointer,
|
.pointer = snd_pmac_playback_pointer,
|
||||||
|
@ -683,8 +663,6 @@ static const struct snd_pcm_ops snd_pmac_capture_ops = {
|
||||||
.open = snd_pmac_capture_open,
|
.open = snd_pmac_capture_open,
|
||||||
.close = snd_pmac_capture_close,
|
.close = snd_pmac_capture_close,
|
||||||
.ioctl = snd_pcm_lib_ioctl,
|
.ioctl = snd_pcm_lib_ioctl,
|
||||||
.hw_params = snd_pmac_pcm_hw_params,
|
|
||||||
.hw_free = snd_pmac_pcm_hw_free,
|
|
||||||
.prepare = snd_pmac_capture_prepare,
|
.prepare = snd_pmac_capture_prepare,
|
||||||
.trigger = snd_pmac_capture_trigger,
|
.trigger = snd_pmac_capture_trigger,
|
||||||
.pointer = snd_pmac_capture_pointer,
|
.pointer = snd_pmac_capture_pointer,
|
||||||
|
@ -721,9 +699,9 @@ int snd_pmac_pcm_new(struct snd_pmac *chip)
|
||||||
chip->capture.cur_freqs = chip->freqs_ok;
|
chip->capture.cur_freqs = chip->freqs_ok;
|
||||||
|
|
||||||
/* preallocate 64k buffer */
|
/* preallocate 64k buffer */
|
||||||
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
|
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
|
||||||
&chip->pdev->dev,
|
&chip->pdev->dev,
|
||||||
64 * 1024, 64 * 1024);
|
64 * 1024, 64 * 1024);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue