Skip to contentSkip to conversation

Add Synopsys DesignWare HDMI RX Controller

PATCH Superseded Dmitry Osipenko 2 participants 15 messages Feb 15, 2025 – Feb 17, 2025

Subsystems (4)

v6 of 13 Superseded Latest is v13 →

lore
Share & tools
lore

Dmitry Osipenko

author maintainer
#0 lore raw

v6 cover Add Synopsys DesignWare HDMI RX Controller

This series implements support for the Synopsys DesignWare HDMI RX Controller, being compliant with standard HDMI 1.4b and HDMI 2.0.

Features that are currently supported by the HDMI RX driver have been tested on rock5b board using a HDMI to micro-HDMI cable. It is recommended to use a good quality cable as there were multiple issues seen during testing the driver.

Please note the below information :-
* HDMIRX driver now only works with the opensource TF-A.
* We have tested the working of OBS studio with HDMIRX driver and there were no issues seen.
* We tested and verified the support for interlaced video.
* We tested capturing of YUV formats.

To test the HDMI RX Controller driver, following example commands can be used :-

root@debian-rockchip-rock5b-rk3588:~# v4l2-ctl --verbose -d /dev/video0 \
--set-fmt-video=width=1920,height=1080,pixelformat='BGR3' --stream-mmap=4 \
--stream-skip=3 --stream-count=100 --stream-to=/home/hdmiin4k.raw --stream-poll
root@debian-rockchip-rock5b-rk3588:~# ffmpeg -f rawvideo -vcodec rawvideo \
-s 1920x1080 -r 60 -pix_fmt bgr24 -i /home/hdmiin4k.raw output.mkv

CEC compliance test results :-

* https://gitlab.collabora.com/-/snippets/380
* https://gitlab.collabora.com/-/snippets/381

Following is the v4l2-compliance test result :-

root@debian-rockchip-rock5b-rk3588:~# v4l2-compliance -d /dev/video1
v4l2-compliance 1.29.0-5326, 64 bits, 64-bit time_t
v4l2-compliance SHA: 77f5df419204 2025-02-07 08:59:59

Compliance test for snps_hdmirx device /dev/video1:

Driver Info:

        Driver name      : snps_hdmirx
        Card type        : snps_hdmirx
        Bus info         : platform:fdee0000.hdmi_receiver
        Driver version   : 6.14.0
        Capabilities     : 0x84201000

Video Capture Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04201000
Video Capture Multiplanar
Streaming
Extended Pix Format

Required ioctls:
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK

Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK test VIDIOC_DV_TIMINGS_CAP: OK
test VIDIOC_G/S_EDID: OK

Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 4 Private Controls: 0

Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)

Codec ioctls (Input 0):
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK

Test input 0:

Streaming ioctls:
test read/write: OK (Not Supported)
test MMAP (no poll, REQBUFS): OK
test MMAP (select, REQBUFS): OK
test MMAP (epoll, REQBUFS): OK
test MMAP (no poll, CREATE_BUFS): OK test MMAP (select, CREATE_BUFS): OK
test MMAP (epoll, CREATE_BUFS): OK
test USERPTR (no poll): OK (Not Supported) test USERPTR (select): OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device

Total for snps_hdmirx device /dev/video1: 57, Succeeded: 57, Failed: 0, Warnings: 0

---

Changes in v6 :-
- Driver now keeps HPD low instead of zeroing EDID when EDID-clearing is invoked and when default EDID usage is disabled in the kernel config
- Added InfoFrame debugfs support
- Added another code comment clarifying validation of timing values
- Rebased on top of recent media-next tree

Changes in v5 :-
- Fix the interrupt IRQ number in the dt-bindings and device tree
- Add alignment property to ensure hdmi-receiver-cma starts at a 64KB-aligned address
- Change the MODULE_DESCRIPTION
- Add VIDEO_SYNOPSYS_HDMIRX as prefix to the default edid config
- Drop the enabling of default edid in the Kconfig
- Replace the default EDID with hdmi-4k-300mhz EDID produced by v4l2-ctl tool for better compatibility with various HDMI cables and adapters
- Rework the write_edid and set_edid functions
- During format change, retrieve the current pixel format, color depth, and AVI infoframe details instead of only detecting the format
- Improve the logging mechanism and delays in the hdmirx_wait_signal_lock function
- Fix the 4K@60 capturing for RGB format
- Document what hdmirx_check_timing_valid function does
- Rework the hdmirx_get_detected_timings function
- Fix the NV16/24 size image value
- Add the implementation from Benjamin Hoff to expose the ITC type to v4l2
- Remove all the firmware related code

Changes in v4 :-
- Remove DTS changes included in the device tree patch
- Remove the hdmi rx pin info as it's already present in the rk3588-base-pinctrl.dtsi
- Create a separate config option for selecting the EDID and enable it by default
- Improve the comment related to DV timings and move it to the side of hdmirx_get_detected_timings
- Add 100ms delay before pulling the HPD high
- Do not return the detected timings from VIDIOC_G_DV_TIMINGS
- Drop the bus info from hdmirx_querycap
- If *num_planes != 0 then return 0 in hdmirx_queue_setup
- Set queue->min_queued_buffers to 1
- Drop q->allow_cache_hints = 0; as it's always 0 by default
- Add a comment for q->dma_attrs = DMA_ATTR_FORCE_CONTIGUOUS;
- Drop .read = vb2_fop_read as it's not supported by driver
- Remove redundant edid_init_data_600M
- Make HPD low when driver is loaded
- Add support for reading AVI Infoframe
- Remove msg_len checks from hdmirx_cec_transmit
- Add info about the CEC compliance test in the cover letter
- Add arbitration lost status
- Validate the physical address inside the EDID

Changes in v3 :-
- Use v4l2-common helpers in the HDMIRX driver
- Rename cma node and phandle names
- Elaborate the comment to explain 160MiB calculation
- Move &hdmi_receiver_cma to the rock5b dts file
- Add information about interlaced video testing in the cover-letter

Changes in v2 :-
- Fix checkpatch --strict warnings
- Move the dt-binding include file changes in a separate patch
- Add a description for the hardware in the dt-bindings file
- Rename resets, vo1 grf and HPD properties
- Add a proper description for grf and vo1-grf phandles in the bindings
- Rename the HDMI RX node name to hdmi-receiver
- Include gpio header file in binding example to fix the dt_binding_check failure
- Move hdmirx_cma node to the rk3588.dtsi file
- Add an entry to MAINTAINERS file for the HDMIRX driver

Sebastian Reichel (2):
arm64: defconfig: Enable Synopsys HDMI receiver
arm64: dts: rockchip: Enable HDMI receiver on rock-5b

Shreeya Patel (4):
MAINTAINERS: Add entry for Synopsys DesignWare HDMI RX Driver
dt-bindings: media: Document bindings for HDMI RX Controller
arm64: dts: rockchip: Add device tree support for HDMI RX Controller
media: platform: synopsys: Add support for HDMI input driver

 .../bindings/media/snps,dw-hdmi-rx.yaml       |  132 +
 MAINTAINERS                                   |    8 +
 .../dts/rockchip/rk3588-base-pinctrl.dtsi     |   14 +
 .../arm64/boot/dts/rockchip/rk3588-extra.dtsi |   57 +
 .../boot/dts/rockchip/rk3588-rock-5b.dts      |   18 +
 arch/arm64/configs/defconfig                  |    1 +
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/synopsys/Kconfig       |    3 +
 drivers/media/platform/synopsys/Makefile      |    2 +
 .../media/platform/synopsys/hdmirx/Kconfig    |   27 +
 .../media/platform/synopsys/hdmirx/Makefile   |    4 +
 .../platform/synopsys/hdmirx/snps_hdmirx.c    | 2715 +++++++++++++++++
 .../platform/synopsys/hdmirx/snps_hdmirx.h    |  394 +++
 .../synopsys/hdmirx/snps_hdmirx_cec.c         |  284 ++
 .../synopsys/hdmirx/snps_hdmirx_cec.h         |   44 +
 16 files changed, 3705 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml
 create mode 100644 drivers/media/platform/synopsys/Kconfig
 create mode 100644 drivers/media/platform/synopsys/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Kconfig
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h
Signature · 7 lines
2.48.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
author maintainer
#1 lore raw

PATCH v6 1/6 MAINTAINERS: Add entry for Synopsys DesignWare HDMI RX Driver

From: Shreeya Patel <[email protected]>

Add an entry for Synopsys DesignWare HDMI Receiver Controller Driver.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index 896a307fa065..d73ddb317b11 100644
@@ -22942,6 +22942,14 @@ F:	drivers/net/pcs/pcs-xpcs.c
 F:	drivers/net/pcs/pcs-xpcs.h
 F:	include/linux/pcs/pcs-xpcs.h
 
+SYNOPSYS DESIGNWARE HDMI RX CONTROLLER DRIVER
+M:	Shreeya Patel <[email protected]>
+L:	[email protected]
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml
+F:	drivers/media/platform/synopsys/hdmirx/*
+
 SYNOPSYS DESIGNWARE I2C DRIVER
 M:	Jarkko Nikula <[email protected]>
 R:	Andy Shevchenko <[email protected]>
Signature · 7 lines
2.48.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
author maintainer
#2 lore raw

PATCH v6 2/6 dt-bindings: media: Document bindings for HDMI RX Controller

In reply to Dmitry Osipenko

From: Shreeya Patel <[email protected]>

Document bindings for the Synopsys DesignWare HDMI RX Controller.

---
 .../bindings/media/snps,dw-hdmi-rx.yaml       | 132 ++++++++++++++++++
 1 file changed, 132 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml
Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml new file +132 -0
new file mode 100644
index 000000000000..510e94e9ca3a
@@ -0,0 +1,132 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Device Tree bindings for Synopsys DesignWare HDMI RX Controller
+
+---
+$id: http://devicetree.org/schemas/media/snps,dw-hdmi-rx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys DesignWare HDMI RX Controller
+
+maintainers:
+  - Shreeya Patel <[email protected]>
+
+description:
+  Synopsys DesignWare HDMI Input Controller preset on RK3588 SoCs
+  allowing devices to receive and decode high-resolution video streams
+  from external sources like media players, cameras, laptops, etc.
+
+properties:
+  compatible:
+    items:
+      - const: rockchip,rk3588-hdmirx-ctrler
+      - const: snps,dw-hdmi-rx
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 3
+
+  interrupt-names:
+    items:
+      - const: cec
+      - const: hdmi
+      - const: dma
+
+  clocks:
+    maxItems: 7
+
+  clock-names:
+    items:
+      - const: aclk
+      - const: audio
+      - const: cr_para
+      - const: pclk
+      - const: ref
+      - const: hclk_s_hdmirx
+      - const: hclk_vo1
+
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 4
+
+  reset-names:
+    items:
+      - const: axi
+      - const: apb
+      - const: ref
+      - const: biu
+
+  memory-region:
+    maxItems: 1
+
+  hpd-gpios:
+    description: GPIO specifier for HPD.
+    maxItems: 1
+
+  rockchip,grf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      The phandle of the syscon node for the general register file
+      containing HDMIRX PHY status bits.
+
+  rockchip,vo1-grf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      The phandle of the syscon node for the Video Output GRF register
+      to enable EDID transfer through SDAIN and SCLIN.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+  - clocks
+  - clock-names
+  - power-domains
+  - resets
+  - pinctrl-0
+  - hpd-gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/rockchip,rk3588-cru.h>
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/rk3588-power.h>
+    #include <dt-bindings/reset/rockchip,rk3588-cru.h>
+    hdmi_receiver: hdmi-receiver@fdee0000 {
+      compatible = "rockchip,rk3588-hdmirx-ctrler", "snps,dw-hdmi-rx";
+      reg = <0xfdee0000 0x6000>;
+      interrupts = <GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH 0>,
+                   <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH 0>,
+                   <GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH 0>;
+      interrupt-names = "cec", "hdmi", "dma";
+      clocks = <&cru ACLK_HDMIRX>,
+               <&cru CLK_HDMIRX_AUD>,
+               <&cru CLK_CR_PARA>,
+               <&cru PCLK_HDMIRX>,
+               <&cru CLK_HDMIRX_REF>,
+               <&cru PCLK_S_HDMIRX>,
+               <&cru HCLK_VO1>;
+      clock-names = "aclk",
+                    "audio",
+                    "cr_para",
+                    "pclk",
+                    "ref",
+                    "hclk_s_hdmirx",
+                    "hclk_vo1";
+      power-domains = <&power RK3588_PD_VO1>;
+      resets = <&cru SRST_A_HDMIRX>, <&cru SRST_P_HDMIRX>,
+               <&cru SRST_HDMIRX_REF>, <&cru SRST_A_HDMIRX_BIU>;
+      reset-names = "axi", "apb", "ref", "biu";
+      memory-region = <&hdmi_receiver_cma>;
+      pinctrl-0 = <&hdmim1_rx_cec &hdmim1_rx_hpdin &hdmim1_rx_scl &hdmim1_rx_sda &hdmirx_5v_detection>;
+      pinctrl-names = "default";
+      hpd-gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
+    };
Signature · 7 lines
2.48.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
author maintainer
#3 lore raw

PATCH v6 3/6 arm64: dts: rockchip: Add device tree support for HDMI RX Controller

In reply to Dmitry Osipenko

From: Shreeya Patel <[email protected]>

Add device tree support for Synopsys DesignWare HDMI RX Controller.

---
 .../dts/rockchip/rk3588-base-pinctrl.dtsi     | 14 +++++
 .../arm64/boot/dts/rockchip/rk3588-extra.dtsi | 57 +++++++++++++++++++
 2 files changed, 71 insertions(+)
arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi +14 -0
index 7f874c77410c..2d4b9986a177 100644
@@ -594,6 +594,20 @@ hdmim0_tx1_hpd: hdmim0-tx1-hpd {
 				/* hdmim0_tx1_hpd */
 				<1 RK_PA6 5 &pcfg_pull_none>;
 		};
+
+		/omit-if-no-ref/
+		hdmim1_rx: hdmim1-rx {
+			rockchip,pins =
+				/* hdmim1_rx_cec */
+				<3 RK_PD1 5 &pcfg_pull_none>,
+				/* hdmim1_rx_scl */
+				<3 RK_PD2 5 &pcfg_pull_none_smt>,
+				/* hdmim1_rx_sda */
+				<3 RK_PD3 5 &pcfg_pull_none_smt>,
+				/* hdmim1_rx_hpdin */
+				<3 RK_PD4 5 &pcfg_pull_none>;
+		};
+
 		/omit-if-no-ref/
 		hdmim1_rx_cec: hdmim1-rx-cec {
 			rockchip,pins =
arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi +57 -0

69 lines not on this page · raw message

Signature · 7 lines
2.48.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
author maintainer
#4 lore raw

PATCH v6 4/6 media: platform: synopsys: Add support for HDMI input driver

In reply to Dmitry Osipenko

From: Shreeya Patel <[email protected]>

Add initial support for the Synopsys DesignWare HDMI RX Controller Driver used by Rockchip RK3588. The driver supports:
- HDMI 1.4b and 2.0 modes (HDMI 4k@60Hz)
- RGB888, YUV422, YUV444 and YCC420 pixel formats
- CEC
- EDID configuration

The hardware also has Audio and HDCP capabilities, but these are not yet supported by the driver.

---
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/synopsys/Kconfig       |    3 +
 drivers/media/platform/synopsys/Makefile      |    2 +
 .../media/platform/synopsys/hdmirx/Kconfig    |   27 +
 .../media/platform/synopsys/hdmirx/Makefile   |    4 +
 .../platform/synopsys/hdmirx/snps_hdmirx.c    | 2715 +++++++++++++++++
 .../platform/synopsys/hdmirx/snps_hdmirx.h    |  394 +++
 .../synopsys/hdmirx/snps_hdmirx_cec.c         |  284 ++
 .../synopsys/hdmirx/snps_hdmirx_cec.h         |   44 +
 10 files changed, 3475 insertions(+)
 create mode 100644 drivers/media/platform/synopsys/Kconfig
 create mode 100644 drivers/media/platform/synopsys/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Kconfig
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h
drivers/media/platform/Kconfig +1 -0
index 85d2627776b6..9287faafdce5 100644
@@ -85,6 +85,7 @@ source "drivers/media/platform/rockchip/Kconfig"
 source "drivers/media/platform/samsung/Kconfig"
 source "drivers/media/platform/st/Kconfig"
 source "drivers/media/platform/sunxi/Kconfig"
+source "drivers/media/platform/synopsys/Kconfig"
 source "drivers/media/platform/ti/Kconfig"
 source "drivers/media/platform/verisilicon/Kconfig"
 source "drivers/media/platform/via/Kconfig"
drivers/media/platform/Makefile +1 -0
index ace4e34483dd..6fd7db0541c7 100644
@@ -28,6 +28,7 @@ obj-y += rockchip/
 obj-y += samsung/
 obj-y += st/
 obj-y += sunxi/
+obj-y += synopsys/
 obj-y += ti/
 obj-y += verisilicon/
 obj-y += via/
drivers/media/platform/synopsys/Kconfig new file +3 -0
new file mode 100644
index 000000000000..4fd521f78425
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+source "drivers/media/platform/synopsys/hdmirx/Kconfig"
drivers/media/platform/synopsys/Makefile new file +2 -0
new file mode 100644
index 000000000000..3b12c574dd67
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-y += hdmirx/
drivers/media/platform/synopsys/hdmirx/Kconfig new file +27 -0
new file mode 100644
index 000000000000..3f96f6c97cf0
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0
+
+config VIDEO_SYNOPSYS_HDMIRX
+	tristate "Synopsys DesignWare HDMI Receiver driver"
+	depends on VIDEO_DEV
+	select MEDIA_CONTROLLER
+	select VIDEO_V4L2_SUBDEV_API
+	select VIDEOBUF2_DMA_CONTIG
+	select CEC_CORE
+	select CEC_NOTIFIER
+	select HDMI
+	help
+	  Support for Synopsys HDMI HDMI RX Controller.
+	  This driver supports HDMI 2.0 version.
+
+	  To compile this driver as a module, choose M here. The module
+	  will be called synopsys_hdmirx.
+
+config VIDEO_SYNOPSYS_HDMIRX_LOAD_DEFAULT_EDID
+	bool "Load default EDID"
+	depends on VIDEO_SYNOPSYS_HDMIRX
+	help
+	  Preload default EDID (Extended Display Identification Data).
+	  EDID contains information about the capabilities of the display,
+	  such as supported resolutions, refresh rates, and audio formats.
+
+	  Enabling this option is recommended for a non-production use-cases.
drivers/media/platform/synopsys/hdmirx/Makefile new file +4 -0
new file mode 100644
index 000000000000..2fa2d9e25300
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+synopsys-hdmirx-objs := snps_hdmirx.o snps_hdmirx_cec.o
+
+obj-$(CONFIG_VIDEO_SYNOPSYS_HDMIRX) += synopsys-hdmirx.o
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +2715 -0

2,715 lines not on this page · raw message

drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h new file +394 -0

235 lines not on this page · raw message

drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c new file +284 -0

284 lines not on this page · raw message

drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h new file +44 -0

44 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 7 lines
2.48.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

Part of the diff is not shown here. View the raw message.

#5 lore raw

Re: [PATCH v6 4/6] media: platform: synopsys: Add support for HDMI input driver

Quoted 38 lines · Dmitry Osipenko

From: Shreeya Patel <[email protected]>

Add initial support for the Synopsys DesignWare HDMI RX Controller Driver used by Rockchip RK3588. The driver supports:
- HDMI 1.4b and 2.0 modes (HDMI 4k@60Hz)
- RGB888, YUV422, YUV444 and YCC420 pixel formats
- CEC
- EDID configuration

The hardware also has Audio and HDCP capabilities, but these are not yet supported by the driver.

---
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/synopsys/Kconfig       |    3 +
 drivers/media/platform/synopsys/Makefile      |    2 +
 .../media/platform/synopsys/hdmirx/Kconfig    |   27 +
 .../media/platform/synopsys/hdmirx/Makefile   |    4 +
 .../platform/synopsys/hdmirx/snps_hdmirx.c    | 2715 +++++++++++++++++
 .../platform/synopsys/hdmirx/snps_hdmirx.h    |  394 +++
 .../synopsys/hdmirx/snps_hdmirx_cec.c         |  284 ++
 .../synopsys/hdmirx/snps_hdmirx_cec.h         |   44 +
 10 files changed, 3475 insertions(+)
 create mode 100644 drivers/media/platform/synopsys/Kconfig
 create mode 100644 drivers/media/platform/synopsys/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Kconfig
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h

<snip>

Quoted 8 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +8 -0
+static ssize_t
+hdmirx_debugfs_if_read(u32 type, void *priv, struct file *filp,
+		       char __user *ubuf, size_t count, loff_t *ppos)
+{
+	struct snps_hdmirx_dev *hdmirx_dev = priv;
+	u8 aviif[3 + 7 * 4];
+	int len;
+

drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c line 1098

Quoted 10 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +10 -0
+	if (type != V4L2_DEBUGFS_IF_AVI)
+		return 0;
+
+	hdmirx_read_avi_infoframe(hdmirx_dev, aviif);
+
+	len = simple_read_from_buffer(ubuf, count, ppos,
+				      aviif, ARRAY_SIZE(aviif));
+
+	return len < 0 ? 0 : len;
+}

Have you tested this with 'edid-decode -c -I /path/to/avi'? Also test that it is empty if there is no AVI InfoFrame (e.g. when there is no incoming video). I don't see a test for that in the code.

I also see no sanity check regarding the length of the InfoFrame, it just outputs the full array, meaning you get padding as well since the AVI InfoFrame is smaller than ARRAY_SIZE(aviif). In fact, edid-decode will fail about that if the -c option is used.

See tc358743_debugfs_if_read of how this is typically handled.

Regards,

Hans

author maintainer
#6 lore raw

Re: [PATCH v6 4/6] media: platform: synopsys: Add support for HDMI input driver

Quoted 65 lines · Hans Verkuil
Quoted 38 lines · Dmitry Osipenko

From: Shreeya Patel <[email protected]>

Add initial support for the Synopsys DesignWare HDMI RX Controller Driver used by Rockchip RK3588. The driver supports:
- HDMI 1.4b and 2.0 modes (HDMI 4k@60Hz)
- RGB888, YUV422, YUV444 and YCC420 pixel formats
- CEC
- EDID configuration

The hardware also has Audio and HDCP capabilities, but these are not yet supported by the driver.

---
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/synopsys/Kconfig       |    3 +
 drivers/media/platform/synopsys/Makefile      |    2 +
 .../media/platform/synopsys/hdmirx/Kconfig    |   27 +
 .../media/platform/synopsys/hdmirx/Makefile   |    4 +
 .../platform/synopsys/hdmirx/snps_hdmirx.c    | 2715 +++++++++++++++++
 .../platform/synopsys/hdmirx/snps_hdmirx.h    |  394 +++
 .../synopsys/hdmirx/snps_hdmirx_cec.c         |  284 ++
 .../synopsys/hdmirx/snps_hdmirx_cec.h         |   44 +
 10 files changed, 3475 insertions(+)
 create mode 100644 drivers/media/platform/synopsys/Kconfig
 create mode 100644 drivers/media/platform/synopsys/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Kconfig
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h

<snip>

Quoted 8 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +8 -0
+static ssize_t
+hdmirx_debugfs_if_read(u32 type, void *priv, struct file *filp,
+		       char __user *ubuf, size_t count, loff_t *ppos)
+{
+	struct snps_hdmirx_dev *hdmirx_dev = priv;
+	u8 aviif[3 + 7 * 4];
+	int len;
+

drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c line 1098

Quoted 10 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +10 -0
+	if (type != V4L2_DEBUGFS_IF_AVI)
+		return 0;
+
+	hdmirx_read_avi_infoframe(hdmirx_dev, aviif);
+
+	len = simple_read_from_buffer(ubuf, count, ppos,
+				      aviif, ARRAY_SIZE(aviif));
+
+	return len < 0 ? 0 : len;
+}

Have you tested this with 'edid-decode -c -I /path/to/avi'? Also test that it is empty if there is no AVI InfoFrame (e.g. when there is no incoming video). I don't see a test for that in the code.

Quoted 6 lines

I also see no sanity check regarding the length of the InfoFrame, it just outputs the full array, meaning you get padding as well since the AVI InfoFrame is smaller than ARRAY_SIZE(aviif). In fact, edid-decode will fail about that if the -c option is used.

See tc358743_debugfs_if_read of how this is typically handled.

I've tested with 'edid-decode -I /path/to/avi', including the empty AVI InfoFrame. But without the '-c option'. I'd expect that debugfs should provide a full-sized raw InfoFrame data, rather than a parsed version. The parsed data isn't much useful for debugging purposes, IMO. I intentionally removed the size check that tc358743_debugfs_if_read does because it appeared wrong to me. Will re-check with '-c option', thanks!

Signature · 2 lines
Best regards,
Dmitry
#7 lore raw

Re: [PATCH v6 4/6] media: platform: synopsys: Add support for HDMI input driver

Quoted 71 lines · Dmitry Osipenko
Quoted 70 lines · Hans Verkuil
Quoted 38 lines · Dmitry Osipenko

From: Shreeya Patel <[email protected]>

Add initial support for the Synopsys DesignWare HDMI RX Controller Driver used by Rockchip RK3588. The driver supports:
- HDMI 1.4b and 2.0 modes (HDMI 4k@60Hz)
- RGB888, YUV422, YUV444 and YCC420 pixel formats
- CEC
- EDID configuration

The hardware also has Audio and HDCP capabilities, but these are not yet supported by the driver.

---
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/synopsys/Kconfig       |    3 +
 drivers/media/platform/synopsys/Makefile      |    2 +
 .../media/platform/synopsys/hdmirx/Kconfig    |   27 +
 .../media/platform/synopsys/hdmirx/Makefile   |    4 +
 .../platform/synopsys/hdmirx/snps_hdmirx.c    | 2715 +++++++++++++++++
 .../platform/synopsys/hdmirx/snps_hdmirx.h    |  394 +++
 .../synopsys/hdmirx/snps_hdmirx_cec.c         |  284 ++
 .../synopsys/hdmirx/snps_hdmirx_cec.h         |   44 +
 10 files changed, 3475 insertions(+)
 create mode 100644 drivers/media/platform/synopsys/Kconfig
 create mode 100644 drivers/media/platform/synopsys/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Kconfig
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h

<snip>

Quoted 8 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +8 -0
+static ssize_t
+hdmirx_debugfs_if_read(u32 type, void *priv, struct file *filp,
+		       char __user *ubuf, size_t count, loff_t *ppos)
+{
+	struct snps_hdmirx_dev *hdmirx_dev = priv;
+	u8 aviif[3 + 7 * 4];
+	int len;
+

drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c line 1098

Quoted 10 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +10 -0
+	if (type != V4L2_DEBUGFS_IF_AVI)
+		return 0;
+
+	hdmirx_read_avi_infoframe(hdmirx_dev, aviif);
+
+	len = simple_read_from_buffer(ubuf, count, ppos,
+				      aviif, ARRAY_SIZE(aviif));
+
+	return len < 0 ? 0 : len;
+}

Have you tested this with 'edid-decode -c -I /path/to/avi'? Also test that it is empty if there is no AVI InfoFrame (e.g. when there is no incoming video). I don't see a test for that in the code.

I also see no sanity check regarding the length of the InfoFrame, it just outputs the full array, meaning you get padding as well since the AVI InfoFrame is smaller than ARRAY_SIZE(aviif). In fact, edid-decode will fail about that if the -c option is used.

Quoted 8 lines
Quoted 1 line

See tc358743_debugfs_if_read of how this is typically handled.

I've tested with 'edid-decode -I /path/to/avi', including the empty AVI InfoFrame. But without the '-c option'. I'd expect that debugfs should provide a full-sized raw InfoFrame data, rather than a parsed version. The parsed data isn't much useful for debugging purposes, IMO. I intentionally removed the size check that tc358743_debugfs_if_read does because it appeared wrong to me. Will re-check with '-c option', thanks!

The HDMI header contains the actual length that was received. So debugfs should export the actual payload, not the maximum possible payload.

It is common for hardware to reserve room in the register map for the maximum payload, but you only want to export what was actually received.

Regards,

Hans

Quoted 1 line
author maintainer
#8 lore raw

Re: [PATCH v6 4/6] media: platform: synopsys: Add support for HDMI input driver

Quoted 81 lines · Hans Verkuil
Quoted 71 lines · Dmitry Osipenko
Quoted 70 lines · Hans Verkuil
Quoted 38 lines · Dmitry Osipenko

From: Shreeya Patel <[email protected]>

Add initial support for the Synopsys DesignWare HDMI RX Controller Driver used by Rockchip RK3588. The driver supports:
- HDMI 1.4b and 2.0 modes (HDMI 4k@60Hz)
- RGB888, YUV422, YUV444 and YCC420 pixel formats
- CEC
- EDID configuration

The hardware also has Audio and HDCP capabilities, but these are not yet supported by the driver.

---
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/synopsys/Kconfig       |    3 +
 drivers/media/platform/synopsys/Makefile      |    2 +
 .../media/platform/synopsys/hdmirx/Kconfig    |   27 +
 .../media/platform/synopsys/hdmirx/Makefile   |    4 +
 .../platform/synopsys/hdmirx/snps_hdmirx.c    | 2715 +++++++++++++++++
 .../platform/synopsys/hdmirx/snps_hdmirx.h    |  394 +++
 .../synopsys/hdmirx/snps_hdmirx_cec.c         |  284 ++
 .../synopsys/hdmirx/snps_hdmirx_cec.h         |   44 +
 10 files changed, 3475 insertions(+)
 create mode 100644 drivers/media/platform/synopsys/Kconfig
 create mode 100644 drivers/media/platform/synopsys/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Kconfig
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h

<snip>

Quoted 8 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +8 -0
+static ssize_t
+hdmirx_debugfs_if_read(u32 type, void *priv, struct file *filp,
+		       char __user *ubuf, size_t count, loff_t *ppos)
+{
+	struct snps_hdmirx_dev *hdmirx_dev = priv;
+	u8 aviif[3 + 7 * 4];
+	int len;
+

drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c line 1098

Quoted 10 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +10 -0
+	if (type != V4L2_DEBUGFS_IF_AVI)
+		return 0;
+
+	hdmirx_read_avi_infoframe(hdmirx_dev, aviif);
+
+	len = simple_read_from_buffer(ubuf, count, ppos,
+				      aviif, ARRAY_SIZE(aviif));
+
+	return len < 0 ? 0 : len;
+}

Have you tested this with 'edid-decode -c -I /path/to/avi'? Also test that it is empty if there is no AVI InfoFrame (e.g. when there is no incoming video). I don't see a test for that in the code.

I also see no sanity check regarding the length of the InfoFrame, it just outputs the full array, meaning you get padding as well since the AVI InfoFrame is smaller than ARRAY_SIZE(aviif). In fact, edid-decode will fail about that if the -c option is used.

Quoted 8 lines
Quoted 1 line

See tc358743_debugfs_if_read of how this is typically handled.

I've tested with 'edid-decode -I /path/to/avi', including the empty AVI InfoFrame. But without the '-c option'. I'd expect that debugfs should provide a full-sized raw InfoFrame data, rather than a parsed version. The parsed data isn't much useful for debugging purposes, IMO. I intentionally removed the size check that tc358743_debugfs_if_read does because it appeared wrong to me. Will re-check with '-c option', thanks!

Quoted 5 lines

The HDMI header contains the actual length that was received. So debugfs should export the actual payload, not the maximum possible payload.

It is common for hardware to reserve room in the register map for the maximum payload, but you only want to export what was actually received.

If payload is corrupted, it should be handy to see a full payload. Otherwise you won't be able to debug anything because driver returns zero payload to userspace since it can't parse the header :)

