Commit Graph

228 Commits

Author SHA1 Message Date
Finley Xiao
badb3e30ad PM / devfreq: rockchip_dmc: Add support to get multiple events data
There are multiple devfreq events and they may be used simultaneously.

Change-Id: I6f4c8754d3bcf5c20215a0689eb843a8f617b7a6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-13 20:13:57 +08:00
Finley Xiao
6e33c42767 PM / devfreq: rockchip_dmc: Optimize function rockchip_dmcfreq_probe()
Make the function rockchip_dmcfreq_probe() clearer.

Change-Id: Ia752b57000be6fb8135a2576e4892fd489130461
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-08-13 20:11:30 +08:00
Tang Yun ping
90efddf9eb PM / devfreq: rockchip_dmc: add rk322x dfs init code
Change-Id: I5d81d19286dda9ddd096e648ec59370389c296e1
Signed-off-by: Tang Yun ping <typ@rock-chips.com>
2018-07-31 15:17:16 +08:00
Chris Diamand
981d6435af UPSTREAM: PM / devfreq: Don't delete sysfs group twice
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>
2018-07-10 16:40:19 +08:00
Finley Xiao
e4d2ea0c55 PM / devfreq: rockchip_dmc: Add wide-temperature control
Change-Id: Ia90494728679287fb505c1ee0ddffaa9a52bf0cb
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-07-06 19:40:25 +08:00
Finley Xiao
71e634507f soc: rockchip: opp_select: Add support to adjust power scale
Change-Id: I2358d75c2fdada7cfe385e85d2106370f9aa5ea3
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-06-01 16:58:27 +08:00
Finley Xiao
3c460646d5 PM / devfreq: rockchip_bus: Add support for rk3288, rk3368 and rk3399
Change-Id: I920e220b406f9cfa8d34359465fed4683e3a4eae
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-05-31 14:17:29 +08:00
Finley Xiao
9c4e21b035 PM / devfreq: rockchip_bus: Add clkfreq and cpufreq policy
Change-Id: Ibba74a5d6bc4326155b628c8d4238fed93c44b14
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-05-31 14:17:29 +08:00
Liang Chen
e5a5cff62f PM / devfreq: rockchip: adjust opp-table by pvtm for dmc and gpu
Change-Id: Iec80dc04ddedbfe747dd7a9ff45e0b1a111728ac
Signed-off-by: Liang Chen <cl@rock-chips.com>
2018-05-22 09:45:43 +08:00
Tao Huang
c95036feef PM / devfreq: rockchip_dmc: Fix deadlock between dmcfreq and vop on/off
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>
2018-05-17 11:43:55 +08:00
Tao Huang
e1bcb0e4eb PM / devfreq: rockchip_dmc: no lock dmcfreq->lock on rockchip_dmcfreq_target
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>
2018-05-17 09:56:53 +08:00
Tao Huang
3bf64cbe1e PM / devfreq: rockchip_dmc: build depends on CPU config
Also fixed minor CodingStyle errors.

Change-Id: I46b9638d095aca8df73a8390638b5ce6d801b5fa
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-05-15 18:19:31 +08:00
Finley Xiao
211ccb244c PM / devfreq: rockchip_dmc: Fix low voltage when probe
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>
2018-05-09 09:25:00 +08:00
Tao Huang
ab0d877240 PM / devfreq: rockchip_dmc: include pm_domains.h
remove rockchip_pm_register_notify_to_dmc from rockchip_dmc.h

