ASoC: TWL4030: Add shadow register
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>
Mon, 25 May 2009 08:12:12 +0000 (11:12 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 25 May 2009 10:54:14 +0000 (11:54 +0100)
Shadow, non HW register for dealing with the HandsfreeL/R
muting.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/twl4030.c
sound/soc/codecs/twl4030.h

index 17ddcb265134f24b74f400892115a4cc7e1931f8..989446dabcda1347f198293f59da579bef2f77ac 100644 (file)
@@ -115,6 +115,7 @@ static const u8 twl4030_reg[TWL4030_CACHEREGNUM] = {
        0x00, /* REG_VIBRA_PWM_SET      (0x47)  */
        0x00, /* REG_ANAMIC_GAIN        (0x48)  */
        0x00, /* REG_MISC_SET_2         (0x49)  */
+       0x00, /* REG_SW_SHADOW          (0x4A)  - Shadow, non HW register */
 };
 
 /* codec private data */
@@ -172,7 +173,11 @@ static int twl4030_write(struct snd_soc_codec *codec,
                        unsigned int reg, unsigned int value)
 {
        twl4030_write_reg_cache(codec, reg, value);
-       return twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, value, reg);
+       if (likely(reg < TWL4030_REG_SW_SHADOW))
+               return twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, value,
+                                           reg);
+       else
+               return 0;
 }
 
 static void twl4030_codec_enable(struct snd_soc_codec *codec, int enable)
index 48326e2bd9de15ae7640ca0934ca4a566c04bca0..fe5f395d9e4fe8bdcce9b4ca29c82aceecb57a7c 100644 (file)
@@ -92,8 +92,9 @@
 #define TWL4030_REG_VIBRA_PWM_SET      0x47
 #define TWL4030_REG_ANAMIC_GAIN                0x48
 #define TWL4030_REG_MISC_SET_2         0x49
+#define TWL4030_REG_SW_SHADOW          0x4A
 
-#define TWL4030_CACHEREGNUM    (TWL4030_REG_MISC_SET_2 + 1)
+#define TWL4030_CACHEREGNUM    (TWL4030_REG_SW_SHADOW + 1)
 
 /* Bitfield Definitions */
 
 #define TWL4030_SMOOTH_ANAVOL_EN       0x02
 #define TWL4030_DIGMIC_LR_SWAP_EN      0x01
 
+/* TWL4030_REG_SW_SHADOW (0x4A) Fields */
+#define TWL4030_HFL_EN                 0x01
+#define TWL4030_HFR_EN                 0x02
+
 #define TWL4030_DAI_HIFI               0
 #define TWL4030_DAI_VOICE              1