Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 1 | /* |
| 2 | * AD193X Audio Codec driver |
| 3 | * |
| 4 | * Copyright 2010 Analog Devices Inc. |
| 5 | * |
| 6 | * Licensed under the GPL-2 or later. |
| 7 | */ |
| 8 | |
| 9 | #ifndef __AD193X_H__ |
| 10 | #define __AD193X_H__ |
| 11 | |
Lars-Peter Clausen | 6c3d713 | 2014-02-17 13:16:54 +0100 | [diff] [blame] | 12 | #include <linux/regmap.h> |
| 13 | |
| 14 | struct device; |
| 15 | |
Cyrille Pitchen | e5224f5 | 2015-09-29 16:41:43 +0200 | [diff] [blame] | 16 | enum ad193x_type { |
| 17 | AD193X, |
| 18 | AD1933, |
| 19 | AD1934, |
| 20 | }; |
| 21 | |
Lars-Peter Clausen | 6c3d713 | 2014-02-17 13:16:54 +0100 | [diff] [blame] | 22 | extern const struct regmap_config ad193x_regmap_config; |
Cyrille Pitchen | e5224f5 | 2015-09-29 16:41:43 +0200 | [diff] [blame] | 23 | int ad193x_probe(struct device *dev, struct regmap *regmap, |
| 24 | enum ad193x_type type); |
Lars-Peter Clausen | 6c3d713 | 2014-02-17 13:16:54 +0100 | [diff] [blame] | 25 | |
Lars-Peter Clausen | 30ab1e7 | 2011-09-05 20:46:33 +0200 | [diff] [blame] | 26 | #define AD193X_PLL_CLK_CTRL0 0x00 |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 27 | #define AD193X_PLL_POWERDOWN 0x01 |
Axel Lin | f3aa721 | 2011-10-14 17:01:59 +0800 | [diff] [blame] | 28 | #define AD193X_PLL_INPUT_MASK 0x6 |
Barry Song | fab90aa | 2010-05-21 11:57:01 +0800 | [diff] [blame] | 29 | #define AD193X_PLL_INPUT_256 (0 << 1) |
| 30 | #define AD193X_PLL_INPUT_384 (1 << 1) |
| 31 | #define AD193X_PLL_INPUT_512 (2 << 1) |
| 32 | #define AD193X_PLL_INPUT_768 (3 << 1) |
Lars-Peter Clausen | 30ab1e7 | 2011-09-05 20:46:33 +0200 | [diff] [blame] | 33 | #define AD193X_PLL_CLK_CTRL1 0x01 |
| 34 | #define AD193X_DAC_CTRL0 0x02 |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 35 | #define AD193X_DAC_POWERDOWN 0x01 |
| 36 | #define AD193X_DAC_SERFMT_MASK 0xC0 |
| 37 | #define AD193X_DAC_SERFMT_STEREO (0 << 6) |
| 38 | #define AD193X_DAC_SERFMT_TDM (1 << 6) |
Lars-Peter Clausen | 30ab1e7 | 2011-09-05 20:46:33 +0200 | [diff] [blame] | 39 | #define AD193X_DAC_CTRL1 0x03 |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 40 | #define AD193X_DAC_CHAN_SHFT 1 |
| 41 | #define AD193X_DAC_CHAN_MASK (3 << AD193X_DAC_CHAN_SHFT) |
| 42 | #define AD193X_DAC_LCR_MASTER (1 << 4) |
| 43 | #define AD193X_DAC_BCLK_MASTER (1 << 5) |
| 44 | #define AD193X_DAC_LEFT_HIGH (1 << 3) |
| 45 | #define AD193X_DAC_BCLK_INV (1 << 7) |
Lars-Peter Clausen | b82ca57 | 2011-11-28 17:28:11 +0100 | [diff] [blame] | 46 | #define AD193X_DAC_FMT_MASK (AD193X_DAC_LCR_MASTER | \ |
| 47 | AD193X_DAC_BCLK_MASTER | AD193X_DAC_LEFT_HIGH | AD193X_DAC_BCLK_INV) |
Lars-Peter Clausen | 30ab1e7 | 2011-09-05 20:46:33 +0200 | [diff] [blame] | 48 | #define AD193X_DAC_CTRL2 0x04 |
Scott Jiang | 95c93d8 | 2011-08-12 18:04:11 -0400 | [diff] [blame] | 49 | #define AD193X_DAC_WORD_LEN_SHFT 3 |
Scott Jiang | bf545ed | 2011-08-12 18:04:10 -0400 | [diff] [blame] | 50 | #define AD193X_DAC_WORD_LEN_MASK 0x18 |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 51 | #define AD193X_DAC_MASTER_MUTE 1 |
Lars-Peter Clausen | 30ab1e7 | 2011-09-05 20:46:33 +0200 | [diff] [blame] | 52 | #define AD193X_DAC_CHNL_MUTE 0x05 |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 53 | #define AD193X_DACL1_MUTE 0 |
| 54 | #define AD193X_DACR1_MUTE 1 |
| 55 | #define AD193X_DACL2_MUTE 2 |
| 56 | #define AD193X_DACR2_MUTE 3 |
| 57 | #define AD193X_DACL3_MUTE 4 |
| 58 | #define AD193X_DACR3_MUTE 5 |
| 59 | #define AD193X_DACL4_MUTE 6 |
| 60 | #define AD193X_DACR4_MUTE 7 |
Lars-Peter Clausen | 30ab1e7 | 2011-09-05 20:46:33 +0200 | [diff] [blame] | 61 | #define AD193X_DAC_L1_VOL 0x06 |
| 62 | #define AD193X_DAC_R1_VOL 0x07 |
| 63 | #define AD193X_DAC_L2_VOL 0x08 |
| 64 | #define AD193X_DAC_R2_VOL 0x09 |
| 65 | #define AD193X_DAC_L3_VOL 0x0a |
| 66 | #define AD193X_DAC_R3_VOL 0x0b |
| 67 | #define AD193X_DAC_L4_VOL 0x0c |
| 68 | #define AD193X_DAC_R4_VOL 0x0d |
| 69 | #define AD193X_ADC_CTRL0 0x0e |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 70 | #define AD193X_ADC_POWERDOWN 0x01 |
| 71 | #define AD193X_ADC_HIGHPASS_FILTER 1 |
| 72 | #define AD193X_ADCL1_MUTE 2 |
| 73 | #define AD193X_ADCR1_MUTE 3 |
| 74 | #define AD193X_ADCL2_MUTE 4 |
| 75 | #define AD193X_ADCR2_MUTE 5 |
Lars-Peter Clausen | 30ab1e7 | 2011-09-05 20:46:33 +0200 | [diff] [blame] | 76 | #define AD193X_ADC_CTRL1 0x0f |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 77 | #define AD193X_ADC_SERFMT_MASK 0x60 |
| 78 | #define AD193X_ADC_SERFMT_STEREO (0 << 5) |
Scott Jiang | bf545ed | 2011-08-12 18:04:10 -0400 | [diff] [blame] | 79 | #define AD193X_ADC_SERFMT_TDM (1 << 5) |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 80 | #define AD193X_ADC_SERFMT_AUX (2 << 5) |
| 81 | #define AD193X_ADC_WORD_LEN_MASK 0x3 |
Lars-Peter Clausen | 30ab1e7 | 2011-09-05 20:46:33 +0200 | [diff] [blame] | 82 | #define AD193X_ADC_CTRL2 0x10 |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 83 | #define AD193X_ADC_CHAN_SHFT 4 |
| 84 | #define AD193X_ADC_CHAN_MASK (3 << AD193X_ADC_CHAN_SHFT) |
| 85 | #define AD193X_ADC_LCR_MASTER (1 << 3) |
| 86 | #define AD193X_ADC_BCLK_MASTER (1 << 6) |
| 87 | #define AD193X_ADC_LEFT_HIGH (1 << 2) |
| 88 | #define AD193X_ADC_BCLK_INV (1 << 1) |
Lars-Peter Clausen | b82ca57 | 2011-11-28 17:28:11 +0100 | [diff] [blame] | 89 | #define AD193X_ADC_FMT_MASK (AD193X_ADC_LCR_MASTER | \ |
| 90 | AD193X_ADC_BCLK_MASTER | AD193X_ADC_LEFT_HIGH | AD193X_ADC_BCLK_INV) |
| 91 | |
| 92 | #define AD193X_2_CHANNELS 0 |
| 93 | #define AD193X_4_CHANNELS 1 |
| 94 | #define AD193X_8_CHANNELS 2 |
| 95 | #define AD193X_16_CHANNELS 3 |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 96 | |
| 97 | #define AD193X_NUM_REGS 17 |
| 98 | |
Barry Song | a1533d9 | 2010-03-19 14:48:33 +0800 | [diff] [blame] | 99 | #endif |