Commit 830e7b00 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: azt3328: 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-28-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 817790cc
...@@ -1205,20 +1205,6 @@ snd_azf3328_mixer_new(struct snd_azf3328 *chip) ...@@ -1205,20 +1205,6 @@ snd_azf3328_mixer_new(struct snd_azf3328 *chip)
} }
#endif /* AZF_USE_AC97_LAYER */ #endif /* AZF_USE_AC97_LAYER */
static int
snd_azf3328_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_azf3328_hw_free(struct snd_pcm_substream *substream)
{
snd_pcm_lib_free_pages(substream);
return 0;
}
static void static void
snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec, snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec,
enum azf_freq_t bitrate, enum azf_freq_t bitrate,
...@@ -2080,8 +2066,6 @@ static const struct snd_pcm_ops snd_azf3328_playback_ops = { ...@@ -2080,8 +2066,6 @@ static const struct snd_pcm_ops snd_azf3328_playback_ops = {
.open = snd_azf3328_pcm_playback_open, .open = snd_azf3328_pcm_playback_open,
.close = snd_azf3328_pcm_close, .close = snd_azf3328_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_azf3328_hw_params,
.hw_free = snd_azf3328_hw_free,
.prepare = snd_azf3328_pcm_prepare, .prepare = snd_azf3328_pcm_prepare,
.trigger = snd_azf3328_pcm_trigger, .trigger = snd_azf3328_pcm_trigger,
.pointer = snd_azf3328_pcm_pointer .pointer = snd_azf3328_pcm_pointer
...@@ -2091,8 +2075,6 @@ static const struct snd_pcm_ops snd_azf3328_capture_ops = { ...@@ -2091,8 +2075,6 @@ static const struct snd_pcm_ops snd_azf3328_capture_ops = {
.open = snd_azf3328_pcm_capture_open, .open = snd_azf3328_pcm_capture_open,
.close = snd_azf3328_pcm_close, .close = snd_azf3328_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_azf3328_hw_params,
.hw_free = snd_azf3328_hw_free,
.prepare = snd_azf3328_pcm_prepare, .prepare = snd_azf3328_pcm_prepare,
.trigger = snd_azf3328_pcm_trigger, .trigger = snd_azf3328_pcm_trigger,
.pointer = snd_azf3328_pcm_pointer .pointer = snd_azf3328_pcm_pointer
...@@ -2102,8 +2084,6 @@ static const struct snd_pcm_ops snd_azf3328_i2s_out_ops = { ...@@ -2102,8 +2084,6 @@ static const struct snd_pcm_ops snd_azf3328_i2s_out_ops = {
.open = snd_azf3328_pcm_i2s_out_open, .open = snd_azf3328_pcm_i2s_out_open,
.close = snd_azf3328_pcm_close, .close = snd_azf3328_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_azf3328_hw_params,
.hw_free = snd_azf3328_hw_free,
.prepare = snd_azf3328_pcm_prepare, .prepare = snd_azf3328_pcm_prepare,
.trigger = snd_azf3328_pcm_trigger, .trigger = snd_azf3328_pcm_trigger,
.pointer = snd_azf3328_pcm_pointer .pointer = snd_azf3328_pcm_pointer
...@@ -2134,8 +2114,7 @@ snd_azf3328_pcm(struct snd_azf3328 *chip) ...@@ -2134,8 +2114,7 @@ snd_azf3328_pcm(struct snd_azf3328 *chip)
chip->pcm[AZF_CODEC_PLAYBACK] = pcm; chip->pcm[AZF_CODEC_PLAYBACK] = pcm;
chip->pcm[AZF_CODEC_CAPTURE] = pcm; chip->pcm[AZF_CODEC_CAPTURE] = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
&chip->pci->dev,
64*1024, 64*1024); 64*1024, 64*1024);
err = snd_pcm_new(chip->card, "AZF3328 I2S OUT", AZF_PCMDEV_I2S_OUT, err = snd_pcm_new(chip->card, "AZF3328 I2S OUT", AZF_PCMDEV_I2S_OUT,
...@@ -2150,8 +2129,7 @@ snd_azf3328_pcm(struct snd_azf3328 *chip) ...@@ -2150,8 +2129,7 @@ snd_azf3328_pcm(struct snd_azf3328 *chip)
strcpy(pcm->name, chip->card->shortname); strcpy(pcm->name, chip->card->shortname);
chip->pcm[AZF_CODEC_I2S_OUT] = pcm; chip->pcm[AZF_CODEC_I2S_OUT] = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
&chip->pci->dev,
64*1024, 64*1024); 64*1024, 64*1024);
return 0; return 0;
......
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