Commit Graph

865120 Commits

Author SHA1 Message Date
Yandong Lin
c2de227bfc dt-bindings: video: mpp: add rk3568 codec properties
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I53eed4f4f0d444515dcac4c533baa15c8fba6f32
2021-06-29 18:20:25 +08:00
Yandong Lin
c7a7aa3370 video: rockchip: mpp: Fix 3568 cabac/cavlc switch issue
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ifd54d76470889e4d76d97cd33b2a4af26c7af6ab
2021-06-29 12:03:37 +08:00
Yifeng Zhao
b0868873db mmc: sdhci-of-dwcmshc: rk3568: do not enable DLL while the clock rate less than 52mhz
The DLL may not be able to lock while the clock rate less than 52mhz.

Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Change-Id: Ifacc3da516d78f5f242d8b03a60500a7dfe28993
2021-06-28 14:07:03 +08:00
Tao Huang
6770b766b4 regulator: xz3216: Fix gcc this statement may fall through warning
drivers/regulator/xz3216.c: In function 'xz3216_dcdc_set_suspend_mode':
drivers/regulator/xz3216.c:112:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/regulator/xz3216.c:115:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/regulator/xz3216.c:165:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/regulator/xz3216.c:168:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I4709021a667a5def61361f27a1675099bcb7b45f
2021-06-28 10:37:59 +08:00
Cai YiWei
ff7380d396 media: rockchip: isp: clear rdbk fifo at dmarx stop
Change-Id: If26ebfa218da49d272c1e4aa0a2e8c7e4361ba5f
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
2021-06-25 19:56:17 +08:00
Shunqing Chen
2f3b789905 media: i2c: rk628csi: workround avi packet probabitity error
If read the same value three times,
we think this avi patket is correct.

Signed-off-by: Shunqing Chen <csq@rock-chips.com>
Change-Id: I96154c38a79fe142368a2069175fa58fa2d38b0f
2021-06-25 16:29:58 +08:00
Zhihuan He
3fbe548efa include: linux: rockchip: add share mem page type define
The share mem page type should be corresponded with
smccc call.

Change-Id: I2fc97fc6841e2fd6ed7080d6af2fa2929ae355fb
Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
2021-06-25 09:07:07 +08:00
Cai YiWei
93aa3972ad media: rockchip: fix isp and ispp share dmabuf release fail
Change-Id: I80d34b89c0dd8965baebbc9cd75b0877f5e4ed9d
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
2021-06-24 10:02:34 +08:00
Cliff Chen
ce02e6a41d f2fs: Avoid using empty extent_tree when look up extent cache
If CONFIG_F2FS_CHECK_FS is not enabled, the lookup_extent_tree function will continue to run when
the extent_tree is NULL, causing the kernel to crash. The dump like this:
[05-13 09:41:14][ 3309.526262] Unable to handle kernel NULL pointer dereference at virtual a5ddress 0000000000000040
[05-13 09:41:14][ 3309.715348] Mem abort info:
[05-13 09:41:14][ 3309.715618]   ESR = 0x96000006
[05-13 09:41:14][ 3309.715899]   Exception class = DABT (current EL), IL = 32 bits
[05-13 09:41:14][ 3309.716416]   SET = 0, FnV = 0
[05-13 09:41:14][ 3309.716693]   EA = 0, S1PTW = 0
[05-13 09:41:14][ 3309.717003] Data abort info:
[05-13 09:41:14][ 3309.717260]   ISV = 0, ISS = 0x00000006
[05-13 09:41:14]  0): Mem abort info:
[05-13 09:41:14]05-13 01:40:58.784 F/        (    0): ESR = 0x96000006
[05-13 09:41:14]05-13 01:40:58.784 F/        (    0): Exception class = DABT (current EL), IL = 32 bits
[05-13 09:41:14]05-13 01:40:58.785 F/        (    0): SET = 0, FnV = 0
[05-13 09:41:14]05-13 01:40:58.785 F/        (    0): EA = 0, S1PTW = 0
[05-13 09:41:14]05-13 01:40:58.785 F/        (    0): Data abort info:
[05-13 09:41:14]05-13 01:40:58.785 F/        (    0): ISV = 0, ISS = 0x00000006
[05-13 09:41:14]05-13 01:40:58.792 F/Internal error(    0): Oops: 96000006 [#1] PREEMPT SMP
[05-13 09:41:14][ 3309.726031] Process Binder:382_1 (pid: 396, stack limit = 0x00000000b36c00c5)
[05-13 09:41:14][ 3309.726670] CPU: 3 PID: 396 Comm: Binder:382_1 Tainted: G        W         4.19.172 #166
[05-13 09:41:14][ 3309.727380] Hardware name: Rockchip RK3566 RK817 TABLET LP4X Board (DT)
[05-13 09:41:14][ 3309.727968] pstate: 60400009 (nZCv daif +PAN -UAO)
[05-13 09:41:14][ 3309.728412] pc : _raw_read_lock+0x20/0x48
[05-13 09:41:14][ 3309.728779] lr : f2fs_lookup_extent_tree+0xd0/0x330
[05-13 09:41:14][ 3309.729216] sp : ffffff800cc3b700
[05-13 09:41:14][ 3309.818050] Call trace:
[05-13 09:41:14][ 3309.818288]  _raw_read_lock+0x20/0x48
[05-13 09:41:14][ 3309.818617]  f2fs_lookup_extent_tree+0xd0/0x330
[05-13 09:41:14][ 3309.819021]  f2fs_lookup_extent_cache+0x4c/0x60
[05-13 09:41:14][ 3309.819427]  f2fs_map_blocks+0x84/0x9e8
[05-13 09:41:14][ 3309.819774]  f2fs_mpage_readpages+0x1e8/0x604
[05-13 09:41:14][ 3309.820166]  f2fs_read_data_pages+0xf4/0x11c
[05-13 09:41:14][ 3309.820551]  read_pages+0x64/0x148
[05-13 09:41:14][ 3309.820852]  __do_page_cache_readahead+0x164/0x1c4
[05-13 09:41:14][ 3309.821278]  ondemand_readahead+0x1e4/0x264
[05-13 09:41:14][ 3309.821647]  page_cache_async_readahead+0xb4/0xd0
[05-13 09:41:14][ 3309.822066]  generic_file_read_iter+0x168/0x8b4
[05-13 09:41:14][ 3309.822474]  f2fs_file_read_iter+0x34/0xa0
[05-13 09:41:14][ 3309.822848]  generic_file_splice_read+0xc8/0x144
[05-13 09:41:14][ 3309.823263]  splice_direct_to_actor+0xf8/0x274
[05-13 09:41:14][ 3309.823655]  do_splice_direct+0x78/0xc8
[05-13 09:41:14][ 3309.824008]  do_sendfile+0x1cc/0x404
[05-13 09:41:14][ 3309.824336]  __se_compat_sys_sendfile+0x9c/0x26c
[05-13 09:41:14][ 3309.824750]  __arm64_compat_sys_sendfile+0x18/0x20
[05-13 09:41:14][ 3309.825181]  el0_svc_common+0x98/0x160
[05-13 09:41:14][ 3309.825518]  el0_svc_compat_handler+0x18/0x20
[05-13 09:41:14][ 3309.825913]  el0_svc_compat+0x8/0x34
[05-13 09:41:14][ 3309.826244] Code: aa0003e1 52804000 11000529 b9001909 (b8a0003e)

Signed-off-by: Cliff Chen <cliff.chen@rock-chips.com>
Change-Id: Ic7d144eb2518ecc255428eff1c493dbcb36d7976
2021-06-23 15:57:07 +08:00
Thinh Nguyen
f8d073dcd3 UPSTREAM: usb: dwc3: gadget: Remove FS bInterval_m1 limitation
The programming guide incorrectly stated that the DCFG.bInterval_m1 must
be set to 0 when operating in fullspeed. There's no such limitation for
all IPs. See DWC_usb3x programming guide section 3.2.2.1.

Fixes: a1679af85b ("usb: dwc3: gadget: Fix setting of DEPCFG.bInterval_m1")
Cc: <stable@vger.kernel.org>
Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/5d4139ae89d810eb0a2d8577fb096fc88e87bfab.1618472454.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3232a3ce55)
Change-Id: I3e77e49152bbf85c2ecb01bb490b930a78af18ee
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-06-23 12:06:10 +08:00
Yifeng Zhao
e6ce9c3ded drivers: rk_nand: set dma mask to 32bits
The nandc's DMA only supports 32bits. When the DDR capacity exceeds 4GB,
It need to configure DMA mask to 32bits and use API dma_map_single to
get the physical address.

Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Change-Id: I39d7270cfc9ed02770fca5946b57011722ab2d7b
2021-06-23 12:05:17 +08:00
Zhihuan He
059b67e1f1 arm64: configs: rockchip_defconfig enable DMC_DEBUG
enable CONFIG_ARM_ROCKCHIP_DMC_DEBUG

