aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tlv320aic3x.h
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/tlv320aic3x.h')
-rw-r--r--sound/soc/codecs/tlv320aic3x.h46
1 files changed, 45 insertions, 1 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.h b/sound/soc/codecs/tlv320aic3x.h
index 7e982acf3996..73e35b6ec929 100644
--- a/sound/soc/codecs/tlv320aic3x.h
+++ b/sound/soc/codecs/tlv320aic3x.h
@@ -39,7 +39,9 @@
39#define AIC3X_OVRF_STATUS_AND_PLLR_REG 11 39#define AIC3X_OVRF_STATUS_AND_PLLR_REG 11
40/* Audio codec digital filter control register */ 40/* Audio codec digital filter control register */
41#define AIC3X_CODEC_DFILT_CTRL 12 41#define AIC3X_CODEC_DFILT_CTRL 12
42 42/* Headset/button press detection register */
43#define AIC3X_HEADSET_DETECT_CTRL_A 13
44#define AIC3X_HEADSET_DETECT_CTRL_B 14
43/* ADC PGA Gain control registers */ 45/* ADC PGA Gain control registers */
44#define LADC_VOL 15 46#define LADC_VOL 15
45#define RADC_VOL 16 47#define RADC_VOL 16
@@ -233,7 +235,49 @@ enum {
233 235
234void aic3x_set_gpio(struct snd_soc_codec *codec, int gpio, int state); 236void aic3x_set_gpio(struct snd_soc_codec *codec, int gpio, int state);
235int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio); 237int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio);
238
239/* headset detection / button API */
240
241/* The AIC3x supports detection of stereo headsets (GND + left + right signal)
242 * and cellular headsets (GND + speaker output + microphone input).
243 * It is recommended to enable MIC bias for this function to work properly.
244 * For more information, please refer to the datasheet. */
245enum {
246 AIC3X_HEADSET_DETECT_OFF = 0,
247 AIC3X_HEADSET_DETECT_STEREO = 1,
248 AIC3X_HEADSET_DETECT_CELLULAR = 2,
249 AIC3X_HEADSET_DETECT_BOTH = 3
250};
251
252enum {
253 AIC3X_HEADSET_DEBOUNCE_16MS = 0,
254 AIC3X_HEADSET_DEBOUNCE_32MS = 1,
255 AIC3X_HEADSET_DEBOUNCE_64MS = 2,
256 AIC3X_HEADSET_DEBOUNCE_128MS = 3,
257 AIC3X_HEADSET_DEBOUNCE_256MS = 4,
258 AIC3X_HEADSET_DEBOUNCE_512MS = 5
259};
260
261enum {
262 AIC3X_BUTTON_DEBOUNCE_0MS = 0,
263 AIC3X_BUTTON_DEBOUNCE_8MS = 1,
264 AIC3X_BUTTON_DEBOUNCE_16MS = 2,
265 AIC3X_BUTTON_DEBOUNCE_32MS = 3
266};
267
268#define AIC3X_HEADSET_DETECT_ENABLED 0x80
269#define AIC3X_HEADSET_DETECT_SHIFT 5
270#define AIC3X_HEADSET_DETECT_MASK 3
271#define AIC3X_HEADSET_DEBOUNCE_SHIFT 2
272#define AIC3X_HEADSET_DEBOUNCE_MASK 7
273#define AIC3X_BUTTON_DEBOUNCE_SHIFT 0
274#define AIC3X_BUTTON_DEBOUNCE_MASK 3
275
276/* see the enums above for valid parameters to this function */
277void aic3x_set_headset_detection(struct snd_soc_codec *codec, int detect,
278 int headset_debounce, int button_debounce);
236int aic3x_headset_detected(struct snd_soc_codec *codec); 279int aic3x_headset_detected(struct snd_soc_codec *codec);
280int aic3x_button_pressed(struct snd_soc_codec *codec);
237 281
238struct aic3x_setup_data { 282struct aic3x_setup_data {
239 int i2c_bus; 283 int i2c_bus;