fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / sound / pci / ice1712 / ews.c
index 02593f9..b135389 100644 (file)
 #define SND_CS8404
 #include <sound/cs8403.h>
 
+enum {
+       EWS_I2C_CS8404 = 0, EWS_I2C_PCF1, EWS_I2C_PCF2,
+       EWS_I2C_88D = 0,
+       EWS_I2C_6FIRE = 0
+};
+       
+
 /*
  * access via i2c mode (for EWX 24/96, EWS 88MT&D)
  */
 
 /* send SDA and SCL */
-static void ewx_i2c_setlines(snd_i2c_bus_t *bus, int clk, int data)
+static void ewx_i2c_setlines(struct snd_i2c_bus *bus, int clk, int data)
 {
-       ice1712_t *ice = bus->private_data;
+       struct snd_ice1712 *ice = bus->private_data;
        unsigned char tmp = 0;
        if (clk)
                tmp |= ICE1712_EWX2496_SERIAL_CLOCK;
@@ -55,15 +62,15 @@ static void ewx_i2c_setlines(snd_i2c_bus_t *bus, int clk, int data)
        udelay(5);
 }
 
-static int ewx_i2c_getclock(snd_i2c_bus_t *bus)
+static int ewx_i2c_getclock(struct snd_i2c_bus *bus)
 {
-       ice1712_t *ice = bus->private_data;
+       struct snd_ice1712 *ice = bus->private_data;
        return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_CLOCK ? 1 : 0;
 }
 
-static int ewx_i2c_getdata(snd_i2c_bus_t *bus, int ack)
+static int ewx_i2c_getdata(struct snd_i2c_bus *bus, int ack)
 {
-       ice1712_t *ice = bus->private_data;
+       struct snd_ice1712 *ice = bus->private_data;
        int bit;
        /* set RW pin to low */
        snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_RW);
@@ -78,9 +85,9 @@ static int ewx_i2c_getdata(snd_i2c_bus_t *bus, int ack)
        return bit;
 }
 
-static void ewx_i2c_start(snd_i2c_bus_t *bus)
+static void ewx_i2c_start(struct snd_i2c_bus *bus)
 {
-       ice1712_t *ice = bus->private_data;
+       struct snd_ice1712 *ice = bus->private_data;
        unsigned char mask;
 
        snd_ice1712_save_gpio_status(ice);
@@ -97,15 +104,15 @@ static void ewx_i2c_start(snd_i2c_bus_t *bus)
        snd_ice1712_gpio_write_bits(ice, mask, mask);
 }
 
-static void ewx_i2c_stop(snd_i2c_bus_t *bus)
+static void ewx_i2c_stop(struct snd_i2c_bus *bus)
 {
-       ice1712_t *ice = bus->private_data;
+       struct snd_ice1712 *ice = bus->private_data;
        snd_ice1712_restore_gpio_status(ice);
 }
 
-static void ewx_i2c_direction(snd_i2c_bus_t *bus, int clock, int data)
+static void ewx_i2c_direction(struct snd_i2c_bus *bus, int clock, int data)
 {
-       ice1712_t *ice = bus->private_data;
+       struct snd_ice1712 *ice = bus->private_data;
        unsigned char mask = 0;
 
        if (clock)
@@ -118,7 +125,7 @@ static void ewx_i2c_direction(snd_i2c_bus_t *bus, int clock, int data)
        snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~mask);
 }
 
-static snd_i2c_bit_ops_t snd_ice1712_ewx_cs8427_bit_ops = {
+static struct snd_i2c_bit_ops snd_ice1712_ewx_cs8427_bit_ops = {
        .start = ewx_i2c_start,
        .stop = ewx_i2c_stop,
        .direction = ewx_i2c_direction,
@@ -133,17 +140,17 @@ static snd_i2c_bit_ops_t snd_ice1712_ewx_cs8427_bit_ops = {
  */
 
 /* AK4524 chip select; address 0x48 bit 0-3 */
-static int snd_ice1712_ews88mt_chip_select(ice1712_t *ice, int chip_mask)
+static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mask)
 {
        unsigned char data, ndata;
 
        snd_assert(chip_mask >= 0 && chip_mask <= 0x0f, return -EINVAL);
        snd_i2c_lock(ice->i2c);
-       if (snd_i2c_readbytes(ice->i2cdevs[1], &data, 1) != 1)
+       if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &data, 1) != 1)
                goto __error;
        ndata = (data & 0xf0) | chip_mask;
        if (ndata != data)
-               if (snd_i2c_sendbytes(ice->i2cdevs[1], &ndata, 1) != 1)
+               if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &ndata, 1) != 1)
                        goto __error;
        snd_i2c_unlock(ice->i2c);
        return 0;