Signature · 2 lines
Best regards,
Dmitry
author maintainer
#9 lore raw

Re: [PATCH v6 4/6] media: platform: synopsys: Add support for HDMI input driver

Quoted 85 lines · Dmitry Osipenko
Quoted 84 lines · Hans Verkuil
Quoted 71 lines · Dmitry Osipenko
Quoted 70 lines · Hans Verkuil
Quoted 38 lines · Dmitry Osipenko

From: Shreeya Patel <[email protected]>

Add initial support for the Synopsys DesignWare HDMI RX Controller Driver used by Rockchip RK3588. The driver supports:
- HDMI 1.4b and 2.0 modes (HDMI 4k@60Hz)
- RGB888, YUV422, YUV444 and YCC420 pixel formats
- CEC
- EDID configuration

The hardware also has Audio and HDCP capabilities, but these are not yet supported by the driver.

---
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/synopsys/Kconfig       |    3 +
 drivers/media/platform/synopsys/Makefile      |    2 +
 .../media/platform/synopsys/hdmirx/Kconfig    |   27 +
 .../media/platform/synopsys/hdmirx/Makefile   |    4 +
 .../platform/synopsys/hdmirx/snps_hdmirx.c    | 2715 +++++++++++++++++
 .../platform/synopsys/hdmirx/snps_hdmirx.h    |  394 +++
 .../synopsys/hdmirx/snps_hdmirx_cec.c         |  284 ++
 .../synopsys/hdmirx/snps_hdmirx_cec.h         |   44 +
 10 files changed, 3475 insertions(+)
 create mode 100644 drivers/media/platform/synopsys/Kconfig
 create mode 100644 drivers/media/platform/synopsys/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Kconfig
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h

