Commit Graph

1059225 Commits

Author SHA1 Message Date
Sandy Huang
8aa6aa0bf2 drm: support ignore drm ioctl permission
Change-Id: I269766a9f3f844933bd294ce681466f5a97b1d43
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2021-08-04 20:01:16 +08:00
Sandy Huang
d513513390 drm/rockchip: drv: add support afbc
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: I04e99d4d1cfdda75d1938dd2c1e79767ee39b559
2021-08-04 17:36:09 +08:00
Sandy Huang
b33b4d6a73 drm/rockchip: support using reserved memory region for cma
Change-Id: I829162c21748052525b0583185db67015f24141d
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2021-08-04 17:36:09 +08:00
Sandy Huang
c0be657e1e drm/rockchp: drv: Add support for more than 4G memory
fix log:

rockchip-drm display-subsystem: swiotlb buffer is full (sz: 262144 bytes)

Change-Id: I05fd8a2674e1e73fb1d35c75c009eacc7ba8a236
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2021-08-04 17:36:09 +08:00
Yu Qiaowei
e35fa0a231 video/rockchip: rga2: Remove the useless code about the src1 channel
1. Remove the useless code about the coordinate after rotation in
   the src1 channel.
2. Remove 4 alignment of the src1 channel.

Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: Ib780c0143a76e4bfc50c0be95e483c503525ab9f
2021-08-04 09:55:20 +08:00
Jianqun Xu
072228d44e arm64: dts: rockchip: rk3399-android: use irq mode for fiq-debugger
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: I18f48e8a0df6c861bf3ff58a99f724268faa06c6
2021-08-03 15:38:21 +08:00
Tao Huang
e3114d3911 arm64: rockchip_gki.config: Enable CONFIG_PHY_ROCKCHIP_INNO_HDMI
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I4b72d9621d95d2df2f878dbb2faa2faa39b50f29
2021-08-03 15:18:24 +08:00
Algea Cao
7132bf4dcd phy/rockchip: inno-hdmi: using kernel4.19 inno-hdmi phy driver
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: I87775498a06539c007051024e403812e6d92ffbe
2021-08-03 15:18:00 +08:00
David Wu
9be1cd8653 i2c: rk3x: Remove start state and irq
Let configuration start and count be performed at the
same time as much as possible, which can reduce the
interval between the start signal and the data signal,
and can also reduce a start irq.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I529300a083dcd264cc5f25a2069b88601cade83e
2021-08-03 14:55:57 +08:00
David Wu
87bf929a47 i2c: rk3x: set special bit for rv1126 i2c2
If want to use i2c2, we must write i2c2 register bit with 1 at PMUGRF.

Change-Id: Id2b5c1b06c206e43de19fe42024846918fa0b145
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-03 14:55:36 +08:00
David Wu
17e882e4bd i2c: busses: rk3x: Fix i2c grf special bit setting
When the property "rockchip,grf" of i2c DTS node exists and
the GRF offset is also valid, special bit needs to be configured.

Change-Id: If7ea4185b940ad026ed822b44cfb0c8acda83500
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-03 14:55:09 +08:00
David Wu
06aaf9fc7b i2c: rk3x: set special bit for rv1108 i2c2
If want to use i2c2, we must write i2c2 register bit with 1 at GRF.

Change-Id: Ia7e59c105647304162bde283a3fb98d9e0db75c3
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-03 14:54:49 +08:00
David Wu
fd1cd4a26c i2c: rk3x: Disable irq after i2c transfer finished
In some case,log like this:

[   12.393926] rk3x-i2c ff150000.i2c: irq in STATE_IDLE, ipd = 0x51
[   12.416592] rk3x-i2c ff150000.i2c: irq in STATE_IDLE, ipd = 0x51

The i2c clock is disabled, so the pending irq clean is not
worked. Disable the interrupt after the i2c jobs were done,
the error log would not happen.

