Skip to contentSkip to conversation

Synopsys Designware HDMI Video Capture Controller + PHY

PATCH Superseded Jose Abreu 2 participants 9 messages Jul 7, 2017

Subsystems (3)

v7 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Jose Abreu

author
#0 lore raw

v7 cover Synopsys Designware HDMI Video Capture Controller + PHY

The Synopsys Designware HDMI RX controller is an HDMI receiver controller that is responsible to process digital data that comes from a phy. The final result is a stream of raw video data that can then be connected to a video DMA, for example, and transfered into RAM so that it can be displayed.

The controller + phy available in this series natively support all HDMI 1.4 and HDMI 2.0 modes, including deep color. Although, the driver is quite in its initial stage and unfortunatelly only non deep color modes are supported. Also, audio is not yet supported in the driver (the controller has several audio output interfaces).

Version 7 addresses review comments from Sylwester Nawrocki regarding device tree bindings and also makes edid-phandle property look for parent node if no node is specified in the bindings.

I also added two patches for cec.h and cec-notifier.h which are needed to fix build errors/warnings. At 1/6 we add a stub for cec_register_cec_notifier() and at 2/6 we forward the declaration of cec_notifier structure before including cec.h.

This series depends on the patch at [1].

This series was tested in a FPGA platform using an embedded platform called ARC AXS101.

Jose Abreu (6):
[media] cec.h: Add stub function for cec_register_cec_notifier() [media] cec-notifier.h: Prevent build warnings using forward
declaration
dt-bindings: media: Document Synopsys Designware HDMI RX
MAINTAINERS: Add entry for Synopsys Designware HDMI drivers [media] platform: Add Synopsys Designware HDMI RX PHY e405 Driver [media] platform: Add Synopsys Designware HDMI RX Controller Driver

Cc Carlos Palminha <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Sylwester Nawrocki <[email protected]>

[1] https://patchwork.linuxtv.org/patch/41834/

 .../devicetree/bindings/media/snps,dw-hdmi-rx.txt  |   74 +
 MAINTAINERS                                        |    7 +
 drivers/media/platform/Kconfig                     |    2 +
 drivers/media/platform/Makefile                    |    2 +
 drivers/media/platform/dwc/Kconfig                 |   23 +
 drivers/media/platform/dwc/Makefile                |    2 +
 drivers/media/platform/dwc/dw-hdmi-phy-e405.c      |  844 +++++++++
 drivers/media/platform/dwc/dw-hdmi-phy-e405.h      |   63 +
 drivers/media/platform/dwc/dw-hdmi-rx.c            | 1823 ++++++++++++++++++++
 drivers/media/platform/dwc/dw-hdmi-rx.h            |  441 +++++
 include/media/cec-notifier.h                       |    6 +-
 include/media/cec.h                                |    7 +
 include/media/dwc/dw-hdmi-phy-pdata.h              |  128 ++
 include/media/dwc/dw-hdmi-rx-pdata.h               |   70 +
 14 files changed, 3489 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.txt
 create mode 100644 drivers/media/platform/dwc/Kconfig
 create mode 100644 drivers/media/platform/dwc/Makefile
 create mode 100644 drivers/media/platform/dwc/dw-hdmi-phy-e405.c
 create mode 100644 drivers/media/platform/dwc/dw-hdmi-phy-e405.h
 create mode 100644 drivers/media/platform/dwc/dw-hdmi-rx.c
 create mode 100644 drivers/media/platform/dwc/dw-hdmi-rx.h
 create mode 100644 include/media/dwc/dw-hdmi-phy-pdata.h
 create mode 100644 include/media/dwc/dw-hdmi-rx-pdata.h
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v7 1/6 cec.h: Add stub function for cec_register_cec_notifier()

Add a new stub function for cec_register_cec_notifier() so that we can still call this function when CONFIG_CEC_NOTIFIER and CONFIG_CEC_CORE are not set.

Cc Carlos Palminha <[email protected]>
Cc Hans Verkuil <[email protected]>
---
 include/media/cec.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/media/cec.h +7 -0
index 56643b2..b35f154 100644
@@ -365,6 +365,13 @@ static inline int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port)
 	return 0;
 }
 