<snip>

Quoted 8 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +8 -0
+static ssize_t
+hdmirx_debugfs_if_read(u32 type, void *priv, struct file *filp,
+		       char __user *ubuf, size_t count, loff_t *ppos)
+{
+	struct snps_hdmirx_dev *hdmirx_dev = priv;
+	u8 aviif[3 + 7 * 4];
+	int len;
+

drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c line 1098

Quoted 10 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +10 -0
+	if (type != V4L2_DEBUGFS_IF_AVI)
+		return 0;
+
+	hdmirx_read_avi_infoframe(hdmirx_dev, aviif);
+
+	len = simple_read_from_buffer(ubuf, count, ppos,
+				      aviif, ARRAY_SIZE(aviif));
+
+	return len < 0 ? 0 : len;
+}

Have you tested this with 'edid-decode -c -I /path/to/avi'? Also test that it is empty if there is no AVI InfoFrame (e.g. when there is no incoming video). I don't see a test for that in the code.

I also see no sanity check regarding the length of the InfoFrame, it just outputs the full array, meaning you get padding as well since the AVI InfoFrame is smaller than ARRAY_SIZE(aviif). In fact, edid-decode will fail about that if the -c option is used.

Quoted 8 lines
Quoted 1 line

See tc358743_debugfs_if_read of how this is typically handled.

