Commit Graph

843962 Commits

Author SHA1 Message Date
Sandy Huang
6dd99e4e6f drm/rockchip: driver: add support more function
Change-Id: I4175947340647891dd7422b6ab30af23fb47876e
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-08-13 20:26:01 +08:00
Sandy Huang
e7c00ffb91 arm64: dts: rockchip: rk3399-sapphire-excavator-edp: enable uboot logo
Change-Id: I288ac57b79752269e771138c900b008e7a9a4bca
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-08-09 15:11:46 +08:00
Sandy Huang
862a59c0dc drm/rockchip: driver: crtc primary fb is for non atomic driver
meaningful for non-atomic drivers, for atomic drivers this is
forced to be NULL.

Change-Id: Ic3591c4f4c3ee6de53f89d0b4f230829b1ed056d
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-08-09 15:11:30 +08:00
Algea Cao
f4af517045 drm/rockchip: dw_hdmi: Support switch hdmi quantization range
Add property hdmi_quant_range to switch hdmi quantization range.

Change-Id: I084cd2e1ccb46ed9757fe39802b90eedfbe466b4
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2019-08-09 14:31:33 +08:00
Algea Cao
415f90e967 drm/bridge: synopsys: dw-hdmi: Support set RGB quantization range
1.Filling the HDMI AVI infoframe quantization range information.
2.If output is limited enable color space conversion to convert.

Change-Id: I75f666424f00f3f6ec695047f7851824e89cd1a5
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2019-08-09 14:28:56 +08:00
Liang Chen
97225bafb3 arm64: dts: rockchip: rk3328: limit max-frequency of emmc to 150M
Change-Id: I68d3937180243a1c3e71aac8e82c452c7ec55bf8
Signed-off-by: Liang Chen <cl@rock-chips.com>
2019-08-08 18:55:21 +08:00
Liang Chen
bacee35694 nvmem: rockchip-efuse: clear efuse timing after read
Clear efuse timing after read to avoid efuse misoperation.

Change-Id: I459d01af9c9a84ab6c621e5e5cf3f01213b4f7f9
Signed-off-by: Liang Chen <cl@rock-chips.com>
2019-08-08 18:54:54 +08:00
xuhuicong
10c8ed8db0 drm/bridge: dw-hdmi: fix display shaking when uboot to kernel show
Change-Id: I899bb0dde7111fe97dd2c89d20afb09562d31300
Signed-off-by: xuhuicong <xhc@rock-chips.com>
2019-08-08 18:47:38 +08:00
Zheng Yang
8b8f1e2092 drm: dw-hdmi: fix RK3328/RK3229 phy abnormal enabling
Under the following conditions, phy will be abnormally enabled.

1. HDMI is enabled in uboot.

2. disabled/bridge_is_on/phy.enabled/mc_clkdis were updated to
   work when probe.

3. HDMI is disconnected.

4. drm_helper_probe_single_connector_modes update connector->status
   to disconnected and power off phy by dw_hdmi_update_power. But the
   polled type of HDMI is DRM_CONNECTOR_POLL_HPD, output_poll_execute
   will not process this disconnection, and dw_hdmi_bridge_disable is
   not called, hdmi->disabled is still false.

5. vop will be switch to Tv encoder, and dclk is 27MHz.

6. HDMI is connected.

7. dw_hdmi_update_power is called in dw_hdmi_irq, for hdmi->disabled
   is false, then phy is powered up with parameter of 27MHz, and
   bridge_is_on is set to on.

8. VOP switch to HDMI mode, set the new dclk rate.

9. dw_hdmi_bridge_enable is called, but the bridge_is_on is already on,
   phy will not set again, still maintain the parameters that do not
   conform to the new dclk rate.

This patch introduced an variable initialized to indicate hdmi is
initialized before probe, e.g. uboot. When power off hdmi, initialized
and disabled is updated.

