Skip to contentSkip to conversation

enable HDCP in Cadence MHDP bridge driver

PATCH Superseded Parshuram Thombare 3 participants 11 messages Mar 1, 2021 – Mar 9, 2021

Subsystems (4)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover enable HDCP in Cadence MHDP bridge driver

This patch series enables HDCP in Cadence MHDP DPI/DP bridge driver.

Changes since v1:
- Move sapb reg block right after apb reg block
- Corresponding changes in binding and example

Parshuram Thombare (2):
dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP
drm: bridge: cdns-mhdp8546: Enable HDCP

 .../display/bridge/cdns,mhdp8546.yaml         |  29 +-
 drivers/gpu/drm/bridge/cadence/Makefile       |   2 +-
 .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 105 +++-
 .../drm/bridge/cadence/cdns-mhdp8546-core.h   |  21 +
 .../drm/bridge/cadence/cdns-mhdp8546-hdcp.c   | 578 ++++++++++++++++++
 .../drm/bridge/cadence/cdns-mhdp8546-hdcp.h   |  89 +++
 .../drm/bridge/cadence/cdns-mhdp8546-j721e.c  |   2 +-
 7 files changed, 802 insertions(+), 24 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.h
Signature · 6 lines
2.25.1

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

PATCH v2 1/2 dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

Add binding changes for HDCP in the MHDP8546 DPI/DP bridge binding. This binding is not used in any upstreamed DTS yet, so changing index of property 'j721e-intg' should not affect anything.

---
 .../display/bridge/cdns,mhdp8546.yaml         | 29 ++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +19 -10
index 63427878715e..5fdadadaac16 100644
@@ -17,21 +17,24 @@ properties:
       - ti,j721e-mhdp8546
 
   reg:
-    minItems: 1
-    maxItems: 2
+    minItems: 2
+    maxItems: 3
     items:
       - description:
           Register block of mhdptx apb registers up to PHY mapped area (AUX_CONFIG_P).
           The AUX and PMA registers are not part of this range, they are instead
           included in the associated PHY.
+      - description:
+          Register block of mhdptx sapb registers.
       - description:
           Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 SoCs.
 
   reg-names:
-    minItems: 1
-    maxItems: 2
+    minItems: 2
+    maxItems: 3
     items:
       - const: mhdptx
+      - const: mhdptx-sapb
       - const: j721e-intg
 
   clocks:
@@ -53,6 +56,11 @@ properties:
   power-domains:
     maxItems: 1
 
+  hdcp-config:
+    maxItems: 1
+    description:
+      HDCP version supported. Bit [0]:HDCP2.2 [1]:HDCP1.4.
+
   interrupts:
     maxItems: 1
 
@@ -98,15 +106,15 @@ allOf:
     then:
       properties:
         reg:
-          minItems: 2
+          minItems: 3
         reg-names:
-          minItems: 2
+          minItems: 3
     else:
       properties:
         reg:
-          maxItems: 1
+          maxItems: 2
         reg-names:
-          maxItems: 1
+          maxItems: 2
 
 required:
   - compatible
