Dmasound for iBook2

Stefan Pfetzing dreamind at dreamind.de
Thu Sep 27 08:55:41 EST 2001


Hi,

i recently tested the Dmasound patch for the ibook2, which is now in benh's
tree. I noticed that the volume got really loud even if at approx 10%...
Hope this little patch solves that, for me it does.

bye

dreamind
-------------- next part --------------
diff -urN linux-benh.orig/drivers/sound/dmasound/tas3001c.c linux-benh/drivers/sound/dmasound/tas3001c.c
--- linux-benh.orig/drivers/sound/dmasound/tas3001c.c	Mon Sep 24 22:24:31 2001
+++ linux-benh/drivers/sound/dmasound/tas3001c.c	Tue Sep 25 02:09:10 2001
@@ -52,11 +52,13 @@
 #define VOL_MAX ((1<<20) - 1)

 void tumbler_get_volume(uint * left_vol, uint  *right_vol) {
-  *left_vol = cur_left_vol>>4;
-  *right_vol = cur_right_vol>>4;
+  *left_vol = cur_left_vol;
+  *right_vol = cur_right_vol;
 }

 int tumbler_set_volume(uint left_vol, uint right_vol) {
+  uint left_vol_pers = left_vol;
+  uint right_vol_pers = right_vol;
   unsigned char block[6];

   if (! tumbler_client) {
@@ -64,8 +66,11 @@
     return -1;
   }

-  left_vol<<=4;
-  right_vol<<=4;
+  left_vol>>=6;
+  right_vol>>=6;
+
+  left_vol*=left_vol;
+  right_vol*=right_vol;

   if (left_vol > VOL_MAX)
     left_vol = VOL_MAX;
@@ -85,8 +90,8 @@
     printk("tumbler: failed to set volume \n");
     return -1;
   } else {
-    cur_left_vol = left_vol;
-    cur_right_vol = right_vol;
+    cur_left_vol = left_vol_pers;
+    cur_right_vol = right_vol_pers;
   }

   return 0;


More information about the Linuxppc-dev mailing list