Skip to contentSkip to conversation

Dmasound for iBook2

PATCH Stefan Pfetzing 1 participant 1 message Sep 26, 2001

lore
Share & tools
lore
#0 lore raw

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

drivers/sound/dmasound/tas3001c.c +11 -6
diff -urN linux-benh.orig/drivers/sound/dmasound/tas3001c.c linux-benh/drivers/sound/dmasound/tas3001c.c
@@ -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;