From 33b50b0bf4e501a81605c4351ff163d82c87e0d1 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Fri, 22 Jun 2012 12:12:38 +0530 Subject: regulator: tps80031: support for min voltage tolerance Sometimes the system allow to run in less than requested minimum voltage and if this tolerance allow the regulator to set voltage in lower side range than this saves the power. For the example, if client request vmin = 975mV for regulator voltage then it sets the voltage to 987.5mv as the nearest to this desired value. The next lower side for the voltage is 974.8mv. So if system runs on tolerance of 1mv and if it request for 975mv then driver can look for minimum voltage as 975 - tolerance(1) = 974mv and possible configure 974.8mv rather than 987.5mV and so it can save the power equivalent to 12.5mV higher voltage. Support the configuration of tolerance value. Change-Id: Ic8312bb397c2615a3ee0f84072ec394e513525ea Signed-off-by: Laxman Dewangan Reviewed-on: http://git-master/r/110523 Reviewed-by: Rohan Somvanshi Tested-by: Rohan Somvanshi --- drivers/regulator/tps80031-regulator.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/regulator') diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c index 4b1df3613f56..efc608c936ea 100644 --- a/drivers/regulator/tps80031-regulator.c +++ b/drivers/regulator/tps80031-regulator.c @@ -100,6 +100,7 @@ struct tps80031_regulator { /* chip constraints on regulator behavior */ u16 min_mV; u16 max_mV; + unsigned int tolerance_uv; /* regulator specific turn-on delay */ int delay; @@ -296,6 +297,8 @@ static int __tps80031_dcdc_set_voltage(struct device *parent, int vsel = 0; int ret; + min_uV = min_uV - ri->tolerance_uv; + switch (ri->flags) { case 0: if (min_uV == 0) @@ -1025,6 +1028,7 @@ static int __devinit tps80031_regulator_probe(struct platform_device *pdev) ri->dev = &pdev->dev; if (tps_pdata->delay_us > 0) ri->delay = tps_pdata->delay_us; + ri->tolerance_uv = tps_pdata->tolerance_uv; check_smps_mode_mult(pdev->dev.parent, ri); ri->platform_flags = tps_pdata->flags; -- cgit v1.2.3