Change-Id: If04a2e2214d675410c67db0f131ee7ef635ddcb4
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-03 14:54:03 +08:00
David Wu
442d0afc25 i2c: rk3x: Disable i2c controller after i2c transfer finished
If the slave hold the scl low for a long time, we will send
the stop because the i2c transfer is timeout. Then reset the
slave, the scl will be released to high by slave, the data
hold low, but the controller's state is messy now, need to
disable i2c controller, it is better to reset i2c controller,
it will go back to normal state.

The log like this:

[ 117.444700] rk3x-i2c ff3d0000.i2c: timeout, ipd: 0x93, state: 2
[ 118.466410] rk3x-i2c ff3d0000.i2c: timeout, ipd: 0x00, state: 1
[ 119.486217] rk3x-i2c ff3d0000.i2c: timeout, ipd: 0x00, state: 1

or

[  91.733176] rk3x-i2c ff3d0000.i2c: timeout, ipd: 0x80, state: 1
[ 103.406776] rk3x-i2c ff3d0000.i2c: timeout, ipd: 0x00, state: 2
[ 104.426636] rk3x-i2c ff3d0000.i2c: timeout, ipd: 0x00, state: 2

Change-Id: I53e6e383c849cea22d870f9488c23720e74115df
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-03 14:53:08 +08:00
David Wu
3dab2c9f64 i2c: rk3x: Leave the irq handle if received nack irq
In the TRX mode, if there was a nack signal at the hardware's
tx, we can get start and nack ipd from the I2C_IPD register,
which will enter nack process, send stop command, change the
state to stop, and enter the handler of stop irq, but the stop
irq may not be generated, it has a latency. So the log will like
this:

[ 69.961944] rk3x-i2c ff650000.i2c: unexpected irq in STOP: 0x10
[ 70.959690] rk3x-i2c ff650000.i2c: timeout, ipd: 0x00, state: 4

This error log will confuse us, it is not easier to locate the problem,
we should get nack error at this time, and processing stop interrupt at
the next, then complete this i2c job.

Change-Id: I073ef288557b1b6f525d936e8f32d9d165c81ec4
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-03 14:49:26 +08:00
David Wu
0f8ac2a29c i2c: rk3x: Add slave_hold_scl ipd clean
The bit7 of I2C_IPD register also needs to be clean, otherwise,
it will always exist.

Change-Id: Iee01bffd83909e84ed99c9fab821e621c970efd3
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-03 14:49:26 +08:00
David Wu
36094b61ce i2c: rk3x: Add "suspended" flag to forbid access I2C bus during suspend/resume noirq
Add "suspended" flag in suspend_noirq()/resume_noirq() callback
to prevent new i2c job started, and use i2c_lock_adapter() to wait
for current i2c transfer finished.

If any i2c client try to access I2C after suspend_noirq() or
before resume_noirq() callback, return the error, and they
should fix it, not to start i2c access at this moment.

Change-Id: Idd1142058d10547d085895a498201c2ade6b9e96
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-03 14:49:10 +08:00
Zhang aihui
37fd8ed0a9 i2c: Devices which have some i2c addr can work in same i2c bus
If i2c slave devices don't work at the same time, which have
the same i2c addr, this patch can make them working.

Change-Id: I1bfb7783924b08bdc6e12bf47c2de01bdac7c2e2
Signed-off-by: Zhang aihui <zah@rock-chips.com>
Signed-off-by: Wang Jie <dave.wang@rock-chips.com>
2021-08-03 14:46:23 +08:00
David Wu
497e7bd6e1 i2c: rk3x: Make sure the i2c transfer to be finished before system reboot
If the system rebooted, there might be i2c transfer at the
same time, it will make something unpredictable, because
the i2c host was reset, but the slave device wasn't, such
as rk808 pmic, so make sure the i2c transfer to be finished
before system shutdown at the reset mode.

This call chain is expected to be executed before kernel_restart
to do something before reset system. such as, i2c restart,
boot mode config.

