Commit b22b2478 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ens137x: 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-38-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent cbf7dcd9
...@@ -856,17 +856,6 @@ static int snd_ensoniq_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -856,17 +856,6 @@ static int snd_ensoniq_trigger(struct snd_pcm_substream *substream, int cmd)
* PCM part * PCM part
*/ */
static int snd_ensoniq_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
}
static int snd_ensoniq_hw_free(struct snd_pcm_substream *substream)
{
return snd_pcm_lib_free_pages(substream);
}
static int snd_ensoniq_playback1_prepare(struct snd_pcm_substream *substream) static int snd_ensoniq_playback1_prepare(struct snd_pcm_substream *substream)
{ {
struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
...@@ -1216,8 +1205,6 @@ static const struct snd_pcm_ops snd_ensoniq_playback1_ops = { ...@@ -1216,8 +1205,6 @@ static const struct snd_pcm_ops snd_ensoniq_playback1_ops = {
.open = snd_ensoniq_playback1_open, .open = snd_ensoniq_playback1_open,
.close = snd_ensoniq_playback1_close, .close = snd_ensoniq_playback1_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_ensoniq_hw_params,
.hw_free = snd_ensoniq_hw_free,
.prepare = snd_ensoniq_playback1_prepare, .prepare = snd_ensoniq_playback1_prepare,
.trigger = snd_ensoniq_trigger, .trigger = snd_ensoniq_trigger,
.pointer = snd_ensoniq_playback1_pointer, .pointer = snd_ensoniq_playback1_pointer,
...@@ -1227,8 +1214,6 @@ static const struct snd_pcm_ops snd_ensoniq_playback2_ops = { ...@@ -1227,8 +1214,6 @@ static const struct snd_pcm_ops snd_ensoniq_playback2_ops = {
.open = snd_ensoniq_playback2_open, .open = snd_ensoniq_playback2_open,
.close = snd_ensoniq_playback2_close, .close = snd_ensoniq_playback2_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_ensoniq_hw_params,
.hw_free = snd_ensoniq_hw_free,
.prepare = snd_ensoniq_playback2_prepare, .prepare = snd_ensoniq_playback2_prepare,
.trigger = snd_ensoniq_trigger, .trigger = snd_ensoniq_trigger,
.pointer = snd_ensoniq_playback2_pointer, .pointer = snd_ensoniq_playback2_pointer,
...@@ -1238,8 +1223,6 @@ static const struct snd_pcm_ops snd_ensoniq_capture_ops = { ...@@ -1238,8 +1223,6 @@ static const struct snd_pcm_ops snd_ensoniq_capture_ops = {
.open = snd_ensoniq_capture_open, .open = snd_ensoniq_capture_open,
.close = snd_ensoniq_capture_close, .close = snd_ensoniq_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_ensoniq_hw_params,
.hw_free = snd_ensoniq_hw_free,
.prepare = snd_ensoniq_capture_prepare, .prepare = snd_ensoniq_capture_prepare,
.trigger = snd_ensoniq_trigger, .trigger = snd_ensoniq_trigger,
.pointer = snd_ensoniq_capture_pointer, .pointer = snd_ensoniq_capture_pointer,
...@@ -1274,9 +1257,8 @@ static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device) ...@@ -1274,9 +1257,8 @@ static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device)
strcpy(pcm->name, CHIP_NAME " DAC2/ADC"); strcpy(pcm->name, CHIP_NAME " DAC2/ADC");
ensoniq->pcm1 = pcm; ensoniq->pcm1 = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&ensoniq->pci->dev, &ensoniq->pci->dev, 64*1024, 128*1024);
64*1024, 128*1024);
#ifdef CHIP1370 #ifdef CHIP1370
err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
...@@ -1307,9 +1289,8 @@ static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device) ...@@ -1307,9 +1289,8 @@ static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device)
strcpy(pcm->name, CHIP_NAME " DAC1"); strcpy(pcm->name, CHIP_NAME " DAC1");
ensoniq->pcm2 = pcm; ensoniq->pcm2 = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
&ensoniq->pci->dev, &ensoniq->pci->dev, 64*1024, 128*1024);
64*1024, 128*1024);
#ifdef CHIP1370 #ifdef CHIP1370
err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment