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>
When not using the "_optional" function, a dummy regulator may be returned
and the driver fails to set voltage.
Change-Id: Ib636572362ece234d6b5694c8832ec01daa274e1
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
When lcdc status changing and ddr frequency changing at the same time,
it may deadlock. Use list_for_each_entry to avoid this bug.
Change-Id: I8074dc60b71650ea1afc300282f90ae8ff1ae97b
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
This adds the necessary data for handling dfi on the rk3128.
Access the dfi via registers provided by GRF (general register
files) module.
Change-Id: Ife9e9987224088434e878102b7d1c3b132e761ad
Signed-off-by: Liang Chen <cl@rock-chips.com>
This adds the necessary data for handling dmcfreq on the rk3128.
Change-Id: I6aeae7103c1eaed0b4515d8d11863c4b190b6918
Signed-off-by: Liang Chen <cl@rock-chips.com>
If two vops are working, one of screens will flicker when change ddr
frequency.
Change-Id: I6e31ac1b7a2bfb0d57ec4507c2da1ee714e59c35
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Auto_min_rate is used to instead of normal_rate, if other sys_status is
exist, use status_rate as min_freq, otherwise use auto_min_rate.
Change-Id: If2df35396ec9e6038f18b173a78ff1a248ab87eb
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
If enable auto-freq, raplace min_freq with status-rate, so the target
rate ranges from status rate to max_freq.
If disabe auto-freq, raplace min_freq and max_freq with statusrate,
so the target rate will be status rate.
Change-Id: Id40c3b859d14fd154735af18e642804fc2895b87
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Because ddr freq scanning may get clk mutex than get drm general
mutex to get lcdc_type. But when drm status change, drm may get drm
general mutex first and than get clk mutex. This may cause deadlock.
So when get lcdc type we change to use drm_modeset mutex to avoid
deadlock.
Change-Id: I64d4c236b682d7bd5bdc95264ff2711ebcec2cad
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
drivers/devfreq/rockchip_dmc.c:665:2-3: Unneeded semicolon
drivers/devfreq/rockchip_dmc.c:676:2-3: Unneeded semicolon
drivers/devfreq/rockchip_dmc.c:686:2-3: Unneeded semicolon
drivers/devfreq/rockchip_dmc.c:697:2-3: Unneeded semicolon
drivers/devfreq/rockchip_dmc.c:707:2-3: Unneeded semicolon
drivers/devfreq/rockchip_dmc.c:766:2-3: Unneeded semicolon
drivers/devfreq/rockchip_dmc.c:776:2-3: Unneeded semicolon
drivers/devfreq/rockchip_dmc.c:1397:2-3: Unneeded semicolon
drivers/devfreq/rockchip_dmc.c:1022:3-4: Unneeded semicolon
drivers/devfreq/rockchip_dmc.c:662:5-11: inconsistent IS_ERR and PTR_ERR on line 664.
drivers/devfreq/rockchip_dmc.c:683:5-11: inconsistent IS_ERR and PTR_ERR on line 685.
drivers/devfreq/rockchip_dmc.c:704:5-11: inconsistent IS_ERR and PTR_ERR on line 706.
drivers/devfreq/rockchip_dmc.c:773:5-11: inconsistent IS_ERR and PTR_ERR on line 775.
Change-Id: I95f2f66649ead3d0c0f59ae713d9272863eb9f63
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
This makes ddr possible to enter auto self-refresh mode
when early suspend.
Change-Id: I0cd214bcb9c8e82aeea3f335a77be21feb356e2d
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
This makes it possible to enter ddr self-refresh mode
when early suspend.
Change-Id: Ib72f391af00674a3c3ab32bbbd4e4a857d3354e8
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This registers a reboot notifier, it will change ddr frequency to a
specified value when reboot system.
This registers a fb notifier, it will change ddr frequency to a specified
value and enable ddr self-reflash mode when early suspend.
This adds a new sysfs node system_status, so that different system status
can change ddr frequency through the node.
Change-Id: Ib5d7d5bd8ee82c29f6f260a3d2ffcb829dde2003
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
1. add unify params for ddr frequency scanning.
2. add dram side and phy side odt disable frequency configurate
independent.
Change-Id: Ied97dbee8d30a1a6e95d4c252986121092c484d8
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
We weren't giving enough time for DMC to change frequencies
when the CPU was running slow.
Change-Id: I84e1a4ad7b5ccddafb0016f3d5d6eef147a58591
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
To protect against races with concurrent CPU online/offline, call
get_online_cpus() before change frequency.
Change-Id: I5b97cd7eff6a1c4828ab30bc165fb2aa8b460bb3
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
It never has the mutex_lock counterpart before goto.
Change-Id: I937e79bc65433cb1c173fe0cb221e7d69586046c
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
It may disable vop_crtc when scaling frequency, in this case,
devfreq thread will wait for vop line flag indefinitely, the
system will crash.
Change-Id: I7043b285c329ff23e2fc9c5b5f3a165c37ef6378
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This adds the necessary data for handling dmcfreq on the rk3288.
Change-Id: I042222f899d03ec1832ac47b48db8c6c46c3b0d3
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
This adds the necessary data for handling dfi on the rk3288.
Access the dfi via registers provided by GRF (general register
files) module.
Change-Id: Ic7241af3c20a269ab362055dea04d260e01c50de
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
As dmc may also assess register PMU_BUS_IDLE_REQ, we should prevent
pd driver and dmc driver assessing this register at the same time.
Change-Id: I546033536c87dcf497774cbc6c8f36a3e651ff07
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
In order to scaling frequency more timely, reduce the polling_ms.
Change-Id: Icbee5552396fa0552fb514d92ea77687228c3e28
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This adds the necessary data for handling dmcfreq on the rk3368.
Change-Id: Ie202cbaa3b27e52b22a5efc57c6e108fbd03a20a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>