All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] more au88x0 eq cleanups
@ 2004-09-21 12:07 Jeff Muizelaar
  2004-09-21 12:28 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Muizelaar @ 2004-09-21 12:07 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 74 bytes --]

Attached patch does more cleanups on the eq code. Acked by Manuel.

-Jeff

[-- Attachment #2: 01-cleanup.patch --]
[-- Type: text/x-patch, Size: 4018 bytes --]

diff -ur virgin/sound/pci/au88x0/au88x0_eq.c working/sound/pci/au88x0/au88x0_eq.c
--- virgin/sound/pci/au88x0/au88x0_eq.c	2004-09-08 14:18:17.000000000 -0400
+++ working/sound/pci/au88x0/au88x0_eq.c	2004-09-08 14:33:38.000000000 -0400
@@ -52,37 +52,33 @@
 	hwwrite(vortex->mmio, 0x2b3c8, level);
 }
 
+static inline short sign_invert(short a)
+{
+	/* -(-32768) -> -32768 so we do -(-32768) -> 32767 to make the result positive */
+	if (a == -32768)
+		return 32767;
+	else
+		return -a;
+}
+
 static void vortex_EqHw_SetLeftCoefs(vortex_t * vortex, u16 coefs[])
 {
 	eqhw_t *eqhw = &(vortex->eq.this04);
-	int eax, i = 0, n /*esp2c */;
+	int i = 0, n /*esp2c */;
 
 	for (n = 0; n < eqhw->this04; n++) {
 		hwwrite(vortex->mmio, 0x2b000 + n * 0x30, coefs[i + 0]);
 		hwwrite(vortex->mmio, 0x2b004 + n * 0x30, coefs[i + 1]);
 
 		if (eqhw->this08 == 0) {
-			hwwrite(vortex->mmio, 0x2b008 + n * 0x30, coefs[i + 2]);
-			hwwrite(vortex->mmio, 0x2b00c + n * 0x30, coefs[i + 3]);
-			eax = coefs[i + 4];	//esp24;
+			hwwrite(vortex->mmio, 0x2b008 + n * 0x30, coefs[i + 2] & 0xffff);
+			hwwrite(vortex->mmio, 0x2b00c + n * 0x30, coefs[i + 3] & 0xffff);
+			hwwrite(vortex->mmio, 0x2b010 + n * 0x30, coefs[i + 4] & 0xffff);
 		} else {
-			if (coefs[2 + i] == 0x8000)
-				eax = 0x7fff;
-			else
-				eax = ~coefs[2 + i];
-			hwwrite(vortex->mmio, 0x2b008 + n * 0x30, eax & 0xffff);
-			if (coefs[3 + i] == 0x8000)
-				eax = 0x7fff;
-			else
-				eax = ~coefs[3 + i];
-			hwwrite(vortex->mmio, 0x2b00c + n * 0x30, eax & 0xffff);
-			if (coefs[4 + i] == 0x8000)
-				eax = 0x7fff;
-			else
-				eax = ~coefs[4 + i];
+			hwwrite(vortex->mmio, 0x2b008 + n * 0x30, sign_invert(coefs[2 + i]) & 0xffff);
+			hwwrite(vortex->mmio, 0x2b00c + n * 0x30, sign_invert(coefs[3 + i]) & 0xffff);
+		        hwwrite(vortex->mmio, 0x2b010 + n * 0x30, sign_invert(coefs[4 + i]) & 0xffff);
 		}
-		hwwrite(vortex->mmio, 0x2b010 + n * 0x30, eax);
-
 		i += 5;
 	}
 }
