Skip to contentSkip to conversation

Patch to ymfpci from ALSA 0.99

PATCH Peter Zaitcev 2 participants 3 messages Mar 6, 2001

lore
Share & tools
lore
#0 lore raw

Hello:

the patch does not fix the buzzing, but it does not hurt either. And the way we loaded the microcode before was seriously wrong. Please look.

-- Pete

drivers/sound/ymfpci.c +6 -6
diff -ur -X dontdiff linux-2.4.2/drivers/sound/ymfpci.c linux-2.4.2-p3/drivers/sound/ymfpci.c
@@ -2185,8 +2149,8 @@
 	ymfpci_writew(codec, YDSXGR_GLOBALCTRL, ctrl & ~0x0007);
 
 	/* setup DSP instruction code */
-	for (i = 0; i < YDSXG_DSPLENGTH; i++)
-		ymfpci_writel(codec, YDSXGR_DSPINSTRAM + i, DspInst[i >> 2]);
+	for (i = 0; i < YDSXG_DSPLENGTH / 4; i++)
+		ymfpci_writel(codec, YDSXGR_DSPINSTRAM + (i << 2), DspInst[i]);
 
 	switch (codec->pci->device) {
 	case PCI_DEVICE_ID_YAMAHA_724F:
@@ -2201,11 +2165,11 @@
 
 	if (ver_1e) {
 		/* setup control instruction code */
-		for (i = 0; i < YDSXG_CTRLLENGTH; i++)
-			ymfpci_writel(codec, YDSXGR_CTRLINSTRAM + i, CntrlInst1E[i >> 2]);
+		for (i = 0; i < YDSXG_CTRLLENGTH / 4; i++)
+			ymfpci_writel(codec, YDSXGR_CTRLINSTRAM + (i << 2), CntrlInst1E[i]);
 	} else {
-		for (i = 0; i < YDSXG_CTRLLENGTH; i++)
-			ymfpci_writel(codec, YDSXGR_CTRLINSTRAM + i, CntrlInst[i >> 2]);
+		for (i = 0; i < YDSXG_CTRLLENGTH / 4; i++)
+			ymfpci_writel(codec, YDSXGR_CTRLINSTRAM + (i << 2), CntrlInst[i]);
 	}
 
 	ymfpci_enable_dsp(codec);
drivers/sound/ymfpci_image.h +3 -3
diff -ur -X dontdiff linux-2.4.2/drivers/sound/ymfpci_image.h linux-2.4.2-p3/drivers/sound/ymfpci_image.h
@@ -1,7 +1,7 @@
 #ifndef _HWMCODE_
 #define _HWMCODE_
 
-static unsigned long int	DspInst[] = {
+static unsigned long DspInst[YDSXG_DSPLENGTH / 4] = {
 	0x00000081, 0x000001a4, 0x0000000a, 0x0000002f,
 	0x00080253, 0x01800317, 0x0000407b, 0x0000843f,
 	0x0001483c, 0x0001943c, 0x0005d83c, 0x00001c3c,
@@ -12,7 +12,7 @@
 	0x00000000, 0x00000000, 0x00000000, 0x00000000
 };
 
-static unsigned long int	CntrlInst[] = {
+static unsigned long CntrlInst[YDSXG_CTRLLENGTH / 4] = {
 	0x000007, 0x240007, 0x0C0007, 0x1C0007,
 	0x060007, 0x700002, 0x000020, 0x030040,
 	0x007104, 0x004286, 0x030040, 0x000F0D,
@@ -791,7 +791,7 @@
 // 04/09  creat
 // 04/12  stop nise fix
 // 06/21  WorkingOff timming
-static unsigned long int	CntrlInst1E[] = {
+static unsigned long CntrlInst1E[YDSXG_CTRLLENGTH / 4] = {
 	0x000007, 0x240007, 0x0C0007, 0x1C0007,
 	0x060007, 0x700002, 0x000020, 0x030040,
 	0x007104, 0x004286, 0x030040, 0x000F0D,
#1 lore raw

drivers/sound/ymfpci_image.h line 6

Quoted 4 lines
drivers/sound/ymfpci_image.h +1 -1
-static unsigned long int	DspInst[] = {
+static unsigned long DspInst[YDSXG_DSPLENGTH / 4] = {
 	0x00000081, 0x000001a4, 0x0000000a, 0x0000002f,
 	0x00080253, 0x01800317, 0x0000407b, 0x0000843f,

This seems wrong (actually I suspect its a continuation of wrongness. What about 64bit platforms - u32 maybe ?)

#2 lore raw
In reply to Peter Zaitcev
Quoted 11 lines

From: Alan Cox <[email protected]>
To: [email protected] (Peter Zaitcev)
Date: Mon, 5 Mar 2001 20:46:32 -0500 (EST)

drivers/sound/ymfpci_image.h line 6

Quoted 4 lines
drivers/sound/ymfpci_image.h +1 -1
-static unsigned long int	DspInst[] = {
+static unsigned long DspInst[YDSXG_DSPLENGTH / 4] = {
 	0x00000081, 0x000001a4, 0x0000000a, 0x0000002f,
 	0x00080253, 0x01800317, 0x0000407b, 0x0000843f,

This seems wrong (actually I suspect its a continuation of wrongness. What about 64bit platforms - u32 maybe ?)

It will work on 64 bits, only use 2 times more memory for the storage. Should be safe to change to int or u32.

-- Pete