From patchwork Tue Nov 15 06:28:33 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: 20207 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2549535wru; Mon, 14 Nov 2022 22:30:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf4FKSKPag14fd5ctU+k1qZTUTwTkDF3ldPsLw79eCoYeEvdRzKnt5Uj3gcsQH232SjSh4pS X-Received: by 2002:a17:90a:990d:b0:213:1e05:f991 with SMTP id b13-20020a17090a990d00b002131e05f991mr679215pjp.216.1668493857350; Mon, 14 Nov 2022 22:30:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668493857; cv=none; d=google.com; s=arc-20160816; b=nj8TYsGVwO/3XA4iKA00G6gHnk9Ha6zLe0lq5OC/yXjQPHknrbPLVX6Qmmzvra/2mz 9Bmnc1e/GrokoVx0/MQSmfV3tK0TgtmyhalShZXre38MFYK9z5QTpWaUn3KzbE5lo8c0 qgWQ9qy517E8ZQPUWbpIXyKqHalRRy+iUt1Nd5jTq9kjvhNGwmnKTPdtVXJ3rm4SzJkc oLIgH1+PM3vbFxaNBGhHA4il+Y4R1IMt5cqFhdgN9XoYPsdAX1XR63ynVHJwGzGCrzgZ umnhUwPCT2Wd8HJWFQ9XjDf+ziCsM0T+5bYpKX8ZY7WlhRXYGByPDGX4s04qve7d/90M QQqA== 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=jYF/Js/yiLI83Zy9sWN0PENTbwz1/nvxpqAaN81AAww=; b=fisn0HuKCmR9Xnd7zDoObN+bVlVrg+EpkQkNrX74vyoM+aAu8N+CmSwpO3J4haKm/S P/ZYmyDVtTuVdMUSnc2LwIO8SZkmYD/1VaKYVwEoe18+/0PZlEhyuSLksgkbnXTQTFBC QpeBWHgVHIAdy7VGc9nXy/k0LOcyqNdC7bBg/ZgA6tKzsdrbT+fqWUa2bEyUl5YxAiDA z6M1B16xCFBV/RoOMU6nOsDbuq50T8HJJdZoxpmFQWTpGx7scdwU9E2ITzWr88WObmBk TnLFhf6HlrZWP217sHTCKARtAmW6ukx5UGGyJxWjjlR3KW395DLBcTVRpOomS/op08Jd 8Yfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Po3X0rFR; 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 l5-20020a170902d34500b00188881adcd7si10274387plk.550.2022.11.14.22.30.18; Mon, 14 Nov 2022 22:30:57 -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=Po3X0rFR; 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 S232217AbiKOG27 (ORCPT + 99 others); Tue, 15 Nov 2022 01:28:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232085AbiKOG2m (ORCPT ); Tue, 15 Nov 2022 01:28:42 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FA67CEA for ; Mon, 14 Nov 2022 22:28:41 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id o13so12400393pgu.7 for ; Mon, 14 Nov 2022 22:28:41 -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=jYF/Js/yiLI83Zy9sWN0PENTbwz1/nvxpqAaN81AAww=; b=Po3X0rFRnkmXUSuWki6spsmGHe32wlGY0z2bgPRVq1Tc0tzYKF81Dga33krFcwc8yL OCWKk6lm+vccRWTPaB55QNVqzfiWma0lZ3lbY3jrh7cucnDby7HfBBf4RIdNWCnWIrX7 TTh8Ka5JMep8/45EfFJJbpgNaNQlUgtO0eTOw= 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=jYF/Js/yiLI83Zy9sWN0PENTbwz1/nvxpqAaN81AAww=; b=gBg5HlPwoLE7QNJsVzliuZlUKO/UaHZSOUSXDWVY1vtPiP/76E8LCdhl/wYVxIJHZu 7Vy1MdKKWdMGXXuSiDrNGxpdX9W24JqUMHoySyUqqmwbf46eQmpGJQ6l0ueF3o8LcQYp SNE/nY0hPDtVZ53WOdyDAV0cEqeaGizyxYSr5yFRpHnPTAbKI2XJOi+2yKAi/6KoMyx3 EocrDO+f06NzVTkxnkeqo1Daf/ZOCbhRfIH/yCoTKAEE+Ec7vZV209jFc04nQooJWQz2 wVBpnyE8LuXNo6DHFFyiXmQO+T1gem94geAFXYwk3SG/72xefsuZ4squhl5raUrTnLz2 2v+g== X-Gm-Message-State: ANoB5pkGiytYvjFyCw+UQQTlu+jN3/8gBKouxehZy4MBLHA4L8Bnzrjw T7ridZgyLPG0EylvCO1Q8ySk6w== X-Received: by 2002:a63:eb4e:0:b0:45f:f8df:108e with SMTP id b14-20020a63eb4e000000b0045ff8df108emr14451107pgk.127.1668493720852; Mon, 14 Nov 2022 22:28:40 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:17d2:e181:950d:967a]) by smtp.gmail.com with ESMTPSA id b22-20020a630c16000000b004351358f056sm6956372pgl.85.2022.11.14.22.28.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 22:28:40 -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 v5 1/3] drm_bridge: register content protect property Date: Tue, 15 Nov 2022 14:28:33 +0800 Message-Id: <20221115062835.3785083-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?1749542615161356299?= X-GMAIL-MSGID: =?utf-8?q?1749542615161356299?= 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 Reported-by: kernel test robot --- v4->v5: fix compile warning when CONFIG_DRM_DISPLAY_HELPER=m --- 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..16d038c2982f 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_REACHABLE(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 Tue Nov 15 06:28:34 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: 20206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2549461wru; Mon, 14 Nov 2022 22:30:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf71u/BImP8se/JaoR0aOLqwRyNC07b0XMBwIxMezJjlJVksnd46bqNt2dzhEweH0Q3dFGUe X-Received: by 2002:a17:902:9309:b0:188:d7f5:20df with SMTP id bc9-20020a170902930900b00188d7f520dfmr528522plb.120.1668493843456; Mon, 14 Nov 2022 22:30:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668493843; cv=none; d=google.com; s=arc-20160816; b=w9TdHaWWW1NUv+q27NkxXTDLD4TZPr8ZMptkDAp1neJ82aSbHB8wl7+ltMGXmXG2Iv PhN808IoihXtVN37IBHp71K4qMV0QTLggAwBcV3V/Jl8W1SdekAfT/GniGYAiOhT2pAl GqafoU1J8cVIxb+rB/hRlORk0xI4VhNdkTUaqR9Ka2kI15S6K2ZuQdk5Y7piD1dFtuak 9+dduT9C287zfVQmu8iYuwHch2CIK7Td8LH6fOOUzHmqC0ycxSPbiuMccXIR5dPcTI/Y 8SeOwrrFkzaeQmpze1RSWXrL2+m5zYD0mh/BuaXtqoFgdkIhBlActTmnnAzBlhBv+07D gtJQ== 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=9mBggjsv2GqBICe6FMg0nBv1QbzL30nQillIj133bFg=; b=y1CJ2riRedBUXAQwhkEGkMQ+szvCMKo4Q1W2nmS+B2ByLj9553QxQpO+d3NIcMEEMH wgqQUVQFRw0khA+WEk2mH3A0Rsa92OLtswxbv+b+5ACI2qtXa8jgWa3O1Ir5zcNQcD7P RyRJO9Dpm3/AXtAYoePiRpUjrsjU5TbZhSz1NIWiRJG0l0anPUgyY9ZKDRYs42xGcd+t B5y7l9DrF4eqqz+tvNhRkGBRdOhKupd6wnsK7Di4HbNFu6X7EVJxkgA0oLj9VqIORkTZ TkOoZMjXkPaDcoDIuo0BW/5kzBBsL8fgqv/iNJ8BJBF+n6DDsP27qbf3lkR7o0j4X3VW nbdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=h9HAx1RY; 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 x24-20020a63db58000000b004625c2dbc5csi10732850pgi.718.2022.11.14.22.30.09; Mon, 14 Nov 2022 22:30:43 -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=h9HAx1RY; 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 S232158AbiKOG24 (ORCPT + 99 others); Tue, 15 Nov 2022 01:28:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232093AbiKOG2o (ORCPT ); Tue, 15 Nov 2022 01:28:44 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A7A5E58 for ; Mon, 14 Nov 2022 22:28:43 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id d59-20020a17090a6f4100b00213202d77e1so15983018pjk.2 for ; Mon, 14 Nov 2022 22:28:43 -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=9mBggjsv2GqBICe6FMg0nBv1QbzL30nQillIj133bFg=; b=h9HAx1RYCL+85yBECtCTWfMwgCWVLWezO7TR3xa2myoeE/9GBNy1GPd2bVXJTCyHmp RyF0Me4sutzi/qhfcY1o7pZhIMu0oNX4vDlc9AwIRTOVceoUFeGMdgeywaZLuC2h9L78 zI72oGlO3pPDEik9pwTxZKO2t7TaeOm8hPFgA= 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=9mBggjsv2GqBICe6FMg0nBv1QbzL30nQillIj133bFg=; b=achsKeGleJuUsj2krAj4zDAwEOfUfKTB7f21DxjkTpPnv7F/FRtT4jO8OU+B6XLCjl G+J47YT5aTbEJd+gjNeyfp8QYmmwvI/muw8GWX1XYU8pie37QBZMvTMl6IGbGeFWU5xy TjY6Jxko0fSsryqe33xBb0R8pyfjDwRyEajyFKSaMfdGRPaKFFLw1AoHonvS0e8HVjbS TiNgxiw4CcitC/gWMB1Gka1bwiKh2TsxTOsYvgovgPGMbiS1eS8kaSbRdUyiFbOYtSCa 9vw8xwd4E5sN74dUIHAdVkg5iLXcUIPXWJxgsU1Fh1bSHe3kl1+mNR4ygvipqy8zsAay Cq9A== X-Gm-Message-State: ANoB5pl7/V7Mo3qhsey4R6ELFr9TG/vQ169hHEBbcdA6ASRoJscxFBkF HRGkzILxS9wDQiaTzvPDWDZczQ== X-Received: by 2002:a17:90a:d985:b0:212:e891:f08d with SMTP id d5-20020a17090ad98500b00212e891f08dmr144456pjv.18.1668493723030; Mon, 14 Nov 2022 22:28:43 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:17d2:e181:950d:967a]) by smtp.gmail.com with ESMTPSA id b22-20020a630c16000000b004351358f056sm6956372pgl.85.2022.11.14.22.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 22:28:42 -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 v5 2/3] drm/bridge: anx7625: register content protect property Date: Tue, 15 Nov 2022 14:28:34 +0800 Message-Id: <20221115062835.3785083-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221115062835.3785083-1-hsinyi@chromium.org> References: <20221115062835.3785083-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?1749542600052264779?= X-GMAIL-MSGID: =?utf-8?q?1749542600052264779?= 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 --- v4->v5: 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 Tue Nov 15 06:28:35 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: 20208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2550392wru; Mon, 14 Nov 2022 22:33:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf44fi5i3d96A/zVnhkJRy8sSSBmYMK4NVxEMRPIk1GU3MyggBM5XkljxcAANYZ20wNueLec X-Received: by 2002:a17:90a:d792:b0:211:2c1c:2b74 with SMTP id z18-20020a17090ad79200b002112c1c2b74mr768061pju.18.1668494009631; Mon, 14 Nov 2022 22:33:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668494009; cv=none; d=google.com; s=arc-20160816; b=hvgBB3/1tIxa+X8sewrGNK5LDfBQAV92hAAZlImO/KYLiG1+HoudAMW6NYYvz+Zvlx x6V7MTNravcxwK4lLGf4MSHEVEvkXERLYjqBMEb1gIwHeijfzxQ8/VMSs82IqQNDmPpo yCqRjD8O4fHs1xWxbmBaJFWXPdoAMUKyThO5AZ5OElbp9vzKubWVRVbQlbkxowRogwUF ctdfmW98HgzRdEugU03R/fbYGpcszDMYf5yAgDtBP5yY1RTHGN8HdfCPJ9gUjLJ3/UpM vC9q77xwNmVauzyKnqiYcDNrC2/RaQRO1IsUej5wWxtoYgu0uI8ZLc0Z8prvsURxjiJD qdlg== 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=28miqmbhBE1SXO17DceZt2lsuaubTUHoFD02vHmXDmc=; b=LLogNy6zc+m12ho6W4glMmgEkWQjGpIdTOnDrUXAjwHKOU5fOFydTKgrh3gILzx6ha PTBD7L0IUS21vXTtzJR2MoEgzCTIzT7HZJ7ilvrwwr/30To62KWu8mJCbQlWkt96JHA+ 3ckMN/dBC+ptrlkxmyvGArW53Mb2LcIX4KjUBbOKbTrnIaRWR+6bhFbfGjB04X4TDfmV fnD8Hp2g9dyta+H7PaJMKxB60ageooYaLUOnVWPchShFa0JCeYAbvNTevrbQIAQNRqwt qS8KrynAxv7j2Rs199xz/+uQmXXP/PzIfb2m6evN1wOq6Vvk/RbllrMHHjb+EjV0cTwo LfXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Ej9/j/55"; 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 g2-20020a63f402000000b0042b57d7bc14si11127547pgi.763.2022.11.14.22.33.15; Mon, 14 Nov 2022 22:33:29 -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="Ej9/j/55"; 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 S232258AbiKOG3D (ORCPT + 99 others); Tue, 15 Nov 2022 01:29:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232131AbiKOG2r (ORCPT ); Tue, 15 Nov 2022 01:28:47 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C35ABCD8 for ; Mon, 14 Nov 2022 22:28:45 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id 62so4065315pgb.13 for ; Mon, 14 Nov 2022 22:28:45 -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=28miqmbhBE1SXO17DceZt2lsuaubTUHoFD02vHmXDmc=; b=Ej9/j/55TR7388TSYG4uVzNJ4D2T0ovDDThWLvc8R0rTn43z3Fnvw02ir+dmfPP4Sv TB7ygRnMRsOHu1FWQT23nOv9AIzgpwkd8/e1wmVHyjmsEHV87S0nhanADor2koMLv0Av 2vR48uZXDtRpYb848yMTrtAXXHlyl4CDZGtt0= 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=28miqmbhBE1SXO17DceZt2lsuaubTUHoFD02vHmXDmc=; b=EWmkGttCPVeGHsOfyRBnk/Adv5lEyzG9yaPORlTlZ0nHTSxhpC3bZSIF09fjwELf6Z XCswEv2PFSK9YbkOJOUA2HWGS0WbEKeUlq9+RRl7DUqLUP/L8YhByErbbraJrG+dpinN c8k2tRcQIQMcz+qHW4m+wdAqU2mxhhDRzfXmXsBKW1Ud9hQxjuHWnNIqFBiC2cLJTMNi FIY7GXX0uHggmOhik4VrbiJwRUqQ5j+37xz1mUjhE58nGTH/7LYzOef/KLTznGJuec4M ouzb1nSL5AcRMxrw2Lnubs6goIOiysL8b92fwvdNmdu5/kyr8Icta1pWDLL/+sK3AJ// ClTg== X-Gm-Message-State: ANoB5pl21/ZSJltpCX3HwvOhvo1mLxkEcn0+e77o/5222uGEBPBwl22B /ZOetNEMKibG3hWaPcQ0EuS0BQ== X-Received: by 2002:aa7:9ec7:0:b0:56e:3a98:f02 with SMTP id r7-20020aa79ec7000000b0056e3a980f02mr17168139pfq.53.1668493725187; Mon, 14 Nov 2022 22:28:45 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:17d2:e181:950d:967a]) by smtp.gmail.com with ESMTPSA id b22-20020a630c16000000b004351358f056sm6956372pgl.85.2022.11.14.22.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 22:28:44 -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 v5 3/3] drm/bridge: it6505: handle HDCP request Date: Tue, 15 Nov 2022 14:28:35 +0800 Message-Id: <20221115062835.3785083-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221115062835.3785083-1-hsinyi@chromium.org> References: <20221115062835.3785083-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?1749542774643778117?= X-GMAIL-MSGID: =?utf-8?q?1749542774643778117?= 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 --- v4->v5: no change --- 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;