OSDN Git Service

ALSA: emu10k1: fix writing 1st pointer-offset register set through /proc
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>
Fri, 26 May 2023 10:16:55 +0000 (12:16 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 5 Jun 2023 07:25:22 +0000 (09:25 +0200)
The limits were appropriate only for the 2nd set.

FWIW, the channel count 4 for the 2nd set is suspicious as well - at
least P17V_PLAYBACK_FIFO_PTR actually has 8 channels, and comments on
HCFG2 hint at that as well. But all bitmasks are documented only for 4
channels. Anyway, rectifying that is out of scope for this patch.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230526101659.437969-3-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/emu10k1/emuproc.c

index 6cf4a7e..81d48cd 100644 (file)
@@ -483,7 +483,8 @@ static void snd_emu_proc_ptr_reg_read(struct snd_info_entry *entry,
 }
 
 static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry,
-                                      struct snd_info_buffer *buffer, int iobase)
+                                      struct snd_info_buffer *buffer,
+                                      int iobase, int length, int voices)
 {
        struct snd_emu10k1 *emu = entry->private_data;
        char line[64];
@@ -491,7 +492,7 @@ static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry,
        while (!snd_info_get_line(buffer, line, sizeof(line))) {
                if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3)
                        continue;
-               if (reg < 0xa0 && val <= 0xffffffff && channel_id <= 3)
+               if (reg < length && channel_id < voices)
                        snd_ptr_write(emu, iobase, reg, channel_id, val);
        }
 }
@@ -499,13 +500,15 @@ static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry,
 static void snd_emu_proc_ptr_reg_write00(struct snd_info_entry *entry,
                                         struct snd_info_buffer *buffer)
 {
-       snd_emu_proc_ptr_reg_write(entry, buffer, 0);
+       snd_emu_proc_ptr_reg_write(entry, buffer, 0, 0x80, 64);
 }
 
 static void snd_emu_proc_ptr_reg_write20(struct snd_info_entry *entry,
                                         struct snd_info_buffer *buffer)
 {
-       snd_emu_proc_ptr_reg_write(entry, buffer, 0x20);
+       struct snd_emu10k1 *emu = entry->private_data;
+       snd_emu_proc_ptr_reg_write(entry, buffer, 0x20,
+                                  emu->card_capabilities->ca0108_chip ? 0xa0 : 0x80, 4);
 }