video: rockchip: Ensure that set voltage when update devfreq for the first time

Sometimes the regulator is shared between several devices, if target rate
and target voltage are equal to initial rate and iniital voltage , the
min_uV and max_uV of regulator will be always equal to zero, other devices
may set a low voltage.

Change-Id: I561971844296ffcada823d741710aba808167e3f
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
Finley Xiao
2018-05-08 09:11:34 +08:00
committed by Tao Huang
parent 5d88f40f5a
commit 716dd4d54e

View File

@@ -3104,10 +3104,13 @@ static int devfreq_vcodec_target(struct device *dev, unsigned long *freq,
return ret;
ret = regulator_set_voltage(pservice->vdd_vcodec, target_volt,
INT_MAX);
if (ret)
if (ret) {
dev_err(dev, "Cannot set voltage %lu uV\n",
target_volt);
return ret;
return ret;
}
pservice->volt = target_volt;
return 0;
}
if (old_clk_rate < target_rate) {
@@ -3406,7 +3409,6 @@ static int vcodec_probe(struct platform_device *pdev)
stat = &pservice->devfreq->last_status;
stat->current_frequency = clk_get_rate(pservice->aclk_vcodec);
pservice->volt = regulator_get_voltage(pservice->vdd_vcodec);
ret = devfreq_register_opp_notifier(dev, pservice->devfreq);
if (ret)