@@ -155,9 +162,9 @@ static int snd_ice1712_ews88mt_chip_select(ice1712_t *ice, int chip_mask)
 }
 
 /* start callback for EWS88MT, needs to select a certain chip mask */
-static void ews88mt_ak4524_lock(akm4xxx_t *ak, int chip)
+static void ews88mt_ak4524_lock(struct snd_akm4xxx *ak, int chip)
 {
-       ice1712_t *ice = ak->private_data[0];
+       struct snd_ice1712 *ice = ak->private_data[0];
        unsigned char tmp;
        /* assert AK4524 CS */
        if (snd_ice1712_ews88mt_chip_select(ice, ~(1 << chip) & 0x0f) < 0)
@@ -172,18 +179,18 @@ static void ews88mt_ak4524_lock(akm4xxx_t *ak, int chip)
 }
 
 /* stop callback for EWS88MT, needs to deselect chip mask */
-static void ews88mt_ak4524_unlock(akm4xxx_t *ak, int chip)
+static void ews88mt_ak4524_unlock(struct snd_akm4xxx *ak, int chip)
 {
-       ice1712_t *ice = ak->private_data[0];
+       struct snd_ice1712 *ice = ak->private_data[0];
        snd_ice1712_restore_gpio_status(ice);
        udelay(1);
        snd_ice1712_ews88mt_chip_select(ice, 0x0f);
 }
 
 /* start callback for EWX24/96 */
-static void ewx2496_ak4524_lock(akm4xxx_t *ak, int chip)
+static void ewx2496_ak4524_lock(struct snd_akm4xxx *ak, int chip)
 {
-       ice1712_t *ice = ak->private_data[0];
+       struct snd_ice1712 *ice = ak->private_data[0];
        unsigned char tmp;
        snd_ice1712_save_gpio_status(ice);
        tmp =  ICE1712_EWX2496_SERIAL_DATA |
@@ -196,10 +203,10 @@ static void ewx2496_ak4524_lock(akm4xxx_t *ak, int chip)
 }
 
 /* start callback for DMX 6fire */
-static void dmx6fire_ak4524_lock(akm4xxx_t *ak, int chip)
+static void dmx6fire_ak4524_lock(struct snd_akm4xxx *ak, int chip)
 {
        struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
-       ice1712_t *ice = ak->private_data[0];
+       struct snd_ice1712 *ice = ak->private_data[0];
        unsigned char tmp;
        snd_ice1712_save_gpio_status(ice);
        tmp = priv->cs_mask = priv->cs_addr = (1 << chip) & ICE1712_6FIRE_AK4524_CS_MASK;
@@ -215,7 +222,7 @@ static void dmx6fire_ak4524_lock(akm4xxx_t *ak, int chip)
  * CS8404 interface on EWS88MT/D
  */
 
-static void snd_ice1712_ews_cs8404_spdif_write(ice1712_t *ice, unsigned char bits)
+static void snd_ice1712_ews_cs8404_spdif_write(struct snd_ice1712 *ice, unsigned char bits)
 {
        unsigned char bytes[2];
 
@@ -224,13 +231,16 @@ static void snd_ice1712_ews_cs8404_spdif_write(ice1712_t *ice, unsigned char bit
        case ICE1712_SUBDEVICE_EWS88MT:
        case ICE1712_SUBDEVICE_EWS88MT_NEW:
        case ICE1712_SUBDEVICE_PHASE88:
-               snd_runtime_check(snd_i2c_sendbytes(ice->cs8404, &bits, 1) == 1, goto _error);
+               if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_CS8404], &bits, 1) != 1)
+                       goto _error;
                break;
        case ICE1712_SUBDEVICE_EWS88D:
-               snd_runtime_check(snd_i2c_readbytes(ice->i2cdevs[0], bytes, 2) == 2, goto _error);
+               if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_88D], bytes, 2) != 2)
+                       goto _error;
                if (bits != bytes[1]) {
                        bytes[1] = bits;
-                       snd_runtime_check(snd_i2c_readbytes(ice->i2cdevs[0], bytes, 2) == 2, goto _error);
+                       if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_88D], bytes, 2) != 2)
+                               goto _error;
                }
                break;
        }
