Skip to contentSkip to conversation

Enable rk3066 VOP and HDMI for MK808

PATCH Applied Johan Jonker 2 participants 9 messages Mar 30, 2019 – Mar 31, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v6 cover Enable rk3066 VOP and HDMI for MK808

For testing only.

Version: V6

Title: Enable rk3066 VOP and HDMI for MK808.

This patch serie only works in combination with a MK808 TV stick and a rk3066 processor. Other boxes and tablets with a rk3066 need extra software for power management and lcd's.

What does it do:

With these kernel patches a MK808 can show 2 penguins and a console on a DVI-D monitor in combination with a framebuffer.

Not tested:

HDMI TV
HDCP
DRM
Xorg
Display managers
Android
etc.

Problems:

DRM functions keep changing every rc.
With v5.1-rc1 the monitor doesn't blank on poweroff, it freezes due to a patch revert some time ago.

drm/rockchip: shutdown drm subsystem on shutdown

    https://patchwork.kernel.org/patch/10556151/
  drm/rockchip: Allow driver to be shutdown on reboot/kexec
    https://patchwork.kernel.org/patch/10556135/
  [for-4.20] Revert "drm/rockchip: Allow driver to be shutdown on reboot/kexec"
    https://patchwork.kernel.org/patch/10714725/

DVI-D monitors without CEA modes can add a fixed mode to the kernel command line as workaround.
For example: video=HDMI-A-1:1280x720@60

HDMI sound not included.
etc.

///////////////////////////////////////////
Changes V6:

rk3066_hdmi.c
add goto err_cleanup_hdmi to rk3066_hdmi_bind function small text style changes

///////////////////////////////////////////
Changes V5:

rockchip,rk3066-hdmi.txt
add Reviewed-by tag

rk3066_hdmi.c
change order in unbind function
add goto err_disable_i2c to rk3066_hdmi_bind function change dev_foobar calls to their DRM_* equivalents remove rk3066_hdmi_i2c_irq function
use define constants in rk3066_hdmi_encoder_enable function add comment to rk3066_hdmi_config_phy function small text style changes
remove DVI-D support

rk3066_hdmi.h
add define constants

///////////////////////////////////////////
Changes V4:

rockchip,rk3066-hdmi.txt
change document name

rk3066_hdmi.c
add more info in commit message
replace deprecated drmP.h include
small text style changes
explain vic variable
remove enc_in_format
change lock name
change regmap name
change cmp name
replace hdmi->dev by dev
use sentinel
use HDMI_VIDEO_VSYNC_OFFSET_SHIFT define
remove unused module macros
change driver name for dmesg

///////////////////////////////////////////
Changes V3:

updated to v5.0-rc8
removed patches that are already added to linux-next

rk3066_hdmi.c
removed gpl text
small style changes
removed unused includes
add include for:
drm_helper_hpd_irq_event drm_helper_probe_single_connector_modes
update drm_hdmi_avi_infoframe_from_display_mode function call

rk3066_hdmi.h
removed gpl text

rk3066a.dtsi
add extra port for hdmi connector node

rk3066a-mk808.dts
add hdmi connector node
connect hdmi_out with hdmi_con_in

rk3066-hdmi.txt
add extra port for hdmi connector node

///////////////////////////////////////////

# How to make rkfs.cpio

find . | cpio -o --format=newc > ../rkfs.cpio

# How to compile/flash

make menuconfig ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- make -j4 ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-

cp ./arch/arm/boot/zImage ../zImage-dtb
cat ./arch/arm/boot/dts/rk3066a-mk808.dtb >> ../zImage-dtb ../tools/rkcrc -k ../zImage-dtb ../mk808.img
sudo ../tools/rkflashtool w 0x4000 0x8000 < ../mk808.img sudo ../tools/rkflashtool b

///////////////////////////////////////////

Johan Jonker (2):
ARM: dts: rockchip: rk3066a-mk808: enable vop0 and hdmi nodes
dt-bindings: display: rockchip: add document for rk3066 hdmi

Zheng Yang (2):
drm: rockchip: introduce rk3066 hdmi
ARM: dts: rockchip: add rk3066 hdmi nodes

 .../display/rockchip/rockchip,rk3066-hdmi.txt      |  72 ++
 arch/arm/boot/dts/rk3066a-mk808.dts                |  29 +
 arch/arm/boot/dts/rk3066a.dtsi                     |  52 ++
 drivers/gpu/drm/rockchip/Kconfig                   |   8 +
 drivers/gpu/drm/rockchip/Makefile                  |   1 +
 drivers/gpu/drm/rockchip/rk3066_hdmi.c             | 869 +++++++++++++++++++++
 drivers/gpu/drm/rockchip/rk3066_hdmi.h             | 229 ++++++
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c        |   2 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h        |   1 +
 9 files changed, 1263 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.txt
 create mode 100644 drivers/gpu/drm/rockchip/rk3066_hdmi.c
 create mode 100644 drivers/gpu/drm/rockchip/rk3066_hdmi.h