Change-Id: I163967ac02e7f29ab586acbfd25d5a15679470c8
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-08-08 18:47:20 +08:00
Zheng Yang
42537c5ca8 drm/bridge: synopsys: dw-hdmi: disable phy in dw_hdmi_bind
If hdmi is enabled in uboot and pluged out when booting kernel,
the hdmi phy is still enabled. It's better to disable it to
match the real status.

Change-Id: Ia1c5ede6499ee277d08c35a85c50e3257305f90f
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-08-08 18:47:07 +08:00
Algea Cao
bad1e2e612 drm/bridge: synopsys: dw-hdmi: Update criteria to determine whether uboot logo is on
If hdmi plug in when kernel starting, hdmi may be without output.
Because the old criteria that to determine whether uboot logo is
on is hdmi phy pll locked and hdmi is connected. But in some
platform(such as rk3229), hdmi phy pll is locked even hdmi phy
is power down. In this case, the old criteria is unreliable.

So we add a new criteria that check Frame Composer register.If
the register value is not 0, we think that uboot logo is on,
hdmi has been setup.

Change-Id: Ifaa27030e5f5d551bec8f971694ff5d9c34a7c1d
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2019-08-08 18:46:55 +08:00
Jiancai Huang
25a2afa89c drm: bridge: synopsys: Fix hdmi can't display in android
Change-Id: I2f3ee8176761b5227c30df25c569e4c34ae773e2
Signed-off-by: Jiancai Huang <huangjc@rock-chips.com>
2019-08-08 18:46:05 +08:00
Zheng Yang
8df904f267 drm: bridge: synopsys: update more hdmi status in dw_hdmi_bind
If hdmi is enabled in uboot, hdmi->disabled and bridge_is_on and
phy status need to be updated.

Change-Id: Ib21d894b673bf12b46a271c91d3e08fe7475ea89
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-08-08 18:41:13 +08:00
Zheng Yang
fccc5e8d9c drm: bridge: synopsys: update mc_clkdis in dw_hdmi_bind
If vop return error when showing kernel logo, connector atomic flush
will not be call, and mc_clkdis can not be updated.

This patch update mc_clkdis in the dw_hdmi_bind, when phy clock is
locked and HPD is connected.

Change-Id: I1498d787a993961fe75236c309ecc3c898d611a4
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-08-08 18:41:02 +08:00
Zheng Yang
5975fbc62e drm: bridge: dw-hdmi: Implement connector atomic_begin
To avoid screen flash when updating CSC, we introduce connector
atomic_begin. Before flush crtc and connector, it's need to send
AVMUTE flag to make screen black, and clear flag after CSC updated.

AVMUTE -> Update CRTC -> Update HDMI -> Clear AVMUTE

Change-Id: Id47caac1e25fcce5a5aa7b879da4a6b9a9bab8a1
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-08-08 18:40:49 +08:00
Zheng Yang
401fc0060c drm: introduce atomic_begin for connector
atomic_begin is used to prepare for update flush.

Change-Id: I1d3a2afaea4022c065bda2b4c0746464cc0c1303
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-08-08 18:40:29 +08:00
Zheng Yang
8e9b5db694 drm: bridge: dw-hdmi: Implement connector atomic_flush
Introduce dw_hdmi_connector_atomic_flush to implement connector
atomic_flush.

Only when enc_in_encoding/enc_out_encoding/enc_in_bus_format/
enc_out_bus_format changed, dw_hdmi_setup is called.

Introduce previous_pixelclock/previous_tmdsclock/mtmdsclock to
determine whether PHY needs initialization. If phy is power off,
or mpixelclock/mtmdsclock is different to previous value, phy is
need to be reinitialized.

Change-Id: I1984fb188ba486de18f6d51b7a51320bbf2bc27d
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-08-08 18:40:10 +08:00
Mark Yao
5111545068 drm: support atomic update flush for connector
Change-Id: I101111c489b769244f9ef5e1c1ba78d31b272ae8
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2019-08-08 18:39:30 +08:00
Algea Cao
feaeccc19d drm: bridge: dw-hdmi: optimize edid reading process
1.change SDA high level holding time to 3us.
2.when plug in,add timer to avoid unstable state.

