From 716dd4d54e7c8d0bf6caff48dca9fee9dc7e7804 Mon Sep 17 00:00:00 2001 From: Finley Xiao Date: Tue, 8 May 2018 09:11:34 +0800 Subject: [PATCH] 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 --- drivers/video/rockchip/vcodec/vcodec_service.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/video/rockchip/vcodec/vcodec_service.c b/drivers/video/rockchip/vcodec/vcodec_service.c index abb522ac4ad8..3036bdc0ab79 100644 --- a/drivers/video/rockchip/vcodec/vcodec_service.c +++ b/drivers/video/rockchip/vcodec/vcodec_service.c @@ -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)