Lines Matching refs:chip
243 static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, in pcm1796_write_spi() argument
250 oxygen_write_spi(chip, OXYGEN_SPI_TRIGGER | in pcm1796_write_spi()
258 static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, in pcm1796_write_i2c() argument
261 oxygen_write_i2c(chip, I2C_DEVICE_PCM1796(codec), reg, value); in pcm1796_write_i2c()
264 static void pcm1796_write(struct oxygen *chip, unsigned int codec, in pcm1796_write() argument
267 struct xonar_pcm179x *data = chip->model_data; in pcm1796_write()
269 if ((chip->model.function_flags & OXYGEN_FUNCTION_2WIRE_SPI_MASK) == in pcm1796_write()
271 pcm1796_write_spi(chip, codec, reg, value); in pcm1796_write()
273 pcm1796_write_i2c(chip, codec, reg, value); in pcm1796_write()
279 static void pcm1796_write_cached(struct oxygen *chip, unsigned int codec, in pcm1796_write_cached() argument
282 struct xonar_pcm179x *data = chip->model_data; in pcm1796_write_cached()
285 pcm1796_write(chip, codec, reg, value); in pcm1796_write_cached()
288 static void cs2000_write(struct oxygen *chip, u8 reg, u8 value) in cs2000_write() argument
290 struct xonar_pcm179x *data = chip->model_data; in cs2000_write()
292 oxygen_write_i2c(chip, I2C_DEVICE_CS2000, reg, value); in cs2000_write()
296 static void cs2000_write_cached(struct oxygen *chip, u8 reg, u8 value) in cs2000_write_cached() argument
298 struct xonar_pcm179x *data = chip->model_data; in cs2000_write_cached()
301 cs2000_write(chip, reg, value); in cs2000_write_cached()
304 static void pcm1796_registers_init(struct oxygen *chip) in pcm1796_registers_init() argument
306 struct xonar_pcm179x *data = chip->model_data; in pcm1796_registers_init()
314 pcm1796_write(chip, i, 18, in pcm1796_registers_init()
316 pcm1796_write(chip, i, 16, chip->dac_volume[i * 2] in pcm1796_registers_init()
318 pcm1796_write(chip, i, 17, chip->dac_volume[i * 2 + 1] in pcm1796_registers_init()
320 pcm1796_write(chip, i, 19, in pcm1796_registers_init()
322 pcm1796_write(chip, i, 20, in pcm1796_registers_init()
324 pcm1796_write(chip, i, 21, 0); in pcm1796_registers_init()
329 static void pcm1796_init(struct oxygen *chip) in pcm1796_init() argument
331 struct xonar_pcm179x *data = chip->model_data; in pcm1796_init()
341 pcm1796_registers_init(chip); in pcm1796_init()
345 static void xonar_d2_init(struct oxygen *chip) in xonar_d2_init() argument
347 struct xonar_pcm179x *data = chip->model_data; in xonar_d2_init()
353 pcm1796_init(chip); in xonar_d2_init()
355 oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_D2_ALT); in xonar_d2_init()
356 oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, GPIO_D2_ALT); in xonar_d2_init()
358 oxygen_ac97_set_bits(chip, 0, CM9780_JACK, CM9780_FMIC2MIC); in xonar_d2_init()
360 xonar_init_cs53x1(chip); in xonar_d2_init()
361 xonar_enable_output(chip); in xonar_d2_init()
363 snd_component_add(chip->card, "PCM1796"); in xonar_d2_init()
364 snd_component_add(chip->card, "CS5381"); in xonar_d2_init()
367 static void xonar_d2x_init(struct oxygen *chip) in xonar_d2x_init() argument
369 struct xonar_pcm179x *data = chip->model_data; in xonar_d2x_init()
374 oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_D2X_EXT_POWER); in xonar_d2x_init()
375 xonar_init_ext_power(chip); in xonar_d2x_init()
376 xonar_d2_init(chip); in xonar_d2x_init()
379 static void xonar_hdav_init(struct oxygen *chip) in xonar_hdav_init() argument
381 struct xonar_hdav *data = chip->model_data; in xonar_hdav_init()
383 oxygen_write16(chip, OXYGEN_2WIRE_BUS_STATUS, in xonar_hdav_init()
393 data->pcm179x.dacs = chip->model.dac_channels_mixer / 2; in xonar_hdav_init()
394 data->pcm179x.h6 = chip->model.dac_channels_mixer > 2; in xonar_hdav_init()
396 pcm1796_init(chip); in xonar_hdav_init()
398 oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, in xonar_hdav_init()
400 oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, GPIO_INPUT_ROUTE); in xonar_hdav_init()
402 xonar_init_cs53x1(chip); in xonar_hdav_init()
403 xonar_init_ext_power(chip); in xonar_hdav_init()
404 xonar_hdmi_init(chip, &data->hdmi); in xonar_hdav_init()
405 xonar_enable_output(chip); in xonar_hdav_init()
407 snd_component_add(chip->card, "PCM1796"); in xonar_hdav_init()
408 snd_component_add(chip->card, "CS5381"); in xonar_hdav_init()
411 static void xonar_st_init_i2c(struct oxygen *chip) in xonar_st_init_i2c() argument
413 oxygen_write16(chip, OXYGEN_2WIRE_BUS_STATUS, in xonar_st_init_i2c()
419 static void xonar_st_init_common(struct oxygen *chip) in xonar_st_init_common() argument
421 struct xonar_pcm179x *data = chip->model_data; in xonar_st_init_common()
424 data->dacs = chip->model.dac_channels_mixer / 2; in xonar_st_init_common()
425 data->h6 = chip->model.dac_channels_mixer > 2; in xonar_st_init_common()
428 pcm1796_init(chip); in xonar_st_init_common()
430 oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, in xonar_st_init_common()
433 oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, in xonar_st_init_common()
436 xonar_init_cs53x1(chip); in xonar_st_init_common()
437 xonar_enable_output(chip); in xonar_st_init_common()
439 snd_component_add(chip->card, "PCM1792A"); in xonar_st_init_common()
440 snd_component_add(chip->card, "CS5381"); in xonar_st_init_common()
443 static void cs2000_registers_init(struct oxygen *chip) in cs2000_registers_init() argument
445 struct xonar_pcm179x *data = chip->model_data; in cs2000_registers_init()
447 cs2000_write(chip, CS2000_GLOBAL_CFG, CS2000_FREEZE); in cs2000_registers_init()
448 cs2000_write(chip, CS2000_DEV_CTRL, 0); in cs2000_registers_init()
449 cs2000_write(chip, CS2000_DEV_CFG_1, in cs2000_registers_init()
454 cs2000_write(chip, CS2000_DEV_CFG_2, in cs2000_registers_init()
457 cs2000_write(chip, CS2000_RATIO_0 + 0, 0x00); /* 1.0 */ in cs2000_registers_init()
458 cs2000_write(chip, CS2000_RATIO_0 + 1, 0x10); in cs2000_registers_init()
459 cs2000_write(chip, CS2000_RATIO_0 + 2, 0x00); in cs2000_registers_init()
460 cs2000_write(chip, CS2000_RATIO_0 + 3, 0x00); in cs2000_registers_init()
461 cs2000_write(chip, CS2000_FUN_CFG_1, in cs2000_registers_init()
463 cs2000_write(chip, CS2000_FUN_CFG_2, 0); in cs2000_registers_init()
464 cs2000_write(chip, CS2000_GLOBAL_CFG, CS2000_EN_DEV_CFG_2); in cs2000_registers_init()
468 static void xonar_st_init(struct oxygen *chip) in xonar_st_init() argument
470 struct xonar_pcm179x *data = chip->model_data; in xonar_st_init()
473 data->h6 = chip->model.dac_channels_mixer > 2; in xonar_st_init()
478 oxygen_write16(chip, OXYGEN_I2S_A_FORMAT, in xonar_st_init()
486 xonar_st_init_i2c(chip); in xonar_st_init()
487 cs2000_registers_init(chip); in xonar_st_init()
488 xonar_st_init_common(chip); in xonar_st_init()
490 snd_component_add(chip->card, "CS2000"); in xonar_st_init()
493 static void xonar_stx_init(struct oxygen *chip) in xonar_stx_init() argument
495 struct xonar_pcm179x *data = chip->model_data; in xonar_stx_init()
497 xonar_st_init_i2c(chip); in xonar_stx_init()
502 xonar_init_ext_power(chip); in xonar_stx_init()
503 xonar_st_init_common(chip); in xonar_stx_init()
506 static void xonar_xense_init(struct oxygen *chip) in xonar_xense_init() argument
508 struct xonar_pcm179x *data = chip->model_data; in xonar_xense_init()
513 xonar_init_ext_power(chip); in xonar_xense_init()
519 oxygen_write16(chip, OXYGEN_I2S_A_FORMAT, in xonar_xense_init()
527 xonar_st_init_i2c(chip); in xonar_xense_init()
528 cs2000_registers_init(chip); in xonar_xense_init()
534 pcm1796_init(chip); in xonar_xense_init()
536 oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, in xonar_xense_init()
539 oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, in xonar_xense_init()
543 xonar_init_cs53x1(chip); in xonar_xense_init()
544 xonar_enable_output(chip); in xonar_xense_init()
546 snd_component_add(chip->card, "PCM1796"); in xonar_xense_init()
547 snd_component_add(chip->card, "CS5381"); in xonar_xense_init()
548 snd_component_add(chip->card, "CS2000"); in xonar_xense_init()
551 static void xonar_d2_cleanup(struct oxygen *chip) in xonar_d2_cleanup() argument
553 xonar_disable_output(chip); in xonar_d2_cleanup()
556 static void xonar_hdav_cleanup(struct oxygen *chip) in xonar_hdav_cleanup() argument
558 xonar_hdmi_cleanup(chip); in xonar_hdav_cleanup()
559 xonar_disable_output(chip); in xonar_hdav_cleanup()
563 static void xonar_st_cleanup(struct oxygen *chip) in xonar_st_cleanup() argument
565 xonar_disable_output(chip); in xonar_st_cleanup()
568 static void xonar_d2_suspend(struct oxygen *chip) in xonar_d2_suspend() argument
570 xonar_d2_cleanup(chip); in xonar_d2_suspend()
573 static void xonar_hdav_suspend(struct oxygen *chip) in xonar_hdav_suspend() argument
575 xonar_hdav_cleanup(chip); in xonar_hdav_suspend()
578 static void xonar_st_suspend(struct oxygen *chip) in xonar_st_suspend() argument
580 xonar_st_cleanup(chip); in xonar_st_suspend()
583 static void xonar_d2_resume(struct oxygen *chip) in xonar_d2_resume() argument
585 pcm1796_registers_init(chip); in xonar_d2_resume()
586 xonar_enable_output(chip); in xonar_d2_resume()
589 static void xonar_hdav_resume(struct oxygen *chip) in xonar_hdav_resume() argument
591 struct xonar_hdav *data = chip->model_data; in xonar_hdav_resume()
593 pcm1796_registers_init(chip); in xonar_hdav_resume()
594 xonar_hdmi_resume(chip, &data->hdmi); in xonar_hdav_resume()
595 xonar_enable_output(chip); in xonar_hdav_resume()
598 static void xonar_stx_resume(struct oxygen *chip) in xonar_stx_resume() argument
600 pcm1796_registers_init(chip); in xonar_stx_resume()
601 xonar_enable_output(chip); in xonar_stx_resume()
604 static void xonar_st_resume(struct oxygen *chip) in xonar_st_resume() argument
606 cs2000_registers_init(chip); in xonar_st_resume()
607 xonar_stx_resume(chip); in xonar_st_resume()
610 static void update_pcm1796_oversampling(struct oxygen *chip) in update_pcm1796_oversampling() argument
612 struct xonar_pcm179x *data = chip->model_data; in update_pcm1796_oversampling()
621 pcm1796_write_cached(chip, i, 20, reg); in update_pcm1796_oversampling()
624 static void set_pcm1796_params(struct oxygen *chip, in set_pcm1796_params() argument
627 struct xonar_pcm179x *data = chip->model_data; in set_pcm1796_params()
631 update_pcm1796_oversampling(chip); in set_pcm1796_params()
634 static void update_pcm1796_volume(struct oxygen *chip) in update_pcm1796_volume() argument
636 struct xonar_pcm179x *data = chip->model_data; in update_pcm1796_volume()
642 pcm1796_write_cached(chip, i, 16, chip->dac_volume[i * 2] in update_pcm1796_volume()
644 pcm1796_write_cached(chip, i, 17, chip->dac_volume[i * 2 + 1] in update_pcm1796_volume()
650 static void update_pcm1796_mute(struct oxygen *chip) in update_pcm1796_mute() argument
652 struct xonar_pcm179x *data = chip->model_data; in update_pcm1796_mute()
657 if (chip->dac_mute) in update_pcm1796_mute()
660 pcm1796_write_cached(chip, i, 18, value); in update_pcm1796_mute()
663 static void update_cs2000_rate(struct oxygen *chip, unsigned int rate) in update_cs2000_rate() argument
665 struct xonar_pcm179x *data = chip->model_data; in update_cs2000_rate()
694 oxygen_write16_masked(chip, OXYGEN_I2S_A_FORMAT, rate_mclk, in update_cs2000_rate()
696 cs2000_write_cached(chip, CS2000_FUN_CFG_1, reg); in update_cs2000_rate()
700 static void set_st_params(struct oxygen *chip, in set_st_params() argument
703 update_cs2000_rate(chip, params_rate(params)); in set_st_params()
704 set_pcm1796_params(chip, params); in set_st_params()
707 static void set_hdav_params(struct oxygen *chip, in set_hdav_params() argument
710 struct xonar_hdav *data = chip->model_data; in set_hdav_params()
712 set_pcm1796_params(chip, params); in set_hdav_params()
713 xonar_set_hdmi_params(chip, &data->hdmi, params); in set_hdav_params()
738 struct oxygen *chip = ctl->private_data; in rolloff_get() local
739 struct xonar_pcm179x *data = chip->model_data; in rolloff_get()
750 struct oxygen *chip = ctl->private_data; in rolloff_put() local
751 struct xonar_pcm179x *data = chip->model_data; in rolloff_put()
756 mutex_lock(&chip->mutex); in rolloff_put()
766 pcm1796_write(chip, i, 19, reg); in rolloff_put()
768 mutex_unlock(&chip->mutex); in rolloff_put()
802 struct oxygen *chip = ctl->private_data; in st_output_switch_get() local
805 gpio = oxygen_read16(chip, OXYGEN_GPIO_DATA); in st_output_switch_get()
819 struct oxygen *chip = ctl->private_data; in st_output_switch_put() local
820 struct xonar_pcm179x *data = chip->model_data; in st_output_switch_put()
823 mutex_lock(&chip->mutex); in st_output_switch_put()
824 gpio_old = oxygen_read16(chip, OXYGEN_GPIO_DATA); in st_output_switch_put()
837 oxygen_write16(chip, OXYGEN_GPIO_DATA, gpio); in st_output_switch_put()
839 update_pcm1796_volume(chip); in st_output_switch_put()
840 mutex_unlock(&chip->mutex); in st_output_switch_put()
857 struct oxygen *chip = ctl->private_data; in st_hp_volume_offset_get() local
858 struct xonar_pcm179x *data = chip->model_data; in st_hp_volume_offset_get()
860 mutex_lock(&chip->mutex); in st_hp_volume_offset_get()
869 mutex_unlock(&chip->mutex); in st_hp_volume_offset_get()
878 struct oxygen *chip = ctl->private_data; in st_hp_volume_offset_put() local
879 struct xonar_pcm179x *data = chip->model_data; in st_hp_volume_offset_put()
886 mutex_lock(&chip->mutex); in st_hp_volume_offset_put()
890 update_pcm1796_volume(chip); in st_hp_volume_offset_put()
892 mutex_unlock(&chip->mutex); in st_hp_volume_offset_put()
916 struct oxygen *chip = ctl->private_data; in xense_output_switch_get() local
919 gpio = oxygen_read16(chip, OXYGEN_GPIO_DATA); in xense_output_switch_get()
932 struct oxygen *chip = ctl->private_data; in xense_output_switch_put() local
933 struct xonar_pcm179x *data = chip->model_data; in xense_output_switch_put()
936 mutex_lock(&chip->mutex); in xense_output_switch_put()
937 gpio_old = oxygen_read16(chip, OXYGEN_GPIO_DATA); in xense_output_switch_put()
950 oxygen_write16(chip, OXYGEN_GPIO_DATA, gpio); in xense_output_switch_put()
952 update_pcm1796_volume(chip); in xense_output_switch_put()
953 mutex_unlock(&chip->mutex); in xense_output_switch_put()
974 static void xonar_line_mic_ac97_switch(struct oxygen *chip, in xonar_line_mic_ac97_switch() argument
978 spin_lock_irq(&chip->reg_lock); in xonar_line_mic_ac97_switch()
979 oxygen_write16_masked(chip, OXYGEN_GPIO_DATA, in xonar_line_mic_ac97_switch()
982 spin_unlock_irq(&chip->reg_lock); in xonar_line_mic_ac97_switch()
1004 static int add_pcm1796_controls(struct oxygen *chip) in add_pcm1796_controls() argument
1006 struct xonar_pcm179x *data = chip->model_data; in add_pcm1796_controls()
1010 err = snd_ctl_add(chip->card, in add_pcm1796_controls()
1011 snd_ctl_new1(&rolloff_control, chip)); in add_pcm1796_controls()
1018 static int xonar_d2_mixer_init(struct oxygen *chip) in xonar_d2_mixer_init() argument
1022 err = snd_ctl_add(chip->card, snd_ctl_new1(&alt_switch, chip)); in xonar_d2_mixer_init()
1025 err = add_pcm1796_controls(chip); in xonar_d2_mixer_init()
1031 static int xonar_hdav_mixer_init(struct oxygen *chip) in xonar_hdav_mixer_init() argument
1035 err = snd_ctl_add(chip->card, snd_ctl_new1(&hdav_hdmi_control, chip)); in xonar_hdav_mixer_init()
1038 err = add_pcm1796_controls(chip); in xonar_hdav_mixer_init()
1044 static int xonar_st_mixer_init(struct oxygen *chip) in xonar_st_mixer_init() argument
1050 err = snd_ctl_add(chip->card, in xonar_st_mixer_init()
1051 snd_ctl_new1(&st_controls[i], chip)); in xonar_st_mixer_init()
1055 err = add_pcm1796_controls(chip); in xonar_st_mixer_init()
1061 static int xonar_xense_mixer_init(struct oxygen *chip) in xonar_xense_mixer_init() argument
1067 err = snd_ctl_add(chip->card, in xonar_xense_mixer_init()
1068 snd_ctl_new1(&xense_controls[i], chip)); in xonar_xense_mixer_init()
1072 err = add_pcm1796_controls(chip); in xonar_xense_mixer_init()
1078 static void dump_pcm1796_registers(struct oxygen *chip, in dump_pcm1796_registers() argument
1081 struct xonar_pcm179x *data = chip->model_data; in dump_pcm1796_registers()
1093 static void dump_cs2000_registers(struct oxygen *chip, in dump_cs2000_registers() argument
1096 struct xonar_pcm179x *data = chip->model_data; in dump_cs2000_registers()
1110 static void dump_st_registers(struct oxygen *chip, in dump_st_registers() argument
1113 dump_pcm1796_registers(chip, buffer); in dump_st_registers()
1114 dump_cs2000_registers(chip, buffer); in dump_st_registers()
1119 .chip = "AV200",
1155 .chip = "AV200",
1189 .chip = "AV200",
1219 int get_xonar_pcm179x_model(struct oxygen *chip, in get_xonar_pcm179x_model() argument
1224 chip->model = model_xonar_d2; in get_xonar_pcm179x_model()
1225 chip->model.shortname = "Xonar D2"; in get_xonar_pcm179x_model()
1228 chip->model = model_xonar_d2; in get_xonar_pcm179x_model()
1229 chip->model.shortname = "Xonar D2X"; in get_xonar_pcm179x_model()
1230 chip->model.init = xonar_d2x_init; in get_xonar_pcm179x_model()
1233 chip->model = model_xonar_hdav; in get_xonar_pcm179x_model()
1234 oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_DB_MASK); in get_xonar_pcm179x_model()
1235 switch (oxygen_read16(chip, OXYGEN_GPIO_DATA) & GPIO_DB_MASK) { in get_xonar_pcm179x_model()
1237 chip->model.shortname = "Xonar HDAV1.3"; in get_xonar_pcm179x_model()
1240 chip->model.shortname = "Xonar HDAV1.3+H6"; in get_xonar_pcm179x_model()
1241 chip->model.dac_channels_mixer = 8; in get_xonar_pcm179x_model()
1242 chip->model.dac_mclks = OXYGEN_MCLKS(256, 128, 128); in get_xonar_pcm179x_model()
1247 chip->model = model_xonar_st; in get_xonar_pcm179x_model()
1248 oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_DB_MASK); in get_xonar_pcm179x_model()
1249 switch (oxygen_read16(chip, OXYGEN_GPIO_DATA) & GPIO_DB_MASK) { in get_xonar_pcm179x_model()
1251 chip->model.shortname = "Xonar ST"; in get_xonar_pcm179x_model()
1254 chip->model.shortname = "Xonar ST+H6"; in get_xonar_pcm179x_model()
1255 chip->model.control_filter = xonar_st_h6_control_filter; in get_xonar_pcm179x_model()
1256 chip->model.dac_channels_pcm = 8; in get_xonar_pcm179x_model()
1257 chip->model.dac_channels_mixer = 8; in get_xonar_pcm179x_model()
1258 chip->model.dac_volume_min = 255; in get_xonar_pcm179x_model()
1259 chip->model.dac_mclks = OXYGEN_MCLKS(256, 128, 128); in get_xonar_pcm179x_model()
1264 chip->model = model_xonar_st; in get_xonar_pcm179x_model()
1265 chip->model.shortname = "Xonar STX"; in get_xonar_pcm179x_model()
1266 chip->model.init = xonar_stx_init; in get_xonar_pcm179x_model()
1267 chip->model.resume = xonar_stx_resume; in get_xonar_pcm179x_model()
1268 chip->model.set_dac_params = set_pcm1796_params; in get_xonar_pcm179x_model()
1271 chip->model = model_xonar_st; in get_xonar_pcm179x_model()
1272 oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_DB_MASK); in get_xonar_pcm179x_model()
1273 switch (oxygen_read16(chip, OXYGEN_GPIO_DATA) & GPIO_DB_MASK) { in get_xonar_pcm179x_model()
1275 chip->model.shortname = "Xonar STX II"; in get_xonar_pcm179x_model()
1278 chip->model.shortname = "Xonar STX II+H6"; in get_xonar_pcm179x_model()
1279 chip->model.dac_channels_pcm = 8; in get_xonar_pcm179x_model()
1280 chip->model.dac_channels_mixer = 8; in get_xonar_pcm179x_model()
1281 chip->model.dac_mclks = OXYGEN_MCLKS(256, 128, 128); in get_xonar_pcm179x_model()
1284 chip->model.init = xonar_stx_init; in get_xonar_pcm179x_model()
1285 chip->model.resume = xonar_stx_resume; in get_xonar_pcm179x_model()
1286 chip->model.set_dac_params = set_pcm1796_params; in get_xonar_pcm179x_model()
1289 chip->model = model_xonar_st; in get_xonar_pcm179x_model()
1290 chip->model.shortname = "Xonar Xense"; in get_xonar_pcm179x_model()
1291 chip->model.chip = "AV100"; in get_xonar_pcm179x_model()
1292 chip->model.init = xonar_xense_init; in get_xonar_pcm179x_model()
1293 chip->model.mixer_init = xonar_xense_mixer_init; in get_xonar_pcm179x_model()