Signature · 1 line
2.11.0
#1 lore raw

PATCH v6 1/4 drm: rockchip: introduce rk3066 hdmi

From: Zheng Yang <[email protected]>

The RK3066 HDMI TX serves as interface between a LCD Controller and a HDMI bus. A HDMI TX consists of one HDMI transmitter controller and one HDMI transmitter PHY. The interface has three (3) 8-bit data channels which can be configured for a number of bus widths (8/10/12/16/20/24-bit) and different video formats (RGB, YCbCr).

Features:
HDMI version 1.4a, HDCP revision 1.4 and
DVI version 1.0 compliant transmitter. Supports DTV resolutions from 480i to 1080i/p HD. Master I2C interface for a DDC connection. HDMI TX supports multiple power save modes. The HDMI TX input can switch between LCDC0 and LCDC1. (Sound support is not included in this patch)

---
 drivers/gpu/drm/rockchip/Kconfig            |   8 +
 drivers/gpu/drm/rockchip/Makefile           |   1 +
 drivers/gpu/drm/rockchip/rk3066_hdmi.c      | 869 ++++++++++++++++++++++++++++
 drivers/gpu/drm/rockchip/rk3066_hdmi.h      | 229 ++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c |   2 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h |   1 +
 6 files changed, 1110 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/rk3066_hdmi.c
 create mode 100644 drivers/gpu/drm/rockchip/rk3066_hdmi.h
drivers/gpu/drm/rockchip/Kconfig +8 -0
index 1e75196f9..2cdf3b62d 100644
@@ -77,4 +77,12 @@ config ROCKCHIP_RGB
 	  Some Rockchip CRTCs, like rv1108, can directly output parallel
 	  and serial RGB format to panel or connect to a conversion chip.
 	  say Y to enable its driver.
+
+config ROCKCHIP_RK3066_HDMI
+	bool "Rockchip specific extensions for RK3066 HDMI"
+	depends on DRM_ROCKCHIP
+	help
+	  This selects support for Rockchip SoC specific extensions
+	  for the RK3066 HDMI driver. If you want to enable
+	  HDMI on RK3066 based SoC, you should select this option.
 endif
drivers/gpu/drm/rockchip/Makefile +1 -0
index f6fc9d5dd..524684ba7 100644
@@ -15,5 +15,6 @@ rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi-rockchip.o
 rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
 rockchipdrm-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o
 rockchipdrm-$(CONFIG_ROCKCHIP_RGB) += rockchip_rgb.o
+rockchipdrm-$(CONFIG_ROCKCHIP_RK3066_HDMI) += rk3066_hdmi.o
 
 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o
drivers/gpu/drm/rockchip/rk3066_hdmi.c new file +869 -0

869 lines not on this page · raw message

drivers/gpu/drm/rockchip/rk3066_hdmi.h new file +229 -0

229 lines not on this page · raw message

drivers/gpu/drm/rockchip/rockchip_drm_drv.c +2 -0
index d7fa17f12..8d7a634c1 100644
@@ -486,6 +486,8 @@ static int __init rockchip_drm_init(void)
 	ADD_ROCKCHIP_SUB_DRIVER(dw_mipi_dsi_rockchip_driver,
 				CONFIG_ROCKCHIP_DW_MIPI_DSI);
 	ADD_ROCKCHIP_SUB_DRIVER(inno_hdmi_driver, CONFIG_ROCKCHIP_INNO_HDMI);
+	ADD_ROCKCHIP_SUB_DRIVER(rk3066_hdmi_driver,
+				CONFIG_ROCKCHIP_RK3066_HDMI);
 
 	ret = platform_register_drivers(rockchip_sub_drivers,
 					num_rockchip_sub_drivers);
drivers/gpu/drm/rockchip/rockchip_drm_drv.h +1 -0
index ce48568ec..e4bc4322b 100644
@@ -73,4 +73,5 @@ extern struct platform_driver inno_hdmi_driver;
 extern struct platform_driver rockchip_dp_driver;
 extern struct platform_driver rockchip_lvds_driver;
 extern struct platform_driver vop_platform_driver;
+extern struct platform_driver rk3066_hdmi_driver;
 #endif /* _ROCKCHIP_DRM_DRV_H_ */
Signature · 1 line
2.11.0
maintainer Applied
#2 lore raw

Re: [PATCH v6 1/4] drm: rockchip: introduce rk3066 hdmi

Hi Johan,