Change-Id: Idc6faec710137ac9f8e589d75cbc1b85f7a45faf
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2019-08-08 18:32:44 +08:00
Bin Yang
9a72f564de drm: bridge/dw_hdmi: add switch state to support hdmi audio
Change-Id: Ib8122f9cc913d2cd15b92a3d6c57c7edf77d0483
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
2019-08-08 18:31:28 +08:00
Zheng Yang
e14f9b4ee3 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>
2019-08-08 18:30:44 +08:00
Zheng Yang
99d91794df drm: bridge/dw_hdmi: check is_hdmi2 in hdmi_config_AVI
If a display support HDMI2.0, it must support SCDC or YCbCr420.
So we check the connector->scdc_present and mode->flags to
check the connected display is HDMI 2.0.

Change-Id: I3b868d43791089fcdef77f99ec90396553008b9a
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-08-08 14:35:30 +08:00
Tao Huang
11516680b7 drivers/net/ethernet: remove unused rockchip driver
Change-Id: I73706b525401ae8db6f0185669a43c8a2492fea2
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2019-08-03 16:54:15 +08:00
Liang Chen
0909c9f75a arm64: dts: rockchip: replace earlyprintk with earlycon in the bootargs
arm64 do not support earlyprintk, and use earlycon instead.

Change-Id: I089707eb69f6ad985fb4040248dc62d6ccd0dd78
Signed-off-by: Liang Chen <cl@rock-chips.com>
2019-08-01 16:23:09 +08:00
Elaine Zhang
d289019bbb soc: rockchip: power-domain: fix up the pd add list error
Fixed commit d45556ed94 ("soc: rockchip: power-domain: Add protection
for some special pd during startup") states.

If the pd is power down by default. but it's has keepon_startup flag,
need to power up it before pm_genpd_init.
(ie: PD is off by default on PX30 SOC)

Change-Id: I60e9a5385794ad73f7da86cf8a18aaeecc8bcc6b
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-07-31 11:09:14 +08:00
Tony Xie
c0570888f0 mfd: rk808: Set only resetting pmic register for 817&809.
If the system needs hold register values when system will reboot.
need to set only resetting pmic register for 817&809 forcedly.

Change-Id: Ib4b850c86ec3079cd7e374bc96460ee1532854a2
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2019-07-31 11:09:14 +08:00
Tony Xie
cfe40315e8 pinctrl: support pinctrl driver for the RK817&RK809 PMIC
Change-Id: I9a24ee0d9266a000d582f8ffff8b0c872e3a0769
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2019-07-31 11:09:14 +08:00
Heiko Stuebner
6dbd6c0535 UPSTREAM: regulator: rk808: Add RK809 and RK817 support.
Add support for the rk809 and rk817 regulator driver.
    Their specifications are as follows:
    1. The RK809 and RK809 consist of 5 DCDCs, 9 LDOs
       and have the same registers for these components except dcdc5.
    2. The dcdc5 is a boost dcdc for RK817 and is a buck for RK809.
    3. The RK817 has one switch but The Rk809 has two.

    The output voltages are configurable and are meant to supply power
    to the main processor and other components.

Change-Id: Id652bcc749263bfb70dc9fe9490d56f10f7345d4
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Acked-by: Mark Brown <broonie@kernel.org>
[rebased on top of 5.2-rc1]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
(cherry picked from commit e444f6d68c)
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-07-31 11:09:14 +08:00
Tony Xie
7923bd0b93 UPSTREAM: clk: RK808: Add RK809 and RK817 support.
RK809 and RK817 are power management IC chips for multimedia products.
most of their functions and registers are same, including the clkout
funciton.

Change-Id: Ie86ae58b47a3afc0fe298fdecf9e43d8cae232a9
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
(cherry picked from commit 8ed1440197)
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-07-31 11:09:14 +08:00
Tony Xie
04d617098b UPSTREAM: rtc: rk808: Add RK809 and RK817 support.
RK809 and RK817 are power management IC chips for multimedia products.
Most of their functions and registers are same, including the rtc.

Change-Id: I090ac33f951b64f5c88e6defe67d1f50f8ffd4e5
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
(cherry picked from commit dc79054a64)
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-07-31 11:09:14 +08:00
Stefan Mavrodiev
62e9bedcf2 UPSTREAM: mfd: rk808: Check pm_power_off pointer
The function pointer pm_power_off may point to function from other
module (PSCI for example). If rk808 is removed, pm_power_off is
overwritten to NULL and the system cannot be powered off.

This patch checks if pm_power_off points to a module function.

Change-Id: I00de90d1f5f1cf6587167e59d7e577f484e1fc8c
Signed-off-by: Stefan Mavrodiev <stefan@olimex.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
(cherry picked from commit 7630499464)
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-07-31 11:09:14 +08:00
Tony Xie
af2cb4b882 UPSTREAM: mfd: rk808: Add RK817 and RK809 support
The RK809 and RK817 are a Power Management IC (PMIC) for multimedia
and handheld devices. They contains the following components:
  - Regulators
  - RTC
  - Clocking

Both RK809 and RK817 chips are using a similar register map,
so we can reuse the RTC and Clocking functionality.
Most of regulators have a some implementation also.

Change-Id: I7bc906a41c49e3f1552cf19f1d5fb75b5b8957b3
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
(cherry picked from commit 586c1b4125)
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-07-31 11:09:14 +08:00
Tony Xie
9d41cf4fa0 UPSTREAM: mfd: rk808: Remove the id_table
Remove the id_table because it's not used.

Change-Id: I406d5bd9609652cfee83af2ab7571af4e06f3aff
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
(cherry picked from commit 54349b3ce8)
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-07-31 11:01:26 +08:00
Tony Xie
465bcb4851 UPSTREAM: regmap: add a new macro:REGMAP_IRQ_REG_LINE(_id, _reg_bits)
if there are lots of irqs for a device and the register addresses for these
irqs is continuous, we can use this macro to initialize regmap_irq value.

Change-Id: If358af414c98951363315510b1d23748ba0683e0
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 43fac3238c)
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-07-31 11:01:26 +08:00
Finley Xiao
138d2658ae PM / devfreq: rockchip_dmc: Update stats in a fixed rate scene
Now we set the load of fixed rate scene to 100%, it isn't accurate,
it is better to update stats if auto freq is enabled.

