Skip to contentSkip to conversation

enable HDCP in Cadence MHDP bridge driver

PATCH Superseded Parshuram Thombare 2 participants 5 messages Mar 19, 2021 – Apr 7, 2021

Subsystems (4)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 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

Changes since v2:
- Revert reg resource sequence in binding and
use resource mapping by name
- Remove hdcp_config from binding and use
DRM HDCP Content Type property to select
HDCP version

Changes since v3:
- Fix kernel test robot warning

Changes since v4:
- Fix binding issue

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

 .../display/bridge/cdns,mhdp8546.yaml         |  34 +-
 drivers/gpu/drm/bridge/cadence/Makefile       |   2 +-
 .../drm/bridge/cadence/cdns-mhdp8546-core.c   | 113 +++-
 .../drm/bridge/cadence/cdns-mhdp8546-core.h   |  21 +
 .../drm/bridge/cadence/cdns-mhdp8546-hdcp.c   | 570 ++++++++++++++++++
 .../drm/bridge/cadence/cdns-mhdp8546-hdcp.h   |  92 +++
 6 files changed, 806 insertions(+), 26 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 v5 1/2 dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

Add binding changes for HDCP in the MHDP8546 DPI/DP bridge binding.

---
 .../display/bridge/cdns,mhdp8546.yaml         | 34 ++++++++++++-------
 1 file changed, 21 insertions(+), 13 deletions(-)
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +21 -13
index 63427878715e..d571f4bb6b16 100644
@@ -17,8 +17,8 @@ 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).
@@ -26,13 +26,20 @@ properties:
           included in the associated PHY.
       - description:
           Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 SoCs.
+      - description:
+          Register block of mhdptx sapb registers.
 
   reg-names:
-    minItems: 1
-    maxItems: 2
-    items:
-      - const: mhdptx
-      - const: j721e-intg
+    minItems: 2
+    maxItems: 3
+    oneOf:
+      - items:
+          - const: mhdptx
+          - const: j721e-intg
+          - const: mhdptx-sapb
+      - items:
+          - const: mhdptx
+          - const: mhdptx-sapb
 
   clocks:
     maxItems: 1
@@ -98,15 +105,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 +136,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
maintainer
#2 lore raw

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

Quoted 12 lines · Parshuram Thombare

Add binding changes for HDCP in the MHDP8546 DPI/DP bridge binding.

---
 .../display/bridge/cdns,mhdp8546.yaml         | 34 ++++++++++++-------
 1 file changed, 21 insertions(+), 13 deletions(-)
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +0 -0
index 63427878715e..d571f4bb6b16 100644

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

Quoted 7 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +2 -2
@@ -17,8 +17,8 @@ properties:
       - ti,j721e-mhdp8546
 
   reg:
-    minItems: 1
-    maxItems: 2
+    minItems: 2
+    maxItems: 3

1 entry was valid and now it is not? That's not a compatible change and needs an explanation at a minimum.

Quoted 64 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +19 -11
     items:
       - description:
           Register block of mhdptx apb registers up to PHY mapped area (AUX_CONFIG_P).
@@ -26,13 +26,20 @@ properties:
           included in the associated PHY.
       - description:
           Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 SoCs.
+      - description:
+          Register block of mhdptx sapb registers.
 
   reg-names:
-    minItems: 1
-    maxItems: 2
-    items:
-      - const: mhdptx
-      - const: j721e-intg
+    minItems: 2
+    maxItems: 3
+    oneOf:
+      - items:
+          - const: mhdptx
+          - const: j721e-intg
+          - const: mhdptx-sapb
+      - items:
+          - const: mhdptx
+          - const: mhdptx-sapb
 
   clocks:
     maxItems: 1
@@ -98,15 +105,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 +136,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

#3 lore raw

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

Hi Rob,

Thanks for your comment and sorry for late response.

Quoted 7 lines

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

Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +2 -2
-    minItems: 1
-    maxItems: 2
+    minItems: 2
+    maxItems: 3

1 entry was valid and now it is not? That's not a compatible change and needs an explanation at a minimum.

Yes, as the driver returns error in the absence of SAPB port address range, this may break the driver on platform without SAPB port. This IP needs SAPB port to support HDCP feature using embedded HDCP crypto module.

So, to maintain backward compatibility I will modify the driver and allow it to proceed without HDCP feature, instead of returning an error, in case of no SAPB port.

Regards,
Parshuram Thombare

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

#4 lore raw

PATCH v5 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   | 113 +++-
 .../drm/bridge/cadence/cdns-mhdp8546-core.h   |  21 +
 .../drm/bridge/cadence/cdns-mhdp8546-hdcp.c   | 570 ++++++++++++++++++
 .../drm/bridge/cadence/cdns-mhdp8546-hdcp.h   |  92 +++
 5 files changed, 785 insertions(+), 13 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 +101 -12

189 lines not on this page · raw message

drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h +21 -0
index 5897a85e3159..8744f4f70649 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 hdcp_content_type;
+};
+
 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 +570 -0

570 lines not on this page · raw message

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

92 lines not on this page · raw message

Signature · 6 lines
2.25.1

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