OSDN Git Service

ASoC: wcd9335: Update the Lineout path register configuration
authorBhalchandra Gajare <gajare@codeaurora.org>
Tue, 5 Jan 2016 03:23:54 +0000 (19:23 -0800)
committerGerrit - the friendly Code Review server <code-review@localhost>
Mon, 8 Aug 2016 20:31:18 +0000 (13:31 -0700)
Update codec driver register configuration for all the Lineout paths on
codec. The register configurations are updated for Lineout mono and
stereo configuration.

CRs-fixed: 997556
Change-Id: I7a09aeb2a02c30fb851ef21dcaad194413f17955
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: Stephen Oglesby <soglesby@codeaurora.org>
include/uapi/linux/mfd/wcd9xxx/wcd9xxx_registers.h
sound/soc/codecs/wcd9335.c
sound/soc/codecs/wcd9xxx-common-v2.c

index 8a3f41a..a9fe10d 100644 (file)
 #define WCD9XXX_A_ANA_HPH                              (0x609)
 #define WCD9XXX_A_CDC_CLSH_CRC                         (0xC01)
 #define WCD9XXX_FLYBACK_EN                             (0x6A4)
+#define WCD9XXX_FLYBACK_VNEG_CTRL_1                    (0x6A5)
+#define WCD9XXX_FLYBACK_VNEGDAC_CTRL_2                 (0x6AF)
 #define WCD9XXX_RX_BIAS_FLYB_BUFF                      (0x6C7)
 #define WCD9XXX_HPH_L_EN                               (0x6D3)
 #define WCD9XXX_HPH_R_EN                               (0x6D6)
index 4c3ca7d..d984c8f 100755 (executable)
@@ -11922,6 +11922,12 @@ static const struct tasha_reg_mask_val tasha_codec_reg_init_val_2_0[] = {
        {WCD9335_CDC_RX0_RX_PATH_SEC0, 0xFC, 0xF4},
        {WCD9335_HPH_REFBUFF_LP_CTL, 0x08, 0x08},
        {WCD9335_HPH_REFBUFF_LP_CTL, 0x06, 0x02},
+       {WCD9335_DIFF_LO_CORE_OUT_PROG, 0xFC, 0xA0},
+       {WCD9335_SE_LO_COM1, 0xFF, 0xC0},
+       {WCD9335_CDC_RX3_RX_PATH_SEC0, 0xFC, 0xF4},
+       {WCD9335_CDC_RX4_RX_PATH_SEC0, 0xFC, 0xF4},
+       {WCD9335_CDC_RX5_RX_PATH_SEC0, 0xFC, 0xF8},
+       {WCD9335_CDC_RX6_RX_PATH_SEC0, 0xFC, 0xF8},
 };
 
 static const struct tasha_reg_mask_val tasha_codec_reg_defaults[] = {
@@ -11956,7 +11962,6 @@ static const struct tasha_reg_mask_val tasha_codec_reg_init_common_val[] = {
        {WCD9335_CDC_RX8_RX_PATH_CFG1, 0x08, 0x08},
        {WCD9335_ANA_LO_1_2, 0x3C, 0X3C},
        {WCD9335_DIFF_LO_COM_SWCAP_REFBUF_FREQ, 0x70, 0x00},
-       {WCD9335_DIFF_LO_COM_PA_FREQ, 0x70, 0x40},
        {WCD9335_SOC_MAD_AUDIO_CTL_2, 0x03, 0x03},
        {WCD9335_CDC_TOP_TOP_CFG1, 0x02, 0x02},
        {WCD9335_CDC_TOP_TOP_CFG1, 0x01, 0x01},
@@ -12050,6 +12055,7 @@ static const struct tasha_reg_mask_val tasha_codec_reg_init_1_x_val[] = {
        {WCD9335_DIFF_LO_CORE_OUT_PROG, 0xFC, 0xD8},
        {WCD9335_CDC_RX5_RX_PATH_SEC3, 0xBD, 0xBD},
        {WCD9335_CDC_RX6_RX_PATH_SEC3, 0xBD, 0xBD},
+       {WCD9335_DIFF_LO_COM_PA_FREQ, 0x70, 0x40},
 };
 
 static void tasha_update_reg_reset_values(struct snd_soc_codec *codec)
index 8da04e5..6159222 100644 (file)
@@ -490,6 +490,22 @@ static void wcd_clsh_set_hph_mode(struct snd_soc_codec *codec,
        }
 }
 
+static void wcd_clsh_set_flyback_vneg_ctl(struct snd_soc_codec *codec,
+                                         bool enable)
+{
+       if (enable) {
+               snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEG_CTRL_1, 0xE0,
+                                   0x00);
+               snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEGDAC_CTRL_2,
+                                   0xE0, (0x07 << 5));
+       } else {
+               snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEG_CTRL_1, 0xE0,
+                                   (0x07 << 5));
+               snd_soc_update_bits(codec, WCD9XXX_FLYBACK_VNEGDAC_CTRL_2,
+                                   0xE0, (0x02 << 5));
+       }
+}
+
 static void wcd_clsh_set_flyback_current(struct snd_soc_codec *codec, int mode)
 {
        struct wcd9xxx *wcd9xxx = dev_get_drvdata(codec->dev->parent);
@@ -525,6 +541,7 @@ static void wcd_clsh_state_lo(struct snd_soc_codec *codec,
 
        if (is_enable) {
                wcd_clsh_set_buck_regulator_mode(codec, mode);
+               wcd_clsh_set_flyback_vneg_ctl(codec, true);
                wcd_clsh_set_buck_mode(codec, mode);
                wcd_clsh_set_flyback_mode(codec, mode);
                wcd_clsh_flyback_ctrl(codec, clsh_d, mode, true);
@@ -535,6 +552,7 @@ static void wcd_clsh_state_lo(struct snd_soc_codec *codec,
                wcd_clsh_flyback_ctrl(codec, clsh_d, mode, false);
                wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
                wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
+               wcd_clsh_set_flyback_vneg_ctl(codec, false);
                wcd_clsh_set_buck_regulator_mode(codec, CLS_H_NORMAL);
        }
 }
@@ -714,6 +732,7 @@ static void wcd_clsh_state_hph_lo(struct snd_soc_codec *codec,
                                                WCD9XXX_A_CDC_CLSH_K1_LSB,
                                                0xFF, 0xC0);
                                wcd_clsh_set_flyback_mode(codec, mode);
+                               wcd_clsh_set_flyback_vneg_ctl(codec, false);
                                wcd_clsh_set_buck_mode(codec, mode);
                                wcd_clsh_set_hph_mode(codec, mode);
                                wcd_clsh_set_gain_path(codec, mode);
@@ -749,6 +768,7 @@ static void wcd_clsh_state_hph_lo(struct snd_soc_codec *codec,
                        if ((clsh_d->state & WCD_CLSH_STATE_HPH_ST)
                                != WCD_CLSH_STATE_HPH_ST) {
                                wcd_enable_clsh_block(codec, clsh_d, false);
+                               wcd_clsh_set_flyback_vneg_ctl(codec, true);
                                wcd_clsh_set_flyback_mode(codec, CLS_H_NORMAL);
                                wcd_clsh_set_buck_mode(codec, CLS_H_NORMAL);
                        }