Change-Id: Id5c5353a18144d4bd69afa1263d56eee55f07bd8
Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
2021-06-23 12:04:40 +08:00
Zhihuan He
d4f90f4fd9 ARM: configs: rockchip_defconfig enable DMC_DEBUG
enable CONFIG_ARM_ROCKCHIP_DMC_DEBUG

Change-Id: Ia6837312b36f51eb519d19c95de1174e4e3543ec
Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
2021-06-23 12:02:52 +08:00
Zhihuan He
fda7f718ae arm64: dts: rockchip: px30: add dmcdbg node
Change-Id: Ic75fea4de3bec07c2730678bcf63d38aac2530a7
Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
2021-06-23 12:01:10 +08:00
Zhihuan He
0eb6c247c3 PM / devfreq: rockchip_dmcdbg: add px30 support
Change-Id: I9da8f3229b8a9c44ea1c1237bb36aa4b8762e545
Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
2021-06-23 11:57:54 +08:00
Zhihuan He
ac365f86b9 PM / devfreq: rockchip_dmcdbg: add dramid info
Change-Id: Ibf4aca3e6c37cd3acc1348af578dde6df279ff62
Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
2021-06-23 11:42:50 +08:00
Zhihuan He
1115cdab28 PM / devfreq: rockchip_dmcdbg: updata rv1126 version to 0x102
Change-Id: I44f489dbe383feb58436acf61defa21e9e48dc0d
Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
2021-06-23 11:12:47 +08:00
Zhihuan He
1fe4802396 PM / devfreq: rockchip_dmcdbg: refactor rv1126_dmcdbg_init()
Change-Id: I47c2e3712aeacefa22ec4c589309ab13ce9ec7b1
Signed-off-by: Zhihuan He <huan.he@rock-chips.com>
2021-06-23 11:12:38 +08:00
Herman Chen
41284f5dd3 video: rockchip: mpp: Fix mpp_free_task crash
Due to hardware timeout the session may be released before the remaining
task is alll finished. So mpp_free_task could run after mpp_dev_release.
Then the session used in mpp_free_task could be invalid and crash the
thread.

So we attach session to the mpp_taskqueue and let the work thread to
destroy and release session later.

