From patchwork Wed Nov 23 10:05:27 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: 24849 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2706073wrr; Wed, 23 Nov 2022 02:30:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf4eWs/PH5MqTyil7tsUtElH3rxCiGHyzcbbbeBRjYWKrchj4asYEZxzUL5gnmZ1rTcsXnCE X-Received: by 2002:a17:906:5e49:b0:7ae:38fd:45e9 with SMTP id b9-20020a1709065e4900b007ae38fd45e9mr22402848eju.496.1669199414559; Wed, 23 Nov 2022 02:30:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669199414; cv=none; d=google.com; s=arc-20160816; b=LVPDuiQA0cENA7KV3a29Om9YqzwGVR3TKmcW5Pfyfp6Na7NLRB4PgSgFXeenBeJdrM pXtZFcyZVK01NwOev3rh2QzX1+BJKcXxMc1x8gLZqyXjjy13KG5b06o/bk3v1onLTLck Xg/9wdTE6CW1fciJHOEfNCXexFMyR7i2rrC2GMslpx0fU/0ThGUKbvjYuKNm1dTkFGoA xbB1R4uq0rkicWOqiqdO84OKAEl1C+OdfLgvefFsStpD23kq7CUL3A+xO0CRWtN7WBZa xD8nJq0+m5rvXjD3pK+5pBhu46/h7LDJd5XPETMHm6d84DkzZDm4nmi9qdqQWaaC0ba3 lFjg== 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=1l36+yjPBM6OIANeKy2/6rDvglh4GiKCjNdGiIn1fFk=; b=oDNnUG3xWp7t9YWgtM4BBIjVo7vpMV/AdL+jND/sdo31XN4Nlty9OtqMeseUH3eEe2 vHdPVrnjhMtdQrzQM9BFHJ1mcsZOpmK33cn2SLSY/484j2jtzS0E9YgtEyDWy+SQfI05 Tx/BLN9v08S+SxLwDjENB+Ld0WzrnkLmcQMsGN43vUOHIXaSYV7/7JE3VTaFgFpLsaoe aoU/uaZqvfa+Bv0a8oTVvjhFa3zAnhMM7qs3IPfJJvq7rpohl9Ux/n7VtFta3+2DTWxk 5/L3zwMPwKcfUmhfjd4lwkKMVpUFBAkubto6uamAoYZZxtzEc0UuDUO2cO4m744wkFP1 8xTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Vwmvmase; 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 x11-20020a05640226cb00b0046311e80ebcsi15737616edd.151.2022.11.23.02.29.49; Wed, 23 Nov 2022 02:30:14 -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=Vwmvmase; 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 S237326AbiKWKSG (ORCPT + 99 others); Wed, 23 Nov 2022 05:18:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237683AbiKWKRY (ORCPT ); Wed, 23 Nov 2022 05:17:24 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 548F310AD27 for ; Wed, 23 Nov 2022 02:05:38 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id 71-20020a17090a09cd00b00218adeb3549so1389217pjo.1 for ; Wed, 23 Nov 2022 02:05:38 -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=1l36+yjPBM6OIANeKy2/6rDvglh4GiKCjNdGiIn1fFk=; b=Vwmvmase7OlvtEU2AuizHJgkGE+T7RHQixihY6R2G9s135jY1iE6ZHtm83be9TGR/g Zs0MVFw+jRPryPao3x09vXfmu+eQwsd3WuHAz92o6aQFpiZK8123BE+B5xh9uI7fqvs6 veTgYAd4qeEFAvGA5YX6pt0Cg6MZeRdp0VpX4= 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=1l36+yjPBM6OIANeKy2/6rDvglh4GiKCjNdGiIn1fFk=; b=quxDzmTc6HsPC2crCleQTM2KM7HvopC9Eu25WAQk8TZkP8BZLoTpJOUbxbCNicMnSW LyAQFj1R9RUzGh4TPR3BORDVeA3SKexdQMN7ctvBmzrwnEcNAJJBMBm8ZnRWQrzfxfcY p18NWr4HNkZx8ZiRkcpQsAhJxt9CqcZ7kaBKUDsSrqFWzgr2plL5FQxMx06ernOWcW8w G1h1hD3feh0LQlmmxsHD6MzXJJ4fctkTER6o6zHNDCikfwCDlY/Q3Jba++bJRU04I3ol 8U3CJk9qGu41i0wc9C+cjc8oVd0ZTPB9e9IaZi6JEmOxI9jMLVIoUJx5aEIXTJr7vO26 SCZg== X-Gm-Message-State: ANoB5pnqfHPg3+hSzluHe3XPgnd+O4+2fsnquMQC+SySvwuzz68umoL2 KrMw9Llx7965yTBK+QEZQ4r8MA== X-Received: by 2002:a17:902:e3d5:b0:188:9542:515 with SMTP id r21-20020a170902e3d500b0018895420515mr8790139ple.102.1669197937678; Wed, 23 Nov 2022 02:05:37 -0800 (PST) Received: from hsinyi.c.googlers.com.com (46.165.189.35.bc.googleusercontent.com. [35.189.165.46]) by smtp.gmail.com with ESMTPSA id y129-20020a626487000000b005745a586badsm1020138pfb.218.2022.11.23.02.05.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 02:05:37 -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 v7 1/3] drm_bridge: register content protect property Date: Wed, 23 Nov 2022 10:05:27 +0000 Message-Id: <20221123100529.3943662-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-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?1750282445505056450?= X-GMAIL-MSGID: =?utf-8?q?1750282445505056450?= 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 --- v6->v7: remove reported by bot tag --- drivers/gpu/drm/drm_bridge_connector.c | 9 +++++++++ include/drm/drm_bridge.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index 1c7d936523df..4147c6240110 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,10 @@ 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_REACHABLE(CONFIG_DRM_DISPLAY_HELPER) && + 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 Wed Nov 23 10:05:28 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: 24848 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2706072wrr; Wed, 23 Nov 2022 02:30:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf6LNhZF4gNTm1Kx0R4wi+f8Sltb6QAT+5mFI+baLEvG03uHUN1ZLqOWHdp9vX3AkelRzTj5 X-Received: by 2002:a05:6402:5483:b0:468:d5a9:cb4b with SMTP id fg3-20020a056402548300b00468d5a9cb4bmr11414839edb.409.1669199414396; Wed, 23 Nov 2022 02:30:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669199414; cv=none; d=google.com; s=arc-20160816; b=AIMICR8H5Ecak+mK5iMiAOJeclLeyaK41BiOSIfISgrbH1vQDaqTZmv4GCZLAcbD8s PMncbbxB5cPq6m3KoH2nXTmve859N0uX00hAike1yQzeYqbvOEKlE+UOaDWMUw1vuECT Cs2oAzDNku27PjRkf4TUkLQji8/oUG/DJaDzGnA07oafSNcdgcUspWQkkEU1BeqgmVbG a/zl/3pAR7kpIP32NPYu1Mv+dl/bARpi6TAa48THVhlakryaSyU1QQ83xDJS4LKpLhyh xEna9Alwzs9zNQKZw7w8M765l94FZzkqQH5X+rcphs2U2F6ecPGkqViA7KwRs6N8P6S6 U0vg== 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=UErsT04ZyvPQZD/GWA3SjRANjv/mY45ZrGViPWOUsZw=; b=QgCF6Xz83wUAaMV5lFyTHDIpW6aja/2efngnQ/mwDVGSCwexmvNbovwAG5aNb2UqhX uxBd2++LgMGpV1TSMGCJxlhC3PRRp36XbMRjwUZhENmC8I1Iz0Ipq+yMTY6Xo0eisNJT VhCYTsUs26ajOLppXnNgY3igtRWhhrCTfVMkLflVFQ3v9cWqNSqIJBjZmezwJ+DSx88J schRRV3wiDyloYS2MnENFKH3up1xm5fg1tiKXs0nv07E9M6sZQsUXhcryeyc2UkQWCfX eg3gVWYW/LCsX+41Zd3zR+wdXHYM4hkA/2P6m0IDeVy0hmFRAH6ib5y/WZb4XLRYB7J+ 4hIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="YQq1OWP/"; 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 g10-20020a1709067c4a00b007adc8d6b77esi1751482ejp.308.2022.11.23.02.29.50; Wed, 23 Nov 2022 02:30:14 -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="YQq1OWP/"; 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 S237362AbiKWKSO (ORCPT + 99 others); Wed, 23 Nov 2022 05:18:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237758AbiKWKR1 (ORCPT ); Wed, 23 Nov 2022 05:17:27 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BCA312EBD7 for ; Wed, 23 Nov 2022 02:05:40 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id v3so16360424pgh.4 for ; Wed, 23 Nov 2022 02:05:40 -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=UErsT04ZyvPQZD/GWA3SjRANjv/mY45ZrGViPWOUsZw=; b=YQq1OWP/rreUbf1JZWHTsvWDnRHZ6KDDSG+laL8s//K8YlvbE0jQAQGaPqUVd5uZ5X GxuAkR4sMWfwTX7XUtuQ92Pcgzw8Y568clN2ihAvwMYHUdzCDxRqQNHrF6EDm2pcadEa pbJhY8JmZrX52GI+i4lNgbrQ7ndJmKw0OQ4Mo= 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=UErsT04ZyvPQZD/GWA3SjRANjv/mY45ZrGViPWOUsZw=; b=FEh5yO/7fPuFAmfsy8exbso+TvCjgNqMi7LFfyBAlUcZIwbv+6p2v08Tz2IYG/Q9mi IDGF/gXfQsuLRgHJTOLs75tKVLBzvYAWXe+8qMcKrpqTfGORYqeKGquylv/3J+Bz6Ugk kF2iPRlUiccHOxG5r5zpOTK/fKmGxgore344SPyZgJCrPPQ4M1C+5VGlpjo5vdg34TMZ SFFInMpV6TldnO1SXpNkxGgti7FdHVYUcvvEqpBy4YzHwNAj3gDwRA5wjt7R9qyOUKft b84sfyzgGawZddvZOzlsP7EMDvSaPXzn5/TcSbGTOtdhjGPqSoZOI2EnDDFPEJDQxxpf 4eug== X-Gm-Message-State: ANoB5plFejcdsgUoE9HMNNcz7cBb+JMb+LwAjHsvasdMOrKSWx996EHZ 2CcdbQiIqYQJOMQX9bkhUcke2Q== X-Received: by 2002:a63:195:0:b0:442:c653:677d with SMTP id 143-20020a630195000000b00442c653677dmr25713206pgb.43.1669197939853; Wed, 23 Nov 2022 02:05:39 -0800 (PST) Received: from hsinyi.c.googlers.com.com (46.165.189.35.bc.googleusercontent.com. [35.189.165.46]) by smtp.gmail.com with ESMTPSA id y129-20020a626487000000b005745a586badsm1020138pfb.218.2022.11.23.02.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 02:05:39 -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 v7 2/3] drm/bridge: anx7625: register content protect property Date: Wed, 23 Nov 2022 10:05:28 +0000 Message-Id: <20221123100529.3943662-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog In-Reply-To: <20221123100529.3943662-1-hsinyi@chromium.org> References: <20221123100529.3943662-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?1750282445356783229?= X-GMAIL-MSGID: =?utf-8?q?1750282445356783229?= 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 --- v6->v7: 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 Wed Nov 23 10:05:29 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: 24859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2706990wrr; Wed, 23 Nov 2022 02:32:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf5xT9WYKVGLAHZ9TArByGJ1CM0f8b3613rCu4NGP8tFDDSIlq5g360/agsNsrtVmAqnA5LM X-Received: by 2002:a05:6402:d49:b0:469:885c:4b28 with SMTP id ec9-20020a0564020d4900b00469885c4b28mr13824053edb.426.1669199546355; Wed, 23 Nov 2022 02:32:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669199546; cv=none; d=google.com; s=arc-20160816; b=ISTlhmX+Y+pd/z5vmYflkVVhOkrGOI3117tBzXx2xM5wbbFHDIYay8LvmTdX7fGNjR OCS1tc3ehXqWyYqMnDE39UpQrCwgaC+sRw6crmxxxSDrqBLVGJKh2PXXme6CF1PQV57O ohfG37b31D3W7J6uOtVRE1iY6ceIx/XQxBSYc4v6LZdKCPnTj1oABp8gWZEDR2mssLhk dPL0NopSNm1v6c2kkNddmo7jFaAkKnw5zFl/HBX5IZLyv6cTcGtMk42KnNyL+6NJJBrm 3f6sxLc4gSoG65DZ1gFlQ7TuHuS+DsuPZgllLvX6HKvsjuNp8MJZVlLffAeVn0wH1HXY KjXw== 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=Jg9Va4FU9dSDHU9ZJEP1jjLMkksxPUQCx/bp3wHT5LQ=; b=kQXrQdtjM3m+3fEvr/5UlLrWDT8YZ/qOwpMx1+EkA4QXP2p+IfV44ji4SKKgvvLns7 oVFlh4lFJtzgh2c9TTp1l5Wt75GF9a8Eo4+4XZ0YXmp2Bq1UZfgc+O8wr9kUYy56tuu1 efdkgw3xkTj76GVFZo10JKx7zb6cvkfkeMcRUyMgSwCTtK6okF8PAJVolWIVOKDCeshm vvYSznZczfx27skoWbzKPdr4iSZJmaIVlZMl6grVfmry6b+RFQmB62dWCtrN2UA5/eCo pg7YkScPq0lOm8uiF7OQmYubEZzKlblOGNHCxeYNtP6qXlJdOHEnP+Jef7EIWZuDmqIM tXOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WfT72T7R; 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 y9-20020a056402358900b004597671e0ddsi14413686edc.338.2022.11.23.02.32.01; Wed, 23 Nov 2022 02:32:26 -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=WfT72T7R; 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 S237374AbiKWKSR (ORCPT + 99 others); Wed, 23 Nov 2022 05:18:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237835AbiKWKR2 (ORCPT ); Wed, 23 Nov 2022 05:17:28 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DBAB11606D for ; Wed, 23 Nov 2022 02:05:42 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id p12so16202261plq.4 for ; Wed, 23 Nov 2022 02:05:42 -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=Jg9Va4FU9dSDHU9ZJEP1jjLMkksxPUQCx/bp3wHT5LQ=; b=WfT72T7RroMBI9wlOw/bnHHnoMf0WdGs3XyvUrO4MKlEA6nqF+p/zMfKEtc1lbTHMP AUezr1Y3S9zCcAz1rse/vatF4x4DHyqj1sqxRUoc4F8B7S7ADYFtpx2fKEE76qFdjo4D I/yxw4O7JjW32pIQFhcmJQc1sgcv9rZRQrtcg= 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=Jg9Va4FU9dSDHU9ZJEP1jjLMkksxPUQCx/bp3wHT5LQ=; b=4lf64Hg7iAngZwhKlc0G9BlknxYmoPhrjKy7sds5OYU6o7ZfBsClHAPw/+i9pWdxQL 5vGg5QD+jpisidamJL8qlnxuYi+vvhZYraPfqtiUdaJT6bOY6XVNBGnJFnFXtKhLnUs2 uC5GaA7IrJd1gDnxe7T9uNDjIEuKhtaIHtDajEUSOCo724oH6Ruealz/zb4gNBnuKRJC jfhwVqF2MFRYh5NgljsfcFmZvGwMYYSaLX8AArNwuSOslgAByc9F4uXe62VV3orkxxqB cMBn0i64TJEfQoYcsPqWhSetHULB09jdIEEMFRvi1kVNYtaVjIPZ4BhAe81TaoBcaCHu sPJg== X-Gm-Message-State: ANoB5pm7cBh5uE8KLZw/RnlGE+dAXeQabcloJarVGShy35yLyOcOJjgs q/lMcSXeCRlFtjTHhQx8uyQ5kQ== X-Received: by 2002:a17:903:26ce:b0:189:2274:7282 with SMTP id jg14-20020a17090326ce00b0018922747282mr8540890plb.90.1669197941921; Wed, 23 Nov 2022 02:05:41 -0800 (PST) Received: from hsinyi.c.googlers.com.com (46.165.189.35.bc.googleusercontent.com. [35.189.165.46]) by smtp.gmail.com with ESMTPSA id y129-20020a626487000000b005745a586badsm1020138pfb.218.2022.11.23.02.05.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 02:05:41 -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 v7 3/3] drm/bridge: it6505: handle HDCP request Date: Wed, 23 Nov 2022 10:05:29 +0000 Message-Id: <20221123100529.3943662-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog In-Reply-To: <20221123100529.3943662-1-hsinyi@chromium.org> References: <20221123100529.3943662-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?1750282583324226345?= X-GMAIL-MSGID: =?utf-8?q?1750282583324226345?= 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. Remove this and only turn on when user requests it. Signed-off-by: Hsin-Yi Wang Reviewed-by: allen chen --- v6->v7: remove enable hdcp by default. --- drivers/gpu/drm/bridge/ite-it6505.c | 60 +++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index 21a9b8422bda..93626698c31e 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; @@ -2159,9 +2160,6 @@ static void it6505_link_train_ok(struct it6505 *it6505) DRM_DEV_DEBUG_DRIVER(dev, "Enable audio!"); it6505_enable_audio(it6505); } - - if (it6505->hdcp_desired) - it6505_start_hdcp(it6505); } static void it6505_link_step_train_process(struct it6505 *it6505) @@ -2399,6 +2397,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 +2937,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 +2981,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 +3036,50 @@ 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 { + if (it6505->hdcp_status == HDCP_AUTH_IDLE) { + 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 +3087,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 +3407,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;