@@ -90,33 +86,21 @@
 static void vortex_EqHw_SetRightCoefs(vortex_t * vortex, u16 coefs[])
 {
 	eqhw_t *eqhw = &(vortex->eq.this04);
-	int i = 0, n /*esp2c */, eax;
+	int i = 0, n /*esp2c */;
 
 	for (n = 0; n < eqhw->this04; n++) {
 		hwwrite(vortex->mmio, 0x2b1e0 + n * 0x30, coefs[0 + i]);
 		hwwrite(vortex->mmio, 0x2b1e4 + n * 0x30, coefs[1 + i]);
 
 		if (eqhw->this08 == 0) {
-			hwwrite(vortex->mmio, 0x2b1e8 + n * 0x30, coefs[2 + i]);
-			hwwrite(vortex->mmio, 0x2b1ec + n * 0x30, coefs[3 + i]);
-			eax = coefs[4 + i];	//*esp24;
+			hwwrite(vortex->mmio, 0x2b1e8 + n * 0x30, coefs[2 + i] & 0xffff);
+			hwwrite(vortex->mmio, 0x2b1ec + n * 0x30, coefs[3 + i] & 0xffff);
+			hwwrite(vortex->mmio, 0x2b1f0 + n * 0x30, coefs[4 + i] & 0xffff);
 		} else {
-			if (coefs[2 + i] == 0x8000)
-				eax = 0x7fff;
-			else
-				eax = ~(coefs[2 + i]);
-			hwwrite(vortex->mmio, 0x2b1e8 + n * 0x30, eax & 0xffff);
-			if (coefs[3 + i] == 0x8000)
-				eax = 0x7fff;
-			else
-				eax = ~coefs[3 + i];
-			hwwrite(vortex->mmio, 0x2b1ec + n * 0x30, eax & 0xffff);
-			if (coefs[4 + i] == 0x8000)
-				eax = 0x7fff;
-			else
-				eax = ~coefs[4 + i];
+			hwwrite(vortex->mmio, 0x2b1e8 + n * 0x30, sign_invert(coefs[2 + i]) & 0xffff);
+			hwwrite(vortex->mmio, 0x2b1ec + n * 0x30, sign_invert(coefs[3 + i]) & 0xffff);
+			hwwrite(vortex->mmio, 0x2b1f0 + n * 0x30, sign_invert(coefs[4 + i]) & 0xffff);
 		}
-		hwwrite(vortex->mmio, 0x2b1f0 + n * 0x30, eax);
 		i += 5;
 	}
 
@@ -188,22 +172,12 @@
 static void vortex_EqHw_SetBypassGain(vortex_t * vortex, u16 a, u16 b)
 {
 	eqhw_t *eqhw = &(vortex->eq.this04);
-	int eax;
-
 	if (eqhw->this08 == 0) {
 		hwwrite(vortex->mmio, 0x2b3d4, a);
 		hwwrite(vortex->mmio, 0x2b3ec, b);
 	} else {
-		if (a == 0x8000)
-			eax = 0x7fff;
-		else
-			eax = ~a;
-		hwwrite(vortex->mmio, 0x2b3d4, eax & 0xffff);
-		if (b == 0x8000)
-			eax = 0x7fff;
-		else
-			eax = ~b;
-		hwwrite(vortex->mmio, 0x2b3ec, eax & 0xffff);
+		hwwrite(vortex->mmio, 0x2b3d4, sign_invert(a) & 0xffff);
+		hwwrite(vortex->mmio, 0x2b3ec, sign_invert(b) & 0xffff);
 	}
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] more au88x0 eq cleanups
  2004-09-21 12:07 [PATCH] more au88x0 eq cleanups Jeff Muizelaar
@ 2004-09-21 12:28 ` Takashi Iwai
  2004-09-21 21:32   ` Jeff Muizelaar
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2004-09-21 12:28 UTC (permalink / raw)
  To: Jeff Muizelaar; +Cc: alsa-devel

At Tue, 21 Sep 2004 08:07:49 -0400,
Jeff Muizelaar wrote:
> 
> Attached patch does more cleanups on the eq code. Acked by Manuel.

Could you provide a changelog with a summary and a signed-off-by
lines?


Takashi


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] more au88x0 eq cleanups
  2004-09-21 12:28 ` Takashi Iwai
@ 2004-09-21 21:32   ` Jeff Muizelaar
  2004-09-22 16:11     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Muizelaar @ 2004-09-21 21:32 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Takashi Iwai wrote:

>Could you provide a changelog with a summary and a signed-off-by
>lines?
>
>
>  
>
Sure,

cleanup au88x0 equalizer code by factoring out a sign_invert function 
that ensures all negative integers become positive.

Signed-off-by: Jeff Muizelaar <muizelaar@rogers.com>



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] more au88x0 eq cleanups
  2004-09-21 21:32   ` Jeff Muizelaar
@ 2004-09-22 16:11     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2004-09-22 16:11 UTC (permalink / raw)
  To: Jeff Muizelaar; +Cc: alsa-devel

At Tue, 21 Sep 2004 17:32:18 -0400,
Jeff Muizelaar wrote:
> 
> Takashi Iwai wrote:
> 
> >Could you provide a changelog with a summary and a signed-off-by
> >lines?
> >
> >
> >  
> >
> Sure,
> 
> cleanup au88x0 equalizer code by factoring out a sign_invert function 
> that ensures all negative integers become positive.
> 
> Signed-off-by: Jeff Muizelaar <muizelaar@rogers.com>

Thanks, applied now.


Takashi


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-09-22 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-21 12:07 [PATCH] more au88x0 eq cleanups Jeff Muizelaar
2004-09-21 12:28 ` Takashi Iwai
2004-09-21 21:32   ` Jeff Muizelaar
2004-09-22 16:11     ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.