Change-Id: I3c09f3acbe86595c295edc191aa38351adb7d5dc
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2021-08-03 14:44:16 +08:00
David Wu
72dd938512 iio: adc: rockchip: Don't return fail at probe when the regulator is dummy
If the referenced regulator is a dummy, the voltage is invalid,
but someone doesn't need the voltage, just need the adc value,
so don't return fail at probe when the regulator is dummy. If
he wants the voltage, configures the actual referenced regulator
at dts.

Change-Id: I8eaecc1a8e7e57c3a87aa69b9b852735bf4a025a
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-03 11:40:46 +08:00
David Wu
a220765c61 iio: adc: rockchip_saradc: Just get referenced voltage once at probe
The referenced voltage is not changed after initiation, so just only
get referenced voltage once.

Change-Id: I1eeab03f68855fafe010db328ec7bbcfa7d52310
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-03 11:40:11 +08:00
David Wu
a195f5035c dts: rockchip: Set pwm pin pull down when used for negative pwm regulator
As a second global reset, the GRF is not reset, the iomux and
pull of PWM pin is still keeping, but PWM controller is reset,
PWM pin goes into input mode. However, the pull is still none
changed in kernel, which can cause voltage problems, so should
always keep the PWM pin pull down mode, with 0~50 μA power
increase.

Change-Id: Ibbb9465f7c550d49d416bc3438c5199434df6eba
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-02 17:39:00 +08:00
David Wu
718c02ce18 pwm: rockchip: Make pwm pinctrl setting after pwm enabled
If the PWM pinctrl uses default state, the iomux setting will
be done at probe, the PWM may not be enabled at this moment.
It will make PWM into an intermediate state, destroy the default
hardware state, the PWM is not ready for work yet. So it is better
for doing PWM pinctrl setting after PWM enabled.

Change-Id: Iea34a7baf6a4d7df0c631f7f4fdab5b9d61bbd5f
Signed-off-by: David Wu <david.wu@rock-chips.com>
2021-08-02 17:39:00 +08:00
Tao Huang
69f5bbb436 i2c: rk3x: Call rk3x_i2c_driver_init() early when CONFIG_ROCKCHIP_THUNDER_BOOT=y
Change-Id: Ia723fcbb4bc5cf65843d343645b6ace538a536db
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2021-08-02 16:44:56 +08:00
Shawn Lin
d80d5062b2 mmc: dw_mmc-rockchip: Always fix ID mode clk request into 375KHz for RK356X
RK356X SoCs only support 375KHz for ID mode, otherwise it will be always
failed to set clk if the first attempt to identify cards.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Change-Id: I99ba322b3eeb4c4658869dc88b7a9f303081e12e
2021-08-02 14:34:35 +08:00
Yifeng Zhao
30f84d3755 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-08-02 14:34:35 +08:00
Jon Lin
750cdbce41 drivers: rk_flash: 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.

Change-Id: I1510f7bbe2779ea20ff83a93e3a4dabb941263e3
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2021-07-30 16:06:10 +08:00
Zheng Yang
fed72e8fa9 drm: bridge: dw-hdmi: add debugfs node
Create two debugfs node to debug hdmi controller and phy.

Use following command to debug:
Read hdmi controller register:
	cat /d/dw-hdmi/ctrl
Read hdmi phy register:
	cat /d/dw-hdmi/phy
Write hdmi controller register:
	echo <reg> <val> > /d/dw-hdmi/ctrl
Write hdmi phy register:
	echo <reg> <val> > /d/dw-hdmi/phy

<reg> and <val> is hexadecimal.

Change-Id: I02e40cc94aa651ff0734feddbfa7d816edcf222f
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2021-07-29 20:48:43 +08:00
Algea Cao
4035588f0f drm/rockchip: dw-hdmi: Add ycbcr_420_allowed to hdmi plat data
If the platform supports yuv420, set ycbcr_420_allowed to true.