I've tested with 'edid-decode -I /path/to/avi', including the empty AVI InfoFrame. But without the '-c option'. I'd expect that debugfs should provide a full-sized raw InfoFrame data, rather than a parsed version. The parsed data isn't much useful for debugging purposes, IMO. I intentionally removed the size check that tc358743_debugfs_if_read does because it appeared wrong to me. Will re-check with '-c option', thanks!

The HDMI header contains the actual length that was received. So debugfs should export the actual payload, not the maximum possible payload.

Quoted 6 lines
Quoted 2 lines

It is common for hardware to reserve room in the register map for the maximum payload, but you only want to export what was actually received.

If payload is corrupted, it should be handy to see a full payload. Otherwise you won't be able to debug anything because driver returns zero payload to userspace since it can't parse the header :)

Note those tc358743 and other drivers are parsing the IF header data. I'm pretty sure this is not what InfoFrame debugfs is intended to do, Will revisit it all again in a more details for v7.

Signature · 7 lines
Best regards,
Dmitry

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#10 lore raw

Re: [PATCH v6 4/6] media: platform: synopsys: Add support for HDMI input driver

Quoted 89 lines · Dmitry Osipenko
Quoted 88 lines · Dmitry Osipenko
Quoted 86 lines · Hans Verkuil
Quoted 71 lines · Dmitry Osipenko
Quoted 70 lines · Hans Verkuil
Quoted 38 lines · Dmitry Osipenko

From: Shreeya Patel <[email protected]>

Add initial support for the Synopsys DesignWare HDMI RX Controller Driver used by Rockchip RK3588. The driver supports:
- HDMI 1.4b and 2.0 modes (HDMI 4k@60Hz)
- RGB888, YUV422, YUV444 and YCC420 pixel formats
- CEC
- EDID configuration

The hardware also has Audio and HDCP capabilities, but these are not yet supported by the driver.

---
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/synopsys/Kconfig       |    3 +
 drivers/media/platform/synopsys/Makefile      |    2 +
 .../media/platform/synopsys/hdmirx/Kconfig    |   27 +
 .../media/platform/synopsys/hdmirx/Makefile   |    4 +
 .../platform/synopsys/hdmirx/snps_hdmirx.c    | 2715 +++++++++++++++++
 .../platform/synopsys/hdmirx/snps_hdmirx.h    |  394 +++
 .../synopsys/hdmirx/snps_hdmirx_cec.c         |  284 ++
 .../synopsys/hdmirx/snps_hdmirx_cec.h         |   44 +
 10 files changed, 3475 insertions(+)
 create mode 100644 drivers/media/platform/synopsys/Kconfig
 create mode 100644 drivers/media/platform/synopsys/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Kconfig
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h

<snip>

Quoted 8 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +8 -0
+static ssize_t
+hdmirx_debugfs_if_read(u32 type, void *priv, struct file *filp,
+		       char __user *ubuf, size_t count, loff_t *ppos)
+{
+	struct snps_hdmirx_dev *hdmirx_dev = priv;
+	u8 aviif[3 + 7 * 4];
+	int len;
+

drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c line 1098

Quoted 10 lines
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c new file +10 -0
+	if (type != V4L2_DEBUGFS_IF_AVI)
+		return 0;
+
+	hdmirx_read_avi_infoframe(hdmirx_dev, aviif);
+
+	len = simple_read_from_buffer(ubuf, count, ppos,
+				      aviif, ARRAY_SIZE(aviif));
+
+	return len < 0 ? 0 : len;
+}

Have you tested this with 'edid-decode -c -I /path/to/avi'? Also test that it is empty if there is no AVI InfoFrame (e.g. when there is no incoming video). I don't see a test for that in the code.

I also see no sanity check regarding the length of the InfoFrame, it just outputs the full array, meaning you get padding as well since the AVI InfoFrame is smaller than ARRAY_SIZE(aviif). In fact, edid-decode will fail about that if the -c option is used.

Quoted 8 lines
Quoted 1 line

See tc358743_debugfs_if_read of how this is typically handled.

I've tested with 'edid-decode -I /path/to/avi', including the empty AVI InfoFrame. But without the '-c option'. I'd expect that debugfs should provide a full-sized raw InfoFrame data, rather than a parsed version. The parsed data isn't much useful for debugging purposes, IMO. I intentionally removed the size check that tc358743_debugfs_if_read does because it appeared wrong to me. Will re-check with '-c option', thanks!

The HDMI header contains the actual length that was received. So debugfs should export the actual payload, not the maximum possible payload.

It is common for hardware to reserve room in the register map for the maximum payload, but you only want to export what was actually received.

Quoted 6 lines
Quoted 3 lines

If payload is corrupted, it should be handy to see a full payload. Otherwise you won't be able to debug anything because driver returns zero payload to userspace since it can't parse the header :)

Note those tc358743 and other drivers are parsing the IF header data. I'm pretty sure this is not what InfoFrame debugfs is intended to do,

It's exactly what it is intended to do (I know, I wrote it :-) ).

The HDMI interface transmits the InfoFrame data with that HDMI header, the receiver captures that and stores the InfoFrame data. You have no control over that, it is all implemented in hardware since it is transmitted over the high-speed video lanes. If the header is corrupt, then the video is almost certainly also corrupt.