Change-Id: I7de2c5f0b218cbeb32340bf3287cee0565773785
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-07-23 17:06:59 +08:00
Finley Xiao
1fae7b1632 PM / devfreq: rockchip_dmc: Use raw_smp_processor_id()
Fix this warning when DEBUG_PREEMPT is selected:
BUG: using smp_processor_id() in preemptible [00000000] code: devfreq_wq/46
caller is debug_smp_processor_id+0x1c/0x24
CPU: 4 PID: 46 Comm: devfreq_wq Tainted: G           O    4.4.179-gaa55fe4a4414 #71
Hardware name: Rockchip RK3399 Excavator Board (Linux Opensource) (DT)
Workqueue: devfreq_wq devfreq_monitor
Call trace:
[<ffffff800808866c>] dump_backtrace+0x0/0x228
[<ffffff80080888b8>] show_stack+0x24/0x30
[<ffffff80083c91a0>] dump_stack+0x88/0xb0
[<ffffff80083e11f0>] check_preemption_disabled+0xd4/0xfc
[<ffffff80083e1234>] debug_smp_processor_id+0x1c/0x24
[<ffffff80087a8ce0>] rockchip_dmcfreq_target+0x114/0x340
[<ffffff80087a5ff0>] update_devfreq+0x120/0x1b4
[<ffffff80087a60b8>] devfreq_monitor+0x34/0x8c
[<ffffff80080b3164>] process_one_work+0x23c/0x3d8
[<ffffff80080b3340>] process_scheduled_works+0x40/0x44
[<ffffff80080b3c8c>] rescuer_thread+0x174/0x26c
[<ffffff80080b9020>] kthread+0xdc/0xec
[<ffffff8008082ef0>] ret_from_fork+0x10/0x20

