Lines Matching +full:eeprom +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0-or-later
10 - spdif nonaudio consumer mode does not work (at least with my
11 Sony STR-DB830)
18 * split the code to several files. each low-level routine
25 * I also haven't done anything with the internal S/PDIF transmitter or the MPU-401
40 #include <linux/dma-mapping.h>
64 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
69 static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transcei…
79 MODULE_PARM_DESC(omni, "Enable Midiman M-Audio Delta Omni I/O support.");
106 /* check whether the clock mode is spdif-in */
133 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_ac97_write()
157 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_ac97_read()
187 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_pro_ac97_write()
212 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_pro_ac97_read()
243 ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_ROUTECTRL)) & ICE1712_ROUTE_AC97 ? 1 : 0; in snd_ice1712_digmix_route_ac97_get()
252 spin_lock_irq(&ice->reg_lock); in snd_ice1712_digmix_route_ac97_put()
255 if (ucontrol->value.integer.value[0]) in snd_ice1712_digmix_route_ac97_put()
258 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_digmix_route_ac97_put()
264 .name = "Digital Mixer To AC97",
277 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ in snd_ice1712_set_gpio_dir()
293 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ in snd_ice1712_set_gpio_mask()
304 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ in snd_ice1712_set_gpio_data()
315 * spdif_clock = 1 - IEC958 input, 0 - Envy24
323 snd_i2c_lock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
324 if (snd_i2c_sendbytes(ice->cs8427, reg, 1) != 1) { in snd_ice1712_cs8427_set_input_clock()
325 snd_i2c_unlock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
326 return -EIO; in snd_ice1712_cs8427_set_input_clock()
328 if (snd_i2c_readbytes(ice->cs8427, &val, 1) != 1) { in snd_ice1712_cs8427_set_input_clock()
329 snd_i2c_unlock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
330 return -EIO; in snd_ice1712_cs8427_set_input_clock()
339 if (snd_i2c_sendbytes(ice->cs8427, reg, 2) != 2) { in snd_ice1712_cs8427_set_input_clock()
340 res = -EIO; in snd_ice1712_cs8427_set_input_clock()
345 snd_i2c_unlock(ice->i2c); in snd_ice1712_cs8427_set_input_clock()
354 snd_cs8427_iec958_active(ice->cs8427, 1); in open_cs8427()
359 snd_cs8427_iec958_active(ice->cs8427, 0); in close_cs8427()
364 snd_cs8427_iec958_pcm(ice->cs8427, rate); in setup_cs8427()
374 err = snd_cs8427_create(ice->i2c, addr, in snd_ice1712_init_cs8427()
375 (ice->cs8427_timeout * HZ) / 1000, &ice->cs8427); in snd_ice1712_init_cs8427()
377 dev_err(ice->card->dev, "CS8427 initialization failed\n"); in snd_ice1712_init_cs8427()
380 ice->spdif.ops.open = open_cs8427; in snd_ice1712_init_cs8427()
381 ice->spdif.ops.close = close_cs8427; in snd_ice1712_init_cs8427()
382 ice->spdif.ops.setup_rate = setup_cs8427; in snd_ice1712_init_cs8427()
389 if (ice->cs8427) in snd_ice1712_set_input_clock_source()
394 for (i = 0; i < ice->akm_codecs; i++) { in snd_ice1712_set_input_clock_source()
395 if (ice->akm[i].ops.set_rate_val) in snd_ice1712_set_input_clock_source()
396 ice->akm[i].ops.set_rate_val(&ice->akm[i], 0); in snd_ice1712_set_input_clock_source()
417 if (ice->rmidi[0]) in snd_ice1712_interrupt()
418 snd_mpu401_uart_interrupt(irq, ice->rmidi[0]->private_data); in snd_ice1712_interrupt()
425 if (ice->rmidi[1]) in snd_ice1712_interrupt()
426 snd_mpu401_uart_interrupt(irq, ice->rmidi[1]->private_data); in snd_ice1712_interrupt()
433 if (ice->playback_pro_substream) in snd_ice1712_interrupt()
434 snd_pcm_period_elapsed(ice->playback_pro_substream); in snd_ice1712_interrupt()
438 if (ice->capture_pro_substream) in snd_ice1712_interrupt()
439 snd_pcm_period_elapsed(ice->capture_pro_substream); in snd_ice1712_interrupt()
450 /* dev_dbg(ice->card->dev, "pbkstatus = 0x%x\n", pbkstatus); */ in snd_ice1712_interrupt()
454 substream = ice->playback_con_substream_ds[idx]; in snd_ice1712_interrupt()
462 if (ice->capture_con_substream) in snd_ice1712_interrupt()
463 snd_pcm_period_elapsed(ice->capture_con_substream); in snd_ice1712_interrupt()
467 if (ice->playback_con_substream) in snd_ice1712_interrupt()
468 snd_pcm_period_elapsed(ice->playback_con_substream); in snd_ice1712_interrupt()
477 * PCM part - consumer I/O
487 spin_lock(&ice->reg_lock); in snd_ice1712_playback_trigger()
498 result = -EINVAL; in snd_ice1712_playback_trigger()
501 spin_unlock(&ice->reg_lock); in snd_ice1712_playback_trigger()
512 spin_lock(&ice->reg_lock); in snd_ice1712_playback_ds_trigger()
513 tmp = snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL); in snd_ice1712_playback_ds_trigger()
523 result = -EINVAL; in snd_ice1712_playback_ds_trigger()
525 snd_ice1712_ds_write(ice, substream->number * 2, ICE1712_DSC_CONTROL, tmp); in snd_ice1712_playback_ds_trigger()
526 spin_unlock(&ice->reg_lock); in snd_ice1712_playback_ds_trigger()
537 spin_lock(&ice->reg_lock); in snd_ice1712_capture_trigger()
544 result = -EINVAL; in snd_ice1712_capture_trigger()
547 spin_unlock(&ice->reg_lock); in snd_ice1712_capture_trigger()
554 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ice1712_playback_prepare()
557 period_size = (snd_pcm_lib_period_bytes(substream) >> 2) - 1; in snd_ice1712_playback_prepare()
558 buf_size = snd_pcm_lib_buffer_bytes(substream) - 1; in snd_ice1712_playback_prepare()
560 if (snd_pcm_format_width(runtime->format) == 16) in snd_ice1712_playback_prepare()
562 if (runtime->channels == 2) in snd_ice1712_playback_prepare()
564 rate = (runtime->rate * 8192) / 375; in snd_ice1712_playback_prepare()
567 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_prepare()
568 outb(0, ice->ddma_port + 15); in snd_ice1712_playback_prepare()
569 outb(ICE1712_DMA_MODE_WRITE | ICE1712_DMA_AUTOINIT, ice->ddma_port + 0x0b); in snd_ice1712_playback_prepare()
570 outl(runtime->dma_addr, ice->ddma_port + 0); in snd_ice1712_playback_prepare()
571 outw(buf_size, ice->ddma_port + 4); in snd_ice1712_playback_prepare()
580 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_prepare()
587 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ice1712_playback_ds_prepare()
590 period_size = snd_pcm_lib_period_bytes(substream) - 1; in snd_ice1712_playback_ds_prepare()
592 if (snd_pcm_format_width(runtime->format) == 16) in snd_ice1712_playback_ds_prepare()
594 if (runtime->channels == 2) in snd_ice1712_playback_ds_prepare()
596 rate = (runtime->rate * 8192) / 375; in snd_ice1712_playback_ds_prepare()
599 ice->playback_con_active_buf[substream->number] = 0; in snd_ice1712_playback_ds_prepare()
600 ice->playback_con_virt_addr[substream->number] = runtime->dma_addr; in snd_ice1712_playback_ds_prepare()
601 chn = substream->number * 2; in snd_ice1712_playback_ds_prepare()
602 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_prepare()
603 snd_ice1712_ds_write(ice, chn, ICE1712_DSC_ADDR0, runtime->dma_addr); in snd_ice1712_playback_ds_prepare()
605 …snd_ice1712_ds_write(ice, chn, ICE1712_DSC_ADDR1, runtime->dma_addr + (runtime->periods > 1 ? peri… in snd_ice1712_playback_ds_prepare()
610 if (runtime->channels == 2) { in snd_ice1712_playback_ds_prepare()
614 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_prepare()
621 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ice1712_capture_prepare()
625 period_size = (snd_pcm_lib_period_bytes(substream) >> 2) - 1; in snd_ice1712_capture_prepare()
626 buf_size = snd_pcm_lib_buffer_bytes(substream) - 1; in snd_ice1712_capture_prepare()
628 if (snd_pcm_format_width(runtime->format) == 16) in snd_ice1712_capture_prepare()
630 if (runtime->channels == 2) in snd_ice1712_capture_prepare()
632 spin_lock_irq(&ice->reg_lock); in snd_ice1712_capture_prepare()
633 outl(ice->capture_con_virt_addr = runtime->dma_addr, ICEREG(ice, CONCAP_ADDR)); in snd_ice1712_capture_prepare()
638 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_capture_prepare()
639 snd_ac97_set_rate(ice->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate); in snd_ice1712_capture_prepare()
646 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ice1712_playback_pointer()
651 ptr = runtime->buffer_size - inw(ice->ddma_port + 4); in snd_ice1712_playback_pointer()
652 ptr = bytes_to_frames(substream->runtime, ptr); in snd_ice1712_playback_pointer()
653 if (ptr == runtime->buffer_size) in snd_ice1712_playback_pointer()
664 if (!(snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL) & 1)) in snd_ice1712_playback_ds_pointer()
666 if (ice->playback_con_active_buf[substream->number]) in snd_ice1712_playback_ds_pointer()
670 ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) - in snd_ice1712_playback_ds_pointer()
671 ice->playback_con_virt_addr[substream->number]; in snd_ice1712_playback_ds_pointer()
672 ptr = bytes_to_frames(substream->runtime, ptr); in snd_ice1712_playback_ds_pointer()
673 if (ptr == substream->runtime->buffer_size) in snd_ice1712_playback_ds_pointer()
685 ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr; in snd_ice1712_capture_pointer()
686 ptr = bytes_to_frames(substream->runtime, ptr); in snd_ice1712_capture_pointer()
687 if (ptr == substream->runtime->buffer_size) in snd_ice1712_capture_pointer()
750 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ice1712_playback_open()
753 ice->playback_con_substream = substream; in snd_ice1712_playback_open()
754 runtime->hw = snd_ice1712_playback; in snd_ice1712_playback_open()
760 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ice1712_playback_ds_open()
764 ice->playback_con_substream_ds[substream->number] = substream; in snd_ice1712_playback_ds_open()
765 runtime->hw = snd_ice1712_playback_ds; in snd_ice1712_playback_ds_open()
766 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_open()
767 tmp = inw(ICEDS(ice, INTMASK)) & ~(1 << (substream->number * 2)); in snd_ice1712_playback_ds_open()
769 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_open()
775 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ice1712_capture_open()
778 ice->capture_con_substream = substream; in snd_ice1712_capture_open()
779 runtime->hw = snd_ice1712_capture; in snd_ice1712_capture_open()
780 runtime->hw.rates = ice->ac97->rates[AC97_RATES_ADC]; in snd_ice1712_capture_open()
781 if (!(runtime->hw.rates & SNDRV_PCM_RATE_8000)) in snd_ice1712_capture_open()
782 runtime->hw.rate_min = 48000; in snd_ice1712_capture_open()
790 ice->playback_con_substream = NULL; in snd_ice1712_playback_close()
799 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_close()
800 tmp = inw(ICEDS(ice, INTMASK)) | (3 << (substream->number * 2)); in snd_ice1712_playback_ds_close()
802 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_ds_close()
803 ice->playback_con_substream_ds[substream->number] = NULL; in snd_ice1712_playback_ds_close()
811 ice->capture_con_substream = NULL; in snd_ice1712_capture_close()
844 err = snd_pcm_new(ice->card, "ICE1712 consumer", device, 1, 1, &pcm); in snd_ice1712_pcm()
851 pcm->private_data = ice; in snd_ice1712_pcm()
852 pcm->info_flags = 0; in snd_ice1712_pcm()
853 strcpy(pcm->name, "ICE1712 consumer"); in snd_ice1712_pcm()
854 ice->pcm = pcm; in snd_ice1712_pcm()
857 &ice->pci->dev, 64*1024, 64*1024); in snd_ice1712_pcm()
859 dev_warn(ice->card->dev, in snd_ice1712_pcm()
860 "Consumer PCM code does not work well at the moment --jk\n"); in snd_ice1712_pcm()
870 err = snd_pcm_new(ice->card, "ICE1712 consumer (DS)", device, 6, 0, &pcm); in snd_ice1712_pcm_ds()
876 pcm->private_data = ice; in snd_ice1712_pcm_ds()
877 pcm->info_flags = 0; in snd_ice1712_pcm_ds()
878 strcpy(pcm->name, "ICE1712 consumer (DS)"); in snd_ice1712_pcm_ds()
879 ice->pcm_ds = pcm; in snd_ice1712_pcm_ds()
882 &ice->pci->dev, 64*1024, 128*1024); in snd_ice1712_pcm_ds()
888 * PCM code - professional part (multitrack)
910 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) in snd_ice1712_pro_trigger()
911 return -EINVAL; in snd_ice1712_pro_trigger()
914 spin_lock(&ice->reg_lock); in snd_ice1712_pro_trigger()
921 spin_unlock(&ice->reg_lock); in snd_ice1712_pro_trigger()
932 if (s == ice->playback_pro_substream) { in snd_ice1712_pro_trigger()
935 } else if (s == ice->capture_pro_substream) { in snd_ice1712_pro_trigger()
940 spin_lock(&ice->reg_lock); in snd_ice1712_pro_trigger()
947 spin_unlock(&ice->reg_lock); in snd_ice1712_pro_trigger()
951 return -EINVAL; in snd_ice1712_pro_trigger()
985 spin_lock_irqsave(&ice->reg_lock, flags); in snd_ice1712_set_pro_rate()
990 spin_unlock_irqrestore(&ice->reg_lock, flags); in snd_ice1712_set_pro_rate()
1000 ice->cur_rate = rate; in snd_ice1712_set_pro_rate()
1002 spin_unlock_irqrestore(&ice->reg_lock, flags); in snd_ice1712_set_pro_rate()
1004 if (ice->gpio.set_pro_rate) in snd_ice1712_set_pro_rate()
1005 ice->gpio.set_pro_rate(ice, rate); in snd_ice1712_set_pro_rate()
1006 for (i = 0; i < ice->akm_codecs; i++) { in snd_ice1712_set_pro_rate()
1007 if (ice->akm[i].ops.set_rate_val) in snd_ice1712_set_pro_rate()
1008 ice->akm[i].ops.set_rate_val(&ice->akm[i], rate); in snd_ice1712_set_pro_rate()
1010 if (ice->spdif.ops.setup_rate) in snd_ice1712_set_pro_rate()
1011 ice->spdif.ops.setup_rate(ice, rate); in snd_ice1712_set_pro_rate()
1018 ice->playback_pro_size = snd_pcm_lib_buffer_bytes(substream); in snd_ice1712_playback_pro_prepare()
1019 spin_lock_irq(&ice->reg_lock); in snd_ice1712_playback_pro_prepare()
1020 outl(substream->runtime->dma_addr, ICEMT(ice, PLAYBACK_ADDR)); in snd_ice1712_playback_pro_prepare()
1021 outw((ice->playback_pro_size >> 2) - 1, ICEMT(ice, PLAYBACK_SIZE)); in snd_ice1712_playback_pro_prepare()
1022 outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, PLAYBACK_COUNT)); in snd_ice1712_playback_pro_prepare()
1023 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_playback_pro_prepare()
1041 ice->capture_pro_size = snd_pcm_lib_buffer_bytes(substream); in snd_ice1712_capture_pro_prepare()
1042 spin_lock_irq(&ice->reg_lock); in snd_ice1712_capture_pro_prepare()
1043 outl(substream->runtime->dma_addr, ICEMT(ice, CAPTURE_ADDR)); in snd_ice1712_capture_pro_prepare()
1044 outw((ice->capture_pro_size >> 2) - 1, ICEMT(ice, CAPTURE_SIZE)); in snd_ice1712_capture_pro_prepare()
1045 outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ICEMT(ice, CAPTURE_COUNT)); in snd_ice1712_capture_pro_prepare()
1046 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_capture_pro_prepare()
1066 ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2); in snd_ice1712_playback_pro_pointer()
1067 ptr = bytes_to_frames(substream->runtime, ptr); in snd_ice1712_playback_pro_pointer()
1068 if (ptr == substream->runtime->buffer_size) in snd_ice1712_playback_pro_pointer()
1080 ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2); in snd_ice1712_capture_pro_pointer()
1081 ptr = bytes_to_frames(substream->runtime, ptr); in snd_ice1712_capture_pro_pointer()
1082 if (ptr == substream->runtime->buffer_size) in snd_ice1712_capture_pro_pointer()
1127 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ice1712_playback_pro_open()
1130 ice->playback_pro_substream = substream; in snd_ice1712_playback_pro_open()
1131 runtime->hw = snd_ice1712_playback_pro; in snd_ice1712_playback_pro_open()
1136 runtime->hw.rate_min = PRO_RATE_DEFAULT; in snd_ice1712_playback_pro_open()
1137 runtime->hw.rate_max = PRO_RATE_DEFAULT; in snd_ice1712_playback_pro_open()
1140 if (ice->spdif.ops.open) in snd_ice1712_playback_pro_open()
1141 ice->spdif.ops.open(ice, substream); in snd_ice1712_playback_pro_open()
1149 struct snd_pcm_runtime *runtime = substream->runtime; in snd_ice1712_capture_pro_open()
1151 ice->capture_pro_substream = substream; in snd_ice1712_capture_pro_open()
1152 runtime->hw = snd_ice1712_capture_pro; in snd_ice1712_capture_pro_open()
1157 runtime->hw.rate_min = PRO_RATE_DEFAULT; in snd_ice1712_capture_pro_open()
1158 runtime->hw.rate_max = PRO_RATE_DEFAULT; in snd_ice1712_capture_pro_open()
1170 ice->playback_pro_substream = NULL; in snd_ice1712_playback_pro_close()
1171 if (ice->spdif.ops.close) in snd_ice1712_playback_pro_close()
1172 ice->spdif.ops.close(ice, substream); in snd_ice1712_playback_pro_close()
1183 ice->capture_pro_substream = NULL; in snd_ice1712_capture_pro_close()
1210 err = snd_pcm_new(ice->card, "ICE1712 multi", device, 1, 1, &pcm); in snd_ice1712_pcm_profi()
1217 pcm->private_data = ice; in snd_ice1712_pcm_profi()
1218 pcm->info_flags = 0; in snd_ice1712_pcm_profi()
1219 strcpy(pcm->name, "ICE1712 multi"); in snd_ice1712_pcm_profi()
1222 &ice->pci->dev, 256*1024, 256*1024); in snd_ice1712_pcm_profi()
1224 ice->pcm_pro = pcm; in snd_ice1712_pcm_profi()
1226 if (ice->cs8427) { in snd_ice1712_pcm_profi()
1228 err = snd_cs8427_iec958_build(ice->cs8427, in snd_ice1712_pcm_profi()
1229 pcm->streams[0].substream, in snd_ice1712_pcm_profi()
1230 pcm->streams[1].substream); in snd_ice1712_pcm_profi()
1244 unsigned int vol = ice->pro_volumes[index]; in snd_ice1712_update_volume()
1247 val |= (vol & 0x8000) == 0 ? (96 - (vol & 0x7f)) : 0x7f; in snd_ice1712_update_volume()
1248 val |= ((vol & 0x80000000) == 0 ? (96 - ((vol >> 16) & 0x7f)) : 0x7f) << 8; in snd_ice1712_update_volume()
1258 int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + in snd_ice1712_pro_mixer_switch_get()
1259 kcontrol->private_value; in snd_ice1712_pro_mixer_switch_get()
1261 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_get()
1262 ucontrol->value.integer.value[0] = in snd_ice1712_pro_mixer_switch_get()
1263 !((ice->pro_volumes[priv_idx] >> 15) & 1); in snd_ice1712_pro_mixer_switch_get()
1264 ucontrol->value.integer.value[1] = in snd_ice1712_pro_mixer_switch_get()
1265 !((ice->pro_volumes[priv_idx] >> 31) & 1); in snd_ice1712_pro_mixer_switch_get()
1266 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_get()
1273 int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + in snd_ice1712_pro_mixer_switch_put()
1274 kcontrol->private_value; in snd_ice1712_pro_mixer_switch_put()
1277 nval = (ucontrol->value.integer.value[0] ? 0 : 0x00008000) | in snd_ice1712_pro_mixer_switch_put()
1278 (ucontrol->value.integer.value[1] ? 0 : 0x80000000); in snd_ice1712_pro_mixer_switch_put()
1279 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_put()
1280 nval |= ice->pro_volumes[priv_idx] & ~0x80008000; in snd_ice1712_pro_mixer_switch_put()
1281 change = nval != ice->pro_volumes[priv_idx]; in snd_ice1712_pro_mixer_switch_put()
1282 ice->pro_volumes[priv_idx] = nval; in snd_ice1712_pro_mixer_switch_put()
1284 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_switch_put()
1290 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_ice1712_pro_mixer_volume_info()
1291 uinfo->count = 2; in snd_ice1712_pro_mixer_volume_info()
1292 uinfo->value.integer.min = 0; in snd_ice1712_pro_mixer_volume_info()
1293 uinfo->value.integer.max = 96; in snd_ice1712_pro_mixer_volume_info()
1300 int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + in snd_ice1712_pro_mixer_volume_get()
1301 kcontrol->private_value; in snd_ice1712_pro_mixer_volume_get()
1303 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_get()
1304 ucontrol->value.integer.value[0] = in snd_ice1712_pro_mixer_volume_get()
1305 (ice->pro_volumes[priv_idx] >> 0) & 127; in snd_ice1712_pro_mixer_volume_get()
1306 ucontrol->value.integer.value[1] = in snd_ice1712_pro_mixer_volume_get()
1307 (ice->pro_volumes[priv_idx] >> 16) & 127; in snd_ice1712_pro_mixer_volume_get()
1308 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_get()
1315 int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + in snd_ice1712_pro_mixer_volume_put()
1316 kcontrol->private_value; in snd_ice1712_pro_mixer_volume_put()
1319 nval = (ucontrol->value.integer.value[0] & 127) | in snd_ice1712_pro_mixer_volume_put()
1320 ((ucontrol->value.integer.value[1] & 127) << 16); in snd_ice1712_pro_mixer_volume_put()
1321 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_put()
1322 nval |= ice->pro_volumes[priv_idx] & ~0x007f007f; in snd_ice1712_pro_mixer_volume_put()
1323 change = nval != ice->pro_volumes[priv_idx]; in snd_ice1712_pro_mixer_volume_put()
1324 ice->pro_volumes[priv_idx] = nval; in snd_ice1712_pro_mixer_volume_put()
1326 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_mixer_volume_put()
1330 static const DECLARE_TLV_DB_SCALE(db_scale_playback, -14400, 150, 0);
1335 .name = "Multi Playback Switch",
1346 .name = "Multi Playback Volume",
1358 .name = "H/W Multi Capture Switch",
1367 .name = SNDRV_CTL_NAME_IEC958("Multi ", CAPTURE, SWITCH),
1379 .name = "H/W Multi Capture Volume",
1389 .name = SNDRV_CTL_NAME_IEC958("Multi ", CAPTURE, VOLUME),
1399 struct snd_card *card = ice->card; in snd_ice1712_build_pro_mixer()
1403 /* multi-channel mixer */ in snd_ice1712_build_pro_mixer()
1410 if (ice->num_total_adcs > 0) { in snd_ice1712_build_pro_mixer()
1412 tmp.count = ice->num_total_adcs; in snd_ice1712_build_pro_mixer()
1422 if (ice->num_total_adcs > 0) { in snd_ice1712_build_pro_mixer()
1424 tmp.count = ice->num_total_adcs; in snd_ice1712_build_pro_mixer()
1436 ice->pro_volumes[idx] = 0x80008000; /* mute */ in snd_ice1712_build_pro_mixer()
1439 for (idx = 10; idx < 10 + ice->num_total_adcs; idx++) { in snd_ice1712_build_pro_mixer()
1440 ice->pro_volumes[idx] = 0x80008000; /* mute */ in snd_ice1712_build_pro_mixer()
1444 ice->pro_volumes[idx] = 0x80008000; /* mute */ in snd_ice1712_build_pro_mixer()
1452 struct snd_ice1712 *ice = ac97->private_data; in snd_ice1712_mixer_free_ac97()
1453 ice->ac97 = NULL; in snd_ice1712_mixer_free_ac97()
1471 err = snd_ac97_bus(ice->card, bus_num++, &con_ops, NULL, &pbus); in snd_ice1712_ac97_mixer()
1477 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); in snd_ice1712_ac97_mixer()
1479 dev_warn(ice->card->dev, in snd_ice1712_ac97_mixer()
1482 return snd_ctl_add(ice->card, in snd_ice1712_ac97_mixer()
1488 if (!(ice->eeprom.data[ICE_EEP1_ACLINK] & ICE1712_CFG_PRO_I2S)) { in snd_ice1712_ac97_mixer()
1489 err = snd_ac97_bus(ice->card, bus_num, &pro_ops, NULL, &pbus); in snd_ice1712_ac97_mixer()
1495 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); in snd_ice1712_ac97_mixer()
1497 dev_warn(ice->card->dev, in snd_ice1712_ac97_mixer()
1503 strcat(ice->card->mixername, "ICE1712 - multitrack"); in snd_ice1712_ac97_mixer()
1513 return (unsigned int)ice->eeprom.data[idx] | ((unsigned int)ice->eeprom.data[idx + 1] << 8); in eeprom_double()
1519 struct snd_ice1712 *ice = entry->private_data; in snd_ice1712_proc_read()
1522 snd_iprintf(buffer, "%s\n\n", ice->card->longname); in snd_ice1712_proc_read()
1523 snd_iprintf(buffer, "EEPROM:\n"); in snd_ice1712_proc_read()
1525 snd_iprintf(buffer, " Subvendor : 0x%x\n", ice->eeprom.subvendor); in snd_ice1712_proc_read()
1526 snd_iprintf(buffer, " Size : %i bytes\n", ice->eeprom.size); in snd_ice1712_proc_read()
1527 snd_iprintf(buffer, " Version : %i\n", ice->eeprom.version); in snd_ice1712_proc_read()
1528 snd_iprintf(buffer, " Codec : 0x%x\n", ice->eeprom.data[ICE_EEP1_CODEC]); in snd_ice1712_proc_read()
1529 snd_iprintf(buffer, " ACLink : 0x%x\n", ice->eeprom.data[ICE_EEP1_ACLINK]); in snd_ice1712_proc_read()
1530 snd_iprintf(buffer, " I2S ID : 0x%x\n", ice->eeprom.data[ICE_EEP1_I2SID]); in snd_ice1712_proc_read()
1531 snd_iprintf(buffer, " S/PDIF : 0x%x\n", ice->eeprom.data[ICE_EEP1_SPDIF]); in snd_ice1712_proc_read()
1532 snd_iprintf(buffer, " GPIO mask : 0x%x\n", ice->eeprom.gpiomask); in snd_ice1712_proc_read()
1533 snd_iprintf(buffer, " GPIO state : 0x%x\n", ice->eeprom.gpiostate); in snd_ice1712_proc_read()
1534 snd_iprintf(buffer, " GPIO direction : 0x%x\n", ice->eeprom.gpiodir); in snd_ice1712_proc_read()
1538 snd_iprintf(buffer, " AC'97 record src : 0x%x\n", ice->eeprom.data[ICE_EEP1_AC97_RECSRC]); in snd_ice1712_proc_read()
1540 snd_iprintf(buffer, " DAC ID #%i : 0x%x\n", idx, ice->eeprom.data[ICE_EEP1_DAC_ID + idx]); in snd_ice1712_proc_read()
1542 snd_iprintf(buffer, " ADC ID #%i : 0x%x\n", idx, ice->eeprom.data[ICE_EEP1_ADC_ID + idx]); in snd_ice1712_proc_read()
1543 for (idx = 0x1c; idx < ice->eeprom.size; idx++) in snd_ice1712_proc_read()
1544 snd_iprintf(buffer, " Extra #%02i : 0x%x\n", idx, ice->eeprom.data[idx]); in snd_ice1712_proc_read()
1558 snd_card_ro_proc_new(ice->card, "ice1712", ice, snd_ice1712_proc_read); in snd_ice1712_proc_init()
1568 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; in snd_ice1712_eeprom_info()
1569 uinfo->count = sizeof(struct snd_ice1712_eeprom); in snd_ice1712_eeprom_info()
1578 memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); in snd_ice1712_eeprom_get()
1584 .name = "ICE1712 EEPROM",
1595 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; in snd_ice1712_spdif_info()
1596 uinfo->count = 1; in snd_ice1712_spdif_info()
1604 if (ice->spdif.ops.default_get) in snd_ice1712_spdif_default_get()
1605 ice->spdif.ops.default_get(ice, ucontrol); in snd_ice1712_spdif_default_get()
1613 if (ice->spdif.ops.default_put) in snd_ice1712_spdif_default_put()
1614 return ice->spdif.ops.default_put(ice, ucontrol); in snd_ice1712_spdif_default_put()
1621 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
1631 if (ice->spdif.ops.default_get) { in snd_ice1712_spdif_maskc_get()
1632 ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO | in snd_ice1712_spdif_maskc_get()
1636 ucontrol->value.iec958.status[1] = IEC958_AES1_CON_ORIGINAL | in snd_ice1712_spdif_maskc_get()
1638 ucontrol->value.iec958.status[3] = IEC958_AES3_CON_FS; in snd_ice1712_spdif_maskc_get()
1640 ucontrol->value.iec958.status[0] = 0xff; in snd_ice1712_spdif_maskc_get()
1641 ucontrol->value.iec958.status[1] = 0xff; in snd_ice1712_spdif_maskc_get()
1642 ucontrol->value.iec958.status[2] = 0xff; in snd_ice1712_spdif_maskc_get()
1643 ucontrol->value.iec958.status[3] = 0xff; in snd_ice1712_spdif_maskc_get()
1644 ucontrol->value.iec958.status[4] = 0xff; in snd_ice1712_spdif_maskc_get()
1653 if (ice->spdif.ops.default_get) { in snd_ice1712_spdif_maskp_get()
1654 ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO | in snd_ice1712_spdif_maskp_get()
1658 ucontrol->value.iec958.status[1] = IEC958_AES1_PRO_MODE; in snd_ice1712_spdif_maskp_get()
1660 ucontrol->value.iec958.status[0] = 0xff; in snd_ice1712_spdif_maskp_get()
1661 ucontrol->value.iec958.status[1] = 0xff; in snd_ice1712_spdif_maskp_get()
1662 ucontrol->value.iec958.status[2] = 0xff; in snd_ice1712_spdif_maskp_get()
1663 ucontrol->value.iec958.status[3] = 0xff; in snd_ice1712_spdif_maskp_get()
1664 ucontrol->value.iec958.status[4] = 0xff; in snd_ice1712_spdif_maskp_get()
1673 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK),
1682 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK),
1691 if (ice->spdif.ops.stream_get) in snd_ice1712_spdif_stream_get()
1692 ice->spdif.ops.stream_get(ice, ucontrol); in snd_ice1712_spdif_stream_get()
1700 if (ice->spdif.ops.stream_put) in snd_ice1712_spdif_stream_put()
1701 return ice->spdif.ops.stream_put(ice, ucontrol); in snd_ice1712_spdif_stream_put()
1710 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM),
1720 unsigned char mask = kcontrol->private_value & 0xff; in snd_ice1712_gpio_get()
1721 int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; in snd_ice1712_gpio_get()
1724 ucontrol->value.integer.value[0] = in snd_ice1712_gpio_get()
1734 unsigned char mask = kcontrol->private_value & 0xff; in snd_ice1712_gpio_put()
1735 int invert = (kcontrol->private_value & (1<<24)) ? mask : 0; in snd_ice1712_gpio_put()
1738 if (kcontrol->private_value & (1 << 31)) in snd_ice1712_gpio_put()
1739 return -EPERM; in snd_ice1712_gpio_put()
1740 nval = (ucontrol->value.integer.value[0] ? mask : 0) ^ invert; in snd_ice1712_gpio_put()
1770 "IEC958 Input", /* 13: -- */ in snd_ice1712_pro_internal_clock_info()
1784 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_get()
1786 ucontrol->value.enumerated.item[0] = 13; in snd_ice1712_pro_internal_clock_get()
1793 ucontrol->value.enumerated.item[0] = val; in snd_ice1712_pro_internal_clock_get()
1795 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_get()
1810 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1812 if (ucontrol->value.enumerated.item[0] == 13) { in snd_ice1712_pro_internal_clock_put()
1815 PRO_RATE_DEFAULT = xrate[ucontrol->value.integer.value[0] % 13]; in snd_ice1712_pro_internal_clock_put()
1816 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1818 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1821 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_internal_clock_put()
1832 .name = "Multi Track Internal Clock",
1855 /* "IEC958 Input", 13: -- */ in snd_ice1712_pro_internal_clock_default_info()
1874 ucontrol->value.enumerated.item[0] = val; in snd_ice1712_pro_internal_clock_default_get()
1889 PRO_RATE_DEFAULT = xrate[ucontrol->value.integer.value[0] % 13]; in snd_ice1712_pro_internal_clock_default_put()
1897 .name = "Multi Track Internal Clock Default",
1908 ucontrol->value.integer.value[0] = PRO_RATE_LOCKED; in snd_ice1712_pro_rate_locking_get()
1918 nval = ucontrol->value.integer.value[0] ? 1 : 0; in snd_ice1712_pro_rate_locking_put()
1919 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_locking_put()
1922 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_locking_put()
1928 .name = "Multi Track Rate Locking",
1939 ucontrol->value.integer.value[0] = PRO_RATE_RESET; in snd_ice1712_pro_rate_reset_get()
1949 nval = ucontrol->value.integer.value[0] ? 1 : 0; in snd_ice1712_pro_rate_reset_put()
1950 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_reset_put()
1953 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_rate_reset_put()
1959 .name = "Multi Track Rate Reset",
1973 "H/W In 0", "H/W In 1", "H/W In 2", "H/W In 3", /* 1-4 */ in snd_ice1712_pro_route_info()
1974 "H/W In 4", "H/W In 5", "H/W In 6", "H/W In 7", /* 5-8 */ in snd_ice1712_pro_route_info()
1975 "IEC958 In L", "IEC958 In R", /* 9-10 */ in snd_ice1712_pro_route_info()
1976 "Digital Mixer", /* 11 - optional */ in snd_ice1712_pro_route_info()
1978 int num_items = snd_ctl_get_ioffidx(kcontrol, &uinfo->id) < 2 ? 12 : 11; in snd_ice1712_pro_route_info()
1986 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_ice1712_pro_route_analog_get()
1989 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_get()
1992 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_get()
1998 ucontrol->value.enumerated.item[0] = 11; in snd_ice1712_pro_route_analog_get()
2000 ucontrol->value.enumerated.item[0] = (cval & 7) + 1; in snd_ice1712_pro_route_analog_get()
2002 ucontrol->value.enumerated.item[0] = ((cval >> 3) & 1) + 9; in snd_ice1712_pro_route_analog_get()
2004 ucontrol->value.enumerated.item[0] = 0; in snd_ice1712_pro_route_analog_get()
2013 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_ice1712_pro_route_analog_put()
2017 if (ucontrol->value.enumerated.item[0] >= 11) in snd_ice1712_pro_route_analog_put()
2019 else if (ucontrol->value.enumerated.item[0] >= 9) in snd_ice1712_pro_route_analog_put()
2021 else if (ucontrol->value.enumerated.item[0] >= 1) in snd_ice1712_pro_route_analog_put()
2026 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2033 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2038 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2042 nval = ucontrol->value.enumerated.item[0] - 1; in snd_ice1712_pro_route_analog_put()
2046 nval = (ucontrol->value.enumerated.item[0] - 9) << 3; in snd_ice1712_pro_route_analog_put()
2054 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_analog_put()
2062 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_ice1712_pro_route_spdif_get()
2068 ucontrol->value.enumerated.item[0] = 11; in snd_ice1712_pro_route_spdif_get()
2070 ucontrol->value.enumerated.item[0] = (cval & 7) + 1; in snd_ice1712_pro_route_spdif_get()
2072 ucontrol->value.enumerated.item[0] = ((cval >> 3) & 1) + 9; in snd_ice1712_pro_route_spdif_get()
2074 ucontrol->value.enumerated.item[0] = 0; in snd_ice1712_pro_route_spdif_get()
2083 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_ice1712_pro_route_spdif_put()
2087 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_route_spdif_put()
2089 if (ucontrol->value.enumerated.item[0] >= 11) in snd_ice1712_pro_route_spdif_put()
2091 else if (ucontrol->value.enumerated.item[0] >= 9) in snd_ice1712_pro_route_spdif_put()
2093 else if (ucontrol->value.enumerated.item[0] >= 1) in snd_ice1712_pro_route_spdif_put()
2102 nval = ucontrol->value.enumerated.item[0] - 1; in snd_ice1712_pro_route_spdif_put()
2106 nval = (ucontrol->value.enumerated.item[0] - 9) << 3; in snd_ice1712_pro_route_spdif_put()
2113 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_route_spdif_put()
2119 .name = "H/W Playback Route",
2127 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route",
2138 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_ice1712_pro_volume_rate_info()
2139 uinfo->count = 1; in snd_ice1712_pro_volume_rate_info()
2140 uinfo->value.integer.min = 0; in snd_ice1712_pro_volume_rate_info()
2141 uinfo->value.integer.max = 255; in snd_ice1712_pro_volume_rate_info()
2150 ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_RATE)); in snd_ice1712_pro_volume_rate_get()
2160 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_volume_rate_put()
2161 change = inb(ICEMT(ice, MONITOR_RATE)) != ucontrol->value.integer.value[0]; in snd_ice1712_pro_volume_rate_put()
2162 outb(ucontrol->value.integer.value[0], ICEMT(ice, MONITOR_RATE)); in snd_ice1712_pro_volume_rate_put()
2163 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_volume_rate_put()
2169 .name = "Multi Track Volume Rate",
2178 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_ice1712_pro_peak_info()
2179 uinfo->count = 22; in snd_ice1712_pro_peak_info()
2180 uinfo->value.integer.min = 0; in snd_ice1712_pro_peak_info()
2181 uinfo->value.integer.max = 255; in snd_ice1712_pro_peak_info()
2191 spin_lock_irq(&ice->reg_lock); in snd_ice1712_pro_peak_get()
2194 ucontrol->value.integer.value[idx] = inb(ICEMT(ice, MONITOR_PEAKDATA)); in snd_ice1712_pro_peak_get()
2196 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_pro_peak_get()
2202 .name = "Multi Track Peak",
2230 while (t-- > 0 && (inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_BUSY)) ; in snd_ice1712_read_i2c()
2237 int dev = ICE_I2C_EEPROM_ADDR; /* I2C EEPROM device address */ in snd_ice1712_read_eeprom()
2242 ice->eeprom.subvendor = 0; in snd_ice1712_read_eeprom()
2244 ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) | in snd_ice1712_read_eeprom()
2248 if (ice->eeprom.subvendor == 0 || in snd_ice1712_read_eeprom()
2249 ice->eeprom.subvendor == (unsigned int)-1) { in snd_ice1712_read_eeprom()
2250 /* invalid subvendor from EEPROM, try the PCI subststem ID instead */ in snd_ice1712_read_eeprom()
2252 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_VENDOR_ID, &vendor); in snd_ice1712_read_eeprom()
2253 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device); in snd_ice1712_read_eeprom()
2254 ice->eeprom.subvendor = ((unsigned int)swab16(vendor) << 16) | swab16(device); in snd_ice1712_read_eeprom()
2255 if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) { in snd_ice1712_read_eeprom()
2256 dev_err(ice->card->dev, in snd_ice1712_read_eeprom()
2258 return -ENXIO; in snd_ice1712_read_eeprom()
2263 for (c = *tbl; c->subvendor; c++) { in snd_ice1712_read_eeprom()
2264 if (modelname && c->model && !strcmp(modelname, c->model)) { in snd_ice1712_read_eeprom()
2265 dev_info(ice->card->dev, in snd_ice1712_read_eeprom()
2266 "Using board model %s\n", c->name); in snd_ice1712_read_eeprom()
2267 ice->eeprom.subvendor = c->subvendor; in snd_ice1712_read_eeprom()
2268 } else if (c->subvendor != ice->eeprom.subvendor) in snd_ice1712_read_eeprom()
2270 if (!c->eeprom_size || !c->eeprom_data) in snd_ice1712_read_eeprom()
2272 /* if the EEPROM is given by the driver, use it */ in snd_ice1712_read_eeprom()
2273 dev_dbg(ice->card->dev, "using the defined eeprom..\n"); in snd_ice1712_read_eeprom()
2274 ice->eeprom.version = 1; in snd_ice1712_read_eeprom()
2275 ice->eeprom.size = c->eeprom_size + 6; in snd_ice1712_read_eeprom()
2276 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); in snd_ice1712_read_eeprom()
2280 dev_warn(ice->card->dev, "No matching model found for ID 0x%x\n", in snd_ice1712_read_eeprom()
2281 ice->eeprom.subvendor); in snd_ice1712_read_eeprom()
2284 ice->eeprom.size = snd_ice1712_read_i2c(ice, dev, 0x04); in snd_ice1712_read_eeprom()
2285 if (ice->eeprom.size < 6) in snd_ice1712_read_eeprom()
2286 ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ in snd_ice1712_read_eeprom()
2287 else if (ice->eeprom.size > 32) { in snd_ice1712_read_eeprom()
2288 dev_err(ice->card->dev, in snd_ice1712_read_eeprom()
2289 "invalid EEPROM (size = %i)\n", ice->eeprom.size); in snd_ice1712_read_eeprom()
2290 return -EIO; in snd_ice1712_read_eeprom()
2292 ice->eeprom.version = snd_ice1712_read_i2c(ice, dev, 0x05); in snd_ice1712_read_eeprom()
2293 if (ice->eeprom.version != 1) { in snd_ice1712_read_eeprom()
2294 dev_err(ice->card->dev, "invalid EEPROM version %i\n", in snd_ice1712_read_eeprom()
2295 ice->eeprom.version); in snd_ice1712_read_eeprom()
2296 /* return -EIO; */ in snd_ice1712_read_eeprom()
2298 size = ice->eeprom.size - 6; in snd_ice1712_read_eeprom()
2300 ice->eeprom.data[i] = snd_ice1712_read_i2c(ice, dev, i + 6); in snd_ice1712_read_eeprom()
2303 ice->eeprom.gpiomask = ice->eeprom.data[ICE_EEP1_GPIO_MASK]; in snd_ice1712_read_eeprom()
2304 ice->eeprom.gpiostate = ice->eeprom.data[ICE_EEP1_GPIO_STATE]; in snd_ice1712_read_eeprom()
2305 ice->eeprom.gpiodir = ice->eeprom.data[ICE_EEP1_GPIO_DIR]; in snd_ice1712_read_eeprom()
2318 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE && in snd_ice1712_chip_init()
2319 !ice->dxr_enable) in snd_ice1712_chip_init()
2320 /* Set eeprom value to limit active ADCs and DACs to 6; in snd_ice1712_chip_init()
2324 ice->eeprom.data[ICE_EEP1_CODEC] = 0x3a; in snd_ice1712_chip_init()
2325 pci_write_config_byte(ice->pci, 0x60, ice->eeprom.data[ICE_EEP1_CODEC]); in snd_ice1712_chip_init()
2326 pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]); in snd_ice1712_chip_init()
2327 pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]); in snd_ice1712_chip_init()
2328 pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]); in snd_ice1712_chip_init()
2329 if (ice->eeprom.subvendor != ICE1712_SUBDEVICE_STDSP24 && in snd_ice1712_chip_init()
2330 ice->eeprom.subvendor != ICE1712_SUBDEVICE_STAUDIO_ADCIII) { in snd_ice1712_chip_init()
2331 ice->gpio.write_mask = ice->eeprom.gpiomask; in snd_ice1712_chip_init()
2332 ice->gpio.direction = ice->eeprom.gpiodir; in snd_ice1712_chip_init()
2334 ice->eeprom.gpiomask); in snd_ice1712_chip_init()
2336 ice->eeprom.gpiodir); in snd_ice1712_chip_init()
2338 ice->eeprom.gpiostate); in snd_ice1712_chip_init()
2340 ice->gpio.write_mask = 0xc0; in snd_ice1712_chip_init()
2341 ice->gpio.direction = 0xff; in snd_ice1712_chip_init()
2348 if (!(ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97)) { in snd_ice1712_chip_init()
2357 outb(((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) == 0 ? in snd_ice1712_chip_init()
2359 ((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97) ? in snd_ice1712_chip_init()
2372 if (snd_BUG_ON(!ice->pcm_pro)) in snd_ice1712_spdif_build_controls()
2373 return -EIO; in snd_ice1712_spdif_build_controls()
2375 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2376 err = snd_ctl_add(ice->card, kctl); in snd_ice1712_spdif_build_controls()
2380 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2381 err = snd_ctl_add(ice->card, kctl); in snd_ice1712_spdif_build_controls()
2385 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2386 err = snd_ctl_add(ice->card, kctl); in snd_ice1712_spdif_build_controls()
2390 kctl->id.device = ice->pcm_pro->device; in snd_ice1712_spdif_build_controls()
2391 err = snd_ctl_add(ice->card, kctl); in snd_ice1712_spdif_build_controls()
2394 ice->spdif.stream_ctl = kctl; in snd_ice1712_spdif_build_controls()
2403 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_eeprom, ice)); in snd_ice1712_build_controls()
2406 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_internal_clock, ice)); in snd_ice1712_build_controls()
2409 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_internal_clock_default, ice)); in snd_ice1712_build_controls()
2413 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_rate_locking, ice)); in snd_ice1712_build_controls()
2416 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_rate_reset, ice)); in snd_ice1712_build_controls()
2420 if (ice->num_total_dacs > 0) { in snd_ice1712_build_controls()
2422 tmp.count = ice->num_total_dacs; in snd_ice1712_build_controls()
2423 err = snd_ctl_add(ice->card, snd_ctl_new1(&tmp, ice)); in snd_ice1712_build_controls()
2428 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_pro_spdif_route, ice)); in snd_ice1712_build_controls()
2432 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_pro_volume_rate, ice)); in snd_ice1712_build_controls()
2435 return snd_ctl_add(ice->card, in snd_ice1712_build_controls()
2441 struct snd_ice1712 *ice = card->private_data; in snd_ice1712_free()
2443 if (ice->card_info && ice->card_info->chip_exit) in snd_ice1712_free()
2444 ice->card_info->chip_exit(ice); in snd_ice1712_free()
2460 struct snd_ice1712 *ice = card->private_data; in snd_ice1712_create()
2468 if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(28))) { in snd_ice1712_create()
2469 dev_err(card->dev, in snd_ice1712_create()
2471 return -ENXIO; in snd_ice1712_create()
2474 ice->omni = omni ? 1 : 0; in snd_ice1712_create()
2479 ice->cs8427_timeout = cs8427_timeout; in snd_ice1712_create()
2480 ice->dxr_enable = dxr_enable; in snd_ice1712_create()
2481 spin_lock_init(&ice->reg_lock); in snd_ice1712_create()
2482 mutex_init(&ice->gpio_mutex); in snd_ice1712_create()
2483 mutex_init(&ice->i2c_mutex); in snd_ice1712_create()
2484 mutex_init(&ice->open_mutex); in snd_ice1712_create()
2485 ice->gpio.set_mask = snd_ice1712_set_gpio_mask; in snd_ice1712_create()
2486 ice->gpio.get_mask = snd_ice1712_get_gpio_mask; in snd_ice1712_create()
2487 ice->gpio.set_dir = snd_ice1712_set_gpio_dir; in snd_ice1712_create()
2488 ice->gpio.get_dir = snd_ice1712_get_gpio_dir; in snd_ice1712_create()
2489 ice->gpio.set_data = snd_ice1712_set_gpio_data; in snd_ice1712_create()
2490 ice->gpio.get_data = snd_ice1712_get_gpio_data; in snd_ice1712_create()
2492 ice->spdif.cs8403_bits = in snd_ice1712_create()
2493 ice->spdif.cs8403_stream_bits = (0x01 | /* consumer format */ in snd_ice1712_create()
2496 ice->card = card; in snd_ice1712_create()
2497 ice->pci = pci; in snd_ice1712_create()
2498 ice->irq = -1; in snd_ice1712_create()
2501 pci_write_config_word(ice->pci, 0x40, 0x807f); in snd_ice1712_create()
2502 pci_write_config_word(ice->pci, 0x42, 0x0006); in snd_ice1712_create()
2508 ice->port = pci_resource_start(pci, 0); in snd_ice1712_create()
2509 ice->ddma_port = pci_resource_start(pci, 1); in snd_ice1712_create()
2510 ice->dmapath_port = pci_resource_start(pci, 2); in snd_ice1712_create()
2511 ice->profi_port = pci_resource_start(pci, 3); in snd_ice1712_create()
2513 if (devm_request_irq(&pci->dev, pci->irq, snd_ice1712_interrupt, in snd_ice1712_create()
2515 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); in snd_ice1712_create()
2516 return -EIO; in snd_ice1712_create()
2519 ice->irq = pci->irq; in snd_ice1712_create()
2520 card->sync_irq = ice->irq; in snd_ice1712_create()
2521 card->private_free = snd_ice1712_free; in snd_ice1712_create()
2524 return -EIO; in snd_ice1712_create()
2526 return -EIO; in snd_ice1712_create()
2550 return -ENODEV; in snd_ice1712_probe()
2553 return -ENOENT; in snd_ice1712_probe()
2556 err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, in snd_ice1712_probe()
2560 ice = card->private_data; in snd_ice1712_probe()
2562 strcpy(card->driver, "ICE1712"); in snd_ice1712_probe()
2563 strcpy(card->shortname, "ICEnsemble ICE1712"); in snd_ice1712_probe()
2571 for (c = *tbl; c->subvendor; c++) { in snd_ice1712_probe()
2572 if (c->subvendor == ice->eeprom.subvendor) { in snd_ice1712_probe()
2573 strcpy(card->shortname, c->name); in snd_ice1712_probe()
2574 if (c->driver) /* specific driver? */ in snd_ice1712_probe()
2575 strcpy(card->driver, c->driver); in snd_ice1712_probe()
2576 if (c->chip_init) { in snd_ice1712_probe()
2577 err = c->chip_init(ice); in snd_ice1712_probe()
2581 ice->card_info = c; in snd_ice1712_probe()
2607 if (c->build_controls) { in snd_ice1712_probe()
2608 err = c->build_controls(ice); in snd_ice1712_probe()
2619 if (!c->no_mpu401) { in snd_ice1712_probe()
2622 c->mpu401_1_info_flags | in snd_ice1712_probe()
2624 -1, &ice->rmidi[0]); in snd_ice1712_probe()
2627 if (c->mpu401_1_name) in snd_ice1712_probe()
2628 /* Preferred name available in card_info */ in snd_ice1712_probe()
2629 snprintf(ice->rmidi[0]->name, in snd_ice1712_probe()
2630 sizeof(ice->rmidi[0]->name), in snd_ice1712_probe()
2631 "%s %d", c->mpu401_1_name, card->number); in snd_ice1712_probe()
2633 if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) { in snd_ice1712_probe()
2637 c->mpu401_2_info_flags | in snd_ice1712_probe()
2639 -1, &ice->rmidi[1]); in snd_ice1712_probe()
2643 if (c->mpu401_2_name) in snd_ice1712_probe()
2644 /* Preferred name available in card_info */ in snd_ice1712_probe()
2645 snprintf(ice->rmidi[1]->name, in snd_ice1712_probe()
2646 sizeof(ice->rmidi[1]->name), in snd_ice1712_probe()
2647 "%s %d", c->mpu401_2_name, in snd_ice1712_probe()
2648 card->number); in snd_ice1712_probe()
2654 sprintf(card->longname, "%s at 0x%lx, irq %i", in snd_ice1712_probe()
2655 card->shortname, ice->port, ice->irq); in snd_ice1712_probe()
2669 struct snd_ice1712 *ice = card->private_data; in snd_ice1712_suspend()
2671 if (!ice->pm_suspend_enabled) in snd_ice1712_suspend()
2676 snd_ac97_suspend(ice->ac97); in snd_ice1712_suspend()
2678 spin_lock_irq(&ice->reg_lock); in snd_ice1712_suspend()
2679 ice->pm_saved_is_spdif_master = is_spdif_master(ice); in snd_ice1712_suspend()
2680 ice->pm_saved_spdif_ctrl = inw(ICEMT(ice, ROUTE_SPDOUT)); in snd_ice1712_suspend()
2681 ice->pm_saved_route = inw(ICEMT(ice, ROUTE_PSDOUT03)); in snd_ice1712_suspend()
2682 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_suspend()
2684 if (ice->pm_suspend) in snd_ice1712_suspend()
2685 ice->pm_suspend(ice); in snd_ice1712_suspend()
2692 struct snd_ice1712 *ice = card->private_data; in snd_ice1712_resume()
2695 if (!ice->pm_suspend_enabled) in snd_ice1712_resume()
2698 if (ice->cur_rate) in snd_ice1712_resume()
2699 rate = ice->cur_rate; in snd_ice1712_resume()
2705 return -EIO; in snd_ice1712_resume()
2708 ice->cur_rate = rate; in snd_ice1712_resume()
2710 if (ice->pm_resume) in snd_ice1712_resume()
2711 ice->pm_resume(ice); in snd_ice1712_resume()
2713 if (ice->pm_saved_is_spdif_master) { in snd_ice1712_resume()
2715 spin_lock_irq(&ice->reg_lock); in snd_ice1712_resume()
2718 spin_unlock_irq(&ice->reg_lock); in snd_ice1712_resume()
2721 /* internal on-card clock */ in snd_ice1712_resume()
2726 outw(ice->pm_saved_spdif_ctrl, ICEMT(ice, ROUTE_SPDOUT)); in snd_ice1712_resume()
2727 outw(ice->pm_saved_route, ICEMT(ice, ROUTE_PSDOUT03)); in snd_ice1712_resume()
2729 snd_ac97_resume(ice->ac97); in snd_ice1712_resume()
2742 .name = KBUILD_MODNAME,