Skip to contentSkip to conversation

Enable rk3066 VOP and HDMI for MK808

PATCH Superseded Johan Jonker 3 participants 9 messages Mar 21, 2019 – Mar 31, 2019 2 messages not in the archive

Subsystems (5)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover Enable rk3066 VOP and HDMI for MK808

For testing only.

Version: V5

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.0-rc8 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/

To get the rk3066 hdmi driver accepted DVI-D support is removed. (Fixed screen size support for DVI-D with extra patch.)

HDMI sound not included.
etc.

///////////////////////////////////////////
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
(add DVI-D support with extra patch)

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 (3):
ARM: dts: rockchip: rk3066a-mk808: enable vop0 and hdmi nodes
dt-bindings: display: rockchip: add document for rk3066 hdmi
drm: rockchip: add fixed screen size DVI-D support 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             | 889 +++++++++++++++++++++
 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, 1283 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 v5 1/5 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      | 866 ++++++++++++++++++++++++++++
 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, 1107 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 +866 -0

866 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

A message that is not in the archive (sent off-list or not yet received): 20190321001440.31057-2-jbx6244-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#3 lore raw

Re: Re: [PATCH v5 1/5] drm: rockchip: introduce rk3066 hdmi

Hi,

On Heiko's request the function rk3066_hdmi_connector_get_modes() was made equel to the inno driver. The variable "sink_is_hdmi" now only changes with valid edid. What happens if we plug in a device with valid hdmi video and then with something wrong with edid then "sink_is_hdmi" never turns false. Shouldn't we add an extra statement in this and in the inno driver that makes sure that "sink_is_hdmi" is false in all other cases? Please advise.

+static int rk3066_hdmi_connector_get_modes(struct drm_connector *connector) +{
+ struct rk3066_hdmi *hdmi = to_rk3066_hdmi(connector);
+ struct edid *edid;
+ int ret = 0;
+
+ if (!hdmi->ddc)
+ return 0;
+

Add extra statement here:

	hdmi->hdmi_data.sink_is_hdmi = false;

+ edid = drm_get_edid(connector, hdmi->ddc);
+ if (edid) {
+ hdmi->hdmi_data.sink_is_hdmi = drm_detect_hdmi_monitor(edid);
+ drm_connector_update_edid_property(connector, edid);
+ ret = drm_add_edid_modes(connector, edid);
+ kfree(edid);
+ }
+
+ return ret;
+}

A message that is not in the archive (sent off-list or not yet received): fe1b8049-37be-f911-ec5e-399875db46fe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#5 lore raw

Re: [PATCH v5 1/5] drm: rockchip: introduce rk3066 hdmi

Hi,

Did some testing on what happens when the function rk3066_hdmi_connector_get_modes()
returns 0 with "hdmi->hdmi_data.sink_is_hdmi = true"

If the connector status is connector_status_connected and without EDID modes, standard VESA DMT modes up to 1024x768 are automatically added (drm_add_modes_noedid()). They are all pruned BAD, because they are not CEA modes.

Finally modes specified via the kernel command line (video=...) are added in addition to what the earlier probes produced (drm_helper_probe_add_cmdline_mode()).
These modes are generated using the VESA GTF/CVT formulas. The encoder is then enabled and setup with GTF modes. "hdmi->hdmi_data.vic = drm_match_cea_mode(mode)" results in CEA mode 0. To prevent further setup it's better to set "hdmi->hdmi_data.sink_is_hdmi = false" in all other cases. Also moved the extra statement before the first return. Please advise.

--------------------------------------------------------------------------------
+static int rk3066_hdmi_connector_get_modes(struct drm_connector *connector) +{
+ struct rk3066_hdmi *hdmi = to_rk3066_hdmi(connector);
+ struct edid *edid;
+ int ret = 0;

Moved extra statement up here:

	hdmi->hdmi_data.sink_is_hdmi = false;

+
+ if (!hdmi->ddc)
+ return 0;
+
+ edid = drm_get_edid(connector, hdmi->ddc);
+ if (edid) {
+ hdmi->hdmi_data.sink_is_hdmi = drm_detect_hdmi_monitor(edid);
+ drm_connector_update_edid_property(connector, edid);
+ ret = drm_add_edid_modes(connector, edid);
+ kfree(edid);
+ }
+
+ return ret;
+}
--------------------------------------------------------------------------------

CONFIG_CMDLINE="console=ttyUSB0,115200n8 console=tty0 video=HDMI-A-1:640x480@60 debug drm.debug=0x3f root=LABEL=linuxroot init=/sbin/init rootfstype=ext4 rootwait"

[    0.504955] [drm:drm_mode_debug_printmodeline] Modeline "640x480": 0
25175 640 656 752 800 480 490 492 525 0x40 0xa
[    0.504989] [drm:drm_mode_prune_invalid] Not using 640x480 mode: BAD
[    0.505018] [drm:drm_mode_debug_printmodeline] Modeline "800x600": 0
36000 800 824 896 1024 600 601 603 625 0x40 0x5
[    0.505047] [drm:drm_mode_prune_invalid] Not using 800x600 mode: BAD
[    0.505074] [drm:drm_mode_debug_printmodeline] Modeline "800x600": 0
40000 800 840 968 1056 600 601 605 628 0x40 0x5
[    0.505103] [drm:drm_mode_prune_invalid] Not using 800x600 mode: BAD
[    0.505129] [drm:drm_mode_debug_printmodeline] Modeline "848x480": 0
33750 848 864 976 1088 480 486 494 517 0x40 0x5
[    0.505157] [drm:drm_mode_prune_invalid] Not using 848x480 mode: BAD
[    0.505184] [drm:drm_mode_debug_printmodeline] Modeline "1024x768": 0
65000 1024 1048 1184 1344 768 771 777 806 0x40 0xa
[    0.505213] [drm:drm_mode_prune_invalid] Not using 1024x768 mode: BAD
[    0.505237] [drm:drm_setup_crtcs] No connectors reported connected
with modes
[    0.505259] [drm:drm_setup_crtcs] connector 35 enabled? yes
[    0.505280] [drm:drm_setup_crtcs] looking for cmdline mode on
connector 35
[    0.505308] [drm:drm_setup_crtcs] found mode 640x480
[    0.505330] [drm:drm_setup_crtcs] picking CRTCs for 4096x4096 config
[    0.505357] [drm:drm_setup_crtcs] desired mode 640x480 set on crtc 32

