180503b23SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 2a1533d94SBarry Song /* 3a1533d94SBarry Song * AD193X Audio Codec driver 4a1533d94SBarry Song * 5a1533d94SBarry Song * Copyright 2010 Analog Devices Inc. 6a1533d94SBarry Song */ 7a1533d94SBarry Song 8a1533d94SBarry Song #ifndef __AD193X_H__ 9a1533d94SBarry Song #define __AD193X_H__ 10a1533d94SBarry Song 116c3d713eSLars-Peter Clausen #include <linux/regmap.h> 126c3d713eSLars-Peter Clausen 136c3d713eSLars-Peter Clausen struct device; 146c3d713eSLars-Peter Clausen 15e5224f58SCyrille Pitchen enum ad193x_type { 16e5224f58SCyrille Pitchen AD193X, 17e5224f58SCyrille Pitchen AD1933, 18e5224f58SCyrille Pitchen AD1934, 19e5224f58SCyrille Pitchen }; 20e5224f58SCyrille Pitchen 216c3d713eSLars-Peter Clausen extern const struct regmap_config ad193x_regmap_config; 22e5224f58SCyrille Pitchen int ad193x_probe(struct device *dev, struct regmap *regmap, 23e5224f58SCyrille Pitchen enum ad193x_type type); 246c3d713eSLars-Peter Clausen 2530ab1e78SLars-Peter Clausen #define AD193X_PLL_CLK_CTRL0 0x00 26a1533d94SBarry Song #define AD193X_PLL_POWERDOWN 0x01 27f3aa7219SAxel Lin #define AD193X_PLL_INPUT_MASK 0x6 28fab90aa4SBarry Song #define AD193X_PLL_INPUT_256 (0 << 1) 29fab90aa4SBarry Song #define AD193X_PLL_INPUT_384 (1 << 1) 30fab90aa4SBarry Song #define AD193X_PLL_INPUT_512 (2 << 1) 31fab90aa4SBarry Song #define AD193X_PLL_INPUT_768 (3 << 1) 3230ab1e78SLars-Peter Clausen #define AD193X_PLL_CLK_CTRL1 0x01 3359529473SCodrin Ciubotariu #define AD193X_PLL_SRC_MASK 0x03 3459529473SCodrin Ciubotariu #define AD193X_PLL_DAC_SRC_PLL 0 3559529473SCodrin Ciubotariu #define AD193X_PLL_DAC_SRC_MCLK 1 3659529473SCodrin Ciubotariu #define AD193X_PLL_CLK_SRC_PLL (0 << 1) 3759529473SCodrin Ciubotariu #define AD193X_PLL_CLK_SRC_MCLK (1 << 1) 3830ab1e78SLars-Peter Clausen #define AD193X_DAC_CTRL0 0x02 39a1533d94SBarry Song #define AD193X_DAC_POWERDOWN 0x01 40a1533d94SBarry Song #define AD193X_DAC_SERFMT_MASK 0xC0 41a1533d94SBarry Song #define AD193X_DAC_SERFMT_STEREO (0 << 6) 42a1533d94SBarry Song #define AD193X_DAC_SERFMT_TDM (1 << 6) 4330ab1e78SLars-Peter Clausen #define AD193X_DAC_CTRL1 0x03 44a1533d94SBarry Song #define AD193X_DAC_CHAN_SHFT 1 45a1533d94SBarry Song #define AD193X_DAC_CHAN_MASK (3 << AD193X_DAC_CHAN_SHFT) 46a1533d94SBarry Song #define AD193X_DAC_LCR_MASTER (1 << 4) 47a1533d94SBarry Song #define AD193X_DAC_BCLK_MASTER (1 << 5) 48a1533d94SBarry Song #define AD193X_DAC_LEFT_HIGH (1 << 3) 49a1533d94SBarry Song #define AD193X_DAC_BCLK_INV (1 << 7) 50b82ca578SLars-Peter Clausen #define AD193X_DAC_FMT_MASK (AD193X_DAC_LCR_MASTER | \ 51b82ca578SLars-Peter Clausen AD193X_DAC_BCLK_MASTER | AD193X_DAC_LEFT_HIGH | AD193X_DAC_BCLK_INV) 5230ab1e78SLars-Peter Clausen #define AD193X_DAC_CTRL2 0x04 5395c93d85SScott Jiang #define AD193X_DAC_WORD_LEN_SHFT 3 54bf545ed7SScott Jiang #define AD193X_DAC_WORD_LEN_MASK 0x18 55a1533d94SBarry Song #define AD193X_DAC_MASTER_MUTE 1 5630ab1e78SLars-Peter Clausen #define AD193X_DAC_CHNL_MUTE 0x05 57a1533d94SBarry Song #define AD193X_DACL1_MUTE 0 58a1533d94SBarry Song #define AD193X_DACR1_MUTE 1 59a1533d94SBarry Song #define AD193X_DACL2_MUTE 2 60a1533d94SBarry Song #define AD193X_DACR2_MUTE 3 61a1533d94SBarry Song #define AD193X_DACL3_MUTE 4 62a1533d94SBarry Song #define AD193X_DACR3_MUTE 5 63a1533d94SBarry Song #define AD193X_DACL4_MUTE 6 64a1533d94SBarry Song #define AD193X_DACR4_MUTE 7 6530ab1e78SLars-Peter Clausen #define AD193X_DAC_L1_VOL 0x06 6630ab1e78SLars-Peter Clausen #define AD193X_DAC_R1_VOL 0x07 6730ab1e78SLars-Peter Clausen #define AD193X_DAC_L2_VOL 0x08 6830ab1e78SLars-Peter Clausen #define AD193X_DAC_R2_VOL 0x09 6930ab1e78SLars-Peter Clausen #define AD193X_DAC_L3_VOL 0x0a 7030ab1e78SLars-Peter Clausen #define AD193X_DAC_R3_VOL 0x0b 7130ab1e78SLars-Peter Clausen #define AD193X_DAC_L4_VOL 0x0c 7230ab1e78SLars-Peter Clausen #define AD193X_DAC_R4_VOL 0x0d 7330ab1e78SLars-Peter Clausen #define AD193X_ADC_CTRL0 0x0e 74a1533d94SBarry Song #define AD193X_ADC_POWERDOWN 0x01 75a1533d94SBarry Song #define AD193X_ADC_HIGHPASS_FILTER 1 76a1533d94SBarry Song #define AD193X_ADCL1_MUTE 2 77a1533d94SBarry Song #define AD193X_ADCR1_MUTE 3 78a1533d94SBarry Song #define AD193X_ADCL2_MUTE 4 79a1533d94SBarry Song #define AD193X_ADCR2_MUTE 5 8030ab1e78SLars-Peter Clausen #define AD193X_ADC_CTRL1 0x0f 81a1533d94SBarry Song #define AD193X_ADC_SERFMT_MASK 0x60 82a1533d94SBarry Song #define AD193X_ADC_SERFMT_STEREO (0 << 5) 83bf545ed7SScott Jiang #define AD193X_ADC_SERFMT_TDM (1 << 5) 84a1533d94SBarry Song #define AD193X_ADC_SERFMT_AUX (2 << 5) 85a1533d94SBarry Song #define AD193X_ADC_WORD_LEN_MASK 0x3 8630ab1e78SLars-Peter Clausen #define AD193X_ADC_CTRL2 0x10 87a1533d94SBarry Song #define AD193X_ADC_CHAN_SHFT 4 88a1533d94SBarry Song #define AD193X_ADC_CHAN_MASK (3 << AD193X_ADC_CHAN_SHFT) 89a1533d94SBarry Song #define AD193X_ADC_LCR_MASTER (1 << 3) 90a1533d94SBarry Song #define AD193X_ADC_BCLK_MASTER (1 << 6) 91a1533d94SBarry Song #define AD193X_ADC_LEFT_HIGH (1 << 2) 92a1533d94SBarry Song #define AD193X_ADC_BCLK_INV (1 << 1) 93b82ca578SLars-Peter Clausen #define AD193X_ADC_FMT_MASK (AD193X_ADC_LCR_MASTER | \ 94b82ca578SLars-Peter Clausen AD193X_ADC_BCLK_MASTER | AD193X_ADC_LEFT_HIGH | AD193X_ADC_BCLK_INV) 95b82ca578SLars-Peter Clausen 96b82ca578SLars-Peter Clausen #define AD193X_2_CHANNELS 0 97b82ca578SLars-Peter Clausen #define AD193X_4_CHANNELS 1 98b82ca578SLars-Peter Clausen #define AD193X_8_CHANNELS 2 99b82ca578SLars-Peter Clausen #define AD193X_16_CHANNELS 3 100a1533d94SBarry Song 101a1533d94SBarry Song #define AD193X_NUM_REGS 17 102a1533d94SBarry Song 10359529473SCodrin Ciubotariu #define AD193X_SYSCLK_PLL 0 10459529473SCodrin Ciubotariu #define AD193X_SYSCLK_MCLK 1 10559529473SCodrin Ciubotariu 106a1533d94SBarry Song #endif 107