NOTE: the session is created in mpp_dev_open and attached to
corresponding taskqueue on client init. So when we release the session in
mpp_dev_release if the session is not attached to certain taskqueue just
release it immediately.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I9d4b2358154522e6bcde6e688592c0058781529a
2021-06-22 16:13:41 +08:00
shengfei Xu
0d79e76e79 arm64: dts: rockchip: enable the suspend default config for rk3568-linux
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
Change-Id: I6fefa1d37cf7e1d7bade038f2b909a62417ec254
2021-06-22 14:14:48 +08:00
shengfei Xu
b4b17e1401 arm64: dts: rockchip: enable the suspend default config for rk3568-android
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
Change-Id: I9581ce931162012ecf508c6d14990b98e8466361
2021-06-22 14:13:54 +08:00
Andy Yan
6ffe953d26 drm/rockchip: vop2: No register mirror win when only one vp used
when only one vp(crtc) is registered to drm, all the
plane->possible_crtc will be force set to this crtc.
this make current hwc think that all these planes can be
assigned to this crtc, but the mirror plane(rk3566 feature)
cant't be activated on the same crtc with source plane.

So if some boards only use one vp(crtc), don't register
mirror plane.

Change-Id: Ib25246cf44a0fc4caf98e7c6d21ebba18f1a6c88
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2021-06-21 18:38:34 +08:00
Sandy Huang
754bb09b98 drm/rockchip: vop2: close cluster sub win when main win is closed
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: Ifad854f2e70fe3487731f6cd1d3c41f2a512087e
2021-06-21 18:38:24 +08:00
Andy Yan
05c93d1db1 drm/rockchip: vop: Set output mode to P888 before send mcu cmd
VOP will do a dither logic transform when output is not P888,
this will make send wrong cmd.

Change-Id: Id289d90f029be457269d039d68f43a7cf1867eb2
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2021-06-21 17:21:01 +08:00
ZhiZhan Chen
96ec871718 arm64: dts: rockchip: use cluster for cursor on rk3568-evb1-ddr4-v10-linux.dts
Signed-off-by: ZhiZhan Chen <zhizhan.chen@rock-chips.com>
Change-Id: Icf667a4598a93b672777587775673539018bf4bc
2021-06-18 17:28:51 +08:00
Caesar Wang
141645215d Revert "arm64: dts: rockchip: disable afbc by default on rk3568-linux.dtsi"
This reverts commit bcd00049f4

Fixed by commit bba5e44c03
("drm/rockchip: vop2: Move Primary window to head and Cluster to tail")

Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Change-Id: Id7f0ce15fcbc7cf0edb9c74ee5ca7f6ee2f2d20a
2021-06-18 17:27:27 +08:00
Herman Chen
7b9018beed video: rockchip: mpp: Use kthread to process task
The kthread has less context switch overhead comparing to workqueue.

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I509d8cd86c0966a2bfee8cb8459753368050b2b3
2021-06-18 14:57:00 +08:00
Andy Yan
bc3c93ff07 drm/rockchip: vop2: wait port_mux cfg done before configure new plane
We need two vsync cycle when move a window from
on vp to another: the port_mux take effect in
first vsync, than enable the window at second
vsync.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Change-Id: I87c1ac0803081ecb201d9218d40fdea89424fbd8
2021-06-18 14:15:27 +08:00
Andy Yan
bba5e44c03 drm/rockchip: vop2: Move Primary window to head and Cluster to tail
This make primary win register first to get the lower zpos.

Also hide the cluster win to the tail, give it a lower chance to
be found by some tradional display sorftware(etc X11).

Change-Id: I20e4885c6b18d7eec6ecc32fbf1ac5620fbb8a30
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2021-06-18 14:15:27 +08:00
Andy Yan
7c867f0214 drm/rockchip: vop2: Only register used vp to drm
A registered vp(crtc) need a primary plane, some
linux style display software(X11/weston) want more
overlay plane, so we don't register unused vp to
same some plane for overlay.

Change-Id: I66846af7364d1a20f38f35d65ed3fe34b7f280ab
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2021-06-18 14:15:27 +08:00
Andy Yan
89ee594a71 drm/rockchip: vop2: Support disable Cluster sub win
Change-Id: Ia2f764992ce51ca61f6ba269083fa643509f58e1
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2021-06-18 14:15:27 +08:00
Andy Yan
fb5b2cfea8 drm/rockchip: vop2: Support set cursor win from dts
for example:

Use CLuster0 as cursor win for vp0.

&vp0 {
	cursor-win-id = <ROCKCHIP_VOP2_CLUSTER0>;
};

Change-Id: I10f7921928fbf7ff803c55a95cbce62df658fbed
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2021-06-18 14:15:27 +08:00
Zorro Liu
87a35c65f8 drm/rockchip: ebc_dev: release version v2.02
1.adjust panel power on/off sequence
2.remove EPD_OVERLAY_WHITE mode
3.use another way to draw white Lines

Signed-off-by: Zorro Liu <lyx@rock-chips.com>
Change-Id: I4787b0cd4a1f0f0f8cac310afa06d3d1db6dae9b
2021-06-18 14:11:52 +08:00
Wu Liangqing
ae4c563bea scripts: io-domain.sh: fix parse error caused by io_domain duplicate definitions
Change-Id: Ie8aaa817985643cc48ce8020a7eac38a35029c46
Signed-off-by: Wu Liangqing <wlq@rock-chips.com>
2021-06-18 14:11:18 +08:00
Fenrir Lin
8a735d4ec1 media: i2c: os04c10: fix the gain error problem
Signed-off-by: Fenrir Lin <fenrir.lin@rock-chips.com>
Change-Id: I20bbf598d4bcc9f3029112f6d729286d40bf338d
2021-06-18 10:51:52 +08:00
Sudeep Holla
febcd380ef UPSTREAM: firmware: arm_scmi: Move scmi protocols registration into the driver
In preparation to enable building SCMI as a single module, let us move
the SCMI protocol registration call into the driver. This enables us
to also add unregistration of the SCMI protocols.

The main reason for this is to keep it simple instead of maintaining
it as separate modules and dealing with all possible initcall races
and deferred probe handling. We can move it as separate modules if
needed in future.

Link: https://lore.kernel.org/r/20200907195046.56615-4-sudeep.holla@arm.com
Tested-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
(cherry picked from commit 1eaf18e35a)

Conflicts:
	drivers/firmware/arm_scmi/driver.c
	drivers/firmware/arm_scmi/system.c

Fixes: 5730f8b50f ("UPSTREAM: firmware: arm_scmi: Move scmi protocols registration into the driver")
Change-Id: I0509be2a8614d3f98bad8d19e57d75e6371008a4
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-06-17 19:17:38 +08:00
Sudeep Holla
950a4fde3c UPSTREAM: firmware: arm_scmi: Add names to scmi devices created
Now that scmi bus provides option to create named scmi device, let us
create the default devices with names. This will help to add names for
matching to respective drivers and eventually to add multiple devices
and drivers per protocol.

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
(cherry picked from commit 9c5c463f2a)

Conflicts:
	drivers/firmware/arm_scmi/driver.c

Add missing reset devname.

Fixes: b430ea6fd1 ("UPSTREAM: firmware: arm_scmi: Add names to scmi devices created")
Change-Id: I2ba7edb8b3e6483e2a8d6ce3a33dce41d432c7b5
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-06-17 19:11:34 +08:00
Sudeep Holla
9f10a3c532 UPSTREAM: reset: reset-scmi: Match scmi device by both name and protocol id
The scmi bus now has support to match the driver with devices not only
based on their protocol id but also based on their device name if one is
available. This was added to cater the need to support multiple devices
and drivers for the same protocol.

Let us add the name "reset" to scmi_device_id table in the driver so
that in matches only with device with the same name and protocol id
SCMI_PROTOCOL_RESET.