Change-Id: Idc05e25403de04108f597e69643e91868728b873
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-07-23 17:06:47 +08:00
Tao Huang
378cb4994d Revert "PM / devfreq: rockchip_dmc: Fix using smp_processor_id() in preemptible warning"
This reverts commit 67721b1381.

The get_cup() will disable preemption and the clk_set_rate() may call
schedule() on some platforms, otherwise we may schedule while atomic.

BUG: scheduling while atomic: sh/552/0x00000002
Modules linked in:
CPU: 1 PID: 552 Comm: sh Not tainted 4.4.179 #1122
Hardware name: Rockchip RK1808 EVB V10 Board (DT)
Call trace:
[<ffffff80080873bc>] dump_backtrace+0x0/0x1cc
[<ffffff800808759c>] show_stack+0x14/0x1c
[<ffffff800823a474>] dump_stack+0x94/0xbc
[<ffffff80080b4664>] __schedule_bug+0x3c/0x54
[<ffffff8008657c10>] __schedule+0x88/0x460[root@rk1808:/]#
[<ffffff800865805c>] schedule+0x74/0x94
[<ffffff800865a6dc>] schedule_timeout+0x148/0x178
[<ffffff80084a2920>] rockchip_dmcfreq_wait_complete+0x11c/0x144
[<ffffff800849d508>] rockchip_ddrclk_sip_set_rate_v2+0x64/0x74
[<ffffff8008497420>] clk_change_rate+0xd4/0x208
[<ffffff80084975e4>] clk_core_set_rate_nolock+0x90/0xa4
[<ffffff8008497620>] clk_set_rate+0x28/0x48
[<ffffff80084a1624>] rockchip_dmcfreq_target+0x1f0/0x320
[<ffffff800849fc8c>] update_devfreq+0x118/0x1ac
[<ffffff80084a0974>] store_freq+0x5c/0x84
[<ffffff800832a800>] dev_attr_store+0x18/0x28
[<ffffff80081992d8>] sysfs_kf_write+0x38/0x50
[<ffffff80081984d8>] kernfs_fop_write+0x114/0x170
[<ffffff800813d1f8>] __vfs_write+0x1c/0xc4
[<ffffff800813d990>] vfs_write+0x9c/0x150
[<ffffff800813e21c>] SyS_write+0x44/0x88
[<ffffff8008082ef0>] el0_svc_naked+0x24/0x28

Change-Id: I18f3ee81139ca2908d91a7ef59d3635d1a7e69cb
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2019-07-23 17:06:28 +08:00
Algea Cao
0c9fa833a7 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>
2019-07-22 10:42:45 +08:00
Neil Armstrong
385bc8c09d FROMLIST: drm/bridge: dw-hdmi: allow ycbcr420 modes for >= 0x200a
Now the DW-HDMI Controller supports the HDMI2.0 modes, enable support
for these modes in the connector if the platform supports them.
We limit these modes to DW-HDMI IP version >= 0x200a which
are designed to support HDMI2.0 display modes.

