From patchwork Mon Dec 9 06:46:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Ji X-Patchwork-Id: 13898958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36EE6E77173 for ; Mon, 9 Dec 2024 06:48:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A7AFF10E0E6; Mon, 9 Dec 2024 06:48:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=analogixsemi.com header.i=@analogixsemi.com header.b="dcC7io/i"; dkim-atps=neutral Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazon11022112.outbound.protection.outlook.com [40.93.195.112]) by gabe.freedesktop.org (Postfix) with ESMTPS id AA1C110E0E6 for ; Mon, 9 Dec 2024 06:48:04 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S10cU7FqvhQZsAxfmEAXMbuy2i7GkXU5IL8ams2YDPSZFotEAOhYd4zYLeyJsjBQCGDchuyxpzetiFyiT1rQ1tVucVUzlkSMLB2CjDv5sA3nJIXhHUlRX57zjfPsiEaCtDJPhzE6lUOKZ5Kpafkgp8CKJbThjUzJ163ytZKyL+mOImYDWdeCTTk20du+bMG1j4iDNFf+EMLyoRZ2Pflnt7I2l9uWrV9QAA/IrVH2jUOlrMIERh1jwablK3pv5rmCmRmZJQ40TzCP3CSwi94SVQ8Uy5JIzs22chf/ixgFHy5XCN+1TAV9EUpanF1/QrJ91ClePUWmGlfR8od9ezr6Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aUKRdaLsp50JnzyFXWoQ2tnJmbqXBfLi7MzdsrKQFHk=; b=BO0nPGGhkHmWIvNx/E4LYpe12oKTCP0JBK85KGlfpdQrSy0KAX/OHm2miYk5LXStUr7Hmm0dO/Cjba8svS7geS64dUq5VF32KsZp762GCS/CP+qd+EBr2IJEFIN29cfcCLod9lzeTP3rmv07SWkmznrREf5LYJ1q3jey/bcq/Xi90/oBpjKoYXOUtvFU9PcmRJLR4hkfyTKgGIGj7SnnP5NK49NCiZ0HVJI1O4gPLQdYZvAAjOI65/tXbKr2K9GPXL0bKdGp7L1+UBsC34SCqWm9IWY8z53IdHWrZsaMdONreAP5+k1nVXrM34/nSFR6UEYiewpdb1IJR0HejQZrew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=analogixsemi.com; dmarc=pass action=none header.from=analogixsemi.com; dkim=pass header.d=analogixsemi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analogixsemi.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aUKRdaLsp50JnzyFXWoQ2tnJmbqXBfLi7MzdsrKQFHk=; b=dcC7io/i1Lkdqk3u9O5ed9rE/tCdk6OVuFlv1AUWcOu0e7ghwMks/gbeD+uPMX3HUSEnjCs2YCZB66pasekpqaz6AqTLKPktcmTrsh2FE25bdys8zWPsZ7tBLuduSz3jMS0KDV6BQwsztUW0oi0KFotLLjxLZCqkvWHSciv6Xe4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=analogixsemi.com; Received: from BY5PR04MB6739.namprd04.prod.outlook.com (2603:10b6:a03:229::8) by SJ0PR04MB7360.namprd04.prod.outlook.com (2603:10b6:a03:293::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Mon, 9 Dec 2024 06:47:59 +0000 Received: from BY5PR04MB6739.namprd04.prod.outlook.com ([fe80::5a7e:9e8c:138f:1815]) by BY5PR04MB6739.namprd04.prod.outlook.com ([fe80::5a7e:9e8c:138f:1815%7]) with mapi id 15.20.8230.010; Mon, 9 Dec 2024 06:47:58 +0000 From: Xin Ji To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: bliang@analogixsemi.com, qwen@analogixsemi.com, treapking@google.com, Xin Ji , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] drm/bridge:anx7625: Update HDCP status at atomic_disable() Date: Mon, 9 Dec 2024 14:46:32 +0800 Message-Id: <20241209064632.1705578-1-xji@analogixsemi.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: TP0P295CA0048.TWNP295.PROD.OUTLOOK.COM (2603:1096:910:3::19) To BY5PR04MB6739.namprd04.prod.outlook.com (2603:10b6:a03:229::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR04MB6739:EE_|SJ0PR04MB7360:EE_ X-MS-Office365-Filtering-Correlation-Id: 4929b163-2e90-4420-3d5f-08dd181d6b15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: bbRxZeJRCZLn6Fvwf9PXGh92+3ZXGEDLu12mAD2/vyAa+p9G77qWMTl9oyRsbpnIAQfT+Nnm35CvLQTtSBfqQM9AuaHCsDxyWda6rf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74PwZk9uqbitrFJyhOPPaGM8RfMkCJhRlNmyqCFeI4wzkJB+GcYYScPRq4xug08VSMkCAD1EFbvsW+Bk61WcFb1lb/YomFXy1cPsso3uBj3sxAXIgdIr53ISMJ9HLl2cz+pwKKMTTgvtM1Fh3eAWuD6iNuFL59OpKy5RkXEX42NgYrtzJDPkN215lMjJrPyzA9Pep+6ZvTsaHll12jAte0XjK29jfe00CNwsUlteqD3DSlrTVxb61KZTh+jOZ0R/0RWqwVsvA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR04MB6739.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(7416014)(921020)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H2qehK2rKLZwQpP9I/13+p6nei8lp7YO7zYitTNFZNXwGU9VZhTt4BspyUOXObURLF4XuKRXiALNW5ti13JIU/pUYqBir3RwJK4GJiWOfV4FhYVPcRaPjceTq0TPqU74E2+y/GGKE7dRjduIMoQQd+P9jefBOOgloeBKLLqpF/SbyBTV+5i01H5w7KHfBfW/Q5YqJkqnTDqFU/dCHEs0Q+cI7GT6Hdpj6kmYIT9WT+uMW6lJ0nyiJ0pmoX4lIOwpF+rCPQveJQQmG0aoLIN7mP5iL24Zmr+3jY4XGT92R4Fyevat8ApVhmhxYbllwTnI6nTMTQgFSaaND9ChHgZCtVonzz+Mh8ladp1uBSKJzNTqJlWilQl8gYBPhb4OIfcQ3KVX/cRYN/6/5T3mFsHbva8W7yDqHPuDna6tLUk+Nx4nby4rdFcV9HItDgFadIknhe2cveGkiex3BVCnlRSe0L56jKQy9buoUfn9WlzW4jHIyDdsKEbpZt19GEj9IbtKTVfvXoNRfmRFIiGsTbEZQ+0+Ez3n4DzCORFiu8SfeurZxbDXxYgFmdDkkBrCnlpgRQG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90-4420-3d5f-08dd181d6b15 X-MS-Exchange-CrossTenant-AuthSource: BY5PR04MB6739.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 06:47:58.7319 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b099b0b4-f26c-4cf5-9a0f-d5be9acab205 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eQUFq+TCsunUYX3agCDFvpPjMMhBxaDNwIgDBdxkyuhl2gj1FbYPNbGyWBAMDTD659KAtPelE6Hj6vtbTXuc4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR04MB7360 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When user enabled HDCP feature, upper layer will set HDCP content to DRM_MODE_CONTENT_PROTECTION_DESIRED. Next, anx7625 will update HDCP content to DRM_MODE_CONTENT_PROTECTION_ENABLED if down stream support HDCP feature. However once HDCP content turn to DRM_MODE_CONTENT_PROTECTION_ENABLED upper layer will not update the HDCP content to DRM_MODE_CONTENT_PROTECTION_UNDESIRED until monitor disconnect. So when user dynamic change the display resolution, anx7625 driver must call drm_hdcp_update_content_protection() to update HDCP content to DRM_MODE_CONTENT_PROTECTION_UNDESIRED in bridge interface .atomic_disable(). Signed-off-by: Xin Ji --- drivers/gpu/drm/bridge/analogix/anx7625.c | 25 ++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index a2675b121fe4..a75f519ddcb8 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(struct anx7625_data *ctx) TX_HDCP_CTRL0, ~HARD_AUTH_EN & 0xFF); } +static void anx7625_hdcp_disable_and_update_cp(struct anx7625_data *ctx) +{ + struct device *dev = ctx->dev; + + if (!ctx->connector) + return; + + anx7625_hdcp_disable(ctx); + + ctx->hdcp_cp = DRM_MODE_CONTENT_PROTECTION_UNDESIRED; + drm_hdcp_update_content_protection(ctx->connector, + ctx->hdcp_cp); + + dev_dbg(dev, "update CP to UNDESIRE\n"); +} + static int anx7625_hdcp_enable(struct anx7625_data *ctx) { u8 bcap; @@ -2165,11 +2181,8 @@ static int anx7625_connector_atomic_check(struct anx7625_data *ctx, dev_err(dev, "current CP is not ENABLED\n"); return -EINVAL; } - anx7625_hdcp_disable(ctx); - ctx->hdcp_cp = DRM_MODE_CONTENT_PROTECTION_UNDESIRED; - drm_hdcp_update_content_protection(ctx->connector, - ctx->hdcp_cp); - dev_dbg(dev, "update CP to UNDESIRE\n"); + + anx7625_hdcp_disable_and_update_cp(ctx); } if (cp == DRM_MODE_CONTENT_PROTECTION_ENABLED) { @@ -2449,6 +2462,8 @@ static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge, dev_dbg(dev, "drm atomic disable\n"); + anx7625_hdcp_disable_and_update_cp(ctx); + ctx->connector = NULL; anx7625_dp_stop(ctx);