Commit ca4c5b33 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: msnd: Use proper mmap method

The old ISA MSND driver basically maps the iomem as the DMA buffer.
For this type of buffer, we have already the standard mmap helper,
snd_pcm_lib_mmap_iomem().  Correct the PCM info, set the DMA address
and use the standard helper for handling the mmap on all architectures
properly.

Link: https://lore.kernel.org/r/20210809140532.11006-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 4d9e9153
...@@ -425,7 +425,7 @@ static void snd_msnd_capture_reset_queue(struct snd_msnd *chip, ...@@ -425,7 +425,7 @@ static void snd_msnd_capture_reset_queue(struct snd_msnd *chip,
} }
static const struct snd_pcm_hardware snd_msnd_playback = { static const struct snd_pcm_hardware snd_msnd_playback = {
.info = SNDRV_PCM_INFO_MMAP | .info = SNDRV_PCM_INFO_MMAP_IOMEM |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_BATCH, SNDRV_PCM_INFO_BATCH,
...@@ -444,7 +444,7 @@ static const struct snd_pcm_hardware snd_msnd_playback = { ...@@ -444,7 +444,7 @@ static const struct snd_pcm_hardware snd_msnd_playback = {
}; };
static const struct snd_pcm_hardware snd_msnd_capture = { static const struct snd_pcm_hardware snd_msnd_capture = {
.info = SNDRV_PCM_INFO_MMAP | .info = SNDRV_PCM_INFO_MMAP_IOMEM |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_BATCH, SNDRV_PCM_INFO_BATCH,
...@@ -473,6 +473,7 @@ static int snd_msnd_playback_open(struct snd_pcm_substream *substream) ...@@ -473,6 +473,7 @@ static int snd_msnd_playback_open(struct snd_pcm_substream *substream)
snd_msnd_enable_irq(chip); snd_msnd_enable_irq(chip);
runtime->dma_area = (__force void *)chip->mappedbase; runtime->dma_area = (__force void *)chip->mappedbase;
runtime->dma_addr = chip->base;
runtime->dma_bytes = 0x3000; runtime->dma_bytes = 0x3000;
chip->playback_substream = substream; chip->playback_substream = substream;
...@@ -566,6 +567,7 @@ static const struct snd_pcm_ops snd_msnd_playback_ops = { ...@@ -566,6 +567,7 @@ static const struct snd_pcm_ops snd_msnd_playback_ops = {
.prepare = snd_msnd_playback_prepare, .prepare = snd_msnd_playback_prepare,
.trigger = snd_msnd_playback_trigger, .trigger = snd_msnd_playback_trigger,
.pointer = snd_msnd_playback_pointer, .pointer = snd_msnd_playback_pointer,
.mmap = snd_pcm_lib_mmap_iomem,
}; };
static int snd_msnd_capture_open(struct snd_pcm_substream *substream) static int snd_msnd_capture_open(struct snd_pcm_substream *substream)
...@@ -576,6 +578,7 @@ static int snd_msnd_capture_open(struct snd_pcm_substream *substream) ...@@ -576,6 +578,7 @@ static int snd_msnd_capture_open(struct snd_pcm_substream *substream)
set_bit(F_AUDIO_READ_INUSE, &chip->flags); set_bit(F_AUDIO_READ_INUSE, &chip->flags);
snd_msnd_enable_irq(chip); snd_msnd_enable_irq(chip);
runtime->dma_area = (__force void *)chip->mappedbase + 0x3000; runtime->dma_area = (__force void *)chip->mappedbase + 0x3000;
runtime->dma_addr = chip->base + 0x3000;
runtime->dma_bytes = 0x3000; runtime->dma_bytes = 0x3000;
memset(runtime->dma_area, 0, runtime->dma_bytes); memset(runtime->dma_area, 0, runtime->dma_bytes);
chip->capture_substream = substream; chip->capture_substream = substream;
...@@ -662,6 +665,7 @@ static const struct snd_pcm_ops snd_msnd_capture_ops = { ...@@ -662,6 +665,7 @@ static const struct snd_pcm_ops snd_msnd_capture_ops = {
.prepare = snd_msnd_capture_prepare, .prepare = snd_msnd_capture_prepare,
.trigger = snd_msnd_capture_trigger, .trigger = snd_msnd_capture_trigger,
.pointer = snd_msnd_capture_pointer, .pointer = snd_msnd_capture_pointer,
.mmap = snd_pcm_lib_mmap_iomem,
}; };
......
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