Lines Matching full:ice
95 { PCI_VDEVICE(ICE, PCI_DEVICE_ID_ICE_1712), 0 }, /* ICE1712 */
101 static int snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice);
102 static int snd_ice1712_build_controls(struct snd_ice1712 *ice);
113 static inline int is_spdif_master(struct snd_ice1712 *ice) in is_spdif_master() argument
115 return (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER) ? 1 : 0; in is_spdif_master()
118 static inline int is_pro_rate_locked(struct snd_ice1712 *ice) in is_pro_rate_locked() argument
120 return is_spdif_master(ice) || PRO_RATE_LOCKED; in is_pro_rate_locked()
123 static inline void snd_ice1712_ds_write(struct snd_ice1712 *ice, u8 channel, u8 addr, u32 data) in snd_ice1712_ds_write() argument
125 outb((channel << 4) | addr, ICEDS(ice, INDEX)); in snd_ice1712_ds_write()
126 outl(data, ICEDS(ice, DATA)); in snd_ice1712_ds_write()
129 static inline u32 snd_ice1712_ds_read(struct snd_ice1712 *ice, u8 channel, u8 addr) in snd_ice1712_ds_read() argument
131 outb((channel << 4) | addr, ICEDS(ice, INDEX)); in snd_ice1712_ds_read()
132 return inl(ICEDS(ice, DATA)); in snd_ice1712_ds_read()
139 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_ac97_write() local
144 old_cmd = inb(ICEREG(ice, AC97_CMD)); in snd_ice1712_ac97_write()
151 outb(reg, ICEREG(ice, AC97_INDEX)); in snd_ice1712_ac97_write()
152 outw(val, ICEREG(ice, AC97_DATA)); in snd_ice1712_ac97_write()
154 outb(old_cmd | ICE1712_AC97_WRITE, ICEREG(ice, AC97_CMD)); in snd_ice1712_ac97_write()
156 if ((inb(ICEREG(ice, AC97_CMD)) & ICE1712_AC97_WRITE) == 0) in snd_ice1712_ac97_write()
163 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_ac97_read() local
168 old_cmd = inb(ICEREG(ice, AC97_CMD)); in snd_ice1712_ac97_read()
175 outb(reg, ICEREG(ice, AC97_INDEX)); in snd_ice1712_ac97_read()
176 outb(old_cmd | ICE1712_AC97_READ, ICEREG(ice, AC97_CMD)); in snd_ice1712_ac97_read()
178 if ((inb(ICEREG(ice, AC97_CMD)) & ICE1712_AC97_READ) == 0) in snd_ice1712_ac97_read()
182 return inw(ICEREG(ice, AC97_DATA)); in snd_ice1712_ac97_read()
193 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_pro_ac97_write() local
198 old_cmd = inb(ICEMT(ice, AC97_CMD)); in snd_ice1712_pro_ac97_write()
205 outb(reg, ICEMT(ice, AC97_INDEX)); in snd_ice1712_pro_ac97_write()
206 outw(val, ICEMT(ice, AC97_DATA)); in snd_ice1712_pro_ac97_write()
208 outb(old_cmd | ICE1712_AC97_WRITE, ICEMT(ice, AC97_CMD)); in snd_ice1712_pro_ac97_write()
210 if ((inb(ICEMT(ice, AC97_CMD)) & ICE1712_AC97_WRITE) == 0) in snd_ice1712_pro_ac97_write()
218 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_pro_ac97_read() local
223 old_cmd = inb(ICEMT(ice, AC97_CMD)); in snd_ice1712_pro_ac97_read()
230 outb(reg, ICEMT(ice, AC97_INDEX)); in snd_ice1712_pro_ac97_read()
231 outb(old_cmd | ICE1712_AC97_READ, ICEMT(ice, AC97_CMD)); in snd_ice1712_pro_ac97_read()
233 if ((inb(ICEMT(ice, AC97_CMD)) & ICE1712_AC97_READ) == 0) in snd_ice1712_pro_ac97_read()
237 return inw(ICEMT(ice, AC97_DATA)); in snd_ice1712_pro_ac97_read()
247 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_digmix_route_ac97_get() local
249 ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_ROUTECTRL)) & ICE1712_ROUTE_AC97 ? 1 : 0; in snd_ice1712_digmix_route_ac97_get()
255 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_digmix_route_ac97_put() local
258 spin_lock_irq(&ice->reg_lock); in snd_ice1712_digmix_route_ac97_put()
259 val = inb(ICEMT(ice, MONITOR_ROUTECTRL)); in snd_ice1712_digmix_route_ac97_put()
263 outb(nval, ICEMT(ice, MONITOR_ROUTECTRL)); in snd_ice1712_digmix_route_ac97_put()
264 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_digmix_route_ac97_put()
280 static void snd_ice1712_set_gpio_dir(struct snd_ice1712 *ice, unsigned int data) in snd_ice1712_set_gpio_dir() argument
282 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, data); in snd_ice1712_set_gpio_dir()
283 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ in snd_ice1712_set_gpio_dir()
286 static unsigned int snd_ice1712_get_gpio_dir(struct snd_ice1712 *ice) in snd_ice1712_get_gpio_dir() argument
288 return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION); in snd_ice1712_get_gpio_dir()
291 static unsigned int snd_ice1712_get_gpio_mask(struct snd_ice1712 *ice) in snd_ice1712_get_gpio_mask() argument
293 return snd_ice1712_read(ice, ICE1712_IREG_GPIO_WRITE_MASK); in snd_ice1712_get_gpio_mask()
296 static void snd_ice1712_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) in snd_ice1712_set_gpio_mask() argument
298 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, data); in snd_ice1712_set_gpio_mask()
299 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ in snd_ice1712_set_gpio_mask()
302 static unsigned int snd_ice1712_get_gpio_data(struct snd_ice1712 *ice) in snd_ice1712_get_gpio_data() argument
304 return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); in snd_ice1712_get_gpio_data()
307 static void snd_ice1712_set_gpio_data(struct snd_ice1712 *ice, unsigned int val) in snd_ice1712_set_gpio_data() argument
309 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, val); in snd_ice1712_set_gpio_data()
310 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ in snd_ice1712_set_gpio_data()
323 static int snd_ice1712_cs8427_set_input_clock(struct snd_ice1712 *ice, int spdif_clock) in snd_ice1712_cs8427_set_input_clock() argument
329 snd_i2c_lock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
330 if (snd_i2c_sendbytes(ice->cs8427, reg, 1) != 1) { in snd_ice1712_cs8427_set_input_clock()
331 snd_i2c_unlock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
334 if (snd_i2c_readbytes(ice->cs8427, &val, 1) != 1) { in snd_ice1712_cs8427_set_input_clock()
335 snd_i2c_unlock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
345 if (snd_i2c_sendbytes(ice->cs8427, reg, 2) != 2) { in snd_ice1712_cs8427_set_input_clock()
351 snd_i2c_unlock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
358 static void open_cs8427(struct snd_ice1712 *ice, struct snd_pcm_substream *substream) in open_cs8427() argument
360 snd_cs8427_iec958_active(ice->cs8427, 1); in open_cs8427()
363 static void close_cs8427(struct snd_ice1712 *ice, struct snd_pcm_substream *substream) in close_cs8427() argument
365 snd_cs8427_iec958_active(ice->cs8427, 0); in close_cs8427()
368 static void setup_cs8427(struct snd_ice1712 *ice, int rate) in setup_cs8427() argument
370 snd_cs8427_iec958_pcm(ice->cs8427, rate); in setup_cs8427()
376 int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr) in snd_ice1712_init_cs8427() argument
380 err = snd_cs8427_create(ice->i2c, addr, in snd_ice1712_init_cs8427()
381 (ice->cs8427_timeout * HZ) / 1000, &ice->cs8427); in snd_ice1712_init_cs8427()
383 dev_err(ice->card->dev, "CS8427 initialization failed\n"); in snd_ice1712_init_cs8427()
386 ice->spdif.ops.open = open_cs8427; in snd_ice1712_init_cs8427()
387 ice->spdif.ops.close = close_cs8427; in snd_ice1712_init_cs8427()
388 ice->spdif.ops.setup_rate = setup_cs8427; in snd_ice1712_init_cs8427()
392 static void snd_ice1712_set_input_clock_source(struct snd_ice1712 *ice, int spdif_is_master) in snd_ice1712_set_input_clock_source() argument
395 if (ice->cs8427) in snd_ice1712_set_input_clock_source()
396 snd_ice1712_cs8427_set_input_clock(ice, spdif_is_master); in snd_ice1712_set_input_clock_source()
400 for (i = 0; i < ice->akm_codecs; i++) { in snd_ice1712_set_input_clock_source()
401 if (ice->akm[i].ops.set_rate_val) in snd_ice1712_set_input_clock_source()
402 ice->akm[i].ops.set_rate_val(&ice->akm[i], 0); in snd_ice1712_set_input_clock_source()
413 struct snd_ice1712 *ice = dev_id; in snd_ice1712_interrupt() local
418 status = inb(ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
423 if (ice->rmidi[0]) in snd_ice1712_interrupt()
424 snd_mpu401_uart_interrupt(irq, ice->rmidi[0]->private_data); in snd_ice1712_interrupt()
425 outb(ICE1712_IRQ_MPU1, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
429 outb(ICE1712_IRQ_TIMER, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
431 if (ice->rmidi[1]) in snd_ice1712_interrupt()
432 snd_mpu401_uart_interrupt(irq, ice->rmidi[1]->private_data); in snd_ice1712_interrupt()
433 outb(ICE1712_IRQ_MPU2, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
437 unsigned char mtstat = inb(ICEMT(ice, IRQ)); in snd_ice1712_interrupt()
439 if (ice->playback_pro_substream) in snd_ice1712_interrupt()
440 snd_pcm_period_elapsed(ice->playback_pro_substream); in snd_ice1712_interrupt()
441 outb(ICE1712_MULTI_PBKSTATUS, ICEMT(ice, IRQ)); in snd_ice1712_interrupt()
444 if (ice->capture_pro_substream) in snd_ice1712_interrupt()
445 snd_pcm_period_elapsed(ice->capture_pro_substream); in snd_ice1712_interrupt()
446 outb(ICE1712_MULTI_CAPSTATUS, ICEMT(ice, IRQ)); in snd_ice1712_interrupt()
450 outb(ICE1712_IRQ_FM, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
455 pbkstatus = inw(ICEDS(ice, INTSTAT)); in snd_ice1712_interrupt()
456 /* dev_dbg(ice->card->dev, "pbkstatus = 0x%x\n", pbkstatus); */ in snd_ice1712_interrupt()
460 substream = ice->playback_con_substream_ds[idx]; in snd_ice1712_interrupt()
463 outw(3 << (idx * 2), ICEDS(ice, INTSTAT)); in snd_ice1712_interrupt()
465 outb(ICE1712_IRQ_PBKDS, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
468 if (ice->capture_con_substream) in snd_ice1712_interrupt()
469 snd_pcm_period_elapsed(ice->capture_con_substream); in snd_ice1712_interrupt()
470 outb(ICE1712_IRQ_CONCAP, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
473 if (ice->playback_con_substream) in snd_ice1712_interrupt()
474 snd_pcm_period_elapsed(ice->playback_con_substream); in snd_ice1712_interrupt()
475 outb(ICE1712_IRQ_CONPBK, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
489 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_trigger() local
493 spin_lock(&ice->reg_lock); in snd_ice1712_playback_trigger()
494 tmp = snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL); in snd_ice1712_playback_trigger()
506 snd_ice1712_write(ice, ICE1712_IREG_PBK_CTRL, tmp); in snd_ice1712_playback_trigger()
507 spin_unlock(&ice->reg_lock); in snd_ice1712_playback_trigger()
514 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_ds_trigger() local
518 spin_lock(&ice->reg_lock); in snd_ice1712_playback_ds_trigger()
519 tmp = snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL); in snd_ice1712_playback_ds_trigger()
531 snd_ice1712_ds_write(ice, substream->number * 2, ICE1712_DSC_CONTROL, tmp); in snd_ice1712_playback_ds_trigger()
532 spin_unlock(&ice->reg_lock); in snd_ice1712_playback_ds_trigger()
539 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_trigger() local
543 spin_lock(&ice->reg_lock); in snd_ice1712_capture_trigger()
544 tmp = snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL); in snd_ice1712_capture_trigger()
552 snd_ice1712_write(ice, ICE1712_IREG_CAP_CTRL, tmp); in snd_ice1712_capture_trigger()
553 spin_unlock(&ice->reg_lock); in snd_ice1712_capture_trigger()
559 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_prepare() local
573 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_prepare()
574 outb(0, ice->ddma_port + 15); in snd_ice1712_playback_prepare()
575 outb(ICE1712_DMA_MODE_WRITE | ICE1712_DMA_AUTOINIT, ice->ddma_port + 0x0b); in snd_ice1712_playback_prepare()
576 outl(runtime->dma_addr, ice->ddma_port + 0); in snd_ice1712_playback_prepare()
577 outw(buf_size, ice->ddma_port + 4); in snd_ice1712_playback_prepare()
578 snd_ice1712_write(ice, ICE1712_IREG_PBK_RATE_LO, rate & 0xff); in snd_ice1712_playback_prepare()
579 snd_ice1712_write(ice, ICE1712_IREG_PBK_RATE_MID, (rate >> 8) & 0xff); in snd_ice1712_playback_prepare()
580 snd_ice1712_write(ice, ICE1712_IREG_PBK_RATE_HI, (rate >> 16) & 0xff); in snd_ice1712_playback_prepare()
581 snd_ice1712_write(ice, ICE1712_IREG_PBK_CTRL, tmp); in snd_ice1712_playback_prepare()
582 snd_ice1712_write(ice, ICE1712_IREG_PBK_COUNT_LO, period_size & 0xff); in snd_ice1712_playback_prepare()
583 snd_ice1712_write(ice, ICE1712_IREG_PBK_COUNT_HI, period_size >> 8); in snd_ice1712_playback_prepare()
584 snd_ice1712_write(ice, ICE1712_IREG_PBK_LEFT, 0); in snd_ice1712_playback_prepare()
585 snd_ice1712_write(ice, ICE1712_IREG_PBK_RIGHT, 0); in snd_ice1712_playback_prepare()
586 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_prepare()
592 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_ds_prepare() local
605 ice->playback_con_active_buf[substream->number] = 0; in snd_ice1712_playback_ds_prepare()
606 ice->playback_con_virt_addr[substream->number] = runtime->dma_addr; in snd_ice1712_playback_ds_prepare()
608 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_prepare()
609 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_ADDR0, runtime->dma_addr); in snd_ice1712_playback_ds_prepare()
610 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_COUNT0, period_size); in snd_ice1712_playback_ds_prepare()
611 …snd_ice1712_ds_write(ice, chn, ICE1712_DSC_ADDR1, runtime->dma_addr + (runtime->periods > 1 ? peri… in snd_ice1712_playback_ds_prepare()
612 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_COUNT1, period_size); in snd_ice1712_playback_ds_prepare()
613 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_RATE, rate); in snd_ice1712_playback_ds_prepare()
614 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_VOLUME, 0); in snd_ice1712_playback_ds_prepare()
615 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_CONTROL, tmp); in snd_ice1712_playback_ds_prepare()
617 snd_ice1712_ds_write(ice, chn + 1, ICE1712_DSC_RATE, rate); in snd_ice1712_playback_ds_prepare()
618 snd_ice1712_ds_write(ice, chn + 1, ICE1712_DSC_VOLUME, 0); in snd_ice1712_playback_ds_prepare()
620 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_prepare()
626 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_prepare() local
638 spin_lock_irq(&ice->reg_lock); in snd_ice1712_capture_prepare()
639 outl(ice->capture_con_virt_addr = runtime->dma_addr, ICEREG(ice, CONCAP_ADDR)); in snd_ice1712_capture_prepare()
640 outw(buf_size, ICEREG(ice, CONCAP_COUNT)); in snd_ice1712_capture_prepare()
641 snd_ice1712_write(ice, ICE1712_IREG_CAP_COUNT_HI, period_size >> 8); in snd_ice1712_capture_prepare()
642 snd_ice1712_write(ice, ICE1712_IREG_CAP_COUNT_LO, period_size & 0xff); in snd_ice1712_capture_prepare()
643 snd_ice1712_write(ice, ICE1712_IREG_CAP_CTRL, tmp); in snd_ice1712_capture_prepare()
644 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_capture_prepare()
645 snd_ac97_set_rate(ice->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate); in snd_ice1712_capture_prepare()
651 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pointer() local
655 if (!(snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL) & 1)) in snd_ice1712_playback_pointer()
657 ptr = runtime->buffer_size - inw(ice->ddma_port + 4); in snd_ice1712_playback_pointer()
666 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_ds_pointer() local
670 if (!(snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL) & 1)) in snd_ice1712_playback_ds_pointer()
672 if (ice->playback_con_active_buf[substream->number]) in snd_ice1712_playback_ds_pointer()
676 ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) - in snd_ice1712_playback_ds_pointer()
677 ice->playback_con_virt_addr[substream->number]; in snd_ice1712_playback_ds_pointer()
686 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pointer() local
689 if (!(snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL) & 1)) in snd_ice1712_capture_pointer()
691 ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr; in snd_ice1712_capture_pointer()
757 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_open() local
759 ice->playback_con_substream = substream; in snd_ice1712_playback_open()
767 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_ds_open() local
770 ice->playback_con_substream_ds[substream->number] = substream; in snd_ice1712_playback_ds_open()
772 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_open()
773 tmp = inw(ICEDS(ice, INTMASK)) & ~(1 << (substream->number * 2)); in snd_ice1712_playback_ds_open()
774 outw(tmp, ICEDS(ice, INTMASK)); in snd_ice1712_playback_ds_open()
775 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_open()
782 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_open() local
784 ice->capture_con_substream = substream; in snd_ice1712_capture_open()
786 runtime->hw.rates = ice->ac97->rates[AC97_RATES_ADC]; in snd_ice1712_capture_open()
794 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_close() local
796 ice->playback_con_substream = NULL; in snd_ice1712_playback_close()
802 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_ds_close() local
805 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_close()
806 tmp = inw(ICEDS(ice, INTMASK)) | (3 << (substream->number * 2)); in snd_ice1712_playback_ds_close()
807 outw(tmp, ICEDS(ice, INTMASK)); in snd_ice1712_playback_ds_close()
808 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_close()
809 ice->playback_con_substream_ds[substream->number] = NULL; in snd_ice1712_playback_ds_close()
815 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_close() local
817 ice->capture_con_substream = NULL; in snd_ice1712_capture_close()
845 static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device) in snd_ice1712_pcm() argument
850 err = snd_pcm_new(ice->card, "ICE1712 consumer", device, 1, 1, &pcm); in snd_ice1712_pcm()
857 pcm->private_data = ice; in snd_ice1712_pcm()
860 ice->pcm = pcm; in snd_ice1712_pcm()
863 &ice->pci->dev, 64*1024, 64*1024); in snd_ice1712_pcm()
865 dev_warn(ice->card->dev, in snd_ice1712_pcm()
871 static int snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device) in snd_ice1712_pcm_ds() argument
876 err = snd_pcm_new(ice->card, "ICE1712 consumer (DS)", device, 6, 0, &pcm); in snd_ice1712_pcm_ds()
882 pcm->private_data = ice; in snd_ice1712_pcm_ds()
885 ice->pcm_ds = pcm; in snd_ice1712_pcm_ds()
888 &ice->pci->dev, 64*1024, 128*1024); in snd_ice1712_pcm_ds()
909 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_pro_trigger() local
920 spin_lock(&ice->reg_lock); in snd_ice1712_pro_trigger()
921 old = inl(ICEMT(ice, PLAYBACK_CONTROL)); in snd_ice1712_pro_trigger()
926 outl(old, ICEMT(ice, PLAYBACK_CONTROL)); in snd_ice1712_pro_trigger()
927 spin_unlock(&ice->reg_lock); in snd_ice1712_pro_trigger()
938 if (s == ice->playback_pro_substream) { in snd_ice1712_pro_trigger()
941 } else if (s == ice->capture_pro_substream) { in snd_ice1712_pro_trigger()
946 spin_lock(&ice->reg_lock); in snd_ice1712_pro_trigger()
947 old = inl(ICEMT(ice, PLAYBACK_CONTROL)); in snd_ice1712_pro_trigger()
952 outl(old, ICEMT(ice, PLAYBACK_CONTROL)); in snd_ice1712_pro_trigger()
953 spin_unlock(&ice->reg_lock); in snd_ice1712_pro_trigger()
964 static void snd_ice1712_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, int force) in snd_ice1712_set_pro_rate() argument
991 spin_lock_irqsave(&ice->reg_lock, flags); in snd_ice1712_set_pro_rate()
992 if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW| in snd_ice1712_set_pro_rate()
996 spin_unlock_irqrestore(&ice->reg_lock, flags); in snd_ice1712_set_pro_rate()
999 if (!force && is_pro_rate_locked(ice)) in snd_ice1712_set_pro_rate()
1002 old = inb(ICEMT(ice, RATE)); in snd_ice1712_set_pro_rate()
1006 ice->cur_rate = rate; in snd_ice1712_set_pro_rate()
1007 outb(val, ICEMT(ice, RATE)); in snd_ice1712_set_pro_rate()
1008 spin_unlock_irqrestore(&ice->reg_lock, flags); in snd_ice1712_set_pro_rate()
1010 if (ice->gpio.set_pro_rate) in snd_ice1712_set_pro_rate()
1011 ice->gpio.set_pro_rate(ice, rate); in snd_ice1712_set_pro_rate()
1012 for (i = 0; i < ice->akm_codecs; i++) { in snd_ice1712_set_pro_rate()
1013 if (ice->akm[i].ops.set_rate_val) in snd_ice1712_set_pro_rate()
1014 ice->akm[i].ops.set_rate_val(&ice->akm[i], rate); in snd_ice1712_set_pro_rate()
1016 if (ice->spdif.ops.setup_rate) in snd_ice1712_set_pro_rate()
1017 ice->spdif.ops.setup_rate(ice, rate); in snd_ice1712_set_pro_rate()
1022 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pro_prepare() local
1024 ice->playback_pro_size = snd_pcm_lib_buffer_bytes(substream); in snd_ice1712_playback_pro_prepare()
1025 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_pro_prepare()
1026 outl(substream->runtime->dma_addr, ICEMT(ice, PLAYBACK_ADDR)); in snd_ice1712_playback_pro_prepare()
1027 outw((ice->playback_pro_size >> 2) - 1, ICEMT(ice, PLAYBACK_SIZE)); in snd_ice1712_playback_pro_prepare()
1028 outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, PLAYBACK_COUNT)); in snd_ice1712_playback_pro_prepare()
1029 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_pro_prepare()
1037 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pro_hw_params() local
1039 snd_ice1712_set_pro_rate(ice, params_rate(hw_params), 0); in snd_ice1712_playback_pro_hw_params()
1045 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pro_prepare() local
1047 ice->capture_pro_size = snd_pcm_lib_buffer_bytes(substream); in snd_ice1712_capture_pro_prepare()
1048 spin_lock_irq(&ice->reg_lock); in snd_ice1712_capture_pro_prepare()
1049 outl(substream->runtime->dma_addr, ICEMT(ice, CAPTURE_ADDR)); in snd_ice1712_capture_pro_prepare()
1050 outw((ice->capture_pro_size >> 2) - 1, ICEMT(ice, CAPTURE_SIZE)); in snd_ice1712_capture_pro_prepare()
1051 outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, CAPTURE_COUNT)); in snd_ice1712_capture_pro_prepare()
1052 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_capture_pro_prepare()
1059 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pro_hw_params() local
1061 snd_ice1712_set_pro_rate(ice, params_rate(hw_params), 0); in snd_ice1712_capture_pro_hw_params()
1067 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pro_pointer() local
1070 if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_PLAYBACK_START)) in snd_ice1712_playback_pro_pointer()
1072 ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2); in snd_ice1712_playback_pro_pointer()
1081 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pro_pointer() local
1084 if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_CAPTURE_START_SHADOW)) in snd_ice1712_capture_pro_pointer()
1086 ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2); in snd_ice1712_capture_pro_pointer()
1134 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pro_open() local
1136 ice->playback_pro_substream = substream; in snd_ice1712_playback_pro_open()
1141 if (is_pro_rate_locked(ice)) { in snd_ice1712_playback_pro_open()
1146 if (ice->spdif.ops.open) in snd_ice1712_playback_pro_open()
1147 ice->spdif.ops.open(ice, substream); in snd_ice1712_playback_pro_open()
1154 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pro_open() local
1157 ice->capture_pro_substream = substream; in snd_ice1712_capture_pro_open()
1162 if (is_pro_rate_locked(ice)) { in snd_ice1712_capture_pro_open()
1172 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pro_close() local
1175 snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); in snd_ice1712_playback_pro_close()
1176 ice->playback_pro_substream = NULL; in snd_ice1712_playback_pro_close()
1177 if (ice->spdif.ops.close) in snd_ice1712_playback_pro_close()
1178 ice->spdif.ops.close(ice, substream); in snd_ice1712_playback_pro_close()
1185 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pro_close() local
1188 snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); in snd_ice1712_capture_pro_close()
1189 ice->capture_pro_substream = NULL; in snd_ice1712_capture_pro_close()
1211 static int snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device) in snd_ice1712_pcm_profi() argument
1216 err = snd_pcm_new(ice->card, "ICE1712 multi", device, 1, 1, &pcm); in snd_ice1712_pcm_profi()
1223 pcm->private_data = ice; in snd_ice1712_pcm_profi()
1228 &ice->pci->dev, 256*1024, 256*1024); in snd_ice1712_pcm_profi()
1230 ice->pcm_pro = pcm; in snd_ice1712_pcm_profi()
1232 if (ice->cs8427) { in snd_ice1712_pcm_profi()
1234 err = snd_cs8427_iec958_build(ice->cs8427, in snd_ice1712_pcm_profi()
1241 return snd_ice1712_build_pro_mixer(ice); in snd_ice1712_pcm_profi()
1248 static void snd_ice1712_update_volume(struct snd_ice1712 *ice, int index) in snd_ice1712_update_volume() argument
1250 unsigned int vol = ice->pro_volumes[index]; in snd_ice1712_update_volume()
1255 outb(index, ICEMT(ice, MONITOR_INDEX)); in snd_ice1712_update_volume()
1256 outw(val, ICEMT(ice, MONITOR_VOLUME)); in snd_ice1712_update_volume()
1263 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_mixer_switch_get() local
1267 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_get()
1269 !((ice->pro_volumes[priv_idx] >> 15) & 1); in snd_ice1712_pro_mixer_switch_get()
1271 !((ice->pro_volumes[priv_idx] >> 31) & 1); in snd_ice1712_pro_mixer_switch_get()
1272 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_get()
1278 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_mixer_switch_put() local
1285 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_put()
1286 nval |= ice->pro_volumes[priv_idx] & ~0x80008000; in snd_ice1712_pro_mixer_switch_put()
1287 change = nval != ice->pro_volumes[priv_idx]; in snd_ice1712_pro_mixer_switch_put()
1288 ice->pro_volumes[priv_idx] = nval; in snd_ice1712_pro_mixer_switch_put()
1289 snd_ice1712_update_volume(ice, priv_idx); in snd_ice1712_pro_mixer_switch_put()
1290 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_put()
1305 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_mixer_volume_get() local
1309 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_get()
1311 (ice->pro_volumes[priv_idx] >> 0) & 127; in snd_ice1712_pro_mixer_volume_get()
1313 (ice->pro_volumes[priv_idx] >> 16) & 127; in snd_ice1712_pro_mixer_volume_get()
1314 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_get()
1320 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_mixer_volume_put() local
1327 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_put()
1328 nval |= ice->pro_volumes[priv_idx] & ~0x007f007f; in snd_ice1712_pro_mixer_volume_put()
1329 change = nval != ice->pro_volumes[priv_idx]; in snd_ice1712_pro_mixer_volume_put()
1330 ice->pro_volumes[priv_idx] = nval; in snd_ice1712_pro_mixer_volume_put()
1331 snd_ice1712_update_volume(ice, priv_idx); in snd_ice1712_pro_mixer_volume_put()
1332 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_put()
1403 static int snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice) in snd_ice1712_build_pro_mixer() argument
1405 struct snd_card *card = ice->card; in snd_ice1712_build_pro_mixer()
1411 err = snd_ctl_add(card, snd_ctl_new1(&snd_ice1712_multi_playback_ctrls[idx], ice)); in snd_ice1712_build_pro_mixer()
1416 if (ice->num_total_adcs > 0) { in snd_ice1712_build_pro_mixer()
1418 tmp.count = ice->num_total_adcs; in snd_ice1712_build_pro_mixer()
1419 err = snd_ctl_add(card, snd_ctl_new1(&tmp, ice)); in snd_ice1712_build_pro_mixer()
1424 err = snd_ctl_add(card, snd_ctl_new1(&snd_ice1712_multi_capture_spdif_switch, ice)); in snd_ice1712_build_pro_mixer()
1428 if (ice->num_total_adcs > 0) { in snd_ice1712_build_pro_mixer()
1430 tmp.count = ice->num_total_adcs; in snd_ice1712_build_pro_mixer()
1431 err = snd_ctl_add(card, snd_ctl_new1(&tmp, ice)); in snd_ice1712_build_pro_mixer()
1436 err = snd_ctl_add(card, snd_ctl_new1(&snd_ice1712_multi_capture_spdif_volume, ice)); in snd_ice1712_build_pro_mixer()
1442 ice->pro_volumes[idx] = 0x80008000; /* mute */ in snd_ice1712_build_pro_mixer()
1443 snd_ice1712_update_volume(ice, idx); in snd_ice1712_build_pro_mixer()
1445 for (idx = 10; idx < 10 + ice->num_total_adcs; idx++) { in snd_ice1712_build_pro_mixer()
1446 ice->pro_volumes[idx] = 0x80008000; /* mute */ in snd_ice1712_build_pro_mixer()
1447 snd_ice1712_update_volume(ice, idx); in snd_ice1712_build_pro_mixer()
1450 ice->pro_volumes[idx] = 0x80008000; /* mute */ in snd_ice1712_build_pro_mixer()
1451 snd_ice1712_update_volume(ice, idx); in snd_ice1712_build_pro_mixer()
1458 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_mixer_free_ac97() local
1459 ice->ac97 = NULL; in snd_ice1712_mixer_free_ac97()
1462 static int snd_ice1712_ac97_mixer(struct snd_ice1712 *ice) in snd_ice1712_ac97_mixer() argument
1476 if (ice_has_con_ac97(ice)) { in snd_ice1712_ac97_mixer()
1477 err = snd_ac97_bus(ice->card, bus_num++, &con_ops, NULL, &pbus); in snd_ice1712_ac97_mixer()
1481 ac97.private_data = ice; in snd_ice1712_ac97_mixer()
1483 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); in snd_ice1712_ac97_mixer()
1485 dev_warn(ice->card->dev, in snd_ice1712_ac97_mixer()
1488 return snd_ctl_add(ice->card, in snd_ice1712_ac97_mixer()
1490 ice)); in snd_ice1712_ac97_mixer()
1494 if (!(ice->eeprom.data[ICE_EEP1_ACLINK] & ICE1712_CFG_PRO_I2S)) { in snd_ice1712_ac97_mixer()
1495 err = snd_ac97_bus(ice->card, bus_num, &pro_ops, NULL, &pbus); in snd_ice1712_ac97_mixer()
1499 ac97.private_data = ice; in snd_ice1712_ac97_mixer()
1501 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); in snd_ice1712_ac97_mixer()
1503 dev_warn(ice->card->dev, in snd_ice1712_ac97_mixer()
1509 strcat(ice->card->mixername, "ICE1712 - multitrack"); in snd_ice1712_ac97_mixer()
1517 static inline unsigned int eeprom_double(struct snd_ice1712 *ice, int idx) in eeprom_double() argument
1519 return (unsigned int)ice->eeprom.data[idx] | ((unsigned int)ice->eeprom.data[idx + 1] << 8); in eeprom_double()
1525 struct snd_ice1712 *ice = entry->private_data; in snd_ice1712_proc_read() local
1528 snd_iprintf(buffer, "%s\n\n", ice->card->longname); in snd_ice1712_proc_read()
1531 snd_iprintf(buffer, " Subvendor : 0x%x\n", ice->eeprom.subvendor); in snd_ice1712_proc_read()
1532 snd_iprintf(buffer, " Size : %i bytes\n", ice->eeprom.size); in snd_ice1712_proc_read()
1533 snd_iprintf(buffer, " Version : %i\n", ice->eeprom.version); in snd_ice1712_proc_read()
1534 snd_iprintf(buffer, " Codec : 0x%x\n", ice->eeprom.data[ICE_EEP1_CODEC]); in snd_ice1712_proc_read()
1535 snd_iprintf(buffer, " ACLink : 0x%x\n", ice->eeprom.data[ICE_EEP1_ACLINK]); in snd_ice1712_proc_read()
1536 snd_iprintf(buffer, " I2S ID : 0x%x\n", ice->eeprom.data[ICE_EEP1_I2SID]); in snd_ice1712_proc_read()
1537 snd_iprintf(buffer, " S/PDIF : 0x%x\n", ice->eeprom.data[ICE_EEP1_SPDIF]); in snd_ice1712_proc_read()
1538 snd_iprintf(buffer, " GPIO mask : 0x%x\n", ice->eeprom.gpiomask); in snd_ice1712_proc_read()
1539 snd_iprintf(buffer, " GPIO state : 0x%x\n", ice->eeprom.gpiostate); in snd_ice1712_proc_read()
1540 snd_iprintf(buffer, " GPIO direction : 0x%x\n", ice->eeprom.gpiodir); in snd_ice1712_proc_read()
1541 snd_iprintf(buffer, " AC'97 main : 0x%x\n", eeprom_double(ice, ICE_EEP1_AC97_MAIN_LO)); in snd_ice1712_proc_read()
1542 snd_iprintf(buffer, " AC'97 pcm : 0x%x\n", eeprom_double(ice, ICE_EEP1_AC97_PCM_LO)); in snd_ice1712_proc_read()
1543 snd_iprintf(buffer, " AC'97 record : 0x%x\n", eeprom_double(ice, ICE_EEP1_AC97_REC_LO)); in snd_ice1712_proc_read()
1544 snd_iprintf(buffer, " AC'97 record src : 0x%x\n", ice->eeprom.data[ICE_EEP1_AC97_RECSRC]); in snd_ice1712_proc_read()
1546 snd_iprintf(buffer, " DAC ID #%i : 0x%x\n", idx, ice->eeprom.data[ICE_EEP1_DAC_ID + idx]); in snd_ice1712_proc_read()
1548 snd_iprintf(buffer, " ADC ID #%i : 0x%x\n", idx, ice->eeprom.data[ICE_EEP1_ADC_ID + idx]); in snd_ice1712_proc_read()
1549 for (idx = 0x1c; idx < ice->eeprom.size; idx++) in snd_ice1712_proc_read()
1550 snd_iprintf(buffer, " Extra #%02i : 0x%x\n", idx, ice->eeprom.data[idx]); in snd_ice1712_proc_read()
1553 snd_iprintf(buffer, " PSDOUT03 : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_PSDOUT03))); in snd_ice1712_proc_read()
1554 snd_iprintf(buffer, " CAPTURE : 0x%08x\n", inl(ICEMT(ice, ROUTE_CAPTURE))); in snd_ice1712_proc_read()
1555 snd_iprintf(buffer, " SPDOUT : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_SPDOUT))); in snd_ice1712_proc_read()
1556 snd_iprintf(buffer, " RATE : 0x%02x\n", (unsigned)inb(ICEMT(ice, RATE))); in snd_ice1712_proc_read()
1557 snd_iprintf(buffer, " GPIO_DATA : 0x%02x\n", (unsigned)snd_ice1712_get_gpio_data(ice)); in snd_ice1712_proc_read()
1558 …snd_iprintf(buffer, " GPIO_WRITE_MASK : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_… in snd_ice1712_proc_read()
1559 …snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_… in snd_ice1712_proc_read()
1562 static void snd_ice1712_proc_init(struct snd_ice1712 *ice) in snd_ice1712_proc_init() argument
1564 snd_card_ro_proc_new(ice->card, "ice1712", ice, snd_ice1712_proc_read); in snd_ice1712_proc_init()
1582 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_eeprom_get() local
1584 memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); in snd_ice1712_eeprom_get()
1609 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_default_get() local
1610 if (ice->spdif.ops.default_get) in snd_ice1712_spdif_default_get()
1611 ice->spdif.ops.default_get(ice, ucontrol); in snd_ice1712_spdif_default_get()
1618 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_default_put() local
1619 if (ice->spdif.ops.default_put) in snd_ice1712_spdif_default_put()
1620 return ice->spdif.ops.default_put(ice, ucontrol); in snd_ice1712_spdif_default_put()
1636 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_maskc_get() local
1637 if (ice->spdif.ops.default_get) { in snd_ice1712_spdif_maskc_get()
1658 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_maskp_get() local
1659 if (ice->spdif.ops.default_get) { in snd_ice1712_spdif_maskp_get()
1696 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_stream_get() local
1697 if (ice->spdif.ops.stream_get) in snd_ice1712_spdif_stream_get()
1698 ice->spdif.ops.stream_get(ice, ucontrol); in snd_ice1712_spdif_stream_get()
1705 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_stream_put() local
1706 if (ice->spdif.ops.stream_put) in snd_ice1712_spdif_stream_put()
1707 return ice->spdif.ops.stream_put(ice, ucontrol); in snd_ice1712_spdif_stream_put()
1725 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_gpio_get() local
1729 snd_ice1712_save_gpio_status(ice); in snd_ice1712_gpio_get()
1731 (snd_ice1712_gpio_read(ice) & mask ? 1 : 0) ^ invert; in snd_ice1712_gpio_get()
1732 snd_ice1712_restore_gpio_status(ice); in snd_ice1712_gpio_get()
1739 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_gpio_put() local
1747 snd_ice1712_save_gpio_status(ice); in snd_ice1712_gpio_put()
1748 val = snd_ice1712_gpio_read(ice); in snd_ice1712_gpio_put()
1751 snd_ice1712_gpio_write(ice, nval); in snd_ice1712_gpio_put()
1752 snd_ice1712_restore_gpio_status(ice); in snd_ice1712_gpio_put()
1784 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_internal_clock_get() local
1790 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_get()
1791 if (is_spdif_master(ice)) { in snd_ice1712_pro_internal_clock_get()
1794 val = xlate[inb(ICEMT(ice, RATE)) & 15]; in snd_ice1712_pro_internal_clock_get()
1801 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_get()
1808 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_internal_clock_put() local
1816 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1817 oval = inb(ICEMT(ice, RATE)); in snd_ice1712_pro_internal_clock_put()
1819 outb(oval | ICE1712_SPDIF_MASTER, ICEMT(ice, RATE)); in snd_ice1712_pro_internal_clock_put()
1822 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1823 snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 1); in snd_ice1712_pro_internal_clock_put()
1824 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1826 change = inb(ICEMT(ice, RATE)) != oval; in snd_ice1712_pro_internal_clock_put()
1827 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1830 (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) in snd_ice1712_pro_internal_clock_put()
1831 snd_ice1712_set_input_clock_source(ice, is_spdif_master(ice)); in snd_ice1712_pro_internal_clock_put()
1921 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_rate_locking_put() local
1925 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_locking_put()
1928 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_locking_put()
1952 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_rate_reset_put() local
1956 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_reset_put()
1959 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_reset_put()
1991 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_route_analog_get() local
1995 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_get()
1996 val = inw(ICEMT(ice, ROUTE_PSDOUT03)); in snd_ice1712_pro_route_analog_get()
1997 cval = inl(ICEMT(ice, ROUTE_CAPTURE)); in snd_ice1712_pro_route_analog_get()
1998 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_get()
2017 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_route_analog_put() local
2032 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2033 val = old_val = inw(ICEMT(ice, ROUTE_PSDOUT03)); in snd_ice1712_pro_route_analog_put()
2038 outw(val, ICEMT(ice, ROUTE_PSDOUT03)); in snd_ice1712_pro_route_analog_put()
2039 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2044 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2045 val = old_val = inl(ICEMT(ice, ROUTE_CAPTURE)); in snd_ice1712_pro_route_analog_put()
2058 outl(val, ICEMT(ice, ROUTE_CAPTURE)); in snd_ice1712_pro_route_analog_put()
2060 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2067 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_route_spdif_get() local
2070 val = inw(ICEMT(ice, ROUTE_SPDOUT)); in snd_ice1712_pro_route_spdif_get()
2087 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_route_spdif_put() local
2093 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_spdif_put()
2094 val = old_val = inw(ICEMT(ice, ROUTE_SPDOUT)); in snd_ice1712_pro_route_spdif_put()
2118 outw(val, ICEMT(ice, ROUTE_SPDOUT)); in snd_ice1712_pro_route_spdif_put()
2119 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_spdif_put()
2154 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_volume_rate_get() local
2156 ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_RATE)); in snd_ice1712_pro_volume_rate_get()
2163 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_volume_rate_put() local
2166 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_volume_rate_put()
2167 change = inb(ICEMT(ice, MONITOR_RATE)) != ucontrol->value.integer.value[0]; in snd_ice1712_pro_volume_rate_put()
2168 outb(ucontrol->value.integer.value[0], ICEMT(ice, MONITOR_RATE)); in snd_ice1712_pro_volume_rate_put()
2169 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_volume_rate_put()
2194 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_peak_get() local
2197 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_peak_get()
2199 outb(idx, ICEMT(ice, MONITOR_PEAKINDEX)); in snd_ice1712_pro_peak_get()
2200 ucontrol->value.integer.value[idx] = inb(ICEMT(ice, MONITOR_PEAKDATA)); in snd_ice1712_pro_peak_get()
2202 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_peak_get()
2228 static unsigned char snd_ice1712_read_i2c(struct snd_ice1712 *ice, in snd_ice1712_read_i2c() argument
2234 outb(addr, ICEREG(ice, I2C_BYTE_ADDR)); in snd_ice1712_read_i2c()
2235 outb(dev & ~ICE1712_I2C_WRITE, ICEREG(ice, I2C_DEV_ADDR)); in snd_ice1712_read_i2c()
2236 while (t-- > 0 && (inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_BUSY)) ; in snd_ice1712_read_i2c()
2237 return inb(ICEREG(ice, I2C_DATA)); in snd_ice1712_read_i2c()
2240 static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice, in snd_ice1712_read_eeprom() argument
2248 ice->eeprom.subvendor = 0; in snd_ice1712_read_eeprom()
2249 if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) != 0) in snd_ice1712_read_eeprom()
2250 ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) | in snd_ice1712_read_eeprom()
2251 (snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | in snd_ice1712_read_eeprom()
2252 (snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | in snd_ice1712_read_eeprom()
2253 (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); in snd_ice1712_read_eeprom()
2254 if (ice->eeprom.subvendor == 0 || in snd_ice1712_read_eeprom()
2255 ice->eeprom.subvendor == (unsigned int)-1) { in snd_ice1712_read_eeprom()
2258 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_VENDOR_ID, &vendor); in snd_ice1712_read_eeprom()
2259 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device); in snd_ice1712_read_eeprom()
2260 ice->eeprom.subvendor = ((unsigned int)swab16(vendor) << 16) | swab16(device); in snd_ice1712_read_eeprom()
2261 if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) { in snd_ice1712_read_eeprom()
2262 dev_err(ice->card->dev, in snd_ice1712_read_eeprom()
2271 dev_info(ice->card->dev, in snd_ice1712_read_eeprom()
2273 ice->eeprom.subvendor = c->subvendor; in snd_ice1712_read_eeprom()
2274 } else if (c->subvendor != ice->eeprom.subvendor) in snd_ice1712_read_eeprom()
2279 dev_dbg(ice->card->dev, "using the defined eeprom..\n"); in snd_ice1712_read_eeprom()
2280 ice->eeprom.version = 1; in snd_ice1712_read_eeprom()
2281 ice->eeprom.size = c->eeprom_size + 6; in snd_ice1712_read_eeprom()
2282 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); in snd_ice1712_read_eeprom()
2286 dev_warn(ice->card->dev, "No matching model found for ID 0x%x\n", in snd_ice1712_read_eeprom()
2287 ice->eeprom.subvendor); in snd_ice1712_read_eeprom()
2290 ice->eeprom.size = snd_ice1712_read_i2c(ice, dev, 0x04); in snd_ice1712_read_eeprom()
2291 if (ice->eeprom.size < 6) in snd_ice1712_read_eeprom()
2292 ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ in snd_ice1712_read_eeprom()
2293 else if (ice->eeprom.size > 32) { in snd_ice1712_read_eeprom()
2294 dev_err(ice->card->dev, in snd_ice1712_read_eeprom()
2295 "invalid EEPROM (size = %i)\n", ice->eeprom.size); in snd_ice1712_read_eeprom()
2298 ice->eeprom.version = snd_ice1712_read_i2c(ice, dev, 0x05); in snd_ice1712_read_eeprom()
2299 if (ice->eeprom.version != 1) { in snd_ice1712_read_eeprom()
2300 dev_err(ice->card->dev, "invalid EEPROM version %i\n", in snd_ice1712_read_eeprom()
2301 ice->eeprom.version); in snd_ice1712_read_eeprom()
2304 size = ice->eeprom.size - 6; in snd_ice1712_read_eeprom()
2306 ice->eeprom.data[i] = snd_ice1712_read_i2c(ice, dev, i + 6); in snd_ice1712_read_eeprom()
2309 ice->eeprom.gpiomask = ice->eeprom.data[ICE_EEP1_GPIO_MASK]; in snd_ice1712_read_eeprom()
2310 ice->eeprom.gpiostate = ice->eeprom.data[ICE_EEP1_GPIO_STATE]; in snd_ice1712_read_eeprom()
2311 ice->eeprom.gpiodir = ice->eeprom.data[ICE_EEP1_GPIO_DIR]; in snd_ice1712_read_eeprom()
2318 static int snd_ice1712_chip_init(struct snd_ice1712 *ice) in snd_ice1712_chip_init() argument
2320 outb(ICE1712_RESET | ICE1712_NATIVE, ICEREG(ice, CONTROL)); in snd_ice1712_chip_init()
2322 outb(ICE1712_NATIVE, ICEREG(ice, CONTROL)); in snd_ice1712_chip_init()
2324 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE && in snd_ice1712_chip_init()
2325 !ice->dxr_enable) in snd_ice1712_chip_init()
2330 ice->eeprom.data[ICE_EEP1_CODEC] = 0x3a; in snd_ice1712_chip_init()
2331 pci_write_config_byte(ice->pci, 0x60, ice->eeprom.data[ICE_EEP1_CODEC]); in snd_ice1712_chip_init()
2332 pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]); in snd_ice1712_chip_init()
2333 pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]); in snd_ice1712_chip_init()
2334 pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]); in snd_ice1712_chip_init()
2335 if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24 && in snd_ice1712_chip_init()
2336 ice->eeprom.subvendor != ICE1712_SUBDEVICE_STAUDIO_ADCIII) { in snd_ice1712_chip_init()
2337 ice->gpio.write_mask = ice->eeprom.gpiomask; in snd_ice1712_chip_init()
2338 ice->gpio.direction = ice->eeprom.gpiodir; in snd_ice1712_chip_init()
2339 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, in snd_ice1712_chip_init()
2340 ice->eeprom.gpiomask); in snd_ice1712_chip_init()
2341 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, in snd_ice1712_chip_init()
2342 ice->eeprom.gpiodir); in snd_ice1712_chip_init()
2343 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, in snd_ice1712_chip_init()
2344 ice->eeprom.gpiostate); in snd_ice1712_chip_init()
2346 ice->gpio.write_mask = 0xc0; in snd_ice1712_chip_init()
2347 ice->gpio.direction = 0xff; in snd_ice1712_chip_init()
2348 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, 0xc0); in snd_ice1712_chip_init()
2349 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, 0xff); in snd_ice1712_chip_init()
2350 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, in snd_ice1712_chip_init()
2353 snd_ice1712_write(ice, ICE1712_IREG_PRO_POWERDOWN, 0); in snd_ice1712_chip_init()
2354 if (!(ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97)) { in snd_ice1712_chip_init()
2355 outb(ICE1712_AC97_WARM, ICEREG(ice, AC97_CMD)); in snd_ice1712_chip_init()
2357 outb(0, ICEREG(ice, AC97_CMD)); in snd_ice1712_chip_init()
2359 snd_ice1712_write(ice, ICE1712_IREG_CONSUMER_POWERDOWN, 0); in snd_ice1712_chip_init()
2361 snd_ice1712_set_pro_rate(ice, 48000, 1); in snd_ice1712_chip_init()
2363 outb(((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) == 0 ? in snd_ice1712_chip_init()
2365 ((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97) ? in snd_ice1712_chip_init()
2367 ICEREG(ice, IRQMASK)); in snd_ice1712_chip_init()
2368 outb(0x00, ICEMT(ice, IRQ)); in snd_ice1712_chip_init()
2373 int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice) in snd_ice1712_spdif_build_controls() argument
2378 if (snd_BUG_ON(!ice->pcm_pro)) in snd_ice1712_spdif_build_controls()
2380 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_default, ice)); in snd_ice1712_spdif_build_controls()
2383 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2384 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_maskc, ice)); in snd_ice1712_spdif_build_controls()
2387 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2388 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_maskp, ice)); in snd_ice1712_spdif_build_controls()
2391 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2392 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_stream, ice)); in snd_ice1712_spdif_build_controls()
2395 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2396 ice->spdif.stream_ctl = kctl; in snd_ice1712_spdif_build_controls()
2401 static int snd_ice1712_build_controls(struct snd_ice1712 *ice) in snd_ice1712_build_controls() argument
2405 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_eeprom, ice)); in snd_ice1712_build_controls()
2408 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_internal_clock, ice)); in snd_ice1712_build_controls()
2411 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_internal_clock_default, ice)); in snd_ice1712_build_controls()
2415 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_rate_locking, ice)); in snd_ice1712_build_controls()
2418 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_rate_reset, ice)); in snd_ice1712_build_controls()
2422 if (ice->num_total_dacs > 0) { in snd_ice1712_build_controls()
2424 tmp.count = ice->num_total_dacs; in snd_ice1712_build_controls()
2425 err = snd_ctl_add(ice->card, snd_ctl_new1(&tmp, ice)); in snd_ice1712_build_controls()
2430 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_pro_spdif_route, ice)); in snd_ice1712_build_controls()
2434 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_pro_volume_rate, ice)); in snd_ice1712_build_controls()
2437 return snd_ctl_add(ice->card, in snd_ice1712_build_controls()
2438 snd_ctl_new1(&snd_ice1712_mixer_pro_peak, ice)); in snd_ice1712_build_controls()
2441 static int snd_ice1712_free(struct snd_ice1712 *ice) in snd_ice1712_free() argument
2443 if (!ice->port) in snd_ice1712_free()
2446 outb(ICE1712_MULTI_CAPTURE | ICE1712_MULTI_PLAYBACK, ICEMT(ice, IRQ)); in snd_ice1712_free()
2447 outb(0xff, ICEREG(ice, IRQMASK)); in snd_ice1712_free()
2450 if (ice->irq >= 0) in snd_ice1712_free()
2451 free_irq(ice->irq, ice); in snd_ice1712_free()
2453 if (ice->port) in snd_ice1712_free()
2454 pci_release_regions(ice->pci); in snd_ice1712_free()
2455 snd_ice1712_akm4xxx_free(ice); in snd_ice1712_free()
2456 pci_disable_device(ice->pci); in snd_ice1712_free()
2457 kfree(ice->spec); in snd_ice1712_free()
2458 kfree(ice); in snd_ice1712_free()
2464 struct snd_ice1712 *ice = device->device_data; in snd_ice1712_dev_free() local
2465 return snd_ice1712_free(ice); in snd_ice1712_dev_free()
2476 struct snd_ice1712 *ice; in snd_ice1712_create() local
2497 ice = kzalloc(sizeof(*ice), GFP_KERNEL); in snd_ice1712_create()
2498 if (ice == NULL) { in snd_ice1712_create()
2502 ice->omni = omni ? 1 : 0; in snd_ice1712_create()
2507 ice->cs8427_timeout = cs8427_timeout; in snd_ice1712_create()
2508 ice->dxr_enable = dxr_enable; in snd_ice1712_create()
2509 spin_lock_init(&ice->reg_lock); in snd_ice1712_create()
2510 mutex_init(&ice->gpio_mutex); in snd_ice1712_create()
2511 mutex_init(&ice->i2c_mutex); in snd_ice1712_create()
2512 mutex_init(&ice->open_mutex); in snd_ice1712_create()
2513 ice->gpio.set_mask = snd_ice1712_set_gpio_mask; in snd_ice1712_create()
2514 ice->gpio.get_mask = snd_ice1712_get_gpio_mask; in snd_ice1712_create()
2515 ice->gpio.set_dir = snd_ice1712_set_gpio_dir; in snd_ice1712_create()
2516 ice->gpio.get_dir = snd_ice1712_get_gpio_dir; in snd_ice1712_create()
2517 ice->gpio.set_data = snd_ice1712_set_gpio_data; in snd_ice1712_create()
2518 ice->gpio.get_data = snd_ice1712_get_gpio_data; in snd_ice1712_create()
2520 ice->spdif.cs8403_bits = in snd_ice1712_create()
2521 ice->spdif.cs8403_stream_bits = (0x01 | /* consumer format */ in snd_ice1712_create()
2524 ice->card = card; in snd_ice1712_create()
2525 ice->pci = pci; in snd_ice1712_create()
2526 ice->irq = -1; in snd_ice1712_create()
2529 pci_write_config_word(ice->pci, 0x40, 0x807f); in snd_ice1712_create()
2530 pci_write_config_word(ice->pci, 0x42, 0x0006); in snd_ice1712_create()
2531 snd_ice1712_proc_init(ice); in snd_ice1712_create()
2533 card->private_data = ice; in snd_ice1712_create()
2537 kfree(ice); in snd_ice1712_create()
2541 ice->port = pci_resource_start(pci, 0); in snd_ice1712_create()
2542 ice->ddma_port = pci_resource_start(pci, 1); in snd_ice1712_create()
2543 ice->dmapath_port = pci_resource_start(pci, 2); in snd_ice1712_create()
2544 ice->profi_port = pci_resource_start(pci, 3); in snd_ice1712_create()
2547 KBUILD_MODNAME, ice)) { in snd_ice1712_create()
2549 snd_ice1712_free(ice); in snd_ice1712_create()
2553 ice->irq = pci->irq; in snd_ice1712_create()
2554 card->sync_irq = ice->irq; in snd_ice1712_create()
2556 if (snd_ice1712_read_eeprom(ice, modelname) < 0) { in snd_ice1712_create()
2557 snd_ice1712_free(ice); in snd_ice1712_create()
2560 if (snd_ice1712_chip_init(ice) < 0) { in snd_ice1712_create()
2561 snd_ice1712_free(ice); in snd_ice1712_create()
2565 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops); in snd_ice1712_create()
2567 snd_ice1712_free(ice); in snd_ice1712_create()
2571 *r_ice1712 = ice; in snd_ice1712_create()
2589 struct snd_ice1712 *ice; in snd_ice1712_probe() local
2609 cs8427_timeout[dev], dxr_enable[dev], &ice); in snd_ice1712_probe()
2617 if (c->subvendor == ice->eeprom.subvendor) { in snd_ice1712_probe()
2618 ice->card_info = c; in snd_ice1712_probe()
2623 err = c->chip_init(ice); in snd_ice1712_probe()
2636 err = snd_ice1712_pcm_profi(ice, pcm_dev++); in snd_ice1712_probe()
2642 if (ice_has_con_ac97(ice)) { in snd_ice1712_probe()
2643 err = snd_ice1712_pcm(ice, pcm_dev++); in snd_ice1712_probe()
2650 err = snd_ice1712_ac97_mixer(ice); in snd_ice1712_probe()
2656 err = snd_ice1712_build_controls(ice); in snd_ice1712_probe()
2663 err = c->build_controls(ice); in snd_ice1712_probe()
2670 if (ice_has_con_ac97(ice)) { in snd_ice1712_probe()
2671 err = snd_ice1712_pcm_ds(ice, pcm_dev++); in snd_ice1712_probe()
2680 ICEREG(ice, MPU1_CTRL), in snd_ice1712_probe()
2683 -1, &ice->rmidi[0]); in snd_ice1712_probe()
2690 snprintf(ice->rmidi[0]->name, in snd_ice1712_probe()
2691 sizeof(ice->rmidi[0]->name), in snd_ice1712_probe()
2694 if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) { in snd_ice1712_probe()
2697 ICEREG(ice, MPU2_CTRL), in snd_ice1712_probe()
2700 -1, &ice->rmidi[1]); in snd_ice1712_probe()
2708 snprintf(ice->rmidi[1]->name, in snd_ice1712_probe()
2709 sizeof(ice->rmidi[1]->name), in snd_ice1712_probe()
2715 snd_ice1712_set_input_clock_source(ice, 0); in snd_ice1712_probe()
2718 card->shortname, ice->port, ice->irq); in snd_ice1712_probe()
2733 struct snd_ice1712 *ice = card->private_data; in snd_ice1712_remove() local
2735 if (ice->card_info && ice->card_info->chip_exit) in snd_ice1712_remove()
2736 ice->card_info->chip_exit(ice); in snd_ice1712_remove()
2744 struct snd_ice1712 *ice = card->private_data; in snd_ice1712_suspend() local
2746 if (!ice->pm_suspend_enabled) in snd_ice1712_suspend()
2751 snd_ac97_suspend(ice->ac97); in snd_ice1712_suspend()
2753 spin_lock_irq(&ice->reg_lock); in snd_ice1712_suspend()
2754 ice->pm_saved_is_spdif_master = is_spdif_master(ice); in snd_ice1712_suspend()
2755 ice->pm_saved_spdif_ctrl = inw(ICEMT(ice, ROUTE_SPDOUT)); in snd_ice1712_suspend()
2756 ice->pm_saved_route = inw(ICEMT(ice, ROUTE_PSDOUT03)); in snd_ice1712_suspend()
2757 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_suspend()
2759 if (ice->pm_suspend) in snd_ice1712_suspend()
2760 ice->pm_suspend(ice); in snd_ice1712_suspend()
2767 struct snd_ice1712 *ice = card->private_data; in snd_ice1712_resume() local
2770 if (!ice->pm_suspend_enabled) in snd_ice1712_resume()
2773 if (ice->cur_rate) in snd_ice1712_resume()
2774 rate = ice->cur_rate; in snd_ice1712_resume()
2778 if (snd_ice1712_chip_init(ice) < 0) { in snd_ice1712_resume()
2783 ice->cur_rate = rate; in snd_ice1712_resume()
2785 if (ice->pm_resume) in snd_ice1712_resume()
2786 ice->pm_resume(ice); in snd_ice1712_resume()
2788 if (ice->pm_saved_is_spdif_master) { in snd_ice1712_resume()
2790 spin_lock_irq(&ice->reg_lock); in snd_ice1712_resume()
2791 outb(inb(ICEMT(ice, RATE)) | ICE1712_SPDIF_MASTER, in snd_ice1712_resume()
2792 ICEMT(ice, RATE)); in snd_ice1712_resume()
2793 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_resume()
2794 snd_ice1712_set_input_clock_source(ice, 1); in snd_ice1712_resume()
2797 snd_ice1712_set_pro_rate(ice, rate, 1); in snd_ice1712_resume()
2798 snd_ice1712_set_input_clock_source(ice, 0); in snd_ice1712_resume()
2801 outw(ice->pm_saved_spdif_ctrl, ICEMT(ice, ROUTE_SPDOUT)); in snd_ice1712_resume()
2802 outw(ice->pm_saved_route, ICEMT(ice, ROUTE_PSDOUT03)); in snd_ice1712_resume()
2804 snd_ac97_resume(ice->ac97); in snd_ice1712_resume()