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