Index: ice1712.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/ice1712.c,v retrieving revision 1.75 diff -u -r1.75 ice1712.c --- ice1712.c 17 Nov 2005 14:59:53 -0000 1.75 +++ ice1712.c 1 Feb 2006 21:16:57 -0000 @@ -60,7 +60,7 @@ #include #include #include - +#include #include #include "ice1712.h" @@ -316,7 +316,6 @@ inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ } - /* * * CS8427 interface @@ -332,7 +331,7 @@ unsigned char reg[2] = { 0x80 | 4, 0 }; /* CS8427 auto increment | register number 4 + data */ unsigned char val, nval; int res = 0; - + //printk("spdif_clock = %d\n", spdif_clock); snd_i2c_lock(ice->i2c); if (snd_i2c_sendbytes(ice->cs8427, reg, 1) != 1) { snd_i2c_unlock(ice->i2c); @@ -396,6 +395,21 @@ return 0; } +static void snd_ice1712_init_input_clock(struct snd_ice1712 *ice) +{ + /* change CS8427 clock source too */ + if (ice->cs8427) + printk("Y"); + snd_ice1712_cs8427_set_input_clock(ice, is_spdif_master(ice)); + /* notify ak4524 chip as well */ + if (is_spdif_master(ice)) { + unsigned int i; + for (i = 0; i < ice->akm_codecs; i++) { + if (ice->akm[i].ops.set_rate_val) + ice->akm[i].ops.set_rate_val(&ice->akm[i], 0); + } + } +} /* * Interrupt handler @@ -1537,6 +1551,7 @@ { struct snd_ice1712 *ice = entry->private_data; unsigned int idx; + char reg[128] = {1}; snd_iprintf(buffer, "%s\n\n", ice->card->longname); snd_iprintf(buffer, "EEPROM:\n"); @@ -1567,6 +1582,17 @@ snd_iprintf(buffer, " CAPTURE : 0x%08x\n", inl(ICEMT(ice, ROUTE_CAPTURE))); snd_iprintf(buffer, " SPDOUT : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_SPDOUT))); snd_iprintf(buffer, " RATE : 0x%02x\n", (unsigned)inb(ICEMT(ice, RATE))); + snd_iprintf(buffer, " GPIO_DATA : 0x%02x\n", (unsigned)snd_ice1712_get_gpio_data(ice)); + snd_iprintf(buffer, " GPIO_WRITE_MASK : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_WRITE_MASK)); + snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION)); + snd_iprintf(buffer, "\nCS8427 register dump:\n"); + if (snd_i2c_sendbytes(ice->cs8427, reg, 1) != 1) + snd_printk(KERN_ERR "unable to send register 0x%x byte to CS8427\n", reg[0]); + snd_i2c_readbytes(ice->cs8427, reg, 127); + for (idx = 0; idx < 0x37; idx++) + snd_iprintf(buffer, " reg[0x%02x] = 0x%02x\n", idx+1, 0xff & reg[idx]); + + snd_iprintf(buffer, " reg[0x7f] = 0x%02x\n", reg[126]); } static void __devinit snd_ice1712_proc_init(struct snd_ice1712 * ice) @@ -1844,6 +1870,7 @@ spin_lock_irq(&ice->reg_lock); oval = inb(ICEMT(ice, RATE)); + printk("U %i ",ucontrol->value.enumerated.item[0]); if (ucontrol->value.enumerated.item[0] == 13) { outb(oval | ICE1712_SPDIF_MASTER, ICEMT(ice, RATE)); } else { @@ -1855,22 +1882,12 @@ change = inb(ICEMT(ice, RATE)) != oval; spin_unlock_irq(&ice->reg_lock); - if ((oval & ICE1712_SPDIF_MASTER) != - (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) { - /* change CS8427 clock source too */ - if (ice->cs8427) { - snd_ice1712_cs8427_set_input_clock(ice, is_spdif_master(ice)); - } - /* notify ak4524 chip as well */ - if (is_spdif_master(ice)) { - unsigned int i; - for (i = 0; i < ice->akm_codecs; i++) { - if (ice->akm[i].ops.set_rate_val) - ice->akm[i].ops.set_rate_val(&ice->akm[i], 0); - } - } + printk("CS%i ",is_spdif_master(ice)); + if ((oval & ICE1712_SPDIF_MASTER) != (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) { + printk("IfT "); + snd_ice1712_init_input_clock(ice); } - + printk("\n"); return change; } @@ -2394,7 +2411,7 @@ pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]); if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24) { ice->gpio.write_mask = ice->eeprom.gpiomask; - ice->gpio.direction = ice->eeprom.gpiodir; + ice->gpio.direction = (0x7f & ice->eeprom.gpiodir); snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ice->eeprom.gpiomask); snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, @@ -2735,6 +2752,8 @@ } } + snd_ice1712_init_input_clock(ice); + sprintf(card->longname, "%s at 0x%lx, irq %i", card->shortname, ice->port, ice->irq);