drm/mediatek/dp: Add the HDCP feature for DisplayPort
Subsystems (3)
PATCH 1/1 drm/mediatek/dp: Add the HDCP feature for DisplayPort
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort to support the HDCP feature.
--- drivers/gpu/drm/mediatek/Makefile | 7 +- drivers/gpu/drm/mediatek/ca/tci.h | 143 +++ drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h | 36 + drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c | 638 +++++++++++++ drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h | 305 +++++++ drivers/gpu/drm/mediatek/mtk_dp.c | 159 +++- drivers/gpu/drm/mediatek/mtk_dp.h | 17 + drivers/gpu/drm/mediatek/mtk_dp_hdcp.h | 154 ++++ drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c | 646 +++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h | 55 ++ drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c | 1008 +++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h | 75 ++ drivers/gpu/drm/mediatek/mtk_dp_reg.h | 6 +- 13 files changed, 3233 insertions(+), 16 deletions(-) create mode 100644 drivers/gpu/drm/mediatek/ca/tci.h create mode 100644 drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h create mode 100644 drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c create mode 100644 drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h
drivers/gpu/drm/mediatek/Makefile +6 -1
@@ -26,4 +26,9 @@ mediatek-drm-hdmi-objs := mtk_cec.o \ obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o -obj-$(CONFIG_DRM_MEDIATEK_DP) += mtk_dp.o +mtk-dp-objs := mtk_dp_hdcp1x.o \ + mtk_dp_hdcp2.o \ + ca/tlcDpHdcp.o \ + mtk_dp.o + +obj-$(CONFIG_DRM_MEDIATEK_DP) += mtk-dp.o
drivers/gpu/drm/mediatek/ca/tci.h new file +143 -0
143 lines not on this page · raw message
drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2019-2023 MediaTek Inc. +*/ + +#ifndef _TLDPHDCP_CMD_H_ +#define _TLDPHDCP_CMD_H_ + +#define CMD_DEVICE_ADDED 1 +#define CMD_DEVICE_REMOVE 2 +#define CMD_WRITE_VAL 3 +#define CMD_DEVICE_CLEAN 4 +#define CMD_ENABLE_ENCRYPT 5 + +/* V1.3 */ +#define CMD_CALCULATE_LM 11 +#define CMD_COMPARE_R0 12 +#define CMD_COMPARE_V1 13 +#define CMD_GET_AKSV 14 + +/* V2.2 */ +#define CMD_AKE_CERTIFICATE 20 +#define CMD_ENC_KM 21 +#define CMD_AKE_H_PRIME 22 +#define CMD_AKE_PARING 23 +#define CMD_LC_L_PRIME 24 +#define CMD_COMPARE_L 25 +#define CMD_SKE_CAL_EKS 26 + +#define CMD_COMPARE_V2 27 +#define CMD_COMPARE_M 28 + +/* Need remove in furture */ +#define CMD_LOAD_KEY 50 + +#endif /* _TLDPHDCP_CMD_H_ */
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +638 -0
638 lines not on this page · raw message
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h new file +305 -0
305 lines not on this page · raw message
drivers/gpu/drm/mediatek/mtk_dp.c +145 -14
243 lines not on this page · raw message
drivers/gpu/drm/mediatek/mtk_dp.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2019-2023 MediaTek Inc. +*/ + +#ifndef _MTK_DP_H_ +#define _MTK_DP_H_ + +#include "mtk_dp_hdcp.h" + +u32 mtk_dp_reg_read (struct regmap *regs,u32 offset); + +int mtk_dp_reg_update_bits (struct regmap *regs,u32 offset,u32 val,u32 mask); + +void mtk_dp_re_authentication (struct mtk_hdcp_info *hdcp_info); + +#endif /* _MTK_DP_H_ */
drivers/gpu/drm/mediatek/mtk_dp_hdcp.h new file +154 -0
154 lines not on this page · raw message
drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +646 -0
646 lines not on this page · raw message
drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h new file +55 -0
55 lines not on this page · raw message
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +1008 -0
753 lines not on this page · raw message
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h new file +75 -0
75 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.40.1
Part of the diff is not shown here. View the raw message.
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi mac.shen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.7-rc2]
[cannot apply to pza/reset/next pza/imx-drm/next]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/mac-shen/drm-mediatek-dp-Add-the-HDCP-feature-for-DisplayPort/20231125-152640 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20231124085346.26602-1-mac.shen%40mediatek.com patch subject: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20231125/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231125/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/mediatek/mtk_dp.c:349:5: warning: no previous prototype for function 'mtk_dp_read' [-Wmissing-prototypes]
349 | u32 mtk_dp_read(struct mtk_dp *mtk_dp, u32 offset)
| ^
drivers/gpu/drm/mediatek/mtk_dp.c:349:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
349 | u32 mtk_dp_read(struct mtk_dp *mtk_dp, u32 offset)
| ^
| static
>> drivers/gpu/drm/mediatek/mtk_dp.c:376:5: warning: no previous prototype for function 'mtk_dp_update_bits' [-Wmissing-prototypes]
376 | int mtk_dp_update_bits(struct mtk_dp *mtk_dp, u32 offset,
| ^
drivers/gpu/drm/mediatek/mtk_dp.c:376:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
376 | int mtk_dp_update_bits(struct mtk_dp *mtk_dp, u32 offset,
| ^
| static
>> drivers/gpu/drm/mediatek/mtk_dp.c:2663:6: warning: no previous prototype for function 'mtk_dp_check_hdcp_version' [-Wmissing-prototypes]
2663 | void mtk_dp_check_hdcp_version(struct mtk_dp *mtk_dp, bool only_hdcp1x)
| ^
drivers/gpu/drm/mediatek/mtk_dp.c:2663:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
2663 | void mtk_dp_check_hdcp_version(struct mtk_dp *mtk_dp, bool only_hdcp1x)
| ^
| static 3 warnings generated.
vim +/mtk_dp_read +349 drivers/gpu/drm/mediatek/mtk_dp.c
348
> 349 u32 mtk_dp_read(struct mtk_dp *mtk_dp, u32 offset)
350 {
351 return mtk_dp_reg_read(mtk_dp->regs, offset);
352 }
353
354 static int mtk_dp_write(struct mtk_dp *mtk_dp, u32 offset, u32 val)
355 {
356 int ret = regmap_write(mtk_dp->regs, offset, val);
357
358 if (ret)
359 dev_err(mtk_dp->dev,
360 "Failed to write register 0x%x with value 0x%x\n",
361 offset, val);
362 return ret;
363 }
364
365 int mtk_dp_reg_update_bits(struct regmap *regs, u32 offset,
366 u32 val, u32 mask)
367 {
368 int ret = regmap_update_bits(regs, offset, mask, val);
369
370 if (ret)
371 pr_err("Failed to update register 0x%x with value 0x%x, mask 0x%x\n",
372 offset, val, mask);
373 return ret;
374 }
375
> 376 int mtk_dp_update_bits(struct mtk_dp *mtk_dp, u32 offset, 377 u32 val, u32 mask)
378 {
379 return mtk_dp_reg_update_bits(mtk_dp->regs, offset, val, mask);
380 }
381
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi mac.shen,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.7-rc2 next-20231124] [cannot apply to pza/reset/next pza/imx-drm/next]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/mac-shen/drm-mediatek-dp-Add-the-HDCP-feature-for-DisplayPort/20231125-152640 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20231124085346.26602-1-mac.shen%40mediatek.com patch subject: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20231125/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231125/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/mediatek/mtk_dp.c:349:5: warning: no previous prototype for 'mtk_dp_read' [-Wmissing-prototypes]
349 | u32 mtk_dp_read(struct mtk_dp *mtk_dp, u32 offset)
| ^~~~~~~~~~~
>> drivers/gpu/drm/mediatek/mtk_dp.c:376:5: warning: no previous prototype for 'mtk_dp_update_bits' [-Wmissing-prototypes]
376 | int mtk_dp_update_bits(struct mtk_dp *mtk_dp, u32 offset,
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:15,
from include/drm/display/drm_dp_aux_bus.h:13,
from drivers/gpu/drm/mediatek/mtk_dp.c:7:
drivers/gpu/drm/mediatek/mtk_dp.c: In function 'mtk_dp_hpd_sink_event':
>> include/drm/drm_print.h:456:54: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'ssize_t' {aka 'int'} [-Wformat=]
456 | dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt, ##__VA_ARGS__)
| ^~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
include/drm/drm_print.h:456:9: note: in expansion of macro 'dev_info'
456 | dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt, ##__VA_ARGS__)
| ^~~~
include/drm/drm_print.h:460:9: note: in expansion of macro '__drm_printk'
460 | __drm_printk((drm), info,, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/gpu/drm/mediatek/mtk_dp.c:1905:17: note: in expansion of macro 'drm_info'
1905 | drm_info(mtk_dp->drm_dev, "Read sink count failed: %ld\n", ret);
| ^~~~~~~~
>> include/drm/drm_print.h:456:54: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'ssize_t' {aka 'int'} [-Wformat=]
456 | dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt, ##__VA_ARGS__)
| ^~~~~~~~
include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt'
150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
include/drm/drm_print.h:456:9: note: in expansion of macro 'dev_info'
456 | dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt, ##__VA_ARGS__)
| ^~~~
include/drm/drm_print.h:460:9: note: in expansion of macro '__drm_printk'
460 | __drm_printk((drm), info,, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~
drivers/gpu/drm/mediatek/mtk_dp.c:1911:17: note: in expansion of macro 'drm_info'
1911 | drm_info(mtk_dp->drm_dev,
| ^~~~~~~~
drivers/gpu/drm/mediatek/mtk_dp.c: At top level:
>> drivers/gpu/drm/mediatek/mtk_dp.c:2663:6: warning: no previous prototype for 'mtk_dp_check_hdcp_version' [-Wmissing-prototypes]
2663 | void mtk_dp_check_hdcp_version(struct mtk_dp *mtk_dp, bool only_hdcp1x)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
--
>> drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c:38: warning: Function parameter or member 'dp_tee_priv' not described in 'dp_tee_op_send'
>> drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c:38: warning: Function parameter or member 'cmd_id' not described in 'dp_tee_op_send'
>> drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c:38: warning: Excess function parameter 'chip' description in 'dp_tee_op_send'vim +/mtk_dp_read +349 drivers/gpu/drm/mediatek/mtk_dp.c
348
> 349 u32 mtk_dp_read(struct mtk_dp *mtk_dp, u32 offset)
350 {
351 return mtk_dp_reg_read(mtk_dp->regs, offset);
352 }
353
354 static int mtk_dp_write(struct mtk_dp *mtk_dp, u32 offset, u32 val)
355 {
356 int ret = regmap_write(mtk_dp->regs, offset, val);
357
358 if (ret)
359 dev_err(mtk_dp->dev,
360 "Failed to write register 0x%x with value 0x%x\n",
361 offset, val);
362 return ret;
363 }
364
365 int mtk_dp_reg_update_bits(struct regmap *regs, u32 offset,
366 u32 val, u32 mask)
367 {
368 int ret = regmap_update_bits(regs, offset, mask, val);
369
370 if (ret)
371 pr_err("Failed to update register 0x%x with value 0x%x, mask 0x%x\n",
372 offset, val, mask);
373 return ret;
374 }
375
> 376 int mtk_dp_update_bits(struct mtk_dp *mtk_dp, u32 offset, 377 u32 val, u32 mask)
378 {
379 return mtk_dp_reg_update_bits(mtk_dp->regs, offset, val, mask);
380 }
381
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi, Mac:
Quoted 9 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>--- drivers/gpu/drm/mediatek/Makefile | 7 +- drivers/gpu/drm/mediatek/ca/tci.h | 143 +++ drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h | 36 +
Use lower case for file name.
Quoted 2 lines
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c | 638 +++++++++++++ drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h | 305 +++++++
Why need a ca folder?
Quoted 12 lines
drivers/gpu/drm/mediatek/mtk_dp.c | 159 +++- drivers/gpu/drm/mediatek/mtk_dp.h | 17 + drivers/gpu/drm/mediatek/mtk_dp_hdcp.h | 154 ++++ drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c | 646 +++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h | 55 ++ drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c | 1008 +++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h | 75 ++ drivers/gpu/drm/mediatek/mtk_dp_reg.h | 6 +- 13 files changed, 3233 insertions(+), 16 deletions(-) create mode 100644 drivers/gpu/drm/mediatek/ca/tci.h create mode 100644 drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h
Quoted 9 lines
create mode 100644 drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c create mode 100644 drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h
This is large patch, so I would like you to separate this patch. Maybe ca, hdcp1, and hdcp2.
Regards,
CK
Hi, Mac:
Quoted 32 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>--- drivers/gpu/drm/mediatek/Makefile | 7 +- drivers/gpu/drm/mediatek/ca/tci.h | 143 +++ drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h | 36 + drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c | 638 +++++++++++++ drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h | 305 +++++++ drivers/gpu/drm/mediatek/mtk_dp.c | 159 +++- drivers/gpu/drm/mediatek/mtk_dp.h | 17 + drivers/gpu/drm/mediatek/mtk_dp_hdcp.h | 154 ++++ drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c | 646 +++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h | 55 ++ drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c | 1008 +++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h | 75 ++ drivers/gpu/drm/mediatek/mtk_dp_reg.h | 6 +- 13 files changed, 3233 insertions(+), 16 deletions(-) create mode 100644 drivers/gpu/drm/mediatek/ca/tci.h create mode 100644 drivers/gpu/drm/mediatek/ca/tlDPHdcpCMD.h create mode 100644 drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c create mode 100644 drivers/gpu/drm/mediatek/ca/tlcDpHdcp.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.h create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h
[snip]
drivers/gpu/drm/mediatek/ca/tci.h line 41
Quoted 6 lines
drivers/gpu/drm/mediatek/ca/tci.h new file +6
-0+ +struct cryptokeys_t { +u8 type; +u32 len; +u32 key; +};
Useless, so remove it.
Quoted 14 lines
drivers/gpu/drm/mediatek/ca/tci.h new file +14
-0+ +struct cmd_hdcp_init_for_verion_t { +u32 version; +bool need_load_key; +}; + +struct cmd_hdcp_write_val_t { +u8 type; +u8 len; +u32 val; +}; + +struct cmd_hdcp_calculate_lm_t { +u8 bksv[BKSV_LEN ];
drivers/gpu/drm/mediatek/ca/tci.h line 65
Quoted 10 lines
drivers/gpu/drm/mediatek/ca/tci.h new file +10
-0+}; + +struct cmd_hdcp_get_aksv_t { +u8 aksv[AKSV_LEN ]; +}; + +struct cmd_hdcp_sha1_t { +u32 message_len; +u32 message_addr; +};
Useless, so remove it.
Regards,
CK
Quoted 16 lines
drivers/gpu/drm/mediatek/ca/tci.h new file +16
-0+ +struct cmd_hdcp_ake_certificate_t { +u8 certification[CERT_LEN ]; +bool stored; +u8 m[M_LEN ]; +u8 ekm[EKM_LEN ]; +}; + +struct cmd_hdcp_ake_paring_t { +u8 ekm[EKM_LEN ]; +}; + +struct cmd_hdcp_enc_km_t { +u8 enc_km[ENC_KM_LEN ]; +}; +
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>
[snip]
Quoted 74 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +14
-0+ +int mdrv_dp_tx_hdcp2_fsm (struct mtk_hdcp_info *hdcp_info) +{ +static u32 timeout_value; +static u8 pre_main; +static u8 pre_sub; +static u32 pre_time; +int err_code =HDCP_ERR_NONE ; +bool stored = false; +u32 time; +int ret =0 ; +bool tmp = false; + + if (pre_main != hdcp_info->hdcp2_info.hdcp_handler.main_state||
(quoted diff) +2
-0+ hdcp_info->hdcp2_info.hdcp_handler.sub_state != pre_sub) { + DPTXHDCPMSG("Port(M : S)= (%d, %d)", hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.main_state,
(quoted diff) +1
-0+ hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.sub_state);
(quoted diff) +1
-0+ pre_main = hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.main_state;
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +21
-0+ pre_sub = hdcp_info->hdcp2_info.hdcp_handler.sub_state; + } + +switch (hdcp_info->hdcp2_info.hdcp_handler.main_state) { +case HDCP2_MS_H1P1 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_ZERO : +break ; +case HDCP2_MSG_AUTH_FAIL : +pr_err ("HDCP2.x Authentication Fail\n" ); +mdrv_dp_tx_hdcp2_enable_auth (hdcp_info, false); + hdcp_info->auth_status =AUTH_FAIL ; +break ; + } +break ; +case HDCP2_MS_A0F0 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_ZERO : +if (hdcp_info->hdcp2_info.enable) { +mdrv_dp_tx_hdcp2_init (hdcp_info); + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A1F1,(quoted diff) +1
-0+ HDCP2_MSG_ZERO);
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+DPTXHDCPMSG ("Sink Support Hdcp2x!\n" ); + }else { + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_H1P1,(quoted diff) +1
-0+ HDCP2_MSG_AU
TH_FAIL);(quoted diff) +1
-0+ DPTXHDCPMSG("Sink Doesn't SupportHdcp2x!\n");
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +12
-0+ } +break ; + } +break ; + +case HDCP2_MS_A1F1 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_ZERO : +if (hdcp_info->hdcp2_info.retry_count + <HDCP2_TX_RETRY_CNT ) { + hdcp_info->hdcp2_info.retry_count++; + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A1F1,(quoted diff) +1
-0+ HDCP2_MSG_AK
E_INIT);(quoted diff) +2
-0+ } else { + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_H1P1,(quoted diff) +1
-0+ HDCP2_MSG_AU
TH_FAIL);
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c line 525
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +4
-0+pr_err ("Try Max Count\n" ); + } +break ; +
I think you could get rid of switch case and add comment or label to indicate the state like this:
/* HDCP2_MS_A1F1 */
/* HDCP2_MSG_ZERO */
if (hdcp_info->hdcp2_info.retry_count >= HDCP2_TX_RETRY_CNT)
goto HDCP2_MSG_AUTH_FAIL:
hdcp_info->hdcp2_info.retry_count++;
/* HDCP2_MSG_AKE_INIT */
HDCP2_MSG_AUTH_FAIL:
The code looks more clear.
Regards,
CK
Quoted 524 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +2
-0+case HDCP2_MSG_AKE_INIT : + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
HDCP2_MSG_AKE_INIT);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_SEND_MSG_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +6
-0+break ; + } +mdrv_dp_tx_hdcp2_rest_variable (hdcp_info); + hdcp_info->hdcp2_info.read_certrx = true; + + hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.send_ake_init = true;
(quoted diff) +1
-0+ mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A1F1,(quoted diff) +1
-0+ HDCP2_MSG_AKE_SEND_CERT);
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +11
-0+ pre_time =get_system_time (); +break ; + +case HDCP2_MSG_AKE_SEND_CERT : + time =get_time_diff (pre_time); +if (time <HDCP2_AKESENDCERT_WDT ) { +msleep (20 ); +break ; + } +if (hdcp_info->hdcp2_info.read_certrx) + mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
HDCP2_MSG_AKE_SEND_CERT);(quoted diff) +2
-0+ + if (!hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.recv_msg)
drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +3
-0+break ; + + ret = tee_ake_certificate(hdcp_info, hdcp_info-Quoted 1 line
hdcp2_info.hdcp_rx.cert,
(quoted diff) +2
-0+ &stored, + hdcp_info-Quoted 1 line
hdcp2_info.stored_pairing_info.m,
(quoted diff) +1
-0+ hdcp_info-Quoted 1 line
hdcp2_info.stored_pairing_info.ekh_km);
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +4
-0+ +if (ret !=RET_COMPARE_PASS ) { + err_code =HDCP_ERR_PROCESS_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + hdcp_info->hdcp2_info.hdcp_handler.stored_km =stored;
(quoted diff) +1
-0+ hdcp_info->hdcp2_info.hdcp_handler.recv_msg =false;
(quoted diff) +1
-0+ mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A1F1,(quoted diff) +1
-0+ hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.stored_km ?
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +8
-0+ HDCP2_MSG_AKE_STORED_KM : + HDCP2_MSG_AKE_NO_STORED_KM); +break ; + +case HDCP2_MSG_AKE_NO_STORED_KM : +DPTXHDCPMSG ("4. Get Km, derive Ekpub(km)\n" ); + + tee_enc_rsaes_oaep(hdcp_info, hdcp_info-Quoted 1 line
hdcp2_info.hdcp_tx.ekpub_km);
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+/* Prepare ekpub_km to send */ + tmp =mdrv_dp_tx_hdcp2_write_msg (hdcp_info, + HDCP2_MSG_AKE_
NO_STORED_KM);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_SEND_MSG_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A1F1,(quoted diff) +1
-0+ HDCP2_MSG_AKE_SEND_H
_PRIME);(quoted diff) +1
-0+ timeout_value =
HDCP2_AKESENDHPRIME_NO_STORED_WDT;(quoted diff) +1
-0+ hdcp_info->hdcp2_info.hdcp_handler.recv_msg =false;
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +5
-0+ pre_time =get_system_time (); +break ; +case HDCP2_MSG_AKE_STORED_KM : +/* Prepare ekh_km & M to send */ + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
HDCP2_MSG_AKE_STORED_KM);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_SEND_MSG_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +5
-0+break ; + } + + err_code =HDCP_ERR_NONE ; + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A1F1,(quoted diff) +1
-0+ HDCP2_MSG_AKE_SEND_H
_PRIME);(quoted diff) +2
-0+ timeout_value = HDCP2_AKESENDHPRIME_STORED_WDT; + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =false;
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +7
-0+ pre_time =get_system_time (); +break ; + +case HDCP2_MSG_AKE_SEND_H_PRIME : +if (hdcp_info->hdcp2_info.read_h_prime) { +mdrv_dp_tx_hdcp2_read_msg (hdcp_info, + HDCP2_MSG_AKE
_SEND_H_PRIME);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +5
-0+ } + time =get_time_diff (pre_time); +if (time > timeout_value) { + err_code =HDCP_ERR_RESPONSE_TIMEROUT ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + if (!hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.recv_msg)
drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +3
-0+break ; + + ret = tee_ake_h_prime(hdcp_info, hdcp_info-Quoted 1 line
hdcp2_info.hdcp_tx.rtx,
(quoted diff) +1
-0+ hdcp_info-Quoted 1 line
hdcp2_info.hdcp_rx.rrx,
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +6
-0+ hdcp_info->hdcp2_info.hdcp_rx.rx_caps, + hdcp_info->hdcp2_info.hdcp_tx.tx_caps, + hdcp_info->hdcp2_info.hdcp_rx.h_prime, + HDCP2_HPRIME_SIZE); +if (ret !=RET_COMPARE_PASS ) { + if (hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.stored_km)
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+tee_clear_paring (hdcp_info); + err_code =HDCP_ERR_PROCESS_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + if (hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.stored_km)
(quoted diff) +1
-0+ mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A2F2,(quoted diff) +1
-0+ HDCP2_MSG_LC
_INIT);(quoted diff) +2
-0+ else + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A1F1,(quoted diff) +1
-0+ HDCP2_MSG_AK
E_SEND_PAIRING_INFO);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +3
-0+ + pre_time =get_system_time (); + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =false;
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +6
-0+break ; + +case HDCP2_MSG_AKE_SEND_PAIRING_INFO : +if (hdcp_info->hdcp2_info.read_pairing) +mdrv_dp_tx_hdcp2_read_msg (hdcp_info, + HDCP2_MSG_AKE
_SEND_PAIRING_INFO);(quoted diff) +2
-0+ + /* Ekh_Km must be available less than 200ms,Give mode time for some Rx */
(quoted diff) +2
-0+ time = get_time_diff(pre_time); + if (time > HDCP2_AKESENDPAIRINGINFO_WDT* 2) {
(quoted diff) +2
-0+ err_code = HDCP_ERR_RESPONSE_TIMEROUT; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + if (!hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.recv_msg)
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +4
-0+break ; + +/* Store m, km, Ekh(km) */ + tee_ake_paring(hdcp_info, hdcp_info-Quoted 1 line
hdcp2_info.hdcp_rx.ekh_km);
(quoted diff) +2
-0+ + hdcp_info->hdcp2_info.hdcp_handler.send_pair =true;
(quoted diff) +1
-0+ hdcp_info->hdcp2_info.hdcp_handler.recv_msg =false;
(quoted diff) +1
-0+ mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A2F2,HDCP2_MSG_LC_INIT);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +10
-0+ pre_time =get_system_time (); +break ; + } +break ; + +case HDCP2_MS_A2F2 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_LC_INIT : +/* prepare Rn to send */ + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
HDCP2_MSG_LC_INIT);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_SEND_MSG_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +3
-0+break ; + } + hdcp_info->hdcp2_info.hdcp_handler.send_lc_init= true;
(quoted diff) +2
-0+ + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A2F2,(quoted diff) +1
-0+ HDCP2_MSG_LC_SEND_L_PRIME);
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +11
-0+ pre_time =get_system_time (); +break ; + +case HDCP2_MSG_LC_SEND_L_PRIME : + time =get_time_diff (pre_time); +if (time <HDCP2_LCSENDLPRIME_WDT ) +break ; + +if (hdcp_info->hdcp2_info.read_l_prime) +mdrv_dp_tx_hdcp2_read_msg (hdcp_info, + HDCP2_MSG_LC_
SEND_L_PRIME);(quoted diff) +2
-0+ + if (!hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.recv_msg)
drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +3
-0+break ; + + ret = tee_lc_l_prime(hdcp_info, hdcp_info-Quoted 1 line
hdcp2_info.hdcp_tx.rn,
(quoted diff) +1
-0+ hdcp_info-Quoted 1 line
hdcp2_info.hdcp_rx.l_prime,
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +4
-0+ HDCP2_LPRIME_SIZE); +if (ret !=RET_COMPARE_PASS ) { + err_code =HDCP_ERR_PROCESS_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +5
-0+break ; + } + +DPTXHDCPMSG ("L' is PASS!!\n" ); + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =false;
(quoted diff) +1
-0+ mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A3F3,HDCP2_MSG_ZERO);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +9
-0+ pre_time =get_system_time (); +break ; + } +break ; + +case HDCP2_MS_A3F3 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_ZERO : + tee_ske_enc_ks(hdcp_info, hdcp_info-Quoted 1 line
hdcp2_info.hdcp_tx.riv,
(quoted diff) +1
-0+ hdcp_info-Quoted 1 line
hdcp2_info.hdcp_tx.eks);
(quoted diff) +2
-0+ + tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
HDCP2_MSG_SKE_SEND_EKS);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_SEND_MSG_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A3F3,(quoted diff) +1
-0+ HDCP2_MSG_SKE_SEND_EKS);
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +7
-0+ pre_time =get_system_time (); +break ; + +case HDCP2_MSG_SKE_SEND_EKS : + time =get_time_diff (pre_time); +if (time >=HDCP2_ENC_EN_TIMER ) { + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A4F4,(quoted diff) +1
-0+ HDCP2_MSG_ZERO);
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +10
-0+ } +break ; + } +break ; + +case HDCP2_MS_A4F4 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_ZERO : +if (!hdcp_info->hdcp2_info.repeater) { + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A5F5,(quoted diff) +1
-0+ HDCP2_MSG_AU
TH_DONE);(quoted diff) +2
-0+ } else { + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A6F6,(quoted diff) +1
-0+ HDCP2_MSG_RE
PAUTH_SEND_RECVID_LIST);(quoted diff) +1
-0+ hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.recv_msg = false;
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +15
-0+ pre_time =get_system_time (); + } +break ; + } +break ; + +case HDCP2_MS_A5F5 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_ZERO : +break ; +case HDCP2_MSG_AUTH_DONE : +DPTXHDCPMSG ("HDCP2.x Authentication done.\n" ); + hdcp_info->auth_status =AUTH_PASS ; + hdcp_info->hdcp2_info.retry_count =0 ; + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A5F5,HDCP2_MSG_ZERO);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +10
-0+mdrv_dp_tx_hdcp2_enable_auth (hdcp_info, true); +break ; + } +break ; +case HDCP2_MS_A6F6 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_REPAUTH_SEND_RECVID_LIST : +if (hdcp_info->hdcp2_info.read_v_prime) +mdrv_dp_tx_hdcp2_read_msg (hdcp_info, + HDCP2_MSG_REP
AUTH_SEND_RECVID_LIST);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +5
-0+ + time =get_time_diff (pre_time); +if (time >HDCP2_REPAUTHSENDRECVID_WDT ) { + err_code =HDCP_ERR_RESPONSE_TIMEROUT ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + if (!hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.recv_msg)
drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + + pre_time =get_system_time (); + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =false;
(quoted diff) +1
-0+ mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A7F7,(quoted diff) +1
-0+ HDCP2_MSG_REPAUTH_VE
RIFY_RECVID_LIST);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +8
-0+break ; + } +break ; + +case HDCP2_MS_A7F7 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_REPAUTH_VERIFY_RECVID_LIST : + if ((hdcp_info->hdcp2_info.hdcp_rx.rx_info[1] &(BIT(2) | BIT(3))) != 0) {
(quoted diff) +1
-0+ pr_err("DEVS_EXCEEDED orCASCADE_EXCEDDED!\n");
(quoted diff) +2
-0+ err_code = HDCP_ERR_PROCESS_FAIL; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +5
-0+break ; + } + +/* check seqNumV here */ + tmp =
mdrv_dp_tx_hdcp2_check_seq_num_v(hdcp_info);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_PROCESS_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + tmp =
mdrv_dp_tx_hdcp2_recv_rep_auth_send_recv_id_list(hdcp_info);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_PROCESS_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A8F8,(quoted diff) +1
-0+ HDCP2_MSG_REPAUTH_SE
ND_ACK);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +9
-0+break ; + } +break ; + +case HDCP2_MS_A8F8 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_REPAUTH_SEND_ACK : + tmp =mdrv_dp_tx_hdcp2_write_msg (hdcp_info, + HDCP2_MSG_REPA
UTH_SEND_ACK);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_SEND_MSG_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +7
-0+break ; + } + + time =get_time_diff (pre_time); +if (time >HDCP2_REP_SEND_ACK ) { + err_code =HDCP_ERR_RESPONSE_TIMEROUT ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A9F9,(quoted diff) +1
-0+ HDCP2_MSG_REPAUTH_ST
REAM_MANAGE);(quoted diff) +1
-0+ hdcp_info->hdcp2_info.hdcp_handler.retry_cnt =0;
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +8
-0+break ; + } +break ; + +case HDCP2_MS_A9F9 : +switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) { +case HDCP2_MSG_REPAUTH_STREAM_MANAGE : + tmp =
mdrv_dp_tx_hdcp2_process_rep_auth_stream_manage(hdcp_info);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_PROCESS_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +5
-0+break ; + } + + tmp =mdrv_dp_tx_hdcp2_write_msg (hdcp_info, + HDCP2_MSG_REPA
UTH_STREAM_MANAGE);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_SEND_MSG_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +5
-0+break ; + } + + pre_time =get_system_time (); + hdcp_info->hdcp2_info.hdcp_handler.recv_msg =false;
(quoted diff) +1
-0+ mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A9F9,(quoted diff) +1
-0+ HDCP2_MSG_REPAUTH_ST
REAM_READY);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +6
-0+break ; +case HDCP2_MSG_REPAUTH_STREAM_READY : + time =get_time_diff (pre_time); +if (time >HDCP2_REPAUTHSTREAMRDY_WDT /2 ) +mdrv_dp_tx_hdcp2_read_msg (hdcp_info, + HDCP2_MSG_REP
AUTH_STREAM_READY);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +7
-0+else +break ; + + time =get_time_diff (pre_time); +if (time >HDCP2_REPAUTHSTREAMRDY_WDT ) { + err_code =HDCP_ERR_RESPONSE_TIMEROUT ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);(quoted diff) +2
-0+ break; + } else if (!hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.recv_msg) {
(quoted diff) +1
-0+ if (hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.retry_cnt
(quoted diff) +1
-0+ >=
HDCP2_STREAM_MANAGE_RETRY_CNT) {(quoted diff) +1
-0+ err_code =
HDCP_ERR_RESPONSE_TIMEROUT;(quoted diff) +1
-0+ mdrv_dp_tx_hdcp2_err_handle(hdc
p_info,err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + hdcp_info-Quoted 1 line
hdcp2_info.hdcp_handler.retry_cnt++;
(quoted diff) +2
-0+ + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A9F9,(quoted diff) +1
-0+ HDCP2_MSG_RE
PAUTH_STREAM_READY);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + tmp =
mdrv_dp_tx_hdcp2_recv_rep_auth_stream_ready(hdcp_info);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+if (!tmp) { + err_code =HDCP_ERR_PROCESS_FAIL ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
err_code,__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +4
-0+break ; + } + + mdrv_dp_tx_hdcp2_set_state(hdcp_info,
HDCP2_MS_A5F5,(quoted diff) +1
-0+ HDCP2_MSG_AUTH_DONE);
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +6
-0+break ; + } +break ; +default : + err_code =HDCP_ERR_UNKNOWN_STATE ; + mdrv_dp_tx_hdcp2_err_handle(hdcp_info, err_code,
__LINE__);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +6
-0+break ; + } + +return err_code; +} +
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c line 261
Quoted 11 lines
(quoted diff) +2
-0+ +int tee_hdcp_enable_encrypt(struct mtk_hdcp_info *hdcp_info, boolenable, u8 version)
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +8
-0+{ +int rc; +struct dp_tee_private *dp_tee_priv = hdcp_info->g_dp_tee_priv; +struct tci_t *tci = (struct tci_t *)dp_tee_priv->shm->kaddr; +u8 *share_buffer = (u8 *)dp_tee_priv->shm->kaddr; + +/* Copy parameters */ +memset (tci,0 ,TCI_LENGTH );
You don't need to clear this structure. The field you do not write in this command would not be access in tee. So it's not necessary to clear the field that does not write in this command.
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c line 293
Quoted 11 lines
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +3
-0+ tci->command_id =CMD_ENABLE_ENCRYPT ; +if (enable) + tci->cmd_body.cmd_hdcp_write_val.type =
TYPE_HDCP_ENABLE_ENCRYPT;(quoted diff) +2
-0+ else + tci->cmd_body.cmd_hdcp_write_val.type =
TYPE_HDCP_DISABLE_ENCRYPT;drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +4
-0+ +/* Set HDCP version supportted by device */ + tci->cmd_body.cmd_hdcp_write_val.len =1 ; +memset (share_buffer +TCI_LENGTH , version,1 );
It's weird that some data in the range of share_buffer + 0 ~ share_buffer + TCI_LENGTH - 1, and some data is after share_buffer + TCI_LENGTH. Do not separate them and code would be more clear.
Regards,
CK
Quoted 11 lines
(quoted diff) +2
-0+ + rc = dp_tee_op_send(dp_tee_priv, (u8 *)tci, TCI_LENGTH + 1,
CMD_ENABLE_ENCRYPT);drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +8
-0+if (rc !=0 ) { +TLCERR ("tee_op_send failed, error=%x\n" , rc); +return rc; + } + +return rc; +} +
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
Quoted 40 lines
+static int
dp_tee_op_send(struct dp_tee_private *dp_tee_priv, u8 *buf, size_t len, u32 cmd_id)drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +9
-0+{ +int rc; +u8 *temp_buf; +struct tee_ioctl_invoke_arg transceive_args; +struct tee_param command_params[4 ]; +struct tee_shm *shm = dp_tee_priv->shm; + +if (len >MAX_COMMAND_SIZE ) { + TLCERR("%s: len=%zd exceeds MAX_COMMAND_SIZE supportedby dp TA\n",
__func__, len);drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +27
-0+return -EIO ; + } + +memset (&transceive_args,0 ,sizeof (transceive_args)); +memset (command_params,0 ,sizeof (command_params)); + dp_tee_priv->resp_len =0 ; + +/* Invoke FTPM_OPTEE_TA_SUBMIT_COMMAND function of dp TA */ + transceive_args = (struct tee_ioctl_invoke_arg ) { + .func = cmd_id, + .session = dp_tee_priv->session, + .num_params =4 , + }; + +/* Fill FTPM_OPTEE_TA_SUBMIT_COMMAND parameters */ + command_params[0 ] = (struct tee_param ) { + .attr =TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT , + .u.memref = { + .shm = shm, + .size = len, + .shm_offs =0 , + }, + }; + + temp_buf =tee_shm_get_va (shm,0 ); +if (IS_ERR (temp_buf)) { + TLCERR("%s: tee_shm_get_va failed for transmit\n",
__func__);
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c line 77
Quoted 4 lines
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +4
-0+return PTR_ERR (temp_buf); + } + +memcpy (temp_buf, buf, len);
temp_buf is equal to buf, so drop temp_buf.
Regards,
CK
Quoted 33 lines
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +14
-0+ + command_params[1 ] = (struct tee_param ) { + .attr =TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT , + .u.memref = { + .shm = shm, + .size =MAX_RESPONSE_SIZE , + .shm_offs =MAX_COMMAND_SIZE , + }, + }; + + rc =tee_client_invoke_func (dp_tee_priv->ctx, &transceive_args, + command_params); +if (rc <0 || transceive_args.ret !=0 ) { + TLCERR("%s: invoke error: 0x%x\n", __func__,transceive_args.ret);
drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +4
-0+return (rc <0 ) ? rc : transceive_args.ret; + } + + temp_buf = tee_shm_get_va(shm,command_params[1].u.memref.shm_offs);
(quoted diff) +2
-0+ if (IS_ERR(temp_buf)) { + TLCERR("%s: tee_shm_get_va failed for receive\n",
__func__);drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +10
-0+return PTR_ERR (temp_buf); + } + +/* Sanity checks look good, cache the response */ +memcpy (dp_tee_priv->resp_buf, temp_buf,MAX_RESPONSE_SIZE /2 ); + dp_tee_priv->resp_len =MAX_RESPONSE_SIZE /2 ; + +return 0 ; +} +
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>
[snip]
Quoted 18 lines
(quoted diff) +2
-0+ +static void mhal_dp_tx_hdcp1x_set_repeater(struct mtk_hdcp_info
*hdcp_info, bool enable)drivers/gpu/drm/mediatek/ca/tlcDpHdcp.c new file +3
-0+{ +if (enable) + mtk_dp_reg_update_bits(hdcp_info->regs,
MTK_DP_TRANS_P0_34A4, BIT(15), BIT(15));(quoted diff) +2
-0+ else + mtk_dp_reg_update_bits(hdcp_info->regs,
MTK_DP_TRANS_P0_34A4, 0, BIT(15));drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +7
-0+ +#ifdef IF_ZERO +if (hdcp_info->hdcp1x_info.repeater) { +u8 temp; + + temp =BIT (0 );/* REAUTHENTICATION_ENABLE_IRQ_HPD */ + drm_dp_dpcd_write(hdcp_info->aux, DPCD_6803B, &temp,1);
Review
Quoted 2 lines
(quoted diff) +2
-0+ } +#endif
IF_ZERO is not defined, so remove these.
Regards,
CK
Quoted 2 lines
(quoted diff) +2
-0+} +
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_dp.c +1
-0+static int mtk_dp_probe (struct platform_device *pdev) {struct mtk_dp *mtk_dp;@@ -2657,6 +2778,16 @@ static int mtk_dp_probe(struct platform_device *pdev)if (ret)return ret;
drivers/gpu/drm/mediatek/mtk_dp.c static int mtk_dp_probe(struct platform_device · line 2791
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dp.c +9
-0+INIT_WORK (&mtk_dp->hdcp_work, mtk_dp_hdcp_handle); + mtk_dp->hdcp_workqueue =create_workqueue ("mtk_dp_hdcp_work" ); +if (!mtk_dp->hdcp_workqueue) { +dev_err (mtk_dp->dev,"failed to create hdcp work queue"); +return -ENOMEM ; + } + + mtk_dp->hdcp_info.aux = &mtk_dp->aux; + mtk_dp->hdcp_info.regs = mtk_dp->regs;
It's not necessary to duplicate aux and regs, so drop this.
Regards,
CK
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_dp.c +1
-0+ mtk_dp->bridge.funcs = &mtk_dp_bridge_funcs;drivers/gpu/drm/mediatek/mtk_dp.c +0
-0mtk_dp->bridge.of_node = dev->of_node; mtk_dp->bridge.type = mtk_dp->data->bridge_type;
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
Quoted 3 lines
(quoted diff) +2
-0+ +void mdrv_dp_tx_hdcp1x_set_start_auth(struct mtk_hdcp_info
*hdcp_info, bool enable)
The prefix 'mdrv' of each function seems redundant. So drop the prifix 'mdrv'.
Regards,
CK
Quoted 23 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +6
-0+{ + hdcp_info->hdcp1x_info.enable = enable; + +if (enable) { + hdcp_info->auth_status =AUTH_INIT ; + hdcp_info->hdcp1x_info.main_states =
HDCP1X_main_state_A0;(quoted diff) +1
-0+ hdcp_info->hdcp1x_info.sub_states =
HDCP1X_sub_FSM_IDLE;drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +3
-0+ }else { + hdcp_info->auth_status =AUTH_ZERO ; + hdcp_info->hdcp1x_info.main_states =
HDCP1X_main_state_H2;(quoted diff) +1
-0+ hdcp_info->hdcp1x_info.sub_states =
HDCP1X_sub_FSM_IDLE;drivers/gpu/drm/mediatek/mtk_dp_hdcp1x.c new file +8
-0+tee_hdcp_enable_encrypt (hdcp_info, false,HDCP_NONE ); +mhal_dp_tx_hdcp1x_start_cipher (hdcp_info, false); +tee_hdcp1x_soft_rst (hdcp_info); + } + + hdcp_info->hdcp1x_info.retry_count =0 ; +} +
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c line 117
Quoted 5 lines
+static bool
mdrv_dp_tx_hdcp2_inc_seq_num_m(struct mtk_hdcp_info *hdcp_info)drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+{ +u8 i =0 ; +u32 temp_value =0 ;
Use tmp is enough.
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +3
-0+ +for (i =0 ; i <HDCP2_SEQ_NUM_M_SIZE ; i++) + temp_value |= hdcp_info-Quoted 1 line
hdcp2_info.hdcp_tx.seq_num_m[i] << (i * 8);
+
tmp = drm_hdcp_be24_to_cpu(hdcp_info->hdcp2_info.hdcp_tx.seq_num_m);
Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +8
-0+if (temp_value ==0xFFFFFF ) +return false; + + temp_value++; + +for (i =0 ; i <HDCP2_SEQ_NUM_M_SIZE ; i++) + hdcp_info->hdcp2_info.hdcp_tx.seq_num_m[i] = + (temp_value & ((u32)0xFF << (i * 8))) >> (i *8);
drm_hdcp_cpu_to_be24(hdcp_info->hdcp2_info.hdcp_tx.seq_num_m, tmp);
Regards,
CK
Quoted 2 lines
(quoted diff) +2
-0+ return true; +}
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
Review
Quoted 2 lines
(quoted diff) +2
-0+#define AN_LEN 8 +#define AKSV_LEN 5
Is this DRM_HDCP_KSV_LEN?
If all these length are defined in HDCP specification, move these definition to include/drm/drm_hdcp.h
Regards,
CK
Quoted 10 lines
drivers/gpu/drm/mediatek/ca/tci.h new file +10
-0+#define BKSV_LEN 5 +#define CERT_LEN 522 +#define EKM_LEN 16 +#define M_LEN 16 +#define ENC_KM_LEN 128 +#define RXX_LEN 8 +#define CAPS_LEN 3 +#define RN_LEN 8 +#define RIV_LEN 8 +
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
Quoted 23 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp.h new file +22
-0@@ -0,0 +1,154 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2019-2023 MediaTek Inc. +*/ + +#ifndef _MTK_DP_HDCP_H_ +#define _MTK_DP_HDCP_H_ + +#include <linux/types.h> +#include <drm/display/drm_dp_helper.h> +#include <linux/sched/clock.h> + +#define HDCP2_RXSTATUS_SIZE 1 +#define HDCP2_RTX_SIZE 8 +#define HDCP2_RRX_SIZE 8 +#define HDCP2_TXCAPS_SIZE 3 +#define HDCP2_RXCAPS_SIZE 3 +#define HDCP2_M_SIZE 16 +#define HDCP2_KD_SIZE 32 +#define HDCP2_CERTRX_SIZE 522 +#define HDCP2_EKPUBKM_SIZE 128 +#define HDCP2_EKHKM_SIZE 16
drivers/gpu/drm/mediatek/mtk_dp_hdcp.h line 32
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp.h new file +10
-0+#define HDCP2_KM_SIZE 16 +#define HDCP2_KH_SIZE 16 +#define HDCP2_RN_SIZE 8 +#define HDCP2_LPRIME_SIZE 32 +#define HDCP2_EDKEYKS_SIZE 16 +#define HDCP2_KS_SIZE 16 +#define HDCP2_RIV_SIZE 8 +#define HDCP2_RXINFO_SIZE 2 +#define HDCP2_SEQ_NUM_V_SIZE 3 +#define HDCP2_RECVID_SIZE 5
Is this HDCP_2_2_RECEIVERID_LEN? If this is defined in HDCP specification, move these definition to include/drm/drm_hdcp.h
Regards,
CK
Quoted 17 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp.h new file +17
-0+#define HDCP2_VPRIME_SIZE 16 +#define HDCP2_RECV_ID_LIST_SIZE 155 +#define HDCP2_SEQ_NUM_M_SIZE 3 +#define HDCP2_STREAMID_TYPE_SIZE 2 +#define HDCP2_K_SIZE 2 +#define HDCP2_REP_MPRIME_SIZE 32 +#define HDCP2_HPRIME_SIZE 32 +#define HDCP2_RX_ENCKEY_SIZE 104 +#define HDCP2_TX_ENCKEY_SIZE 448 +#define HDCP2_LC128_SIZE 16 +#define HDCP2_KPUBRX_MODULUS_SIZE 128 +#define HDCP2_KPUBRX_EXPONENT_SIZE 3 +#define HDCP2_KPUBRX_RESERVED_SIZE 2 +#define HDCP2_MAX_DEVICE_COUNT 31 +#define HDCP2_MAX_DEPTH_LEVEL 4 +#define HDCP2_KPUB_SIZE 384 +
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h line 49
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h new file +10
-0+ +enum ENUM_HDCP2_MSG_LIST { +HDCP2_MSG_ZERO =0 , +HDCP2_MSG_AKE_INIT =1 , +HDCP2_MSG_AKE_SEND_CERT =2 , +HDCP2_MSG_AKE_NO_STORED_KM =3 , +HDCP2_MSG_AKE_STORED_KM =4 , +HDCP2_MSG_AKE_SEND_H_PRIME =5 , +HDCP2_MSG_AKE_SEND_PAIRING_INFO =6 , +HDCP2_MSG_LC_INIT =7 ,
This looks like HDCP_2_2_LC_INIT in include/drm/drm_hdcp.h. If these are defined in HDCP specification, move these definition to include/drm/drm_hdcp.h
Regards,
CK
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h new file +10
-0+HDCP2_MSG_LC_SEND_L_PRIME =8 , +HDCP2_MSG_SKE_SEND_EKS =9 , +HDCP2_MSG_REPAUTH_SEND_RECVID_LIST =10 , +HDCP2_MSG_REPAUTH_VERIFY_RECVID_LIST =11 , +HDCP2_MSG_REPAUTH_SEND_ACK =12 , +HDCP2_MSG_REPAUTH_STREAM_MANAGE =13 , +HDCP2_MSG_REPAUTH_STREAM_READY =14 , +HDCP2_MSG_AUTH_FAIL =15 , + HDCP2_MSG_AUTH_DONE = 16, +};
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h line 18
Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h new file +9
-0+ +/* Timeout relative */ +#define HDCP2_AKESENDCERT_WDT 100 // 100ms +#define HDCP2_AKESENDHPRIME_NO_STORED_WDT 1000 // 1sec +#define HDCP2_AKESENDHPRIME_STORED_WDT 200 // 200ms +#define HDCP2_AKESENDPAIRINGINFO_WDT 200 // 200ms +#define HDCP2_LCSENDLPRIME_WDT 7 // 7ms +#define HDCP2_ENC_EN_TIMER 200 // 200 ms +#define HDCP2_REPAUTHSENDRECVID_WDT 3000 // 3 sec
Is this HDCP_2_2_RECVID_LIST_TIMEOUT_MS? If these are defined in HDCP specification, move these definition to include/drm/display/drm_hdcp.h
Regards,
CK
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.h new file +3
-0+#define HDCP2_REP_SEND_ACK 2000 // 2 Sec +#define HDCP2_REPAUTHSTREAMRDY_WDT 100 // 100 ms +
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
drivers/gpu/drm/mediatek/mtk_dp_hdcp.h line 72
Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp.h new file +11
-0+ +struct hdcp2_info_rx { +u8 cert[HDCP2_CERTRX_SIZE ]; +u8 rrx[HDCP2_RRX_SIZE ]; +u8 rx_caps[HDCP2_RXCAPS_SIZE ]; +u8 rx_info[HDCP2_RXINFO_SIZE ]; +u8 ekh_km[HDCP2_EKHKM_SIZE ]; +u8 v_prime[HDCP2_VPRIME_SIZE ]; +u8 m_prime[HDCP2_REP_MPRIME_SIZE ]; +u8 h_prime[HDCP2_HPRIME_SIZE ]; +u8 l_prime[HDCP2_LPRIME_SIZE ];
This is defined in include/drm/display/drm_hdcp.h as struct hdcp2_lc_send_lprime{}, so I think you could reuse it. Ditto for all others in hdcp2_info_rx{}.
Regards,
CK
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp.h new file +4
-0+u8 recv_id_list[HDCP2_MAX_DEVICE_COUNT *HDCP2_RECVID_SIZE ]; +u8 seq_num_v[HDCP2_SEQ_NUM_V_SIZE ]; +}; +
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
drivers/gpu/drm/mediatek/mtk_dp.c static void mtk_dp_bridge_atomic_enable(struct · line 2328
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_dp.c +1
-1@@ -2271,7 +2324,7 @@ static void mtk_dp_bridge_atomic_enable(struct drm_bridge *bridge, mtk_dp->enabled = true;mtk_dp_update_plugged_status (mtk_dp); - +mtk_dp_re_authentication (&mtk_dp->hdcp_info);
According to intel HDCP flow [1], I think you should enable HDCP according to the connector status set by user space.
Regards,
CK
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_dp.c +0
-0return ; power_off_aux:mtk_dp_update_bits(mtk_dp,
MTK_DP_TOP_PWR_STATE,
Hi, Mac:
Quoted 6 lines · mac.shen
Add tee client application, HDCP 1.x and 2.x authentication for DisplayPort
to support the HDCP feature.Signed-off-by mac.shen <[email protected]>---
[snip]
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c line 955
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +7
-0+ +bool mdrv_dp_tx_hdcp2_support (struct mtk_hdcp_info *hdcp_info) +{ +u8 temp_buffer[3 ]; +int ret; + + drm_dp_dpcd_read(hdcp_info->aux,
DP_HDCP_2_2_REG_RX_CAPS_OFFSET,temp_buffer,0x3);drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +2
-0+ +if ((temp_buffer[2 ] &BIT (1 )) && temp_buffer[0 ] ==0x02 ) {
Use defined symbol instead of magic number. According to [1], this could be:
if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL &&
HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2]))Regards,
CK
Quoted 23 lines
(quoted diff) +2
-0+ hdcp_info->hdcp2_info.enable = true; + hdcp_info->hdcp2_info.repeater = temp_buffer[2] &BIT(0);
drivers/gpu/drm/mediatek/mtk_dp_hdcp2.c new file +20
-0+ }else { + hdcp_info->hdcp2_info.enable = false; + } + +DPTXHDCPMSG ("HDCP.2x CAPABLE: %d, Reapeater: %d\n" , + hdcp_info->hdcp2_info.enable, + hdcp_info->hdcp2_info.repeater); + +if (!hdcp_info->hdcp2_info.enable) +return false; + + ret =tee_add_device (hdcp_info,HDCP_VERSION_2X ); +if (ret !=RET_SUCCESS ) { +pr_err ("HDCP TA has some error\n" ); + hdcp_info->hdcp2_info.enable = false; + } + +return hdcp_info->hdcp2_info.enable; +} +