Lines Matching +full:eeprom +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0-or-later
48 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
86 /* check whether the clock mode is spdif-in */
97 return (!ice->is_spdif_master(ice)) && PRO_RATE_LOCKED; in is_pro_rate_locked()
116 dev_dbg(ice->card->dev, "snd_vt1724_ac97_ready: timeout\n"); in snd_vt1724_ac97_ready()
126 dev_dbg(ice->card->dev, "snd_vt1724_ac97_wait_bit: timeout\n"); in snd_vt1724_ac97_wait_bit()
127 return -EIO; in snd_vt1724_ac97_wait_bit()
134 struct snd_ice1712 *ice = ac97->private_data; in snd_vt1724_ac97_write()
139 old_cmd |= ac97->num; in snd_vt1724_ac97_write()
148 struct snd_ice1712 *ice = ac97->private_data; in snd_vt1724_ac97_read()
153 old_cmd |= ac97->num; in snd_vt1724_ac97_read()
170 inw(ICEREG1724(ice, GPIO_DIRECTION)); /* dummy read for pci-posting */ in snd_vt1724_set_gpio_dir()
183 if (!ice->vt1720) /* VT1720 supports only 16 GPIO bits */ in snd_vt1724_set_gpio_mask()
185 inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */ in snd_vt1724_set_gpio_mask()
191 if (!ice->vt1720) in snd_vt1724_get_gpio_mask()
202 if (!ice->vt1720) in snd_vt1724_set_gpio_data()
204 inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */ in snd_vt1724_set_gpio_data()
210 if (!ice->vt1720) in snd_vt1724_get_gpio_data()
226 for (count = inb(ICEREG1724(ice, MPU_RXFIFO)); count > 0; --count) in vt1724_midi_clear_rx()
233 return list_first_entry(&ice->rmidi[0]->streams[stream].substreams, in get_rawmidi_substream()
246 count = 31 - inb(ICEREG1724(ice, MPU_TXFIFO)); in vt1724_midi_write()
275 /* call with ice->reg_lock */
289 struct snd_ice1712 *ice = substream->rmidi->private_data; in vt1724_enable_midi_irq()
291 spin_lock_irq(&ice->reg_lock); in vt1724_enable_midi_irq()
293 spin_unlock_irq(&ice->reg_lock); in vt1724_enable_midi_irq()
308 struct snd_ice1712 *ice = s->rmidi->private_data; in vt1724_midi_output_trigger()
311 spin_lock_irqsave(&ice->reg_lock, flags); in vt1724_midi_output_trigger()
313 ice->midi_output = 1; in vt1724_midi_output_trigger()
316 ice->midi_output = 0; in vt1724_midi_output_trigger()
319 spin_unlock_irqrestore(&ice->reg_lock, flags); in vt1724_midi_output_trigger()
324 struct snd_ice1712 *ice = s->rmidi->private_data; in vt1724_midi_output_drain()
346 vt1724_midi_clear_rx(s->rmidi->private_data); in vt1724_midi_input_open()
359 struct snd_ice1712 *ice = s->rmidi->private_data; in vt1724_midi_input_trigger()
362 spin_lock_irqsave(&ice->reg_lock, flags); in vt1724_midi_input_trigger()
364 ice->midi_input = 1; in vt1724_midi_input_trigger()
367 ice->midi_input = 0; in vt1724_midi_input_trigger()
369 spin_unlock_irqrestore(&ice->reg_lock, flags); in vt1724_midi_input_trigger()
397 spin_lock(&ice->reg_lock); in snd_vt1724_interrupt()
400 dev_err(ice->card->dev, in snd_vt1724_interrupt()
403 dev_err(ice->card->dev, "Disabling MPU_TX\n"); in snd_vt1724_interrupt()
406 spin_unlock(&ice->reg_lock); in snd_vt1724_interrupt()
411 if (ice->midi_output) in snd_vt1724_interrupt()
423 if (ice->midi_input) in snd_vt1724_interrupt()
430 spin_unlock(&ice->reg_lock); in snd_vt1724_interrupt()
433 * Multi-track PCM in snd_vt1724_interrupt()
445 if (ice->playback_pro_substream) in snd_vt1724_interrupt()
446 snd_pcm_period_elapsed(ice->playback_pro_substream); in snd_vt1724_interrupt()
449 if (ice->capture_pro_substream) in snd_vt1724_interrupt()
450 snd_pcm_period_elapsed(ice->capture_pro_substream); in snd_vt1724_interrupt()
453 if (ice->playback_con_substream_ds[0]) in snd_vt1724_interrupt()
454 snd_pcm_period_elapsed(ice->playback_con_substream_ds[0]); in snd_vt1724_interrupt()
457 if (ice->playback_con_substream_ds[1]) in snd_vt1724_interrupt()
458 snd_pcm_period_elapsed(ice->playback_con_substream_ds[1]); in snd_vt1724_interrupt()
461 if (ice->playback_con_substream_ds[2]) in snd_vt1724_interrupt()
462 snd_pcm_period_elapsed(ice->playback_con_substream_ds[2]); in snd_vt1724_interrupt()
465 if (ice->playback_con_substream) in snd_vt1724_interrupt()
466 snd_pcm_period_elapsed(ice->playback_con_substream); in snd_vt1724_interrupt()
469 if (ice->capture_con_substream) in snd_vt1724_interrupt()
470 snd_pcm_period_elapsed(ice->capture_con_substream); in snd_vt1724_interrupt()
488 * PCM code - professional part (multitrack)
498 .count = ARRAY_SIZE(rates) - 2, /* up to 96000 */
504 .count = ARRAY_SIZE(rates) - 5, /* up to 48000 */
533 reg = s->runtime->private_data; in snd_vt1724_pcm_trigger()
534 what |= reg->start; in snd_vt1724_pcm_trigger()
542 spin_lock(&ice->reg_lock); in snd_vt1724_pcm_trigger()
549 spin_unlock(&ice->reg_lock); in snd_vt1724_pcm_trigger()
555 spin_lock(&ice->reg_lock); in snd_vt1724_pcm_trigger()
562 spin_unlock(&ice->reg_lock); in snd_vt1724_pcm_trigger()
570 return -EINVAL; in snd_vt1724_pcm_trigger()
609 if (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S) { in stdclock_set_mclk()
633 if (rate > ice->hw_rates->list[ice->hw_rates->count - 1]) in snd_vt1724_set_pro_rate()
634 return -EINVAL; in snd_vt1724_set_pro_rate()
636 spin_lock_irqsave(&ice->reg_lock, flags); in snd_vt1724_set_pro_rate()
640 spin_unlock_irqrestore(&ice->reg_lock, flags); in snd_vt1724_set_pro_rate()
641 return ((rate == ice->cur_rate) && !force) ? 0 : -EBUSY; in snd_vt1724_set_pro_rate()
644 /* comparing required and current rate - makes sense for in snd_vt1724_set_pro_rate()
646 spin_unlock_irqrestore(&ice->reg_lock, flags); in snd_vt1724_set_pro_rate()
647 return (rate == ice->cur_rate) ? 0 : -EBUSY; in snd_vt1724_set_pro_rate()
650 if (force || !ice->is_spdif_master(ice)) { in snd_vt1724_set_pro_rate()
653 old_rate = ice->get_rate(ice); in snd_vt1724_set_pro_rate()
656 else if (rate == ice->cur_rate) { in snd_vt1724_set_pro_rate()
657 spin_unlock_irqrestore(&ice->reg_lock, flags); in snd_vt1724_set_pro_rate()
662 ice->cur_rate = rate; in snd_vt1724_set_pro_rate()
663 spin_unlock_irqrestore(&ice->reg_lock, flags); in snd_vt1724_set_pro_rate()
666 ice->set_rate(ice, rate); in snd_vt1724_set_pro_rate()
669 mclk_change = ice->set_mclk(ice, rate); in snd_vt1724_set_pro_rate()
671 if (mclk_change && ice->gpio.i2s_mclk_changed) in snd_vt1724_set_pro_rate()
672 ice->gpio.i2s_mclk_changed(ice); in snd_vt1724_set_pro_rate()
673 if (ice->gpio.set_pro_rate) in snd_vt1724_set_pro_rate()
674 ice->gpio.set_pro_rate(ice, rate); in snd_vt1724_set_pro_rate()
677 for (i = 0; i < ice->akm_codecs; i++) { in snd_vt1724_set_pro_rate()
678 if (ice->akm[i].ops.set_rate_val) in snd_vt1724_set_pro_rate()
679 ice->akm[i].ops.set_rate_val(&ice->akm[i], rate); in snd_vt1724_set_pro_rate()
681 if (ice->spdif.ops.setup_rate) in snd_vt1724_set_pro_rate()
682 ice->spdif.ops.setup_rate(ice, rate); in snd_vt1724_set_pro_rate()
694 mutex_lock(&ice->open_mutex); in snd_vt1724_pcm_hw_params()
696 if (substream == ice->playback_pro_substream) { in snd_vt1724_pcm_hw_params()
697 /* PDMA0 can be multi-channel up to 8 */ in snd_vt1724_pcm_hw_params()
698 chs = chs / 2 - 1; in snd_vt1724_pcm_hw_params()
700 if (ice->pcm_reserved[i] && in snd_vt1724_pcm_hw_params()
701 ice->pcm_reserved[i] != substream) { in snd_vt1724_pcm_hw_params()
702 mutex_unlock(&ice->open_mutex); in snd_vt1724_pcm_hw_params()
703 return -EBUSY; in snd_vt1724_pcm_hw_params()
705 ice->pcm_reserved[i] = substream; in snd_vt1724_pcm_hw_params()
708 if (ice->pcm_reserved[i] == substream) in snd_vt1724_pcm_hw_params()
709 ice->pcm_reserved[i] = NULL; in snd_vt1724_pcm_hw_params()
714 if (ice->playback_con_substream_ds[i] == substream) { in snd_vt1724_pcm_hw_params()
715 if (ice->pcm_reserved[i] && in snd_vt1724_pcm_hw_params()
716 ice->pcm_reserved[i] != substream) { in snd_vt1724_pcm_hw_params()
717 mutex_unlock(&ice->open_mutex); in snd_vt1724_pcm_hw_params()
718 return -EBUSY; in snd_vt1724_pcm_hw_params()
720 ice->pcm_reserved[i] = substream; in snd_vt1724_pcm_hw_params()
725 mutex_unlock(&ice->open_mutex); in snd_vt1724_pcm_hw_params()
735 mutex_lock(&ice->open_mutex); in snd_vt1724_pcm_hw_free()
738 if (ice->pcm_reserved[i] == substream) in snd_vt1724_pcm_hw_free()
739 ice->pcm_reserved[i] = NULL; in snd_vt1724_pcm_hw_free()
740 mutex_unlock(&ice->open_mutex); in snd_vt1724_pcm_hw_free()
750 spin_lock_irq(&ice->reg_lock); in snd_vt1724_playback_pro_prepare()
751 val = (8 - substream->runtime->channels) >> 1; in snd_vt1724_playback_pro_prepare()
754 outl(substream->runtime->dma_addr, ICEMT1724(ice, PLAYBACK_ADDR)); in snd_vt1724_playback_pro_prepare()
756 size = (snd_pcm_lib_buffer_bytes(substream) >> 2) - 1; in snd_vt1724_playback_pro_prepare()
760 size = (snd_pcm_lib_period_bytes(substream) >> 2) - 1; in snd_vt1724_playback_pro_prepare()
765 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_playback_pro_prepare()
768 dev_dbg(ice->card->dev, "pro prepare: ch = %d, addr = 0x%x, " in snd_vt1724_playback_pro_prepare()
770 substream->runtime->channels, in snd_vt1724_playback_pro_prepare()
771 (unsigned int)substream->runtime->dma_addr, in snd_vt1724_playback_pro_prepare()
787 if (ptr < substream->runtime->dma_addr) { in snd_vt1724_playback_pro_pointer()
788 dev_dbg(ice->card->dev, "invalid negative ptr\n"); in snd_vt1724_playback_pro_pointer()
791 ptr -= substream->runtime->dma_addr; in snd_vt1724_playback_pro_pointer()
792 ptr = bytes_to_frames(substream->runtime, ptr); in snd_vt1724_playback_pro_pointer()
793 if (ptr >= substream->runtime->buffer_size) { in snd_vt1724_playback_pro_pointer()
794 dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n", in snd_vt1724_playback_pro_pointer()
795 (int)ptr, (int)substream->runtime->period_size); in snd_vt1724_playback_pro_pointer()
801 ptr = bytes_to_frames(substream->runtime, ptr); in snd_vt1724_playback_pro_pointer()
804 else if (ptr <= substream->runtime->buffer_size) in snd_vt1724_playback_pro_pointer()
805 ptr = substream->runtime->buffer_size - ptr; in snd_vt1724_playback_pro_pointer()
807 dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n", in snd_vt1724_playback_pro_pointer()
808 (int)ptr, (int)substream->runtime->buffer_size); in snd_vt1724_playback_pro_pointer()
818 const struct vt1724_pcm_reg *reg = substream->runtime->private_data; in snd_vt1724_pcm_prepare()
820 spin_lock_irq(&ice->reg_lock); in snd_vt1724_pcm_prepare()
821 outl(substream->runtime->dma_addr, ice->profi_port + reg->addr); in snd_vt1724_pcm_prepare()
822 outw((snd_pcm_lib_buffer_bytes(substream) >> 2) - 1, in snd_vt1724_pcm_prepare()
823 ice->profi_port + reg->size); in snd_vt1724_pcm_prepare()
824 outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, in snd_vt1724_pcm_prepare()
825 ice->profi_port + reg->count); in snd_vt1724_pcm_prepare()
826 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_pcm_prepare()
833 const struct vt1724_pcm_reg *reg = substream->runtime->private_data; in snd_vt1724_pcm_pointer()
836 if (!(inl(ICEMT1724(ice, DMA_CONTROL)) & reg->start)) in snd_vt1724_pcm_pointer()
839 ptr = inl(ice->profi_port + reg->addr); in snd_vt1724_pcm_pointer()
840 ptr -= substream->runtime->dma_addr; in snd_vt1724_pcm_pointer()
841 return bytes_to_frames(substream->runtime, ptr); in snd_vt1724_pcm_pointer()
843 ptr = inw(ice->profi_port + reg->size); in snd_vt1724_pcm_pointer()
845 ptr = bytes_to_frames(substream->runtime, ptr); in snd_vt1724_pcm_pointer()
848 else if (ptr <= substream->runtime->buffer_size) in snd_vt1724_pcm_pointer()
849 ptr = substream->runtime->buffer_size - ptr; in snd_vt1724_pcm_pointer()
851 dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n", in snd_vt1724_pcm_pointer()
852 (int)ptr, (int)substream->runtime->buffer_size); in snd_vt1724_pcm_pointer()
954 if (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S) { in set_std_hw_rates()
957 if ((ice->eeprom.data[ICE_EEP2_I2S] & 0x08) && !ice->vt1720) in set_std_hw_rates()
958 ice->hw_rates = &hw_constraints_rates_192; in set_std_hw_rates()
960 ice->hw_rates = &hw_constraints_rates_96; in set_std_hw_rates()
963 ice->hw_rates = &hw_constraints_rates_48; in set_std_hw_rates()
970 struct snd_pcm_runtime *runtime = substream->runtime; in set_rate_constraints()
972 runtime->hw.rate_min = ice->hw_rates->list[0]; in set_rate_constraints()
973 runtime->hw.rate_max = ice->hw_rates->list[ice->hw_rates->count - 1]; in set_rate_constraints()
974 runtime->hw.rates = SNDRV_PCM_RATE_KNOT; in set_rate_constraints()
977 ice->hw_rates); in set_rate_constraints()
986 struct snd_pcm_runtime *runtime = substream->runtime; in constrain_rate_if_locked()
989 rate = ice->get_rate(ice); in constrain_rate_if_locked()
990 if (rate >= runtime->hw.rate_min in constrain_rate_if_locked()
991 && rate <= runtime->hw.rate_max) { in constrain_rate_if_locked()
992 runtime->hw.rate_min = rate; in constrain_rate_if_locked()
993 runtime->hw.rate_max = rate; in constrain_rate_if_locked()
999 /* multi-channel playback needs alignment 8x32bit regardless of the channels
1006 struct snd_pcm_runtime *runtime = substream->runtime; in snd_vt1724_playback_pro_open()
1010 runtime->private_data = (void *)&vt1724_playback_pro_reg; in snd_vt1724_playback_pro_open()
1011 ice->playback_pro_substream = substream; in snd_vt1724_playback_pro_open()
1012 runtime->hw = snd_vt1724_playback_pro; in snd_vt1724_playback_pro_open()
1016 mutex_lock(&ice->open_mutex); in snd_vt1724_playback_pro_open()
1018 num_indeps = ice->num_total_dacs / 2 - 1; in snd_vt1724_playback_pro_open()
1020 if (ice->pcm_reserved[chs]) in snd_vt1724_playback_pro_open()
1024 runtime->hw.channels_max = chs; in snd_vt1724_playback_pro_open()
1027 mutex_unlock(&ice->open_mutex); in snd_vt1724_playback_pro_open()
1033 if (ice->pro_open) in snd_vt1724_playback_pro_open()
1034 ice->pro_open(ice, substream); in snd_vt1724_playback_pro_open()
1041 struct snd_pcm_runtime *runtime = substream->runtime; in snd_vt1724_capture_pro_open()
1043 runtime->private_data = (void *)&vt1724_capture_pro_reg; in snd_vt1724_capture_pro_open()
1044 ice->capture_pro_substream = substream; in snd_vt1724_capture_pro_open()
1045 runtime->hw = snd_vt1724_2ch_stereo; in snd_vt1724_capture_pro_open()
1054 if (ice->pro_open) in snd_vt1724_capture_pro_open()
1055 ice->pro_open(ice, substream); in snd_vt1724_capture_pro_open()
1064 snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 0); in snd_vt1724_playback_pro_close()
1065 ice->playback_pro_substream = NULL; in snd_vt1724_playback_pro_close()
1075 snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 0); in snd_vt1724_capture_pro_close()
1076 ice->capture_pro_substream = NULL; in snd_vt1724_capture_pro_close()
1105 if ((ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_ADC_MASK) == in snd_vt1724_pcm_profi()
1110 err = snd_pcm_new(ice->card, "ICE1724", device, 1, capt, &pcm); in snd_vt1724_pcm_profi()
1119 pcm->private_data = ice; in snd_vt1724_pcm_profi()
1120 pcm->info_flags = 0; in snd_vt1724_pcm_profi()
1121 strcpy(pcm->name, "ICE1724"); in snd_vt1724_pcm_profi()
1124 &ice->pci->dev, 256*1024, 256*1024); in snd_vt1724_pcm_profi()
1126 ice->pcm_pro = pcm; in snd_vt1724_pcm_profi()
1157 spin_lock_irqsave(&ice->reg_lock, flags); in update_spdif_rate()
1171 spin_unlock_irqrestore(&ice->reg_lock, flags); in update_spdif_rate()
1177 if (!ice->force_pdma4) in snd_vt1724_playback_spdif_prepare()
1178 update_spdif_rate(ice, substream->runtime->rate); in snd_vt1724_playback_spdif_prepare()
1185 struct snd_pcm_runtime *runtime = substream->runtime; in snd_vt1724_playback_spdif_open()
1187 runtime->private_data = (void *)&vt1724_playback_spdif_reg; in snd_vt1724_playback_spdif_open()
1188 ice->playback_con_substream = substream; in snd_vt1724_playback_spdif_open()
1189 if (ice->force_pdma4) { in snd_vt1724_playback_spdif_open()
1190 runtime->hw = snd_vt1724_2ch_stereo; in snd_vt1724_playback_spdif_open()
1193 runtime->hw = snd_vt1724_spdif; in snd_vt1724_playback_spdif_open()
1201 if (ice->spdif.ops.open) in snd_vt1724_playback_spdif_open()
1202 ice->spdif.ops.open(ice, substream); in snd_vt1724_playback_spdif_open()
1211 snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 0); in snd_vt1724_playback_spdif_close()
1212 ice->playback_con_substream = NULL; in snd_vt1724_playback_spdif_close()
1213 if (ice->spdif.ops.close) in snd_vt1724_playback_spdif_close()
1214 ice->spdif.ops.close(ice, substream); in snd_vt1724_playback_spdif_close()
1222 struct snd_pcm_runtime *runtime = substream->runtime; in snd_vt1724_capture_spdif_open()
1224 runtime->private_data = (void *)&vt1724_capture_spdif_reg; in snd_vt1724_capture_spdif_open()
1225 ice->capture_con_substream = substream; in snd_vt1724_capture_spdif_open()
1226 if (ice->force_rdma1) { in snd_vt1724_capture_spdif_open()
1227 runtime->hw = snd_vt1724_2ch_stereo; in snd_vt1724_capture_spdif_open()
1230 runtime->hw = snd_vt1724_spdif; in snd_vt1724_capture_spdif_open()
1238 if (ice->spdif.ops.open) in snd_vt1724_capture_spdif_open()
1239 ice->spdif.ops.open(ice, substream); in snd_vt1724_capture_spdif_open()
1248 snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 0); in snd_vt1724_capture_spdif_close()
1249 ice->capture_con_substream = NULL; in snd_vt1724_capture_spdif_close()
1250 if (ice->spdif.ops.close) in snd_vt1724_capture_spdif_close()
1251 ice->spdif.ops.close(ice, substream); in snd_vt1724_capture_spdif_close()
1279 char *name; in snd_vt1724_pcm_spdif() local
1284 if (ice->force_pdma4 || in snd_vt1724_pcm_spdif()
1285 (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_OUT_INT)) { in snd_vt1724_pcm_spdif()
1287 ice->has_spdif = 1; in snd_vt1724_pcm_spdif()
1290 if (ice->force_rdma1 || in snd_vt1724_pcm_spdif()
1291 (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_IN)) { in snd_vt1724_pcm_spdif()
1293 ice->has_spdif = 1; in snd_vt1724_pcm_spdif()
1299 if (ice->force_pdma4 || ice->force_rdma1) in snd_vt1724_pcm_spdif()
1300 name = "ICE1724 Secondary"; in snd_vt1724_pcm_spdif()
1302 name = "ICE1724 IEC958"; in snd_vt1724_pcm_spdif()
1303 err = snd_pcm_new(ice->card, name, device, play, capt, &pcm); in snd_vt1724_pcm_spdif()
1314 pcm->private_data = ice; in snd_vt1724_pcm_spdif()
1315 pcm->info_flags = 0; in snd_vt1724_pcm_spdif()
1316 strcpy(pcm->name, name); in snd_vt1724_pcm_spdif()
1319 &ice->pci->dev, 256*1024, 256*1024); in snd_vt1724_pcm_spdif()
1321 ice->pcm = pcm; in snd_vt1724_pcm_spdif()
1357 spin_lock_irq(&ice->reg_lock); in snd_vt1724_playback_indep_prepare()
1358 val = 3 - substream->number; in snd_vt1724_playback_indep_prepare()
1361 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_playback_indep_prepare()
1368 struct snd_pcm_runtime *runtime = substream->runtime; in snd_vt1724_playback_indep_open()
1370 mutex_lock(&ice->open_mutex); in snd_vt1724_playback_indep_open()
1372 if (ice->pcm_reserved[substream->number]) { in snd_vt1724_playback_indep_open()
1373 mutex_unlock(&ice->open_mutex); in snd_vt1724_playback_indep_open()
1374 return -EBUSY; /* FIXME: should handle blocking mode properly */ in snd_vt1724_playback_indep_open()
1376 mutex_unlock(&ice->open_mutex); in snd_vt1724_playback_indep_open()
1377 runtime->private_data = (void *)&vt1724_playback_dma_regs[substream->number]; in snd_vt1724_playback_indep_open()
1378 ice->playback_con_substream_ds[substream->number] = substream; in snd_vt1724_playback_indep_open()
1379 runtime->hw = snd_vt1724_2ch_stereo; in snd_vt1724_playback_indep_open()
1391 snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 0); in snd_vt1724_playback_indep_close()
1392 ice->playback_con_substream_ds[substream->number] = NULL; in snd_vt1724_playback_indep_close()
1393 ice->pcm_reserved[substream->number] = NULL; in snd_vt1724_playback_indep_close()
1415 play = ice->num_total_dacs / 2 - 1; in snd_vt1724_pcm_indep()
1419 err = snd_pcm_new(ice->card, "ICE1724 Surrounds", device, play, 0, &pcm); in snd_vt1724_pcm_indep()
1426 pcm->private_data = ice; in snd_vt1724_pcm_indep()
1427 pcm->info_flags = 0; in snd_vt1724_pcm_indep()
1428 strcpy(pcm->name, "ICE1724 Surround PCM"); in snd_vt1724_pcm_indep()
1431 &ice->pci->dev, 256*1024, 256*1024); in snd_vt1724_pcm_indep()
1433 ice->pcm_ds = pcm; in snd_vt1724_pcm_indep()
1447 if (!(ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) { in snd_vt1724_ac97_mixer()
1460 err = snd_ac97_bus(ice->card, 0, &ops, NULL, &pbus); in snd_vt1724_ac97_mixer()
1465 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); in snd_vt1724_ac97_mixer()
1467 dev_warn(ice->card->dev, in snd_vt1724_ac97_mixer()
1473 strcat(ice->card->mixername, "ICE1724 - multitrack"); in snd_vt1724_ac97_mixer()
1483 return (unsigned int)ice->eeprom.data[idx] | \ in eeprom_triple()
1484 ((unsigned int)ice->eeprom.data[idx + 1] << 8) | \ in eeprom_triple()
1485 ((unsigned int)ice->eeprom.data[idx + 2] << 16); in eeprom_triple()
1491 struct snd_ice1712 *ice = entry->private_data; in snd_vt1724_proc_read()
1494 snd_iprintf(buffer, "%s\n\n", ice->card->longname); in snd_vt1724_proc_read()
1495 snd_iprintf(buffer, "EEPROM:\n"); in snd_vt1724_proc_read()
1497 snd_iprintf(buffer, " Subvendor : 0x%x\n", ice->eeprom.subvendor); in snd_vt1724_proc_read()
1498 snd_iprintf(buffer, " Size : %i bytes\n", ice->eeprom.size); in snd_vt1724_proc_read()
1499 snd_iprintf(buffer, " Version : %i\n", ice->eeprom.version); in snd_vt1724_proc_read()
1501 ice->eeprom.data[ICE_EEP2_SYSCONF]); in snd_vt1724_proc_read()
1503 ice->eeprom.data[ICE_EEP2_ACLINK]); in snd_vt1724_proc_read()
1505 ice->eeprom.data[ICE_EEP2_I2S]); in snd_vt1724_proc_read()
1507 ice->eeprom.data[ICE_EEP2_SPDIF]); in snd_vt1724_proc_read()
1509 ice->eeprom.gpiodir); in snd_vt1724_proc_read()
1511 ice->eeprom.gpiomask); in snd_vt1724_proc_read()
1513 ice->eeprom.gpiostate); in snd_vt1724_proc_read()
1514 for (idx = 0x12; idx < ice->eeprom.size; idx++) in snd_vt1724_proc_read()
1516 idx, ice->eeprom.data[idx]); in snd_vt1724_proc_read()
1524 idx, inb(ice->port+idx)); in snd_vt1724_proc_read()
1527 idx, inb(ice->profi_port+idx)); in snd_vt1724_proc_read()
1532 snd_card_ro_proc_new(ice->card, "ice1724", ice, snd_vt1724_proc_read); in snd_vt1724_proc_init()
1542 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; in snd_vt1724_eeprom_info()
1543 uinfo->count = sizeof(struct snd_ice1712_eeprom); in snd_vt1724_eeprom_info()
1552 memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); in snd_vt1724_eeprom_get()
1558 .name = "ICE1724 EEPROM",
1569 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; in snd_vt1724_spdif_info()
1570 uinfo->count = 1; in snd_vt1724_spdif_info()
1578 val = diga->status[0] & 0x03; /* professional, non-audio */ in encode_spdif_bits()
1581 if ((diga->status[0] & IEC958_AES0_PRO_EMPHASIS) == in encode_spdif_bits()
1584 rbits = (diga->status[4] >> 3) & 0x0f; in encode_spdif_bits()
1593 switch (diga->status[0] & IEC958_AES0_PRO_FS) { in encode_spdif_bits()
1606 val |= diga->status[1] & 0x04; /* copyright */ in encode_spdif_bits()
1607 if ((diga->status[0] & IEC958_AES0_CON_EMPHASIS) == in encode_spdif_bits()
1610 val |= (unsigned int)(diga->status[1] & 0x3f) << 4; /* category */ in encode_spdif_bits()
1611 val |= (unsigned int)(diga->status[3] & IEC958_AES3_CON_FS) << 12; /* fs */ in encode_spdif_bits()
1618 memset(diga->status, 0, sizeof(diga->status)); in decode_spdif_bits()
1619 diga->status[0] = val & 0x03; /* professional, non-audio */ in decode_spdif_bits()
1623 diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_5015; in decode_spdif_bits()
1628 diga->status[0] |= IEC958_AES0_PRO_FS_32000; in decode_spdif_bits()
1631 diga->status[0] |= IEC958_AES0_PRO_FS_48000; in decode_spdif_bits()
1636 diga->status[0] |= val & (1U << 2); /* copyright */ in decode_spdif_bits()
1638 diga->status[0] |= IEC958_AES0_CON_EMPHASIS_5015; in decode_spdif_bits()
1639 diga->status[1] |= (val >> 4) & 0x3f; /* category */ in decode_spdif_bits()
1640 diga->status[3] |= (val >> 12) & 0x07; /* fs */ in decode_spdif_bits()
1650 decode_spdif_bits(&ucontrol->value.iec958, val); in snd_vt1724_spdif_default_get()
1660 val = encode_spdif_bits(&ucontrol->value.iec958); in snd_vt1724_spdif_default_put()
1661 spin_lock_irq(&ice->reg_lock); in snd_vt1724_spdif_default_put()
1665 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_spdif_default_put()
1672 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
1681 ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO | in snd_vt1724_spdif_maskc_get()
1685 ucontrol->value.iec958.status[1] = IEC958_AES1_CON_ORIGINAL | in snd_vt1724_spdif_maskc_get()
1687 ucontrol->value.iec958.status[3] = IEC958_AES3_CON_FS; in snd_vt1724_spdif_maskc_get()
1694 ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO | in snd_vt1724_spdif_maskp_get()
1705 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK),
1714 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK),
1725 ucontrol->value.integer.value[0] = inb(ICEREG1724(ice, SPDIF_CFG)) & in snd_vt1724_spdif_sw_get()
1736 spin_lock_irq(&ice->reg_lock); in snd_vt1724_spdif_sw_put()
1739 if (ucontrol->value.integer.value[0]) in snd_vt1724_spdif_sw_put()
1743 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_spdif_sw_put()
1751 /* .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH), */
1752 .name = SNDRV_CTL_NAME_IEC958("Output ", NONE, SWITCH),
1770 int shift = kcontrol->private_value & 0xff;
1771 int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0;
1774 ucontrol->value.integer.value[0] =
1784 int shift = kcontrol->private_value & 0xff;
1785 int invert = (kcontrol->private_value & (1<<24)) ? mask : 0;
1788 if (kcontrol->private_value & (1 << 31))
1789 return -EPERM;
1790 nval = (ucontrol->value.integer.value[0] ? (1 << shift) : 0) ^ invert;
1808 int hw_rates_count = ice->hw_rates->count; in snd_vt1724_pro_internal_clock_info()
1809 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in snd_vt1724_pro_internal_clock_info()
1810 uinfo->count = 1; in snd_vt1724_pro_internal_clock_info()
1813 uinfo->value.enumerated.items = hw_rates_count; in snd_vt1724_pro_internal_clock_info()
1815 if (ice->force_rdma1 || in snd_vt1724_pro_internal_clock_info()
1816 (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_IN)) in snd_vt1724_pro_internal_clock_info()
1817 uinfo->value.enumerated.items += ice->ext_clock_count; in snd_vt1724_pro_internal_clock_info()
1818 /* upper limit - keep at top */ in snd_vt1724_pro_internal_clock_info()
1819 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) in snd_vt1724_pro_internal_clock_info()
1820 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; in snd_vt1724_pro_internal_clock_info()
1821 if (uinfo->value.enumerated.item >= hw_rates_count) in snd_vt1724_pro_internal_clock_info()
1823 strcpy(uinfo->value.enumerated.name, in snd_vt1724_pro_internal_clock_info()
1824 ice->ext_clock_names[ in snd_vt1724_pro_internal_clock_info()
1825 uinfo->value.enumerated.item - hw_rates_count]); in snd_vt1724_pro_internal_clock_info()
1828 sprintf(uinfo->value.enumerated.name, "%d", in snd_vt1724_pro_internal_clock_info()
1829 ice->hw_rates->list[uinfo->value.enumerated.item]); in snd_vt1724_pro_internal_clock_info()
1839 spin_lock_irq(&ice->reg_lock); in snd_vt1724_pro_internal_clock_get()
1840 if (ice->is_spdif_master(ice)) { in snd_vt1724_pro_internal_clock_get()
1841 ucontrol->value.enumerated.item[0] = ice->hw_rates->count + in snd_vt1724_pro_internal_clock_get()
1842 ice->get_spdif_master_type(ice); in snd_vt1724_pro_internal_clock_get()
1844 rate = ice->get_rate(ice); in snd_vt1724_pro_internal_clock_get()
1845 ucontrol->value.enumerated.item[0] = 0; in snd_vt1724_pro_internal_clock_get()
1846 for (i = 0; i < ice->hw_rates->count; i++) { in snd_vt1724_pro_internal_clock_get()
1847 if (ice->hw_rates->list[i] == rate) { in snd_vt1724_pro_internal_clock_get()
1848 ucontrol->value.enumerated.item[0] = i; in snd_vt1724_pro_internal_clock_get()
1853 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_pro_internal_clock_get()
1859 /* standard external clock - only single type - SPDIF IN */ in stdclock_get_spdif_master_type()
1863 /* setting clock to external - SPDIF */
1882 unsigned int item = ucontrol->value.enumerated.item[0]; in snd_vt1724_pro_internal_clock_put()
1883 unsigned int first_ext_clock = ice->hw_rates->count; in snd_vt1724_pro_internal_clock_put()
1885 if (item > first_ext_clock + ice->ext_clock_count - 1) in snd_vt1724_pro_internal_clock_put()
1886 return -EINVAL; in snd_vt1724_pro_internal_clock_put()
1889 spin_lock_irq(&ice->reg_lock); in snd_vt1724_pro_internal_clock_put()
1890 if (ice->is_spdif_master(ice)) in snd_vt1724_pro_internal_clock_put()
1893 old_rate = ice->get_rate(ice); in snd_vt1724_pro_internal_clock_put()
1896 ice->set_spdif_clock(ice, item - first_ext_clock); in snd_vt1724_pro_internal_clock_put()
1899 /* internal on-card clock */ in snd_vt1724_pro_internal_clock_put()
1900 new_rate = ice->hw_rates->list[item]; in snd_vt1724_pro_internal_clock_put()
1901 ice->pro_rate_default = new_rate; in snd_vt1724_pro_internal_clock_put()
1902 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_pro_internal_clock_put()
1903 snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1); in snd_vt1724_pro_internal_clock_put()
1904 spin_lock_irq(&ice->reg_lock); in snd_vt1724_pro_internal_clock_put()
1906 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_pro_internal_clock_put()
1912 if (ice->gpio.set_pro_rate) in snd_vt1724_pro_internal_clock_put()
1913 ice->gpio.set_pro_rate(ice, 0); in snd_vt1724_pro_internal_clock_put()
1914 for (i = 0; i < ice->akm_codecs; i++) { in snd_vt1724_pro_internal_clock_put()
1915 if (ice->akm[i].ops.set_rate_val) in snd_vt1724_pro_internal_clock_put()
1916 ice->akm[i].ops.set_rate_val(&ice->akm[i], 0); in snd_vt1724_pro_internal_clock_put()
1924 .name = "Multi Track Internal Clock",
1935 ucontrol->value.integer.value[0] = PRO_RATE_LOCKED; in snd_vt1724_pro_rate_locking_get()
1945 nval = ucontrol->value.integer.value[0] ? 1 : 0; in snd_vt1724_pro_rate_locking_put()
1946 spin_lock_irq(&ice->reg_lock); in snd_vt1724_pro_rate_locking_put()
1949 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_pro_rate_locking_put()
1955 .name = "Multi Track Rate Locking",
1966 ucontrol->value.integer.value[0] = PRO_RATE_RESET ? 1 : 0; in snd_vt1724_pro_rate_reset_get()
1976 nval = ucontrol->value.integer.value[0] ? 1 : 0; in snd_vt1724_pro_rate_reset_put()
1977 spin_lock_irq(&ice->reg_lock); in snd_vt1724_pro_rate_reset_put()
1980 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_pro_rate_reset_put()
1986 .name = "Multi Track Rate Reset",
2001 "H/W In 0", "H/W In 1", /* 1-2 */ in snd_vt1724_pro_route_info()
2002 "IEC958 In L", "IEC958 In R", /* 3-4 */ in snd_vt1724_pro_route_info()
2064 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_vt1724_pro_route_analog_get()
2065 ucontrol->value.enumerated.item[0] = in snd_vt1724_pro_route_analog_get()
2074 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_vt1724_pro_route_analog_put()
2076 ucontrol->value.enumerated.item[0], in snd_vt1724_pro_route_analog_put()
2084 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_vt1724_pro_route_spdif_get()
2085 ucontrol->value.enumerated.item[0] = in snd_vt1724_pro_route_spdif_get()
2094 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_vt1724_pro_route_spdif_put()
2096 ucontrol->value.enumerated.item[0], in snd_vt1724_pro_route_spdif_put()
2103 .name = "H/W Playback Route",
2111 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route",
2122 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_vt1724_pro_peak_info()
2123 uinfo->count = 22; /* FIXME: for compatibility with ice1712... */ in snd_vt1724_pro_peak_info()
2124 uinfo->value.integer.min = 0; in snd_vt1724_pro_peak_info()
2125 uinfo->value.integer.max = 255; in snd_vt1724_pro_peak_info()
2135 spin_lock_irq(&ice->reg_lock); in snd_vt1724_pro_peak_get()
2138 ucontrol->value.integer.value[idx] = in snd_vt1724_pro_peak_get()
2141 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_pro_peak_get()
2147 .name = "Multi Track Peak",
2161 [ICE_EEP2_SPDIF] = 0xc1, /* out-en, out-int, out-ext */
2178 .name = "ooAoo SQ210a",
2212 while ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY) && t--) in wait_i2c_busy()
2214 if (t == -1) in wait_i2c_busy()
2215 dev_err(ice->card->dev, "i2c busy timeout\n"); in wait_i2c_busy()
2223 mutex_lock(&ice->i2c_mutex); in snd_vt1724_read_i2c()
2229 mutex_unlock(&ice->i2c_mutex); in snd_vt1724_read_i2c()
2231 dev_dbg(ice->card->dev, "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); in snd_vt1724_read_i2c()
2239 mutex_lock(&ice->i2c_mutex); in snd_vt1724_write_i2c()
2242 dev_dbg(ice->card->dev, "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); in snd_vt1724_write_i2c()
2248 mutex_unlock(&ice->i2c_mutex); in snd_vt1724_write_i2c()
2254 const int dev = 0xa0; /* EEPROM device address */ in snd_vt1724_read_eeprom()
2259 ice->eeprom.subvendor = 0; in snd_vt1724_read_eeprom()
2261 ice->eeprom.subvendor = in snd_vt1724_read_eeprom()
2266 if (ice->eeprom.subvendor == 0 || in snd_vt1724_read_eeprom()
2267 ice->eeprom.subvendor == (unsigned int)-1) { in snd_vt1724_read_eeprom()
2268 /* invalid subvendor from EEPROM, try the PCI in snd_vt1724_read_eeprom()
2272 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_VENDOR_ID, in snd_vt1724_read_eeprom()
2274 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device); in snd_vt1724_read_eeprom()
2275 ice->eeprom.subvendor = in snd_vt1724_read_eeprom()
2277 if (ice->eeprom.subvendor == 0 || in snd_vt1724_read_eeprom()
2278 ice->eeprom.subvendor == (unsigned int)-1) { in snd_vt1724_read_eeprom()
2279 dev_err(ice->card->dev, in snd_vt1724_read_eeprom()
2281 return -ENXIO; in snd_vt1724_read_eeprom()
2286 for (c = *tbl; c->name; c++) { in snd_vt1724_read_eeprom()
2287 if (modelname && c->model && in snd_vt1724_read_eeprom()
2288 !strcmp(modelname, c->model)) { in snd_vt1724_read_eeprom()
2289 dev_info(ice->card->dev, in snd_vt1724_read_eeprom()
2291 c->name); in snd_vt1724_read_eeprom()
2292 ice->eeprom.subvendor = c->subvendor; in snd_vt1724_read_eeprom()
2293 } else if (c->subvendor != ice->eeprom.subvendor) in snd_vt1724_read_eeprom()
2295 ice->card_info = c; in snd_vt1724_read_eeprom()
2296 if (!c->eeprom_size || !c->eeprom_data) in snd_vt1724_read_eeprom()
2298 /* if the EEPROM is given by the driver, use it */ in snd_vt1724_read_eeprom()
2299 dev_dbg(ice->card->dev, "using the defined eeprom..\n"); in snd_vt1724_read_eeprom()
2300 ice->eeprom.version = 2; in snd_vt1724_read_eeprom()
2301 ice->eeprom.size = c->eeprom_size + 6; in snd_vt1724_read_eeprom()
2302 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); in snd_vt1724_read_eeprom()
2306 dev_warn(ice->card->dev, "No matching model found for ID 0x%x\n", in snd_vt1724_read_eeprom()
2307 ice->eeprom.subvendor); in snd_vt1724_read_eeprom()
2309 /* assume AC97-only card which can suspend without additional code */ in snd_vt1724_read_eeprom()
2310 ice->pm_suspend_enabled = 1; in snd_vt1724_read_eeprom()
2314 ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04); in snd_vt1724_read_eeprom()
2315 if (ice->eeprom.size < 6) in snd_vt1724_read_eeprom()
2316 ice->eeprom.size = 32; in snd_vt1724_read_eeprom()
2317 else if (ice->eeprom.size > 32) { in snd_vt1724_read_eeprom()
2318 dev_err(ice->card->dev, "Invalid EEPROM (size = %i)\n", in snd_vt1724_read_eeprom()
2319 ice->eeprom.size); in snd_vt1724_read_eeprom()
2320 return -EIO; in snd_vt1724_read_eeprom()
2322 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05); in snd_vt1724_read_eeprom()
2323 if (ice->eeprom.version != 1 && ice->eeprom.version != 2) in snd_vt1724_read_eeprom()
2324 dev_warn(ice->card->dev, "Invalid EEPROM version %i\n", in snd_vt1724_read_eeprom()
2325 ice->eeprom.version); in snd_vt1724_read_eeprom()
2326 size = ice->eeprom.size - 6; in snd_vt1724_read_eeprom()
2328 ice->eeprom.data[i] = snd_vt1724_read_i2c(ice, dev, i + 6); in snd_vt1724_read_eeprom()
2331 ice->eeprom.gpiomask = eeprom_triple(ice, ICE_EEP2_GPIO_MASK); in snd_vt1724_read_eeprom()
2332 ice->eeprom.gpiostate = eeprom_triple(ice, ICE_EEP2_GPIO_STATE); in snd_vt1724_read_eeprom()
2333 ice->eeprom.gpiodir = eeprom_triple(ice, ICE_EEP2_GPIO_DIR); in snd_vt1724_read_eeprom()
2352 outb(ice->eeprom.data[ICE_EEP2_SYSCONF], ICEREG1724(ice, SYS_CFG)); in snd_vt1724_chip_init()
2353 outb(ice->eeprom.data[ICE_EEP2_ACLINK], ICEREG1724(ice, AC97_CFG)); in snd_vt1724_chip_init()
2354 outb(ice->eeprom.data[ICE_EEP2_I2S], ICEREG1724(ice, I2S_FEATURES)); in snd_vt1724_chip_init()
2355 outb(ice->eeprom.data[ICE_EEP2_SPDIF], ICEREG1724(ice, SPDIF_CFG)); in snd_vt1724_chip_init()
2357 ice->gpio.write_mask = ice->eeprom.gpiomask; in snd_vt1724_chip_init()
2358 ice->gpio.direction = ice->eeprom.gpiodir; in snd_vt1724_chip_init()
2359 snd_vt1724_set_gpio_mask(ice, ice->eeprom.gpiomask); in snd_vt1724_chip_init()
2360 snd_vt1724_set_gpio_dir(ice, ice->eeprom.gpiodir); in snd_vt1724_chip_init()
2361 snd_vt1724_set_gpio_data(ice, ice->eeprom.gpiostate); in snd_vt1724_chip_init()
2381 if (snd_BUG_ON(!ice->pcm)) in snd_vt1724_spdif_build_controls()
2382 return -EIO; in snd_vt1724_spdif_build_controls()
2384 if (!ice->own_routing) { in snd_vt1724_spdif_build_controls()
2385 err = snd_ctl_add(ice->card, in snd_vt1724_spdif_build_controls()
2391 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_spdif_switch, ice)); in snd_vt1724_spdif_build_controls()
2396 kctl->id.device = ice->pcm->device; in snd_vt1724_spdif_build_controls()
2397 err = snd_ctl_add(ice->card, kctl); in snd_vt1724_spdif_build_controls()
2401 kctl->id.device = ice->pcm->device; in snd_vt1724_spdif_build_controls()
2402 err = snd_ctl_add(ice->card, kctl); in snd_vt1724_spdif_build_controls()
2406 kctl->id.device = ice->pcm->device; in snd_vt1724_spdif_build_controls()
2407 err = snd_ctl_add(ice->card, kctl); in snd_vt1724_spdif_build_controls()
2412 kctl->id.device = ice->pcm->device; in snd_vt1724_spdif_build_controls()
2413 err = snd_ctl_add(ice->card, kctl); in snd_vt1724_spdif_build_controls()
2416 ice->spdif.stream_ctl = kctl; in snd_vt1724_spdif_build_controls()
2426 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_eeprom, ice)); in snd_vt1724_build_controls()
2429 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_pro_internal_clock, ice)); in snd_vt1724_build_controls()
2433 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_pro_rate_locking, ice)); in snd_vt1724_build_controls()
2436 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_pro_rate_reset, ice)); in snd_vt1724_build_controls()
2440 if (!ice->own_routing && ice->num_total_dacs > 0) { in snd_vt1724_build_controls()
2442 tmp.count = ice->num_total_dacs; in snd_vt1724_build_controls()
2443 if (ice->vt1720 && tmp.count > 2) in snd_vt1724_build_controls()
2445 err = snd_ctl_add(ice->card, snd_ctl_new1(&tmp, ice)); in snd_vt1724_build_controls()
2450 return snd_ctl_add(ice->card, in snd_vt1724_build_controls()
2456 struct snd_ice1712 *ice = card->private_data; in snd_vt1724_free()
2469 struct snd_ice1712 *ice = card->private_data; in snd_vt1724_create()
2477 ice->vt1724 = 1; in snd_vt1724_create()
2478 spin_lock_init(&ice->reg_lock); in snd_vt1724_create()
2479 mutex_init(&ice->gpio_mutex); in snd_vt1724_create()
2480 mutex_init(&ice->open_mutex); in snd_vt1724_create()
2481 mutex_init(&ice->i2c_mutex); in snd_vt1724_create()
2482 ice->gpio.set_mask = snd_vt1724_set_gpio_mask; in snd_vt1724_create()
2483 ice->gpio.get_mask = snd_vt1724_get_gpio_mask; in snd_vt1724_create()
2484 ice->gpio.set_dir = snd_vt1724_set_gpio_dir; in snd_vt1724_create()
2485 ice->gpio.get_dir = snd_vt1724_get_gpio_dir; in snd_vt1724_create()
2486 ice->gpio.set_data = snd_vt1724_set_gpio_data; in snd_vt1724_create()
2487 ice->gpio.get_data = snd_vt1724_get_gpio_data; in snd_vt1724_create()
2488 ice->card = card; in snd_vt1724_create()
2489 ice->pci = pci; in snd_vt1724_create()
2490 ice->irq = -1; in snd_vt1724_create()
2497 ice->port = pci_resource_start(pci, 0); in snd_vt1724_create()
2498 ice->profi_port = pci_resource_start(pci, 1); in snd_vt1724_create()
2500 if (devm_request_irq(&pci->dev, pci->irq, snd_vt1724_interrupt, in snd_vt1724_create()
2502 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); in snd_vt1724_create()
2503 return -EIO; in snd_vt1724_create()
2506 ice->irq = pci->irq; in snd_vt1724_create()
2507 card->sync_irq = ice->irq; in snd_vt1724_create()
2508 card->private_free = snd_vt1724_free; in snd_vt1724_create()
2512 return -EIO; in snd_vt1724_create()
2514 return -EIO; in snd_vt1724_create()
2536 return -ENODEV; in __snd_vt1724_probe()
2539 return -ENOENT; in __snd_vt1724_probe()
2542 err = snd_devm_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, in __snd_vt1724_probe()
2546 ice = card->private_data; in __snd_vt1724_probe()
2548 strcpy(card->driver, "ICE1724"); in __snd_vt1724_probe()
2549 strcpy(card->shortname, "ICEnsemble ICE1724"); in __snd_vt1724_probe()
2556 ice->ext_clock_count = 0; in __snd_vt1724_probe()
2558 c = ice->card_info; in __snd_vt1724_probe()
2560 strcpy(card->shortname, c->name); in __snd_vt1724_probe()
2561 if (c->driver) /* specific driver? */ in __snd_vt1724_probe()
2562 strcpy(card->driver, c->driver); in __snd_vt1724_probe()
2563 if (c->chip_init) { in __snd_vt1724_probe()
2564 err = c->chip_init(ice); in __snd_vt1724_probe()
2578 ice->pro_rate_default = PRO_RATE_DEFAULT; in __snd_vt1724_probe()
2579 if (!ice->is_spdif_master) in __snd_vt1724_probe()
2580 ice->is_spdif_master = stdclock_is_spdif_master; in __snd_vt1724_probe()
2581 if (!ice->get_rate) in __snd_vt1724_probe()
2582 ice->get_rate = stdclock_get_rate; in __snd_vt1724_probe()
2583 if (!ice->set_rate) in __snd_vt1724_probe()
2584 ice->set_rate = stdclock_set_rate; in __snd_vt1724_probe()
2585 if (!ice->set_mclk) in __snd_vt1724_probe()
2586 ice->set_mclk = stdclock_set_mclk; in __snd_vt1724_probe()
2587 if (!ice->set_spdif_clock) in __snd_vt1724_probe()
2588 ice->set_spdif_clock = stdclock_set_spdif_clock; in __snd_vt1724_probe()
2589 if (!ice->get_spdif_master_type) in __snd_vt1724_probe()
2590 ice->get_spdif_master_type = stdclock_get_spdif_master_type; in __snd_vt1724_probe()
2591 if (!ice->ext_clock_names) in __snd_vt1724_probe()
2592 ice->ext_clock_names = ext_clock_names; in __snd_vt1724_probe()
2593 if (!ice->ext_clock_count) in __snd_vt1724_probe()
2594 ice->ext_clock_count = ARRAY_SIZE(ext_clock_names); in __snd_vt1724_probe()
2596 if (!ice->hw_rates) in __snd_vt1724_probe()
2619 if (ice->pcm && ice->has_spdif) { /* has SPDIF I/O */ in __snd_vt1724_probe()
2625 if (c && c->build_controls) { in __snd_vt1724_probe()
2626 err = c->build_controls(ice); in __snd_vt1724_probe()
2631 if (!c || !c->no_mpu401) { in __snd_vt1724_probe()
2632 if (ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_MPU401) { in __snd_vt1724_probe()
2638 ice->rmidi[0] = rmidi; in __snd_vt1724_probe()
2639 rmidi->private_data = ice; in __snd_vt1724_probe()
2640 strcpy(rmidi->name, "ICE1724 MIDI"); in __snd_vt1724_probe()
2641 rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | in __snd_vt1724_probe()
2658 sprintf(card->longname, "%s at 0x%lx, irq %i", in __snd_vt1724_probe()
2659 card->shortname, ice->port, ice->irq); in __snd_vt1724_probe()
2672 return snd_card_free_on_error(&pci->dev, __snd_vt1724_probe(pci, pci_id)); in snd_vt1724_probe()
2679 struct snd_ice1712 *ice = card->private_data; in snd_vt1724_suspend()
2681 if (!ice->pm_suspend_enabled) in snd_vt1724_suspend()
2686 snd_ac97_suspend(ice->ac97); in snd_vt1724_suspend()
2688 spin_lock_irq(&ice->reg_lock); in snd_vt1724_suspend()
2689 ice->pm_saved_is_spdif_master = ice->is_spdif_master(ice); in snd_vt1724_suspend()
2690 ice->pm_saved_spdif_ctrl = inw(ICEMT1724(ice, SPDIF_CTRL)); in snd_vt1724_suspend()
2691 ice->pm_saved_spdif_cfg = inb(ICEREG1724(ice, SPDIF_CFG)); in snd_vt1724_suspend()
2692 ice->pm_saved_route = inl(ICEMT1724(ice, ROUTE_PLAYBACK)); in snd_vt1724_suspend()
2693 spin_unlock_irq(&ice->reg_lock); in snd_vt1724_suspend()
2695 if (ice->pm_suspend) in snd_vt1724_suspend()
2696 ice->pm_suspend(ice); in snd_vt1724_suspend()
2703 struct snd_ice1712 *ice = card->private_data; in snd_vt1724_resume()
2705 if (!ice->pm_suspend_enabled) in snd_vt1724_resume()
2712 return -EIO; in snd_vt1724_resume()
2715 if (ice->pm_resume) in snd_vt1724_resume()
2716 ice->pm_resume(ice); in snd_vt1724_resume()
2718 if (ice->pm_saved_is_spdif_master) { in snd_vt1724_resume()
2720 ice->set_spdif_clock(ice, 0); in snd_vt1724_resume()
2722 /* internal on-card clock */ in snd_vt1724_resume()
2724 if (ice->cur_rate) in snd_vt1724_resume()
2725 rate = ice->cur_rate; in snd_vt1724_resume()
2727 rate = ice->pro_rate_default; in snd_vt1724_resume()
2731 update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); in snd_vt1724_resume()
2733 outb(ice->pm_saved_spdif_cfg, ICEREG1724(ice, SPDIF_CFG)); in snd_vt1724_resume()
2734 outl(ice->pm_saved_route, ICEMT1724(ice, ROUTE_PLAYBACK)); in snd_vt1724_resume()
2736 snd_ac97_resume(ice->ac97); in snd_vt1724_resume()
2749 .name = KBUILD_MODNAME,