diff options
Diffstat (limited to 'sound/soc/codecs/tlv320aic3x.h')
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.h | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.h b/sound/soc/codecs/tlv320aic3x.h index 00a195aa02e4..ac827e578c4d 100644 --- a/sound/soc/codecs/tlv320aic3x.h +++ b/sound/soc/codecs/tlv320aic3x.h | |||
@@ -35,11 +35,15 @@ | |||
35 | #define AIC3X_ASD_INTF_CTRLA 8 | 35 | #define AIC3X_ASD_INTF_CTRLA 8 |
36 | /* Audio serial data interface control register B */ | 36 | /* Audio serial data interface control register B */ |
37 | #define AIC3X_ASD_INTF_CTRLB 9 | 37 | #define AIC3X_ASD_INTF_CTRLB 9 |
38 | /* Audio serial data interface control register C */ | ||
39 | #define AIC3X_ASD_INTF_CTRLC 10 | ||
38 | /* Audio overflow status and PLL R value programming register */ | 40 | /* Audio overflow status and PLL R value programming register */ |
39 | #define AIC3X_OVRF_STATUS_AND_PLLR_REG 11 | 41 | #define AIC3X_OVRF_STATUS_AND_PLLR_REG 11 |
40 | /* Audio codec digital filter control register */ | 42 | /* Audio codec digital filter control register */ |
41 | #define AIC3X_CODEC_DFILT_CTRL 12 | 43 | #define AIC3X_CODEC_DFILT_CTRL 12 |
42 | 44 | /* Headset/button press detection register */ | |
45 | #define AIC3X_HEADSET_DETECT_CTRL_A 13 | ||
46 | #define AIC3X_HEADSET_DETECT_CTRL_B 14 | ||
43 | /* ADC PGA Gain control registers */ | 47 | /* ADC PGA Gain control registers */ |
44 | #define LADC_VOL 15 | 48 | #define LADC_VOL 15 |
45 | #define RADC_VOL 16 | 49 | #define RADC_VOL 16 |
@@ -48,7 +52,9 @@ | |||
48 | #define MIC3LR_2_RADC_CTRL 18 | 52 | #define MIC3LR_2_RADC_CTRL 18 |
49 | /* Line1 Input control registers */ | 53 | /* Line1 Input control registers */ |
50 | #define LINE1L_2_LADC_CTRL 19 | 54 | #define LINE1L_2_LADC_CTRL 19 |
55 | #define LINE1R_2_LADC_CTRL 21 | ||
51 | #define LINE1R_2_RADC_CTRL 22 | 56 | #define LINE1R_2_RADC_CTRL 22 |
57 | #define LINE1L_2_RADC_CTRL 24 | ||
52 | /* Line2 Input control registers */ | 58 | /* Line2 Input control registers */ |
53 | #define LINE2L_2_LADC_CTRL 20 | 59 | #define LINE2L_2_LADC_CTRL 20 |
54 | #define LINE2R_2_RADC_CTRL 23 | 60 | #define LINE2R_2_RADC_CTRL 23 |
@@ -79,6 +85,8 @@ | |||
79 | #define LINE2L_2_HPLOUT_VOL 45 | 85 | #define LINE2L_2_HPLOUT_VOL 45 |
80 | #define LINE2R_2_HPROUT_VOL 62 | 86 | #define LINE2R_2_HPROUT_VOL 62 |
81 | #define PGAL_2_HPLOUT_VOL 46 | 87 | #define PGAL_2_HPLOUT_VOL 46 |
88 | #define PGAL_2_HPROUT_VOL 60 | ||
89 | #define PGAR_2_HPLOUT_VOL 49 | ||
82 | #define PGAR_2_HPROUT_VOL 63 | 90 | #define PGAR_2_HPROUT_VOL 63 |
83 | #define DACL1_2_HPLOUT_VOL 47 | 91 | #define DACL1_2_HPLOUT_VOL 47 |
84 | #define DACR1_2_HPROUT_VOL 64 | 92 | #define DACR1_2_HPROUT_VOL 64 |
@@ -88,6 +96,8 @@ | |||
88 | #define LINE2L_2_HPLCOM_VOL 52 | 96 | #define LINE2L_2_HPLCOM_VOL 52 |
89 | #define LINE2R_2_HPRCOM_VOL 69 | 97 | #define LINE2R_2_HPRCOM_VOL 69 |
90 | #define PGAL_2_HPLCOM_VOL 53 | 98 | #define PGAL_2_HPLCOM_VOL 53 |
99 | #define PGAR_2_HPLCOM_VOL 56 | ||
100 | #define PGAL_2_HPRCOM_VOL 67 | ||
91 | #define PGAR_2_HPRCOM_VOL 70 | 101 | #define PGAR_2_HPRCOM_VOL 70 |
92 | #define DACL1_2_HPLCOM_VOL 54 | 102 | #define DACL1_2_HPLCOM_VOL 54 |
93 | #define DACR1_2_HPRCOM_VOL 71 | 103 | #define DACR1_2_HPRCOM_VOL 71 |
@@ -103,11 +113,17 @@ | |||
103 | #define MONOLOPM_CTRL 79 | 113 | #define MONOLOPM_CTRL 79 |
104 | /* Line Output Plus/Minus control registers */ | 114 | /* Line Output Plus/Minus control registers */ |
105 | #define LINE2L_2_LLOPM_VOL 80 | 115 | #define LINE2L_2_LLOPM_VOL 80 |
116 | #define LINE2L_2_RLOPM_VOL 87 | ||
117 | #define LINE2R_2_LLOPM_VOL 83 | ||
106 | #define LINE2R_2_RLOPM_VOL 90 | 118 | #define LINE2R_2_RLOPM_VOL 90 |
107 | #define PGAL_2_LLOPM_VOL 81 | 119 | #define PGAL_2_LLOPM_VOL 81 |
120 | #define PGAL_2_RLOPM_VOL 88 | ||
121 | #define PGAR_2_LLOPM_VOL 84 | ||
108 | #define PGAR_2_RLOPM_VOL 91 | 122 | #define PGAR_2_RLOPM_VOL 91 |
109 | #define DACL1_2_LLOPM_VOL 82 | 123 | #define DACL1_2_LLOPM_VOL 82 |
124 | #define DACL1_2_RLOPM_VOL 89 | ||
110 | #define DACR1_2_RLOPM_VOL 92 | 125 | #define DACR1_2_RLOPM_VOL 92 |
126 | #define DACR1_2_LLOPM_VOL 85 | ||
111 | #define LLOPM_CTRL 86 | 127 | #define LLOPM_CTRL 86 |
112 | #define RLOPM_CTRL 93 | 128 | #define RLOPM_CTRL 93 |
113 | /* GPIO/IRQ registers */ | 129 | /* GPIO/IRQ registers */ |
@@ -221,7 +237,49 @@ enum { | |||
221 | 237 | ||
222 | void aic3x_set_gpio(struct snd_soc_codec *codec, int gpio, int state); | 238 | void aic3x_set_gpio(struct snd_soc_codec *codec, int gpio, int state); |
223 | int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio); | 239 | int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio); |
240 | |||
241 | /* headset detection / button API */ | ||
242 | |||
243 | /* The AIC3x supports detection of stereo headsets (GND + left + right signal) | ||
244 | * and cellular headsets (GND + speaker output + microphone input). | ||
245 | * It is recommended to enable MIC bias for this function to work properly. | ||
246 | * For more information, please refer to the datasheet. */ | ||
247 | enum { | ||
248 | AIC3X_HEADSET_DETECT_OFF = 0, | ||
249 | AIC3X_HEADSET_DETECT_STEREO = 1, | ||
250 | AIC3X_HEADSET_DETECT_CELLULAR = 2, | ||
251 | AIC3X_HEADSET_DETECT_BOTH = 3 | ||
252 | }; | ||
253 | |||
254 | enum { | ||
255 | AIC3X_HEADSET_DEBOUNCE_16MS = 0, | ||
256 | AIC3X_HEADSET_DEBOUNCE_32MS = 1, | ||
257 | AIC3X_HEADSET_DEBOUNCE_64MS = 2, | ||
258 | AIC3X_HEADSET_DEBOUNCE_128MS = 3, | ||
259 | AIC3X_HEADSET_DEBOUNCE_256MS = 4, | ||
260 | AIC3X_HEADSET_DEBOUNCE_512MS = 5 | ||
261 | }; | ||
262 | |||
263 | enum { | ||
264 | AIC3X_BUTTON_DEBOUNCE_0MS = 0, | ||
265 | AIC3X_BUTTON_DEBOUNCE_8MS = 1, | ||
266 | AIC3X_BUTTON_DEBOUNCE_16MS = 2, | ||
267 | AIC3X_BUTTON_DEBOUNCE_32MS = 3 | ||
268 | }; | ||
269 | |||
270 | #define AIC3X_HEADSET_DETECT_ENABLED 0x80 | ||
271 | #define AIC3X_HEADSET_DETECT_SHIFT 5 | ||
272 | #define AIC3X_HEADSET_DETECT_MASK 3 | ||
273 | #define AIC3X_HEADSET_DEBOUNCE_SHIFT 2 | ||
274 | #define AIC3X_HEADSET_DEBOUNCE_MASK 7 | ||
275 | #define AIC3X_BUTTON_DEBOUNCE_SHIFT 0 | ||
276 | #define AIC3X_BUTTON_DEBOUNCE_MASK 3 | ||
277 | |||
278 | /* see the enums above for valid parameters to this function */ | ||
279 | void aic3x_set_headset_detection(struct snd_soc_codec *codec, int detect, | ||
280 | int headset_debounce, int button_debounce); | ||
224 | int aic3x_headset_detected(struct snd_soc_codec *codec); | 281 | int aic3x_headset_detected(struct snd_soc_codec *codec); |
282 | int aic3x_button_pressed(struct snd_soc_codec *codec); | ||
225 | 283 | ||
226 | struct aic3x_setup_data { | 284 | struct aic3x_setup_data { |
227 | int i2c_bus; | 285 | int i2c_bus; |