Am Samstag, 30. März 2019, 10:56:36 CEST schrieb Johan Jonker:

Quoted 17 lines

From: Zheng Yang <[email protected]>

The RK3066 HDMI TX serves as interface between a LCD Controller and a HDMI bus. A HDMI TX consists of one HDMI transmitter controller and one HDMI transmitter PHY. The interface has three (3) 8-bit data channels which can be configured for a number of bus widths (8/10/12/16/20/24-bit) and different video formats (RGB, YCbCr).

Features:
HDMI version 1.4a, HDCP revision 1.4 and
DVI version 1.0 compliant transmitter. Supports DTV resolutions from 480i to 1080i/p HD. Master I2C interface for a DDC connection. HDMI TX supports multiple power save modes. The HDMI TX input can switch between LCDC0 and LCDC1. (Sound support is not included in this patch)

Quoted 2 lines

applied to drm-misc-next with a smallish change as described below, please double check. [0]

drivers/gpu/drm/rockchip/rk3066_hdmi.c line 508

Quoted 4 lines
drivers/gpu/drm/rockchip/rk3066_hdmi.c new file +4 -0
+static int
+rk3066_hdmi_probe_single_connector_modes(struct drm_connector *connector,
+					 uint32_t maxX, uint32_t maxY)
+{

instead of

drivers/gpu/drm/rockchip/rk3066_hdmi.c line 509

Quoted 1 line
drivers/gpu/drm/rockchip/rk3066_hdmi.c new file +1 -0
+	return drm_helper_probe_single_connector_modes(connector, 1920, 1080);

it is now doing

+ if (maxX > 1920)
+ maxX = 1920;
+ if (maxY > 1080)
+ maxY = 1080;
+
+ return drm_helper_probe_single_connector_modes(connector, maxX, maxY);

to take into account maxX / maxY being already below 1920x1080

Quoted 1 line

+}

Heiko

[0] https://cgit.freedesktop.org/drm/drm-misc/commit/?id=f84d3d37b7fbb022e33b79d54374466f6fbc7186

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

PATCH v6 2/4 ARM: dts: rockchip: add rk3066 hdmi nodes

In reply to Johan Jonker

From: Zheng Yang <[email protected]>

This patch adds the hdmi nodes to rk3066.

---
 arch/arm/boot/dts/rk3066a.dtsi | 52 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm/boot/dts/rk3066a.dtsi +52 -0
index 653127a37..9c43b985a 100644
@@ -80,6 +80,10 @@
 		vop0_out: port {
 			#address-cells = <1>;
 			#size-cells = <0>;
+			vop0_out_hdmi: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&hdmi_in_vop0>;
+			};
 		};
 	};
 
@@ -101,6 +105,44 @@
 		vop1_out: port {
 			#address-cells = <1>;
 			#size-cells = <0>;
+			vop1_out_hdmi: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&hdmi_in_vop1>;
+			};
+		};
+	};
+
+	hdmi: hdmi@10116000 {
+		compatible = "rockchip,rk3066-hdmi";
+		reg = <0x10116000 0x2000>;
+		interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru HCLK_HDMI>;
+		clock-names = "hclk";
+		power-domains = <&power RK3066_PD_VIO>;
+		rockchip,grf = <&grf>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&hdmii2c_xfer>, <&hdmi_hpd>;
+		status = "disabled";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			hdmi_in: port@0 {
+				reg = <0>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				hdmi_in_vop0: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&vop0_out_hdmi>;
+				};
+				hdmi_in_vop1: endpoint@1 {
+					reg = <1>;
+					remote-endpoint = <&vop1_out_hdmi>;
+				};
+			};
+			hdmi_out: port@1 {
+				reg = <1>;
+			};
 		};
 	};
 
@@ -415,6 +457,16 @@
 			};
 		};
 
+		hdmi {
+			hdmi_hpd: hdmi-hpd {
+				rockchip,pins = <0 RK_PA0 1 &pcfg_pull_default>;
+			};
+			hdmii2c_xfer: hdmii2c-xfer {
+				rockchip,pins = <0 RK_PA1 1 &pcfg_pull_none>,
+						<0 RK_PA2 1 &pcfg_pull_none>;
+			};
+		};
+
 		pwm0 {
 			pwm0_out: pwm0-out {
 				rockchip,pins = <RK_GPIO0 3 RK_FUNC_1 &pcfg_pull_none>;
Signature · 1 line
2.11.0
#5 lore raw

PATCH v6 3/4 ARM: dts: rockchip: rk3066a-mk808: enable vop0 and hdmi nodes

In reply to Johan Jonker

This patch enables the vop0 and hdmi nodes
for a MK808 with rk3066 processor.

---
 arch/arm/boot/dts/rk3066a-mk808.dts | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
arch/arm/boot/dts/rk3066a-mk808.dts +29 -0
index 9d2216d71..8bc259d3e 100644
@@ -30,6 +30,17 @@
 		};
 	};
 
