From: Finley Xiao Date: Mon, 28 Nov 2016 11:44:36 +0000 (+0800) Subject: devfreq: rockchip: dmc: support sharing regulator with other devices X-Git-Tag: firefly_0821_release~1204 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=55d7dcc796ab182555d4ad3b4eb91a611fb1400f;p=firefly-linux-kernel-4.4.55.git devfreq: rockchip: dmc: support sharing regulator with other devices If the regulator is shared between several devices then the lowest request voltage that meets the system constraints will be used. Change-Id: I9645f3f81004c7203769a92367513d9d177504b2 Signed-off-by: Finley Xiao --- diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c index c178b808ca80..9020bd3406ad 100644 --- a/drivers/devfreq/rk3399_dmc.c +++ b/drivers/devfreq/rk3399_dmc.c @@ -111,7 +111,7 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq, if (dmcfreq->volt == target_volt) return 0; err = regulator_set_voltage(dmcfreq->vdd_center, target_volt, - target_volt); + INT_MAX); if (err) { dev_err(dev, "Cannot to set voltage %lu uV\n", target_volt); @@ -128,7 +128,7 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq, */ if (old_clk_rate < target_rate) { err = regulator_set_voltage(dmcfreq->vdd_center, target_volt, - target_volt); + INT_MAX); if (err) { dev_err(dev, "Cannot to set voltage %lu uV\n", target_volt); @@ -141,7 +141,7 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq, dev_err(dev, "Cannot to set frequency %lu (%d)\n", target_rate, err); regulator_set_voltage(dmcfreq->vdd_center, dmcfreq->volt, - dmcfreq->volt); + INT_MAX); goto out; } @@ -158,11 +158,11 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq, dev_err(dev, "Get wrong ddr frequency, Request frequency %lu,\ Current frequency %lu\n", target_rate, dmcfreq->rate); regulator_set_voltage(dmcfreq->vdd_center, dmcfreq->volt, - dmcfreq->volt); + INT_MAX); goto out; } else if (old_clk_rate > target_rate) { err = regulator_set_voltage(dmcfreq->vdd_center, target_volt, - target_volt); + INT_MAX); if (err) { dev_err(dev, "Cannot to set vol %lu uV\n", target_volt); goto out;