Change-Id: I9e78eaec2a88cfc06ac3d24f01870cd39c9d05ad
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-05-08 17:18:43 +08:00
Finley Xiao
61c7457667 PM / devfreq: rockchip_dmc: Restore cpu frequency only when it has been changed
Change-Id: Ie845185b62f2b2e38766dab96d396d5dcbe4231f
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-05-08 15:52:23 +08:00
Tao Huang
57da81b29f PM / devfreq: rockchip_dmc: make rockchip_find_video_info static
Change-Id: I13eb60038410592dc1eab14cf3db8f30d01fc56b
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-05-04 20:11:48 +08:00
Tony Xie
b66148ef0d PM / devfreq: rockchip_bus: support soc bus devfreq.
Change-Id: Iba750d4522b99e88c16c8e4a77d3367fbb2a0d82
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2018-05-03 19:53:43 +08:00
Finley Xiao
09b5dcfc98 PM / devfreq: rockchip_dmc: Limit rate when system_status is isp
Change-Id: Ia3ebe8210522d7d06854eea14094ba45b8e62a8b
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-28 16:51:52 +08:00
Tony Xie
4487c33172 PM / devfreq: rockchip_dmc: Adjust struct rockchip_dmcfreq in suspend.
Change-Id: If9761fe64d7edef6e218dee591f523679e154199
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2018-04-26 16:44:58 +08:00
Finley Xiao
e37dce72a0 PM / devfreq: rockchip_dmc: Update cpu dma latency when change frequency
Change-Id: Ia063ce7da2f68ffac4068f4f8136acf178a28918
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: YouMin Chen <cym@rock-chips.com>
2018-04-26 16:44:24 +08:00
Tony Xie
5c1ca8c14c PM / devfreq: rockchip_dmc: support wait_complete.
Change-Id: Ie3f173f632068f261b84a204bbd36b26b10e1981
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Signed-off-by: YouMin Chen <cym@rock-chips.com>
2018-04-26 16:44:24 +08:00
Finley Xiao
b63f27bbc9 PM / devfreq: rockchip_dmc: Add support for rk3308
Change-Id: Iff7deff76a02360021aacaeaa0d509593f88fb2d
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-18 17:22:03 +08:00
Finley Xiao
7eedb273de PM / devfreq: rockchip_dmc: Adjust voltage according to opp table when probe
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>
2018-04-18 17:22:03 +08:00
Finley Xiao
aec15a24a8 PM / devfreq: rockchip_dmc: Add touch boost support
Change-Id: I873891c79a75271ddb57cf8dcc25cf882d7c1126
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-04-02 14:58:40 +08:00
Liang Chen
1641eb4fc2 PM / devfreq: adjust opp-table by board IR-Drop
Change-Id: I94280b3f4a122961c0201cf9f8fbf5dc34058581
Signed-off-by: Liang Chen <cl@rock-chips.com>
2018-03-16 17:49:29 +08:00
Tao Huang
3430c68a33 Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux-linaro-stable.git
* linux-linaro-lsk-v4.4-android: (660 commits)
  ANDROID: keychord: Check for write data size
  ANDROID: sdcardfs: Set num in extension_details during make_item
  ANDROID: sdcardfs: Hold i_mutex for i_size_write
  BACKPORT, FROMGIT: crypto: speck - add test vectors for Speck64-XTS
  BACKPORT, FROMGIT: crypto: speck - add test vectors for Speck128-XTS
  BACKPORT, FROMGIT: crypto: arm/speck - add NEON-accelerated implementation of Speck-XTS
  FROMGIT: crypto: speck - export common helpers
  BACKPORT, FROMGIT: crypto: speck - add support for the Speck block cipher
  UPSTREAM: ANDROID: binder: synchronize_rcu() when using POLLFREE.
  f2fs: updates on v4.16-rc1
  BACKPORT: tee: shm: Potential NULL dereference calling tee_shm_register()
  BACKPORT: tee: shm: don't put_page on null shm->pages
  BACKPORT: tee: shm: make function __tee_shm_alloc static
  BACKPORT: tee: optee: check type of registered shared memory
  BACKPORT: tee: add start argument to shm_register callback
  BACKPORT: tee: optee: fix header dependencies
  BACKPORT: tee: shm: inline tee_shm_get_id()
  BACKPORT: tee: use reference counting for tee_context
  BACKPORT: tee: optee: enable dynamic SHM support
  BACKPORT: tee: optee: add optee-specific shared pool implementation
  ...

Conflicts:
	drivers/irqchip/Kconfig
	drivers/media/i2c/tc35874x.c
	drivers/media/v4l2-core/v4l2-compat-ioctl32.c
	drivers/usb/gadget/function/f_fs.c
	fs/f2fs/node.c

Change-Id: Icecd73a515821b536fa3d81ea91b63d9b3699916
2018-03-09 19:10:14 +08:00
Liang Chen
3efb6d37bd PM / devfreq: record opp rate instead of real clock rate for thermal
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>
2018-03-08 15:08:36 +08:00
Liang Chen
385761959c PM / devfreq: rockchip_dmc: protect video_info_list with mutex
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>
2018-02-28 09:36:02 +08:00
Bjorn Andersson
8bb3fe364f PM / devfreq: Propagate error from devfreq_add_device()
commit d1bf2d3072 upstream.

Propagate the error of devfreq_add_device() in devm_devfreq_add_device()
rather than statically returning ENOMEM. This makes it slightly faster
to pinpoint the cause of a returned error.