Change-Id: Iccebdc2ed032db23d5b4e86462ce33534a23924c
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
(cherry picked from commit 34ce3c5e69)
2021-06-17 19:02:15 +08:00
Sudeep Holla
70379c59db UPSTREAM: reset: reset-scmi: add missing handle initialisation
scmi_reset_data->handle needs to be initialised at probe, so that it
can be later used to access scmi reset protocol APIs using the same.

Since it was tested with a module that obtained handle elsewhere,
it was missed easily. Add the missing scmi_reset_data->handle
initialisation to fix the issue.

Change-Id: Id4a398dc0bede531e384301067a71327f1d78821
Fixes: c8ae9c2da1 ("reset: Add support for resets provided by SCMI")
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Reported-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
(cherry picked from commit 61423712db)
2021-06-17 19:00:34 +08:00
Sudeep Holla
64ffa834bf UPSTREAM: reset: Add support for resets provided by SCMI
On some ARM based systems, a separate Cortex-M based System Control
Processor(SCP) provides the overall power, clock, reset and system
control. System Control and Management Interface(SCMI) Message Protocol
is defined for the communication between the Application Cores(AP)
and the SCP.

Adds support for the resets provided using SCMI protocol for performing
reset management of various devices present on the SoC. Various reset
functionalities are achieved by the means of different ARM SCMI device
operations provided by the ARM SCMI framework.

Change-Id: I7cadc2be170ed8029e3db92aeda8249bbb7c4e88
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
(cherry picked from commit c8ae9c2da1)
2021-06-17 18:59:42 +08:00
Etienne Carriere
c256ed3a52 UPSTREAM: firmware: arm_scmi: Fix ARCH_COLD_RESET
The defination for ARCH_COLD_RESET is wrong. Let us fix it according to
the SCMI specification.

Change-Id: Ied2b8d55e21583a9dec2d131155ec5cbd86636ba
Link: https://lore.kernel.org/r/20201008143722.21888-5-etienne.carriere@linaro.org
Fixes: 95a15d80aa ("firmware: arm_scmi: Add RESET protocol in SCMI v2.0")
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
(cherry picked from commit 45b9e04d5b)
2021-06-17 18:58:23 +08:00
Sudeep Holla
a7763786b1 UPSTREAM: firmware: arm_scmi: Stash version in protocol init functions
In order to avoid querying the individual protocol versions multiple
time with more that one device created for each protocol, we can simple
store the copy in the protocol specific private data and use them whenever
required.

Change-Id: I80e3b6177ffe99deb74c2e6dccf705b73f2163a8
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
(cherry picked from commit b55b06b794)
2021-06-17 18:57:51 +08:00
Sudeep Holla
57d62a13d8 UPSTREAM: firmware: arm_scmi: reset: fix reset_state assignment in scmi_domain_reset
Fix the copy paste typo that incorrectly assigns domain_id with the
passed 'state' parameter instead of reset_state.

Change-Id: If645ba6372f616638d50c5023aa7a8b1404f424a
Fixes: 95a15d80aa ("firmware: arm_scmi: Add RESET protocol in SCMI v2.0")
Reported-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
(cherry picked from commit 11ed5cf064)
2021-06-17 18:56:21 +08:00
Sudeep Holla
7d7b363271 UPSTREAM: firmware: arm_scmi: Add RESET protocol in SCMI v2.0
SCMIv2.0 adds a new Reset Management Protocol to manage various reset
states a given device or domain can enter. Device(s) that can be
collectively reset through a common reset signal constitute a reset
domain for the firmware.

A reset domain can be reset autonomously or explicitly through assertion
and de-assertion of the signal. When autonomous reset is chosen, the
firmware is responsible for taking the necessary steps to reset the
domain and to subsequently bring it out of reset. When explicit reset is
chosen, the caller has to specifically assert and then de-assert the
reset signal by issuing two separate RESET commands.

Add the basic SCMI reset infrastructure that can be used by Linux
reset controller driver.

