From patchwork Mon Nov 14 08:04:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 19580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2026922wru; Mon, 14 Nov 2022 00:12:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf4dTxtIKXT3d1TiDdtKMnDVYeafm026O8ZTd0+lsF0nPCBg9AN41w7hU8kWknaccecP0buf X-Received: by 2002:a17:906:35d7:b0:7ad:eb81:c6c7 with SMTP id p23-20020a17090635d700b007adeb81c6c7mr8900279ejb.91.1668413542882; Mon, 14 Nov 2022 00:12:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668413542; cv=none; d=google.com; s=arc-20160816; b=LDYZ3+MZ2qlj9isJXYhJAnnoOdkkJOp48ehdoARlpJbXsjCt358ROC6m17Qnrbhdfx JY9yCExN1rB5tIBIeuQne7wB917iEMUwDbukjltwjh1GJjka/YpmctQG+LvbVlYTv4MX GLanEZRomwQ1HoL8tOWD0yw42fZsNMDQUh3pYu+d1m76itq+Sn/4M3CAI1EyADhdJS7M IzIDzwRawpNa+34AZzvo56cyD6jxB9Lzuty1xRMdfJl3we4BwmhbYx59LsEg6cWDoVAJ cV4ERflINfaRyMelOTVFy+gaOHUTGh4LI08MUBErA0sl6C7NRPFuVY22RX+rNYuPsIV7 BRCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xoG+PJ9Nv0PDD+u17FuY5+9Du9VLILbNauZXpkpEyQQ=; b=PBNTCJBVWRHQ+hjMjNb4TDNx7N7KlsOfCtw+Lbw0aGrJOVoSOln4c98KZFp03Dx9iO WafjgDar7TQCDGg0B8EgGWMUyrZjEPlBFM41BILmIrvPikze9lcf1nY27e9ceVDQmnET I3XRLGi7Z2rLEsHEvCr5A6nilgWqFU0MiaqPkcNj03Qvjn56eQU0FhuLo9mNObWSIWRd 1z4EUVWnFhhJMpmD+koqs6/+KxSTHWU9TJy5UsemTuOOFGHouBUGU4ME0VZDjAmpyZTR uS10tpUwspKbz9AVfdyzHh1pQlWxMblLjosac3Kx44hI5zofcotolNKAumSIXrDz9foB 42Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CIZEgZfU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz3-20020a1709072ce300b00783c42d2da1si8210873ejc.425.2022.11.14.00.11.59; Mon, 14 Nov 2022 00:12:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CIZEgZfU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236182AbiKNIEh (ORCPT + 99 others); Mon, 14 Nov 2022 03:04:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235782AbiKNIEf (ORCPT ); Mon, 14 Nov 2022 03:04:35 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80821A44D for ; Mon, 14 Nov 2022 00:04:34 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id b11so9654530pjp.2 for ; Mon, 14 Nov 2022 00:04:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xoG+PJ9Nv0PDD+u17FuY5+9Du9VLILbNauZXpkpEyQQ=; b=CIZEgZfUnCWJeURsVp/Xm+odE+LazMMPO6T0YWFu4rOJWHW0dOOIryWk6KVIImAAIj dnRQXgEEDyvvG10/lE+19pymhklk3X1ZIMT5Ml3unTgam0Atkjjo5k6BXk5KC5muXRdZ SKJnnogqqy0wD5olJGDVRJpf46SyYN6BB38L4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xoG+PJ9Nv0PDD+u17FuY5+9Du9VLILbNauZXpkpEyQQ=; b=Fxf4EWFEdyh3nUwZFgrtz6+3OQOwnH0ohI9cc5F/79+DUUMxSTH04idnH3n5rTMuza qb9yWjqG+MaH+VfPs2i3PLQcBBVMt2QZiaBba1Y6A/L3q+jGTS+k8aIK+vot4eUCwmj5 pnp18ciHc1sJoQRCA+mhX4X2S13YKAqhXB953Si0BH1+f6QXwNuw2hn8R46ws+hq0QfP vhhVmu7JcwutgRkNF6iYBMr/F4Xfpy7JEgYV5pa/mcxi4JG2G6ksqJMiMVJZyQ9qSIeY Pg+Lk67Ng4+mIKl1MUCeNcrBgNbGQeQCfotdohpyWgNsB+53ww+1hFNC+eRVrhwuzZj1 NJyw== X-Gm-Message-State: ANoB5pnpIPRFu+81i50cPvcDLojAz+vweAEJBw+ZG5+QE+cYmTghPbVx Tv59X0GwxF1vklQm7Nm1S2sCvQ== X-Received: by 2002:a17:90a:28e5:b0:213:566c:376e with SMTP id f92-20020a17090a28e500b00213566c376emr13043378pjd.96.1668413073771; Mon, 14 Nov 2022 00:04:33 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:40f1:682:170b:f25a]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e5d000b00186fb8f931asm6696799plf.206.2022.11.14.00.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 00:04:33 -0800 (PST) From: Hsin-Yi Wang To: Sean Paul , Douglas Anderson , Robert Foss Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Allen Chen , David Airlie Subject: [PATCH v4 1/3] drm_bridge: register content protect property Date: Mon, 14 Nov 2022 16:04:05 +0800 Message-Id: <20221114080405.2426999-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749458398872007812?= X-GMAIL-MSGID: =?utf-8?q?1749458398872007812?= Some bridges are able to update HDCP status from userspace request if they support HDCP. HDCP property is the same as other connector properties that needs to be created after the connecter is initialized and before the connector is registered. If there exists a bridge that supports HDCP, add the property to the bridge connector. Signed-off-by: Hsin-Yi Wang Reviewed-by: Sean Paul --- v3->v4: no change. --- drivers/gpu/drm/drm_bridge_connector.c | 8 ++++++++ include/drm/drm_bridge.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index 1c7d936523df..b4fb5da0b963 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -333,6 +334,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, struct i2c_adapter *ddc = NULL; struct drm_bridge *bridge, *panel_bridge = NULL; int connector_type; + bool support_hdcp = false; bridge_connector = kzalloc(sizeof(*bridge_connector), GFP_KERNEL); if (!bridge_connector) @@ -376,6 +378,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, if (drm_bridge_is_panel(bridge)) panel_bridge = bridge; + + if (bridge->support_hdcp) + support_hdcp = true; } if (connector_type == DRM_MODE_CONNECTOR_Unknown) { @@ -398,6 +403,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, if (panel_bridge) drm_panel_bridge_set_orientation(connector, panel_bridge); + if (support_hdcp && IS_ENABLED(CONFIG_DRM_DISPLAY_HDCP_HELPER)) + drm_connector_attach_content_protection_property(connector, true); + return connector; } EXPORT_SYMBOL_GPL(drm_bridge_connector_init); diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 6b65b0dfb4fb..1d2ab70f3436 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -768,6 +768,10 @@ struct drm_bridge { * modes. */ bool interlace_allowed; + /** + * @support_hdcp: Indicate that the bridge supports HDCP. + */ + bool support_hdcp; /** * @ddc: Associated I2C adapter for DDC access, if any. */ From patchwork Mon Nov 14 08:04:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 19581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2026959wru; Mon, 14 Nov 2022 00:12:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf7qxO+vp9l8DU/r5FtNB8JofqCKs8a3WoKXrQYMq6kmubygo9cWmpMwoY6XyuwCkNf3OLp7 X-Received: by 2002:a05:6402:95b:b0:459:401:c23e with SMTP id h27-20020a056402095b00b004590401c23emr10707490edz.23.1668413551523; Mon, 14 Nov 2022 00:12:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668413551; cv=none; d=google.com; s=arc-20160816; b=ZOuyAqtSX8K2uv9Aq5Z+tWUXVQzvZoFSngMizz0JQv+lzTDOF3Nem5s16SxMcdUJne YBeq99HLZHtstRtrHbhGhJHmdP1UbI/vhGAvcfmuddU7CqausoRJ+/9rIMg2pL8FFO1K 3oSHptheJ5e2lCwHETvu7TVNm43IYBn9XZIWVmsLDqe9APV+HJrSZ+N82QGitf0VwJ5k KWfxzsaz+juX8oik7fISVGuc+OqVxopruVKJEpcqDFCBDNDBvkQpgTumYOnC2IEm3bCW Iv6rH1FqHyEpLwm96D/1D+OwtqCSQt2aNB4m2GgZ+LAFKQkMCfzEq7Cg7woDLGm7BG5Q cbZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bJDRhD+by6ePLMyu0jFNF0DA5otbXQzM82G9QXM16+g=; b=d1hFl++ZEvAysdh2htZGNqPnVrqLTgmjYwadG7tgQHcOMx+iXDlguaej68OlyRTO1b A139J6lm82rcfGHQBQEXlS9VyG3hFh9EVll+WB3WOlQLb5Y4pIkEaWOLgT6xOecIKgSv qt8OZCNAbeDDuMPxH6hlSH5A606apymycaXsBv7nnpy4qPeWSlxolT2SunUrrLi7yDWr /WMv/ikR1qEwgrgdIz3GtpPZKD0VuRkj1rIfgAZMpH3fxLFCzTgt3svV7LTtWdYAJg05 U/GJ1HuAm+QfPdqc0jvNJEamnBg/aAxlcS5O6ztl3RERRCfL/eFQD2YBOVv5h8n/v24N pp2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=iNyUdIcL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf16-20020a1709077f1000b0078dad659776si9952098ejc.320.2022.11.14.00.12.05; Mon, 14 Nov 2022 00:12:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=iNyUdIcL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236190AbiKNIEk (ORCPT + 99 others); Mon, 14 Nov 2022 03:04:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236176AbiKNIEh (ORCPT ); Mon, 14 Nov 2022 03:04:37 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7176D766F for ; Mon, 14 Nov 2022 00:04:36 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id b11so9654605pjp.2 for ; Mon, 14 Nov 2022 00:04:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bJDRhD+by6ePLMyu0jFNF0DA5otbXQzM82G9QXM16+g=; b=iNyUdIcLjrR/mqWwLs/KmivHxLDyDcgVMh73gXOXYAq/IkDPCGsH/9skjnoPBo8gG6 dVsG+Nyz//OyLV9sBaU+LDku2PU2tznUw3oQfZcEDdJTg3TXSasC9ANQUJ8O9rAfDnu3 HYFZQvEswdMHQT0j1ewSY0yDMwKNsygZtxCdM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bJDRhD+by6ePLMyu0jFNF0DA5otbXQzM82G9QXM16+g=; b=MUa5SEa+5LKlRaOMwJ3dVfWuA0jh2yzQlcP+dO5rnJcJTIPcX7vPQcU715SDgj3/TE vdhQdM1nLXRKcsF1Z0Qz6SiL0yXZQfKgXqSPNkTPE+VP1ujqTeeVijwWbXZ2FUsoKkzq 2wiTj/bsGnEQstbdyDljSI9ln3n1f+2YqYDXuAMDkYleLWPNooVPG/3jzaywOJOOtO2p uPpy1AHbJ26GYd/UIlMLzkMscv/eFPfpsNLfTO1oSCfYY71TUaQ2JX/y3K86tFKbc6uu KIU/MQkzk+d3eKpqAh0jidoyxgN/sQ+80GmZr193rNWDvFidMFai5CMMop/ZMkpZEkLd kikQ== X-Gm-Message-State: ANoB5plJRnfCbpvJPXb/MmnopnFhZA47jx8DWtsEdeRpXVZQFyawNKUq RT6lS4g13FdyfRxq4a+yklzI9g== X-Received: by 2002:a17:90a:f18f:b0:218:8f4:bad5 with SMTP id bv15-20020a17090af18f00b0021808f4bad5mr12851400pjb.55.1668413075989; Mon, 14 Nov 2022 00:04:35 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:40f1:682:170b:f25a]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e5d000b00186fb8f931asm6696799plf.206.2022.11.14.00.04.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 00:04:35 -0800 (PST) From: Hsin-Yi Wang To: Sean Paul , Douglas Anderson , Robert Foss Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Allen Chen , David Airlie Subject: [PATCH v4 2/3] drm/bridge: anx7625: register content protect property Date: Mon, 14 Nov 2022 16:04:06 +0800 Message-Id: <20221114080405.2426999-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221114080405.2426999-1-hsinyi@chromium.org> References: <20221114080405.2426999-1-hsinyi@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749458408264753488?= X-GMAIL-MSGID: =?utf-8?q?1749458408264753488?= Set support_hdcp so the connector can register content protect proterty when it's initializing. Signed-off-by: Hsin-Yi Wang Reviewed-by: Sean Paul --- v3->v4: no change. --- drivers/gpu/drm/bridge/analogix/anx7625.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index b0ff1ecb80a5..0636ac59c739 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -2680,6 +2680,7 @@ static int anx7625_i2c_probe(struct i2c_client *client, platform->bridge.type = platform->pdata.panel_bridge ? DRM_MODE_CONNECTOR_eDP : DRM_MODE_CONNECTOR_DisplayPort; + platform->bridge.support_hdcp = true; drm_bridge_add(&platform->bridge); From patchwork Mon Nov 14 08:04:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 19582 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2027130wru; Mon, 14 Nov 2022 00:13:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf4BhO6Dcfng7aufplWU16KDrA/G+5yOt1uee0MUiARospl4/Pw17yvikk+gZkYbz6WkBWyG X-Received: by 2002:aa7:ce09:0:b0:45f:9526:e35a with SMTP id d9-20020aa7ce09000000b0045f9526e35amr10389110edv.256.1668413584513; Mon, 14 Nov 2022 00:13:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668413584; cv=none; d=google.com; s=arc-20160816; b=xCQeqreZDNvwxUOMAQiqmgWvMrREAjkhL/HlEb6J+vdVBA3pteRaYVwsIysT/hGSjy fShsBl3GUL5aCXXL+OnNOqHaptpElXNRXM/Vl9k89jdRKE8+60vGb7QXuP5VIyIy+O6b gPITOkygLiBfG9E4wgofOUHU/PkSoRe69B2I+LSjDhhRd2d/BsaJMXLAHAfWcYop0gh4 Hi2WO3FB1iJgPNFDdgwLXjeyBmjLHRb4omGvjkHQ6+WLm4uubWbguFSfZ0tVtm2NZg4f MRhs720yiaFMmHcT8jz2bUq3CaoOF9r6WNs1HRFYCcSIz3cVAQM7TAzAdlMhiQmOhBy9 S3cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RbTvIBQr/qxVFcQN0vUy2BZfbem/T4A3R/H1WrAy9X8=; b=aDoudh2J/IrSJZCv5lrzZWcXg5Sq3/EjLb8ArR2hvEZBjnVRD29qZpckNXygNALwkx vURpaV1SIQn8fRf0lXopKTFvKIRTRcdkkk3qfwnM+Ejn0Vvy4g6DHX/2YJwSHIy13ZT+ GjdKC+vbWLviI2ivOJ8P5HjUEDmez0vej5anmikoBk2ridvgh3ve3h7+2Oc1s6tTJ0/i Et9IAJv8wEsXb4fVr4lDvKzAdUpWi1Riy7xqJAO5gd81OaKJHYrqlL6V/b4i0+7RvUdh cDWSIv6cxJDTCUs9qQKwF6S+c8CLWPe16rAPM30MmNOjteFSI/QKkbjeITZUmYaG2xKL zxwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jGbdhn8I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs10-20020a0564020c4a00b004642b0f237esi8751649edb.115.2022.11.14.00.12.41; Mon, 14 Nov 2022 00:13:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jGbdhn8I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236171AbiKNIEn (ORCPT + 99 others); Mon, 14 Nov 2022 03:04:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236188AbiKNIEk (ORCPT ); Mon, 14 Nov 2022 03:04:40 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D572B2FC for ; Mon, 14 Nov 2022 00:04:38 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id b185so10277092pfb.9 for ; Mon, 14 Nov 2022 00:04:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RbTvIBQr/qxVFcQN0vUy2BZfbem/T4A3R/H1WrAy9X8=; b=jGbdhn8I3v4YDqdQ0NU7bffKSgQelS1ujvoH/Lga6Y/dEqgfCWcFNnPLbaJl8uXU1l of3qRWQZkgxt7NL09AYdUoA48BcjDZf1eDwDxsz3SV+9mfCaXlRfSvH19eiAjve5G5T6 t2HZOHsaz0a/WFsCLoq6XAc5UDdzqwbIB10oY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RbTvIBQr/qxVFcQN0vUy2BZfbem/T4A3R/H1WrAy9X8=; b=MKf18YtnMuPbfcJTYghoNDmKMp0NLXWJXmAy6Je7n/93BVCoWqGEIEnxvZPrt+G9Zw uMdvKosUyBCDGLeNG+5/uMEgNUGZxRnKYEgjCNy5LJlWzHhyV8cv4tY+VTNpaRz3C+nR kshD+q7mIYFx+K/0UBm0jb5ZFv/I7m8AfGYsH2WWdbUQUCJ2AFDBnCMl/jd++jAgBugF uqXVSyR54A6+nGa91ILCxAH0v0LTHQaAzzxtm4FojmCbvp8vHdrm3oW1MzprxpaWgSoJ 7HrRYAxociPps5f7VoIar5PAhWRL2OFlsggphUMiLwh/cIZBnxCKwjxlNqch4QXCqzVO lnNA== X-Gm-Message-State: ANoB5pl2Ww6Fyg6C1JxxpkHozu6pH6VTqsiKYtPhKdKjEXREanC47vT6 KmPC2q104sCq1YITWiMVSwesdA== X-Received: by 2002:a65:6945:0:b0:476:91d6:e15e with SMTP id w5-20020a656945000000b0047691d6e15emr1932218pgq.455.1668413078295; Mon, 14 Nov 2022 00:04:38 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:40f1:682:170b:f25a]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e5d000b00186fb8f931asm6696799plf.206.2022.11.14.00.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 00:04:38 -0800 (PST) From: Hsin-Yi Wang To: Sean Paul , Douglas Anderson , Robert Foss Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Allen Chen , David Airlie Subject: [PATCH v4 3/3] drm/bridge: it6505: handle HDCP request Date: Mon, 14 Nov 2022 16:04:07 +0800 Message-Id: <20221114080405.2426999-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221114080405.2426999-1-hsinyi@chromium.org> References: <20221114080405.2426999-1-hsinyi@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749458442832599422?= X-GMAIL-MSGID: =?utf-8?q?1749458442832599422?= it6505 supports HDCP 1.3, but current implementation lacks the update of HDCP status through drm_hdcp_update_content_protection(). it6505 default enables the HDCP. If user set it to undesired then the driver will stop HDCP. Signed-off-by: Hsin-Yi Wang reviewed-by: allen chen Signed-off-by: Hsin-Yi Wang --- Include it6505[1] to the series. [1] https://patchwork.kernel.org/project/dri-devel/patch/20221101112009.1067681-1-hsinyi@chromium.org/ --- drivers/gpu/drm/bridge/ite-it6505.c | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index 21a9b8422bda..be08b42de4ea 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -423,6 +423,7 @@ struct it6505 { struct extcon_dev *extcon; struct work_struct extcon_wq; int extcon_state; + struct drm_connector *connector; enum drm_connector_status connector_status; enum link_train_status link_state; struct work_struct link_works; @@ -2399,6 +2400,14 @@ static void it6505_irq_hdcp_done(struct it6505 *it6505) DRM_DEV_DEBUG_DRIVER(dev, "hdcp done interrupt"); it6505->hdcp_status = HDCP_AUTH_DONE; + if (it6505->connector) { + struct drm_device *drm_dev = it6505->connector->dev; + + drm_modeset_lock(&drm_dev->mode_config.connection_mutex, NULL); + drm_hdcp_update_content_protection(it6505->connector, + DRM_MODE_CONTENT_PROTECTION_ENABLED); + drm_modeset_unlock(&drm_dev->mode_config.connection_mutex); + } it6505_show_hdcp_info(it6505); } @@ -2931,6 +2940,7 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge, if (WARN_ON(!connector)) return; + it6505->connector = connector; conn_state = drm_atomic_get_new_connector_state(state, connector); if (WARN_ON(!conn_state)) @@ -2974,6 +2984,7 @@ static void it6505_bridge_atomic_disable(struct drm_bridge *bridge, DRM_DEV_DEBUG_DRIVER(dev, "start"); + it6505->connector = NULL; if (it6505->powered) { it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, DP_SET_POWER_D3); @@ -3028,6 +3039,48 @@ static struct edid *it6505_bridge_get_edid(struct drm_bridge *bridge, return edid; } +static int it6505_connector_atomic_check(struct it6505 *it6505, + struct drm_connector_state *state) +{ + struct device *dev = &it6505->client->dev; + int cp = state->content_protection; + + DRM_DEV_DEBUG_DRIVER(dev, "hdcp connector state:%d, curr hdcp state:%d", + cp, it6505->hdcp_status); + + if (!it6505->hdcp_desired) { + DRM_DEV_DEBUG_DRIVER(dev, "sink not support hdcp"); + return 0; + } + + if (it6505->hdcp_status == HDCP_AUTH_GOING) + return -EINVAL; + + if (cp == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { + if (it6505->hdcp_status == HDCP_AUTH_DONE) + it6505_stop_hdcp(it6505); + } else if (cp == DRM_MODE_CONTENT_PROTECTION_DESIRED) { + if (it6505->hdcp_status == HDCP_AUTH_IDLE && + it6505->link_state == LINK_OK) + it6505_start_hdcp(it6505); + } else { + DRM_DEV_DEBUG_DRIVER(dev, "invalid to set hdcp enabled"); + return -EINVAL; + } + + return 0; +} + +static int it6505_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct it6505 *it6505 = bridge_to_it6505(bridge); + + return it6505_connector_atomic_check(it6505, conn_state); +} + static const struct drm_bridge_funcs it6505_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, @@ -3035,6 +3088,7 @@ static const struct drm_bridge_funcs it6505_bridge_funcs = { .attach = it6505_bridge_attach, .detach = it6505_bridge_detach, .mode_valid = it6505_bridge_mode_valid, + .atomic_check = it6505_bridge_atomic_check, .atomic_enable = it6505_bridge_atomic_enable, .atomic_disable = it6505_bridge_atomic_disable, .atomic_pre_enable = it6505_bridge_atomic_pre_enable, @@ -3354,6 +3408,7 @@ static int it6505_i2c_probe(struct i2c_client *client, it6505->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; it6505->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD; + it6505->bridge.support_hdcp = true; drm_bridge_add(&it6505->bridge); return 0;