aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tlv320aic3x.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/tlv320aic3x.c')
-rw-r--r--sound/soc/codecs/tlv320aic3x.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 0f4067bdd4a3..341e1adc9167 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1018,14 +1018,41 @@ int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio)
1018} 1018}
1019EXPORT_SYMBOL_GPL(aic3x_get_gpio); 1019EXPORT_SYMBOL_GPL(aic3x_get_gpio);
1020 1020
1021void aic3x_set_headset_detection(struct snd_soc_codec *codec, int detect,
1022 int headset_debounce, int button_debounce)
1023{
1024 u8 val;
1025
1026 val = ((detect & AIC3X_HEADSET_DETECT_MASK)
1027 << AIC3X_HEADSET_DETECT_SHIFT) |
1028 ((headset_debounce & AIC3X_HEADSET_DEBOUNCE_MASK)
1029 << AIC3X_HEADSET_DEBOUNCE_SHIFT) |
1030 ((button_debounce & AIC3X_BUTTON_DEBOUNCE_MASK)
1031 << AIC3X_BUTTON_DEBOUNCE_SHIFT);
1032
1033 if (detect & AIC3X_HEADSET_DETECT_MASK)
1034 val |= AIC3X_HEADSET_DETECT_ENABLED;
1035
1036 aic3x_write(codec, AIC3X_HEADSET_DETECT_CTRL_A, val);
1037}
1038EXPORT_SYMBOL_GPL(aic3x_set_headset_detection);
1039
1021int aic3x_headset_detected(struct snd_soc_codec *codec) 1040int aic3x_headset_detected(struct snd_soc_codec *codec)
1022{ 1041{
1023 u8 val; 1042 u8 val;
1024 aic3x_read(codec, AIC3X_RT_IRQ_FLAGS_REG, &val); 1043 aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val);
1025 return (val >> 2) & 1; 1044 return (val >> 4) & 1;
1026} 1045}
1027EXPORT_SYMBOL_GPL(aic3x_headset_detected); 1046EXPORT_SYMBOL_GPL(aic3x_headset_detected);
1028 1047
1048int aic3x_button_pressed(struct snd_soc_codec *codec)
1049{
1050 u8 val;
1051 aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val);
1052 return (val >> 5) & 1;
1053}
1054EXPORT_SYMBOL_GPL(aic3x_button_pressed);
1055
1029#define AIC3X_RATES SNDRV_PCM_RATE_8000_96000 1056#define AIC3X_RATES SNDRV_PCM_RATE_8000_96000
1030#define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 1057#define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
1031 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) 1058 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)