Change-Id: I78f79b81852d31dc3026ba06ca66f36a2aa60df2
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
(cherry picked from commit 95a15d80aa)
2021-06-17 18:54:45 +08:00
Sudeep Holla
28bafe15f8 UPSTREAM: firmware: arm_scmi: Use {get,put}_unaligned_le{32,64} accessors
Instead of type-casting the {tx,rx}.buf all over the place while
accessing them to read/write __le{32,64} from/to the firmware, let's
use the existing {get,put}_unaligned_le{32,64} accessors to hide all
the type cast ugliness.

Change-Id: I5cbb01ad87d985fc759cdd5d33a63beb8c790c4c
Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit aa90ac45bc)
2021-06-17 18:42:39 +08:00
Sudeep Holla
77037bcf25 UPSTREAM: firmware: arm_scmi: Use asynchronous CLOCK_RATE_SET when possible
CLOCK_PROTOCOL_ATTRIBUTES provides attributes to indicate the maximum
number of pending asynchronous clock rate changes supported by the
platform. If it's non-zero, then we should be able to use asynchronous
clock rate set for any clocks until the maximum limit is reached.

Tracking the current count of pending asynchronous clock set rate
requests, we can decide if the incoming/new request for clock set rate
can be handled asynchronously or not until the maximum limit is
reached.

Change-Id: I958da7f1990ef773e26f182b59af26c5717ebd61
Cc: linux-clk@vger.kernel.org
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 2bc06ffa06)
2021-06-17 18:42:24 +08:00
Sudeep Holla
09523b99d7 UPSTREAM: firmware: arm_scmi: Drop config flag in clk_ops->rate_set
CLOCK_PROTOCOL_ATTRIBUTES provides attributes to indicate the maximum
number of pending asynchronous clock rate changes supported by the
platform. If it's non-zero, then we should be able to use asynchronous
clock rate set for any clocks until the maximum limit is reached.

In order to add that support, let's drop the config flag passed to
clk_ops->rate_set and handle the asynchronous requests dynamically.

Change-Id: I1f6b5947638f3dad041d163bfb44936a3c484da9
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org
Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit d0aba11614)
2021-06-17 18:41:50 +08:00
Sudeep Holla
96048edcc7 UPSTREAM: firmware: arm_scmi: Add asynchronous sensor read if it supports
SENSOR_DESCRIPTION_GET provides attributes to indicate if the sensor
supports asynchronous read. We can read that flag and use asynchronous
reads for any sensors with that attribute set.

Let's use the new scmi_do_xfer_with_response to support asynchronous
sensor reads.

Change-Id: I8066cecb9565d5f40c42accbebc8ced2747d5dba
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit d09aac0eb1)
2021-06-17 18:41:21 +08:00
Sudeep Holla
c32cceb6bb UPSTREAM: firmware: arm_scmi: Drop async flag in sensor_ops->reading_get
SENSOR_DESCRIPTION_GET provides attributes to indicate if the sensor
supports asynchronous read. Ideally we should be able to read that flag
and use asynchronous reads for any sensors with that attribute set.

In order to add that support, let's drop the async flag passed to
sensor_ops->reading_get and dynamically switch between sync and async
flags based on the attributes as provided by the firmware.

Change-Id: I000cae002b0fc85dcf09a3d35bd273685d6960b7
Cc: linux-hwmon@vger.kernel.org
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 6a55331c87)
2021-06-17 18:41:08 +08:00
Sudeep Holla
075a3702aa UPSTREAM: firmware: arm_scmi: Align few names in sensors protocol with SCMI specification
Looks like more code developed during the draft versions of the
specification slipped through and they don't match the final
released version. This seem to have happened only with sensor
protocol.

Renaming few command and function names here to match exactly with
the released version of SCMI specification for ease of maintenance.

Change-Id: Idbaaa32e46e4d515c0fcb57f376f5f5b581e311b
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 9eefa43a1a)
2021-06-17 18:40:57 +08:00