aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/lp872x.c
diff options
context:
space:
mode:
authorKim, Milo <Milo.Kim@ti.com>2012-09-05 00:39:16 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-09-05 19:53:02 -0400
commitb158fba605bf4f1c97af338dfab64c85c4937513 (patch)
treea22c8091b4032bbc3047b53c4cc3b615d349406f /drivers/regulator/lp872x.c
parent9ffaa8689ea71ad74075dfd2a7520e6b48ecd910 (diff)
regulator: lp872x: set the default DVS mode
The lp872x driver has the DVS platform data which select the register address of the BUCK voltage. This patch enables updating the default DVS mode when the DVS platform data is not defined. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/lp872x.c')
-rw-r--r--drivers/regulator/lp872x.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
index ddd60c6b27ea..d86b6a3e750d 100644
--- a/drivers/regulator/lp872x.c
+++ b/drivers/regulator/lp872x.c
@@ -86,6 +86,10 @@
86#define EXTERN_DVS_USED 0 86#define EXTERN_DVS_USED 0
87#define MAX_DELAY 6 87#define MAX_DELAY 6
88 88
89/* Default DVS Mode */
90#define LP8720_DEFAULT_DVS 0
91#define LP8725_DEFAULT_DVS BIT(2)
92
89/* dump registers in regmap-debugfs */ 93/* dump registers in regmap-debugfs */
90#define MAX_REGISTERS 0x0F 94#define MAX_REGISTERS 0x0F
91 95
@@ -750,8 +754,13 @@ static int lp872x_check_dvs_validity(struct lp872x *lp)
750static int lp872x_init_dvs(struct lp872x *lp) 754static int lp872x_init_dvs(struct lp872x *lp)
751{ 755{
752 int ret, gpio; 756 int ret, gpio;
753 struct lp872x_dvs *dvs = lp->pdata->dvs; 757 struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs : NULL;
754 enum lp872x_dvs_state pinstate; 758 enum lp872x_dvs_state pinstate;
759 u8 mask[] = { LP8720_EXT_DVS_M, LP8725_DVS1_M | LP8725_DVS2_M };
760 u8 default_dvs_mode[] = { LP8720_DEFAULT_DVS, LP8725_DEFAULT_DVS };
761
762 if (!dvs)
763 goto set_default_dvs_mode;
755 764
756 ret = lp872x_check_dvs_validity(lp); 765 ret = lp872x_check_dvs_validity(lp);
757 if (ret) { 766 if (ret) {
@@ -776,6 +785,10 @@ static int lp872x_init_dvs(struct lp872x *lp)
776 lp->dvs_gpio = gpio; 785 lp->dvs_gpio = gpio;
777 786
778 return 0; 787 return 0;
788
789set_default_dvs_mode:
790 return lp872x_update_bits(lp, LP872X_GENERAL_CFG, mask[lp->chipid],
791 default_dvs_mode[lp->chipid]);
779} 792}
780 793
781static int lp872x_config(struct lp872x *lp) 794static int lp872x_config(struct lp872x *lp)