📄 aureon.c
字号:
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Mic Playback Volume", .info = aureon_ac97_vol_info, .get = aureon_ac97_vol_get, .put = aureon_ac97_vol_put, .private_value = AC97_MIC }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Mic Boost (+20dB)", .info = aureon_ac97_micboost_info, .get = aureon_ac97_micboost_get, .put = aureon_ac97_micboost_put }};static snd_kcontrol_new_t universe_ac97_controls[] __devinitdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "AC97 Playback Switch", .info = aureon_ac97_mmute_info, .get = aureon_ac97_mmute_get, .put = aureon_ac97_mmute_put, .private_value = AC97_MASTER }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "AC97 Playback Volume", .info = aureon_ac97_vol_info, .get = aureon_ac97_vol_get, .put = aureon_ac97_vol_put, .private_value = AC97_MASTER|AUREON_AC97_STEREO }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "CD Playback Switch", .info = aureon_ac97_mute_info, .get = aureon_ac97_mute_get, .put = aureon_ac97_mute_put, .private_value = AC97_AUX }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "CD Playback Volume", .info = aureon_ac97_vol_info, .get = aureon_ac97_vol_get, .put = aureon_ac97_vol_put, .private_value = AC97_AUX|AUREON_AC97_STEREO }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Phono Playback Switch", .info = aureon_ac97_mute_info, .get = aureon_ac97_mute_get, .put = aureon_ac97_mute_put, .private_value = AC97_CD, }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Phono Playback Volume", .info = aureon_ac97_vol_info, .get = aureon_ac97_vol_get, .put = aureon_ac97_vol_put, .private_value = AC97_CD|AUREON_AC97_STEREO }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Line Playback Switch", .info = aureon_ac97_mute_info, .get = aureon_ac97_mute_get, .put = aureon_ac97_mute_put, .private_value = AC97_LINE }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Line Playback Volume", .info = aureon_ac97_vol_info, .get = aureon_ac97_vol_get, .put = aureon_ac97_vol_put, .private_value = AC97_LINE|AUREON_AC97_STEREO }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Mic Playback Switch", .info = aureon_ac97_mute_info, .get = aureon_ac97_mute_get, .put = aureon_ac97_mute_put, .private_value = AC97_MIC }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Mic Playback Volume", .info = aureon_ac97_vol_info, .get = aureon_ac97_vol_get, .put = aureon_ac97_vol_put, .private_value = AC97_MIC }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Mic Boost (+20dB)", .info = aureon_ac97_micboost_info, .get = aureon_ac97_micboost_get, .put = aureon_ac97_micboost_put }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Aux Playback Switch", .info = aureon_ac97_mute_info, .get = aureon_ac97_mute_get, .put = aureon_ac97_mute_put, .private_value = AC97_VIDEO, }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Aux Playback Volume", .info = aureon_ac97_vol_info, .get = aureon_ac97_vol_get, .put = aureon_ac97_vol_put, .private_value = AC97_VIDEO|AUREON_AC97_STEREO }}; static snd_kcontrol_new_t cs8415_controls[] __devinitdata = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), .info = aureon_cs8415_mute_info, .get = aureon_cs8415_mute_get, .put = aureon_cs8415_mute_put }, { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Source", .info = aureon_cs8415_mux_info, .get = aureon_cs8415_mux_get, .put = aureon_cs8415_mux_put, }, { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("Q-subcode ",CAPTURE,DEFAULT), .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = aureon_cs8415_qsub_info, .get = aureon_cs8415_qsub_get, }, { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,MASK), .access = SNDRV_CTL_ELEM_ACCESS_READ, .info = aureon_cs8415_spdif_info, .get = aureon_cs8415_mask_get }, { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,DEFAULT), .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = aureon_cs8415_spdif_info, .get = aureon_cs8415_spdif_get }, { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Rate", .access =SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = aureon_cs8415_rate_info, .get = aureon_cs8415_rate_get }}; static int __devinit aureon_add_controls(ice1712_t *ice){ unsigned int i, counts; int err; counts = ARRAY_SIZE(aureon_dac_controls); if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) counts -= 2; /* no side */ for (i = 0; i < counts; i++) { err = snd_ctl_add(ice->card, snd_ctl_new1(&aureon_dac_controls[i], ice)); if (err < 0) return err; } for (i = 0; i < ARRAY_SIZE(wm_controls); i++) { err = snd_ctl_add(ice->card, snd_ctl_new1(&wm_controls[i], ice)); if (err < 0) return err; } if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON71_UNIVERSE) { for (i = 0; i < ARRAY_SIZE(universe_ac97_controls); i++) { err = snd_ctl_add(ice->card, snd_ctl_new1(&universe_ac97_controls[i], ice)); if (err < 0) return err; } } else { for (i = 0; i < ARRAY_SIZE(ac97_controls); i++) { err = snd_ctl_add(ice->card, snd_ctl_new1(&ac97_controls[i], ice)); if (err < 0) return err; } } { unsigned char id; snd_ice1712_save_gpio_status(ice); id = aureon_cs8415_get(ice, CS8415_ID); if (id != 0x41) snd_printk("No CS8415 chip. Skipping CS8415 controls.\n"); else if ((id & 0x0F) != 0x01) snd_printk("Detected unsupported CS8415 rev. (%c)\n", (char)((id & 0x0F) + 'A' - 1)); else { for (i = 0; i< ARRAY_SIZE(cs8415_controls); i++) { snd_kcontrol_t *kctl; err = snd_ctl_add(ice->card, (kctl = snd_ctl_new1(&cs8415_controls[i], ice))); if (err < 0) return err; if (i > 1) kctl->id.device = ice->pcm->device; } } snd_ice1712_restore_gpio_status(ice); } return 0;}/* * initialize the chip */static int __devinit aureon_init(ice1712_t *ice){ static unsigned short wm_inits_aureon[] = { /* These come first to reduce init pop noise */ 0x1b, 0x044, /* ADC Mux (AC'97 source) */ 0x1c, 0x00B, /* Out Mux1 (VOUT1 = DAC+AUX, VOUT2 = DAC) */ 0x1d, 0x009, /* Out Mux2 (VOUT2 = DAC, VOUT3 = DAC) */ 0x18, 0x000, /* All power-up */ 0x16, 0x122, /* I2S, normal polarity, 24bit */ 0x17, 0x022, /* 256fs, slave mode */ 0x00, 0, /* DAC1 analog mute */ 0x01, 0, /* DAC2 analog mute */ 0x02, 0, /* DAC3 analog mute */ 0x03, 0, /* DAC4 analog mute */ 0x04, 0, /* DAC5 analog mute */ 0x05, 0, /* DAC6 analog mute */ 0x06, 0, /* DAC7 analog mute */ 0x07, 0, /* DAC8 analog mute */ 0x08, 0x100, /* master analog mute */ 0x09, 0xff, /* DAC1 digital full */ 0x0a, 0xff, /* DAC2 digital full */ 0x0b, 0xff, /* DAC3 digital full */ 0x0c, 0xff, /* DAC4 digital full */ 0x0d, 0xff, /* DAC5 digital full */ 0x0e, 0xff, /* DAC6 digital full */ 0x0f, 0xff, /* DAC7 digital full */ 0x10, 0xff, /* DAC8 digital full */ 0x11, 0x1ff, /* master digital full */ 0x12, 0x000, /* phase normal */ 0x13, 0x090, /* unmute DAC L/R */ 0x14, 0x000, /* all unmute */ 0x15, 0x000, /* no deemphasis, no ZFLG */ 0x19, 0x000, /* -12dB ADC/L */ 0x1a, 0x000, /* -12dB ADC/R */ (unsigned short)-1 }; static unsigned short wm_inits_prodigy[] = { /* These come first to reduce init pop noise */ 0x1b, 0x000, /* ADC Mux */ 0x1c, 0x009, /* Out Mux1 */ 0x1d, 0x009, /* Out Mux2 */ 0x18, 0x000, /* All power-up */ 0x16, 0x022, /* I2S, normal polarity, 24bit, high-pass on */ 0x17, 0x006, /* 128fs, slave mode */ 0x00, 0, /* DAC1 analog mute */ 0x01, 0, /* DAC2 analog mute */ 0x02, 0, /* DAC3 analog mute */ 0x03, 0, /* DAC4 analog mute */ 0x04, 0, /* DAC5 analog mute */ 0x05, 0, /* DAC6 analog mute */ 0x06, 0, /* DAC7 analog mute */ 0x07, 0, /* DAC8 analog mute */ 0x08, 0x100, /* master analog mute */ 0x09, 0x7f, /* DAC1 digital full */ 0x0a, 0x7f, /* DAC2 digital full */ 0x0b, 0x7f, /* DAC3 digital full */ 0x0c, 0x7f, /* DAC4 digital full */ 0x0d, 0x7f, /* DAC5 digital full */ 0x0e, 0x7f, /* DAC6 digital full */ 0x0f, 0x7f, /* DAC7 digital full */ 0x10, 0x7f, /* DAC8 digital full */ 0x11, 0x1FF, /* master digital full */ 0x12, 0x000, /* phase normal */ 0x13, 0x090, /* unmute DAC L/R */ 0x14, 0x000, /* all unmute */ 0x15, 0x000, /* no deemphasis, no ZFLG */ 0x19, 0x000, /* -12dB ADC/L */ 0x1a, 0x000, /* -12dB ADC/R */ (unsigned short)-1 }; static unsigned short cs_inits[] = { 0x0441, /* RUN */ 0x0180, /* no mute, OMCK output on RMCK pin */ 0x0201, /* S/PDIF source on RXP1 */ 0x0605, /* slave, 24bit, MSB on second OSCLK, SDOUT for right channel when OLRCK is high */ (unsigned short)-1 }; unsigned int tmp; unsigned short *p; int err, i; if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) { ice->num_total_dacs = 6; ice->num_total_adcs = 2; } else { /* aureon 7.1 and prodigy 7.1 */ ice->num_total_dacs = 8; ice->num_total_adcs = 2; } /* to remeber the register values of CS8415 */ ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); if (! ice->akm) return -ENOMEM; ice->akm_codecs = 1; if ((err = aureon_ac97_init(ice)) != 0) return err; snd_ice1712_gpio_set_dir(ice, 0x5fffff); /* fix this for the time being */ /* reset the wm codec as the SPI mode */ snd_ice1712_save_gpio_status(ice); snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RESET|AUREON_WM_CS|AUREON_CS8415_CS|AUREON_HP_SEL)); tmp = snd_ice1712_gpio_read(ice); tmp &= ~AUREON_WM_RESET; snd_ice1712_gpio_write(ice, tmp); udelay(1); tmp |= AUREON_WM_CS | AUREON_CS8415_CS; snd_ice1712_gpio_write(ice, tmp); udelay(1); tmp |= AUREON_WM_RESET; snd_ice1712_gpio_write(ice, tmp); udelay(1); /* initialize WM8770 codec */ if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71) p = wm_inits_prodigy; else p = wm_inits_aureon; for (; *p != (unsigned short)-1; p += 2) wm_put(ice, p[0], p[1]); /* initialize CS8415A codec */ for (p = cs_inits; *p != (unsigned short)-1; p++) aureon_spi_write(ice, AUREON_CS8415_CS, *p | 0x200000, 24); ice->spec.aureon.cs8415_mux = 1; aureon_set_headphone_amp(ice, 1); snd_ice1712_restore_gpio_status(ice); ice->spec.aureon.master[0] = WM_VOL_MUTE; ice->spec.aureon.master[1] = WM_VOL_MUTE; for (i = 0; i < ice->num_total_dacs; i++) { ice->spec.aureon.vol[i] = WM_VOL_MUTE; wm_set_vol(ice, i, ice->spec.aureon.vol[i], ice->spec.aureon.master[i % 2]); } return 0;}/* * Aureon boards don't provide the EEPROM data except for the vendor IDs. * hence the driver needs to sets up it properly. */static unsigned char aureon51_eeprom[] __devinitdata = { 0x0a, /* SYSCONF: clock 512, spdif-in/ADC, 3DACs */ 0x80, /* ACLINK: I2S */ 0xfc, /* I2S: vol, 96k, 24bit, 192k */ 0xc3, /* SPDIF: out-en, out-int, spdif-in */ 0xff, /* GPIO_DIR */ 0xff, /* GPIO_DIR1 */ 0x5f, /* GPIO_DIR2 */ 0x00, /* GPIO_MASK */ 0x00, /* GPIO_MASK1 */ 0x00, /* GPIO_MASK2 */ 0x00, /* GPIO_STATE */ 0x00, /* GPIO_STATE1 */ 0x00, /* GPIO_STATE2 */};static unsigned char aureon71_eeprom[] __devinitdata = { 0x0b, /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */ 0x80, /* ACLINK: I2S */ 0xfc, /* I2S: vol, 96k, 24bit, 192k */ 0xc3, /* SPDIF: out-en, out-int, spdif-in */ 0xff, /* GPIO_DIR */ 0xff, /* GPIO_DIR1 */ 0x5f, /* GPIO_DIR2 */ 0x00, /* GPIO_MASK */ 0x00, /* GPIO_MASK1 */ 0x00, /* GPIO_MASK2 */ 0x00, /* GPIO_STATE */ 0x00, /* GPIO_STATE1 */ 0x00, /* GPIO_STATE2 */};static unsigned char prodigy71_eeprom[] __devinitdata = { 0x0b, /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */ 0x80, /* ACLINK: I2S */ 0xfc, /* I2S: vol, 96k, 24bit, 192k */ 0xc3, /* SPDIF: out-en, out-int, spdif-in */ 0xff, /* GPIO_DIR */ 0xff, /* GPIO_DIR1 */ 0x5f, /* GPIO_DIR2 */ 0x00, /* GPIO_MASK */ 0x00, /* GPIO_MASK1 */ 0x00, /* GPIO_MASK2 */ 0x00, /* GPIO_STATE */ 0x00, /* GPIO_STATE1 */ 0x00, /* GPIO_STATE2 */};/* entry point */struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = { { .subvendor = VT1724_SUBDEVICE_AUREON51_SKY, .name = "Terratec Aureon 5.1-Sky", .model = "aureon51", .chip_init = aureon_init, .build_controls = aureon_add_controls, .eeprom_size = sizeof(aureon51_eeprom), .eeprom_data = aureon51_eeprom, .driver = "Aureon51", }, { .subvendor = VT1724_SUBDEVICE_AUREON71_SPACE, .name = "Terratec Aureon 7.1-Space", .model = "aureon71", .chip_init = aureon_init, .build_controls = aureon_add_controls, .eeprom_size = sizeof(aureon71_eeprom), .eeprom_data = aureon71_eeprom, .driver = "Aureon71", }, { .subvendor = VT1724_SUBDEVICE_AUREON71_UNIVERSE, .name = "Terratec Aureon 7.1-Universe", .model = "universe", .chip_init = aureon_init, .build_controls = aureon_add_controls, .eeprom_size = sizeof(aureon71_eeprom), .eeprom_data = aureon71_eeprom, .driver = "Aureon71Universe", }, { .subvendor = VT1724_SUBDEVICE_PRODIGY71, .name = "Audiotrak Prodigy 7.1", .model = "prodigy71", .chip_init = aureon_init, .build_controls = aureon_add_controls, .eeprom_size = sizeof(prodigy71_eeprom), .eeprom_data = prodigy71_eeprom, .driver = "Prodigy71", /* should be identical with Aureon71 */ }, { } /* terminator */};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -