diff options
Diffstat (limited to 'sound/pci/oxygen/xonar_cs43xx.c')
-rw-r--r-- | sound/pci/oxygen/xonar_cs43xx.c | 92 |
1 files changed, 53 insertions, 39 deletions
diff --git a/sound/pci/oxygen/xonar_cs43xx.c b/sound/pci/oxygen/xonar_cs43xx.c index 7c4986b27f2b..252719101c42 100644 --- a/sound/pci/oxygen/xonar_cs43xx.c +++ b/sound/pci/oxygen/xonar_cs43xx.c | |||
@@ -22,29 +22,28 @@ | |||
22 | * | 22 | * |
23 | * CMI8788: | 23 | * CMI8788: |
24 | * | 24 | * |
25 | * I²C <-> CS4398 (front) | 25 | * I²C <-> CS4398 (addr 1001111) (front) |
26 | * <-> CS4362A (surround, center/LFE, back) | 26 | * <-> CS4362A (addr 0011000) (surround, center/LFE, back) |
27 | * | 27 | * |
28 | * GPI 0 <- external power present (DX only) | 28 | * GPI 0 <- external power present (DX only) |
29 | * | 29 | * |
30 | * GPIO 0 -> enable output to speakers | 30 | * GPIO 0 -> enable output to speakers |
31 | * GPIO 1 -> enable front panel I/O | 31 | * GPIO 1 -> route output to front panel |
32 | * GPIO 2 -> M0 of CS5361 | 32 | * GPIO 2 -> M0 of CS5361 |
33 | * GPIO 3 -> M1 of CS5361 | 33 | * GPIO 3 -> M1 of CS5361 |
34 | * GPIO 8 -> route input jack to line-in (0) or mic-in (1) | 34 | * GPIO 6 -> ? |
35 | * GPIO 7 -> ? | ||
36 | * GPIO 8 -> route input jack to line-in (0) or mic-in (1) | ||
35 | * | 37 | * |
36 | * CS4398: | 38 | * CM9780: |
37 | * | ||
38 | * AD0 <- 1 | ||
39 | * AD1 <- 1 | ||
40 | * | ||
41 | * CS4362A: | ||
42 | * | 39 | * |
43 | * AD0 <- 0 | 40 | * LINE_OUT -> input of ADC |
44 | * | 41 | * |
45 | * CM9780: | 42 | * AUX_IN <- aux |
43 | * MIC_IN <- mic | ||
44 | * FMIC_IN <- front mic | ||
46 | * | 45 | * |
47 | * GPO 0 -> route line-in (0) or AC97 output (1) to CS5361 input | 46 | * GPO 0 -> route line-in (0) or AC97 output (1) to CS5361 input |
48 | */ | 47 | */ |
49 | 48 | ||
50 | #include <linux/pci.h> | 49 | #include <linux/pci.h> |
@@ -63,6 +62,7 @@ | |||
63 | #define GPI_EXT_POWER 0x01 | 62 | #define GPI_EXT_POWER 0x01 |
64 | #define GPIO_D1_OUTPUT_ENABLE 0x0001 | 63 | #define GPIO_D1_OUTPUT_ENABLE 0x0001 |
65 | #define GPIO_D1_FRONT_PANEL 0x0002 | 64 | #define GPIO_D1_FRONT_PANEL 0x0002 |
65 | #define GPIO_D1_MAGIC 0x00c0 | ||
66 | #define GPIO_D1_INPUT_ROUTE 0x0100 | 66 | #define GPIO_D1_INPUT_ROUTE 0x0100 |
67 | 67 | ||
68 | #define I2C_DEVICE_CS4398 0x9e /* 10011, AD1=1, AD0=1, /W=0 */ | 68 | #define I2C_DEVICE_CS4398 0x9e /* 10011, AD1=1, AD0=1, /W=0 */ |
@@ -169,12 +169,12 @@ static void xonar_d1_init(struct oxygen *chip) | |||
169 | cs43xx_registers_init(chip); | 169 | cs43xx_registers_init(chip); |
170 | 170 | ||
171 | oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, | 171 | oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, |
172 | GPIO_D1_FRONT_PANEL | GPIO_D1_INPUT_ROUTE); | 172 | GPIO_D1_FRONT_PANEL | |
173 | GPIO_D1_MAGIC | | ||
174 | GPIO_D1_INPUT_ROUTE); | ||
173 | oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, | 175 | oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, |
174 | GPIO_D1_FRONT_PANEL | GPIO_D1_INPUT_ROUTE); | 176 | GPIO_D1_FRONT_PANEL | GPIO_D1_INPUT_ROUTE); |
175 | 177 | ||
176 | oxygen_ac97_set_bits(chip, 0, CM9780_JACK, CM9780_FMIC2MIC); | ||
177 | |||
178 | xonar_init_cs53x1(chip); | 178 | xonar_init_cs53x1(chip); |
179 | xonar_enable_output(chip); | 179 | xonar_enable_output(chip); |
180 | 180 | ||
@@ -284,7 +284,7 @@ static void update_cs43xx_center_lfe_mix(struct oxygen *chip, bool mixed) | |||
284 | 284 | ||
285 | static const struct snd_kcontrol_new front_panel_switch = { | 285 | static const struct snd_kcontrol_new front_panel_switch = { |
286 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 286 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
287 | .name = "Front Panel Switch", | 287 | .name = "Front Panel Playback Switch", |
288 | .info = snd_ctl_boolean_mono_info, | 288 | .info = snd_ctl_boolean_mono_info, |
289 | .get = xonar_gpio_bit_switch_get, | 289 | .get = xonar_gpio_bit_switch_get, |
290 | .put = xonar_gpio_bit_switch_put, | 290 | .put = xonar_gpio_bit_switch_put, |
@@ -298,13 +298,7 @@ static int rolloff_info(struct snd_kcontrol *ctl, | |||
298 | "Fast Roll-off", "Slow Roll-off" | 298 | "Fast Roll-off", "Slow Roll-off" |
299 | }; | 299 | }; |
300 | 300 | ||
301 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 301 | return snd_ctl_enum_info(info, 1, 2, names); |
302 | info->count = 1; | ||
303 | info->value.enumerated.items = 2; | ||
304 | if (info->value.enumerated.item >= 2) | ||
305 | info->value.enumerated.item = 1; | ||
306 | strcpy(info->value.enumerated.name, names[info->value.enumerated.item]); | ||
307 | return 0; | ||
308 | } | 302 | } |
309 | 303 | ||
310 | static int rolloff_get(struct snd_kcontrol *ctl, | 304 | static int rolloff_get(struct snd_kcontrol *ctl, |
@@ -367,13 +361,6 @@ static void xonar_d1_line_mic_ac97_switch(struct oxygen *chip, | |||
367 | 361 | ||
368 | static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -6000, 100, 0); | 362 | static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -6000, 100, 0); |
369 | 363 | ||
370 | static int xonar_d1_control_filter(struct snd_kcontrol_new *template) | ||
371 | { | ||
372 | if (!strncmp(template->name, "CD Capture ", 11)) | ||
373 | return 1; /* no CD input */ | ||
374 | return 0; | ||
375 | } | ||
376 | |||
377 | static int xonar_d1_mixer_init(struct oxygen *chip) | 364 | static int xonar_d1_mixer_init(struct oxygen *chip) |
378 | { | 365 | { |
379 | int err; | 366 | int err; |
@@ -387,31 +374,58 @@ static int xonar_d1_mixer_init(struct oxygen *chip) | |||
387 | return 0; | 374 | return 0; |
388 | } | 375 | } |
389 | 376 | ||
377 | static void dump_cs4362a_registers(struct xonar_cs43xx *data, | ||
378 | struct snd_info_buffer *buffer) | ||
379 | { | ||
380 | unsigned int i; | ||
381 | |||
382 | snd_iprintf(buffer, "\nCS4362A:"); | ||
383 | for (i = 1; i <= 14; ++i) | ||
384 | snd_iprintf(buffer, " %02x", data->cs4362a_regs[i]); | ||
385 | snd_iprintf(buffer, "\n"); | ||
386 | } | ||
387 | |||
388 | static void dump_d1_registers(struct oxygen *chip, | ||
389 | struct snd_info_buffer *buffer) | ||
390 | { | ||
391 | struct xonar_cs43xx *data = chip->model_data; | ||
392 | unsigned int i; | ||
393 | |||
394 | snd_iprintf(buffer, "\nCS4398: 7?"); | ||
395 | for (i = 2; i < 8; ++i) | ||
396 | snd_iprintf(buffer, " %02x", data->cs4398_regs[i]); | ||
397 | snd_iprintf(buffer, "\n"); | ||
398 | dump_cs4362a_registers(data, buffer); | ||
399 | } | ||
400 | |||
390 | static const struct oxygen_model model_xonar_d1 = { | 401 | static const struct oxygen_model model_xonar_d1 = { |
391 | .longname = "Asus Virtuoso 100", | 402 | .longname = "Asus Virtuoso 100", |
392 | .chip = "AV200", | 403 | .chip = "AV200", |
393 | .init = xonar_d1_init, | 404 | .init = xonar_d1_init, |
394 | .control_filter = xonar_d1_control_filter, | ||
395 | .mixer_init = xonar_d1_mixer_init, | 405 | .mixer_init = xonar_d1_mixer_init, |
396 | .cleanup = xonar_d1_cleanup, | 406 | .cleanup = xonar_d1_cleanup, |
397 | .suspend = xonar_d1_suspend, | 407 | .suspend = xonar_d1_suspend, |
398 | .resume = xonar_d1_resume, | 408 | .resume = xonar_d1_resume, |
399 | .get_i2s_mclk = oxygen_default_i2s_mclk, | ||
400 | .set_dac_params = set_cs43xx_params, | 409 | .set_dac_params = set_cs43xx_params, |
401 | .set_adc_params = xonar_set_cs53x1_params, | 410 | .set_adc_params = xonar_set_cs53x1_params, |
402 | .update_dac_volume = update_cs43xx_volume, | 411 | .update_dac_volume = update_cs43xx_volume, |
403 | .update_dac_mute = update_cs43xx_mute, | 412 | .update_dac_mute = update_cs43xx_mute, |
404 | .update_center_lfe_mix = update_cs43xx_center_lfe_mix, | 413 | .update_center_lfe_mix = update_cs43xx_center_lfe_mix, |
405 | .ac97_switch = xonar_d1_line_mic_ac97_switch, | 414 | .ac97_switch = xonar_d1_line_mic_ac97_switch, |
415 | .dump_registers = dump_d1_registers, | ||
406 | .dac_tlv = cs4362a_db_scale, | 416 | .dac_tlv = cs4362a_db_scale, |
407 | .model_data_size = sizeof(struct xonar_cs43xx), | 417 | .model_data_size = sizeof(struct xonar_cs43xx), |
408 | .device_config = PLAYBACK_0_TO_I2S | | 418 | .device_config = PLAYBACK_0_TO_I2S | |
409 | PLAYBACK_1_TO_SPDIF | | 419 | PLAYBACK_1_TO_SPDIF | |
410 | CAPTURE_0_FROM_I2S_2, | 420 | CAPTURE_0_FROM_I2S_2 | |
411 | .dac_channels = 8, | 421 | AC97_FMIC_SWITCH, |
422 | .dac_channels_pcm = 8, | ||
423 | .dac_channels_mixer = 8, | ||
412 | .dac_volume_min = 127 - 60, | 424 | .dac_volume_min = 127 - 60, |
413 | .dac_volume_max = 127, | 425 | .dac_volume_max = 127, |
414 | .function_flags = OXYGEN_FUNCTION_2WIRE, | 426 | .function_flags = OXYGEN_FUNCTION_2WIRE, |
427 | .dac_mclks = OXYGEN_MCLKS(256, 128, 128), | ||
428 | .adc_mclks = OXYGEN_MCLKS(256, 128, 128), | ||
415 | .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | 429 | .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, |
416 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | 430 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, |
417 | }; | 431 | }; |