There are multiple devfreq events and they may be used simultaneously.
Change-Id: I6f4c8754d3bcf5c20215a0689eb843a8f617b7a6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Make the function rockchip_dmcfreq_probe() clearer.
Change-Id: Ia752b57000be6fb8135a2576e4892fd489130461
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
The 'userspace' governor adds a sysfs entry, which is removed when
the governor is changed, or the devfreq device is released. However,
when the latter occurs via device_unregister(), device_del() is
called first, which removes the sysfs entries recursively and deletes
the kobject.
This means we get an Oops when the governor calls
sysfs_remove_group() on the deleted kobject. Fix this by only doing
the call when kobj *hasn't* been kobject_del()'d.
Note that we can't just remove the call to sysfs_remove_group()
entirely - it's needed for when the governor is changed to one which
doesn't need a sysfs entry.
Change-Id: I2ddad9d062ebb1a64582a15cd5b9efc5882bc848
Signed-off-by: Chris Diamand <chris.diamand@arm.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
(cherry picked from commit 924b9111a1)
Signed-off-by: Liang Chen <cl@rock-chips.com>
When change vop status and ddr frequency at the same time,
the following deadlock will happen:
vop no/off dmcfreq
vop_crtc_disable update_devfreq
->mutex_lock(&vop->vop_lock); ->mutex_lock(&pd->pmu->mutex);
->pm_runtime_put(vop->dev); ->mutex_lock(&vop->vop_lock);
->mutex_lock(&pd->pmu->mutex); ...
Use new dmcfreq rwsem to decouple vop and pd driver, and get better
parallelism.
Change-Id: I56a4ee944200826d2a09e3ae8d2f4837f6f769d6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
It is not necessary to lock/unlock dmcfreq->lock on rockchip_dmcfreq_target.
update_devfreq call target callback with devfreq->lock.
So use rockchip_dmcfreq lock to serializes access to video_info_list only.
Change-Id: I9abd5fa1dfc37740d3fac9983775028dc14b64b5
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
If initial rate is greater than opp rate and initial voltage isn't qeual
to opp volatge, the opp voltage may too low for initial rate, so it's
inappropriate to update voltage when initial voltage isn't qeual to
opp volatge.
In order to solve this problem and consider that the regulator is shared
between several devices on some platforms, make the following two changes.
If the driver doesn't support to change frequency, the opp table should
contain an opp whose rate is geater than or equal to initial rate, so that
the voltage is enough for initial rate and the min_uV and max_uV of
regulator aren't equal to zero after update voltage.
If the driver supports to change frequency, let devfreq framework update
rate and voltage.
Change-Id: I4004f55f2cfd3b87f734844a0cdf8e9619d785d2
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
remove rockchip_pm_register_notify_to_dmc from rockchip_dmc.h
Change-Id: I9e78eaec2a88cfc06ac3d24f01870cd39c9d05ad
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
If dmc node doesn't contain 'system-status-freq' and auto-freq is disabled,
devfreq feature won't be added and only to adjust voltage according to opp
table.
Change-Id: Iaf9d9f61938babff2e08719e2285a8554cfa9389
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Opp rate is used to calc power in thermal framework, so we record
this rate instead of real clock rate.
Devfreq is not ready in target() when use performance governor, so
we need record opp rate in probe().
Change-Id: Iec1918ad5d12124b9f112964f247339e0d50645f
Signed-off-by: Liang Chen <cl@rock-chips.com>
When multiple videos are playback at the same time, video_info_list
may be damaged, so we need protect the list with a muxte_lock.
Change-Id: I7f9ab8d9a9cd29b69550b47d1b35b6645357b0b0
Signed-off-by: Liang Chen <cl@rock-chips.com>
opp rate is used to calc power in thermal framework, so we record this rate
instead of real clock rate.
Change-Id: Ic51a8c36be8d63fcf765e6d49930d1d437a2e502
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
By passing a pointer to struct devfreq, we can fix global data abuse issue.
Change-Id: I17f6264b86549f67d61d03f38da0127e666eee3c
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
Last_status is used to calculate dmc's power in thermal control.
If last_status is neithor inited nor kept updated, the power model will
get the wrong status and then the wrong power. And dmc gets wrong
cooling state at last.
Meanwhile this issue reports the warning "core: dev_pm_opp_get_voltage
: Invalid parameters"
Change-Id: Ic371796ad94fd6dab376fefbea91adff0068d26b
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
use framework internal dynamic power calc function. Do not use
global data, rk_dmcfreq.
Change-Id: I1f46b2471b5d25a9233724fdd61efe63ea13b860
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
When the devfreq cooling device was designed, it was an oversight not to
pass a pointer to the struct devfreq as the first parameters of the
callbacks. The design patterns of the kernel suggest it for a good
reason.
By passing a pointer to struct devfreq, the driver can register one
function that works with multiple devices. With the current
implementation, a driver that can work with multiple devices has to
create multiple copies of the same function with different parameters so
that each devfreq_cooling_device can use the appropriate one. By
passing a pointer to struct devfreq, the driver can identify which
device it's referring to.
Change-Id: I384bf9aafd2391eccab2ca6a76e4e57f2740aa6b
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Reviewed-by: Punit Agrawal <punit.agrawal@arm.com>
Reviewed-by: Ørjan Eide <orjan.eide@arm.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 3aa5374376)
Some chips need adjust opp level by different chip-process, add
common functions to select opp level from device-tree, so modules
can select opp level easy.
Change-Id: Ifbd5f720e6a52a68f13697bbb37ac01ff4a87e3e
Signed-off-by: Liang Chen <cl@rock-chips.com>
This adds the necessary data for handling dmcfreq on the rk3328
Change-Id: If4cff5cc372f80b6776a7272a1bff54abef2cf33
Signed-off-by: CanYang He <hcy@rock-chips.com>
This adds the necessary data for handling dfi on the rk3328.
Change-Id: Id870f78dad3ddd6cb5771674a4e8905322f9e8ef
Signed-off-by: CanYang He <hcy@rock-chips.com>
after modify, rockchip_dfi_ops can apply to other platform use such
version ddr monitor. regardless of channel count, only one channel
of rk3288,rk3399,rk3328 can work. and regardless of monitor clk,
some platform like rk3328 monitor clk is always on.
Change-Id: Ia1c02a89116546ded385c5a6a3e36d020d66b7f3
Signed-off-by: CanYang He <hcy@rock-chips.com>
add rockchip_dmc as a cooling device in thermal control
Change-Id: Iefb046a104eb2205f2ef17dd80bb31fd75b42c90
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
This patch adds NoC (Network on Chip) Probe driver which provides
the primitive values to get the performance data. For example, RK3399
has multiple NoC probes to monitor traffic statistics for analyzing
the transaction flow.
Change-Id: I66f6708f0d244488ca08f0f1f1cb36b19c7a2d0a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
drivers/devfreq/rockchip_dmc.c: In function 'rk3368_dmc_init':
drivers/devfreq/rockchip_dmc.c:649:7: warning: 'ret' may be used uninitialized in this function [-Wuninitialized]
drivers/devfreq/rockchip_dmc.c:639:6: note: 'ret' was declared here
Change-Id: I843b7a4a0804bcf02152ba3218dcefa26d047c95
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
When DRAM frequency greater than or equal to this setting value,
the function of auto power-down will disable.
Change-Id: I0c7faee045ff00de0dc36adc45e21389c41aa81f
Signed-off-by: YouMin Chen <cym@rock-chips.com>
The dmc driver supports changing min_freq and max_freq according to
system status and vop bandwidth at present. But even if user changes
governor to userspace, the ddr frequency may also change constantly.
This patch adds a new dmc_ondemand governor which doesn't chang min_freq
and max_freq, it can also support changing ddr frequecy based on usage,
system status and vop bandwidth. So users can set their own frequency by
the userspace governor.
Change-Id: Ib731f29a6ded3b7f05e60cbae4f858e6beeac9da
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
There is a frequency map table between vop bandwidth and dmc, when vop
bandwidth is changed, the dmc frequency will also be changed to specified
frequency.
If new request frequency is greater than old request frequency, update dmc
target frequency immediately. If new request frequency is less than old
request frequency, only update min_freq and max_freq.
Change-Id: Ib5bf098faf5ffa72e60c34aa686431352420e69b
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>