49 #include <linux/pci.h>
62 #define GPI_EXT_POWER 0x01
63 #define GPIO_D1_OUTPUT_ENABLE 0x0001
64 #define GPIO_D1_FRONT_PANEL 0x0002
65 #define GPIO_D1_MAGIC 0x00c0
66 #define GPIO_D1_INPUT_ROUTE 0x0100
68 #define I2C_DEVICE_CS4398 0x9e
69 #define I2C_DEVICE_CS4362A 0x30
91 cs4398_write(chip, reg, value);
94 static void cs4362a_write(
struct oxygen *chip,
u8 reg,
u8 value)
103 static void cs4362a_write_cached(
struct oxygen *chip,
u8 reg,
u8 value)
108 cs4362a_write(chip, reg, value);
111 static void cs43xx_registers_init(
struct oxygen *chip)
130 cs4362a_write(chip, 0x05, 0);
131 for (i = 6; i <= 14; ++
i)
138 static void xonar_d1_init(
struct oxygen *chip)
142 data->
generic.anti_pop_delay = 800;
169 cs43xx_registers_init(chip);
186 static void xonar_dx_init(
struct oxygen *chip)
197 static void xonar_d1_cleanup(
struct oxygen *chip)
204 static void xonar_d1_suspend(
struct oxygen *chip)
206 xonar_d1_cleanup(chip);
209 static void xonar_d1_resume(
struct oxygen *chip)
213 cs43xx_registers_init(chip);
217 static void set_cs43xx_params(
struct oxygen *chip,
221 u8 cs4398_fm, cs4362a_fm;
234 cs4398_write_cached(chip, 2, cs4398_fm);
236 cs4362a_write_cached(chip, 6, cs4362a_fm);
237 cs4362a_write_cached(chip, 12, cs4362a_fm);
240 cs4362a_write_cached(chip, 9, cs4362a_fm);
243 static void update_cs4362a_volumes(
struct oxygen *chip)
249 for (i = 0; i < 6; ++
i)
250 cs4362a_write_cached(chip, 7 + i + i / 2,
254 static void update_cs43xx_volume(
struct oxygen *chip)
256 cs4398_write_cached(chip, 5, (127 - chip->
dac_volume[0]) * 2);
257 cs4398_write_cached(chip, 6, (127 - chip->
dac_volume[1]) * 2);
258 update_cs4362a_volumes(chip);
261 static void update_cs43xx_mute(
struct oxygen *chip)
268 cs4398_write_cached(chip, 4, reg);
269 update_cs4362a_volumes(chip);
272 static void update_cs43xx_center_lfe_mix(
struct oxygen *chip,
bool mixed)
282 cs4362a_write_cached(chip, 9, reg);
287 .name =
"Front Panel Playback Switch",
297 static const char *
const names[2] = {
298 "Fast Roll-off",
"Slow Roll-off"
310 value->
value.enumerated.item[0] =
325 if (value->
value.enumerated.item[0])
331 cs4398_write(chip, 7, reg);
336 cs4362a_write(chip, 0x04, reg);
344 .name =
"DAC Filter Playback Enum",
345 .info = rolloff_info,
350 static void xonar_d1_line_mic_ac97_switch(
struct oxygen *chip,
351 unsigned int reg,
unsigned int mute)
357 GPIO_D1_INPUT_ROUTE);
364 static int xonar_d1_mixer_init(
struct oxygen *chip)
377 static void dump_cs4362a_registers(
struct xonar_cs43xx *data,
382 snd_iprintf(buffer,
"\nCS4362A:");
383 for (i = 1; i <= 14; ++
i)
385 snd_iprintf(buffer,
"\n");
388 static void dump_d1_registers(
struct oxygen *chip,
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);
402 .longname =
"Asus Virtuoso 100",
404 .init = xonar_d1_init,
405 .mixer_init = xonar_d1_mixer_init,
406 .cleanup = xonar_d1_cleanup,
407 .suspend = xonar_d1_suspend,
408 .resume = xonar_d1_resume,
409 .set_dac_params = set_cs43xx_params,
411 .update_dac_volume = update_cs43xx_volume,
412 .update_dac_mute = update_cs43xx_mute,
413 .update_center_lfe_mix = update_cs43xx_center_lfe_mix,
414 .ac97_switch = xonar_d1_line_mic_ac97_switch,
415 .dump_registers = dump_d1_registers,
416 .dac_tlv = cs4362a_db_scale,
423 .dac_channels_pcm = 8,
424 .dac_channels_mixer = 8,
425 .dac_volume_min = 127 - 60,
426 .dac_volume_max = 127,
439 chip->
model = model_xonar_d1;
440 chip->
model.shortname =
"Xonar D1";
444 chip->
model = model_xonar_d1;
445 chip->
model.shortname =
"Xonar DX";
446 chip->
model.init = xonar_dx_init;