X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fpci%2Fice1712%2Fice1712.c;h=8ba31cfb90450146d47dd663f060714245a89f14;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=194dc5431c380bb5508916da89398cfb95e7fbc9;hpb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;p=linux-2.6.git diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 194dc5431..8ba31cfb9 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -53,13 +53,16 @@ #include #include #include +#include #include #include +#include + #include #include #include -#include #include +#include #include @@ -82,31 +85,27 @@ MODULE_SUPPORTED_DEVICE("{" static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ static char *model[SNDRV_CARDS]; -static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ +static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transciever reset timeout value in msec */ -static int boot_devs; +static int dxr_enable[SNDRV_CARDS]; /* DXR enable for DMX6FIRE */ -module_param_array(index, int, boot_devs, 0444); +module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for ICE1712 soundcard."); -module_param_array(id, charp, boot_devs, 0444); +module_param_array(id, charp, NULL, 0444); MODULE_PARM_DESC(id, "ID string for ICE1712 soundcard."); -module_param_array(enable, bool, boot_devs, 0444); +module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable ICE1712 soundcard."); -module_param_array(omni, bool, boot_devs, 0444); +module_param_array(omni, bool, NULL, 0444); MODULE_PARM_DESC(omni, "Enable Midiman M-Audio Delta Omni I/O support."); -module_param_array(cs8427_timeout, int, boot_devs, 0444); +module_param_array(cs8427_timeout, int, NULL, 0444); MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec resolution."); -module_param_array(model, charp, boot_devs, 0444); +module_param_array(model, charp, NULL, 0444); MODULE_PARM_DESC(model, "Use the given board model."); +module_param_array(dxr_enable, int, NULL, 0444); +MODULE_PARM_DESC(dxr_enable, "Enable DXR support for Terratec DMX6FIRE."); -#ifndef PCI_VENDOR_ID_ICE -#define PCI_VENDOR_ID_ICE 0x1412 -#endif -#ifndef PCI_DEVICE_ID_ICE_1712 -#define PCI_DEVICE_ID_ICE_1712 0x1712 -#endif static struct pci_device_id snd_ice1712_ids[] = { { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICE1712 */ @@ -115,8 +114,8 @@ static struct pci_device_id snd_ice1712_ids[] = { MODULE_DEVICE_TABLE(pci, snd_ice1712_ids); -static int snd_ice1712_build_pro_mixer(ice1712_t *ice); -static int snd_ice1712_build_controls(ice1712_t *ice); +static int snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice); +static int snd_ice1712_build_controls(struct snd_ice1712 *ice); static int PRO_RATE_LOCKED; static int PRO_RATE_RESET = 1; @@ -127,33 +126,33 @@ static unsigned int PRO_RATE_DEFAULT = 44100; */ /* check whether the clock mode is spdif-in */ -static inline int is_spdif_master(ice1712_t *ice) +static inline int is_spdif_master(struct snd_ice1712 *ice) { return (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER) ? 1 : 0; } -static inline int is_pro_rate_locked(ice1712_t *ice) +static inline int is_pro_rate_locked(struct snd_ice1712 *ice) { return is_spdif_master(ice) || PRO_RATE_LOCKED; } -static inline void snd_ice1712_ds_write(ice1712_t * ice, u8 channel, u8 addr, u32 data) +static inline void snd_ice1712_ds_write(struct snd_ice1712 * ice, u8 channel, u8 addr, u32 data) { outb((channel << 4) | addr, ICEDS(ice, INDEX)); outl(data, ICEDS(ice, DATA)); } -static inline u32 snd_ice1712_ds_read(ice1712_t * ice, u8 channel, u8 addr) +static inline u32 snd_ice1712_ds_read(struct snd_ice1712 * ice, u8 channel, u8 addr) { outb((channel << 4) | addr, ICEDS(ice, INDEX)); return inl(ICEDS(ice, DATA)); } -static void snd_ice1712_ac97_write(ac97_t *ac97, +static void snd_ice1712_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) { - ice1712_t *ice = (ice1712_t *)ac97->private_data; + struct snd_ice1712 *ice = ac97->private_data; int tm; unsigned char old_cmd = 0; @@ -174,10 +173,10 @@ static void snd_ice1712_ac97_write(ac97_t *ac97, break; } -static unsigned short snd_ice1712_ac97_read(ac97_t *ac97, +static unsigned short snd_ice1712_ac97_read(struct snd_ac97 *ac97, unsigned short reg) { - ice1712_t *ice = (ice1712_t *)ac97->private_data; + struct snd_ice1712 *ice = ac97->private_data; int tm; unsigned char old_cmd = 0; @@ -203,11 +202,11 @@ static unsigned short snd_ice1712_ac97_read(ac97_t *ac97, * pro ac97 section */ -static void snd_ice1712_pro_ac97_write(ac97_t *ac97, +static void snd_ice1712_pro_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) { - ice1712_t *ice = (ice1712_t *)ac97->private_data; + struct snd_ice1712 *ice = ac97->private_data; int tm; unsigned char old_cmd = 0; @@ -229,10 +228,10 @@ static void snd_ice1712_pro_ac97_write(ac97_t *ac97, } -static unsigned short snd_ice1712_pro_ac97_read(ac97_t *ac97, +static unsigned short snd_ice1712_pro_ac97_read(struct snd_ac97 *ac97, unsigned short reg) { - ice1712_t *ice = (ice1712_t *)ac97->private_data; + struct snd_ice1712 *ice = ac97->private_data; int tm; unsigned char old_cmd = 0; @@ -257,7 +256,7 @@ static unsigned short snd_ice1712_pro_ac97_read(ac97_t *ac97, /* * consumer ac97 digital mix */ -static int snd_ice1712_digmix_route_ac97_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_ice1712_digmix_route_ac97_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -266,17 +265,17 @@ static int snd_ice1712_digmix_route_ac97_info(snd_kcontrol_t *kcontrol, snd_ctl_ return 0; } -static int snd_ice1712_digmix_route_ac97_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_ice1712_digmix_route_ac97_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); ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_ROUTECTRL)) & ICE1712_ROUTE_AC97 ? 1 : 0; return 0; } -static int snd_ice1712_digmix_route_ac97_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_ice1712_digmix_route_ac97_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 val, nval; spin_lock_irq(&ice->reg_lock); @@ -288,7 +287,7 @@ static int snd_ice1712_digmix_route_ac97_put(snd_kcontrol_t *kcontrol, snd_ctl_e return val != nval; } -static snd_kcontrol_new_t snd_ice1712_mixer_digmix_route_ac97 __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_mixer_digmix_route_ac97 __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Digital Mixer To AC97", .info = snd_ice1712_digmix_route_ac97_info, @@ -300,30 +299,29 @@ static snd_kcontrol_new_t snd_ice1712_mixer_digmix_route_ac97 __devinitdata = { /* * gpio operations */ -static void snd_ice1712_set_gpio_dir(ice1712_t *ice, unsigned int data) +static void snd_ice1712_set_gpio_dir(struct snd_ice1712 *ice, unsigned int data) { snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, data); inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ } -static void snd_ice1712_set_gpio_mask(ice1712_t *ice, unsigned int data) +static void snd_ice1712_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) { snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, data); inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ } -static unsigned int snd_ice1712_get_gpio_data(ice1712_t *ice) +static unsigned int snd_ice1712_get_gpio_data(struct snd_ice1712 *ice) { return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); } -static void snd_ice1712_set_gpio_data(ice1712_t *ice, unsigned int val) +static void snd_ice1712_set_gpio_data(struct snd_ice1712 *ice, unsigned int val) { snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, val); inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ } - /* * * CS8427 interface @@ -334,7 +332,7 @@ static void snd_ice1712_set_gpio_data(ice1712_t *ice, unsigned int val) * change the input clock selection * spdif_clock = 1 - IEC958 input, 0 - Envy24 */ -static int snd_ice1712_cs8427_set_input_clock(ice1712_t *ice, int spdif_clock) +static int snd_ice1712_cs8427_set_input_clock(struct snd_ice1712 *ice, int spdif_clock) { unsigned char reg[2] = { 0x80 | 4, 0 }; /* CS8427 auto increment | register number 4 + data */ unsigned char val, nval; @@ -369,17 +367,17 @@ static int snd_ice1712_cs8427_set_input_clock(ice1712_t *ice, int spdif_clock) /* * spdif callbacks */ -static void open_cs8427(ice1712_t *ice, snd_pcm_substream_t * substream) +static void open_cs8427(struct snd_ice1712 *ice, struct snd_pcm_substream *substream) { snd_cs8427_iec958_active(ice->cs8427, 1); } -static void close_cs8427(ice1712_t *ice, snd_pcm_substream_t * substream) +static void close_cs8427(struct snd_ice1712 *ice, struct snd_pcm_substream *substream) { snd_cs8427_iec958_active(ice->cs8427, 0); } -static void setup_cs8427(ice1712_t *ice, int rate) +static void setup_cs8427(struct snd_ice1712 *ice, int rate) { snd_cs8427_iec958_pcm(ice->cs8427, rate); } @@ -387,14 +385,14 @@ static void setup_cs8427(ice1712_t *ice, int rate) /* * create and initialize callbacks for cs8427 interface */ -int __devinit snd_ice1712_init_cs8427(ice1712_t *ice, int addr) +int __devinit snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr) { int err; if ((err = snd_cs8427_create(ice->i2c, addr, (ice->cs8427_timeout * HZ) / 1000, &ice->cs8427)) < 0) { - snd_printk("CS8427 initialization failed\n"); + snd_printk(KERN_ERR "CS8427 initialization failed\n"); return err; } ice->spdif.ops.open = open_cs8427; @@ -403,14 +401,28 @@ int __devinit snd_ice1712_init_cs8427(ice1712_t *ice, int addr) return 0; } +static void snd_ice1712_set_input_clock_source(struct snd_ice1712 *ice, int spdif_is_master) +{ + /* change CS8427 clock source too */ + if (ice->cs8427) + snd_ice1712_cs8427_set_input_clock(ice, spdif_is_master); + /* notify ak4524 chip as well */ + if (spdif_is_master) { + 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 */ -static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id) { - ice1712_t *ice = dev_id; + struct snd_ice1712 *ice = dev_id; unsigned char status; int handled = 0; @@ -421,7 +433,7 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id, struct pt_regs * handled = 1; if (status & ICE1712_IRQ_MPU1) { if (ice->rmidi[0]) - snd_mpu401_uart_interrupt(irq, ice->rmidi[0]->private_data, regs); + snd_mpu401_uart_interrupt(irq, ice->rmidi[0]->private_data); outb(ICE1712_IRQ_MPU1, ICEREG(ice, IRQSTAT)); status &= ~ICE1712_IRQ_MPU1; } @@ -429,7 +441,7 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id, struct pt_regs * outb(ICE1712_IRQ_TIMER, ICEREG(ice, IRQSTAT)); if (status & ICE1712_IRQ_MPU2) { if (ice->rmidi[1]) - snd_mpu401_uart_interrupt(irq, ice->rmidi[1]->private_data, regs); + snd_mpu401_uart_interrupt(irq, ice->rmidi[1]->private_data); outb(ICE1712_IRQ_MPU2, ICEREG(ice, IRQSTAT)); status &= ~ICE1712_IRQ_MPU2; } @@ -451,7 +463,7 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id, struct pt_regs * if (status & ICE1712_IRQ_PBKDS) { u32 idx; u16 pbkstatus; - snd_pcm_substream_t *substream; + struct snd_pcm_substream *substream; pbkstatus = inw(ICEDS(ice, INTSTAT)); //printk("pbkstatus = 0x%x\n", pbkstatus); for (idx = 0; idx < 6; idx++) { @@ -482,13 +494,13 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id, struct pt_regs * * PCM part - misc */ -static int snd_ice1712_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_ice1712_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); } -static int snd_ice1712_hw_free(snd_pcm_substream_t * substream) +static int snd_ice1712_hw_free(struct snd_pcm_substream *substream) { return snd_pcm_lib_free_pages(substream); } @@ -497,10 +509,10 @@ static int snd_ice1712_hw_free(snd_pcm_substream_t * substream) * PCM part - consumer I/O */ -static int snd_ice1712_playback_trigger(snd_pcm_substream_t * substream, +static int snd_ice1712_playback_trigger(struct snd_pcm_substream *substream, int cmd) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); int result = 0; u32 tmp; @@ -522,10 +534,10 @@ static int snd_ice1712_playback_trigger(snd_pcm_substream_t * substream, return result; } -static int snd_ice1712_playback_ds_trigger(snd_pcm_substream_t * substream, +static int snd_ice1712_playback_ds_trigger(struct snd_pcm_substream *substream, int cmd) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); int result = 0; u32 tmp; @@ -547,10 +559,10 @@ static int snd_ice1712_playback_ds_trigger(snd_pcm_substream_t * substream, return result; } -static int snd_ice1712_capture_trigger(snd_pcm_substream_t * substream, +static int snd_ice1712_capture_trigger(struct snd_pcm_substream *substream, int cmd) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); int result = 0; u8 tmp; @@ -568,10 +580,10 @@ static int snd_ice1712_capture_trigger(snd_pcm_substream_t * substream, return result; } -static int snd_ice1712_playback_prepare(snd_pcm_substream_t * substream) +static int snd_ice1712_playback_prepare(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; u32 period_size, buf_size, rate, tmp; period_size = (snd_pcm_lib_period_bytes(substream) >> 2) - 1; @@ -601,10 +613,10 @@ static int snd_ice1712_playback_prepare(snd_pcm_substream_t * substream) return 0; } -static int snd_ice1712_playback_ds_prepare(snd_pcm_substream_t * substream) +static int snd_ice1712_playback_ds_prepare(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; u32 period_size, buf_size, rate, tmp, chn; period_size = snd_pcm_lib_period_bytes(substream) - 1; @@ -636,10 +648,10 @@ static int snd_ice1712_playback_ds_prepare(snd_pcm_substream_t * substream) return 0; } -static int snd_ice1712_capture_prepare(snd_pcm_substream_t * substream) +static int snd_ice1712_capture_prepare(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; u32 period_size, buf_size; u8 tmp; @@ -661,10 +673,10 @@ static int snd_ice1712_capture_prepare(snd_pcm_substream_t * substream) return 0; } -static snd_pcm_uframes_t snd_ice1712_playback_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_ice1712_playback_pointer(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; size_t ptr; if (!(snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL) & 1)) @@ -675,9 +687,9 @@ static snd_pcm_uframes_t snd_ice1712_playback_pointer(snd_pcm_substream_t * subs return bytes_to_frames(substream->runtime, ptr); } -static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); u8 addr; size_t ptr; @@ -694,9 +706,9 @@ static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(snd_pcm_substream_t * s return bytes_to_frames(substream->runtime, ptr); } -static snd_pcm_uframes_t snd_ice1712_capture_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); size_t ptr; if (!(snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL) & 1)) @@ -707,7 +719,7 @@ static snd_pcm_uframes_t snd_ice1712_capture_pointer(snd_pcm_substream_t * subst return bytes_to_frames(substream->runtime, ptr); } -static snd_pcm_hardware_t snd_ice1712_playback = +static struct snd_pcm_hardware snd_ice1712_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -727,7 +739,7 @@ static snd_pcm_hardware_t snd_ice1712_playback = .fifo_size = 0, }; -static snd_pcm_hardware_t snd_ice1712_playback_ds = +static struct snd_pcm_hardware snd_ice1712_playback_ds = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -747,7 +759,7 @@ static snd_pcm_hardware_t snd_ice1712_playback_ds = .fifo_size = 0, }; -static snd_pcm_hardware_t snd_ice1712_capture = +static struct snd_pcm_hardware snd_ice1712_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -766,20 +778,20 @@ static snd_pcm_hardware_t snd_ice1712_capture = .fifo_size = 0, }; -static int snd_ice1712_playback_open(snd_pcm_substream_t * substream) +static int snd_ice1712_playback_open(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); ice->playback_con_substream = substream; runtime->hw = snd_ice1712_playback; return 0; } -static int snd_ice1712_playback_ds_open(snd_pcm_substream_t * substream) +static int snd_ice1712_playback_ds_open(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); u32 tmp; ice->playback_con_substream_ds[substream->number] = substream; @@ -791,10 +803,10 @@ static int snd_ice1712_playback_ds_open(snd_pcm_substream_t * substream) return 0; } -static int snd_ice1712_capture_open(snd_pcm_substream_t * substream) +static int snd_ice1712_capture_open(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); ice->capture_con_substream = substream; runtime->hw = snd_ice1712_capture; @@ -804,17 +816,17 @@ static int snd_ice1712_capture_open(snd_pcm_substream_t * substream) return 0; } -static int snd_ice1712_playback_close(snd_pcm_substream_t * substream) +static int snd_ice1712_playback_close(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); ice->playback_con_substream = NULL; return 0; } -static int snd_ice1712_playback_ds_close(snd_pcm_substream_t * substream) +static int snd_ice1712_playback_ds_close(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); u32 tmp; spin_lock_irq(&ice->reg_lock); @@ -825,15 +837,15 @@ static int snd_ice1712_playback_ds_close(snd_pcm_substream_t * substream) return 0; } -static int snd_ice1712_capture_close(snd_pcm_substream_t * substream) +static int snd_ice1712_capture_close(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); ice->capture_con_substream = NULL; return 0; } -static snd_pcm_ops_t snd_ice1712_playback_ops = { +static struct snd_pcm_ops snd_ice1712_playback_ops = { .open = snd_ice1712_playback_open, .close = snd_ice1712_playback_close, .ioctl = snd_pcm_lib_ioctl, @@ -844,7 +856,7 @@ static snd_pcm_ops_t snd_ice1712_playback_ops = { .pointer = snd_ice1712_playback_pointer, }; -static snd_pcm_ops_t snd_ice1712_playback_ds_ops = { +static struct snd_pcm_ops snd_ice1712_playback_ds_ops = { .open = snd_ice1712_playback_ds_open, .close = snd_ice1712_playback_ds_close, .ioctl = snd_pcm_lib_ioctl, @@ -855,7 +867,7 @@ static snd_pcm_ops_t snd_ice1712_playback_ds_ops = { .pointer = snd_ice1712_playback_ds_pointer, }; -static snd_pcm_ops_t snd_ice1712_capture_ops = { +static struct snd_pcm_ops snd_ice1712_capture_ops = { .open = snd_ice1712_capture_open, .close = snd_ice1712_capture_close, .ioctl = snd_pcm_lib_ioctl, @@ -866,16 +878,9 @@ static snd_pcm_ops_t snd_ice1712_capture_ops = { .pointer = snd_ice1712_capture_pointer, }; -static void snd_ice1712_pcm_free(snd_pcm_t *pcm) +static int __devinit snd_ice1712_pcm(struct snd_ice1712 * ice, int device, struct snd_pcm ** rpcm) { - ice1712_t *ice = pcm->private_data; - ice->pcm = NULL; - snd_pcm_lib_preallocate_free_for_all(pcm); -} - -static int __devinit snd_ice1712_pcm(ice1712_t * ice, int device, snd_pcm_t ** rpcm) -{ - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; if (rpcm) @@ -888,7 +893,6 @@ static int __devinit snd_ice1712_pcm(ice1712_t * ice, int device, snd_pcm_t ** r snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ice1712_capture_ops); pcm->private_data = ice; - pcm->private_free = snd_ice1712_pcm_free; pcm->info_flags = 0; strcpy(pcm->name, "ICE1712 consumer"); ice->pcm = pcm; @@ -904,16 +908,9 @@ static int __devinit snd_ice1712_pcm(ice1712_t * ice, int device, snd_pcm_t ** r return 0; } -static void snd_ice1712_pcm_free_ds(snd_pcm_t *pcm) -{ - ice1712_t *ice = pcm->private_data; - ice->pcm_ds = NULL; - snd_pcm_lib_preallocate_free_for_all(pcm); -} - -static int __devinit snd_ice1712_pcm_ds(ice1712_t * ice, int device, snd_pcm_t ** rpcm) +static int __devinit snd_ice1712_pcm_ds(struct snd_ice1712 * ice, int device, struct snd_pcm ** rpcm) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; if (rpcm) @@ -925,7 +922,6 @@ static int __devinit snd_ice1712_pcm_ds(ice1712_t * ice, int device, snd_pcm_t * snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ice1712_playback_ds_ops); pcm->private_data = ice; - pcm->private_free = snd_ice1712_pcm_free_ds; pcm->info_flags = 0; strcpy(pcm->name, "ICE1712 consumer (DS)"); ice->pcm_ds = pcm; @@ -946,16 +942,16 @@ static int __devinit snd_ice1712_pcm_ds(ice1712_t * ice, int device, snd_pcm_t * static unsigned int rates[] = { 8000, 9600, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }; -static snd_pcm_hw_constraint_list_t hw_constraints_rates = { +static struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0, }; -static int snd_ice1712_pro_trigger(snd_pcm_substream_t *substream, +static int snd_ice1712_pro_trigger(struct snd_pcm_substream *substream, int cmd) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); switch (cmd) { case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: @@ -982,7 +978,7 @@ static int snd_ice1712_pro_trigger(snd_pcm_substream_t *substream, unsigned int what = 0; unsigned int old; struct list_head *pos; - snd_pcm_substream_t *s; + struct snd_pcm_substream *s; snd_pcm_group_for_each(pos, substream) { s = snd_pcm_group_substream_entry(pos); @@ -1012,24 +1008,12 @@ static int snd_ice1712_pro_trigger(snd_pcm_substream_t *substream, /* */ -static void snd_ice1712_set_pro_rate(ice1712_t *ice, unsigned int rate, int force) +static void snd_ice1712_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, int force) { unsigned long flags; - unsigned char val; + unsigned char val, old; unsigned int i; - spin_lock_irqsave(&ice->reg_lock, flags); - if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW| - ICE1712_PLAYBACK_PAUSE| - ICE1712_PLAYBACK_START)) { - spin_unlock_irqrestore(&ice->reg_lock, flags); - return; - } - if (!force && is_pro_rate_locked(ice)) { - spin_unlock_irqrestore(&ice->reg_lock, flags); - return; - } - switch (rate) { case 8000: val = 6; break; case 9600: val = 3; break; @@ -1050,8 +1034,22 @@ static void snd_ice1712_set_pro_rate(ice1712_t *ice, unsigned int rate, int forc rate = 48000; break; } - outb(val, ICEMT(ice, RATE)); + spin_lock_irqsave(&ice->reg_lock, flags); + if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW| + ICE1712_PLAYBACK_PAUSE| + ICE1712_PLAYBACK_START)) { + __out: + spin_unlock_irqrestore(&ice->reg_lock, flags); + return; + } + if (!force && is_pro_rate_locked(ice)) + goto __out; + + old = inb(ICEMT(ice, RATE)); + if (!force && old == val) + goto __out; + outb(val, ICEMT(ice, RATE)); spin_unlock_irqrestore(&ice->reg_lock, flags); if (ice->gpio.set_pro_rate) @@ -1064,9 +1062,9 @@ static void snd_ice1712_set_pro_rate(ice1712_t *ice, unsigned int rate, int forc ice->spdif.ops.setup_rate(ice, rate); } -static int snd_ice1712_playback_pro_prepare(snd_pcm_substream_t * substream) +static int snd_ice1712_playback_pro_prepare(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); ice->playback_pro_size = snd_pcm_lib_buffer_bytes(substream); spin_lock_irq(&ice->reg_lock); @@ -1078,18 +1076,18 @@ static int snd_ice1712_playback_pro_prepare(snd_pcm_substream_t * substream) return 0; } -static int snd_ice1712_playback_pro_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_ice1712_playback_pro_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); snd_ice1712_set_pro_rate(ice, params_rate(hw_params), 0); return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); } -static int snd_ice1712_capture_pro_prepare(snd_pcm_substream_t * substream) +static int snd_ice1712_capture_pro_prepare(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); ice->capture_pro_size = snd_pcm_lib_buffer_bytes(substream); spin_lock_irq(&ice->reg_lock); @@ -1100,18 +1098,18 @@ static int snd_ice1712_capture_pro_prepare(snd_pcm_substream_t * substream) return 0; } -static int snd_ice1712_capture_pro_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_ice1712_capture_pro_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); snd_ice1712_set_pro_rate(ice, params_rate(hw_params), 0); return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); } -static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); size_t ptr; if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_PLAYBACK_START)) @@ -1122,9 +1120,9 @@ static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(snd_pcm_substream_t * return bytes_to_frames(substream->runtime, ptr); } -static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); size_t ptr; if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_CAPTURE_START_SHADOW)) @@ -1135,7 +1133,7 @@ static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(snd_pcm_substream_t * s return bytes_to_frames(substream->runtime, ptr); } -static snd_pcm_hardware_t snd_ice1712_playback_pro = +static struct snd_pcm_hardware snd_ice1712_playback_pro = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1155,7 +1153,7 @@ static snd_pcm_hardware_t snd_ice1712_playback_pro = .fifo_size = 0, }; -static snd_pcm_hardware_t snd_ice1712_capture_pro = +static struct snd_pcm_hardware snd_ice1712_capture_pro = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1175,10 +1173,10 @@ static snd_pcm_hardware_t snd_ice1712_capture_pro = .fifo_size = 0, }; -static int snd_ice1712_playback_pro_open(snd_pcm_substream_t * substream) +static int snd_ice1712_playback_pro_open(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); ice->playback_pro_substream = substream; runtime->hw = snd_ice1712_playback_pro; @@ -1192,10 +1190,10 @@ static int snd_ice1712_playback_pro_open(snd_pcm_substream_t * substream) return 0; } -static int snd_ice1712_capture_pro_open(snd_pcm_substream_t * substream) +static int snd_ice1712_capture_pro_open(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; ice->capture_pro_substream = substream; runtime->hw = snd_ice1712_capture_pro; @@ -1205,9 +1203,9 @@ static int snd_ice1712_capture_pro_open(snd_pcm_substream_t * substream) return 0; } -static int snd_ice1712_playback_pro_close(snd_pcm_substream_t * substream) +static int snd_ice1712_playback_pro_close(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); if (PRO_RATE_RESET) snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); @@ -1218,9 +1216,9 @@ static int snd_ice1712_playback_pro_close(snd_pcm_substream_t * substream) return 0; } -static int snd_ice1712_capture_pro_close(snd_pcm_substream_t * substream) +static int snd_ice1712_capture_pro_close(struct snd_pcm_substream *substream) { - ice1712_t *ice = snd_pcm_substream_chip(substream); + struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); if (PRO_RATE_RESET) snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); @@ -1228,14 +1226,7 @@ static int snd_ice1712_capture_pro_close(snd_pcm_substream_t * substream) return 0; } -static void snd_ice1712_pcm_profi_free(snd_pcm_t *pcm) -{ - ice1712_t *ice = pcm->private_data; - ice->pcm_pro = NULL; - snd_pcm_lib_preallocate_free_for_all(pcm); -} - -static snd_pcm_ops_t snd_ice1712_playback_pro_ops = { +static struct snd_pcm_ops snd_ice1712_playback_pro_ops = { .open = snd_ice1712_playback_pro_open, .close = snd_ice1712_playback_pro_close, .ioctl = snd_pcm_lib_ioctl, @@ -1246,7 +1237,7 @@ static snd_pcm_ops_t snd_ice1712_playback_pro_ops = { .pointer = snd_ice1712_playback_pro_pointer, }; -static snd_pcm_ops_t snd_ice1712_capture_pro_ops = { +static struct snd_pcm_ops snd_ice1712_capture_pro_ops = { .open = snd_ice1712_capture_pro_open, .close = snd_ice1712_capture_pro_close, .ioctl = snd_pcm_lib_ioctl, @@ -1257,9 +1248,9 @@ static snd_pcm_ops_t snd_ice1712_capture_pro_ops = { .pointer = snd_ice1712_capture_pro_pointer, }; -static int __devinit snd_ice1712_pcm_profi(ice1712_t * ice, int device, snd_pcm_t ** rpcm) +static int __devinit snd_ice1712_pcm_profi(struct snd_ice1712 * ice, int device, struct snd_pcm ** rpcm) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; if (rpcm) @@ -1272,7 +1263,6 @@ static int __devinit snd_ice1712_pcm_profi(ice1712_t * ice, int device, snd_pcm_ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ice1712_capture_pro_ops); pcm->private_data = ice; - pcm->private_free = snd_ice1712_pcm_profi_free; pcm->info_flags = 0; strcpy(pcm->name, "ICE1712 multi"); @@ -1301,7 +1291,7 @@ static int __devinit snd_ice1712_pcm_profi(ice1712_t * ice, int device, snd_pcm_ * Mixer section */ -static void snd_ice1712_update_volume(ice1712_t *ice, int index) +static void snd_ice1712_update_volume(struct snd_ice1712 *ice, int index) { unsigned int vol = ice->pro_volumes[index]; unsigned short val = 0; @@ -1312,7 +1302,7 @@ static void snd_ice1712_update_volume(ice1712_t *ice, int index) outw(val, ICEMT(ice, MONITOR_VOLUME)); } -static int snd_ice1712_pro_mixer_switch_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_pro_mixer_switch_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 2; @@ -1321,9 +1311,9 @@ static int snd_ice1712_pro_mixer_switch_info(snd_kcontrol_t *kcontrol, snd_ctl_e return 0; } -static int snd_ice1712_pro_mixer_switch_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_mixer_switch_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 index = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + kcontrol->private_value; spin_lock_irq(&ice->reg_lock); @@ -1333,9 +1323,9 @@ static int snd_ice1712_pro_mixer_switch_get(snd_kcontrol_t * kcontrol, snd_ctl_e return 0; } -static int snd_ice1712_pro_mixer_switch_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_mixer_switch_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 index = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + kcontrol->private_value; unsigned int nval, change; @@ -1350,7 +1340,7 @@ static int snd_ice1712_pro_mixer_switch_put(snd_kcontrol_t * kcontrol, snd_ctl_e return change; } -static int snd_ice1712_pro_mixer_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_pro_mixer_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -1359,9 +1349,9 @@ static int snd_ice1712_pro_mixer_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_e return 0; } -static int snd_ice1712_pro_mixer_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_mixer_volume_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 index = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + kcontrol->private_value; spin_lock_irq(&ice->reg_lock); @@ -1371,9 +1361,9 @@ static int snd_ice1712_pro_mixer_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_e return 0; } -static int snd_ice1712_pro_mixer_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_mixer_volume_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 index = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + kcontrol->private_value; unsigned int nval, change; @@ -1388,8 +1378,9 @@ static int snd_ice1712_pro_mixer_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_e return change; } +static DECLARE_TLV_DB_SCALE(db_scale_playback, -14400, 150, 0); -static snd_kcontrol_new_t snd_ice1712_multi_playback_ctrls[] __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_multi_playback_ctrls[] __devinitdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Multi Playback Switch", @@ -1401,16 +1392,19 @@ static snd_kcontrol_new_t snd_ice1712_multi_playback_ctrls[] __devinitdata = { }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | + SNDRV_CTL_ELEM_ACCESS_TLV_READ), .name = "Multi Playback Volume", .info = snd_ice1712_pro_mixer_volume_info, .get = snd_ice1712_pro_mixer_volume_get, .put = snd_ice1712_pro_mixer_volume_put, .private_value = 0, .count = 10, + .tlv = { .p = db_scale_playback } }, }; -static snd_kcontrol_new_t snd_ice1712_multi_capture_analog_switch __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_switch __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "H/W Multi Capture Switch", .info = snd_ice1712_pro_mixer_switch_info, @@ -1419,9 +1413,9 @@ static snd_kcontrol_new_t snd_ice1712_multi_capture_analog_switch __devinitdata .private_value = 10, }; -static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_switch __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_switch __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "IEC958 Multi Capture Switch", + .name = SNDRV_CTL_NAME_IEC958("Multi ",CAPTURE,SWITCH), .info = snd_ice1712_pro_mixer_switch_info, .get = snd_ice1712_pro_mixer_switch_get, .put = snd_ice1712_pro_mixer_switch_put, @@ -1429,18 +1423,21 @@ static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_switch __devinitdata = .count = 2, }; -static snd_kcontrol_new_t snd_ice1712_multi_capture_analog_volume __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_volume __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | + SNDRV_CTL_ELEM_ACCESS_TLV_READ), .name = "H/W Multi Capture Volume", .info = snd_ice1712_pro_mixer_volume_info, .get = snd_ice1712_pro_mixer_volume_get, .put = snd_ice1712_pro_mixer_volume_put, .private_value = 10, + .tlv = { .p = db_scale_playback } }; -static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_volume __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_volume __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "IEC958 Multi Capture Volume", + .name = SNDRV_CTL_NAME_IEC958("Multi ",CAPTURE,VOLUME), .info = snd_ice1712_pro_mixer_volume_info, .get = snd_ice1712_pro_mixer_volume_get, .put = snd_ice1712_pro_mixer_volume_put, @@ -1448,9 +1445,9 @@ static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_volume __devinitdata = .count = 2, }; -static int __devinit snd_ice1712_build_pro_mixer(ice1712_t *ice) +static int __devinit snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice) { - snd_card_t * card = ice->card; + struct snd_card *card = ice->card; unsigned int idx; int err; @@ -1462,7 +1459,7 @@ static int __devinit snd_ice1712_build_pro_mixer(ice1712_t *ice) } if (ice->num_total_adcs > 0) { - snd_kcontrol_new_t tmp = snd_ice1712_multi_capture_analog_switch; + struct snd_kcontrol_new tmp = snd_ice1712_multi_capture_analog_switch; tmp.count = ice->num_total_adcs; err = snd_ctl_add(card, snd_ctl_new1(&tmp, ice)); if (err < 0) @@ -1474,7 +1471,7 @@ static int __devinit snd_ice1712_build_pro_mixer(ice1712_t *ice) return err; if (ice->num_total_adcs > 0) { - snd_kcontrol_new_t tmp = snd_ice1712_multi_capture_analog_volume; + struct snd_kcontrol_new tmp = snd_ice1712_multi_capture_analog_volume; tmp.count = ice->num_total_adcs; err = snd_ctl_add(card, snd_ctl_new1(&tmp, ice)); if (err < 0) @@ -1501,22 +1498,22 @@ static int __devinit snd_ice1712_build_pro_mixer(ice1712_t *ice) return 0; } -static void snd_ice1712_mixer_free_ac97(ac97_t *ac97) +static void snd_ice1712_mixer_free_ac97(struct snd_ac97 *ac97) { - ice1712_t *ice = ac97->private_data; + struct snd_ice1712 *ice = ac97->private_data; ice->ac97 = NULL; } -static int __devinit snd_ice1712_ac97_mixer(ice1712_t * ice) +static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 * ice) { int err, bus_num = 0; - ac97_template_t ac97; - ac97_bus_t *pbus; - static ac97_bus_ops_t con_ops = { + struct snd_ac97_template ac97; + struct snd_ac97_bus *pbus; + static struct snd_ac97_bus_ops con_ops = { .write = snd_ice1712_ac97_write, .read = snd_ice1712_ac97_read, }; - static ac97_bus_ops_t pro_ops = { + static struct snd_ac97_bus_ops pro_ops = { .write = snd_ice1712_pro_ac97_write, .read = snd_ice1712_pro_ac97_read, }; @@ -1556,15 +1553,15 @@ static int __devinit snd_ice1712_ac97_mixer(ice1712_t * ice) * */ -static inline unsigned int eeprom_double(ice1712_t *ice, int idx) +static inline unsigned int eeprom_double(struct snd_ice1712 *ice, int idx) { return (unsigned int)ice->eeprom.data[idx] | ((unsigned int)ice->eeprom.data[idx + 1] << 8); } -static void snd_ice1712_proc_read(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_ice1712_proc_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - ice1712_t *ice = entry->private_data; + struct snd_ice1712 *ice = entry->private_data; unsigned int idx; snd_iprintf(buffer, "%s\n\n", ice->card->longname); @@ -1596,36 +1593,41 @@ static void snd_ice1712_proc_read(snd_info_entry_t *entry, 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)); } -static void __devinit snd_ice1712_proc_init(ice1712_t * ice) +static void __devinit snd_ice1712_proc_init(struct snd_ice1712 * ice) { - snd_info_entry_t *entry; + struct snd_info_entry *entry; if (! snd_card_proc_new(ice->card, "ice1712", &entry)) - snd_info_set_text_ops(entry, ice, 1024, snd_ice1712_proc_read); + snd_info_set_text_ops(entry, ice, snd_ice1712_proc_read); } /* * */ -static int snd_ice1712_eeprom_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_eeprom_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; - uinfo->count = sizeof(ice1712_eeprom_t); + uinfo->count = sizeof(struct snd_ice1712_eeprom); return 0; } -static int snd_ice1712_eeprom_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_eeprom_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); memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); return 0; } -static snd_kcontrol_new_t snd_ice1712_eeprom __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_eeprom __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_CARD, .name = "ICE1712 EEPROM", .access = SNDRV_CTL_ELEM_ACCESS_READ, @@ -1635,32 +1637,33 @@ static snd_kcontrol_new_t snd_ice1712_eeprom __devinitdata = { /* */ -static int snd_ice1712_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_spdif_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; uinfo->count = 1; return 0; } -static int snd_ice1712_spdif_default_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_spdif_default_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); if (ice->spdif.ops.default_get) ice->spdif.ops.default_get(ice, ucontrol); return 0; } -static int snd_ice1712_spdif_default_put(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_spdif_default_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); if (ice->spdif.ops.default_put) return ice->spdif.ops.default_put(ice, ucontrol); return 0; } -static snd_kcontrol_new_t snd_ice1712_spdif_default __devinitdata = +static struct snd_kcontrol_new snd_ice1712_spdif_default __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), @@ -1669,10 +1672,10 @@ static snd_kcontrol_new_t snd_ice1712_spdif_default __devinitdata = .put = snd_ice1712_spdif_default_put }; -static int snd_ice1712_spdif_maskc_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_spdif_maskc_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); if (ice->spdif.ops.default_get) { ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO | IEC958_AES0_PROFESSIONAL | @@ -1691,10 +1694,10 @@ static int snd_ice1712_spdif_maskc_get(snd_kcontrol_t * kcontrol, return 0; } -static int snd_ice1712_spdif_maskp_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_spdif_maskp_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); if (ice->spdif.ops.default_get) { ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO | IEC958_AES0_PROFESSIONAL | @@ -1711,45 +1714,46 @@ static int snd_ice1712_spdif_maskp_get(snd_kcontrol_t * kcontrol, return 0; } -static snd_kcontrol_new_t snd_ice1712_spdif_maskc __devinitdata = +static struct snd_kcontrol_new snd_ice1712_spdif_maskc __devinitdata = { .access = SNDRV_CTL_ELEM_ACCESS_READ, - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), .info = snd_ice1712_spdif_info, .get = snd_ice1712_spdif_maskc_get, }; -static snd_kcontrol_new_t snd_ice1712_spdif_maskp __devinitdata = +static struct snd_kcontrol_new snd_ice1712_spdif_maskp __devinitdata = { .access = SNDRV_CTL_ELEM_ACCESS_READ, - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), .info = snd_ice1712_spdif_info, .get = snd_ice1712_spdif_maskp_get, }; -static int snd_ice1712_spdif_stream_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_spdif_stream_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); if (ice->spdif.ops.stream_get) ice->spdif.ops.stream_get(ice, ucontrol); return 0; } -static int snd_ice1712_spdif_stream_put(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_spdif_stream_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); if (ice->spdif.ops.stream_put) return ice->spdif.ops.stream_put(ice, ucontrol); return 0; } -static snd_kcontrol_new_t snd_ice1712_spdif_stream __devinitdata = +static struct snd_kcontrol_new snd_ice1712_spdif_stream __devinitdata = { - .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, + .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | + SNDRV_CTL_ELEM_ACCESS_INACTIVE), .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PCM_STREAM), .info = snd_ice1712_spdif_info, @@ -1757,7 +1761,8 @@ static snd_kcontrol_new_t snd_ice1712_spdif_stream __devinitdata = .put = snd_ice1712_spdif_stream_put }; -int snd_ice1712_gpio_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +int snd_ice1712_gpio_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -1766,21 +1771,24 @@ int snd_ice1712_gpio_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) return 0; } -int snd_ice1712_gpio_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +int snd_ice1712_gpio_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; int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; snd_ice1712_save_gpio_status(ice); - ucontrol->value.integer.value[0] = (snd_ice1712_gpio_read(ice) & mask ? 1 : 0) ^ invert; + ucontrol->value.integer.value[0] = + (snd_ice1712_gpio_read(ice) & mask ? 1 : 0) ^ invert; snd_ice1712_restore_gpio_status(ice); return 0; } -int snd_ice1712_gpio_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +int snd_ice1712_gpio_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 invert = (kcontrol->private_value & (1<<24)) ? mask : 0; unsigned int val, nval; @@ -1800,7 +1808,8 @@ int snd_ice1712_gpio_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucont /* * rate */ -static int snd_ice1712_pro_internal_clock_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_pro_internal_clock_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { static char *texts[] = { "8000", /* 0: 6 */ @@ -1827,9 +1836,10 @@ static int snd_ice1712_pro_internal_clock_info(snd_kcontrol_t *kcontrol, snd_ctl return 0; } -static int snd_ice1712_pro_internal_clock_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_internal_clock_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); static unsigned char xlate[16] = { 9, 6, 3, 1, 7, 4, 0, 12, 8, 5, 2, 11, 255, 255, 255, 10 }; @@ -1850,11 +1860,12 @@ static int snd_ice1712_pro_internal_clock_get(snd_kcontrol_t * kcontrol, snd_ctl return 0; } -static int snd_ice1712_pro_internal_clock_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_internal_clock_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); static unsigned int xrate[13] = { - 8000, 9600, 11025, 12000, 1600, 22050, 24000, + 8000, 9600, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }; unsigned char oval; @@ -1873,25 +1884,14 @@ static int snd_ice1712_pro_internal_clock_put(snd_kcontrol_t * kcontrol, snd_ctl 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); - } - } - } + if ((oval & ICE1712_SPDIF_MASTER) != + (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) + snd_ice1712_set_input_clock_source(ice, is_spdif_master(ice)); return change; } -static snd_kcontrol_new_t snd_ice1712_pro_internal_clock __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_pro_internal_clock __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Multi Track Internal Clock", .info = snd_ice1712_pro_internal_clock_info, @@ -1899,7 +1899,8 @@ static snd_kcontrol_new_t snd_ice1712_pro_internal_clock __devinitdata = { .put = snd_ice1712_pro_internal_clock_put }; -static int snd_ice1712_pro_internal_clock_default_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_pro_internal_clock_default_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { static char *texts[] = { "8000", /* 0: 6 */ @@ -1926,11 +1927,12 @@ static int snd_ice1712_pro_internal_clock_default_info(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ice1712_pro_internal_clock_default_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_internal_clock_default_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { int val; static unsigned int xrate[13] = { - 8000, 9600, 11025, 12000, 1600, 22050, 24000, + 8000, 9600, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }; @@ -1943,10 +1945,11 @@ static int snd_ice1712_pro_internal_clock_default_get(snd_kcontrol_t * kcontrol, return 0; } -static int snd_ice1712_pro_internal_clock_default_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_internal_clock_default_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { static unsigned int xrate[13] = { - 8000, 9600, 11025, 12000, 1600, 22050, 24000, + 8000, 9600, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }; unsigned char oval; @@ -1959,7 +1962,7 @@ static int snd_ice1712_pro_internal_clock_default_put(snd_kcontrol_t * kcontrol, return change; } -static snd_kcontrol_new_t snd_ice1712_pro_internal_clock_default __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_pro_internal_clock_default __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Multi Track Internal Clock Default", .info = snd_ice1712_pro_internal_clock_default_info, @@ -1967,7 +1970,8 @@ static snd_kcontrol_new_t snd_ice1712_pro_internal_clock_default __devinitdata = .put = snd_ice1712_pro_internal_clock_default_put }; -static int snd_ice1712_pro_rate_locking_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_pro_rate_locking_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -1976,15 +1980,17 @@ static int snd_ice1712_pro_rate_locking_info(snd_kcontrol_t *kcontrol, snd_ctl_e return 0; } -static int snd_ice1712_pro_rate_locking_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_rate_locking_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { ucontrol->value.integer.value[0] = PRO_RATE_LOCKED; return 0; } -static int snd_ice1712_pro_rate_locking_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_rate_locking_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 change = 0, nval; nval = ucontrol->value.integer.value[0] ? 1 : 0; @@ -1995,7 +2001,7 @@ static int snd_ice1712_pro_rate_locking_put(snd_kcontrol_t * kcontrol, snd_ctl_e return change; } -static snd_kcontrol_new_t snd_ice1712_pro_rate_locking __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_pro_rate_locking __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Multi Track Rate Locking", .info = snd_ice1712_pro_rate_locking_info, @@ -2003,7 +2009,8 @@ static snd_kcontrol_new_t snd_ice1712_pro_rate_locking __devinitdata = { .put = snd_ice1712_pro_rate_locking_put }; -static int snd_ice1712_pro_rate_reset_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_pro_rate_reset_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -2012,15 +2019,17 @@ static int snd_ice1712_pro_rate_reset_info(snd_kcontrol_t *kcontrol, snd_ctl_ele return 0; } -static int snd_ice1712_pro_rate_reset_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_rate_reset_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { ucontrol->value.integer.value[0] = PRO_RATE_RESET; return 0; } -static int snd_ice1712_pro_rate_reset_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_rate_reset_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 change = 0, nval; nval = ucontrol->value.integer.value[0] ? 1 : 0; @@ -2031,7 +2040,7 @@ static int snd_ice1712_pro_rate_reset_put(snd_kcontrol_t * kcontrol, snd_ctl_ele return change; } -static snd_kcontrol_new_t snd_ice1712_pro_rate_reset __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_pro_rate_reset __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Multi Track Rate Reset", .info = snd_ice1712_pro_rate_reset_info, @@ -2042,7 +2051,8 @@ static snd_kcontrol_new_t snd_ice1712_pro_rate_reset __devinitdata = { /* * routing */ -static int snd_ice1712_pro_route_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_pro_route_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { static char *texts[] = { "PCM Out", /* 0 */ @@ -2054,16 +2064,18 @@ static int snd_ice1712_pro_route_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; - uinfo->value.enumerated.items = snd_ctl_get_ioffidx(kcontrol, &uinfo->id) < 2 ? 12 : 11; + uinfo->value.enumerated.items = + snd_ctl_get_ioffidx(kcontrol, &uinfo->id) < 2 ? 12 : 11; if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); return 0; } -static int snd_ice1712_pro_route_analog_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_ice1712_pro_route_analog_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 idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); unsigned int val, cval; @@ -2086,9 +2098,10 @@ static int snd_ice1712_pro_route_analog_get(snd_kcontrol_t * kcontrol, snd_ctl_e return 0; } -static int snd_ice1712_pro_route_analog_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_ice1712_pro_route_analog_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 change, shift; int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); unsigned int val, old_val, nval; @@ -2135,9 +2148,10 @@ static int snd_ice1712_pro_route_analog_put(snd_kcontrol_t * kcontrol, snd_ctl_e return change; } -static int snd_ice1712_pro_route_spdif_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_ice1712_pro_route_spdif_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 idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); unsigned int val, cval; val = inw(ICEMT(ice, ROUTE_SPDOUT)); @@ -2154,9 +2168,10 @@ static int snd_ice1712_pro_route_spdif_get(snd_kcontrol_t * kcontrol, snd_ctl_el return 0; } -static int snd_ice1712_pro_route_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_ice1712_pro_route_spdif_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 change, shift; int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); unsigned int val, old_val, nval; @@ -2192,7 +2207,7 @@ static int snd_ice1712_pro_route_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_el return change; } -static snd_kcontrol_new_t snd_ice1712_mixer_pro_analog_route __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_mixer_pro_analog_route __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "H/W Playback Route", .info = snd_ice1712_pro_route_info, @@ -2200,9 +2215,9 @@ static snd_kcontrol_new_t snd_ice1712_mixer_pro_analog_route __devinitdata = { .put = snd_ice1712_pro_route_analog_put, }; -static snd_kcontrol_new_t snd_ice1712_mixer_pro_spdif_route __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_mixer_pro_spdif_route __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "IEC958 Playback Route", + .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route", .info = snd_ice1712_pro_route_info, .get = snd_ice1712_pro_route_spdif_get, .put = snd_ice1712_pro_route_spdif_put, @@ -2210,7 +2225,8 @@ static snd_kcontrol_new_t snd_ice1712_mixer_pro_spdif_route __devinitdata = { }; -static int snd_ice1712_pro_volume_rate_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_pro_volume_rate_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -2219,17 +2235,19 @@ static int snd_ice1712_pro_volume_rate_info(snd_kcontrol_t *kcontrol, snd_ctl_el return 0; } -static int snd_ice1712_pro_volume_rate_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_volume_rate_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); ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_RATE)); return 0; } -static int snd_ice1712_pro_volume_rate_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_volume_rate_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 change; spin_lock_irq(&ice->reg_lock); @@ -2239,7 +2257,7 @@ static int snd_ice1712_pro_volume_rate_put(snd_kcontrol_t * kcontrol, snd_ctl_el return change; } -static snd_kcontrol_new_t snd_ice1712_mixer_pro_volume_rate __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_mixer_pro_volume_rate __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Multi Track Volume Rate", .info = snd_ice1712_pro_volume_rate_info, @@ -2247,7 +2265,8 @@ static snd_kcontrol_new_t snd_ice1712_mixer_pro_volume_rate __devinitdata = { .put = snd_ice1712_pro_volume_rate_put }; -static int snd_ice1712_pro_peak_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ice1712_pro_peak_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 22; @@ -2256,9 +2275,10 @@ static int snd_ice1712_pro_peak_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info return 0; } -static int snd_ice1712_pro_peak_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ice1712_pro_peak_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 idx; spin_lock_irq(&ice->reg_lock); @@ -2270,7 +2290,7 @@ static int snd_ice1712_pro_peak_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu return 0; } -static snd_kcontrol_new_t snd_ice1712_mixer_pro_peak __devinitdata = { +static struct snd_kcontrol_new snd_ice1712_mixer_pro_peak __devinitdata = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Multi Track Peak", .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, @@ -2292,7 +2312,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = { NULL, }; -static unsigned char __devinit snd_ice1712_read_i2c(ice1712_t *ice, +static unsigned char __devinit snd_ice1712_read_i2c(struct snd_ice1712 *ice, unsigned char dev, unsigned char addr) { @@ -2304,48 +2324,72 @@ static unsigned char __devinit snd_ice1712_read_i2c(ice1712_t *ice, return inb(ICEREG(ice, I2C_DATA)); } -static int __devinit snd_ice1712_read_eeprom(ice1712_t *ice, const char *modelname) +static int __devinit snd_ice1712_read_eeprom(struct snd_ice1712 *ice, + const char *modelname) { int dev = 0xa0; /* EEPROM device address */ unsigned int i, size; + struct snd_ice1712_card_info **tbl, *c; - if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) == 0) { - snd_printk("ICE1712 has not detected EEPROM\n"); - return -EIO; - } - if (modelname && *modelname) { - struct snd_ice1712_card_info **tbl, *c; - for (tbl = card_tables; *tbl; tbl++) { - for (c = *tbl; c->subvendor; c++) { - if (c->model && !strcmp(modelname, c->model)) { - /* use the given subvendor */ - printk(KERN_INFO "ice1712: Using board model %s\n", c->name); - ice->eeprom.subvendor = c->subvendor; - break; - } + if (! modelname || ! *modelname) { + ice->eeprom.subvendor = 0; + if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) != 0) + ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) | + (snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | + (snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | + (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); + if (ice->eeprom.subvendor == 0 || + ice->eeprom.subvendor == (unsigned int)-1) { + /* invalid subvendor from EEPROM, try the PCI subststem ID instead */ + u16 vendor, device; + pci_read_config_word(ice->pci, PCI_SUBSYSTEM_VENDOR_ID, &vendor); + pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device); + ice->eeprom.subvendor = ((unsigned int)swab16(vendor) << 16) | swab16(device); + if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) { + printk(KERN_ERR "ice1712: No valid ID is found\n"); + return -ENXIO; } } - } else - ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) | - (snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | - (snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | - (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); + } + for (tbl = card_tables; *tbl; tbl++) { + for (c = *tbl; c->subvendor; c++) { + if (modelname && c->model && ! strcmp(modelname, c->model)) { + printk(KERN_INFO "ice1712: Using board model %s\n", c->name); + ice->eeprom.subvendor = c->subvendor; + } else if (c->subvendor != ice->eeprom.subvendor) + continue; + if (! c->eeprom_size || ! c->eeprom_data) + goto found; + /* if the EEPROM is given by the driver, use it */ + snd_printdd("using the defined eeprom..\n"); + ice->eeprom.version = 1; + ice->eeprom.size = c->eeprom_size + 6; + memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); + goto read_skipped; + } + } + printk(KERN_WARNING "ice1712: No matching model found for ID 0x%x\n", + ice->eeprom.subvendor); + + found: ice->eeprom.size = snd_ice1712_read_i2c(ice, dev, 0x04); if (ice->eeprom.size < 6) ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ else if (ice->eeprom.size > 32) { - snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size); + snd_printk(KERN_ERR "invalid EEPROM (size = %i)\n", ice->eeprom.size); return -EIO; } ice->eeprom.version = snd_ice1712_read_i2c(ice, dev, 0x05); if (ice->eeprom.version != 1) { - snd_printk("invalid EEPROM version %i\n", ice->eeprom.version); + snd_printk(KERN_ERR "invalid EEPROM version %i\n", + ice->eeprom.version); /* return -EIO; */ } size = ice->eeprom.size - 6; for (i = 0; i < size; i++) ice->eeprom.data[i] = snd_ice1712_read_i2c(ice, dev, i + 6); + read_skipped: ice->eeprom.gpiomask = ice->eeprom.data[ICE_EEP1_GPIO_MASK]; ice->eeprom.gpiostate = ice->eeprom.data[ICE_EEP1_GPIO_STATE]; ice->eeprom.gpiodir = ice->eeprom.data[ICE_EEP1_GPIO_DIR]; @@ -2355,12 +2399,19 @@ static int __devinit snd_ice1712_read_eeprom(ice1712_t *ice, const char *modelna -static int __devinit snd_ice1712_chip_init(ice1712_t *ice) +static int __devinit snd_ice1712_chip_init(struct snd_ice1712 *ice) { outb(ICE1712_RESET | ICE1712_NATIVE, ICEREG(ice, CONTROL)); udelay(200); outb(ICE1712_NATIVE, ICEREG(ice, CONTROL)); udelay(200); + if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE && + !ice->dxr_enable) + /* Set eeprom value to limit active ADCs and DACs to 6; + * Also disable AC97 as no hardware in standard 6fire card/box + * Note: DXR extensions are not currently supported + */ + ice->eeprom.data[ICE_EEP1_CODEC] = 0x3a; pci_write_config_byte(ice->pci, 0x60, ice->eeprom.data[ICE_EEP1_CODEC]); pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]); pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]); @@ -2368,15 +2419,19 @@ static int __devinit snd_ice1712_chip_init(ice1712_t *ice) if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24) { ice->gpio.write_mask = ice->eeprom.gpiomask; ice->gpio.direction = ice->eeprom.gpiodir; - snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ice->eeprom.gpiomask); - snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->eeprom.gpiodir); - snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, ice->eeprom.gpiostate); + snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, + ice->eeprom.gpiomask); + snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, + ice->eeprom.gpiodir); + snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, + ice->eeprom.gpiostate); } else { ice->gpio.write_mask = 0xc0; ice->gpio.direction = 0xff; snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, 0xc0); snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, 0xff); - snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, ICE1712_STDSP24_CLOCK_BIT); + snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, + ICE1712_STDSP24_CLOCK_BIT); } snd_ice1712_write(ice, ICE1712_IREG_PRO_POWERDOWN, 0); if (!(ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97)) { @@ -2386,14 +2441,15 @@ static int __devinit snd_ice1712_chip_init(ice1712_t *ice) udelay(200); snd_ice1712_write(ice, ICE1712_IREG_CONSUMER_POWERDOWN, 0); } + snd_ice1712_set_pro_rate(ice, 48000, 1); return 0; } -int __devinit snd_ice1712_spdif_build_controls(ice1712_t *ice) +int __devinit snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice) { int err; - snd_kcontrol_t *kctl; + struct snd_kcontrol *kctl; snd_assert(ice->pcm_pro != NULL, return -EIO); err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_default, ice)); @@ -2417,7 +2473,7 @@ int __devinit snd_ice1712_spdif_build_controls(ice1712_t *ice) } -static int __devinit snd_ice1712_build_controls(ice1712_t *ice) +static int __devinit snd_ice1712_build_controls(struct snd_ice1712 *ice) { int err; @@ -2439,7 +2495,7 @@ static int __devinit snd_ice1712_build_controls(ice1712_t *ice) return err; if (ice->num_total_dacs > 0) { - snd_kcontrol_new_t tmp = snd_ice1712_mixer_pro_analog_route; + struct snd_kcontrol_new tmp = snd_ice1712_mixer_pro_analog_route; tmp.count = ice->num_total_dacs; err = snd_ctl_add(ice->card, snd_ctl_new1(&tmp, ice)); if (err < 0) @@ -2460,7 +2516,7 @@ static int __devinit snd_ice1712_build_controls(ice1712_t *ice) return 0; } -static int snd_ice1712_free(ice1712_t *ice) +static int snd_ice1712_free(struct snd_ice1712 *ice) { if (! ice->port) goto __hw_end; @@ -2471,31 +2527,33 @@ static int snd_ice1712_free(ice1712_t *ice) __hw_end: if (ice->irq >= 0) { synchronize_irq(ice->irq); - free_irq(ice->irq, (void *) ice); + free_irq(ice->irq, ice); } if (ice->port) pci_release_regions(ice->pci); snd_ice1712_akm4xxx_free(ice); + pci_disable_device(ice->pci); kfree(ice); return 0; } -static int snd_ice1712_dev_free(snd_device_t *device) +static int snd_ice1712_dev_free(struct snd_device *device) { - ice1712_t *ice = device->device_data; + struct snd_ice1712 *ice = device->device_data; return snd_ice1712_free(ice); } -static int __devinit snd_ice1712_create(snd_card_t * card, +static int __devinit snd_ice1712_create(struct snd_card *card, struct pci_dev *pci, const char *modelname, int omni, int cs8427_timeout, - ice1712_t ** r_ice1712) + int dxr_enable, + struct snd_ice1712 ** r_ice1712) { - ice1712_t *ice; + struct snd_ice1712 *ice; int err; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_ice1712_dev_free, }; @@ -2505,24 +2563,29 @@ static int __devinit snd_ice1712_create(snd_card_t * card, if ((err = pci_enable_device(pci)) < 0) return err; /* check, if we can restrict PCI DMA transfers to 28 bits */ - if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || - pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { - snd_printk("architecture does not support 28bit PCI busmaster DMA\n"); + if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || + pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { + snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); + pci_disable_device(pci); return -ENXIO; } - ice = kcalloc(1, sizeof(*ice), GFP_KERNEL); - if (ice == NULL) + ice = kzalloc(sizeof(*ice), GFP_KERNEL); + if (ice == NULL) { + pci_disable_device(pci); return -ENOMEM; + } ice->omni = omni ? 1 : 0; if (cs8427_timeout < 1) cs8427_timeout = 1; else if (cs8427_timeout > 1000) cs8427_timeout = 1000; ice->cs8427_timeout = cs8427_timeout; + ice->dxr_enable = dxr_enable; spin_lock_init(&ice->reg_lock); - init_MUTEX(&ice->gpio_mutex); - init_MUTEX(&ice->open_mutex); + mutex_init(&ice->gpio_mutex); + mutex_init(&ice->i2c_mutex); + mutex_init(&ice->open_mutex); ice->gpio.set_mask = snd_ice1712_set_gpio_mask; ice->gpio.set_dir = snd_ice1712_set_gpio_dir; ice->gpio.set_data = snd_ice1712_set_gpio_data; @@ -2543,6 +2606,7 @@ static int __devinit snd_ice1712_create(snd_card_t * card, if ((err = pci_request_regions(pci, "ICE1712")) < 0) { kfree(ice); + pci_disable_device(pci); return err; } ice->port = pci_resource_start(pci, 0); @@ -2550,8 +2614,9 @@ static int __devinit snd_ice1712_create(snd_card_t * card, ice->dmapath_port = pci_resource_start(pci, 2); ice->profi_port = pci_resource_start(pci, 3); - if (request_irq(pci->irq, snd_ice1712_interrupt, SA_INTERRUPT|SA_SHIRQ, "ICE1712", (void *) ice)) { - snd_printk("unable to grab IRQ %d\n", pci->irq); + if (request_irq(pci->irq, snd_ice1712_interrupt, IRQF_SHARED, + "ICE1712", ice)) { + snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); snd_ice1712_free(ice); return -EIO; } @@ -2568,8 +2633,10 @@ static int __devinit snd_ice1712_create(snd_card_t * card, } /* unmask used interrupts */ - outb((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) == 0 ? ICE1712_IRQ_MPU2 : 0 | - (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97) ? ICE1712_IRQ_PBKDS | ICE1712_IRQ_CONCAP | ICE1712_IRQ_CONPBK : 0, + outb(((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) == 0 ? + ICE1712_IRQ_MPU2 : 0) | + ((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97) ? + ICE1712_IRQ_PBKDS | ICE1712_IRQ_CONCAP | ICE1712_IRQ_CONPBK : 0), ICEREG(ice, IRQMASK)); outb(0x00, ICEMT(ice, IRQ)); @@ -2597,8 +2664,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { static int dev; - snd_card_t *card; - ice1712_t *ice; + struct snd_card *card; + struct snd_ice1712 *ice; int pcm_dev = 0, err; struct snd_ice1712_card_info **tbl, *c; @@ -2616,7 +2683,9 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, strcpy(card->driver, "ICE1712"); strcpy(card->shortname, "ICEnsemble ICE1712"); - if ((err = snd_ice1712_create(card, pci, model[dev], omni[dev], cs8427_timeout[dev], &ice)) < 0) { + if ((err = snd_ice1712_create(card, pci, model[dev], omni[dev], + cs8427_timeout[dev], dxr_enable[dev], + &ice)) < 0) { snd_card_free(card); return err; } @@ -2676,23 +2745,42 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, if (! c->no_mpu401) { if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712, - ICEREG(ice, MPU1_CTRL), 1, + ICEREG(ice, MPU1_CTRL), + (c->mpu401_1_info_flags | + MPU401_INFO_INTEGRATED), ice->irq, 0, &ice->rmidi[0])) < 0) { snd_card_free(card); return err; } - - if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) + if (c->mpu401_1_name) + /* Prefered name available in card_info */ + snprintf(ice->rmidi[0]->name, + sizeof(ice->rmidi[0]->name), + "%s %d", c->mpu401_1_name, card->number); + + if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) { + /* 2nd port used */ if ((err = snd_mpu401_uart_new(card, 1, MPU401_HW_ICE1712, - ICEREG(ice, MPU2_CTRL), 1, + ICEREG(ice, MPU2_CTRL), + (c->mpu401_2_info_flags | + MPU401_INFO_INTEGRATED), ice->irq, 0, &ice->rmidi[1])) < 0) { snd_card_free(card); return err; } + if (c->mpu401_2_name) + /* Prefered name available in card_info */ + snprintf(ice->rmidi[1]->name, + sizeof(ice->rmidi[1]->name), + "%s %d", c->mpu401_2_name, + card->number); + } } + snd_ice1712_set_input_clock_source(ice, 0); + sprintf(card->longname, "%s at 0x%lx, irq %i", card->shortname, ice->port, ice->irq); @@ -2720,7 +2808,7 @@ static struct pci_driver driver = { static int __init alsa_card_ice1712_init(void) { - return pci_module_init(&driver); + return pci_register_driver(&driver); } static void __exit alsa_card_ice1712_exit(void)