xref: /kernel/linux/linux-6.6/sound/pci/oxygen/cs4245.h (revision 62306a36)
162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#define CS4245_CHIP_ID		0x01
362306a36Sopenharmony_ci#define CS4245_POWER_CTRL	0x02
462306a36Sopenharmony_ci#define CS4245_DAC_CTRL_1	0x03
562306a36Sopenharmony_ci#define CS4245_ADC_CTRL		0x04
662306a36Sopenharmony_ci#define CS4245_MCLK_FREQ	0x05
762306a36Sopenharmony_ci#define CS4245_SIGNAL_SEL	0x06
862306a36Sopenharmony_ci#define CS4245_PGA_B_CTRL	0x07
962306a36Sopenharmony_ci#define CS4245_PGA_A_CTRL	0x08
1062306a36Sopenharmony_ci#define CS4245_ANALOG_IN	0x09
1162306a36Sopenharmony_ci#define CS4245_DAC_A_CTRL	0x0a
1262306a36Sopenharmony_ci#define CS4245_DAC_B_CTRL	0x0b
1362306a36Sopenharmony_ci#define CS4245_DAC_CTRL_2	0x0c
1462306a36Sopenharmony_ci#define CS4245_INT_STATUS	0x0d
1562306a36Sopenharmony_ci#define CS4245_INT_MASK		0x0e
1662306a36Sopenharmony_ci#define CS4245_INT_MODE_MSB	0x0f
1762306a36Sopenharmony_ci#define CS4245_INT_MODE_LSB	0x10
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/* Chip ID */
2062306a36Sopenharmony_ci#define CS4245_CHIP_PART_MASK	0xf0
2162306a36Sopenharmony_ci#define CS4245_CHIP_REV_MASK	0x0f
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/* Power Control */
2462306a36Sopenharmony_ci#define CS4245_FREEZE		0x80
2562306a36Sopenharmony_ci#define CS4245_PDN_MIC		0x08
2662306a36Sopenharmony_ci#define CS4245_PDN_ADC		0x04
2762306a36Sopenharmony_ci#define CS4245_PDN_DAC		0x02
2862306a36Sopenharmony_ci#define CS4245_PDN		0x01
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci/* DAC Control */
3162306a36Sopenharmony_ci#define CS4245_DAC_FM_MASK	0xc0
3262306a36Sopenharmony_ci#define CS4245_DAC_FM_SINGLE	0x00
3362306a36Sopenharmony_ci#define CS4245_DAC_FM_DOUBLE	0x40
3462306a36Sopenharmony_ci#define CS4245_DAC_FM_QUAD	0x80
3562306a36Sopenharmony_ci#define CS4245_DAC_DIF_MASK	0x30
3662306a36Sopenharmony_ci#define CS4245_DAC_DIF_LJUST	0x00
3762306a36Sopenharmony_ci#define CS4245_DAC_DIF_I2S	0x10
3862306a36Sopenharmony_ci#define CS4245_DAC_DIF_RJUST_16	0x20
3962306a36Sopenharmony_ci#define CS4245_DAC_DIF_RJUST_24	0x30
4062306a36Sopenharmony_ci#define CS4245_RESERVED_1	0x08
4162306a36Sopenharmony_ci#define CS4245_MUTE_DAC		0x04
4262306a36Sopenharmony_ci#define CS4245_DEEMPH		0x02
4362306a36Sopenharmony_ci#define CS4245_DAC_MASTER	0x01
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci/* ADC Control */
4662306a36Sopenharmony_ci#define CS4245_ADC_FM_MASK	0xc0
4762306a36Sopenharmony_ci#define CS4245_ADC_FM_SINGLE	0x00
4862306a36Sopenharmony_ci#define CS4245_ADC_FM_DOUBLE	0x40
4962306a36Sopenharmony_ci#define CS4245_ADC_FM_QUAD	0x80
5062306a36Sopenharmony_ci#define CS4245_ADC_DIF_MASK	0x10
5162306a36Sopenharmony_ci#define CS4245_ADC_DIF_LJUST	0x00
5262306a36Sopenharmony_ci#define CS4245_ADC_DIF_I2S	0x10
5362306a36Sopenharmony_ci#define CS4245_MUTE_ADC		0x04
5462306a36Sopenharmony_ci#define CS4245_HPF_FREEZE	0x02
5562306a36Sopenharmony_ci#define CS4245_ADC_MASTER	0x01
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci/* MCLK Frequency */
5862306a36Sopenharmony_ci#define CS4245_MCLK1_MASK	0x70
5962306a36Sopenharmony_ci#define CS4245_MCLK1_SHIFT	4
6062306a36Sopenharmony_ci#define CS4245_MCLK2_MASK	0x07
6162306a36Sopenharmony_ci#define CS4245_MCLK2_SHIFT	0
6262306a36Sopenharmony_ci#define CS4245_MCLK_1		0
6362306a36Sopenharmony_ci#define CS4245_MCLK_1_5		1
6462306a36Sopenharmony_ci#define CS4245_MCLK_2		2
6562306a36Sopenharmony_ci#define CS4245_MCLK_3		3
6662306a36Sopenharmony_ci#define CS4245_MCLK_4		4
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci/* Signal Selection */
6962306a36Sopenharmony_ci#define CS4245_A_OUT_SEL_MASK	0x60
7062306a36Sopenharmony_ci#define CS4245_A_OUT_SEL_HIZ	0x00
7162306a36Sopenharmony_ci#define CS4245_A_OUT_SEL_DAC	0x20
7262306a36Sopenharmony_ci#define CS4245_A_OUT_SEL_PGA	0x40
7362306a36Sopenharmony_ci#define CS4245_LOOP		0x02
7462306a36Sopenharmony_ci#define CS4245_ASYNCH		0x01
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci/* Channel B/A PGA Control */
7762306a36Sopenharmony_ci#define CS4245_PGA_GAIN_MASK	0x3f
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci/* ADC Input Control */
8062306a36Sopenharmony_ci#define CS4245_PGA_SOFT		0x10
8162306a36Sopenharmony_ci#define CS4245_PGA_ZERO		0x08
8262306a36Sopenharmony_ci#define CS4245_SEL_MASK		0x07
8362306a36Sopenharmony_ci#define CS4245_SEL_MIC		0x00
8462306a36Sopenharmony_ci#define CS4245_SEL_INPUT_1	0x01
8562306a36Sopenharmony_ci#define CS4245_SEL_INPUT_2	0x02
8662306a36Sopenharmony_ci#define CS4245_SEL_INPUT_3	0x03
8762306a36Sopenharmony_ci#define CS4245_SEL_INPUT_4	0x04
8862306a36Sopenharmony_ci#define CS4245_SEL_INPUT_5	0x05
8962306a36Sopenharmony_ci#define CS4245_SEL_INPUT_6	0x06
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci/* DAC Channel A/B Volume Control */
9262306a36Sopenharmony_ci#define CS4245_VOL_MASK		0xff
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci/* DAC Control 2 */
9562306a36Sopenharmony_ci#define CS4245_DAC_SOFT		0x80
9662306a36Sopenharmony_ci#define CS4245_DAC_ZERO		0x40
9762306a36Sopenharmony_ci#define CS4245_INVERT_DAC	0x20
9862306a36Sopenharmony_ci#define CS4245_INT_ACTIVE_HIGH	0x01
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci/* Interrupt Status/Mask/Mode */
10162306a36Sopenharmony_ci#define CS4245_ADC_CLK_ERR	0x08
10262306a36Sopenharmony_ci#define CS4245_DAC_CLK_ERR	0x04
10362306a36Sopenharmony_ci#define CS4245_ADC_OVFL		0x02
10462306a36Sopenharmony_ci#define CS4245_ADC_UNDRFL	0x01
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#define CS4245_SPI_ADDRESS_S	(0x9e << 16)
10762306a36Sopenharmony_ci#define CS4245_SPI_WRITE_S	(0 << 16)
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci#define CS4245_SPI_ADDRESS	0x9e
11062306a36Sopenharmony_ci#define CS4245_SPI_WRITE	0
11162306a36Sopenharmony_ci#define CS4245_SPI_READ		1
112