^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef XONAR_DG_H_INCLUDED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define XONAR_DG_H_INCLUDED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include "oxygen.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define GPIO_MAGIC 0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define GPIO_HP_DETECT 0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define GPIO_INPUT_ROUTE 0x0060
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define GPIO_HP_REAR 0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define GPIO_OUTPUT_ENABLE 0x0100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define CAPTURE_SRC_MIC 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define CAPTURE_SRC_FP_MIC 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define CAPTURE_SRC_LINE 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define CAPTURE_SRC_AUX 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define PLAYBACK_DST_HP 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define PLAYBACK_DST_HP_FP 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define PLAYBACK_DST_MULTICH 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) enum cs4245_shadow_operation {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) CS4245_SAVE_TO_SHADOW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) CS4245_LOAD_FROM_SHADOW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct dg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /* shadow copy of the CS4245 register space */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) unsigned char cs4245_shadow[17];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) /* output select: headphone/speakers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) unsigned char output_sel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* volumes for all capture sources */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) char input_vol[4][2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* input select: mic/fp mic/line/aux */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) unsigned char input_sel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* Xonar DG control routines */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) int cs4245_write_spi(struct oxygen *chip, u8 reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) int cs4245_read_spi(struct oxygen *chip, u8 reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) int cs4245_shadow_control(struct oxygen *chip, enum cs4245_shadow_operation op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) void dg_init(struct oxygen *chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void set_cs4245_dac_params(struct oxygen *chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct snd_pcm_hw_params *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) void set_cs4245_adc_params(struct oxygen *chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct snd_pcm_hw_params *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) unsigned int adjust_dg_dac_routing(struct oxygen *chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) unsigned int play_routing);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void dump_cs4245_registers(struct oxygen *chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct snd_info_buffer *buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) void dg_suspend(struct oxygen *chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) void dg_resume(struct oxygen *chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) void dg_cleanup(struct oxygen *chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) extern const struct oxygen_model model_xonar_dg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #endif