aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYadwinder Singh Brar <yadi.brar@samsung.com>2013-06-24 07:20:56 -0400
committerMark Brown <broonie@linaro.org>2013-07-15 06:28:25 -0400
commit1e1598ed04d831f5bb42a197b4045e6780365217 (patch)
tree9463fea126c28024e09c6c5af276f254fb3a13df
parentad81f0545ef01ea651886dddac4bef6cec930092 (diff)
regulator: s2mps11: Implement set_voltage_time_sel() ops for bucks
Currently driver uses local struct s2mps11_info to store ramp rate for bucks whic its getting through platform data, so instead of using regulator constraints it should use s2mps11_info to calculate ramp delay. Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/regulator/s2mps11.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 2f62564ca936..a671eb63a4e5 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -53,6 +53,57 @@ static int get_ramp_delay(int ramp_delay)
53 return cnt; 53 return cnt;
54} 54}
55 55
56static int s2mps11_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
57 unsigned int old_selector,
58 unsigned int new_selector)
59{
60 struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
61 unsigned int ramp_delay = 0;
62 int old_volt, new_volt;
63
64 switch (rdev->desc->id) {
65 case S2MPS11_BUCK2:
66 if (!s2mps11->buck2_ramp)
67 return 0;
68 ramp_delay = s2mps11->ramp_delay2;
69 break;
70 case S2MPS11_BUCK3:
71 if (!s2mps11->buck3_ramp)
72 return 0;
73 ramp_delay = s2mps11->ramp_delay34;
74 break;
75 case S2MPS11_BUCK4:
76 if (!s2mps11->buck4_ramp)
77 return 0;
78 ramp_delay = s2mps11->ramp_delay34;
79 break;
80 case S2MPS11_BUCK5:
81 ramp_delay = s2mps11->ramp_delay5;
82 break;
83 case S2MPS11_BUCK6:
84 if (!s2mps11->buck6_ramp)
85 return 0;
86 case S2MPS11_BUCK1:
87 ramp_delay = s2mps11->ramp_delay16;
88 break;
89 case S2MPS11_BUCK7:
90 case S2MPS11_BUCK8:
91 case S2MPS11_BUCK10:
92 ramp_delay = s2mps11->ramp_delay7810;
93 break;
94 case S2MPS11_BUCK9:
95 ramp_delay = s2mps11->ramp_delay9;
96 }
97
98 if (ramp_delay == 0)
99 ramp_delay = rdev->desc->ramp_delay;
100
101 old_volt = rdev->desc->min_uV + (rdev->desc->uV_step * old_selector);
102 new_volt = rdev->desc->min_uV + (rdev->desc->uV_step * new_selector);
103
104 return DIV_ROUND_UP(abs(new_volt - old_volt), ramp_delay);
105}
106
56static struct regulator_ops s2mps11_ldo_ops = { 107static struct regulator_ops s2mps11_ldo_ops = {
57 .list_voltage = regulator_list_voltage_linear, 108 .list_voltage = regulator_list_voltage_linear,
58 .map_voltage = regulator_map_voltage_linear, 109 .map_voltage = regulator_map_voltage_linear,
@@ -72,7 +123,7 @@ static struct regulator_ops s2mps11_buck_ops = {
72 .disable = regulator_disable_regmap, 123 .disable = regulator_disable_regmap,
73 .get_voltage_sel = regulator_get_voltage_sel_regmap, 124 .get_voltage_sel = regulator_get_voltage_sel_regmap,
74 .set_voltage_sel = regulator_set_voltage_sel_regmap, 125 .set_voltage_sel = regulator_set_voltage_sel_regmap,
75 .set_voltage_time_sel = regulator_set_voltage_time_sel, 126 .set_voltage_time_sel = s2mps11_regulator_set_voltage_time_sel,
76}; 127};
77 128
78#define regulator_desc_ldo1(num) { \ 129#define regulator_desc_ldo1(num) { \