Fixes: 8cd84092d3 ("PM / devfreq: Add resource-managed function for devfreq device")
Cc: stable@vger.kernel.org
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:44:58 +01:00
YouMin Chen
3f9d4749de PM / devfreq: event: add support for px30 dfi
Change-Id: Ib6808d961b65d993fea05ab15d648d814d14a4a2
Signed-off-by: YouMin Chen <cym@rock-chips.com>
2018-02-08 14:53:27 +08:00
YouMin Chen
8865f61ad2 PM / devfreq: rockchip_dmc: add support for px30
Change-Id: I225088ce179f9b9cd62fce256b87bccb591fd2b2
Signed-off-by: YouMin Chen <cym@rock-chips.com>
2018-02-08 14:52:32 +08:00
Rocky Hao
f417571488 PM / devfreq: rockchip_dmc: record opp rate instead of real clock rate
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>
2018-02-08 09:47:01 +08:00
Finley Xiao
3aa3d78ce1 PM / devfreq: rockchip_dmc: Disable auto-freq if events is disabled
Change-Id: Ia39dfc884feea8cb6c29a7ed293bb567aca15b83
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-02-08 09:46:14 +08:00
Liang Chen
f06ee6308f PM / devfreq: rockchip_dmc: add support for rk3228
Change-Id: I3943716a66b3c0849d815b7f69cc0bbd843d7e4e
Signed-off-by: Liang Chen <cl@rock-chips.com>
2018-02-08 09:37:30 +08:00
Rocky Hao
33b1e41afd PM / devfreq: rockchip_dmc: pass a pointer to devfreq in bandwidth request/update actions
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>
2018-01-23 14:18:50 +08:00
Rocky Hao
0ea4217387 PM / devfreq: rockchip_dmc: init and update last_status
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>
2018-01-12 19:17:11 +08:00
Rocky Hao
5172573fa1 PM / devfreq: rockchip_dmc: optimize thermal control code
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>
2018-01-12 14:30:19 +08:00
CanYang He
96312b689d PM / devfreq: rockchip_dmc: fix rk3328 of_get_ddr_timings fail
because of_parse_phandle() phandle_name parameter incorrect

Change-Id: Ic1b2cf7b1a7331aff52102a863e97a937677f2ae
Signed-off-by: CanYang He <hcy@rock-chips.com>
2018-01-08 21:01:19 +08:00
Javi Merino
5dcb4226bb BACKPORT: devfreq_cooling: pass a pointer to devfreq in the power model callbacks
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)
2018-01-04 09:22:34 +08:00
Liang Chen
17efab953d soc: rockchip: add functions to select opp level form device-tree
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>
2018-01-02 10:21:39 +08:00
Hecanyang
4807c45f72 PM / devfreq: rockchip_dmc: add support for rk3328
This adds the necessary data for handling dmcfreq on the rk3328

Change-Id: If4cff5cc372f80b6776a7272a1bff54abef2cf33
Signed-off-by: CanYang He <hcy@rock-chips.com>
2017-12-28 08:48:54 +08:00
Hecanyang
3397fb4994 PM / devfreq: event: add support for rk3328 dfi
This adds the necessary data for handling dfi on the rk3328.

Change-Id: Id870f78dad3ddd6cb5771674a4e8905322f9e8ef
Signed-off-by: CanYang He <hcy@rock-chips.com>
2017-12-28 08:48:23 +08:00
Hecanyang
3943bc44aa PM / devfreq: event: make dfi more extension
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>
2017-12-28 08:47:43 +08:00
Rocky Hao
e422847701 PM / devfreq: rockchip_dmc: add thermal control support
add rockchip_dmc as a cooling device in thermal control

Change-Id: Iefb046a104eb2205f2ef17dd80bb31fd75b42c90
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
2017-12-26 19:46:01 +08:00
Finley Xiao
ccfeccfe22 PM / devfreq: event: Add new Rockchip NoC probe driver
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>
2017-11-21 20:24:57 +08:00
Wyon Bi
c9d26e763b PM / devfreq: rockchip_dmc: Fix compiler warning
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>
2017-10-18 14:32:48 +08:00
YouMin Chen
b9d770c7de PM / devfreq: rockchip_dmc: add auto_lp_dis_freq to rk3399 dram timing table
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>
2017-09-20 11:31:08 +08:00
YouMin Chen
4625e95606 PM / devfreq: rockchip_dmc: modify rk3399 dram default timing
Change-Id: I1af3177d78240c0767a4a71f4f085b55b2d7a2c6
Signed-off-by: YouMin Chen <cym@rock-chips.com>
2017-09-20 11:30:58 +08:00
Finley Xiao
f6c39e35ad PM / devfreq: rockchip_dmc: Add dmc_ondemand governor
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>
2017-09-20 09:42:56 +08:00
Finley Xiao
9836687630 PM / devfreq: rockchip_dmc: Allow to change frequency according to vop BW
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>
2017-09-20 09:42:23 +08:00