@@ -241,12 +251,12 @@ static void snd_ice1712_ews_cs8404_spdif_write(ice1712_t *ice, unsigned char bit
 /*
  */
 
-static void ews88_spdif_default_get(ice1712_t *ice, snd_ctl_elem_value_t * ucontrol)
+static void ews88_spdif_default_get(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
 {
        snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_bits);
 }
 
-static int ews88_spdif_default_put(ice1712_t *ice, snd_ctl_elem_value_t * ucontrol)
+static int ews88_spdif_default_put(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
 {
        unsigned int val;
        int change;
@@ -264,12 +274,12 @@ static int ews88_spdif_default_put(ice1712_t *ice, snd_ctl_elem_value_t * ucontr
        return change;
 }
 
-static void ews88_spdif_stream_get(ice1712_t *ice, snd_ctl_elem_value_t * ucontrol)
+static void ews88_spdif_stream_get(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
 {
        snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_stream_bits);
 }
 
-static int ews88_spdif_stream_put(ice1712_t *ice, snd_ctl_elem_value_t * ucontrol)
+static int ews88_spdif_stream_put(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
 {
        unsigned int val;
        int change;
@@ -289,13 +299,13 @@ static int ews88_spdif_stream_put(ice1712_t *ice, snd_ctl_elem_value_t * ucontro
 
 
 /* open callback */
-static void ews88_open_spdif(ice1712_t *ice, snd_pcm_substream_t * substream)
+static void ews88_open_spdif(struct snd_ice1712 *ice, struct snd_pcm_substream *substream)
 {
        ice->spdif.cs8403_stream_bits = ice->spdif.cs8403_bits;
 }
 
 /* set up SPDIF for EWS88MT / EWS88D */
-static void ews88_setup_spdif(ice1712_t *ice, int rate)
+static void ews88_setup_spdif(struct snd_ice1712 *ice, int rate)
 {
        unsigned long flags;
        unsigned char tmp;
@@ -322,7 +332,7 @@ static void ews88_setup_spdif(ice1712_t *ice, int rate)
 
 /*
  */
-static akm4xxx_t akm_ews88mt __devinitdata = {
+static struct snd_akm4xxx akm_ews88mt __devinitdata = {
        .num_adcs = 8,
        .num_dacs = 8,
        .type = SND_AK4524,
@@ -344,7 +354,7 @@ static struct snd_ak4xxx_private akm_ews88mt_priv __devinitdata = {
        .mask_flags = 0,
 };
 
-static akm4xxx_t akm_ewx2496 __devinitdata = {
+static struct snd_akm4xxx akm_ewx2496 __devinitdata = {
        .num_adcs = 2,
        .num_dacs = 2,
        .type = SND_AK4524,
@@ -365,7 +375,7 @@ static struct snd_ak4xxx_private akm_ewx2496_priv __devinitdata = {
        .mask_flags = 0,
 };
 
-static akm4xxx_t akm_6fire __devinitdata = {
+static struct snd_akm4xxx akm_6fire __devinitdata = {
        .num_adcs = 6,
        .num_dacs = 6,
        .type = SND_AK4524,
@@ -396,12 +406,12 @@ static struct snd_ak4xxx_private akm_6fire_priv __devinitdata = {
 #define PCF9554_REG_POLARITY   2
 #define PCF9554_REG_CONFIG     3
 
-static int snd_ice1712_6fire_write_pca(ice1712_t *ice, unsigned char reg, unsigned char data);
+static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char data);
 
-static int __devinit snd_ice1712_ews_init(ice1712_t *ice)
+static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice)
 {
        int err;
-       akm4xxx_t *ak;
+       struct snd_akm4xxx *ak;
 
        /* set the analog DACs */
        switch (ice->eeprom.subvendor) {
@@ -416,7 +426,10 @@ static int __devinit snd_ice1712_ews_init(ice1712_t *ice)
                ice->num_total_adcs = 8;
                break;
        case ICE1712_SUBDEVICE_EWS88D:
-               break; /* no analog */
+               /* Note: not analog but ADAT I/O */
+               ice->num_total_dacs = 8;
+               ice->num_total_adcs = 8;
+               break;
        case ICE1712_SUBDEVICE_DMX6FIRE:
                ice->num_total_dacs = 6;
                ice->num_total_adcs = 6;
@@ -425,7 +438,7 @@ static int __devinit snd_ice1712_ews_init(ice1712_t *ice)
 
        /* create i2c */
        if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
-               snd_printk("unable to create I2C bus\n");
+               snd_printk(KERN_ERR "unable to create I2C bus\n");
                return err;
        }
        ice->i2c->private_data = ice;
@@ -434,8 +447,8 @@ static int __devinit snd_ice1712_ews_init(ice1712_t *ice)
        /* create i2c devices */
        switch (ice->eeprom.subvendor) {
        case ICE1712_SUBDEVICE_DMX6FIRE:
-               if ((err = snd_i2c_device_create(ice->i2c, "PCF9554", ICE1712_6FIRE_PCF9554_ADDR, &ice->i2cdevs[0])) < 0) {
-                       snd_printk("PCF9554 initialization failed\n");
+               if ((err = snd_i2c_device_create(ice->i2c, "PCF9554", ICE1712_6FIRE_PCF9554_ADDR, &ice->spec.i2cdevs[EWS_I2C_6FIRE])) < 0) {
+                       snd_printk(KERN_ERR "PCF9554 initialization failed\n");
                        return err;
                }
                snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80);
@@ -443,18 +456,18 @@ static int __devinit snd_ice1712_ews_init(ice1712_t *ice)
        case ICE1712_SUBDEVICE_EWS88MT:
        case ICE1712_SUBDEVICE_EWS88MT_NEW:
        case ICE1712_SUBDEVICE_PHASE88:
-               if ((err = snd_i2c_device_create(ice->i2c, "CS8404", ICE1712_EWS88MT_CS8404_ADDR, &ice->cs8404)) < 0)
+               if ((err = snd_i2c_device_create(ice->i2c, "CS8404", ICE1712_EWS88MT_CS8404_ADDR, &ice->spec.i2cdevs[EWS_I2C_CS8404])) < 0)
                        return err;
-               if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)", ICE1712_EWS88MT_INPUT_ADDR, &ice->i2cdevs[0])) < 0)
+               if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)", ICE1712_EWS88MT_INPUT_ADDR, &ice->spec.i2cdevs[EWS_I2C_PCF1])) < 0)
                        return err;
-               if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)", ICE1712_EWS88MT_OUTPUT_ADDR, &ice->i2cdevs[1])) < 0)
+               if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)", ICE1712_EWS88MT_OUTPUT_ADDR, &ice->spec.i2cdevs[EWS_I2C_PCF2])) < 0)
                        return err;
                /* Check if the front module is connected */
                if ((err = snd_ice1712_ews88mt_chip_select(ice, 0x0f)) < 0)
                        return err;
                break;
        case ICE1712_SUBDEVICE_EWS88D:
-               if ((err = snd_i2c_device_create(ice->i2c, "PCF8575", ICE1712_EWS88D_PCF_ADDR, &ice->i2cdevs[0])) < 0)
+               if ((err = snd_i2c_device_create(ice->i2c, "PCF8575", ICE1712_EWS88D_PCF_ADDR, &ice->spec.i2cdevs[EWS_I2C_88D])) < 0)
                        return err;
                break;
        }
@@ -494,7 +507,7 @@ static int __devinit snd_ice1712_ews_init(ice1712_t *ice)
        }
 
        /* analog section */
-       ak = ice->akm = kmalloc(sizeof(akm4xxx_t), GFP_KERNEL);
+       ak = ice->akm = kmalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
        if (! ak)
                return -ENOMEM;
        ice->akm_codecs = 1;
@@ -523,7 +536,7 @@ static int __devinit snd_ice1712_ews_init(ice1712_t *ice)
  */
 
 /* i/o sensitivity - this callback is shared among other devices, too */
-static int snd_ice1712_ewx_io_sense_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo){
+static int snd_ice1712_ewx_io_sense_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo){
 
        static char *texts[2] = {
                "+4dBu", "-10dBV",
@@ -537,9 +550,9 @@ static int snd_ice1712_ewx_io_sense_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_
        return 0;
 }
 
-static int snd_ice1712_ewx_io_sense_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_ice1712_ewx_io_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        unsigned char mask = kcontrol->private_value & 0xff;
        
        snd_ice1712_save_gpio_status(ice);
@@ -548,9 +561,9 @@ static int snd_ice1712_ewx_io_sense_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_
        return 0;
 }
 
-static int snd_ice1712_ewx_io_sense_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_ice1712_ewx_io_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        unsigned char mask = kcontrol->private_value & 0xff;
        int val, nval;
 
@@ -565,7 +578,7 @@ static int snd_ice1712_ewx_io_sense_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_
        return val != nval;
 }
 
-static snd_kcontrol_new_t snd_ice1712_ewx2496_controls[] __devinitdata = {
+static struct snd_kcontrol_new snd_ice1712_ewx2496_controls[] __devinitdata = {
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                .name = "Input Sensitivity Switch",
@@ -589,13 +602,13 @@ static snd_kcontrol_new_t snd_ice1712_ewx2496_controls[] __devinitdata = {
  * EWS88MT specific controls
  */
 /* analog output sensitivity;; address 0x48 bit 6 */
-static int snd_ice1712_ews88mt_output_sense_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_ice1712_ews88mt_output_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        unsigned char data;
 
        snd_i2c_lock(ice->i2c);
-       if (snd_i2c_readbytes(ice->i2cdevs[1], &data, 1) != 1) {
+       if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) {
                snd_i2c_unlock(ice->i2c);
                return -EIO;
        }
@@ -605,18 +618,18 @@ static int snd_ice1712_ews88mt_output_sense_get(snd_kcontrol_t *kcontrol, snd_ct
 }
 
 /* analog output sensitivity;; address 0x48 bit 6 */
-static int snd_ice1712_ews88mt_output_sense_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_ice1712_ews88mt_output_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        unsigned char data, ndata;
 
        snd_i2c_lock(ice->i2c);
-       if (snd_i2c_readbytes(ice->i2cdevs[1], &data, 1) != 1) {
+       if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) {
                snd_i2c_unlock(ice->i2c);
                return -EIO;
        }
        ndata = (data & ~ICE1712_EWS88MT_OUTPUT_SENSE) | (ucontrol->value.enumerated.item[0] ? ICE1712_EWS88MT_OUTPUT_SENSE : 0);
-       if (ndata != data && snd_i2c_sendbytes(ice->i2cdevs[1], &ndata, 1) != 1) {
+       if (ndata != data && snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &ndata, 1) != 1) {
                snd_i2c_unlock(ice->i2c);
                return -EIO;
        }
@@ -625,15 +638,15 @@ static int snd_ice1712_ews88mt_output_sense_put(snd_kcontrol_t *kcontrol, snd_ct
 }
 
 /* analog input sensitivity; address 0x46 */
-static int snd_ice1712_ews88mt_input_sense_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_ice1712_ews88mt_input_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
        unsigned char data;
 
        snd_assert(channel >= 0 && channel <= 7, return 0);
        snd_i2c_lock(ice->i2c);
-       if (snd_i2c_readbytes(ice->i2cdevs[0], &data, 1) != 1) {
+       if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) {
                snd_i2c_unlock(ice->i2c);
                return -EIO;
        }
@@ -644,20 +657,20 @@ static int snd_ice1712_ews88mt_input_sense_get(snd_kcontrol_t *kcontrol, snd_ctl
 }
 
 /* analog output sensitivity; address 0x46 */
-static int snd_ice1712_ews88mt_input_sense_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_ice1712_ews88mt_input_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
        unsigned char data, ndata;
 
        snd_assert(channel >= 0 && channel <= 7, return 0);
        snd_i2c_lock(ice->i2c);
-       if (snd_i2c_readbytes(ice->i2cdevs[0], &data, 1) != 1) {
+       if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) {
                snd_i2c_unlock(ice->i2c);
                return -EIO;
        }
        ndata = (data & ~(1 << channel)) | (ucontrol->value.enumerated.item[0] ? 0 : (1 << channel));
-       if (ndata != data && snd_i2c_sendbytes(ice->i2cdevs[0], &ndata, 1) != 1) {
+       if (ndata != data && snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_PCF1], &ndata, 1) != 1) {
                snd_i2c_unlock(ice->i2c);
                return -EIO;
        }
@@ -665,7 +678,7 @@ static int snd_ice1712_ews88mt_input_sense_put(snd_kcontrol_t *kcontrol, snd_ctl
        return ndata != data;
 }
 
-static snd_kcontrol_new_t snd_ice1712_ews88mt_input_sense __devinitdata = {
+static struct snd_kcontrol_new snd_ice1712_ews88mt_input_sense __devinitdata = {
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
        .name = "Input Sensitivity Switch",
        .info = snd_ice1712_ewx_io_sense_info,
@@ -674,7 +687,7 @@ static snd_kcontrol_new_t snd_ice1712_ews88mt_input_sense __devinitdata = {
        .count = 8,
 };
 
-static snd_kcontrol_new_t snd_ice1712_ews88mt_output_sense __devinitdata = {
+static struct snd_kcontrol_new snd_ice1712_ews88mt_output_sense __devinitdata = {
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
        .name = "Output Sensitivity Switch",
        .info = snd_ice1712_ewx_io_sense_info,
@@ -687,7 +700,7 @@ static snd_kcontrol_new_t snd_ice1712_ews88mt_output_sense __devinitdata = {
  * EWS88D specific controls
  */
 
-static int snd_ice1712_ews88d_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int snd_ice1712_ews88d_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
        uinfo->count = 1;
@@ -696,15 +709,15 @@ static int snd_ice1712_ews88d_control_info(snd_kcontrol_t *kcontrol, snd_ctl_ele
        return 0;
 }
 
-static int snd_ice1712_ews88d_control_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_ice1712_ews88d_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int shift = kcontrol->private_value & 0xff;
        int invert = (kcontrol->private_value >> 8) & 1;
        unsigned char data[2];
        
        snd_i2c_lock(ice->i2c);
-       if (snd_i2c_readbytes(ice->i2cdevs[0], data, 2) != 2) {
+       if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_88D], data, 2) != 2) {
                snd_i2c_unlock(ice->i2c);
                return -EIO;
        }
@@ -716,16 +729,16 @@ static int snd_ice1712_ews88d_control_get(snd_kcontrol_t *kcontrol, snd_ctl_elem
        return 0;
 }
 
-static int snd_ice1712_ews88d_control_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+static int snd_ice1712_ews88d_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int shift = kcontrol->private_value & 0xff;
        int invert = (kcontrol->private_value >> 8) & 1;
        unsigned char data[2], ndata[2];
        int change;
 
        snd_i2c_lock(ice->i2c);
-       if (snd_i2c_readbytes(ice->i2cdevs[0], data, 2) != 2) {
+       if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_88D], data, 2) != 2) {
                snd_i2c_unlock(ice->i2c);
                return -EIO;
        }
@@ -738,7 +751,7 @@ static int snd_ice1712_ews88d_control_put(snd_kcontrol_t * kcontrol, snd_ctl_ele
                        ndata[shift >> 3] |= (1 << (shift & 7));
        }
        change = (data[shift >> 3] != ndata[shift >> 3]);
-       if (change && snd_i2c_sendbytes(ice->i2cdevs[0], data, 2) != 2) {
+       if (change && snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_88D], data, 2) != 2) {
                snd_i2c_unlock(ice->i2c);
                return -EIO;
        }
@@ -756,7 +769,7 @@ static int snd_ice1712_ews88d_control_put(snd_kcontrol_t * kcontrol, snd_ctl_ele
   .private_value = xshift | (xinvert << 8),\
 }
 
-static snd_kcontrol_new_t snd_ice1712_ews88d_controls[] __devinitdata = {
+static struct snd_kcontrol_new snd_ice1712_ews88d_controls[] __devinitdata = {
        EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, 1, 0), /* inverted */
        EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Output Optical", 1, 0, 0),
        EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT External Master Clock", 2, 0, 0),
@@ -769,29 +782,29 @@ static snd_kcontrol_new_t snd_ice1712_ews88d_controls[] __devinitdata = {
  * DMX 6Fire specific controls
  */
 
-static int snd_ice1712_6fire_read_pca(ice1712_t *ice, unsigned char reg)
+static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg)
 {
        unsigned char byte;
        snd_i2c_lock(ice->i2c);
        byte = reg;
-       snd_i2c_sendbytes(ice->i2cdevs[0], &byte, 1);
+       snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], &byte, 1);
        byte = 0;
-       if (snd_i2c_readbytes(ice->i2cdevs[0], &byte, 1) != 1) {
+       if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) {
                snd_i2c_unlock(ice->i2c);
-               printk("cannot read pca\n");
+               printk(KERN_ERR "cannot read pca\n");
                return -EIO;
        }
        snd_i2c_unlock(ice->i2c);
        return byte;
 }
 
-static int snd_ice1712_6fire_write_pca(ice1712_t *ice, unsigned char reg, unsigned char data)
+static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char data)
 {
        unsigned char bytes[2];
        snd_i2c_lock(ice->i2c);
        bytes[0] = reg;
        bytes[1] = data;
-       if (snd_i2c_sendbytes(ice->i2cdevs[0], bytes, 2) != 2) {
+       if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], bytes, 2) != 2) {
                snd_i2c_unlock(ice->i2c);
                return -EIO;
        }
@@ -799,7 +812,7 @@ static int snd_ice1712_6fire_write_pca(ice1712_t *ice, unsigned char reg, unsign
        return 0;
 }
 
-static int snd_ice1712_6fire_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int snd_ice1712_6fire_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
        uinfo->count = 1;
@@ -808,9 +821,9 @@ static int snd_ice1712_6fire_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem
        return 0;
 }
 
-static int snd_ice1712_6fire_control_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_ice1712_6fire_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int shift = kcontrol->private_value & 0xff;
        int invert = (kcontrol->private_value >> 8) & 1;
        int data;
@@ -824,9 +837,9 @@ static int snd_ice1712_6fire_control_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_
        return 0;
 }
 
-static int snd_ice1712_6fire_control_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_ice1712_6fire_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int shift = kcontrol->private_value & 0xff;
        int invert = (kcontrol->private_value >> 8) & 1;
        int data, ndata;
@@ -845,7 +858,7 @@ static int snd_ice1712_6fire_control_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_
        return 0;
 }
 
-static int snd_ice1712_6fire_select_input_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int snd_ice1712_6fire_select_input_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        static char *texts[4] = {
                "Internal", "Front Input", "Rear Input", "Wave Table"
@@ -859,9 +872,9 @@ static int snd_ice1712_6fire_select_input_info(snd_kcontrol_t *kcontrol, snd_ctl
        return 0;
 }
      
-static int snd_ice1712_6fire_select_input_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_ice1712_6fire_select_input_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int data;
        
        if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0)
@@ -870,9 +883,9 @@ static int snd_ice1712_6fire_select_input_get(snd_kcontrol_t *kcontrol, snd_ctl_
        return 0;
 }
 
-static int snd_ice1712_6fire_select_input_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int snd_ice1712_6fire_select_input_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
-       ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int data, ndata;
        
        if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0)
@@ -896,7 +909,7 @@ static int snd_ice1712_6fire_select_input_put(snd_kcontrol_t *kcontrol, snd_ctl_
   .private_value = xshift | (xinvert << 8),\
 }
 
-static snd_kcontrol_new_t snd_ice1712_6fire_controls[] __devinitdata = {
+static struct snd_kcontrol_new snd_ice1712_6fire_controls[] __devinitdata = {
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                .name = "Analog Input Select",
@@ -904,7 +917,7 @@ static snd_kcontrol_new_t snd_ice1712_6fire_controls[] __devinitdata = {
                .get = snd_ice1712_6fire_select_input_get,
                .put = snd_ice1712_6fire_select_input_put,
        },
-       DMX6FIRE_CONTROL("Front Digital Input Switch", 2, 0),
+       DMX6FIRE_CONTROL("Front Digital Input Switch", 2, 1),
        // DMX6FIRE_CONTROL("Master Clock Select", 3, 0),
        DMX6FIRE_CONTROL("Optical Digital Input Switch", 4, 0),
        DMX6FIRE_CONTROL("Phono Analog Input Switch", 5, 0),
@@ -912,7 +925,7 @@ static snd_kcontrol_new_t snd_ice1712_6fire_controls[] __devinitdata = {
 };
 
 
-static int __devinit snd_ice1712_ews_add_controls(ice1712_t *ice)
+static int __devinit snd_ice1712_ews_add_controls(struct snd_ice1712 *ice)
 {
        unsigned int idx;
        int err;
@@ -1018,6 +1031,9 @@ struct snd_ice1712_card_info snd_ice1712_ews_cards[] __devinitdata = {
                .model = "dmx6fire",
                .chip_init = snd_ice1712_ews_init,
                .build_controls = snd_ice1712_ews_add_controls,
+               .mpu401_1_name = "MIDI-Front DMX6fire",
+               .mpu401_2_name = "Wavetable DMX6fire",
+               .mpu401_2_info_flags = MPU401_INFO_OUTPUT,
        },
        { } /* terminator */
 };