The current CVS version of ALSA is broken for ibook2 tumbler based
cards.  After digging in quite a bit, I finally found and fixed several
bugs, although there is still one more pending.

The attached patched fixes the initialization and with it, one can play
sounds normally.  (before the driver would either not detect the
TAS3001C chip or it would segfault)

There is still one outstanding issue.  As you can see, in pmac.c I have
commented out the beep timer code.  The old code crashes the kernel.
This new code (if it's not commented out) will also crash the kernel.
With it commented out, if a beep is generated, it will sound until
another beep is generated, the driver is unloaded, or a normal pcm sound
is played.

I am unfamiliar with how timers work, and why this isn't work as
expected, and I'm still digging in.  I'll supply a followup patch once I
figure it out (or if anyone else knows the answer, please speak up).

jack.
Index: keywest.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/cards/ppc/keywest.c,v
retrieving revision 1.3
diff -u -r1.3 keywest.c
--- keywest.c   2001/09/03 10:39:06     1.3
+++ keywest.c   2001/12/07 00:26:10
@@ -79,7 +79,7 @@
        /* Clear all past interrupts */
        interrupt_state = keywest_readb(i2c, KW_ADDR_ISR) & 0x0f;
        if (interrupt_state > 0)
-               keywest_writeb(i2c, KW_ADDR_ISR, interrupt_state);
+               keywest_writeb_wait(i2c, KW_ADDR_ISR, interrupt_state);
 }
 
 static int keywest_start(pmac_keywest_t *i2c, unsigned char cmd, int is_read)
Index: pmac.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/cards/ppc/pmac.c,v
retrieving revision 1.5
diff -u -r1.5 pmac.c
--- pmac.c      2001/10/11 10:27:54     1.5
+++ pmac.c      2001/12/07 00:26:13
@@ -262,7 +262,6 @@
 
        if (beep && beep->running) {
                beep->running = 0;
-               del_timer(&beep->timer);
                snd_pmac_dma_stop(&chip->playback);
                st_le16(&chip->extra_dma.cmds->command, DBDMA_STOP);
        }
@@ -790,8 +789,9 @@
        if (beep->running) {
                if (ticks <= 0)
                        ticks = 1;
+               //del_timer(&beep->timer);
                beep->timer.expires = jiffies + ticks;
-               add_timer(&beep->timer);
+               //add_timer(&beep->timer);
                snd_pmac_dma_stop(rec);
                st_le16(&chip->extra_dma.cmds->req_count, nsamples * 4);
                st_le16(&chip->extra_dma.cmds->xfer_status, 0);
@@ -879,6 +879,7 @@
        beep->timer.data = (unsigned long) chip;
        beep->orig_mksound = kd_mksound;
        beep->volume = BEEP_VOLUME;
+       beep->running = 0;
        beep->control = snd_ctl_new1(&snd_pmac_beep_mixer, chip);
        if (beep->control == NULL) {
                kfree(beep);
Index: tumbler.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/cards/ppc/tumbler.c,v
retrieving revision 1.4
diff -u -r1.4 tumbler.c
--- tumbler.c   2001/09/07 13:41:11     1.4
+++ tumbler.c   2001/12/07 00:26:13
@@ -326,7 +326,7 @@
        struct device_node *node;
        void *base;
 
-       node = find_audio_device("audio-hw-reset");
+       node = find_audio_device(device);
        if (! node) {
                snd_printd("cannot find device %s\n", device);
                return 0;
@@ -349,12 +349,13 @@
 
        if (! (base = tumbler_find_device("audio-hw-reset")))
                return -ENODEV;
+
        map = ioremap(base, 1);
-       writeb(5, base);
+       writeb(5, map);
        mdelay(100);
-       writeb(4, base);
+       writeb(4, map);
        mdelay(1);
-       writeb(5, base);
+       writeb(5, map);
        mdelay(1);
        iounmap(map);
        return 0;
@@ -447,6 +448,8 @@
        chip->mixer_data = mix;
        chip->mixer_free = tumbler_cleanup;
 
+       tumbler_init(chip);
+
        if ((err = snd_pmac_keywest_find(chip, &mix->i2c, TAS_I2C_ADDR, 
tumbler_init_client)) < 0)
                return err;
 
@@ -460,7 +463,6 @@
                        return err;
        }
 
-       tumbler_init(chip);
 #ifdef CONFIG_PMAC_PBOOK
        chip->resume = tumbler_resume;
 #endif

Reply via email to