+#ifndef CONFIG_CEC_NOTIFIER
+static inline void cec_register_cec_notifier(struct cec_adapter *adap,
+					     struct cec_notifier *notifier)
+{
+}
+#endif
+
 #endif
 
 /**
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v7 2/6 cec-notifier.h: Prevent build warnings using forward declaration

In reply to Jose Abreu

When CONFIC_CEC_NOTIFIER is not set and we only include cec-notifier.h we can get build warnings like these ones:

"warning: ‘struct cec_notifier’ declared inside parameter list will not be visible outside of this definition or declaration"

Prevent these warnings by using forward declaration of notifier structure.

Cc Carlos Palminha <[email protected]>
Cc Hans Verkuil <[email protected]>
---
 include/media/cec-notifier.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/media/cec-notifier.h +3 -3
index 298f996..84f9376 100644
@@ -21,14 +21,14 @@
 #ifndef LINUX_CEC_NOTIFIER_H
 #define LINUX_CEC_NOTIFIER_H
 
-#include <linux/types.h>
-#include <media/cec.h>
-
 struct device;
 struct edid;
 struct cec_adapter;
 struct cec_notifier;
 
+#include <linux/types.h>
+#include <media/cec.h>
+
 #if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLED(CONFIG_CEC_NOTIFIER)
 
 /**
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH v7 2/6] [media] cec-notifier.h: Prevent build warnings using forward declaration

Quoted 29 lines · Jose Abreu

When CONFIC_CEC_NOTIFIER is not set and we only include cec-notifier.h we can get build warnings like these ones:

"warning: ‘struct cec_notifier’ declared inside parameter list will not be visible outside of this definition or declaration"

Prevent these warnings by using forward declaration of notifier structure.

Cc Carlos Palminha <[email protected]>
Cc Hans Verkuil <[email protected]>
---
 include/media/cec-notifier.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/media/cec-notifier.h +0 -3
index 298f996..84f9376 100644
@@ -21,14 +21,14 @@
 #ifndef LINUX_CEC_NOTIFIER_H
 #define LINUX_CEC_NOTIFIER_H
 
-#include <linux/types.h>
-#include <media/cec.h>
-
 struct device;

include/media/cec-notifier.h line 34

Quoted 10 lines
include/media/cec-notifier.h +3 -0
 struct edid;
 struct cec_adapter;
 struct cec_notifier;
 
+#include <linux/types.h>
+#include <media/cec.h>
+
 #if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLED(CONFIG_CEC_NOTIFIER)
 
 /**

Isn't it enough to add a forward declaration of cec_notifier in the previous patch? E.g.:

+#ifndef CONFIG_CEC_NOTIFIER
+struct cec_notifier;
+static inline void cec_register_cec_notifier(struct cec_adapter *adap,
+ struct cec_notifier *notifier)
+{
+}
+#endif

Then this header doesn't need to change.

Regards,

Hans

author
#4 lore raw

Re: [PATCH v7 2/6] [media] cec-notifier.h: Prevent build warnings using forward declaration

Hi Hans,

Quoted 51 lines · Hans Verkuil
Quoted 29 lines · Jose Abreu

When CONFIC_CEC_NOTIFIER is not set and we only include cec-notifier.h we can get build warnings like these ones:

"warning: ‘struct cec_notifier’ declared inside parameter list will not be visible outside of this definition or declaration"

Prevent these warnings by using forward declaration of notifier structure.

Cc Carlos Palminha <[email protected]>
Cc Hans Verkuil <[email protected]>
---
 include/media/cec-notifier.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/media/cec-notifier.h +0 -3
index 298f996..84f9376 100644
@@ -21,14 +21,14 @@
 #ifndef LINUX_CEC_NOTIFIER_H
 #define LINUX_CEC_NOTIFIER_H
 
-#include <linux/types.h>
-#include <media/cec.h>
-
 struct device;

include/media/cec-notifier.h line 34

Quoted 10 lines
include/media/cec-notifier.h +3 -0
 struct edid;
 struct cec_adapter;
 struct cec_notifier;
 
+#include <linux/types.h>
+#include <media/cec.h>
+
 #if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLED(CONFIG_CEC_NOTIFIER)
 
 /**

Isn't it enough to add a forward declaration of cec_notifier in the previous patch? E.g.:

(quoted diff) +7 -0
+#ifndef CONFIG_CEC_NOTIFIER
+struct cec_notifier;
+static inline void cec_register_cec_notifier(struct cec_adapter *adap,
+					     struct cec_notifier *notifier)
+{
+}
+#endif
Quoted 1 line

Then this header doesn't need to change.

Yeah, it should also work :) I will add to the previous patch and drop this one then.

Best regards,
Jose Miguel Abreu

Quoted 4 lines

Regards,

Hans

author
#5 lore raw

PATCH v7 3/6 dt-bindings: media: Document Synopsys Designware HDMI RX

In reply to Jose Abreu

Document the bindings for the Synopsys Designware HDMI RX.

Cc Carlos Palminha <palminha-HKixBCOQz3hWk0Htik3J/[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Sylwester Nawrocki <[email protected]>

Changes from v6:
- Document which properties are required/optional (Sylwester)
- Drop compatible string for SoC (Sylwester)
- Reword edid-phandle property (Sylwester)
- Typo fixes (Sylwester)
Changes from v4:
- Use "cfg" instead of "cfg-clk" (Rob)
- Change node names (Rob)
Changes from v3:
- Document the new DT bindings suggested by Sylwester
Changes from v2:
- Document edid-phandle property

---
 .../devicetree/bindings/media/snps,dw-hdmi-rx.txt  | 74 ++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.txt
Documentation/devicetree/bindings/media/snps,dw-hdmi-rx.txt new file +74 -0
new file mode 100644
index 0000000..6c49aae
@@ -0,0 +1,74 @@
+Synopsys DesignWare HDMI RX Decoder
+===================================
+
+This document defines device tree properties for the Synopsys DesignWare HDMI
+RX Decoder (DWC HDMI RX). It doesn't constitute a device tree binding
+specification by itself but is meant to be referenced by platform-specific
+device tree bindings.
+
+The properties bellow belong to the Synopsys DesignWare HDMI RX Decoder node.
+
+- compatible: Required property. Shall be "snps,dw-hdmi-rx".
+
+- reg: Required property. Memory mapped base address and length of the DWC
+HDMI RX registers.
+
+- interrupts: Required property. Reference to the DWC HDMI RX interrupt and
+HDMI 5V sense interrupt.
+
+- clocks: Required property. Phandle to the config clock block.
+
+- clock-names: Required property. Shall be "cfg".
+
+- edid-phandle: Optional proerty. phandle to the EDID handler block; if this
+property is not specified it is assumed that EDID is handled by device
+described by parent node of the HDMI RX node. You should not specify this
+property if your HDMI RX controller does not have CEC.
+
+- #address-cells: Required property. Shall be 1.
+
+- #size-cells: Required property. Shall be 0.
+
+You also have to create a subnode for the PHY device. PHY node properties are
+as follows.
+
+- compatible: Required property. Shall be "snps,dw-hdmi-phy-e405".
+
+- reg: Required property. Shall be JTAG address of the PHY.
+
+- clocks: Required property. Phandle for cfg clock.
+
+- clock-names: Required property. Shall be "cfg".
+
+A sample binding is now provided. The compatible string is for a SoC which has
+has a Synopsys DesignWare HDMI RX decoder inside.
+
+Example:
+
+dw_hdmi_soc: dw-hdmi-soc@0 {
+	compatible = "...";
+	#address-cells = <1>;
+	#size-cells = <1>;
+	ranges;
+
+	hdmi-rx@0 {
+		compatible = "snps,dw-hdmi-rx";
+		reg = <0x0 0x10000>;
+		interrupts = <1 2>;
+		edid-phandle = <&dw_hdmi_soc>;
+
+		clocks = <&dw_hdmi_refclk>;
+		clock-names = "cfg";
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		hdmi-phy@fc {
+			compatible = "snps,dw-hdmi-phy-e405";
+			reg = <0xfc>;
+
+			clocks = <&dw_hdmi_refclk>;
+			clock-names = "cfg";
+		};
+	};
+};
Signature · 7 lines
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#6 lore raw

PATCH v7 4/6 MAINTAINERS: Add entry for Synopsys Designware HDMI drivers

In reply to Jose Abreu

Add a entry for Synopsys Designware HDMI Receivers drivers and phys.

Cc Carlos Palminha <[email protected]>
---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index c4be6d4..7ebc6dd 100644
@@ -11354,6 +11354,13 @@ L:	[email protected]
 S:	Supported
 F:	drivers/net/ethernet/synopsys/
 
+SYNOPSYS DESIGNWARE HDMI RECEIVERS AND PHY DRIVERS
+M:	Jose Abreu <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/media/platform/dwc/*
+F:	include/media/dwc/*
+
 SYNOPSYS DESIGNWARE I2C DRIVER
 M:	Jarkko Nikula <[email protected]>
 R:	Andy Shevchenko <[email protected]>
Signature · 1 line
1.9.1
author
#7 lore raw

PATCH v7 5/6 platform: Add Synopsys Designware HDMI RX PHY e405 Driver

In reply to Jose Abreu

This adds support for the Synopsys Designware HDMI RX PHY e405. This phy receives and decodes HDMI video that is delivered to a controller.

Main features included in this driver are:
- Equalizer algorithm that chooses the phy best settings according to the detected HDMI cable characteristics.
- Support for scrambling
- Support for HDMI 2.0 modes up to 6G (HDMI 4k@60Hz).

The driver was implemented as a standalone V4L2 subdevice and the phy interface with the controller was implemented using V4L2 ioctls. I do not know if this is the best option but it is not possible to use the existing API functions directly as we need specific functions that will be called by the controller at specific configuration stages.

There is also a bidirectional communication between controller and phy:
The phy must provide functions that the controller will call (i.e. configuration functions) and the controller must provide read/write callbacks, as well as other specific functions.

Cc Carlos Palminha <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Sylwester Nawrocki <[email protected]>

Changes from v4:
- Use usleep_range (Sylwester)
- Remove some comments (Sylwester)
- Parse phy version from of_device_id (Sylwester)
- Use "cfg" instead of "cfg-clk" (Sylwester, Rob)
- Change some messages to dev_dbg (Sylwester)
Changes from v3:
- Use v4l2 async API (Sylwester)
- Use clock API (Sylwester)
- Add compatible string (Sylwester)
Changes from RFC:
- Remove a bunch of functions that can be collapsed into a single config() function
- Add comments for the callbacks and structures (Hans)

---
 drivers/media/platform/Kconfig                |   2 +
 drivers/media/platform/Makefile               |   2 +
 drivers/media/platform/dwc/Kconfig            |   8 +
 drivers/media/platform/dwc/Makefile           |   1 +
 drivers/media/platform/dwc/dw-hdmi-phy-e405.c | 844 ++++++++++++++++++++++++++
 drivers/media/platform/dwc/dw-hdmi-phy-e405.h |  63 ++
 include/media/dwc/dw-hdmi-phy-pdata.h         | 128 ++++
 7 files changed, 1048 insertions(+)
 create mode 100644 drivers/media/platform/dwc/Kconfig
 create mode 100644 drivers/media/platform/dwc/Makefile
 create mode 100644 drivers/media/platform/dwc/dw-hdmi-phy-e405.c
 create mode 100644 drivers/media/platform/dwc/dw-hdmi-phy-e405.h
 create mode 100644 include/media/dwc/dw-hdmi-phy-pdata.h
drivers/media/platform/Kconfig +2 -0
index 1313cd5..47d4a50 100644
@@ -33,6 +33,8 @@ source "drivers/media/platform/omap/Kconfig"
 
 source "drivers/media/platform/blackfin/Kconfig"
 
+source "drivers/media/platform/dwc/Kconfig"
+
 config VIDEO_SH_VOU
 	tristate "SuperH VOU video output driver"
 	depends on MEDIA_CAMERA_SUPPORT
drivers/media/platform/Makefile +2 -0
index 9beadc7..e6a55fb 100644
@@ -86,3 +86,5 @@ obj-$(CONFIG_VIDEO_MEDIATEK_MDP)	+= mtk-mdp/
 obj-$(CONFIG_VIDEO_MEDIATEK_JPEG)	+= mtk-jpeg/
 
 obj-$(CONFIG_VIDEO_QCOM_VENUS)		+= qcom/venus/
+
+obj-y	+= dwc/
drivers/media/platform/dwc/Kconfig new file +8 -0
new file mode 100644
index 0000000..361d38d
@@ -0,0 +1,8 @@
+config VIDEO_DWC_HDMI_PHY_E405
+	tristate "Synopsys Designware HDMI RX PHY e405 driver"
+	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	help
+	  Support for Synopsys Designware HDMI RX PHY. Version is e405.
+
+	  To compile this driver as a module, choose M here. The module
+	  will be called dw-hdmi-phy-e405.
drivers/media/platform/dwc/Makefile new file +1 -0
new file mode 100644
index 0000000..fc3b62c
@@ -0,0 +1 @@
+obj-$(CONFIG_VIDEO_DWC_HDMI_PHY_E405) += dw-hdmi-phy-e405.o
drivers/media/platform/dwc/dw-hdmi-phy-e405.c new file +844 -0

844 lines not on this page · raw message

drivers/media/platform/dwc/dw-hdmi-phy-e405.h new file +63 -0

63 lines not on this page · raw message

include/media/dwc/dw-hdmi-phy-pdata.h new file +128 -0

128 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#8 lore raw

PATCH v7 6/6 platform: Add Synopsys Designware HDMI RX Controller Driver

In reply to Jose Abreu

This is an initial submission for the Synopsys Designware HDMI RX Controller Driver. This driver interacts with a phy driver so that a communication between them is created and a video pipeline is configured.

The controller + phy pipeline can then be integrated into a fully featured system that can be able to receive video up to 4k@60Hz with deep color 48bit RGB, depending on the platform. Although, this initial version does not yet handle deep color modes.

This driver was implemented as a standard V4L2 subdevice and its main features are:
- Internal state machine that reconfigures phy until the video is not stable
- JTAG communication with phy
- Inter-module communication with phy driver
- Debug write/read ioctls

Some notes:
- RX sense controller (cable connection/disconnection) must be handled by the platform wrapper as this is not integrated into the controller RTL
- The same goes for EDID ROM's
- ZCAL calibration is needed only in FPGA platforms, in ASIC this is not needed
- The state machine is not an ideal solution as it creates a kthread but it is needed because some sources might not be very stable at sending the video (i.e. we must react accordingly).

Cc Carlos Palminha <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Sylwester Nawrocki <[email protected]>

Changes from v6:
- edid-phandle now also looks for parent node (Sylwester)
- Fix kbuild build warnings
Changes from v5:
- Removed HDCP 1.4 support (Hans)
- Removed some CEC debug messages (Hans)
- Add s_dv_timings callback (Hans)
- Add V4L2_CID_DV_RX_POWER_PRESENT ctrl (Hans)
Changes from v4:
- Add flag V4L2_SUBDEV_FL_HAS_DEVNODE (Sylwester)
- Remove some comments and change some messages to dev_dbg (Sylwester)
- Use v4l2_async_subnotifier_register() (Sylwester)
Changes from v3:
- Use v4l2 async API (Sylwester)
- Do not block waiting for phy
- Do not use busy waiting delays (Sylwester)
- Simplify dw_hdmi_power_on (Sylwester)
- Use clock API (Sylwester)
- Use compatible string (Sylwester)
- Minor fixes (Sylwester)
Changes from v2:
- Address review comments from Hans regarding CEC
- Use CEC notifier
- Enable SCDC
Changes from v1:
- Add support for CEC
- Correct typo errors
- Correctly detect interlaced video modes
- Correct VIC parsing
Changes from RFC:
- Add support for HDCP 1.4
- Fixup HDMI_VIC not being parsed (Hans)
- Send source change signal when powering off (Hans)
- Add a "wait stable delay"
- Detect interlaced video modes (Hans)
- Restrain g/s_register from reading/writing to HDCP regs (Hans)

---
 drivers/media/platform/dwc/Kconfig      |   15 +
 drivers/media/platform/dwc/Makefile     |    1 +
 drivers/media/platform/dwc/dw-hdmi-rx.c | 1823 +++++++++++++++++++++++++++++++
 drivers/media/platform/dwc/dw-hdmi-rx.h |  441 ++++++++
 include/media/dwc/dw-hdmi-rx-pdata.h    |   70 ++
 5 files changed, 2350 insertions(+)
 create mode 100644 drivers/media/platform/dwc/dw-hdmi-rx.c
 create mode 100644 drivers/media/platform/dwc/dw-hdmi-rx.h
 create mode 100644 include/media/dwc/dw-hdmi-rx-pdata.h
drivers/media/platform/dwc/Kconfig +15 -0
index 361d38d..3ddccde 100644
@@ -6,3 +6,18 @@ config VIDEO_DWC_HDMI_PHY_E405
 
 	  To compile this driver as a module, choose M here. The module
 	  will be called dw-hdmi-phy-e405.
+
+config VIDEO_DWC_HDMI_RX
+	tristate "Synopsys Designware HDMI Receiver driver"
+	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	help
+	  Support for Synopsys Designware HDMI RX controller.
+
+	  To compile this driver as a module, choose M here. The module
+	  will be called dw-hdmi-rx.
+
+config VIDEO_DWC_HDMI_RX_CEC
+	bool
+	depends on VIDEO_DWC_HDMI_RX
+	select CEC_CORE
+	select CEC_NOTIFIER
drivers/media/platform/dwc/Makefile +1 -0
index fc3b62c..cd04ca9 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_VIDEO_DWC_HDMI_PHY_E405) += dw-hdmi-phy-e405.o
+obj-$(CONFIG_VIDEO_DWC_HDMI_RX) += dw-hdmi-rx.o
drivers/media/platform/dwc/dw-hdmi-rx.c new file +1823 -0

1,823 lines not on this page · raw message

drivers/media/platform/dwc/dw-hdmi-rx.h new file +441 -0

441 lines not on this page · raw message

include/media/dwc/dw-hdmi-rx-pdata.h new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
1.9.1