Change-Id: I963b35b1e243f3267a3237c82120e6fe826850d5
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2021-07-29 20:48:43 +08:00
Zheng Yang
0b64f6166d drm/rockchip: hdmi: add color depth and output mode capacity property
Change-Id: I878780df5c1c81094498be2e7b4b3a22da0bfd4e
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2021-07-29 20:48:42 +08:00
Zheng Yang
650ab4a0bb drm/rockchip: hdmi: support modify color format
This patch is based on https://patchwork.kernel.org/patch/9801533,
add the drm property "hdmi_output_format", the possible value
could be:
     - RGB
     - YCBCR 444
     - YCBCR 422

To handle various subsampling of YCBCR output types, this property
allows two special automatic cases:
     - DRM_HDMI_OUTPUT_YCBCR_HQ
       This indicates preferred output should be YCBCR output,
       with highest subsampling rate by the source/sink, which
       can be typically:
	- ycbcr444
	- ycbcr422
	- ycbcr420
     - DRM_HDMI_OUTPUT_YCBCR_LQ
       This indicates preferred output should be YCBCR output, with
       lowest subsampling rate supported by source/sink, which can be:
	- ycbcr420
	- ycbcr422
	- ycbcr444

Default value of the property is set to 0 = RGB, so no changes if you
don't set the property.

Change-Id: Ie4a98ba91c8285a2e8f1ec7832d73183ad57665e
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2021-07-29 20:48:42 +08:00
Zheng Yang
3a9f825189 drm/rockchip: hdmi: support modify color depth
This patch introduce a drm property hdmi_output_depth to
get/set HDMI color depth, the possible value could be
	- Automatic
	  This indicates prefer highest color depth, it is
	  30bit on rockcip platform.
	- 24bit
	- 30bit
The default value of property is 24bit.

The max_tmds_clock is 0 on some display device, we think it's
max_tmds_clock is 340MHz.

If tmdsclock > max_tmds_clock, real output color depth fallback
to 24bit.

Change-Id: I666ac85d1ce5e73af31251eae324d1a6ae00b31e
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2021-07-29 20:48:42 +08:00
Zheng Yang
8a67fdbcfe drm: bridge: dw-hdmi: support attach property
Introduce struct dw_hdmi_property_ops in plat_data to attach
vendor connector property.

Change-Id: I3d23e40e9d342b22ca47f723b3f81057b58010e8
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2021-07-29 20:48:42 +08:00
Algea Cao
540a3c5d7c drm/rockchip: hdmi: Implement get input/output bus format handling
Set HDMI controller input/output bus format according to vop bus format.

Change-Id: Ib669ee6b0ea586410c715518d0bc9c55f5a52a50
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2021-07-29 20:48:42 +08:00
Zheng Yang
a888e70c4d drm: bridge/dw_hdmi: support DRM_MODE_FLAG_DBLCLK
Change-Id: I66d9456d6bde38fcf17d5cd5f6394517e4308a68
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2021-07-29 20:48:42 +08:00
Algea Cao
a07b4b5edd drm/rockchip: hdmi: Add hdmi drv_data features
Hdmi features vary on different platforms:
1.max_tmdsclk:hdmi max tmds clock.
2.unsupported_yuv_input:hdmi only support rgb input.
3.unsupported_deep_color:deep color mode is unsupported.

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: I77468b21960c49596c45bfef037fc5bfb3545b61
2021-07-29 20:48:42 +08:00
Tao Huang
83e6a415e8 Revert "ARM: rockchip_linux_defconfig: Enable CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND"
This reverts commit 07bf6d1a58.

DEVFREQ_GOV_SIMPLE_ONDEMAND is selected by ARM_ROCKCHIP_DMC_DEVFREQ.

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: Iee779012ac3d1d81838666965e97153fb8eca15c
2021-07-29 11:13:20 +08:00
Tao Huang
f40ece5f7b Revert "arm64: rockchip_linux_defconfig: Enable CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND"
This reverts commit fcb101fe62.

