Skip to contentSkip to conversation

enable HDCP in Cadence MHDP bridge driver

PATCH Superseded Parshuram Thombare 2 participants 6 messages Mar 17, 2021 – Mar 18, 2021

Subsystems (4)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 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

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

 .../display/bridge/cdns,mhdp8546.yaml         |  24 +-
 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   |  89 +++
 6 files changed, 796 insertions(+), 23 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 v3 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         | 24 +++++++++++--------
 1 file changed, 14 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +14 -10
index 63427878715e..8a85768f6202 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,16 @@ 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
+    minItems: 2
+    maxItems: 3
     items:
       - const: mhdptx
       - const: j721e-intg
+      - const: mhdptx-sapb
 
   clocks:
     maxItems: 1
@@ -98,15 +101,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 +132,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

PATCH v3 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   |  89 +++
 5 files changed, 782 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 +89 -0

89 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
#3 lore raw

Re: [PATCH v3 2/2] drm: bridge: cdns-mhdp8546: Enable HDCP

Thank you for the patch! Perhaps something to improve:

Hi Parshuram,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.12-rc3 next-20210317] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Parshuram-Thombare/enable-HDCP-in-Cadence-MHDP-bridge-driver/20210318-000928
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: x86_64-randconfig-a016-20210317 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8ef111222a3dd12a9175f69c3bff598c46e8bdf7)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/9c8eb15a5059a553e08304619775dd7af4394eb1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Parshuram-Thombare/enable-HDCP-in-Cadence-MHDP-bridge-driver/20210318-000928 git checkout 9c8eb15a5059a553e08304619775dd7af4394eb1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c:502:5: warning: no previous prototype for function 'cdns_mhdp_hdcp_set_lc' [-Wmissing-prototypes]
   int cdns_mhdp_hdcp_set_lc(struct cdns_mhdp_device *mhdp, u8 *val)
       ^
   drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c:502:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int cdns_mhdp_hdcp_set_lc(struct cdns_mhdp_device *mhdp, u8 *val)
   ^
   static 
>> drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c:516:1: warning: no previous prototype for function 'cdns_mhdp_hdcp_set_public_key_params' [-Wmissing-prototypes]

cdns_mhdp_hdcp_set_public_key_params(struct cdns_mhdp_device *mhdp,
^
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c:515:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int
^
static
2 warnings generated.

vim +/cdns_mhdp_hdcp_set_lc +502 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c

501

 > 502	int cdns_mhdp_hdcp_set_lc(struct cdns_mhdp_device *mhdp, u8 *val)
   503	{
   504		int ret;
   505	
   506		mutex_lock(&mhdp->mbox_mutex);
   507		ret = cdns_mhdp_secure_mailbox_send(mhdp, MB_MODULE_ID_HDCP_GENERAL,
   508						    HDCP_GENERAL_SET_LC_128,
   509						    16, val);
   510		mutex_unlock(&mhdp->mbox_mutex);
   511	
   512		return ret;
   513	}
   514	
   515	int
 > 516	cdns_mhdp_hdcp_set_public_key_params(struct cdns_mhdp_device *mhdp,

517 struct cdns_hdcp_tx_public_key_param *val)
518 {
519 int ret;
520
521 mutex_lock(&mhdp->mbox_mutex);
522 ret = cdns_mhdp_secure_mailbox_send(mhdp, MB_MODULE_ID_HDCP_TX,
523 HDCP2X_TX_SET_PUBLIC_KEY_PARAMS,
524 sizeof(*val), (u8 *)val);
525 mutex_unlock(&mhdp->mbox_mutex);
526
527 return ret;
528 }
529

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#4 lore raw

Re: [PATCH v3 2/2] drm: bridge: cdns-mhdp8546: Enable HDCP

In reply to Parshuram Thombare
Thank you for the patch! Perhaps something to improve:

Hi Parshuram,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.12-rc3 next-20210317] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Parshuram-Thombare/enable-HDCP-in-Cadence-MHDP-bridge-driver/20210318-000928
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: x86_64-randconfig-s022-20210317 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-277-gc089cd2d-dirty
        # https://github.com/0day-ci/linux/commit/9c8eb15a5059a553e08304619775dd7af4394eb1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Parshuram-Thombare/enable-HDCP-in-Cadence-MHDP-bridge-driver/20210318-000928
        git checkout 9c8eb15a5059a553e08304619775dd7af4394eb1
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

sparse warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c:502:5: sparse: sparse: symbol 'cdns_mhdp_hdcp_set_lc' was not declared. Should it be static?
>> drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c:516:1: sparse: sparse: symbol 'cdns_mhdp_hdcp_set_public_key_params' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#5 lore raw

[RFC PATCH] drm: bridge: cdns-mhdp8546: cdns_mhdp_hdcp_set_lc() can be static

In reply to Parshuram Thombare
Reported-by: kernel test robot <[email protected]>
---
 cdns-mhdp8546-hdcp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-hdcp.c +2 -2
index c4bcacd23ee32..7757c272c49f6 100644
@@ -499,7 +499,7 @@ static void cdns_mhdp_hdcp_prop_work(struct work_struct *work)
 	drm_modeset_unlock(&dev->mode_config.connection_mutex);
 }
 
-int cdns_mhdp_hdcp_set_lc(struct cdns_mhdp_device *mhdp, u8 *val)
+static int cdns_mhdp_hdcp_set_lc(struct cdns_mhdp_device *mhdp, u8 *val)
 {
 	int ret;
 
@@ -512,7 +512,7 @@ int cdns_mhdp_hdcp_set_lc(struct cdns_mhdp_device *mhdp, u8 *val)
 	return ret;
 }
 
-int
+static int
 cdns_mhdp_hdcp_set_public_key_params(struct cdns_mhdp_device *mhdp,
 				     struct cdns_hdcp_tx_public_key_param *val)
 {