+	hdmi_con {
+		compatible = "hdmi-connector";
+		type = "c";
+
+		port {
+			hdmi_con_in: endpoint {
+				remote-endpoint = <&hdmi_out_con>;
+			};
+		};
+	};
+
 	vcc_io: vcc-io {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc_io";
@@ -91,6 +102,20 @@
 	};
 };
 
+&hdmi {
+	status = "okay";
+};
+
+&hdmi_in_vop1 {
+	status = "disabled";
+};
+
+&hdmi_out {
+	hdmi_out_con: endpoint {
+		remote-endpoint = <&hdmi_con_in>;
+	};
+};
+
 &mmc0 {
 	bus-width = <4>;
 	cap-mmc-highspeed;
@@ -150,6 +175,10 @@
 	status = "okay";
 };
 
+&vop0 {
+	status = "okay";
+};
+
 &wdt {
 	status = "okay";
 };
Signature · 1 line
2.11.0
maintainer
#6 lore raw

Re: [PATCH v6 3/4] ARM: dts: rockchip: rk3066a-mk808: enable vop0 and hdmi nodes

Am Samstag, 30. März 2019, 10:56:38 CEST schrieb Johan Jonker:

Quoted 4 lines

This patch enables the vop0 and hdmi nodes
for a MK808 with rk3066 processor.

applied for 5.2

Thanks
Heiko

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

PATCH v6 4/4 dt-bindings: display: rockchip: add document for rk3066 hdmi

In reply to Johan Jonker

This patch adds a binding that describes the HDMI controller for rk3066.

---
 .../display/rockchip/rockchip,rk3066-hdmi.txt      | 72 ++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.txt
Documentation/devicetree/bindings/display/rockchip/rockchip,rk3066-hdmi.txt new file +72 -0
new file mode 100644
index 000000000..d1ad31bca
@@ -0,0 +1,72 @@
+Rockchip specific extensions for rk3066 HDMI
+============================================
+
+Required properties:
+- compatible:
+	"rockchip,rk3066-hdmi";
+- reg:
+	Physical base address and length of the controller's registers.
+- clocks, clock-names:
+	Phandle to HDMI controller clock, name should be "hclk".
+- interrupts:
+	HDMI interrupt number.
+- power-domains:
+	Phandle to the RK3066_PD_VIO power domain.
+- rockchip,grf:
+	This soc uses GRF regs to switch the HDMI TX input between vop0 and vop1.
+- ports:
+	Contains one port node with two endpoints, numbered 0 and 1,
+	connected respectively to vop0 and vop1.
+	Contains one port node with one endpoint
+	connected to a hdmi-connector node.
+- pinctrl-0, pinctrl-name:
+	Switch the iomux for the HPD/I2C pins to HDMI function.
+
+Example:
+	hdmi: hdmi@10116000 {
+		compatible = "rockchip,rk3066-hdmi";
+		reg = <0x10116000 0x2000>;
+		interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru HCLK_HDMI>;
+		clock-names = "hclk";
+		power-domains = <&power RK3066_PD_VIO>;
+		rockchip,grf = <&grf>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&hdmii2c_xfer>, <&hdmi_hpd>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			hdmi_in: port@0 {
+				reg = <0>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				hdmi_in_vop0: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&vop0_out_hdmi>;
+				};
+				hdmi_in_vop1: endpoint@1 {
+					reg = <1>;
+					remote-endpoint = <&vop1_out_hdmi>;
+				};
+			};
+			hdmi_out: port@1 {
+				reg = <1>;
+				hdmi_out_con: endpoint {
+					remote-endpoint = <&hdmi_con_in>;
+				};
+			};
+		};
+	};
+
+&pinctrl {
+		hdmi {
+			hdmi_hpd: hdmi-hpd {
+				rockchip,pins = <0 RK_PA0 1 &pcfg_pull_default>;
+			};
+			hdmii2c_xfer: hdmii2c-xfer {
+				rockchip,pins = <0 RK_PA1 1 &pcfg_pull_none>,
+						<0 RK_PA2 1 &pcfg_pull_none>;
+			};
+		};
+};
Signature · 1 line
2.11.0
maintainer Applied
#8 lore raw

Re: [PATCH v6 4/4] dt-bindings: display: rockchip: add document for rk3066 hdmi

Am Samstag, 30. März 2019, 10:56:39 CEST schrieb Johan Jonker:

Quoted 5 lines

This patch adds a binding that describes the HDMI controller for rk3066.

applied to drm-misc-next, so should land in 5.2

Thanks
Heiko