diff mbox series

[3/7] ALSA: emu10k1: fix snd_emu1010_fpga_read() input masking for rev2 cards

Message ID 20230421141006.1005539-3-oswald.buddenhagen@gmx.de (mailing list archive)
State New, archived
Headers show
Series [1/7] ALSA: emu10k1: properly assert E-MU FPGA access constaints | expand

Commit Message

Oswald Buddenhagen April 21, 2023, 2:10 p.m. UTC
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
---
 include/sound/emu10k1.h | 3 ++-
 sound/pci/emu10k1/io.c  | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Takashi Iwai April 21, 2023, 3:14 p.m. UTC | #1
On Fri, 21 Apr 2023 16:10:02 +0200,
Oswald Buddenhagen wrote:
> 
> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>

No changelog is no good news.
Please give more information.


thanks,

Takashi
Oswald Buddenhagen April 21, 2023, 3:25 p.m. UTC | #2
On Fri, Apr 21, 2023 at 05:14:10PM +0200, Takashi Iwai wrote:
>On Fri, 21 Apr 2023 16:10:02 +0200,
>Oswald Buddenhagen wrote:
>> 
>> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
>
>No changelog is no good news.
>Please give more information.
>
i suppose this is a difference in philosophy. i generally refrain from 
covering in the commit message what comments in the patch already 
explain. otherwise it would be just redundant, and i don't like that 
very much.

anyway, i can add some speculation what problems this could have 
theoretically caused.

regards
Takashi Iwai April 21, 2023, 3:32 p.m. UTC | #3
On Fri, 21 Apr 2023 17:25:46 +0200,
Oswald Buddenhagen wrote:
> 
> On Fri, Apr 21, 2023 at 05:14:10PM +0200, Takashi Iwai wrote:
> > On Fri, 21 Apr 2023 16:10:02 +0200,
> > Oswald Buddenhagen wrote:
> >> 
> >> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
> > 
> > No changelog is no good news.
> > Please give more information.
> > 
> i suppose this is a difference in philosophy. i generally refrain from
> covering in the commit message what comments in the patch already
> explain. otherwise it would be just redundant, and i don't like that
> very much.
> 
> anyway, i can add some speculation what problems this could have
> theoretically caused.

You didn't explain exactly *WHAT* you fixed, and that's the readers
may be interested more.  The summary says merely "fix
snd_emu1010_fpga_read() input masking for rev2 cards".  What was
broken beforehand and what was corrected by your patch?  The summary
isn't enough for explaining it, but you have more space here.


thanks,

Takashi
diff mbox series

Patch

diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index d6c4c290ad1d..6867a042ebe2 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -252,7 +252,8 @@ 
 #define MUSTAT_ORDYN		0x40		/* 0 = MUDATA can accept a command or data	*/
 
 #define A_GPIO			0x18		/* GPIO on Audigy card (16bits)			*/
-#define A_GPINPUT_MASK		0xff00
+#define A_GPINPUT_MASK		0xff00		/* Alice/2 has 8 input pins			*/
+#define A3_GPINPUT_MASK		0x3f00		/* ... while Tina/2 has only 6			*/
 #define A_GPOUTPUT_MASK		0x00ff
 
 // The GPIO port is used for I/O config on Sound Blasters;
diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c
index f0134689c320..42b06f2e5552 100644
--- a/sound/pci/emu10k1/io.c
+++ b/sound/pci/emu10k1/io.c
@@ -255,16 +255,19 @@  void snd_emu1010_fpga_write(struct snd_emu10k1 *emu, u32 reg, u32 value)
 
 void snd_emu1010_fpga_read(struct snd_emu10k1 *emu, u32 reg, u32 *value)
 {
+	// The higest input pin is used as the designated interrupt trigger,
+	// so it needs to be masked out.
+	u32 mask = emu->card_capabilities->ca0108_chip ? 0x1f : 0x7f;
 	unsigned long flags;
 	if (snd_BUG_ON(reg > 0x3f))
 		return;
 	reg += 0x40; /* 0x40 upwards are registers. */
 	spin_lock_irqsave(&emu->emu_lock, flags);
 	outw(reg, emu->port + A_GPIO);
 	udelay(10);
 	outw(reg | 0x80, emu->port + A_GPIO);  /* High bit clocks the value into the fpga. */
 	udelay(10);
-	*value = ((inw(emu->port + A_GPIO) >> 8) & 0x7f);
+	*value = ((inw(emu->port + A_GPIO) >> 8) & mask);
 	spin_unlock_irqrestore(&emu->emu_lock, flags);
 }