(0,0)

[    0.512224] rockchip-rk3066-hdmi 10116000.hdmi:
[drm:rk3066_hdmi_encoder_enable] hdmi encoder enable select: vop0
[    0.512317] rockchip-rk3066-hdmi 10116000.hdmi:
[drm:rk3066_hdmi_encoder_enable] >>>> hdmi->hdmi_data.vic: 0 <<<<
[    0.522996] rockchip-rk3066-hdmi 10116000.hdmi:

[drm:rk3066_hdmi_set_power_mode] mode :128

#6 lore raw

PATCH v5 2/5 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
#7 lore raw

PATCH v5 3/5 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
#8 lore raw

PATCH v5 4/5 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
#9 lore raw

PATCH v5 5/5 drm: rockchip: add fixed screen size DVI-D support for rk3066 hdmi

In reply to Johan Jonker

Add fixed screen size DVI-D support
for rk3066 hdmi with an extra patch.

---
 drivers/gpu/drm/rockchip/rk3066_hdmi.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rk3066_hdmi.c +24 -1
index ff8f86152..f656da769 100644
@@ -349,11 +349,12 @@ static int rk3066_hdmi_setup(struct rk3066_hdmi *hdmi,
 	if (hdmi->hdmi_data.sink_is_hdmi) {
 		hdmi_modb(hdmi, HDMI_HDCP_CTRL, HDMI_VIDEO_MODE_MASK,
 			  HDMI_VIDEO_MODE_HDMI);
-		rk3066_hdmi_config_avi(hdmi, mode);
 	} else {
 		hdmi_modb(hdmi, HDMI_HDCP_CTRL, HDMI_VIDEO_MODE_MASK, 0);
 	}
 
+	rk3066_hdmi_config_avi(hdmi, mode);
+
 	rk3066_hdmi_config_phy(hdmi);
 
 	rk3066_hdmi_set_power_mode(hdmi, HDMI_SYS_POWER_MODE_E);
@@ -462,15 +463,26 @@ rk3066_hdmi_connector_detect(struct drm_connector *connector, bool force)
 		connector_status_connected : connector_status_disconnected;
 }
 
+static const struct drm_display_mode edid_cea_modes[] = {
+	/* 4 - 1280x720@60Hz 16:9 */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1390,
+		   1430, 1650, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },
+};
+
 static int rk3066_hdmi_connector_get_modes(struct drm_connector *connector)
 {
 	struct rk3066_hdmi *hdmi = to_rk3066_hdmi(connector);
+	struct drm_display_mode *mode = NULL;
 	struct edid *edid;
 	int ret = 0;
 
 	if (!hdmi->ddc)
 		return 0;
 
+	hdmi->hdmi_data.sink_is_hdmi = false;
+
 	edid = drm_get_edid(connector, hdmi->ddc);
 	if (edid) {
 		hdmi->hdmi_data.sink_is_hdmi = drm_detect_hdmi_monitor(edid);
@@ -479,6 +491,17 @@ static int rk3066_hdmi_connector_get_modes(struct drm_connector *connector)
 		kfree(edid);
 	}
 
+	if ((ret == 0) || (hdmi->hdmi_data.sink_is_hdmi == false)) {
+		hdmi->hdmi_data.sink_is_hdmi = false;
+
+		mode = drm_mode_duplicate(hdmi->drm_dev, &edid_cea_modes[0]);
+		if (!mode)
+			return ret;
+		mode->type |= DRM_MODE_TYPE_PREFERRED;
+		drm_mode_probed_add(connector, mode);
+		ret++;
+	}
+
 	return ret;
 }
 
Signature · 1 line
2.11.0
maintainer
#10 lore raw

Re: [PATCH v5 5/5] drm: rockchip: add fixed screen size DVI-D support for rk3066 hdmi

Hi Johan,

Am Donnerstag, 21. März 2019, 01:14:40 CEST schrieb Johan Jonker:

drivers/gpu/drm/rockchip/rk3066_hdmi.c rk3066_hdmi_connector_detect(struct drm_connector *connector, bool force) · line 472

Quoted 12 lines

Add fixed screen size DVI-D support
for rk3066 hdmi with an extra patch.

drivers/gpu/drm/rockchip/rk3066_hdmi.c +7 -0
+static const struct drm_display_mode edid_cea_modes[] = {
+	/* 4 - 1280x720@60Hz 16:9 */
+	{ DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1390,
+		   1430, 1650, 0, 720, 725, 730, 750, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
+	  .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },
+};

you already dropped this patch from v6, but just for completeness sake, I don't think there should be a static mode for dvi displays.

Similar to hdmi, dvi also can use ddc to read the monitor edid and some sort of static mode might behave badly if for example a display with less than this 720p is connected.

I think I remember reading in the Rockchip tree that they added that for the case reading the edid fails, but if that happens the reading should be fixed and not worked around a failure :-)

Heiko