Merge branch 'topic/usb' into for-linus
[pandora-kernel.git] / sound / ppc / tumbler.c
index 789f44f..20afdf9 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/kmod.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
+#include <linux/string.h>
 #include <sound/core.h>
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -46,6 +47,8 @@
 #define DBG(fmt...)
 #endif
 
+#define IS_G4DA (of_machine_is_compatible("PowerMac3,4"))
+
 /* i2c address for tumbler */
 #define TAS_I2C_ADDR   0x34
 
@@ -243,6 +246,7 @@ static int tumbler_set_master_volume(struct pmac_tumbler *mix)
                snd_printk(KERN_ERR "failed to set volume \n");
                return -EINVAL;
        }
+       DBG("(I) succeeded to set volume (%u, %u)\n", left_vol, right_vol);
        return 0;
 }
 
@@ -353,6 +357,7 @@ static int tumbler_set_drc(struct pmac_tumbler *mix)
                snd_printk(KERN_ERR "failed to set DRC\n");
                return -EINVAL;
        }
+       DBG("(I) succeeded to set DRC (%u, %u)\n", val[0], val[1]);
        return 0;
 }
 
@@ -389,6 +394,7 @@ static int snapper_set_drc(struct pmac_tumbler *mix)
                snd_printk(KERN_ERR "failed to set DRC\n");
                return -EINVAL;
        }
+       DBG("(I) succeeded to set DRC (%u, %u)\n", val[0], val[1]);
        return 0;
 }
 
@@ -1134,7 +1140,8 @@ static long tumbler_find_device(const char *device, const char *platform,
                gp->inactive_val = (*base) ? 0x4 : 0x5;
        } else {
                const u32 *prop = NULL;
-               gp->active_state = 0;
+               gp->active_state = IS_G4DA
+                               && !strncmp(device, "keywest-gpio1", 13);
                gp->active_val = 0x4;
                gp->inactive_val = 0x5;
                /* Here are some crude hacks to extract the GPIO polarity and
@@ -1312,6 +1319,9 @@ static int __devinit tumbler_init(struct snd_pmac *chip)
        if (irq <= NO_IRQ)
                irq = tumbler_find_device("line-output-detect",
                                          NULL, &mix->line_detect, 1);
+       if (IS_G4DA && irq <= NO_IRQ)
+               irq = tumbler_find_device("keywest-gpio16",
+                                         NULL, &mix->line_detect, 1);
        mix->lineout_irq = irq;
 
        tumbler_reset_audio(chip);