The reason for storing the InfoFrame in debugfs is to see what the transmitter is sending us in the InfoFrame: does the InfoFrame contents make sense? Is it consistent with the EDID?

If for example the transmitter is sending us a video format that isn't supported in the EDID, then it is helpful to see what the AVI InfoFrame says.

Regards,

Hans

Quoted 2 lines

Will revisit it all again in a more details for v7.

author maintainer
#11 lore raw

PATCH v6 5/6 arm64: defconfig: Enable Synopsys HDMI receiver

In reply to Dmitry Osipenko

From: Sebastian Reichel <[email protected]>

The Rockchip RK3588 has a built-in HDMI receiver block from Synopsys. Let's enable the driver for it.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index cb7da4415599..6ed1ad3c0055 100644
@@ -859,6 +859,7 @@ CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC=m
 CONFIG_VIDEO_SAMSUNG_S5P_JPEG=m
 CONFIG_VIDEO_SAMSUNG_S5P_MFC=m
 CONFIG_VIDEO_SUN6I_CSI=m
+CONFIG_VIDEO_SYNOPSYS_HDMIRX=m
 CONFIG_VIDEO_TI_J721E_CSI2RX=m
 CONFIG_VIDEO_HANTRO=m
 CONFIG_VIDEO_IMX219=m
Signature · 7 lines
2.48.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
author maintainer
#12 lore raw

PATCH v6 6/6 arm64: dts: rockchip: Enable HDMI receiver on rock-5b

In reply to Dmitry Osipenko

From: Sebastian Reichel <[email protected]>

The Rock 5B has a Micro HDMI port, which can be used for receiving HDMI data. This enables support for it.

---
 .../arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +18 -0
index d597112f1d5b..377824e69e20 100644
@@ -220,6 +220,18 @@ hdmi0_out_con: endpoint {
 	};
 };
 
+&hdmi_receiver_cma {
+	status = "okay";
+};
+
+&hdmi_receiver {
+	status = "okay";
+	hpd-gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_LOW>;
+	pinctrl-0 = <&hdmim1_rx_cec &hdmim1_rx_hpdin &hdmim1_rx_scl &hdmim1_rx_sda &hdmirx_hpd>;
+	pinctrl-names = "default";
+	memory-region = <&hdmi_receiver_cma>;
+};
+
 &hdptxphy_hdmi0 {
 	status = "okay";
 };
