Merge remote-tracking branches 'asoc/topic/wm8996', 'asoc/topic/xtensa' and 'asoc...
[sfrench/cifs-2.6.git] / sound / soc / codecs / ab8500-codec.h
index 306d0bc8455faeb202f4c13d87892355350fa0b3..e2e54425d25ef7f8b4e4d295ad824cb676586043 100644 (file)
 #define AB8500_SUPPORTED_RATE                  (SNDRV_PCM_RATE_48000)
 #define AB8500_SUPPORTED_FMT                   (SNDRV_PCM_FMTBIT_S16_LE)
 
+/* AB8500 interface slot offset definitions */
+
+#define AB8500_AD_DATA0_OFFSET 0
+#define AB8500_DA_DATA0_OFFSET 8
+#define AB8500_AD_DATA1_OFFSET 16
+#define AB8500_DA_DATA1_OFFSET 24
+
 /* AB8500 audio bank (0x0d) register definitions */
 
 #define AB8500_POWERUP                         0x00
@@ -73,6 +80,7 @@
 #define AB8500_ADSLOTSEL14                     0x2C
 #define AB8500_ADSLOTSEL15                     0x2D
 #define AB8500_ADSLOTSEL16                     0x2E
+#define AB8500_ADSLOTSEL(slot)                 (AB8500_ADSLOTSEL1 + (slot >> 1))
 #define AB8500_ADSLOTHIZCTRL1                  0x2F
 #define AB8500_ADSLOTHIZCTRL2                  0x30
 #define AB8500_ADSLOTHIZCTRL3                  0x31
 #define AB8500_CACHEREGNUM                     (AB8500_LAST_REG + 1)
 
 #define AB8500_MASK_ALL                                0xFF
+#define AB8500_MASK_SLOT(slot)                 ((slot & 1) ? 0xF0 : 0x0F)
 #define AB8500_MASK_NONE                       0x00
 
 /* AB8500_POWERUP */
 #define AB8500_DIGIFCONF4_IF1WL0               0
 
 /* AB8500_ADSLOTSELX */
-#define AB8500_ADSLOTSELX_AD_OUT1_TO_SLOT_ODD  0x00
-#define AB8500_ADSLOTSELX_AD_OUT2_TO_SLOT_ODD  0x10
-#define AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_ODD  0x20
-#define AB8500_ADSLOTSELX_AD_OUT4_TO_SLOT_ODD  0x30
-#define AB8500_ADSLOTSELX_AD_OUT5_TO_SLOT_ODD  0x40
-#define AB8500_ADSLOTSELX_AD_OUT6_TO_SLOT_ODD  0x50
-#define AB8500_ADSLOTSELX_AD_OUT7_TO_SLOT_ODD  0x60
-#define AB8500_ADSLOTSELX_AD_OUT8_TO_SLOT_ODD  0x70
-#define AB8500_ADSLOTSELX_ZEROES_TO_SLOT_ODD   0x80
-#define AB8500_ADSLOTSELX_TRISTATE_TO_SLOT_ODD 0xF0
-#define AB8500_ADSLOTSELX_AD_OUT1_TO_SLOT_EVEN 0x00
-#define AB8500_ADSLOTSELX_AD_OUT2_TO_SLOT_EVEN 0x01
-#define AB8500_ADSLOTSELX_AD_OUT3_TO_SLOT_EVEN 0x02
-#define AB8500_ADSLOTSELX_AD_OUT4_TO_SLOT_EVEN 0x03
-#define AB8500_ADSLOTSELX_AD_OUT5_TO_SLOT_EVEN 0x04
-#define AB8500_ADSLOTSELX_AD_OUT6_TO_SLOT_EVEN 0x05
-#define AB8500_ADSLOTSELX_AD_OUT7_TO_SLOT_EVEN 0x06
-#define AB8500_ADSLOTSELX_AD_OUT8_TO_SLOT_EVEN 0x07
-#define AB8500_ADSLOTSELX_ZEROES_TO_SLOT_EVEN  0x08
-#define AB8500_ADSLOTSELX_TRISTATE_TO_SLOT_EVEN        0x0F
+#define AB8500_AD_OUT1 0x0
+#define AB8500_AD_OUT2 0x1
+#define AB8500_AD_OUT3 0x2
+#define AB8500_AD_OUT4 0x3
+#define AB8500_AD_OUT5 0x4
+#define AB8500_AD_OUT6 0x5
+#define AB8500_AD_OUT7 0x6
+#define AB8500_AD_OUT8 0x7
+#define AB8500_ZEROES  0x8
+#define AB8500_TRISTATE        0xF
 #define AB8500_ADSLOTSELX_EVEN_SHIFT           0
 #define AB8500_ADSLOTSELX_ODD_SHIFT            4
+#define AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(out, slot)    \
+       ((out) << (((slot) & 1) ? \
+        AB8500_ADSLOTSELX_ODD_SHIFT : AB8500_ADSLOTSELX_EVEN_SHIFT))
 
 /* AB8500_ADSLOTHIZCTRL1 */
 /* AB8500_ADSLOTHIZCTRL2 */