• Home
  • Raw
  • Download

Lines Matching refs:ice

115 static int snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice);
116 static int snd_ice1712_build_controls(struct snd_ice1712 *ice);
127 static inline int is_spdif_master(struct snd_ice1712 *ice) in is_spdif_master() argument
129 return (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER) ? 1 : 0; in is_spdif_master()
132 static inline int is_pro_rate_locked(struct snd_ice1712 *ice) in is_pro_rate_locked() argument
134 return is_spdif_master(ice) || PRO_RATE_LOCKED; in is_pro_rate_locked()
137 static inline void snd_ice1712_ds_write(struct snd_ice1712 *ice, u8 channel, u8 addr, u32 data) in snd_ice1712_ds_write() argument
139 outb((channel << 4) | addr, ICEDS(ice, INDEX)); in snd_ice1712_ds_write()
140 outl(data, ICEDS(ice, DATA)); in snd_ice1712_ds_write()
143 static inline u32 snd_ice1712_ds_read(struct snd_ice1712 *ice, u8 channel, u8 addr) in snd_ice1712_ds_read() argument
145 outb((channel << 4) | addr, ICEDS(ice, INDEX)); in snd_ice1712_ds_read()
146 return inl(ICEDS(ice, DATA)); in snd_ice1712_ds_read()
153 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_ac97_write() local
158 old_cmd = inb(ICEREG(ice, AC97_CMD)); in snd_ice1712_ac97_write()
165 outb(reg, ICEREG(ice, AC97_INDEX)); in snd_ice1712_ac97_write()
166 outw(val, ICEREG(ice, AC97_DATA)); in snd_ice1712_ac97_write()
168 outb(old_cmd | ICE1712_AC97_WRITE, ICEREG(ice, AC97_CMD)); in snd_ice1712_ac97_write()
170 if ((inb(ICEREG(ice, AC97_CMD)) & ICE1712_AC97_WRITE) == 0) in snd_ice1712_ac97_write()
177 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_ac97_read() local
182 old_cmd = inb(ICEREG(ice, AC97_CMD)); in snd_ice1712_ac97_read()
189 outb(reg, ICEREG(ice, AC97_INDEX)); in snd_ice1712_ac97_read()
190 outb(old_cmd | ICE1712_AC97_READ, ICEREG(ice, AC97_CMD)); in snd_ice1712_ac97_read()
192 if ((inb(ICEREG(ice, AC97_CMD)) & ICE1712_AC97_READ) == 0) in snd_ice1712_ac97_read()
196 return inw(ICEREG(ice, AC97_DATA)); in snd_ice1712_ac97_read()
207 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_pro_ac97_write() local
212 old_cmd = inb(ICEMT(ice, AC97_CMD)); in snd_ice1712_pro_ac97_write()
219 outb(reg, ICEMT(ice, AC97_INDEX)); in snd_ice1712_pro_ac97_write()
220 outw(val, ICEMT(ice, AC97_DATA)); in snd_ice1712_pro_ac97_write()
222 outb(old_cmd | ICE1712_AC97_WRITE, ICEMT(ice, AC97_CMD)); in snd_ice1712_pro_ac97_write()
224 if ((inb(ICEMT(ice, AC97_CMD)) & ICE1712_AC97_WRITE) == 0) in snd_ice1712_pro_ac97_write()
232 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_pro_ac97_read() local
237 old_cmd = inb(ICEMT(ice, AC97_CMD)); in snd_ice1712_pro_ac97_read()
244 outb(reg, ICEMT(ice, AC97_INDEX)); in snd_ice1712_pro_ac97_read()
245 outb(old_cmd | ICE1712_AC97_READ, ICEMT(ice, AC97_CMD)); in snd_ice1712_pro_ac97_read()
247 if ((inb(ICEMT(ice, AC97_CMD)) & ICE1712_AC97_READ) == 0) in snd_ice1712_pro_ac97_read()
251 return inw(ICEMT(ice, AC97_DATA)); in snd_ice1712_pro_ac97_read()
261 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_digmix_route_ac97_get() local
263 ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_ROUTECTRL)) & ICE1712_ROUTE_AC97 ? 1 : 0; in snd_ice1712_digmix_route_ac97_get()
269 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_digmix_route_ac97_put() local
272 spin_lock_irq(&ice->reg_lock); in snd_ice1712_digmix_route_ac97_put()
273 val = inb(ICEMT(ice, MONITOR_ROUTECTRL)); in snd_ice1712_digmix_route_ac97_put()
277 outb(nval, ICEMT(ice, MONITOR_ROUTECTRL)); in snd_ice1712_digmix_route_ac97_put()
278 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_digmix_route_ac97_put()
294 static void snd_ice1712_set_gpio_dir(struct snd_ice1712 *ice, unsigned int data) in snd_ice1712_set_gpio_dir() argument
296 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, data); in snd_ice1712_set_gpio_dir()
297 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ in snd_ice1712_set_gpio_dir()
300 static unsigned int snd_ice1712_get_gpio_dir(struct snd_ice1712 *ice) in snd_ice1712_get_gpio_dir() argument
302 return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION); in snd_ice1712_get_gpio_dir()
305 static unsigned int snd_ice1712_get_gpio_mask(struct snd_ice1712 *ice) in snd_ice1712_get_gpio_mask() argument
307 return snd_ice1712_read(ice, ICE1712_IREG_GPIO_WRITE_MASK); in snd_ice1712_get_gpio_mask()
310 static void snd_ice1712_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) in snd_ice1712_set_gpio_mask() argument
312 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, data); in snd_ice1712_set_gpio_mask()
313 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ in snd_ice1712_set_gpio_mask()
316 static unsigned int snd_ice1712_get_gpio_data(struct snd_ice1712 *ice) in snd_ice1712_get_gpio_data() argument
318 return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); in snd_ice1712_get_gpio_data()
321 static void snd_ice1712_set_gpio_data(struct snd_ice1712 *ice, unsigned int val) in snd_ice1712_set_gpio_data() argument
323 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, val); in snd_ice1712_set_gpio_data()
324 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ in snd_ice1712_set_gpio_data()
337 static int snd_ice1712_cs8427_set_input_clock(struct snd_ice1712 *ice, int spdif_clock) in snd_ice1712_cs8427_set_input_clock() argument
343 snd_i2c_lock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
344 if (snd_i2c_sendbytes(ice->cs8427, reg, 1) != 1) { in snd_ice1712_cs8427_set_input_clock()
345 snd_i2c_unlock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
348 if (snd_i2c_readbytes(ice->cs8427, &val, 1) != 1) { in snd_ice1712_cs8427_set_input_clock()
349 snd_i2c_unlock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
359 if (snd_i2c_sendbytes(ice->cs8427, reg, 2) != 2) { in snd_ice1712_cs8427_set_input_clock()
365 snd_i2c_unlock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
372 static void open_cs8427(struct snd_ice1712 *ice, struct snd_pcm_substream *substream) in open_cs8427() argument
374 snd_cs8427_iec958_active(ice->cs8427, 1); in open_cs8427()
377 static void close_cs8427(struct snd_ice1712 *ice, struct snd_pcm_substream *substream) in close_cs8427() argument
379 snd_cs8427_iec958_active(ice->cs8427, 0); in close_cs8427()
382 static void setup_cs8427(struct snd_ice1712 *ice, int rate) in setup_cs8427() argument
384 snd_cs8427_iec958_pcm(ice->cs8427, rate); in setup_cs8427()
390 int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr) in snd_ice1712_init_cs8427() argument
394 err = snd_cs8427_create(ice->i2c, addr, in snd_ice1712_init_cs8427()
395 (ice->cs8427_timeout * HZ) / 1000, &ice->cs8427); in snd_ice1712_init_cs8427()
400 ice->spdif.ops.open = open_cs8427; in snd_ice1712_init_cs8427()
401 ice->spdif.ops.close = close_cs8427; in snd_ice1712_init_cs8427()
402 ice->spdif.ops.setup_rate = setup_cs8427; in snd_ice1712_init_cs8427()
406 static void snd_ice1712_set_input_clock_source(struct snd_ice1712 *ice, int spdif_is_master) in snd_ice1712_set_input_clock_source() argument
409 if (ice->cs8427) in snd_ice1712_set_input_clock_source()
410 snd_ice1712_cs8427_set_input_clock(ice, spdif_is_master); in snd_ice1712_set_input_clock_source()
414 for (i = 0; i < ice->akm_codecs; i++) { in snd_ice1712_set_input_clock_source()
415 if (ice->akm[i].ops.set_rate_val) in snd_ice1712_set_input_clock_source()
416 ice->akm[i].ops.set_rate_val(&ice->akm[i], 0); in snd_ice1712_set_input_clock_source()
427 struct snd_ice1712 *ice = dev_id; in snd_ice1712_interrupt() local
432 status = inb(ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
437 if (ice->rmidi[0]) in snd_ice1712_interrupt()
438 snd_mpu401_uart_interrupt(irq, ice->rmidi[0]->private_data); in snd_ice1712_interrupt()
439 outb(ICE1712_IRQ_MPU1, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
443 outb(ICE1712_IRQ_TIMER, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
445 if (ice->rmidi[1]) in snd_ice1712_interrupt()
446 snd_mpu401_uart_interrupt(irq, ice->rmidi[1]->private_data); in snd_ice1712_interrupt()
447 outb(ICE1712_IRQ_MPU2, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
451 unsigned char mtstat = inb(ICEMT(ice, IRQ)); in snd_ice1712_interrupt()
453 if (ice->playback_pro_substream) in snd_ice1712_interrupt()
454 snd_pcm_period_elapsed(ice->playback_pro_substream); in snd_ice1712_interrupt()
455 outb(ICE1712_MULTI_PBKSTATUS, ICEMT(ice, IRQ)); in snd_ice1712_interrupt()
458 if (ice->capture_pro_substream) in snd_ice1712_interrupt()
459 snd_pcm_period_elapsed(ice->capture_pro_substream); in snd_ice1712_interrupt()
460 outb(ICE1712_MULTI_CAPSTATUS, ICEMT(ice, IRQ)); in snd_ice1712_interrupt()
464 outb(ICE1712_IRQ_FM, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
469 pbkstatus = inw(ICEDS(ice, INTSTAT)); in snd_ice1712_interrupt()
474 substream = ice->playback_con_substream_ds[idx]; in snd_ice1712_interrupt()
477 outw(3 << (idx * 2), ICEDS(ice, INTSTAT)); in snd_ice1712_interrupt()
479 outb(ICE1712_IRQ_PBKDS, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
482 if (ice->capture_con_substream) in snd_ice1712_interrupt()
483 snd_pcm_period_elapsed(ice->capture_con_substream); in snd_ice1712_interrupt()
484 outb(ICE1712_IRQ_CONCAP, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
487 if (ice->playback_con_substream) in snd_ice1712_interrupt()
488 snd_pcm_period_elapsed(ice->playback_con_substream); in snd_ice1712_interrupt()
489 outb(ICE1712_IRQ_CONPBK, ICEREG(ice, IRQSTAT)); in snd_ice1712_interrupt()
518 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_trigger() local
522 spin_lock(&ice->reg_lock); in snd_ice1712_playback_trigger()
523 tmp = snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL); in snd_ice1712_playback_trigger()
535 snd_ice1712_write(ice, ICE1712_IREG_PBK_CTRL, tmp); in snd_ice1712_playback_trigger()
536 spin_unlock(&ice->reg_lock); in snd_ice1712_playback_trigger()
543 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_ds_trigger() local
547 spin_lock(&ice->reg_lock); in snd_ice1712_playback_ds_trigger()
548 tmp = snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL); in snd_ice1712_playback_ds_trigger()
560 snd_ice1712_ds_write(ice, substream->number * 2, ICE1712_DSC_CONTROL, tmp); in snd_ice1712_playback_ds_trigger()
561 spin_unlock(&ice->reg_lock); in snd_ice1712_playback_ds_trigger()
568 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_trigger() local
572 spin_lock(&ice->reg_lock); in snd_ice1712_capture_trigger()
573 tmp = snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL); in snd_ice1712_capture_trigger()
581 snd_ice1712_write(ice, ICE1712_IREG_CAP_CTRL, tmp); in snd_ice1712_capture_trigger()
582 spin_unlock(&ice->reg_lock); in snd_ice1712_capture_trigger()
588 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_prepare() local
602 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_prepare()
603 outb(0, ice->ddma_port + 15); in snd_ice1712_playback_prepare()
604 outb(ICE1712_DMA_MODE_WRITE | ICE1712_DMA_AUTOINIT, ice->ddma_port + 0x0b); in snd_ice1712_playback_prepare()
605 outl(runtime->dma_addr, ice->ddma_port + 0); in snd_ice1712_playback_prepare()
606 outw(buf_size, ice->ddma_port + 4); in snd_ice1712_playback_prepare()
607 snd_ice1712_write(ice, ICE1712_IREG_PBK_RATE_LO, rate & 0xff); in snd_ice1712_playback_prepare()
608 snd_ice1712_write(ice, ICE1712_IREG_PBK_RATE_MID, (rate >> 8) & 0xff); in snd_ice1712_playback_prepare()
609 snd_ice1712_write(ice, ICE1712_IREG_PBK_RATE_HI, (rate >> 16) & 0xff); in snd_ice1712_playback_prepare()
610 snd_ice1712_write(ice, ICE1712_IREG_PBK_CTRL, tmp); in snd_ice1712_playback_prepare()
611 snd_ice1712_write(ice, ICE1712_IREG_PBK_COUNT_LO, period_size & 0xff); in snd_ice1712_playback_prepare()
612 snd_ice1712_write(ice, ICE1712_IREG_PBK_COUNT_HI, period_size >> 8); in snd_ice1712_playback_prepare()
613 snd_ice1712_write(ice, ICE1712_IREG_PBK_LEFT, 0); in snd_ice1712_playback_prepare()
614 snd_ice1712_write(ice, ICE1712_IREG_PBK_RIGHT, 0); in snd_ice1712_playback_prepare()
615 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_prepare()
621 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_ds_prepare() local
635 ice->playback_con_active_buf[substream->number] = 0; in snd_ice1712_playback_ds_prepare()
636 ice->playback_con_virt_addr[substream->number] = runtime->dma_addr; in snd_ice1712_playback_ds_prepare()
638 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_prepare()
639 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_ADDR0, runtime->dma_addr); in snd_ice1712_playback_ds_prepare()
640 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_COUNT0, period_size); in snd_ice1712_playback_ds_prepare()
641 …snd_ice1712_ds_write(ice, chn, ICE1712_DSC_ADDR1, runtime->dma_addr + (runtime->periods > 1 ? peri… in snd_ice1712_playback_ds_prepare()
642 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_COUNT1, period_size); in snd_ice1712_playback_ds_prepare()
643 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_RATE, rate); in snd_ice1712_playback_ds_prepare()
644 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_VOLUME, 0); in snd_ice1712_playback_ds_prepare()
645 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_CONTROL, tmp); in snd_ice1712_playback_ds_prepare()
647 snd_ice1712_ds_write(ice, chn + 1, ICE1712_DSC_RATE, rate); in snd_ice1712_playback_ds_prepare()
648 snd_ice1712_ds_write(ice, chn + 1, ICE1712_DSC_VOLUME, 0); in snd_ice1712_playback_ds_prepare()
650 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_prepare()
656 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_prepare() local
668 spin_lock_irq(&ice->reg_lock); in snd_ice1712_capture_prepare()
669 outl(ice->capture_con_virt_addr = runtime->dma_addr, ICEREG(ice, CONCAP_ADDR)); in snd_ice1712_capture_prepare()
670 outw(buf_size, ICEREG(ice, CONCAP_COUNT)); in snd_ice1712_capture_prepare()
671 snd_ice1712_write(ice, ICE1712_IREG_CAP_COUNT_HI, period_size >> 8); in snd_ice1712_capture_prepare()
672 snd_ice1712_write(ice, ICE1712_IREG_CAP_COUNT_LO, period_size & 0xff); in snd_ice1712_capture_prepare()
673 snd_ice1712_write(ice, ICE1712_IREG_CAP_CTRL, tmp); in snd_ice1712_capture_prepare()
674 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_capture_prepare()
675 snd_ac97_set_rate(ice->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate); in snd_ice1712_capture_prepare()
681 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pointer() local
685 if (!(snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL) & 1)) in snd_ice1712_playback_pointer()
687 ptr = runtime->buffer_size - inw(ice->ddma_port + 4); in snd_ice1712_playback_pointer()
695 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_ds_pointer() local
699 if (!(snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL) & 1)) in snd_ice1712_playback_ds_pointer()
701 if (ice->playback_con_active_buf[substream->number]) in snd_ice1712_playback_ds_pointer()
705 ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) - in snd_ice1712_playback_ds_pointer()
706 ice->playback_con_virt_addr[substream->number]; in snd_ice1712_playback_ds_pointer()
714 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pointer() local
717 if (!(snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL) & 1)) in snd_ice1712_capture_pointer()
719 ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr; in snd_ice1712_capture_pointer()
784 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_open() local
786 ice->playback_con_substream = substream; in snd_ice1712_playback_open()
794 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_ds_open() local
797 ice->playback_con_substream_ds[substream->number] = substream; in snd_ice1712_playback_ds_open()
799 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_open()
800 tmp = inw(ICEDS(ice, INTMASK)) & ~(1 << (substream->number * 2)); in snd_ice1712_playback_ds_open()
801 outw(tmp, ICEDS(ice, INTMASK)); in snd_ice1712_playback_ds_open()
802 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_open()
809 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_open() local
811 ice->capture_con_substream = substream; in snd_ice1712_capture_open()
813 runtime->hw.rates = ice->ac97->rates[AC97_RATES_ADC]; in snd_ice1712_capture_open()
821 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_close() local
823 ice->playback_con_substream = NULL; in snd_ice1712_playback_close()
829 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_ds_close() local
832 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_close()
833 tmp = inw(ICEDS(ice, INTMASK)) | (3 << (substream->number * 2)); in snd_ice1712_playback_ds_close()
834 outw(tmp, ICEDS(ice, INTMASK)); in snd_ice1712_playback_ds_close()
835 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_close()
836 ice->playback_con_substream_ds[substream->number] = NULL; in snd_ice1712_playback_ds_close()
842 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_close() local
844 ice->capture_con_substream = NULL; in snd_ice1712_capture_close()
881 static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) in snd_ice1712_pcm() argument
888 err = snd_pcm_new(ice->card, "ICE1712 consumer", device, 1, 1, &pcm); in snd_ice1712_pcm()
895 pcm->private_data = ice; in snd_ice1712_pcm()
898 ice->pcm = pcm; in snd_ice1712_pcm()
901 snd_dma_pci_data(ice->pci), 64*1024, 64*1024); in snd_ice1712_pcm()
911 static int snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) in snd_ice1712_pcm_ds() argument
918 err = snd_pcm_new(ice->card, "ICE1712 consumer (DS)", device, 6, 0, &pcm); in snd_ice1712_pcm_ds()
924 pcm->private_data = ice; in snd_ice1712_pcm_ds()
927 ice->pcm_ds = pcm; in snd_ice1712_pcm_ds()
930 snd_dma_pci_data(ice->pci), 64*1024, 128*1024); in snd_ice1712_pcm_ds()
954 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_pro_trigger() local
965 spin_lock(&ice->reg_lock); in snd_ice1712_pro_trigger()
966 old = inl(ICEMT(ice, PLAYBACK_CONTROL)); in snd_ice1712_pro_trigger()
971 outl(old, ICEMT(ice, PLAYBACK_CONTROL)); in snd_ice1712_pro_trigger()
972 spin_unlock(&ice->reg_lock); in snd_ice1712_pro_trigger()
983 if (s == ice->playback_pro_substream) { in snd_ice1712_pro_trigger()
986 } else if (s == ice->capture_pro_substream) { in snd_ice1712_pro_trigger()
991 spin_lock(&ice->reg_lock); in snd_ice1712_pro_trigger()
992 old = inl(ICEMT(ice, PLAYBACK_CONTROL)); in snd_ice1712_pro_trigger()
997 outl(old, ICEMT(ice, PLAYBACK_CONTROL)); in snd_ice1712_pro_trigger()
998 spin_unlock(&ice->reg_lock); in snd_ice1712_pro_trigger()
1009 static void snd_ice1712_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, int force) in snd_ice1712_set_pro_rate() argument
1036 spin_lock_irqsave(&ice->reg_lock, flags); in snd_ice1712_set_pro_rate()
1037 if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW| in snd_ice1712_set_pro_rate()
1041 spin_unlock_irqrestore(&ice->reg_lock, flags); in snd_ice1712_set_pro_rate()
1044 if (!force && is_pro_rate_locked(ice)) in snd_ice1712_set_pro_rate()
1047 old = inb(ICEMT(ice, RATE)); in snd_ice1712_set_pro_rate()
1050 outb(val, ICEMT(ice, RATE)); in snd_ice1712_set_pro_rate()
1051 spin_unlock_irqrestore(&ice->reg_lock, flags); in snd_ice1712_set_pro_rate()
1053 if (ice->gpio.set_pro_rate) in snd_ice1712_set_pro_rate()
1054 ice->gpio.set_pro_rate(ice, rate); in snd_ice1712_set_pro_rate()
1055 for (i = 0; i < ice->akm_codecs; i++) { in snd_ice1712_set_pro_rate()
1056 if (ice->akm[i].ops.set_rate_val) in snd_ice1712_set_pro_rate()
1057 ice->akm[i].ops.set_rate_val(&ice->akm[i], rate); in snd_ice1712_set_pro_rate()
1059 if (ice->spdif.ops.setup_rate) in snd_ice1712_set_pro_rate()
1060 ice->spdif.ops.setup_rate(ice, rate); in snd_ice1712_set_pro_rate()
1065 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pro_prepare() local
1067 ice->playback_pro_size = snd_pcm_lib_buffer_bytes(substream); in snd_ice1712_playback_pro_prepare()
1068 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_pro_prepare()
1069 outl(substream->runtime->dma_addr, ICEMT(ice, PLAYBACK_ADDR)); in snd_ice1712_playback_pro_prepare()
1070 outw((ice->playback_pro_size >> 2) - 1, ICEMT(ice, PLAYBACK_SIZE)); in snd_ice1712_playback_pro_prepare()
1071 outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, PLAYBACK_COUNT)); in snd_ice1712_playback_pro_prepare()
1072 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_pro_prepare()
1080 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pro_hw_params() local
1082 snd_ice1712_set_pro_rate(ice, params_rate(hw_params), 0); in snd_ice1712_playback_pro_hw_params()
1088 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pro_prepare() local
1090 ice->capture_pro_size = snd_pcm_lib_buffer_bytes(substream); in snd_ice1712_capture_pro_prepare()
1091 spin_lock_irq(&ice->reg_lock); in snd_ice1712_capture_pro_prepare()
1092 outl(substream->runtime->dma_addr, ICEMT(ice, CAPTURE_ADDR)); in snd_ice1712_capture_pro_prepare()
1093 outw((ice->capture_pro_size >> 2) - 1, ICEMT(ice, CAPTURE_SIZE)); in snd_ice1712_capture_pro_prepare()
1094 outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, CAPTURE_COUNT)); in snd_ice1712_capture_pro_prepare()
1095 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_capture_pro_prepare()
1102 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pro_hw_params() local
1104 snd_ice1712_set_pro_rate(ice, params_rate(hw_params), 0); in snd_ice1712_capture_pro_hw_params()
1110 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pro_pointer() local
1113 if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_PLAYBACK_START)) in snd_ice1712_playback_pro_pointer()
1115 ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2); in snd_ice1712_playback_pro_pointer()
1123 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pro_pointer() local
1126 if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_CAPTURE_START_SHADOW)) in snd_ice1712_capture_pro_pointer()
1128 ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2); in snd_ice1712_capture_pro_pointer()
1175 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pro_open() local
1177 ice->playback_pro_substream = substream; in snd_ice1712_playback_pro_open()
1182 if (is_pro_rate_locked(ice)) { in snd_ice1712_playback_pro_open()
1187 if (ice->spdif.ops.open) in snd_ice1712_playback_pro_open()
1188 ice->spdif.ops.open(ice, substream); in snd_ice1712_playback_pro_open()
1195 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pro_open() local
1198 ice->capture_pro_substream = substream; in snd_ice1712_capture_pro_open()
1203 if (is_pro_rate_locked(ice)) { in snd_ice1712_capture_pro_open()
1213 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_playback_pro_close() local
1216 snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); in snd_ice1712_playback_pro_close()
1217 ice->playback_pro_substream = NULL; in snd_ice1712_playback_pro_close()
1218 if (ice->spdif.ops.close) in snd_ice1712_playback_pro_close()
1219 ice->spdif.ops.close(ice, substream); in snd_ice1712_playback_pro_close()
1226 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); in snd_ice1712_capture_pro_close() local
1229 snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); in snd_ice1712_capture_pro_close()
1230 ice->capture_pro_substream = NULL; in snd_ice1712_capture_pro_close()
1256 static int snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) in snd_ice1712_pcm_profi() argument
1263 err = snd_pcm_new(ice->card, "ICE1712 multi", device, 1, 1, &pcm); in snd_ice1712_pcm_profi()
1270 pcm->private_data = ice; in snd_ice1712_pcm_profi()
1275 snd_dma_pci_data(ice->pci), 256*1024, 256*1024); in snd_ice1712_pcm_profi()
1277 ice->pcm_pro = pcm; in snd_ice1712_pcm_profi()
1281 if (ice->cs8427) { in snd_ice1712_pcm_profi()
1283 err = snd_cs8427_iec958_build(ice->cs8427, in snd_ice1712_pcm_profi()
1290 err = snd_ice1712_build_pro_mixer(ice); in snd_ice1712_pcm_profi()
1300 static void snd_ice1712_update_volume(struct snd_ice1712 *ice, int index) in snd_ice1712_update_volume() argument
1302 unsigned int vol = ice->pro_volumes[index]; in snd_ice1712_update_volume()
1307 outb(index, ICEMT(ice, MONITOR_INDEX)); in snd_ice1712_update_volume()
1308 outw(val, ICEMT(ice, MONITOR_VOLUME)); in snd_ice1712_update_volume()
1315 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_mixer_switch_get() local
1319 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_get()
1321 !((ice->pro_volumes[priv_idx] >> 15) & 1); in snd_ice1712_pro_mixer_switch_get()
1323 !((ice->pro_volumes[priv_idx] >> 31) & 1); in snd_ice1712_pro_mixer_switch_get()
1324 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_get()
1330 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_mixer_switch_put() local
1337 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_put()
1338 nval |= ice->pro_volumes[priv_idx] & ~0x80008000; in snd_ice1712_pro_mixer_switch_put()
1339 change = nval != ice->pro_volumes[priv_idx]; in snd_ice1712_pro_mixer_switch_put()
1340 ice->pro_volumes[priv_idx] = nval; in snd_ice1712_pro_mixer_switch_put()
1341 snd_ice1712_update_volume(ice, priv_idx); in snd_ice1712_pro_mixer_switch_put()
1342 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_put()
1357 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_mixer_volume_get() local
1361 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_get()
1363 (ice->pro_volumes[priv_idx] >> 0) & 127; in snd_ice1712_pro_mixer_volume_get()
1365 (ice->pro_volumes[priv_idx] >> 16) & 127; in snd_ice1712_pro_mixer_volume_get()
1366 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_get()
1372 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_mixer_volume_put() local
1379 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_put()
1380 nval |= ice->pro_volumes[priv_idx] & ~0x007f007f; in snd_ice1712_pro_mixer_volume_put()
1381 change = nval != ice->pro_volumes[priv_idx]; in snd_ice1712_pro_mixer_volume_put()
1382 ice->pro_volumes[priv_idx] = nval; in snd_ice1712_pro_mixer_volume_put()
1383 snd_ice1712_update_volume(ice, priv_idx); in snd_ice1712_pro_mixer_volume_put()
1384 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_put()
1455 static int snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice) in snd_ice1712_build_pro_mixer() argument
1457 struct snd_card *card = ice->card; in snd_ice1712_build_pro_mixer()
1463 err = snd_ctl_add(card, snd_ctl_new1(&snd_ice1712_multi_playback_ctrls[idx], ice)); in snd_ice1712_build_pro_mixer()
1468 if (ice->num_total_adcs > 0) { in snd_ice1712_build_pro_mixer()
1470 tmp.count = ice->num_total_adcs; in snd_ice1712_build_pro_mixer()
1471 err = snd_ctl_add(card, snd_ctl_new1(&tmp, ice)); in snd_ice1712_build_pro_mixer()
1476 err = snd_ctl_add(card, snd_ctl_new1(&snd_ice1712_multi_capture_spdif_switch, ice)); in snd_ice1712_build_pro_mixer()
1480 if (ice->num_total_adcs > 0) { in snd_ice1712_build_pro_mixer()
1482 tmp.count = ice->num_total_adcs; in snd_ice1712_build_pro_mixer()
1483 err = snd_ctl_add(card, snd_ctl_new1(&tmp, ice)); in snd_ice1712_build_pro_mixer()
1488 err = snd_ctl_add(card, snd_ctl_new1(&snd_ice1712_multi_capture_spdif_volume, ice)); in snd_ice1712_build_pro_mixer()
1494 ice->pro_volumes[idx] = 0x80008000; /* mute */ in snd_ice1712_build_pro_mixer()
1495 snd_ice1712_update_volume(ice, idx); in snd_ice1712_build_pro_mixer()
1497 for (idx = 10; idx < 10 + ice->num_total_adcs; idx++) { in snd_ice1712_build_pro_mixer()
1498 ice->pro_volumes[idx] = 0x80008000; /* mute */ in snd_ice1712_build_pro_mixer()
1499 snd_ice1712_update_volume(ice, idx); in snd_ice1712_build_pro_mixer()
1502 ice->pro_volumes[idx] = 0x80008000; /* mute */ in snd_ice1712_build_pro_mixer()
1503 snd_ice1712_update_volume(ice, idx); in snd_ice1712_build_pro_mixer()
1510 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_mixer_free_ac97() local
1511 ice->ac97 = NULL; in snd_ice1712_mixer_free_ac97()
1514 static int snd_ice1712_ac97_mixer(struct snd_ice1712 *ice) in snd_ice1712_ac97_mixer() argument
1528 if (ice_has_con_ac97(ice)) { in snd_ice1712_ac97_mixer()
1529 err = snd_ac97_bus(ice->card, bus_num++, &con_ops, NULL, &pbus); in snd_ice1712_ac97_mixer()
1533 ac97.private_data = ice; in snd_ice1712_ac97_mixer()
1535 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); in snd_ice1712_ac97_mixer()
1539 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice)); in snd_ice1712_ac97_mixer()
1546 if (!(ice->eeprom.data[ICE_EEP1_ACLINK] & ICE1712_CFG_PRO_I2S)) { in snd_ice1712_ac97_mixer()
1547 err = snd_ac97_bus(ice->card, bus_num, &pro_ops, NULL, &pbus); in snd_ice1712_ac97_mixer()
1551 ac97.private_data = ice; in snd_ice1712_ac97_mixer()
1553 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); in snd_ice1712_ac97_mixer()
1560 strcat(ice->card->mixername, "ICE1712 - multitrack"); in snd_ice1712_ac97_mixer()
1568 static inline unsigned int eeprom_double(struct snd_ice1712 *ice, int idx) in eeprom_double() argument
1570 return (unsigned int)ice->eeprom.data[idx] | ((unsigned int)ice->eeprom.data[idx + 1] << 8); in eeprom_double()
1576 struct snd_ice1712 *ice = entry->private_data; in snd_ice1712_proc_read() local
1579 snd_iprintf(buffer, "%s\n\n", ice->card->longname); in snd_ice1712_proc_read()
1582 snd_iprintf(buffer, " Subvendor : 0x%x\n", ice->eeprom.subvendor); in snd_ice1712_proc_read()
1583 snd_iprintf(buffer, " Size : %i bytes\n", ice->eeprom.size); in snd_ice1712_proc_read()
1584 snd_iprintf(buffer, " Version : %i\n", ice->eeprom.version); in snd_ice1712_proc_read()
1585 snd_iprintf(buffer, " Codec : 0x%x\n", ice->eeprom.data[ICE_EEP1_CODEC]); in snd_ice1712_proc_read()
1586 snd_iprintf(buffer, " ACLink : 0x%x\n", ice->eeprom.data[ICE_EEP1_ACLINK]); in snd_ice1712_proc_read()
1587 snd_iprintf(buffer, " I2S ID : 0x%x\n", ice->eeprom.data[ICE_EEP1_I2SID]); in snd_ice1712_proc_read()
1588 snd_iprintf(buffer, " S/PDIF : 0x%x\n", ice->eeprom.data[ICE_EEP1_SPDIF]); in snd_ice1712_proc_read()
1589 snd_iprintf(buffer, " GPIO mask : 0x%x\n", ice->eeprom.gpiomask); in snd_ice1712_proc_read()
1590 snd_iprintf(buffer, " GPIO state : 0x%x\n", ice->eeprom.gpiostate); in snd_ice1712_proc_read()
1591 snd_iprintf(buffer, " GPIO direction : 0x%x\n", ice->eeprom.gpiodir); in snd_ice1712_proc_read()
1592 snd_iprintf(buffer, " AC'97 main : 0x%x\n", eeprom_double(ice, ICE_EEP1_AC97_MAIN_LO)); in snd_ice1712_proc_read()
1593 snd_iprintf(buffer, " AC'97 pcm : 0x%x\n", eeprom_double(ice, ICE_EEP1_AC97_PCM_LO)); in snd_ice1712_proc_read()
1594 snd_iprintf(buffer, " AC'97 record : 0x%x\n", eeprom_double(ice, ICE_EEP1_AC97_REC_LO)); in snd_ice1712_proc_read()
1595 snd_iprintf(buffer, " AC'97 record src : 0x%x\n", ice->eeprom.data[ICE_EEP1_AC97_RECSRC]); in snd_ice1712_proc_read()
1597 snd_iprintf(buffer, " DAC ID #%i : 0x%x\n", idx, ice->eeprom.data[ICE_EEP1_DAC_ID + idx]); in snd_ice1712_proc_read()
1599 snd_iprintf(buffer, " ADC ID #%i : 0x%x\n", idx, ice->eeprom.data[ICE_EEP1_ADC_ID + idx]); in snd_ice1712_proc_read()
1600 for (idx = 0x1c; idx < ice->eeprom.size; idx++) in snd_ice1712_proc_read()
1601 snd_iprintf(buffer, " Extra #%02i : 0x%x\n", idx, ice->eeprom.data[idx]); in snd_ice1712_proc_read()
1604 snd_iprintf(buffer, " PSDOUT03 : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_PSDOUT03))); in snd_ice1712_proc_read()
1605 snd_iprintf(buffer, " CAPTURE : 0x%08x\n", inl(ICEMT(ice, ROUTE_CAPTURE))); in snd_ice1712_proc_read()
1606 snd_iprintf(buffer, " SPDOUT : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_SPDOUT))); in snd_ice1712_proc_read()
1607 snd_iprintf(buffer, " RATE : 0x%02x\n", (unsigned)inb(ICEMT(ice, RATE))); in snd_ice1712_proc_read()
1608 snd_iprintf(buffer, " GPIO_DATA : 0x%02x\n", (unsigned)snd_ice1712_get_gpio_data(ice)); in snd_ice1712_proc_read()
1609 …snd_iprintf(buffer, " GPIO_WRITE_MASK : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_… in snd_ice1712_proc_read()
1610 …snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_… in snd_ice1712_proc_read()
1613 static void snd_ice1712_proc_init(struct snd_ice1712 *ice) in snd_ice1712_proc_init() argument
1617 if (!snd_card_proc_new(ice->card, "ice1712", &entry)) in snd_ice1712_proc_init()
1618 snd_info_set_text_ops(entry, ice, snd_ice1712_proc_read); in snd_ice1712_proc_init()
1636 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_eeprom_get() local
1638 memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); in snd_ice1712_eeprom_get()
1663 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_default_get() local
1664 if (ice->spdif.ops.default_get) in snd_ice1712_spdif_default_get()
1665 ice->spdif.ops.default_get(ice, ucontrol); in snd_ice1712_spdif_default_get()
1672 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_default_put() local
1673 if (ice->spdif.ops.default_put) in snd_ice1712_spdif_default_put()
1674 return ice->spdif.ops.default_put(ice, ucontrol); in snd_ice1712_spdif_default_put()
1690 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_maskc_get() local
1691 if (ice->spdif.ops.default_get) { in snd_ice1712_spdif_maskc_get()
1712 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_maskp_get() local
1713 if (ice->spdif.ops.default_get) { in snd_ice1712_spdif_maskp_get()
1750 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_stream_get() local
1751 if (ice->spdif.ops.stream_get) in snd_ice1712_spdif_stream_get()
1752 ice->spdif.ops.stream_get(ice, ucontrol); in snd_ice1712_spdif_stream_get()
1759 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_spdif_stream_put() local
1760 if (ice->spdif.ops.stream_put) in snd_ice1712_spdif_stream_put()
1761 return ice->spdif.ops.stream_put(ice, ucontrol); in snd_ice1712_spdif_stream_put()
1779 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_gpio_get() local
1783 snd_ice1712_save_gpio_status(ice); in snd_ice1712_gpio_get()
1785 (snd_ice1712_gpio_read(ice) & mask ? 1 : 0) ^ invert; in snd_ice1712_gpio_get()
1786 snd_ice1712_restore_gpio_status(ice); in snd_ice1712_gpio_get()
1793 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_gpio_put() local
1801 snd_ice1712_save_gpio_status(ice); in snd_ice1712_gpio_put()
1802 val = snd_ice1712_gpio_read(ice); in snd_ice1712_gpio_put()
1805 snd_ice1712_gpio_write(ice, nval); in snd_ice1712_gpio_put()
1806 snd_ice1712_restore_gpio_status(ice); in snd_ice1712_gpio_put()
1844 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_internal_clock_get() local
1850 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_get()
1851 if (is_spdif_master(ice)) { in snd_ice1712_pro_internal_clock_get()
1854 val = xlate[inb(ICEMT(ice, RATE)) & 15]; in snd_ice1712_pro_internal_clock_get()
1861 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_get()
1868 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_internal_clock_put() local
1876 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1877 oval = inb(ICEMT(ice, RATE)); in snd_ice1712_pro_internal_clock_put()
1879 outb(oval | ICE1712_SPDIF_MASTER, ICEMT(ice, RATE)); in snd_ice1712_pro_internal_clock_put()
1882 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1883 snd_ice1712_set_pro_rate(ice, PRO_RATE_DEFAULT, 1); in snd_ice1712_pro_internal_clock_put()
1884 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1886 change = inb(ICEMT(ice, RATE)) != oval; in snd_ice1712_pro_internal_clock_put()
1887 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1890 (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) in snd_ice1712_pro_internal_clock_put()
1891 snd_ice1712_set_input_clock_source(ice, is_spdif_master(ice)); in snd_ice1712_pro_internal_clock_put()
1987 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_rate_locking_put() local
1991 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_locking_put()
1994 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_locking_put()
2018 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_rate_reset_put() local
2022 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_reset_put()
2025 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_reset_put()
2064 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_route_analog_get() local
2068 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_get()
2069 val = inw(ICEMT(ice, ROUTE_PSDOUT03)); in snd_ice1712_pro_route_analog_get()
2070 cval = inl(ICEMT(ice, ROUTE_CAPTURE)); in snd_ice1712_pro_route_analog_get()
2071 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_get()
2090 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_route_analog_put() local
2105 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2106 val = old_val = inw(ICEMT(ice, ROUTE_PSDOUT03)); in snd_ice1712_pro_route_analog_put()
2111 outw(val, ICEMT(ice, ROUTE_PSDOUT03)); in snd_ice1712_pro_route_analog_put()
2112 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2117 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2118 val = old_val = inl(ICEMT(ice, ROUTE_CAPTURE)); in snd_ice1712_pro_route_analog_put()
2131 outl(val, ICEMT(ice, ROUTE_CAPTURE)); in snd_ice1712_pro_route_analog_put()
2133 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2140 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_route_spdif_get() local
2143 val = inw(ICEMT(ice, ROUTE_SPDOUT)); in snd_ice1712_pro_route_spdif_get()
2160 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_route_spdif_put() local
2166 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_spdif_put()
2167 val = old_val = inw(ICEMT(ice, ROUTE_SPDOUT)); in snd_ice1712_pro_route_spdif_put()
2191 outw(val, ICEMT(ice, ROUTE_SPDOUT)); in snd_ice1712_pro_route_spdif_put()
2192 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_spdif_put()
2227 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_volume_rate_get() local
2229 ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_RATE)); in snd_ice1712_pro_volume_rate_get()
2236 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_volume_rate_put() local
2239 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_volume_rate_put()
2240 change = inb(ICEMT(ice, MONITOR_RATE)) != ucontrol->value.integer.value[0]; in snd_ice1712_pro_volume_rate_put()
2241 outb(ucontrol->value.integer.value[0], ICEMT(ice, MONITOR_RATE)); in snd_ice1712_pro_volume_rate_put()
2242 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_volume_rate_put()
2267 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_pro_peak_get() local
2270 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_peak_get()
2272 outb(idx, ICEMT(ice, MONITOR_PEAKINDEX)); in snd_ice1712_pro_peak_get()
2273 ucontrol->value.integer.value[idx] = inb(ICEMT(ice, MONITOR_PEAKDATA)); in snd_ice1712_pro_peak_get()
2275 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_peak_get()
2301 static unsigned char snd_ice1712_read_i2c(struct snd_ice1712 *ice, in snd_ice1712_read_i2c() argument
2307 outb(addr, ICEREG(ice, I2C_BYTE_ADDR)); in snd_ice1712_read_i2c()
2308 outb(dev & ~ICE1712_I2C_WRITE, ICEREG(ice, I2C_DEV_ADDR)); in snd_ice1712_read_i2c()
2309 while (t-- > 0 && (inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_BUSY)) ; in snd_ice1712_read_i2c()
2310 return inb(ICEREG(ice, I2C_DATA)); in snd_ice1712_read_i2c()
2313 static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice, in snd_ice1712_read_eeprom() argument
2321 ice->eeprom.subvendor = 0; in snd_ice1712_read_eeprom()
2322 if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) != 0) in snd_ice1712_read_eeprom()
2323 ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) | in snd_ice1712_read_eeprom()
2324 (snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | in snd_ice1712_read_eeprom()
2325 (snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | in snd_ice1712_read_eeprom()
2326 (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); in snd_ice1712_read_eeprom()
2327 if (ice->eeprom.subvendor == 0 || in snd_ice1712_read_eeprom()
2328 ice->eeprom.subvendor == (unsigned int)-1) { in snd_ice1712_read_eeprom()
2331 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_VENDOR_ID, &vendor); in snd_ice1712_read_eeprom()
2332 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device); in snd_ice1712_read_eeprom()
2333 ice->eeprom.subvendor = ((unsigned int)swab16(vendor) << 16) | swab16(device); in snd_ice1712_read_eeprom()
2334 if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) { in snd_ice1712_read_eeprom()
2344 ice->eeprom.subvendor = c->subvendor; in snd_ice1712_read_eeprom()
2345 } else if (c->subvendor != ice->eeprom.subvendor) in snd_ice1712_read_eeprom()
2351 ice->eeprom.version = 1; in snd_ice1712_read_eeprom()
2352 ice->eeprom.size = c->eeprom_size + 6; in snd_ice1712_read_eeprom()
2353 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); in snd_ice1712_read_eeprom()
2358 ice->eeprom.subvendor); in snd_ice1712_read_eeprom()
2361 ice->eeprom.size = snd_ice1712_read_i2c(ice, dev, 0x04); in snd_ice1712_read_eeprom()
2362 if (ice->eeprom.size < 6) in snd_ice1712_read_eeprom()
2363 ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ in snd_ice1712_read_eeprom()
2364 else if (ice->eeprom.size > 32) { in snd_ice1712_read_eeprom()
2365 snd_printk(KERN_ERR "invalid EEPROM (size = %i)\n", ice->eeprom.size); in snd_ice1712_read_eeprom()
2368 ice->eeprom.version = snd_ice1712_read_i2c(ice, dev, 0x05); in snd_ice1712_read_eeprom()
2369 if (ice->eeprom.version != 1) { in snd_ice1712_read_eeprom()
2371 ice->eeprom.version); in snd_ice1712_read_eeprom()
2374 size = ice->eeprom.size - 6; in snd_ice1712_read_eeprom()
2376 ice->eeprom.data[i] = snd_ice1712_read_i2c(ice, dev, i + 6); in snd_ice1712_read_eeprom()
2379 ice->eeprom.gpiomask = ice->eeprom.data[ICE_EEP1_GPIO_MASK]; in snd_ice1712_read_eeprom()
2380 ice->eeprom.gpiostate = ice->eeprom.data[ICE_EEP1_GPIO_STATE]; in snd_ice1712_read_eeprom()
2381 ice->eeprom.gpiodir = ice->eeprom.data[ICE_EEP1_GPIO_DIR]; in snd_ice1712_read_eeprom()
2388 static int snd_ice1712_chip_init(struct snd_ice1712 *ice) in snd_ice1712_chip_init() argument
2390 outb(ICE1712_RESET | ICE1712_NATIVE, ICEREG(ice, CONTROL)); in snd_ice1712_chip_init()
2392 outb(ICE1712_NATIVE, ICEREG(ice, CONTROL)); in snd_ice1712_chip_init()
2394 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE && in snd_ice1712_chip_init()
2395 !ice->dxr_enable) in snd_ice1712_chip_init()
2400 ice->eeprom.data[ICE_EEP1_CODEC] = 0x3a; in snd_ice1712_chip_init()
2401 pci_write_config_byte(ice->pci, 0x60, ice->eeprom.data[ICE_EEP1_CODEC]); in snd_ice1712_chip_init()
2402 pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]); in snd_ice1712_chip_init()
2403 pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]); in snd_ice1712_chip_init()
2404 pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]); in snd_ice1712_chip_init()
2405 if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24) { in snd_ice1712_chip_init()
2406 ice->gpio.write_mask = ice->eeprom.gpiomask; in snd_ice1712_chip_init()
2407 ice->gpio.direction = ice->eeprom.gpiodir; in snd_ice1712_chip_init()
2408 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, in snd_ice1712_chip_init()
2409 ice->eeprom.gpiomask); in snd_ice1712_chip_init()
2410 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, in snd_ice1712_chip_init()
2411 ice->eeprom.gpiodir); in snd_ice1712_chip_init()
2412 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, in snd_ice1712_chip_init()
2413 ice->eeprom.gpiostate); in snd_ice1712_chip_init()
2415 ice->gpio.write_mask = 0xc0; in snd_ice1712_chip_init()
2416 ice->gpio.direction = 0xff; in snd_ice1712_chip_init()
2417 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, 0xc0); in snd_ice1712_chip_init()
2418 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, 0xff); in snd_ice1712_chip_init()
2419 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, in snd_ice1712_chip_init()
2422 snd_ice1712_write(ice, ICE1712_IREG_PRO_POWERDOWN, 0); in snd_ice1712_chip_init()
2423 if (!(ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97)) { in snd_ice1712_chip_init()
2424 outb(ICE1712_AC97_WARM, ICEREG(ice, AC97_CMD)); in snd_ice1712_chip_init()
2426 outb(0, ICEREG(ice, AC97_CMD)); in snd_ice1712_chip_init()
2428 snd_ice1712_write(ice, ICE1712_IREG_CONSUMER_POWERDOWN, 0); in snd_ice1712_chip_init()
2430 snd_ice1712_set_pro_rate(ice, 48000, 1); in snd_ice1712_chip_init()
2435 int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice) in snd_ice1712_spdif_build_controls() argument
2440 if (snd_BUG_ON(!ice->pcm_pro)) in snd_ice1712_spdif_build_controls()
2442 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_default, ice)); in snd_ice1712_spdif_build_controls()
2445 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2446 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_maskc, ice)); in snd_ice1712_spdif_build_controls()
2449 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2450 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_maskp, ice)); in snd_ice1712_spdif_build_controls()
2453 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2454 err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_stream, ice)); in snd_ice1712_spdif_build_controls()
2457 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2458 ice->spdif.stream_ctl = kctl; in snd_ice1712_spdif_build_controls()
2463 static int snd_ice1712_build_controls(struct snd_ice1712 *ice) in snd_ice1712_build_controls() argument
2467 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_eeprom, ice)); in snd_ice1712_build_controls()
2470 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_internal_clock, ice)); in snd_ice1712_build_controls()
2473 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_internal_clock_default, ice)); in snd_ice1712_build_controls()
2477 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_rate_locking, ice)); in snd_ice1712_build_controls()
2480 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_rate_reset, ice)); in snd_ice1712_build_controls()
2484 if (ice->num_total_dacs > 0) { in snd_ice1712_build_controls()
2486 tmp.count = ice->num_total_dacs; in snd_ice1712_build_controls()
2487 err = snd_ctl_add(ice->card, snd_ctl_new1(&tmp, ice)); in snd_ice1712_build_controls()
2492 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_pro_spdif_route, ice)); in snd_ice1712_build_controls()
2496 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_pro_volume_rate, ice)); in snd_ice1712_build_controls()
2499 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_pro_peak, ice)); in snd_ice1712_build_controls()
2506 static int snd_ice1712_free(struct snd_ice1712 *ice) in snd_ice1712_free() argument
2508 if (!ice->port) in snd_ice1712_free()
2511 outb(0xc0, ICEMT(ice, IRQ)); in snd_ice1712_free()
2512 outb(0xff, ICEREG(ice, IRQMASK)); in snd_ice1712_free()
2515 if (ice->irq >= 0) in snd_ice1712_free()
2516 free_irq(ice->irq, ice); in snd_ice1712_free()
2518 if (ice->port) in snd_ice1712_free()
2519 pci_release_regions(ice->pci); in snd_ice1712_free()
2520 snd_ice1712_akm4xxx_free(ice); in snd_ice1712_free()
2521 pci_disable_device(ice->pci); in snd_ice1712_free()
2522 kfree(ice->spec); in snd_ice1712_free()
2523 kfree(ice); in snd_ice1712_free()
2529 struct snd_ice1712 *ice = device->device_data; in snd_ice1712_dev_free() local
2530 return snd_ice1712_free(ice); in snd_ice1712_dev_free()
2541 struct snd_ice1712 *ice; in snd_ice1712_create() local
2561 ice = kzalloc(sizeof(*ice), GFP_KERNEL); in snd_ice1712_create()
2562 if (ice == NULL) { in snd_ice1712_create()
2566 ice->omni = omni ? 1 : 0; in snd_ice1712_create()
2571 ice->cs8427_timeout = cs8427_timeout; in snd_ice1712_create()
2572 ice->dxr_enable = dxr_enable; in snd_ice1712_create()
2573 spin_lock_init(&ice->reg_lock); in snd_ice1712_create()
2574 mutex_init(&ice->gpio_mutex); in snd_ice1712_create()
2575 mutex_init(&ice->i2c_mutex); in snd_ice1712_create()
2576 mutex_init(&ice->open_mutex); in snd_ice1712_create()
2577 ice->gpio.set_mask = snd_ice1712_set_gpio_mask; in snd_ice1712_create()
2578 ice->gpio.get_mask = snd_ice1712_get_gpio_mask; in snd_ice1712_create()
2579 ice->gpio.set_dir = snd_ice1712_set_gpio_dir; in snd_ice1712_create()
2580 ice->gpio.get_dir = snd_ice1712_get_gpio_dir; in snd_ice1712_create()
2581 ice->gpio.set_data = snd_ice1712_set_gpio_data; in snd_ice1712_create()
2582 ice->gpio.get_data = snd_ice1712_get_gpio_data; in snd_ice1712_create()
2584 ice->spdif.cs8403_bits = in snd_ice1712_create()
2585 ice->spdif.cs8403_stream_bits = (0x01 | /* consumer format */ in snd_ice1712_create()
2588 ice->card = card; in snd_ice1712_create()
2589 ice->pci = pci; in snd_ice1712_create()
2590 ice->irq = -1; in snd_ice1712_create()
2592 pci_write_config_word(ice->pci, 0x40, 0x807f); in snd_ice1712_create()
2593 pci_write_config_word(ice->pci, 0x42, 0x0006); in snd_ice1712_create()
2594 snd_ice1712_proc_init(ice); in snd_ice1712_create()
2597 card->private_data = ice; in snd_ice1712_create()
2601 kfree(ice); in snd_ice1712_create()
2605 ice->port = pci_resource_start(pci, 0); in snd_ice1712_create()
2606 ice->ddma_port = pci_resource_start(pci, 1); in snd_ice1712_create()
2607 ice->dmapath_port = pci_resource_start(pci, 2); in snd_ice1712_create()
2608 ice->profi_port = pci_resource_start(pci, 3); in snd_ice1712_create()
2611 KBUILD_MODNAME, ice)) { in snd_ice1712_create()
2613 snd_ice1712_free(ice); in snd_ice1712_create()
2617 ice->irq = pci->irq; in snd_ice1712_create()
2619 if (snd_ice1712_read_eeprom(ice, modelname) < 0) { in snd_ice1712_create()
2620 snd_ice1712_free(ice); in snd_ice1712_create()
2623 if (snd_ice1712_chip_init(ice) < 0) { in snd_ice1712_create()
2624 snd_ice1712_free(ice); in snd_ice1712_create()
2629 outb(((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) == 0 ? in snd_ice1712_create()
2631 ((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97) ? in snd_ice1712_create()
2633 ICEREG(ice, IRQMASK)); in snd_ice1712_create()
2634 outb(0x00, ICEMT(ice, IRQ)); in snd_ice1712_create()
2636 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops); in snd_ice1712_create()
2638 snd_ice1712_free(ice); in snd_ice1712_create()
2644 *r_ice1712 = ice; in snd_ice1712_create()
2662 struct snd_ice1712 *ice; in snd_ice1712_probe() local
2681 cs8427_timeout[dev], dxr_enable[dev], &ice); in snd_ice1712_probe()
2689 if (c->subvendor == ice->eeprom.subvendor) { in snd_ice1712_probe()
2690 ice->card_info = c; in snd_ice1712_probe()
2695 err = c->chip_init(ice); in snd_ice1712_probe()
2708 err = snd_ice1712_pcm_profi(ice, pcm_dev++, NULL); in snd_ice1712_probe()
2714 if (ice_has_con_ac97(ice)) { in snd_ice1712_probe()
2715 err = snd_ice1712_pcm(ice, pcm_dev++, NULL); in snd_ice1712_probe()
2722 err = snd_ice1712_ac97_mixer(ice); in snd_ice1712_probe()
2728 err = snd_ice1712_build_controls(ice); in snd_ice1712_probe()
2735 err = c->build_controls(ice); in snd_ice1712_probe()
2742 if (ice_has_con_ac97(ice)) { in snd_ice1712_probe()
2743 err = snd_ice1712_pcm_ds(ice, pcm_dev++, NULL); in snd_ice1712_probe()
2752 ICEREG(ice, MPU1_CTRL), in snd_ice1712_probe()
2755 -1, &ice->rmidi[0]); in snd_ice1712_probe()
2762 snprintf(ice->rmidi[0]->name, in snd_ice1712_probe()
2763 sizeof(ice->rmidi[0]->name), in snd_ice1712_probe()
2766 if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) { in snd_ice1712_probe()
2769 ICEREG(ice, MPU2_CTRL), in snd_ice1712_probe()
2772 -1, &ice->rmidi[1]); in snd_ice1712_probe()
2780 snprintf(ice->rmidi[1]->name, in snd_ice1712_probe()
2781 sizeof(ice->rmidi[1]->name), in snd_ice1712_probe()
2787 snd_ice1712_set_input_clock_source(ice, 0); in snd_ice1712_probe()
2790 card->shortname, ice->port, ice->irq); in snd_ice1712_probe()
2805 struct snd_ice1712 *ice = card->private_data; in snd_ice1712_remove() local
2807 if (ice->card_info && ice->card_info->chip_exit) in snd_ice1712_remove()
2808 ice->card_info->chip_exit(ice); in snd_ice1712_remove()