DEVFREQ_GOV_SIMPLE_ONDEMAND is selected by ARM_ROCKCHIP_DMC_DEVFREQ.

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: Id71520788e4117345f092bc116ed0f1f00f40eec
2021-07-29 11:13:16 +08:00
Tao Huang
aa21794a81 Revert "ARM: rockchip_defconfig: Enable CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND"
This reverts commit 68d7a58af3.

DEVFREQ_GOV_SIMPLE_ONDEMAND is selected by ARM_ROCKCHIP_DMC_DEVFREQ.

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I9f5a1fbbc9e94b8cca98083d0794a862520aeb46
2021-07-29 11:13:08 +08:00
Tao Huang
0be8bfe201 Revert "arm64: rockchip_defconfig: Enable CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND"
This reverts commit 42ed6f90e0.

DEVFREQ_GOV_SIMPLE_ONDEMAND is selected by ARM_ROCKCHIP_DMC_DEVFREQ.

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I9801cb9a1ea1b954de7bc4b70141c58a073d554f
2021-07-29 11:02:10 +08:00
Tao Huang
abf96942f9 arm64: rockchip_defconfig: Enable CONFIG_PRINTK_CALLER
Thread ID and CPU ID is useful to distinguish printk
callers from different threads/cpus. Enable config
to prepend the information to printk statements.

Same as gki_defconfig.

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I3e0e4a5f29d25e71cf5c01ff3cd4ab42fc977dd2
2021-07-29 10:55:41 +08:00
Tao Huang
2d1051ee97 arm64: rockchip_gki.config: Enable CONFIG_ROCKCHIP_TIMER
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: Ib9972edb7ef26bee2cad671e04f61c15594f3445
2021-07-28 19:32:05 +08:00
Tao Huang
4f2d80c1bb clocksource/drivers/rockchip: Add module support to rockchip timer
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: Ieac5aecb5d50851a70e9f932c1340f253d62c7ec
2021-07-28 19:32:05 +08:00
Sandy Huang
949dbda967 drm/rockchip: vop2: make sure layer sel is take effect when it's updated
when vp0 and vp1 indenpendent config layer_sel register, this register take effect
time is prone to error, so we add the following measures to workaround this issue:

1. Add commit_lock to make sure vp0 and vp1 config register is mutually exclusive;
2. Make sure layer sel register is take effect when it's update.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: Ief832e2bf7e18567f4ea663843c77f0afbd21cf7
2021-07-28 15:16:31 +08:00
Sandy Huang
2563d569fe drm/rockchip: gem: add flag ROCKCHIP_BO_ALLOC_KMAP to assign kmap
RGA need to access CMA buffer at kernel space, so add this flag to keep kernel
line mapping for RGA.

Change-Id: Ia59acee3c904a495792229a80c42f74ae34200e3
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2021-07-28 15:15:28 +08:00
Mark Yao
51ca868e05 drm/rockchip: gem: support force alloc cma buffer with flags
Change-Id: I4749eac53609f865d0d4230364b1cbaf39ee0955
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2021-07-28 15:14:17 +08:00
Sandy Huang
e8f625e2c1 drm/rockchip: gem: use drm core drm_gem_dumb_map_offset
use drm_gem_dumb_map_offset() to instead of rockchip_gem_dumb_map_offset()

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: I992da13480991cf48206868f77f86c3965661b8f
2021-07-28 15:12:49 +08:00
Jianqun Xu
64097b127c drm/rockchip: gem: add dmabuf sync partial to dma_buf_ops
Change-Id: I6ba192c11a0ff9eeafa4f4f0260addb1e56c4afc
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2021-07-28 15:11:53 +08:00
Andy Yan
afec60b71d drm/rockchip: gem: Convert sg to page
This make cpu can dump fb data allocated by ION.

Change-Id: I639e7cbbe6957d2bb02e4577805343cdbf5f5bf7
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2021-07-28 15:09:26 +08:00
Sandy Huang
6aed65b3da drm/rockchip: gem: support cpu cache for drm memory
Change-Id: Ic9ca3d0862eb8c5c4d8a002db8cbbcc93d2dcc02
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2021-07-28 15:09:01 +08:00