Change-Id: I719a138151b1fa2e16941d2f3ac2d8a71bba4a99
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
(am from https://patchwork.kernel.org/patch/282372/)
2019-07-22 10:42:45 +08:00
Neil Armstrong
28850f6ab7 UPSTREAM: drm/bridge: dw-hdmi: add support for YUV420 output
In order to support the HDMI2.0 YUV420 display modes, this patch
adds support for the YUV420 TMDS Clock divided by 2 and the controller
passthrough mode.

YUV420 Synopsys PHY support will need some specific configuration table
to support these modes.

This patch is based on work from Zheng Yang <zhengyang@rock-chips.com> in
the Rockchip Linux 4.4 BSP at [1]

[1] https://github.com/rockchip-linux/kernel/tree/release-4.4

Change-Id: I41733e40ac1a528c8a0e0dadb79c4e3b31ea5f6b
Cc: Zheng Yang <zhengyang@rock-chips.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1549022873-40549-5-git-send-email-narmstrong@baylibre.com
(cherry picked from commit ba9877e236)
2019-07-22 10:42:44 +08:00
Neil Armstrong
50f1e72b05 UPSTREAM: drm/bridge: dw-hdmi: Add SCDC and TMDS Scrambling support
Add support for SCDC Setup for TMDS Clock > 3.4GHz and enable TMDS
Scrambling when supported or mandatory.

This patch also adds an helper to setup the control bit to support
the high TMDS Bit Period/TMDS Clock-Period Ratio as required with
TMDS Clock > 3.4GHz for HDMI2.0 3840x2160@60/50 modes.

These changes were based on work done by Huicong Xu <xhc@rock-chips.com>
and Nickey Yang <nickey.yang@rock-chips.com> to support HDMI2.0 modes
on the Rockchip 4.4 BSP kernel at [1]

[1] https://github.com/rockchip-linux/kernel/tree/release-4.4

Change-Id: I0c98f6b0e05a87018ffb7ced404bbb7433dff87f
Cc: Nickey Yang <nickey.yang@rock-chips.com>
Cc: Huicong Xu <xhc@rock-chips.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1549022873-40549-2-git-send-email-narmstrong@baylibre.com
(cherry picked from commit 264fce6cc2)
2019-07-22 10:42:44 +08:00
Zheng Yang
1063dafafd drm/rockchip: dw-hdmi: fix color depth check in YCBCR420 mode
If sink doesn't support YCBCR420 deep color, we return default
8bit.

In YCBCR420 mode, tmdsclock is half of RGB444 mode.

Change-Id: Ie3a1f8ca4bbe4b3bae5d7c9ea823fc798721a73a
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-07-22 10:42:44 +08:00
Zheng Yang
2d2d0ed94d drm/rockchip: hdmi: add color depth and output mode capacity property
Change-Id: I878780df5c1c81094498be2e7b4b3a22da0bfd4e
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-07-22 10:42:43 +08:00
Zheng Yang
49eecef6cf 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>
2019-07-22 10:42:43 +08:00
Zheng Yang
9f34fe8ff5 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>
2019-07-22 10:42:43 +08:00
Zheng Yang
ba6dac44cc 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>
2019-07-22 10:42:43 +08:00
Zheng Yang
e3cb24ea22 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>
2019-07-22 10:42:42 +08:00
Zheng Yang
d149055570 drm: bridge/dw_hdmi: support DRM_MODE_FLAG_DBLCLK
Change-Id: I66d9456d6bde38fcf17d5cd5f6394517e4308a68
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-07-22 10:42:42 +08:00
Zheng Yang
1bec44e234 drm/edid: fix color format when parsing hdmi deep color info
According to HDMI spec 1.4, YCbCr422 is also 36-bit mode, so
we remove the override of color format when parsing hdmi deep
color info. And record hdmi YCbCr444 deep color info in
edid_hdmi_dc_modes.

The edid_hdmi_dc_modes should be clean up when parsing EDID.

Change-Id: Ic5bd3ff5e50b37f04ed4a0688be68bd8259e5af0
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-07-22 10:42:42 +08:00
Algea Cao
076ce0b10a ARM: dts: rk322x: Add rk322x hdmi max tmdsclk
RK322x hdmi max tmdsclk is 371250000.

Change-Id: I19f6f1fabadd4a225ba924761363c221983a1181
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2019-07-22 10:42:41 +08:00