162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef XONAR_DG_H_INCLUDED
362306a36Sopenharmony_ci#define XONAR_DG_H_INCLUDED
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include "oxygen.h"
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#define GPIO_MAGIC		0x0008
862306a36Sopenharmony_ci#define GPIO_HP_DETECT		0x0010
962306a36Sopenharmony_ci#define GPIO_INPUT_ROUTE	0x0060
1062306a36Sopenharmony_ci#define GPIO_HP_REAR		0x0080
1162306a36Sopenharmony_ci#define GPIO_OUTPUT_ENABLE	0x0100
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define CAPTURE_SRC_MIC		0
1462306a36Sopenharmony_ci#define CAPTURE_SRC_FP_MIC	1
1562306a36Sopenharmony_ci#define CAPTURE_SRC_LINE	2
1662306a36Sopenharmony_ci#define CAPTURE_SRC_AUX		3
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define PLAYBACK_DST_HP		0
1962306a36Sopenharmony_ci#define PLAYBACK_DST_HP_FP	1
2062306a36Sopenharmony_ci#define PLAYBACK_DST_MULTICH	2
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_cienum cs4245_shadow_operation {
2362306a36Sopenharmony_ci	CS4245_SAVE_TO_SHADOW,
2462306a36Sopenharmony_ci	CS4245_LOAD_FROM_SHADOW
2562306a36Sopenharmony_ci};
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistruct dg {
2862306a36Sopenharmony_ci	/* shadow copy of the CS4245 register space */
2962306a36Sopenharmony_ci	unsigned char cs4245_shadow[17];
3062306a36Sopenharmony_ci	/* output select: headphone/speakers */
3162306a36Sopenharmony_ci	unsigned char output_sel;
3262306a36Sopenharmony_ci	/* volumes for all capture sources */
3362306a36Sopenharmony_ci	char input_vol[4][2];
3462306a36Sopenharmony_ci	/* input select: mic/fp mic/line/aux */
3562306a36Sopenharmony_ci	unsigned char input_sel;
3662306a36Sopenharmony_ci};
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/* Xonar DG control routines */
3962306a36Sopenharmony_ciint cs4245_write_spi(struct oxygen *chip, u8 reg);
4062306a36Sopenharmony_ciint cs4245_read_spi(struct oxygen *chip, u8 reg);
4162306a36Sopenharmony_ciint cs4245_shadow_control(struct oxygen *chip, enum cs4245_shadow_operation op);
4262306a36Sopenharmony_civoid dg_init(struct oxygen *chip);
4362306a36Sopenharmony_civoid set_cs4245_dac_params(struct oxygen *chip,
4462306a36Sopenharmony_ci				  struct snd_pcm_hw_params *params);
4562306a36Sopenharmony_civoid set_cs4245_adc_params(struct oxygen *chip,
4662306a36Sopenharmony_ci				  struct snd_pcm_hw_params *params);
4762306a36Sopenharmony_ciunsigned int adjust_dg_dac_routing(struct oxygen *chip,
4862306a36Sopenharmony_ci					  unsigned int play_routing);
4962306a36Sopenharmony_civoid dump_cs4245_registers(struct oxygen *chip,
5062306a36Sopenharmony_ci				struct snd_info_buffer *buffer);
5162306a36Sopenharmony_civoid dg_suspend(struct oxygen *chip);
5262306a36Sopenharmony_civoid dg_resume(struct oxygen *chip);
5362306a36Sopenharmony_civoid dg_cleanup(struct oxygen *chip);
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ciextern const struct oxygen_model model_xonar_dg;
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#endif
58