@@ -129,8 +137,9 @@ examples:
 
         mhdp: dp-bridge@f0fb000000 {
             compatible = "cdns,mhdp8546";
-            reg = <0xf0 0xfb000000 0x0 0x1000000>;
-            reg-names = "mhdptx";
+            reg = <0xf0 0xfb000000 0x0 0x1000000>,
+                  <0x0 0x4f48000 0x0 0x74>;
+            reg-names = "mhdptx", "mhdptx-sapb";
             clocks = <&mhdp_clock>;
             phys = <&dp_phy>;
             phy-names = "dpphy";
Signature · 6 lines
2.25.1

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

Re: [PATCH v2 1/2] dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

Hi Parshuram,

Thank you for the patch.

Quoted 43 lines · Parshuram Thombare

Add binding changes for HDCP in the MHDP8546 DPI/DP bridge binding. This binding is not used in any upstreamed DTS yet, so changing index of property 'j721e-intg' should not affect anything.

---
 .../display/bridge/cdns,mhdp8546.yaml         | 29 ++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +7 -4
index 63427878715e..5fdadadaac16 100644
@@ -17,21 +17,24 @@ properties:
       - ti,j721e-mhdp8546
 
   reg:
-    minItems: 1
-    maxItems: 2
+    minItems: 2
+    maxItems: 3
     items:
       - description:
           Register block of mhdptx apb registers up to PHY mapped area (AUX_CONFIG_P).
           The AUX and PMA registers are not part of this range, they are instead
           included in the associated PHY.
+      - description:
+          Register block of mhdptx sapb registers.
       - description:
           Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 SoCs.
 
   reg-names:
-    minItems: 1
-    maxItems: 2
+    minItems: 2
+    maxItems: 3
     items:
       - const: mhdptx
+      - const: mhdptx-sapb
       - const: j721e-intg
 
   clocks:

Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml properties: · line 63

Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +5 -0
@@ -53,6 +56,11 @@ properties:
   power-domains:
     maxItems: 1
 
+  hdcp-config:
+    maxItems: 1
+    description:
+      HDCP version supported. Bit [0]:HDCP2.2 [1]:HDCP1.4.
+

Is this a property of the hardware, that is, are there multiple versions of this IP core covered by the same compatible string that support HDCP 1.4 only, DHCP 2.2 only or both ? Or is it a way to select what a given system will offer ?

Quoted 35 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +7 -6
   interrupts:
     maxItems: 1
 
@@ -98,15 +106,15 @@ allOf:
     then:
       properties:
         reg:
-          minItems: 2
+          minItems: 3
         reg-names:
-          minItems: 2
+          minItems: 3
     else:
       properties:
         reg:
-          maxItems: 1
+          maxItems: 2
         reg-names:
-          maxItems: 1
+          maxItems: 2
 
 required:
   - compatible
@@ -129,8 +137,9 @@ examples:
 
         mhdp: dp-bridge@f0fb000000 {
             compatible = "cdns,mhdp8546";
-            reg = <0xf0 0xfb000000 0x0 0x1000000>;
-            reg-names = "mhdptx";
+            reg = <0xf0 0xfb000000 0x0 0x1000000>,
+                  <0x0 0x4f48000 0x0 0x74>;
+            reg-names = "mhdptx", "mhdptx-sapb";
             clocks = <&mhdp_clock>;
             phys = <&dp_phy>;
             phy-names = "dpphy";
Signature · 7 lines
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

RE: [PATCH v2 1/2] dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

Hi Laurent,

Quoted 4 lines

Is this a property of the hardware, that is, are there multiple versions of this IP core covered by the same compatible string that support HDCP 1.4 only, DHCP 2.2 only or both ? Or is it a way to select what a given system will offer ?[]

MHDP hardware supports both HDCP 2.2 and 1.4. So, this is a way to select the version of HDCP, system wish to support.

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

#4 lore raw

Re: [PATCH v2 1/2] dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

Hi Parshuram,

Quoted 9 lines · Parshuram Raju Thombare

Hi Laurent,

Quoted 4 lines

Is this a property of the hardware, that is, are there multiple versions of this IP core covered by the same compatible string that support HDCP 1.4 only, DHCP 2.2 only or both ? Or is it a way to select what a given system will offer ?[]

MHDP hardware supports both HDCP 2.2 and 1.4. So, this is a way to select the version of HDCP, system wish to support.

Then I'm not sure this qualifies as a DT property, which should describe the system, not configure it. A way for userspace to configure this would be better.

Signature · 7 lines
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

RE: [PATCH v2 1/2] dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

Hi Laurent,

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

Is this a property of the hardware, that is, are there multiple versions of this IP core covered by the same compatible string that support HDCP 1.4 only, DHCP 2.2 only or both ? Or is it a way to select what a given system will offer ?[]

MHDP hardware supports both HDCP 2.2 and 1.4. So, this is a way to select the version of HDCP, system wish to support.

Then I'm not sure this qualifies as a DT property, which should describe the system, not configure it. A way for userspace to configure this would be better.

Since this is for source device, I am not sure how useful it is to allow user to change HDCP version supported. I think doing it in DTS gives more control over HDCP to system designer/integrator.

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

#6 lore raw

Re: [PATCH v2 1/2] dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

Hi Parshuram,

Quoted 10 lines · Parshuram Raju Thombare

Hi Laurent,

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

Is this a property of the hardware, that is, are there multiple versions of this IP core covered by the same compatible string that support HDCP 1.4 only, DHCP 2.2 only or both ? Or is it a way to select what a given system will offer ?[]

MHDP hardware supports both HDCP 2.2 and 1.4. So, this is a way to select the version of HDCP, system wish to support.

Quoted 7 lines
Quoted 3 lines

Then I'm not sure this qualifies as a DT property, which should describe the system, not configure it. A way for userspace to configure this would be better.

Since this is for source device, I am not sure how useful it is to allow user to change HDCP version supported. I think doing it in DTS gives more control over HDCP to system designer/integrator.

But how would they do so ? What would be the rationale for selecting a particular version in DT ?

I'm not thinking about giving control of this parameter to the end-user, but in the context of an embedded system, it may be useful to select which HDCP versions to offer based on different constraints at runtime. This really seems like a system configuration parameter to me, not a system description.

Signature · 7 lines
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

RE: [PATCH v2 1/2] dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

Is this a property of the hardware, that is, are there multiple versions of this IP core covered by the same compatible string that support HDCP 1.4 only, DHCP 2.2 only or both ? Or is it a way to select what a given system will offer ?[]

MHDP hardware supports both HDCP 2.2 and 1.4. So, this is a way to select the version of HDCP, system wish to support.

Quoted 7 lines
Quoted 3 lines

Then I'm not sure this qualifies as a DT property, which should describe the system, not configure it. A way for userspace to configure this would be better.

Since this is for source device, I am not sure how useful it is to allow user to change HDCP version supported. I think doing it in DTS gives more control over HDCP to system designer/integrator.

Quoted 8 lines

But how would they do so ? What would be the rationale for selecting a particular version in DT ?

I'm not thinking about giving control of this parameter to the end-user, but in the context of an embedded system, it may be useful to select which HDCP versions to offer based on different constraints at runtime. This really seems like a system configuration parameter to me, not a system description.

Ok, we can remove this parameter from DTS and let driver attempt both HDCP 2.2 and HDCP 1.4 in the same sequence so that HDCP version is selected based on sink capabilities. But then user space application will not have information about the HDCP version with which content will be protected. I suppose most UHD 4k content would need HDCP 2.2. So, forcing HDCP version in DTS was the easiest way.

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

maintainer
#8 lore raw

Re: [PATCH v2 1/2] dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

In reply to Parshuram Thombare
Quoted 3 lines · Parshuram Thombare

Add binding changes for HDCP in the MHDP8546 DPI/DP bridge binding. This binding is not used in any upstreamed DTS yet, so changing index of property 'j721e-intg' should not affect anything.

TI folks might disagree, but weren't Cc'ed.

Quoted 40 lines
---
 .../display/bridge/cdns,mhdp8546.yaml         | 29 ++++++++++++-------
 1 file changed, 19 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +7 -4
index 63427878715e..5fdadadaac16 100644
@@ -17,21 +17,24 @@ properties:
       - ti,j721e-mhdp8546
 
   reg:
-    minItems: 1
-    maxItems: 2
+    minItems: 2
+    maxItems: 3
     items:
       - description:
           Register block of mhdptx apb registers up to PHY mapped area (AUX_CONFIG_P).
           The AUX and PMA registers are not part of this range, they are instead
           included in the associated PHY.
+      - description:
+          Register block of mhdptx sapb registers.
       - description:
           Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 SoCs.
 
   reg-names:
-    minItems: 1
-    maxItems: 2
+    minItems: 2
+    maxItems: 3
     items:
       - const: mhdptx
+      - const: mhdptx-sapb
       - const: j721e-intg
 
   clocks:

Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml properties: · line 62

Quoted 7 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +4 -0
@@ -53,6 +56,11 @@ properties:
   power-domains:
     maxItems: 1
 
+  hdcp-config:
+    maxItems: 1
+    description:
+      HDCP version supported. Bit [0]:HDCP2.2 [1]:HDCP1.4.

2.2 is not backwards compatible with 1.4? What's the setting if not present? Maybe just a 'disable 2.2 boolean' if that's the non-common case.

In any case, it needs a type and constraints on the values.

Quoted 39 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +8 -6
+
   interrupts:
     maxItems: 1
 
@@ -98,15 +106,15 @@ allOf:
     then:
       properties:
         reg:
-          minItems: 2
+          minItems: 3
         reg-names:
-          minItems: 2
+          minItems: 3
     else:
       properties:
         reg:
-          maxItems: 1
+          maxItems: 2
         reg-names:
-          maxItems: 1
+          maxItems: 2
 
 required:
   - compatible
@@ -129,8 +137,9 @@ examples:
 
         mhdp: dp-bridge@f0fb000000 {
             compatible = "cdns,mhdp8546";
-            reg = <0xf0 0xfb000000 0x0 0x1000000>;
-            reg-names = "mhdptx";
+            reg = <0xf0 0xfb000000 0x0 0x1000000>,
+                  <0x0 0x4f48000 0x0 0x74>;
+            reg-names = "mhdptx", "mhdptx-sapb";
             clocks = <&mhdp_clock>;
             phys = <&dp_phy>;
             phy-names = "dpphy";
Signature · 1 line
2.25.1

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

#9 lore raw

RE: [PATCH v2 1/2] dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

Hi Rob,

Thanks for your comments.

Quoted 5 lines
Quoted 3 lines

Add binding changes for HDCP in the MHDP8546 DPI/DP bridge binding. This binding is not used in any upstreamed DTS yet, so changing index of property 'j721e-intg' should not affect anything.

TI folks might disagree, but weren't Cc'ed.

Kishon and Nikhil from TI are Cc'ed.
Hi Kishon / Nikhil,
Do you think this can be an issue ?

Quoted 1 line

In any case, it needs a type and constraints on the values.

Ok, I will add type and constraints on the values.

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

#10 lore raw

PATCH v2 2/2 drm: bridge: cdns-mhdp8546: Enable HDCP

In reply to Parshuram Thombare

This patch enable HDCP in MHDP driver.

---
 drivers/gpu/drm/bridge/cadence/Makefile       |   2 +-
 .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 105 +++-
 .../drm/bridge/cadence/cdns-mhdp8546-core.h   |  21 +
 .../drm/bridge/cadence/cdns-mhdp8546-hdcp.c   | 578 ++++++++++++++++++
 .../drm/bridge/cadence/cdns-mhdp8546-hdcp.h   |  89 +++
 .../drm/bridge/cadence/cdns-mhdp8546-j721e.c  |   2 +-
 6 files changed, 783 insertions(+), 14 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.h
drivers/gpu/drm/bridge/cadence/Makefile +1 -1
index 8f647991b374..4d2db8df1bc6 100644
@@ -1,4 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
-cdns-mhdp8546-y := cdns-mhdp8546-core.o
+cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
 cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +93 -12

181 lines not on this page · raw message

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h +21 -0
index 5897a85e3159..0d652569e487 100644
@@ -47,6 +47,10 @@ struct phy;
 
 #define CDNS_SW_EVENT0				0x00044
 #define CDNS_DPTX_HPD				BIT(0)
+#define CDNS_HDCP_TX_STATUS			BIT(4)
+#define CDNS_HDCP2_TX_IS_KM_STORED		BIT(5)
+#define CDNS_HDCP2_TX_STORE_KM			BIT(6)
+#define CDNS_HDCP_TX_IS_RCVR_ID_VALID		BIT(7)
 
 #define CDNS_SW_EVENT1				0x00048
 #define CDNS_SW_EVENT2				0x0004c
@@ -339,8 +343,17 @@ struct cdns_mhdp_platform_info {
 #define to_cdns_mhdp_bridge_state(s) \
 		container_of(s, struct cdns_mhdp_bridge_state, base)
 
+struct cdns_mhdp_hdcp {
+	struct delayed_work check_work;
+	struct work_struct prop_work;
+	struct mutex mutex; /* mutex to protect hdcp.value */
+	u32 value;
+	u8 config;
+};
+
 struct cdns_mhdp_device {
 	void __iomem *regs;
+	void __iomem *sapb_regs;
 	void __iomem *j721e_regs;
 
 	struct device *dev;
@@ -392,9 +405,17 @@ struct cdns_mhdp_device {
 
 	/* Work struct to schedule a uevent on link train failure */
 	struct work_struct modeset_retry_work;
+	struct work_struct hpd_work;
+
+	wait_queue_head_t sw_events_wq;
+	u32 sw_events;
+
+	struct cdns_mhdp_hdcp hdcp;
 };
 
 #define connector_to_mhdp(x) container_of(x, struct cdns_mhdp_device, connector)
 #define bridge_to_mhdp(x) container_of(x, struct cdns_mhdp_device, bridge)
 
+u32 cdns_mhdp_wait_for_sw_event(struct cdns_mhdp_device *mhdp, uint32_t event);
+
 #endif
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c new file +578 -0

578 lines not on this page · raw message

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.h new file +89 -0

89 lines not on this page · raw message

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-j721e.c +1 -1
index dfe1b59514f7..d65de603f76d 100644
@@ -44,7 +44,7 @@ static int cdns_mhdp_j721e_init(struct cdns_mhdp_device *mhdp)
 {
 	struct platform_device *pdev = to_platform_device(mhdp->dev);
 
-	mhdp->j721e_regs = devm_platform_ioremap_resource(pdev, 1);
+	mhdp->j721e_regs = devm_platform_ioremap_resource(pdev, 2);
 	return PTR_ERR_OR_ZERO(mhdp->j721e_regs);
 }
 
Signature · 6 lines
2.25.1

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