Lines Matching defs:ice

97 static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg,
105 tmp = snd_ice1712_gpio_read(ice);
107 snd_ice1712_gpio_set_mask(ice, ~(AUREON_SPI_MOSI|AUREON_SPI_CLK|
115 snd_ice1712_gpio_write(ice, tmp);
123 snd_ice1712_gpio_write(ice, tmp);
126 snd_ice1712_gpio_write(ice, tmp);
129 snd_ice1712_gpio_write(ice, tmp);
132 snd_ice1712_gpio_write(ice, tmp);
152 snd_ice1712_gpio_write(ice, tmp);
158 snd_ice1712_gpio_write(ice, tmp);
161 snd_ice1712_gpio_write(ice, tmp);
165 snd_ice1712_gpio_write(ice, tmp);
168 snd_ice1712_gpio_write(ice, tmp);
171 snd_ice1712_gpio_write(ice, tmp);
175 snd_ice1712_gpio_write(ice, tmp);
178 snd_ice1712_gpio_write(ice, tmp);
181 snd_ice1712_gpio_write(ice, tmp);
184 snd_ice1712_gpio_write(ice, tmp);
200 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
201 struct aureon_spec *spec = ice->spec;
209 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
210 struct aureon_spec *spec = ice->spec;
217 snd_ice1712_save_gpio_status(ice);
221 aureon_pca9554_write(ice, PCA9554_OUT, nval);
224 snd_ice1712_restore_gpio_status(ice);
229 static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg,
232 struct aureon_spec *spec = ice->spec;
236 tmp = (snd_ice1712_gpio_read(ice) & ~0xFF) | (reg & 0x7F);
237 snd_ice1712_gpio_write(ice, tmp);
240 snd_ice1712_gpio_write(ice, tmp);
243 snd_ice1712_gpio_write(ice, tmp);
249 snd_ice1712_gpio_write(ice, tmp);
252 snd_ice1712_gpio_write(ice, tmp);
255 snd_ice1712_gpio_write(ice, tmp);
262 snd_ice1712_gpio_write(ice, tmp);
265 snd_ice1712_gpio_write(ice, tmp);
268 snd_ice1712_gpio_write(ice, tmp);
273 snd_ice1712_gpio_write(ice, tmp);
276 snd_ice1712_gpio_write(ice, tmp);
283 static unsigned short aureon_ac97_read(struct snd_ice1712 *ice, unsigned short reg)
285 struct aureon_spec *spec = ice->spec;
292 static int aureon_ac97_init(struct snd_ice1712 *ice)
294 struct aureon_spec *spec = ice->spec;
320 tmp = (snd_ice1712_gpio_read(ice) | AUREON_AC97_RESET) & ~AUREON_AC97_DATA_MASK;
321 snd_ice1712_gpio_write(ice, tmp);
325 snd_ice1712_gpio_write(ice, tmp);
329 snd_ice1712_gpio_write(ice, tmp);
337 aureon_ac97_write(ice, AC97_MASTER, 0x0000);
358 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
361 mutex_lock(&ice->gpio_mutex);
363 vol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F);
368 mutex_unlock(&ice->gpio_mutex);
374 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
378 snd_ice1712_save_gpio_status(ice);
380 ovol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F);
388 aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol);
390 snd_ice1712_restore_gpio_status(ice);
402 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
404 mutex_lock(&ice->gpio_mutex);
406 ucontrol->value.integer.value[0] = aureon_ac97_read(ice,
409 mutex_unlock(&ice->gpio_mutex);
415 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
419 snd_ice1712_save_gpio_status(ice);
421 ovol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F);
426 aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol);
428 snd_ice1712_restore_gpio_status(ice);
440 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
442 mutex_lock(&ice->gpio_mutex);
444 ucontrol->value.integer.value[0] = aureon_ac97_read(ice, AC97_MIC) & 0x0020 ? 0 : 1;
446 mutex_unlock(&ice->gpio_mutex);
452 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
456 snd_ice1712_save_gpio_status(ice);
458 ovol = aureon_ac97_read(ice, AC97_MIC);
463 aureon_ac97_write(ice, AC97_MIC, nvol);
465 snd_ice1712_restore_gpio_status(ice);
473 static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned int data, int bits)
479 tmp = snd_ice1712_gpio_read(ice);
481 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ||
482 ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT) {
483 snd_ice1712_gpio_set_mask(ice, ~(PRODIGY_SPI_MOSI|PRODIGY_SPI_CLK|PRODIGY_WM_CS));
487 snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RW|AUREON_SPI_MOSI|AUREON_SPI_CLK|
496 snd_ice1712_gpio_write(ice, tmp);
501 snd_ice1712_gpio_write(ice, tmp);
507 snd_ice1712_gpio_write(ice, tmp);
510 snd_ice1712_gpio_write(ice, tmp);
516 snd_ice1712_gpio_write(ice, tmp);
519 snd_ice1712_gpio_write(ice, tmp);
526 static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs,
532 tmp = (snd_ice1712_gpio_read(ice) & ~AUREON_SPI_CLK) | AUREON_CS8415_CS|AUREON_WM_CS;
533 snd_ice1712_gpio_write(ice, tmp);
535 snd_ice1712_gpio_write(ice, tmp);
543 snd_ice1712_gpio_write(ice, tmp);
547 snd_ice1712_gpio_write(ice, tmp);
551 snd_ice1712_gpio_write(ice, tmp);
558 tmp = snd_ice1712_gpio_read(ice);
564 snd_ice1712_gpio_write(ice, tmp);
568 snd_ice1712_gpio_write(ice, tmp);
575 snd_ice1712_gpio_write(ice, tmp);
578 static unsigned char aureon_cs8415_get(struct snd_ice1712 *ice, int reg)
581 aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16);
582 aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, &val, 1);
586 static void aureon_cs8415_read(struct snd_ice1712 *ice, int reg,
589 aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16);
590 aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, buffer, size);
593 static void aureon_cs8415_put(struct snd_ice1712 *ice, int reg,
596 aureon_spi_write(ice, AUREON_CS8415_CS, 0x200000 | (reg << 8) | val, 24);
602 static unsigned short wm_get(struct snd_ice1712 *ice, int reg)
605 return ((unsigned short)ice->akm[0].images[reg] << 8) |
606 ice->akm[0].images[reg + 1];
612 static void wm_put_nocache(struct snd_ice1712 *ice, int reg, unsigned short val)
614 aureon_spi_write(ice,
615 ((ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ||
616 ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT) ?
624 static void wm_put(struct snd_ice1712 *ice, int reg, unsigned short val)
626 wm_put_nocache(ice, reg, val);
628 ice->akm[0].images[reg] = val >> 8;
629 ice->akm[0].images[reg + 1] = val;
643 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
645 mutex_lock(&ice->gpio_mutex);
647 ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX1) >> 1) & 0x01;
649 mutex_unlock(&ice->gpio_mutex);
655 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
659 snd_ice1712_save_gpio_status(ice);
661 ovol = wm_get(ice, WM_OUT_MUX1);
665 wm_put(ice, WM_OUT_MUX1, nvol);
667 snd_ice1712_restore_gpio_status(ice);
682 static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master)
694 wm_put(ice, index, nvol);
695 wm_put_nocache(ice, index, 0x180 | nvol);
705 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
707 mutex_lock(&ice->gpio_mutex);
708 ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1;
709 mutex_unlock(&ice->gpio_mutex);
715 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
719 snd_ice1712_save_gpio_status(ice);
720 oval = wm_get(ice, WM_MUTE);
724 wm_put(ice, WM_MUTE, nval);
725 snd_ice1712_restore_gpio_status(ice);
744 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
745 struct aureon_spec *spec = ice->spec;
755 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
756 struct aureon_spec *spec = ice->spec;
759 snd_ice1712_save_gpio_status(ice);
768 for (dac = 0; dac < ice->num_total_dacs; dac += 2)
769 wm_set_vol(ice, WM_DAC_ATTEN + dac + ch,
775 snd_ice1712_restore_gpio_status(ice);
794 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
795 struct aureon_spec *spec = ice->spec;
808 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
809 struct aureon_spec *spec = ice->spec;
815 snd_ice1712_save_gpio_status(ice);
824 wm_set_vol(ice, idx, spec->vol[ofs + i],
829 snd_ice1712_restore_gpio_status(ice);
847 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
848 struct aureon_spec *spec = ice->spec;
862 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
863 struct aureon_spec *spec = ice->spec;
869 snd_ice1712_save_gpio_status(ice);
876 wm_set_vol(ice, ofs + i, spec->vol[ofs + i],
881 snd_ice1712_restore_gpio_status(ice);
893 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
894 struct aureon_spec *spec = ice->spec;
905 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
906 struct aureon_spec *spec = ice->spec;
909 snd_ice1712_save_gpio_status(ice);
917 for (dac = 0; dac < ice->num_total_dacs; dac += 2)
918 wm_set_vol(ice, WM_DAC_ATTEN + dac + i,
924 snd_ice1712_restore_gpio_status(ice);
944 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
947 mutex_lock(&ice->gpio_mutex);
948 val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
951 mutex_unlock(&ice->gpio_mutex);
957 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
964 snd_ice1712_save_gpio_status(ice);
966 ovol = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
968 wm_put(ice, WM_DAC_DIG_MASTER_ATTEN, nvol); /* prelatch */
969 wm_put_nocache(ice, WM_DAC_DIG_MASTER_ATTEN, nvol | 0x100); /* update */
972 snd_ice1712_restore_gpio_status(ice);
983 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
987 mutex_lock(&ice->gpio_mutex);
989 val = wm_get(ice, WM_ADC_GAIN + i);
992 mutex_unlock(&ice->gpio_mutex);
998 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1002 snd_ice1712_save_gpio_status(ice);
1004 old = wm_get(ice, WM_ADC_GAIN + i);
1007 wm_put(ice, WM_ADC_GAIN + i, new);
1011 snd_ice1712_restore_gpio_status(ice);
1030 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1034 mutex_lock(&ice->gpio_mutex);
1037 vol = wm_get(ice, idx) & 0x1f;
1040 mutex_unlock(&ice->gpio_mutex);
1046 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1051 snd_ice1712_save_gpio_status(ice);
1055 ovol = wm_get(ice, idx);
1057 wm_put(ice, idx, nvol | (ovol & ~0x1f));
1061 snd_ice1712_restore_gpio_status(ice);
1087 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1089 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON71_UNIVERSE)
1097 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1100 mutex_lock(&ice->gpio_mutex);
1101 val = wm_get(ice, WM_ADC_MUX);
1104 mutex_unlock(&ice->gpio_mutex);
1110 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1114 snd_ice1712_save_gpio_status(ice);
1115 oval = wm_get(ice, WM_ADC_MUX);
1121 wm_put(ice, WM_ADC_MUX, nval);
1122 snd_ice1712_restore_gpio_status(ice);
1131 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1140 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71)
1148 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1149 struct aureon_spec *spec = ice->spec;
1151 /* snd_ice1712_save_gpio_status(ice); */
1152 /* val = aureon_cs8415_get(ice, CS8415_CTRL2); */
1154 /* snd_ice1712_restore_gpio_status(ice); */
1160 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1161 struct aureon_spec *spec = ice->spec;
1165 snd_ice1712_save_gpio_status(ice);
1166 oval = aureon_cs8415_get(ice, CS8415_CTRL2);
1171 aureon_cs8415_put(ice, CS8415_CTRL2, nval);
1172 snd_ice1712_restore_gpio_status(ice);
1188 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1190 ratio = aureon_cs8415_get(ice, CS8415_RATIO);
1202 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1203 snd_ice1712_save_gpio_status(ice);
1204 ucontrol->value.integer.value[0] = (aureon_cs8415_get(ice, CS8415_CTRL1) & 0x20) ? 0 : 1;
1205 snd_ice1712_restore_gpio_status(ice);
1211 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1214 snd_ice1712_save_gpio_status(ice);
1215 oval = aureon_cs8415_get(ice, CS8415_CTRL1);
1222 aureon_cs8415_put(ice, CS8415_CTRL1, nval);
1223 snd_ice1712_restore_gpio_status(ice);
1239 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1241 snd_ice1712_save_gpio_status(ice);
1242 aureon_cs8415_read(ice, CS8415_QSUB, ucontrol->value.bytes.data, 10);
1243 snd_ice1712_restore_gpio_status(ice);
1263 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1265 snd_ice1712_save_gpio_status(ice);
1266 aureon_cs8415_read(ice, CS8415_C_BUFFER, ucontrol->value.iec958.status, 24);
1267 snd_ice1712_restore_gpio_status(ice);
1274 static int aureon_set_headphone_amp(struct snd_ice1712 *ice, int enable)
1278 tmp2 = tmp = snd_ice1712_gpio_read(ice);
1280 if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
1281 ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT)
1286 if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
1287 ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT)
1292 snd_ice1712_gpio_write(ice, tmp);
1298 static int aureon_get_headphone_amp(struct snd_ice1712 *ice)
1300 unsigned int tmp = snd_ice1712_gpio_read(ice);
1309 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1311 ucontrol->value.integer.value[0] = aureon_get_headphone_amp(ice);
1318 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1320 return aureon_set_headphone_amp(ice, ucontrol->value.integer.value[0]);
1331 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1332 ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL2) & 0xf) == 0xf;
1338 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1340 temp2 = temp = wm_get(ice, WM_DAC_CTRL2);
1346 wm_put(ice, WM_DAC_CTRL2, temp);
1364 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1365 ucontrol->value.enumerated.item[0] = (wm_get(ice, WM_MASTER) & 0x8) == 0x8;
1372 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1374 temp2 = temp = wm_get(ice, WM_MASTER);
1382 wm_put(ice, WM_MASTER, temp);
1855 static int aureon_add_controls(struct snd_ice1712 *ice)
1861 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY)
1864 err = snd_ctl_add(ice->card, snd_ctl_new1(&aureon_dac_controls[i], ice));
1870 err = snd_ctl_add(ice->card, snd_ctl_new1(&wm_controls[i], ice));
1875 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON71_UNIVERSE) {
1877 err = snd_ctl_add(ice->card, snd_ctl_new1(&universe_ac97_controls[i], ice));
1881 } else if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
1882 ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) {
1884 err = snd_ctl_add(ice->card, snd_ctl_new1(&ac97_controls[i], ice));
1890 if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
1891 ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) {
1893 snd_ice1712_save_gpio_status(ice);
1894 id = aureon_cs8415_get(ice, CS8415_ID);
1895 snd_ice1712_restore_gpio_status(ice);
1897 dev_info(ice->card->dev,
1902 kctl = snd_ctl_new1(&cs8415_controls[i], ice);
1904 kctl->id.device = ice->pcm->device;
1905 err = snd_ctl_add(ice->card, kctl);
1918 static int aureon_reset(struct snd_ice1712 *ice)
2008 struct aureon_spec *spec = ice->spec;
2010 err = aureon_ac97_init(ice);
2014 snd_ice1712_gpio_set_dir(ice, 0x5fffff); /* fix this for the time being */
2017 snd_ice1712_save_gpio_status(ice);
2018 snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RESET|AUREON_WM_CS|AUREON_CS8415_CS|AUREON_HP_SEL));
2020 tmp = snd_ice1712_gpio_read(ice);
2022 snd_ice1712_gpio_write(ice, tmp);
2025 snd_ice1712_gpio_write(ice, tmp);
2028 snd_ice1712_gpio_write(ice, tmp);
2032 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71 ||
2033 ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT ||
2034 ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT)
2039 wm_put(ice, p[0], p[1]);
2042 if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT &&
2043 ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) {
2045 aureon_spi_write(ice, AUREON_CS8415_CS, *p | 0x200000, 24);
2048 aureon_set_headphone_amp(ice, 1);
2051 snd_ice1712_restore_gpio_status(ice);
2054 aureon_pca9554_write(ice, PCA9554_DIR, 0x00);
2055 aureon_pca9554_write(ice, PCA9554_OUT, 0x00); /* internal AUX */
2063 static int aureon_resume(struct snd_ice1712 *ice)
2065 struct aureon_spec *spec = ice->spec;
2068 err = aureon_reset(ice);
2074 for (i = 0; i < ice->num_total_dacs; i++)
2075 wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]);
2083 static int aureon_init(struct snd_ice1712 *ice)
2091 ice->spec = spec;
2093 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) {
2094 ice->num_total_dacs = 6;
2095 ice->num_total_adcs = 2;
2098 ice->num_total_dacs = 8;
2099 ice->num_total_adcs = 2;
2103 ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
2104 if (!ice->akm)
2106 ice->akm_codecs = 1;
2108 err = aureon_reset(ice);
2114 for (i = 0; i < ice->num_total_dacs; i++) {
2116 wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]);
2120 ice->pm_resume = aureon_resume;
2121 ice->pm_suspend_enabled = 1;