]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] tc358743: Disable HDCP with "manual HDCP authentication" bit
authorMats Randgaard <matrandg@cisco.com>
Tue, 6 Dec 2016 10:24:28 +0000 (08:24 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 3 Feb 2017 13:16:02 +0000 (11:16 -0200)
Originally Toshiba told us that the only way to disable HDCP was to
set the receiver in repeater mode, that would make the authentication
fail because of missing software support. It has worked fine with all
the sources we and our customers has used, until it was reported
problems with Apple MacBook (Retina, 12-inch, Early 2015)
(https://support.apple.com/kb/SP712?locale=en_US&viewlocale=en_US)
with Apple A1612 USB type-C multiport adapter
(http://www.apple.com/shop/product/MJ1K2AM/A/usb-c-digital-av-multiport-adapter)

Finally Toshiba came up with a hidden bit that is named "Manual HDCP
authentication". In this patch the original "repeater mode" concept is
removed, and the new bit is set instead.

With his patch HDCP is disabled when connected to the Apple MacBook
and all other sources we have tested so far. The Apple MacBook is
constantly trying to authenticate, but fails and continues to transmit
unencrypted video.

Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/tc358743.c
drivers/media/i2c/tc358743_regs.h

index a35aaf8e08e7557bcc91898cc8f7f318a47e1b89..257969a31baf7817500e10a3eecd47b0168a3aed 100644 (file)
@@ -368,29 +368,21 @@ static void tc358743_set_hdmi_hdcp(struct v4l2_subdev *sd, bool enable)
        v4l2_dbg(2, debug, sd, "%s: %s\n", __func__, enable ?
                                "enable" : "disable");
 
-       i2c_wr8_and_or(sd, HDCP_REG1,
-                       ~(MASK_AUTH_UNAUTH_SEL | MASK_AUTH_UNAUTH),
-                       MASK_AUTH_UNAUTH_SEL_16_FRAMES | MASK_AUTH_UNAUTH_AUTO);
+       if (enable) {
+               i2c_wr8_and_or(sd, HDCP_REG3, ~KEY_RD_CMD, KEY_RD_CMD);
 
-       i2c_wr8_and_or(sd, HDCP_REG2, ~MASK_AUTO_P3_RESET,
-                       SET_AUTO_P3_RESET_FRAMES(0x0f));
+               i2c_wr8_and_or(sd, HDCP_MODE, ~MASK_MANUAL_AUTHENTICATION, 0);
 
-       /* HDCP is disabled by configuring the receiver as HDCP repeater. The
-        * repeater mode require software support to work, so HDCP
-        * authentication will fail.
-        */
-       i2c_wr8_and_or(sd, HDCP_REG3, ~KEY_RD_CMD, enable ? KEY_RD_CMD : 0);
-       i2c_wr8_and_or(sd, HDCP_MODE, ~(MASK_AUTO_CLR | MASK_MODE_RST_TN),
-                       enable ?  (MASK_AUTO_CLR | MASK_MODE_RST_TN) : 0);
+               i2c_wr8_and_or(sd, HDCP_REG1, 0xff,
+                               MASK_AUTH_UNAUTH_SEL_16_FRAMES |
+                               MASK_AUTH_UNAUTH_AUTO);
 
-       /* Apple MacBook Pro gen.8 has a bug that makes it freeze every fifth
-        * second when HDCP is disabled, but the MAX_EXCED bit is handled
-        * correctly and HDCP is disabled on the HDMI output.
-        */
-       i2c_wr8_and_or(sd, BSTATUS1, ~MASK_MAX_EXCED,
-                       enable ? 0 : MASK_MAX_EXCED);
-       i2c_wr8_and_or(sd, BCAPS, ~(MASK_REPEATER | MASK_READY),
-                       enable ? 0 : MASK_REPEATER | MASK_READY);
+               i2c_wr8_and_or(sd, HDCP_REG2, ~MASK_AUTO_P3_RESET,
+                               SET_AUTO_P3_RESET_FRAMES(0x0f));
+       } else {
+               i2c_wr8_and_or(sd, HDCP_MODE, ~MASK_MANUAL_AUTHENTICATION,
+                               MASK_MANUAL_AUTHENTICATION);
+       }
 }
 
 static void tc358743_disable_edid(struct v4l2_subdev *sd)
index 81f1db558e7c79f4e0ca1787e8dae8ccd62ac0f2..657ef50f215f5f03ccebc2b734a38b51387be587 100644 (file)
 #define MASK_MODE_RST_TN                      0x20
 #define MASK_LINE_REKEY                       0x10
 #define MASK_AUTO_CLR                         0x04
+#define MASK_MANUAL_AUTHENTICATION            0x02 /* Not in REF_01 */
 
 #define HDCP_REG1                             0x8563 /* Not in REF_01 */
 #define MASK_AUTH_UNAUTH_SEL                  0x70