1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 266410bfdSClemens Ladisch #ifndef XONAR_DG_H_INCLUDED 366410bfdSClemens Ladisch #define XONAR_DG_H_INCLUDED 466410bfdSClemens Ladisch 566410bfdSClemens Ladisch #include "oxygen.h" 666410bfdSClemens Ladisch 7ddd624c3SRoman Volkov #define GPIO_MAGIC 0x0008 8ddd624c3SRoman Volkov #define GPIO_HP_DETECT 0x0010 9ddd624c3SRoman Volkov #define GPIO_INPUT_ROUTE 0x0060 10ddd624c3SRoman Volkov #define GPIO_HP_REAR 0x0080 11ddd624c3SRoman Volkov #define GPIO_OUTPUT_ENABLE 0x0100 12ddd624c3SRoman Volkov 13ddd624c3SRoman Volkov #define CAPTURE_SRC_MIC 0 14ddd624c3SRoman Volkov #define CAPTURE_SRC_FP_MIC 1 15ddd624c3SRoman Volkov #define CAPTURE_SRC_LINE 2 16ddd624c3SRoman Volkov #define CAPTURE_SRC_AUX 3 17ddd624c3SRoman Volkov 18ddd624c3SRoman Volkov #define PLAYBACK_DST_HP 0 19ddd624c3SRoman Volkov #define PLAYBACK_DST_HP_FP 1 20ddd624c3SRoman Volkov #define PLAYBACK_DST_MULTICH 2 21ddd624c3SRoman Volkov 22bed61935SRoman Volkov enum cs4245_shadow_operation { 23bed61935SRoman Volkov CS4245_SAVE_TO_SHADOW, 24bed61935SRoman Volkov CS4245_LOAD_FROM_SHADOW 25bed61935SRoman Volkov }; 26bed61935SRoman Volkov 27ddd624c3SRoman Volkov struct dg { 28bed61935SRoman Volkov /* shadow copy of the CS4245 register space */ 29bed61935SRoman Volkov unsigned char cs4245_shadow[17]; 301f91ecc1SRoman Volkov /* output select: headphone/speakers */ 312809cb84SRoman Volkov unsigned char output_sel; 32cf218b2eSRoman Volkov /* volumes for all capture sources */ 33cf218b2eSRoman Volkov char input_vol[4][2]; 3470e0d82dSRoman Volkov /* input select: mic/fp mic/line/aux */ 3570e0d82dSRoman Volkov unsigned char input_sel; 36ddd624c3SRoman Volkov }; 37ddd624c3SRoman Volkov 38041f26b6SRoman Volkov /* Xonar DG control routines */ 39041f26b6SRoman Volkov int cs4245_write_spi(struct oxygen *chip, u8 reg); 40041f26b6SRoman Volkov int cs4245_read_spi(struct oxygen *chip, u8 reg); 41041f26b6SRoman Volkov int cs4245_shadow_control(struct oxygen *chip, enum cs4245_shadow_operation op); 42041f26b6SRoman Volkov void dg_init(struct oxygen *chip); 43041f26b6SRoman Volkov void set_cs4245_dac_params(struct oxygen *chip, 44041f26b6SRoman Volkov struct snd_pcm_hw_params *params); 45041f26b6SRoman Volkov void set_cs4245_adc_params(struct oxygen *chip, 46041f26b6SRoman Volkov struct snd_pcm_hw_params *params); 47041f26b6SRoman Volkov unsigned int adjust_dg_dac_routing(struct oxygen *chip, 48041f26b6SRoman Volkov unsigned int play_routing); 49041f26b6SRoman Volkov void dump_cs4245_registers(struct oxygen *chip, 50041f26b6SRoman Volkov struct snd_info_buffer *buffer); 51041f26b6SRoman Volkov void dg_suspend(struct oxygen *chip); 52041f26b6SRoman Volkov void dg_resume(struct oxygen *chip); 53041f26b6SRoman Volkov void dg_cleanup(struct oxygen *chip); 54041f26b6SRoman Volkov 55621c51beSBhumika Goyal extern const struct oxygen_model model_xonar_dg; 5666410bfdSClemens Ladisch 5766410bfdSClemens Ladisch #endif 58