@@ -377,6 +389,12 @@ &pcie3x4 {
 };
 
 &pinctrl {
+	hdmirx {
+		hdmirx_hpd: hdmirx-5v-detection {
+			rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
 	hym8563 {
 		hym8563_int: hym8563-int {
 			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
Signature · 7 lines
2.48.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#13 lore raw
In reply to Dmitry Osipenko

Hi Dmitry,

Quoted 16 lines · Dmitry Osipenko

This series implements support for the Synopsys DesignWare HDMI RX Controller, being compliant with standard HDMI 1.4b and HDMI 2.0.

Features that are currently supported by the HDMI RX driver have been tested on rock5b board using a HDMI to micro-HDMI cable. It is recommended to use a good quality cable as there were multiple issues seen during testing the driver.

Please note the below information :-
* HDMIRX driver now only works with the opensource TF-A.
* We have tested the working of OBS studio with HDMIRX driver and there were no issues seen.
* We tested and verified the support for interlaced video.
* We tested capturing of YUV formats.

Quoted 5 lines

To test the HDMI RX Controller driver, following example commands can be used :-

root@debian-rockchip-rock5b-rk3588:~# v4l2-ctl --verbose -d /dev/video0 \
--set-fmt-video=width=1920,height=1080,pixelformat='BGR3' --stream-mmap=4 \
--stream-skip=3 --stream-count=100 --stream-to=/home/hdmiin4k.raw --stream-poll

This looks a bit odd. This commandline should work just as well:

v4l2-ctl --stream-mmap --stream-count=100 --stream-to=/home/hdmiin4k.raw

v4l2-ctl will call QUERY_DV_TIMINGS, then (if a valid signal is found) S_DV_TIMINGS. That in turn updates the v4l2_format. So there is no need to set the video format, it should happen automatically.

Also, why skip the first three frames? And why select --stream-poll?

It could be that these are just left-overs from previous attempts, but it's weird.

I also commented on the debugfs InfoFrame code in patch 4/6, that's not correct.

Regards,

Hans

Quoted 234 lines
root@debian-rockchip-rock5b-rk3588:~# ffmpeg -f rawvideo -vcodec rawvideo \
-s 1920x1080 -r 60 -pix_fmt bgr24 -i /home/hdmiin4k.raw output.mkv

CEC compliance test results :-

* https://gitlab.collabora.com/-/snippets/380
* https://gitlab.collabora.com/-/snippets/381

Following is the v4l2-compliance test result :-

root@debian-rockchip-rock5b-rk3588:~# v4l2-compliance -d /dev/video1
v4l2-compliance 1.29.0-5326, 64 bits, 64-bit time_t
v4l2-compliance SHA: 77f5df419204 2025-02-07 08:59:59

Compliance test for snps_hdmirx device /dev/video1:

Driver Info:

        Driver name      : snps_hdmirx
        Card type        : snps_hdmirx
        Bus info         : platform:fdee0000.hdmi_receiver
        Driver version   : 6.14.0
        Capabilities     : 0x84201000

Video Capture Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04201000
Video Capture Multiplanar
Streaming
Extended Pix Format

Required ioctls:
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK

Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK test VIDIOC_DV_TIMINGS_CAP: OK
test VIDIOC_G/S_EDID: OK

Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 4 Private Controls: 0

Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)

Codec ioctls (Input 0):
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK

Test input 0:

Streaming ioctls:
test read/write: OK (Not Supported)
test MMAP (no poll, REQBUFS): OK
test MMAP (select, REQBUFS): OK
test MMAP (epoll, REQBUFS): OK
test MMAP (no poll, CREATE_BUFS): OK test MMAP (select, CREATE_BUFS): OK
test MMAP (epoll, CREATE_BUFS): OK
test USERPTR (no poll): OK (Not Supported) test USERPTR (select): OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device

Total for snps_hdmirx device /dev/video1: 57, Succeeded: 57, Failed: 0, Warnings: 0

---

Changes in v6 :-
- Driver now keeps HPD low instead of zeroing EDID when EDID-clearing is invoked and when default EDID usage is disabled in the kernel config
- Added InfoFrame debugfs support
- Added another code comment clarifying validation of timing values
- Rebased on top of recent media-next tree

Changes in v5 :-
- Fix the interrupt IRQ number in the dt-bindings and device tree
- Add alignment property to ensure hdmi-receiver-cma starts at a 64KB-aligned address
- Change the MODULE_DESCRIPTION
- Add VIDEO_SYNOPSYS_HDMIRX as prefix to the default edid config
- Drop the enabling of default edid in the Kconfig
- Replace the default EDID with hdmi-4k-300mhz EDID produced by v4l2-ctl tool for better compatibility with various HDMI cables and adapters
- Rework the write_edid and set_edid functions
- During format change, retrieve the current pixel format, color depth, and AVI infoframe details instead of only detecting the format
- Improve the logging mechanism and delays in the hdmirx_wait_signal_lock function
- Fix the 4K@60 capturing for RGB format
- Document what hdmirx_check_timing_valid function does
- Rework the hdmirx_get_detected_timings function
- Fix the NV16/24 size image value
- Add the implementation from Benjamin Hoff to expose the ITC type to v4l2
- Remove all the firmware related code

Changes in v4 :-
- Remove DTS changes included in the device tree patch
- Remove the hdmi rx pin info as it's already present in the rk3588-base-pinctrl.dtsi
- Create a separate config option for selecting the EDID and enable it by default
- Improve the comment related to DV timings and move it to the side of hdmirx_get_detected_timings
- Add 100ms delay before pulling the HPD high
- Do not return the detected timings from VIDIOC_G_DV_TIMINGS
- Drop the bus info from hdmirx_querycap
- If *num_planes != 0 then return 0 in hdmirx_queue_setup
- Set queue->min_queued_buffers to 1
- Drop q->allow_cache_hints = 0; as it's always 0 by default
- Add a comment for q->dma_attrs = DMA_ATTR_FORCE_CONTIGUOUS;
- Drop .read = vb2_fop_read as it's not supported by driver
- Remove redundant edid_init_data_600M
- Make HPD low when driver is loaded
- Add support for reading AVI Infoframe
- Remove msg_len checks from hdmirx_cec_transmit
- Add info about the CEC compliance test in the cover letter
- Add arbitration lost status
- Validate the physical address inside the EDID

Changes in v3 :-
- Use v4l2-common helpers in the HDMIRX driver
- Rename cma node and phandle names
- Elaborate the comment to explain 160MiB calculation
- Move &hdmi_receiver_cma to the rock5b dts file
- Add information about interlaced video testing in the cover-letter

Changes in v2 :-
- Fix checkpatch --strict warnings
- Move the dt-binding include file changes in a separate patch
- Add a description for the hardware in the dt-bindings file
- Rename resets, vo1 grf and HPD properties
- Add a proper description for grf and vo1-grf phandles in the bindings
- Rename the HDMI RX node name to hdmi-receiver
- Include gpio header file in binding example to fix the dt_binding_check failure
- Move hdmirx_cma node to the rk3588.dtsi file
- Add an entry to MAINTAINERS file for the HDMIRX driver

Sebastian Reichel (2):
arm64: defconfig: Enable Synopsys HDMI receiver
arm64: dts: rockchip: Enable HDMI receiver on rock-5b

Shreeya Patel (4):
MAINTAINERS: Add entry for Synopsys DesignWare HDMI RX Driver
dt-bindings: media: Document bindings for HDMI RX Controller
arm64: dts: rockchip: Add device tree support for HDMI RX Controller
media: platform: synopsys: Add support for HDMI input driver

 .../bindings/media/snps,dw-hdmi-rx.yaml       |  132 +
 MAINTAINERS                                   |    8 +
 .../dts/rockchip/rk3588-base-pinctrl.dtsi     |   14 +
 .../arm64/boot/dts/rockchip/rk3588-extra.dtsi |   57 +
 .../boot/dts/rockchip/rk3588-rock-5b.dts      |   18 +
 arch/arm64/configs/defconfig                  |    1 +
 drivers/media/platform/Kconfig                |    1 +
 drivers/media/platform/Makefile               |    1 +
 drivers/media/platform/synopsys/Kconfig       |    3 +
 drivers/media/platform/synopsys/Makefile      |    2 +
 .../media/platform/synopsys/hdmirx/Kconfig    |   27 +
 .../media/platform/synopsys/hdmirx/Makefile   |    4 +
 .../platform/synopsys/hdmirx/snps_hdmirx.c    | 2715 +++++++++++++++++
 .../platform/synopsys/hdmirx/snps_hdmirx.h    |  394 +++
 .../synopsys/hdmirx/snps_hdmirx_cec.c         |  284 ++
 .../synopsys/hdmirx/snps_hdmirx_cec.h         |   44 +
 16 files changed, 3705 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.yaml
 create mode 100644 drivers/media/platform/synopsys/Kconfig
 create mode 100644 drivers/media/platform/synopsys/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Kconfig
 create mode 100644 drivers/media/platform/synopsys/hdmirx/Makefile
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx.h
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.c
 create mode 100644 drivers/media/platform/synopsys/hdmirx/snps_hdmirx_cec.h
author maintainer
#14 lore raw
Quoted 25 lines · Hans Verkuil

Hi Dmitry,

Quoted 16 lines · Dmitry Osipenko

This series implements support for the Synopsys DesignWare HDMI RX Controller, being compliant with standard HDMI 1.4b and HDMI 2.0.

Features that are currently supported by the HDMI RX driver have been tested on rock5b board using a HDMI to micro-HDMI cable. It is recommended to use a good quality cable as there were multiple issues seen during testing the driver.

Please note the below information :-
* HDMIRX driver now only works with the opensource TF-A.
* We have tested the working of OBS studio with HDMIRX driver and there were no issues seen.
* We tested and verified the support for interlaced video.
* We tested capturing of YUV formats.

Quoted 5 lines

To test the HDMI RX Controller driver, following example commands can be used :-

root@debian-rockchip-rock5b-rk3588:~# v4l2-ctl --verbose -d /dev/video0 \
--set-fmt-video=width=1920,height=1080,pixelformat='BGR3' --stream-mmap=4 \
--stream-skip=3 --stream-count=100 --stream-to=/home/hdmiin4k.raw --stream-poll
Quoted 7 lines

This looks a bit odd. This commandline should work just as well:

v4l2-ctl --stream-mmap --stream-count=100 --stream-to=/home/hdmiin4k.raw

v4l2-ctl will call QUERY_DV_TIMINGS, then (if a valid signal is found) S_DV_TIMINGS. That in turn updates the v4l2_format. So there is no need to set the video format, it should happen automatically.

Your cmdline works fine, setting format isn't necessary.

Quoted 4 lines

Also, why skip the first three frames? And why select --stream-poll?

It could be that these are just left-overs from previous attempts, but it's weird.

It's indeed the left-overs, will edit the cover letter in v7.

Quoted 2 lines

I also commented on the debugfs InfoFrame code in patch 4/6, that's not correct.

Thanks for the thorough review! :)

Additional note: I'm going to finish upstreaming of the driver because Shreeya is currently busy. She will be maintaining driver afterwards.

Signature · 2 lines
Best regards,
Dmitry