]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - sound/soc/codecs/tlv320aic3x.h
ASoC: tlv320aic3x: Change to use device model
[mv-sheeva.git] / sound / soc / codecs / tlv320aic3x.h
index 00a195aa02e4e2321d9437f964688f532cf0fde8..9af1c886213c0f1d432014ea65a259dfea4ecfd8 100644 (file)
 #define AIC3X_ASD_INTF_CTRLA           8
 /* Audio serial data interface control register B */
 #define AIC3X_ASD_INTF_CTRLB           9
+/* Audio serial data interface control register C */
+#define AIC3X_ASD_INTF_CTRLC           10
 /* Audio overflow status and PLL R value programming register */
 #define AIC3X_OVRF_STATUS_AND_PLLR_REG 11
 /* Audio codec digital filter control register */
 #define AIC3X_CODEC_DFILT_CTRL         12
-
+/* Headset/button press detection register */
+#define AIC3X_HEADSET_DETECT_CTRL_A    13
+#define AIC3X_HEADSET_DETECT_CTRL_B    14
 /* ADC PGA Gain control registers */
 #define LADC_VOL                       15
 #define RADC_VOL                       16
@@ -48,7 +52,9 @@
 #define MIC3LR_2_RADC_CTRL             18
 /* Line1 Input control registers */
 #define LINE1L_2_LADC_CTRL             19
+#define LINE1R_2_LADC_CTRL             21
 #define LINE1R_2_RADC_CTRL             22
+#define LINE1L_2_RADC_CTRL             24
 /* Line2 Input control registers */
 #define LINE2L_2_LADC_CTRL             20
 #define LINE2R_2_RADC_CTRL             23
@@ -79,6 +85,8 @@
 #define LINE2L_2_HPLOUT_VOL            45
 #define LINE2R_2_HPROUT_VOL            62
 #define PGAL_2_HPLOUT_VOL              46
+#define PGAL_2_HPROUT_VOL              60
+#define PGAR_2_HPLOUT_VOL              49
 #define PGAR_2_HPROUT_VOL              63
 #define DACL1_2_HPLOUT_VOL             47
 #define DACR1_2_HPROUT_VOL             64
@@ -88,6 +96,8 @@
 #define LINE2L_2_HPLCOM_VOL            52
 #define LINE2R_2_HPRCOM_VOL            69
 #define PGAL_2_HPLCOM_VOL              53
+#define PGAR_2_HPLCOM_VOL              56
+#define PGAL_2_HPRCOM_VOL              67
 #define PGAR_2_HPRCOM_VOL              70
 #define DACL1_2_HPLCOM_VOL             54
 #define DACR1_2_HPRCOM_VOL             71
 #define MONOLOPM_CTRL                  79
 /* Line Output Plus/Minus control registers */
 #define LINE2L_2_LLOPM_VOL             80
+#define LINE2L_2_RLOPM_VOL             87
+#define LINE2R_2_LLOPM_VOL             83
 #define LINE2R_2_RLOPM_VOL             90
 #define PGAL_2_LLOPM_VOL               81
+#define PGAL_2_RLOPM_VOL               88
+#define PGAR_2_LLOPM_VOL               84
 #define PGAR_2_RLOPM_VOL               91
 #define DACL1_2_LLOPM_VOL              82
+#define DACL1_2_RLOPM_VOL              89
 #define DACR1_2_RLOPM_VOL              92
+#define DACR1_2_LLOPM_VOL              85
 #define LLOPM_CTRL                     86
 #define RLOPM_CTRL                     93
 /* GPIO/IRQ registers */
@@ -221,11 +237,51 @@ enum {
 
 void aic3x_set_gpio(struct snd_soc_codec *codec, int gpio, int state);
 int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio);
+
+/* headset detection / button API */
+
+/* The AIC3x supports detection of stereo headsets (GND + left + right signal)
+ * and cellular headsets (GND + speaker output + microphone input).
+ * It is recommended to enable MIC bias for this function to work properly.
+ * For more information, please refer to the datasheet. */
+enum {
+       AIC3X_HEADSET_DETECT_OFF        = 0,
+       AIC3X_HEADSET_DETECT_STEREO     = 1,
+       AIC3X_HEADSET_DETECT_CELLULAR   = 2,
+       AIC3X_HEADSET_DETECT_BOTH       = 3
+};
+
+enum {
+       AIC3X_HEADSET_DEBOUNCE_16MS     = 0,
+       AIC3X_HEADSET_DEBOUNCE_32MS     = 1,
+       AIC3X_HEADSET_DEBOUNCE_64MS     = 2,
+       AIC3X_HEADSET_DEBOUNCE_128MS    = 3,
+       AIC3X_HEADSET_DEBOUNCE_256MS    = 4,
+       AIC3X_HEADSET_DEBOUNCE_512MS    = 5
+};
+
+enum {
+       AIC3X_BUTTON_DEBOUNCE_0MS       = 0,
+       AIC3X_BUTTON_DEBOUNCE_8MS       = 1,
+       AIC3X_BUTTON_DEBOUNCE_16MS      = 2,
+       AIC3X_BUTTON_DEBOUNCE_32MS      = 3
+};
+
+#define AIC3X_HEADSET_DETECT_ENABLED   0x80
+#define AIC3X_HEADSET_DETECT_SHIFT     5
+#define AIC3X_HEADSET_DETECT_MASK      3
+#define AIC3X_HEADSET_DEBOUNCE_SHIFT   2
+#define AIC3X_HEADSET_DEBOUNCE_MASK    7
+#define AIC3X_BUTTON_DEBOUNCE_SHIFT    0
+#define AIC3X_BUTTON_DEBOUNCE_MASK     3
+
+/* see the enums above for valid parameters to this function */
+void aic3x_set_headset_detection(struct snd_soc_codec *codec, int detect,
+                                int headset_debounce, int button_debounce);
 int aic3x_headset_detected(struct snd_soc_codec *codec);
+int aic3x_button_pressed(struct snd_soc_codec *codec);
 
 struct aic3x_setup_data {
-       int i2c_bus;
-       unsigned short i2c_address;
        unsigned int gpio_func[2];
 };