Loading drivers/mfd/wcd934x-regmap.c +43 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,18 @@ #include <linux/device.h> #include "wcd9xxx-regmap.h" static const struct reg_sequence wcd934x_1_1_defaults[] = { { WCD934X_CHIP_TIER_CTRL_CHIP_ID_BYTE0, 0x01 }, { WCD934X_BIAS_VBG_FINE_ADJ, 0x75 }, { WCD934X_HPH_REFBUFF_LP_CTL, 0x0E }, { WCD934X_EAR_DAC_CTL_ATEST, 0x08 }, { WCD934X_SIDO_NEW_VOUT_A_STARTUP, 0x17 }, { WCD934X_HPH_NEW_INT_RDAC_GAIN_CTL, 0x40 }, { WCD934X_HPH_NEW_INT_RDAC_HD2_CTL_L, 0x81 }, { WCD934X_HPH_NEW_INT_RDAC_HD2_CTL_R, 0x81 }, }; static const struct reg_default wcd934x_defaults[] = { { WCD934X_PAGE0_PAGE_REGISTER, 0x00 }, { WCD934X_CODEC_RPM_CLK_BYPASS, 0x00 }, Loading Loading @@ -1803,6 +1815,37 @@ static const struct reg_default wcd934x_defaults[] = { { WCD934X_TEST_DEBUG_CODEC_DIAGS, 0x00 }, }; /* * wcd934x_regmap_register_patch: Update register defaults based on version * @regmap: handle to wcd9xxx regmap * @version: wcd934x version * * Returns error code in case of failure or 0 for success */ int wcd934x_regmap_register_patch(struct regmap *regmap, int revision) { int rc = 0; if (!regmap) { pr_err("%s: regmap struct is NULL\n", __func__); return -EINVAL; } switch (revision) { case TAVIL_VERSION_1_1: case TAVIL_VERSION_WCD9340_1_1: case TAVIL_VERSION_WCD9341_1_1: regcache_cache_only(regmap, true); rc = regmap_multi_reg_write(regmap, wcd934x_1_1_defaults, ARRAY_SIZE(wcd934x_1_1_defaults)); regcache_cache_only(regmap, false); break; } return rc; } EXPORT_SYMBOL(wcd934x_regmap_register_patch); static bool wcd934x_is_readable_register(struct device *dev, unsigned int reg) { u8 pg_num, reg_offset; Loading drivers/mfd/wcd9xxx-regmap.h +7 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ typedef int (*regmap_patch_fptr)(struct regmap *, int); #ifdef CONFIG_WCD934X_CODEC extern struct regmap_config wcd934x_regmap_config; extern int wcd934x_regmap_register_patch(struct regmap *regmap, int version); #endif #ifdef CONFIG_WCD9335_CODEC Loading Loading @@ -70,6 +72,11 @@ static inline regmap_patch_fptr wcd9xxx_get_regmap_reg_patch(int type) case WCD9335: apply_patch = wcd9335_regmap_register_patch; break; #endif #ifdef CONFIG_WCD934X_CODEC case WCD934X: apply_patch = wcd934x_regmap_register_patch; break; #endif default: apply_patch = NULL; Loading include/linux/mfd/wcd934x/registers.h +2 −0 Original line number Diff line number Diff line Loading @@ -800,9 +800,11 @@ enum { #define WCD934X_VBADC_NEW_ADC_DOUTLSB 0x0731 #define WCD934X_HPH_NEW_INT_RDAC_GAIN_CTL 0x0732 #define WCD934X_HPH_NEW_INT_RDAC_HD2_CTL 0x0733 #define WCD934X_HPH_NEW_INT_RDAC_HD2_CTL_L 0x0733 #define WCD934X_HPH_NEW_INT_RDAC_VREF_CTL 0x0734 #define WCD934X_HPH_NEW_INT_RDAC_OVERRIDE_CTL 0x0735 #define WCD934X_HPH_NEW_INT_RDAC_MISC1 0x0736 #define WCD934X_HPH_NEW_INT_RDAC_HD2_CTL_R 0x0736 #define WCD934X_HPH_NEW_INT_PA_MISC1 0x0737 #define WCD934X_HPH_NEW_INT_PA_MISC2 0x0738 #define WCD934X_HPH_NEW_INT_PA_RDAC_MISC 0x0739 Loading sound/soc/codecs/wcd934x/wcd934x.c +6 −0 Original line number Diff line number Diff line Loading @@ -8749,6 +8749,9 @@ static int tavil_swrm_clock(void *handle, bool enable) if (enable) { tavil->swr.clk_users++; if (tavil->swr.clk_users == 1) { regmap_update_bits(tavil->wcd9xxx->regmap, WCD934X_TEST_DEBUG_NPL_DLY_TEST_1, 0x10, 0x00); __tavil_cdc_mclk_enable(tavil, true); regmap_update_bits(tavil->wcd9xxx->regmap, WCD934X_CDC_CLK_RST_CTRL_SWR_CONTROL, Loading @@ -8761,6 +8764,9 @@ static int tavil_swrm_clock(void *handle, bool enable) WCD934X_CDC_CLK_RST_CTRL_SWR_CONTROL, 0x01, 0x00); __tavil_cdc_mclk_enable(tavil, false); regmap_update_bits(tavil->wcd9xxx->regmap, WCD934X_TEST_DEBUG_NPL_DLY_TEST_1, 0x10, 0x10); } } dev_dbg(tavil->dev, "%s: swrm clock users %d\n", Loading Loading
drivers/mfd/wcd934x-regmap.c +43 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,18 @@ #include <linux/device.h> #include "wcd9xxx-regmap.h" static const struct reg_sequence wcd934x_1_1_defaults[] = { { WCD934X_CHIP_TIER_CTRL_CHIP_ID_BYTE0, 0x01 }, { WCD934X_BIAS_VBG_FINE_ADJ, 0x75 }, { WCD934X_HPH_REFBUFF_LP_CTL, 0x0E }, { WCD934X_EAR_DAC_CTL_ATEST, 0x08 }, { WCD934X_SIDO_NEW_VOUT_A_STARTUP, 0x17 }, { WCD934X_HPH_NEW_INT_RDAC_GAIN_CTL, 0x40 }, { WCD934X_HPH_NEW_INT_RDAC_HD2_CTL_L, 0x81 }, { WCD934X_HPH_NEW_INT_RDAC_HD2_CTL_R, 0x81 }, }; static const struct reg_default wcd934x_defaults[] = { { WCD934X_PAGE0_PAGE_REGISTER, 0x00 }, { WCD934X_CODEC_RPM_CLK_BYPASS, 0x00 }, Loading Loading @@ -1803,6 +1815,37 @@ static const struct reg_default wcd934x_defaults[] = { { WCD934X_TEST_DEBUG_CODEC_DIAGS, 0x00 }, }; /* * wcd934x_regmap_register_patch: Update register defaults based on version * @regmap: handle to wcd9xxx regmap * @version: wcd934x version * * Returns error code in case of failure or 0 for success */ int wcd934x_regmap_register_patch(struct regmap *regmap, int revision) { int rc = 0; if (!regmap) { pr_err("%s: regmap struct is NULL\n", __func__); return -EINVAL; } switch (revision) { case TAVIL_VERSION_1_1: case TAVIL_VERSION_WCD9340_1_1: case TAVIL_VERSION_WCD9341_1_1: regcache_cache_only(regmap, true); rc = regmap_multi_reg_write(regmap, wcd934x_1_1_defaults, ARRAY_SIZE(wcd934x_1_1_defaults)); regcache_cache_only(regmap, false); break; } return rc; } EXPORT_SYMBOL(wcd934x_regmap_register_patch); static bool wcd934x_is_readable_register(struct device *dev, unsigned int reg) { u8 pg_num, reg_offset; Loading
drivers/mfd/wcd9xxx-regmap.h +7 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ typedef int (*regmap_patch_fptr)(struct regmap *, int); #ifdef CONFIG_WCD934X_CODEC extern struct regmap_config wcd934x_regmap_config; extern int wcd934x_regmap_register_patch(struct regmap *regmap, int version); #endif #ifdef CONFIG_WCD9335_CODEC Loading Loading @@ -70,6 +72,11 @@ static inline regmap_patch_fptr wcd9xxx_get_regmap_reg_patch(int type) case WCD9335: apply_patch = wcd9335_regmap_register_patch; break; #endif #ifdef CONFIG_WCD934X_CODEC case WCD934X: apply_patch = wcd934x_regmap_register_patch; break; #endif default: apply_patch = NULL; Loading
include/linux/mfd/wcd934x/registers.h +2 −0 Original line number Diff line number Diff line Loading @@ -800,9 +800,11 @@ enum { #define WCD934X_VBADC_NEW_ADC_DOUTLSB 0x0731 #define WCD934X_HPH_NEW_INT_RDAC_GAIN_CTL 0x0732 #define WCD934X_HPH_NEW_INT_RDAC_HD2_CTL 0x0733 #define WCD934X_HPH_NEW_INT_RDAC_HD2_CTL_L 0x0733 #define WCD934X_HPH_NEW_INT_RDAC_VREF_CTL 0x0734 #define WCD934X_HPH_NEW_INT_RDAC_OVERRIDE_CTL 0x0735 #define WCD934X_HPH_NEW_INT_RDAC_MISC1 0x0736 #define WCD934X_HPH_NEW_INT_RDAC_HD2_CTL_R 0x0736 #define WCD934X_HPH_NEW_INT_PA_MISC1 0x0737 #define WCD934X_HPH_NEW_INT_PA_MISC2 0x0738 #define WCD934X_HPH_NEW_INT_PA_RDAC_MISC 0x0739 Loading
sound/soc/codecs/wcd934x/wcd934x.c +6 −0 Original line number Diff line number Diff line Loading @@ -8749,6 +8749,9 @@ static int tavil_swrm_clock(void *handle, bool enable) if (enable) { tavil->swr.clk_users++; if (tavil->swr.clk_users == 1) { regmap_update_bits(tavil->wcd9xxx->regmap, WCD934X_TEST_DEBUG_NPL_DLY_TEST_1, 0x10, 0x00); __tavil_cdc_mclk_enable(tavil, true); regmap_update_bits(tavil->wcd9xxx->regmap, WCD934X_CDC_CLK_RST_CTRL_SWR_CONTROL, Loading @@ -8761,6 +8764,9 @@ static int tavil_swrm_clock(void *handle, bool enable) WCD934X_CDC_CLK_RST_CTRL_SWR_CONTROL, 0x01, 0x00); __tavil_cdc_mclk_enable(tavil, false); regmap_update_bits(tavil->wcd9xxx->regmap, WCD934X_TEST_DEBUG_NPL_DLY_TEST_1, 0x10, 0x10); } } dev_dbg(tavil->dev, "%s: swrm clock users %d\n", Loading