From patchwork Fri Jan 19 05:54:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13523330 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 A9C12C4725D for ; Fri, 19 Jan 2024 05:54:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 11F1A10E85C; Fri, 19 Jan 2024 05:54:57 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2066.outbound.protection.outlook.com [40.107.223.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id E270710E91C for ; Fri, 19 Jan 2024 05:54:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TjJsbJ1QlOCfwlZ7evOSrKKLkSz/hGH33287nFoGe8GR0dCTdbh2wcpDhqxy5LOD2KrSwBF3xpL9R6Ap+/9dY9KT8HPBWKIPgsOB1GAplj0JKQnsUih887cLQgvDAQKnwlFHCJBFOxPvgkrn/JlwLNnzRu0W6GgsIMq+iv9brhszTzxo7Q1E6cvKocAmD1YaBwnLolwRcDgx8h5xkr+vcd7DJLP+vLAixuabAb8DQ/aT9u+07G+SVy3hfcl61p9P17tKfRZ9o+vLhFNzM1fImxRP4mdpB1pHrDTc0QHmdVBgeu9UcPtzMY82vL2cRozFgQly+Azek16zNhffIkUMRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=A078BbaAGY/zU6JL5BJwe7eSaF1X+L8idnxCjUVxvc0=; b=nS7Zz6mA6v3BrYfq2qQYX9jKcGBEDL0i5watj0sx2gfok84scRaG+lj9zE1jHsVy1v+QKh6QYmYVkpC5umlWMune55i48sGeZ018jBw3IFp5QSeLfFbgyLqT1BkicCsY/2jb4YwXeKrNa11+ryMy53blnTHhjmj3azDe9sB0gOkK8F9hZAUnkH84ikfi9XMB2oWzMOaaS69kK3/1ddd9qvCAi1fVD71PqPTyhXlnC/8isqLie8w4I0T6+3gz8cDGThsJLrRyhDxbq+WDGHF8pt66V1sMlXM/ykuKLZtBbymwbebkzsNMp5b7owY0wyNQ3QyobTE4YEItuNxviIp58A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ideasonboard.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A078BbaAGY/zU6JL5BJwe7eSaF1X+L8idnxCjUVxvc0=; b=p8j09RpanAOmiaolyjIrLJDpih6KABFdLll6QraG8SP6dV7BrYsKrrmWASaBOGeSOZv/ZJa2NDXId/l+IoUhekLSDFuBimivQ8sc4obF3je+8vdwr6/1o92/V7vPpFHa77Tmx0+5roLUemqWCQCR7bhOukxKL7nsVvM4cJL3f84= Received: from DS7PR05CA0053.namprd05.prod.outlook.com (2603:10b6:8:2f::34) by LV8PR12MB9208.namprd12.prod.outlook.com (2603:10b6:408:182::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 05:54:50 +0000 Received: from DS3PEPF000099DC.namprd04.prod.outlook.com (2603:10b6:8:2f:cafe::62) by DS7PR05CA0053.outlook.office365.com (2603:10b6:8:2f::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.9 via Frontend Transport; Fri, 19 Jan 2024 05:54:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099DC.mail.protection.outlook.com (10.167.17.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Fri, 19 Jan 2024 05:54:50 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 18 Jan 2024 23:54:49 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 18 Jan 2024 21:54:38 -0800 Received: from xsjanatoliy50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Thu, 18 Jan 2024 23:54:38 -0600 From: Anatoliy Klymenko To: , , , , , , , , , Subject: [PATCH v2 1/4] drm: xlnx: zynqmp_dpsub: Make drm bridge discoverable Date: Thu, 18 Jan 2024 21:54:34 -0800 Message-ID: <20240119055437.2549149-2-anatoliy.klymenko@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240119055437.2549149-1-anatoliy.klymenko@amd.com> References: <20240119055437.2549149-1-anatoliy.klymenko@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DC:EE_|LV8PR12MB9208:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ae4bcc8-a139-4356-6ced-08dc18b32681 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zZDWEeeNwCRCyldCEW83modsjzGVmXGuY+L+1U972nEos56MtM/etm9pX9rCR5CoPsOt2y2oAKiE/dGEt5iZJH+TYqsZD3VkJCsPYJOOgOSAJShENyb++J12tLhOreR16Ae9X6OeNzKVMwEJzGYD3vTdi9vZGLKiBq6A1b9JVYyveAXgA4Nlzhc5qct2EcT8CXdnjgObwYENgMcYuYUAWZzmCiarcErP9Yiq+uvdAC3GR2WSIF4xhSHBJpB8Fq/mtmcx7nIoGL08P3bqOdKhIyxg2qw8l+dELJ1PS07xwbe6XzJ8IifCEP5KngJQ7Y8eXcx7kwsP2lRX9cpJeVsKJUDKbv95wll8bc4QIQZyLaLnbI+/grXVFaZkXgjZxjCbqCZTUof8a6N9DRHPS4UXzEMOWlcXpEK4FdCYG2N1QBPJnoj7fCbDmn9I6Jn0IqQvRKGQfbi6c6xkbfVDZ+2RlAHd7pSiEvwZCGfxX9NIVLbnuE87GvHYCflu/AKr5vz3/DGwbAlmhCyD2AxSXBEWqiTIeHt0Tz+JOqFRW42hFBFh3+n7VDn9Gk4pkwV69K2F0XWNBozR0bcUIOW6K4Cq3Y4qMHhS5hG52Fgf/0RFTEU92eJlBe0PmVE6dSCPqj/kLeAxntzhj4m1+Y/dpc+YbKNW1uOM0WINhg0mjIs7uDRifCHBCCK87Db3BzQfReMed2vXMYtGCga/G7H8k+d15J6tq42ioP/CCUTcxA3t7HkGGYKb42Fjm06Ba7la3tMzpEgCnuXNMY7S304MgpB02ZwQdZSk7FVaBNXO81I/94pvs0nk/9s59PofC/8pfhn5PumznC8/HSMgpErbIzZFEBls62O/HqPVw8aNdsUKbbK2mzuY/Z8YEP3Ee+rAip2t X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(346002)(136003)(376002)(39860400002)(396003)(230922051799003)(230273577357003)(230173577357003)(64100799003)(82310400011)(1800799012)(451199024)(186009)(40470700004)(36840700001)(46966006)(2906002)(36860700001)(36756003)(41300700001)(86362001)(81166007)(356005)(82740400003)(110136005)(70206006)(316002)(6666004)(70586007)(1076003)(478600001)(2616005)(5660300002)(47076005)(8676002)(83380400001)(336012)(426003)(8936002)(44832011)(26005)(921011)(40480700001)(40460700003)(36900700001)(2101003)(83996005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 05:54:50.3215 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ae4bcc8-a139-4356-6ced-08dc18b32681 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DC.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9208 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" ZynqMP DPSUB supports 2 input modes: DMA based and live video. In the first mode, the driver implements CRTC and DP encoder DRM bridge to model the complete display pipeline. In this case, DRM bridge is being directly instantiated within the driver, not using any bridge discovery mechanisms. In the live video input mode video signal is generated by FPGA fabric and passed into DPSUB over the connected bus. In this mode driver exposes the DP encoder as a DRM bridge, expecting external CRTC to discover it via drm_of_find_panel_or_bridge() or a similar call. This discovery relies on drm_bridge.of_node being properly set. Assign device OF node to the bridge prior to registering it. This will make said bridge discoverable by an external CRTC driver. Reviewed-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Signed-off-by: Anatoliy Klymenko --- drivers/gpu/drm/xlnx/zynqmp_dp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index a0606fab0e22..d60b7431603f 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1721,6 +1721,7 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub) bridge->ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD; bridge->type = DRM_MODE_CONNECTOR_DisplayPort; + bridge->of_node = dp->dev->of_node; dpsub->bridge = bridge; /* From patchwork Fri Jan 19 05:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13523333 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 AE5E2C47DD3 for ; Fri, 19 Jan 2024 05:55:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 16AA410E951; Fri, 19 Jan 2024 05:55:09 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D5C610E951 for ; Fri, 19 Jan 2024 05:55:07 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E9Z9zCLLFk1u9VDg8B9zLbDO0WVsT4a9KdGWQy816d2pS2z8tElCNdW1EiHOoLT6Fdt1FghiAwfx9qbLX6GfNz03RxS3QZQSZlDbYe0JM0vQsB+52uqzbv75/yzfWrzFIUwjL5BKLaL2NA/D/TLHYHZS2yR0wcXsjmpx+e7m1HGI69GVg92uNnDTF2M7VQQ09bkkjJjCIiD0COV0MNmhdo9gZk13tZ4nRHRRS2E4fNC9u1nRMfqsWEktk130BDIvlz4S3OlXGz8ArO2jKnOhAbmFdrBzK7EAAvTvvah8CH2dvG4bl5IpVK3qVkoRJEsN9+oo9mvfATEMKUDyOVvCfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=sbYhtGPpxSXx/5jQiSZ/ohKOZc6mALk5xxnOCV2OPeg=; b=hWMeAjST6/faYMIJDlM01if1q6Lw5F5fqJ0IJamgBrXI4+txZ/CasWvyiUlmmTMZIIXldWBJgX/ZvsXeRLkvMA9a2DKv7+ZxtGcdSO2/PEAj7p9OtjLRE2zsXtc18EAU6fEJ3rFLnSBRF4IV62unxxBSYgDlG/bBhcfeCXda7kcSytTQWB5XULUuIrKSJ97Jxwz/U+S5B9+cxIOzpdpNPviYnuZh8IyyaRjiyXUc2KXqXtmHV3mqgdHd+xuvaRUihMFkBrEVfFj8u2rzDhvTquXAXUfhS8F6KPhBTfCelFtKzRy3KX5YnAFlxQT5weKJ/T2DY2siGqlJH1IewTbRyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ideasonboard.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sbYhtGPpxSXx/5jQiSZ/ohKOZc6mALk5xxnOCV2OPeg=; b=AIw4LVtPdxP60IPQCk3MPYsrXvlrZy4E0SEWbyLGsJH7PZKTfdJMYGyOx4Ewx+tHD5cq00YXBJ4y+hcdumawwQeMYlCubwjRkIr4hPg60ZZU7oADYEHbr6c0VH1vCOcM9jOTuS+fSwAh9W3Cq3yzizAQNi+agrNciJS9t6PxdUM= Received: from DS7PR05CA0048.namprd05.prod.outlook.com (2603:10b6:8:2f::19) by CY8PR12MB7314.namprd12.prod.outlook.com (2603:10b6:930:52::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 05:54:50 +0000 Received: from DS3PEPF000099DC.namprd04.prod.outlook.com (2603:10b6:8:2f:cafe::3f) by DS7PR05CA0048.outlook.office365.com (2603:10b6:8:2f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.9 via Frontend Transport; Fri, 19 Jan 2024 05:54:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099DC.mail.protection.outlook.com (10.167.17.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Fri, 19 Jan 2024 05:54:50 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 18 Jan 2024 23:54:49 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 18 Jan 2024 21:54:39 -0800 Received: from xsjanatoliy50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Thu, 18 Jan 2024 23:54:39 -0600 From: Anatoliy Klymenko To: , , , , , , , , , Subject: [PATCH v2 2/4] drm: xlnx: zynqmp_dpsub: Fix timing for live mode Date: Thu, 18 Jan 2024 21:54:35 -0800 Message-ID: <20240119055437.2549149-3-anatoliy.klymenko@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240119055437.2549149-1-anatoliy.klymenko@amd.com> References: <20240119055437.2549149-1-anatoliy.klymenko@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DC:EE_|CY8PR12MB7314:EE_ X-MS-Office365-Filtering-Correlation-Id: ae8f9f3a-38b4-42a4-b7fe-08dc18b326cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7HvAARaEqmz+Rn399qaiWlzaIxt2hXS70AtsNkDRdbGsvnviZO1E3TbxkM0mlEyUXmXWnUVfxkfQ9eCAAV+b0PN2iV4mVM8JevR2HlULS6g488NpeTqZXU+L31c23KHjivcqhxA+aqcy+c7HC1e/QKdS/hU9ShM3FguSvVRIdVTZYy2ID8xnSwK8+QQQCKcguv6gJDQc0KgnQ5KbzL768hHMKlUTwWJrI9v8BgOv6T8lue8YteFI6PM8JIIUsN9ZXdK+kwQeNv0VyLXE18AQDnvL7TflZx0UfwnBmKfE0I27eqW8TKY0hk/yXHXtJmyGEVpWq2N3T7SHzik0QGIqIAwXobr+DJk/YvQBl7oeKDa1g2ACy6NeocLDDQxcAKuV+uQogfnPZlNh/50Lc4AzxOvmKEGIyzeL39jzc99IVZM333Pyv1m4jZ4aeubWzZSMi/Ya7YT/VkjyMZe6r5y8LgUdXbyAuHRcOPH7bLCkikdLtN7ZP8w5w2FMWvtO2japrRpBPNOGkvgwH0cHWuxJY4LLvVjkQ8VJ2SDyHBNSUbtyCLS1S/WlubRPg7H4GPA06lYTtAF2x23sD4WUkdHtwAuS9nEp1n8qDGMeow82SOxueg0wnuwNTrNFcb/UrOy/M/3HV2vW6tg/il7hB0V7S5bDJcy4f+EJI7FkQXK0nwHw0UrBSTZ6XkXD61VMXiKVDqO8VuZfIZqRNiHdQRVwB0IiDWeGG+/DjhPBxv0nzvWdHidWRE+dlggxkU3RER1MktPlg68HbnKBKTRPq7KcFNm4dQ0v/b3UGhwqVL2rkVGLn96Ud2mueBE2PqQVaOULq7S4RkVMXDz5t+UN5T42+dJG4sJTLh6Xf4wzUK8Mc6ZeaeIRJhKmhbR3hk6i89aB X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(230273577357003)(230173577357003)(64100799003)(1800799012)(451199024)(82310400011)(186009)(40470700004)(36840700001)(46966006)(81166007)(356005)(41300700001)(36756003)(336012)(8936002)(8676002)(83380400001)(426003)(70586007)(316002)(70206006)(110136005)(44832011)(478600001)(6666004)(921011)(26005)(1076003)(82740400003)(2616005)(4744005)(2906002)(5660300002)(47076005)(36860700001)(40460700003)(86362001)(40480700001)(36900700001)(2101003)(83996005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 05:54:50.8215 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae8f9f3a-38b4-42a4-b7fe-08dc18b326cd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DC.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7314 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" Expect external video timing in live video input mode, program DPSUB acordingly. Reviewed-by: Tomi Valkeinen Signed-off-by: Anatoliy Klymenko --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index 407bc07cec69..8a39b3accce5 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -1166,7 +1166,7 @@ void zynqmp_disp_enable(struct zynqmp_disp *disp) /* Choose clock source based on the DT clock handle. */ zynqmp_disp_avbuf_set_clocks_sources(disp, disp->dpsub->vid_clk_from_ps, disp->dpsub->aud_clk_from_ps, - true); + disp->dpsub->vid_clk_from_ps); zynqmp_disp_avbuf_enable_channels(disp); zynqmp_disp_avbuf_enable_audio(disp); From patchwork Fri Jan 19 05:54:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13523331 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 DBCCDC47DD6 for ; Fri, 19 Jan 2024 05:55:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D95210E95D; Fri, 19 Jan 2024 05:55:01 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2075.outbound.protection.outlook.com [40.107.212.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id B323810E951 for ; Fri, 19 Jan 2024 05:54:54 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DnVDbiAwBz2F2MAwSHVueJ139CL/aBu106cdOWT92G6Z9AFjbJauLx1eb5tkIXVUtdbkm0UreKbqwpW9rSVpH/NCifEgoSmxmEs3tW4XZD9XDPxsXTTT02XCwlZiQ1OULL5ROSbOODAXhZrVwLPrct919tQEjWJfnfBn5k1ApOwlfe5ZNlpb0U5QyrJSTeLX0PC7qu7bdHsiKkfB9v2B4Ud/uGvyatANWlp/gme93bitQoPLR6S9SENwPwUqa0vPz1VJkng5mjsVINeM4OHejBiyYEGk0HbEY/Tgt52MxBqUa6rBGVJrvxfGodDGted2JnyC/3N10Yd0/RF7EFxZAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=qGfqYKlOF07yfK5bGVkIkrxAPdfk2HmdGVScqC2dKTU=; b=mSg/4qE0V1lIBlJqPTxZq/unnYLzrFFQ/gCBESA83K/lmq/pIYUzMuIOT10qKJ0ceAqba1Ry2o2KdxLM5NgUY66UZUNZQj8uu5VAKgw4sM2pbbpr5+Ba4KUXYkax8g81MbrncglaTJ5bmt2VhB5a85ZiinUmE/0zFwsvO5aS3MzcM6KNaLi6hBOBm+BuQIQ/AxTlMgIvUXHAsX0QruNaps/xZARoRURRFttininL+4xtf3rL9zJVRzHCZ89mRPf2hi+MFexiPisc/fAGkfS5cISy8dtuijYULrhhKlwz9At0flJFatmd4/JCNxttqiM8s8jlFObNxCZSYrb1Op+dsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ideasonboard.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qGfqYKlOF07yfK5bGVkIkrxAPdfk2HmdGVScqC2dKTU=; b=LQoVKSJ+eMKSH9MzGC8taTCwgwwyOWvAVZdjrCVkkl1vHfVN6D6KsQHd74D291zvxkkBQk0sr0PUoGBMxwROT9oHzqYUdCodr/P5LiWe7voq0PnIBvaTV5/bwp/0v4Jv9YmiIQ+UZYtxq4mu6jOeYDoJu9XUE2yTj+FXtsCdEPo= Received: from DS7PR05CA0041.namprd05.prod.outlook.com (2603:10b6:8:2f::8) by BL3PR12MB6571.namprd12.prod.outlook.com (2603:10b6:208:38e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.23; Fri, 19 Jan 2024 05:54:52 +0000 Received: from DS3PEPF000099DC.namprd04.prod.outlook.com (2603:10b6:8:2f:cafe::ee) by DS7PR05CA0041.outlook.office365.com (2603:10b6:8:2f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.9 via Frontend Transport; Fri, 19 Jan 2024 05:54:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099DC.mail.protection.outlook.com (10.167.17.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Fri, 19 Jan 2024 05:54:51 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 18 Jan 2024 23:54:49 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 18 Jan 2024 21:54:40 -0800 Received: from xsjanatoliy50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Thu, 18 Jan 2024 23:54:40 -0600 From: Anatoliy Klymenko To: , , , , , , , , , Subject: [PATCH v2 3/4] drm: xlnx: zynqmp_dpsub: Filter interrupts against mask Date: Thu, 18 Jan 2024 21:54:36 -0800 Message-ID: <20240119055437.2549149-4-anatoliy.klymenko@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240119055437.2549149-1-anatoliy.klymenko@amd.com> References: <20240119055437.2549149-1-anatoliy.klymenko@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DC:EE_|BL3PR12MB6571:EE_ X-MS-Office365-Filtering-Correlation-Id: 775e944d-6df9-4883-39c7-08dc18b32772 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cij6rcgGxcRnOF8UYO3EVNQ+LQepNT2We0M+3iXPM/SZx8+aiJikrl/yaSluJobhiNMpxhORHzEmDAb3zXeSR3TxeErE8hnLyQO6ohvKOVelum4+4Ae2FiToez8/O5sOTvcgLDc0nm4b1ZR66HQzY2HC4tCuEmK7vlNCX4lFBhneUupr0g+iVMyS/PVgy48E1+gmf7OQli75KggOZlMOMDnvlo96vpl6o735ZSsbeedv5BN14w58NnojZR42p4lXz5aJLsiJ0NRMbm+PrgVqS+YtjAaq/PqP5po4+yXWMwh8ceqbaZrpb2QaQp75H/vdt9XdcFvTStYcJo8d7nVKyjcTcZul3vg0gAqY3NyaTJFgLjSPhqQny0duOA/UCxMKAuIkqahl4H042Nr6xYlz9dHirJn+gC9RuekIgBHyByJbVZre8R2suCxA7Xp/8BPHPCss48ISklS8nPyWR6xcSgElZ/hYiwqy65UNuBMzkMxTShFGMJMeDh81L2ZmDJ3xt85JmZ/FVjXzRRIVufNIXGglwn5gOun10e+1qPEEG7gfuFYc4jnFU1U3J3YUO/2rlVNXt1uIf6pJesBAsX8I3n81X3QNVgSMJaVSu/O0EmSD5/Y3cM3GrhwB3KmytWeKJ3zN1HEfwWwTxCRV5P3T0xxQQlT5F1PRRJMtOVw2hQ35cGf6rEPMoE0Fn5S4630cjvk7jY/qLBK7pDx/XVUWMXeu4Ir4t5Xaf7iPKuXpz0lYu3fQmoZNMmQsafp0ttLqOWVN0J+pW/9ex85W7MuC7V0FKV74Cgui/w2QeY3NFHD9sJcbdAOpC/OBxG4Kiar2Ypr5RNgmYO1nP7Lqh5FwRg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(39860400002)(376002)(346002)(136003)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(82310400011)(36840700001)(40470700004)(46966006)(26005)(36756003)(356005)(81166007)(478600001)(86362001)(40460700003)(2616005)(316002)(40480700001)(336012)(2906002)(41300700001)(426003)(1076003)(6666004)(70206006)(5660300002)(70586007)(83380400001)(110136005)(82740400003)(921011)(47076005)(8676002)(8936002)(36860700001)(44832011)(83996005)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 05:54:51.8996 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 775e944d-6df9-4883-39c7-08dc18b32772 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DC.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6571 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" Filter out status register against the interrupts' mask. Some events are being reported via DP status register, even if corresponding interrupts have been disabled. One instance of such event leads to generation of VBLANK when the driver is in DRM bridge mode, which in turn results in NULL pointer dereferencing. We should avoid processing such events in an interrupt handler context. This problem is less noticeable when the driver operates in DMA mode, as in this case we have DRM CRTC object instantiated and DRM framework simply discards unwanted VBLANKs in drm_handle_vblank(). Signed-off-by: Anatoliy Klymenko --- drivers/gpu/drm/xlnx/zynqmp_dp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index d60b7431603f..9ed12244a429 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1624,8 +1624,17 @@ static irqreturn_t zynqmp_dp_irq_handler(int irq, void *data) u32 status, mask; status = zynqmp_dp_read(dp, ZYNQMP_DP_INT_STATUS); + /* clear status register as soon as we read its content */ + zynqmp_dp_write(dp, ZYNQMP_DP_INT_STATUS, status); mask = zynqmp_dp_read(dp, ZYNQMP_DP_INT_MASK); - if (!(status & ~mask)) + + /* + * Status register may report some events, which corresponding interrupts + * have been disabled. Filter out those events against interrupts' mask. + */ + status &= ~mask; + + if (!status) return IRQ_NONE; /* dbg for diagnostic, but not much that the driver can do */ @@ -1634,7 +1643,6 @@ static irqreturn_t zynqmp_dp_irq_handler(int irq, void *data) if (status & ZYNQMP_DP_INT_CHBUF_OVERFLW_MASK) dev_dbg_ratelimited(dp->dev, "overflow interrupt\n"); - zynqmp_dp_write(dp, ZYNQMP_DP_INT_STATUS, status); if (status & ZYNQMP_DP_INT_VBLANK_START) zynqmp_dpsub_drm_handle_vblank(dp->dpsub); From patchwork Fri Jan 19 05:54:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Klymenko, Anatoliy" X-Patchwork-Id: 13523332 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 E7EB9C4725D for ; Fri, 19 Jan 2024 05:55:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B18110E960; Fri, 19 Jan 2024 05:55:01 +0000 (UTC) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2072.outbound.protection.outlook.com [40.107.101.72]) by gabe.freedesktop.org (Postfix) with ESMTPS id C2DD910E951 for ; Fri, 19 Jan 2024 05:54:57 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O2Bqfeek+7XSWNynyQQro8SY1RM2ifa1PAV5Xwj3hpiZL94lDrK6NOOwiR6OivPLVqb1wPzHY2110hKf8D4uedbsfRqeTKU0RUMzfaesD7xqMNU8Qx4P3Z93FYqdUmv7c5LiiohcP1mAkk2GT/Vps9VrTyQlhgs7w8wfpqVOzbzQxB2q32A2NOyEjSNKsv66479kPviYTyTHc3kBb227NT9n8Le1uIWNZjepsFjVFPhMV1FOda0w4/BdipQbxlo4uji9KoP7Nfh8TnQIJkdvYJvGt+lMmn6EueJ6nFQ/IhDK+nz5FbEvniFcTCXeCzL3QmOhTy4IPpZK8QJVhpiO0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=ppU7HCS8JZ83NN7IiL00Dru4ywfZHSOanPWnEyQlX0A=; b=CqX/C0J/PI5bsyCwuPI3zH87/mRdLcZrCPChsZ/WRGV33MrEI2m8s43KcpAAFG2/anJ7D/UHKhhCO8wtxvw2O9iw0VUWVRekbT4PcnL5CFj3LkBFmhUhdhk+jPYmvD7Ds7VkON3TSwFHX01kIgOBcrRfvC8JhVo8OLvrDxhAk3b16mhIGRxz92N5C1lk64dOIURYv+4IsKPqwDR2kXymZrGYzG4tD/Sf9hAVp4nCHXDiBX5v6LvIEjdq9OYlkcmZKSsylIYlQHeWN92WLRycFvodWvNdW4IQEZX9oEMz7bLsmH0dVLWyiPeJArncoJTAvxXaWkWqh8/bOdTP6YM77Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ideasonboard.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ppU7HCS8JZ83NN7IiL00Dru4ywfZHSOanPWnEyQlX0A=; b=XrI2CMrUj43jrd7GMBiL1N623LV8Q5ojhrwldb1ET0w/IMEop6bh1Ti+l6hwF42vEv3oqUP65ogLv8bkssc8jy7UiINbDyY+3Ex5NmTGzpoZMh8MH+v44hhh3TwgwM9RT24TUX3zkSxXIlB3O9VVAb7Ngn/iCU2jYAX5qaCk5HI= Received: from DS7PR05CA0032.namprd05.prod.outlook.com (2603:10b6:8:2f::31) by SJ2PR12MB8848.namprd12.prod.outlook.com (2603:10b6:a03:537::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 05:54:52 +0000 Received: from DS3PEPF000099DC.namprd04.prod.outlook.com (2603:10b6:8:2f:cafe::db) by DS7PR05CA0032.outlook.office365.com (2603:10b6:8:2f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.9 via Frontend Transport; Fri, 19 Jan 2024 05:54:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099DC.mail.protection.outlook.com (10.167.17.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Fri, 19 Jan 2024 05:54:52 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 18 Jan 2024 23:54:49 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 18 Jan 2024 21:54:41 -0800 Received: from xsjanatoliy50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Thu, 18 Jan 2024 23:54:41 -0600 From: Anatoliy Klymenko To: , , , , , , , , , Subject: [PATCH v2 4/4] drm: xlnx: zynqmp_dpsub: Set live video in format Date: Thu, 18 Jan 2024 21:54:37 -0800 Message-ID: <20240119055437.2549149-5-anatoliy.klymenko@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240119055437.2549149-1-anatoliy.klymenko@amd.com> References: <20240119055437.2549149-1-anatoliy.klymenko@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DC:EE_|SJ2PR12MB8848:EE_ X-MS-Office365-Filtering-Correlation-Id: 88bfd48f-0154-4168-4990-08dc18b327c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b/AypDF7Q2JaSP0XpPMV9BCksvIH8b+M8M1ORcDnreEkqAxaC65KOgojWy2jqWePnB8gCF6WCbPN9ojyByw8gf4rKpdY63k7OvP8KX0SdU1hoDlxBtDHtwkDPrxNqbYodq0pA2fF5yL/jS8k9Jt0GZ8eZqvxuEFZeTY+AfxA29OlmdWo+NYapoejpDEDWJvfpnLdQYVuhY0n7uc/NnMJrmPnv4JGLuWcypDcb/Bw1lKwOvpdNsDormH/t2NoQhc28V1Jtdkt5EApP5gE/rudWU9VyO2JFQUCKS3C3QnAbTr6CX/B9iMVQOE7Zt9XFPiLM8B6lYCCS7z+eb2947zfo9y9bUVMPhjiLsy5IkgXWx0D80Fi3gcBlOCKXjZcX2gFSr21ws5J6Lfb1cT3dT4krLMK7KlO2woSXS5aWPL9ANyQOLfR7Lqo+MHD21BI3b2eVi6cEuWRAJ8w2UCh9KzIPdS22EKt8gWJdZmTLl2xjgBvm+vEJMz30xjk62B7mvAot1UHfzol9Ms3H1AVkbRehrlXq5sOIhOfC/LhdiQtxKX5nWo2DeWoNtFtTqrgtppRblO3ztL0WduGoFGuW+q4EsH2mIxFTzuZBAuSeh2a/5dst0sni0vdWXfpHreGOTvgQdNjUsvEAR72/an3GBnAmDKA76qffdO5lxtDUJ/WuQHxMtKrUnjMA9/PbBEMT3BsVelB96lyB9BKkReoYOTj9lKRZhSXxuu7ZQn7h4Po/0DlQnVjtSNehZEWEr+qBX+ftMbZYQgVg0osrfr+DlAoVX/h0Izn7btdh5Kn/w2tpIbqPiM05kx5nIdgODK6xFKrXaSZdkU4gfc9GDg3GIMiO4viVJXJx8TyeXuMCdTR/ixAcsg4c7Tz2zdf0tSEgclv X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(136003)(346002)(376002)(39860400002)(230922051799003)(230273577357003)(230173577357003)(64100799003)(1800799012)(82310400011)(186009)(451199024)(46966006)(40470700004)(36840700001)(40480700001)(40460700003)(921011)(426003)(83380400001)(478600001)(8936002)(30864003)(5660300002)(336012)(316002)(110136005)(70206006)(26005)(1076003)(6666004)(2616005)(2906002)(70586007)(36860700001)(356005)(44832011)(82740400003)(81166007)(36756003)(47076005)(86362001)(41300700001)(8676002)(2101003)(83996005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 05:54:52.4308 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 88bfd48f-0154-4168-4990-08dc18b327c3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DC.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8848 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" ZynqMP DPSUB supports 2 modes of operations in regard to video data input. In the first mode, DPSUB uses DMA engine to pull video data from memory buffers. To support this the driver implements CRTC and DRM bridge representing DP encoder. In the second mode, DPSUB acquires video data pushed from FPGA and passes it downstream to DP output. This mode of operation is modeled in the driver as a DRM bridge that should be attached to some external CRTC. DPSUB supports multiple input data formats. In order to properly operate exact media bus format should be negotiated between external CRTC and DPSUB bridge. DRM framework provides a mechanism to negotiate media bus formats between bridges connected into a chain, but not between CRTC and encoder (first bridge in the chain). This change mitigates the issue for FPGA based CRTC, which would typically have a single fixed media bus format. Expect live video input format to be set as "bus-format" property in connected remote endpoint. Set display layer mode in the layer creation context. Signed-off-by: Anatoliy Klymenko --- drivers/gpu/drm/xlnx/zynqmp_disp.c | 109 ++++++++++++++++++++++-- drivers/gpu/drm/xlnx/zynqmp_disp.h | 3 +- drivers/gpu/drm/xlnx/zynqmp_disp_regs.h | 8 +- drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +- drivers/gpu/drm/xlnx/zynqmp_kms.c | 2 +- 5 files changed, 107 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c index 8a39b3accce5..a7115321b3fb 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c @@ -18,8 +18,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -67,12 +69,16 @@ /** * struct zynqmp_disp_format - Display subsystem format information * @drm_fmt: DRM format (4CC) + * @bus_fmt: Live video media bus format * @buf_fmt: AV buffer format * @swap: Flag to swap R & B for RGB formats, and U & V for YUV formats * @sf: Scaling factors for color components */ struct zynqmp_disp_format { - u32 drm_fmt; + union { + u32 drm_fmt; + u32 bus_fmt; + }; u32 buf_fmt; bool swap; const u32 *sf; @@ -354,6 +360,16 @@ static const struct zynqmp_disp_format avbuf_gfx_fmts[] = { }, }; +/* TODO: add support for different formats */ +static const struct zynqmp_disp_format avbuf_live_vid_fmts[] = { + { + .bus_fmt = MEDIA_BUS_FMT_UYVY8_1X16, + .buf_fmt = ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_8 | + ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV422, + .sf = scaling_factors_888, + } +}; + static u32 zynqmp_disp_avbuf_read(struct zynqmp_disp *disp, int reg) { return readl(disp->avbuf.base + reg); @@ -369,6 +385,34 @@ static bool zynqmp_disp_layer_is_video(const struct zynqmp_disp_layer *layer) return layer->id == ZYNQMP_DPSUB_LAYER_VID; } +/** + * zynqmp_disp_avbuf_set_live_format - Set live input format for a layer + * @disp: Display controller + * @layer: The layer + * @fmt: The format information + * + * Set the live video input format for @layer to @fmt. + */ +static void zynqmp_disp_avbuf_set_live_format(struct zynqmp_disp *disp, + struct zynqmp_disp_layer *layer, + const struct zynqmp_disp_format *fmt) +{ + u32 reg, i; + + reg = zynqmp_disp_layer_is_video(layer) + ? ZYNQMP_DISP_AV_BUF_LIVE_VID_CONFIG + : ZYNQMP_DISP_AV_BUF_LIVE_GFX_CONFIG; + zynqmp_disp_avbuf_write(disp, reg, fmt->buf_fmt); + + for (i = 0; i < ZYNQMP_DISP_AV_BUF_NUM_SF; ++i) { + reg = zynqmp_disp_layer_is_video(layer) + ? ZYNQMP_DISP_AV_BUF_LIVD_VID_COMP_SF(i) + : ZYNQMP_DISP_AV_BUF_LIVD_GFX_COMP_SF(i); + zynqmp_disp_avbuf_write(disp, reg, fmt->sf[i]); + } + layer->disp_fmt = fmt; +} + /** * zynqmp_disp_avbuf_set_format - Set the input format for a layer * @disp: Display controller @@ -902,15 +946,12 @@ u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, /** * zynqmp_disp_layer_enable - Enable a layer * @layer: The layer - * @mode: Operating mode of layer * * Enable the @layer in the audio/video buffer manager and the blender. DMA * channels are started separately by zynqmp_disp_layer_update(). */ -void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer, - enum zynqmp_dpsub_layer_mode mode) +void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer) { - layer->mode = mode; zynqmp_disp_avbuf_enable_video(layer->disp, layer); zynqmp_disp_blend_layer_enable(layer->disp, layer); } @@ -950,11 +991,12 @@ void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer, layer->disp_fmt = zynqmp_disp_layer_find_format(layer, info->format); layer->drm_fmt = info; - zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt); - - if (!layer->disp->dpsub->dma_enabled) + /* Live format set during layer creation */ + if (layer->mode == ZYNQMP_DPSUB_LAYER_LIVE) return; + zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt); + /* * Set pconfig for each DMA channel to indicate they're part of a * video group. @@ -1083,7 +1125,7 @@ static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp, unsigned int i; int ret; - if (!disp->dpsub->dma_enabled) + if (layer->mode == ZYNQMP_DPSUB_LAYER_LIVE) return 0; for (i = 0; i < layer->info->num_channels; i++) { @@ -1104,6 +1146,43 @@ static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp, return 0; } +/** + * zynqmp_disp_get_live_fmt - Get live video format + * @disp: Display controller + * @layer: Display layer + * + * Parse connected remote endpoint and retrieve configured bus-format + * + * Return: live format pointer on success, NULL otherwise + */ +static const struct zynqmp_disp_format *zynqmp_disp_get_live_fmt(struct zynqmp_disp *disp, + struct zynqmp_disp_layer *layer) +{ + struct device_node *local, *remote, *dpsub = disp->dev->of_node; + int rc, i; + u32 fmt; + + local = of_graph_get_endpoint_by_regs(dpsub, layer->id, -1); + if (!local) + return NULL; + + remote = of_graph_get_remote_endpoint(local); + of_node_put(local); + if (!remote) + return NULL; + + rc = of_property_read_u32(remote, "bus-format", &fmt); + of_node_put(remote); + if (rc) + return NULL; + + for (i = 0; i < ARRAY_SIZE(avbuf_live_vid_fmts); ++i) + if (avbuf_live_vid_fmts[i].bus_fmt == fmt) + return &avbuf_live_vid_fmts[i]; + + return NULL; +} + /** * zynqmp_disp_create_layers - Create and initialize all layers * @disp: Display controller @@ -1130,9 +1209,15 @@ static int zynqmp_disp_create_layers(struct zynqmp_disp *disp) for (i = 0; i < ARRAY_SIZE(disp->layers); i++) { struct zynqmp_disp_layer *layer = &disp->layers[i]; + const struct zynqmp_disp_format *disp_fmt; layer->id = i; layer->disp = disp; + /* For now we assume dpsub works in either live or non-live mode for both layers. + * Hybrid mode is not supported yet. + */ + layer->mode = disp->dpsub->dma_enabled ? ZYNQMP_DPSUB_LAYER_NONLIVE + : ZYNQMP_DPSUB_LAYER_LIVE; layer->info = &layer_info[i]; ret = zynqmp_disp_layer_request_dma(disp, layer); @@ -1140,6 +1225,12 @@ static int zynqmp_disp_create_layers(struct zynqmp_disp *disp) goto err; disp->dpsub->layers[i] = layer; + + if (layer->mode == ZYNQMP_DPSUB_LAYER_LIVE) { + disp_fmt = zynqmp_disp_get_live_fmt(disp, layer); + if (disp_fmt) + zynqmp_disp_avbuf_set_live_format(disp, layer, disp_fmt); + } } return 0; diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.h b/drivers/gpu/drm/xlnx/zynqmp_disp.h index 123cffac08be..f3357b2d5c09 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp.h +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.h @@ -62,8 +62,7 @@ void zynqmp_disp_blend_set_global_alpha(struct zynqmp_disp *disp, u32 *zynqmp_disp_layer_drm_formats(struct zynqmp_disp_layer *layer, unsigned int *num_formats); -void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer, - enum zynqmp_dpsub_layer_mode mode); +void zynqmp_disp_layer_enable(struct zynqmp_disp_layer *layer); void zynqmp_disp_layer_disable(struct zynqmp_disp_layer *layer); void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer, const struct drm_format_info *info); diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp_regs.h b/drivers/gpu/drm/xlnx/zynqmp_disp_regs.h index f92a006d5070..926e07c255bb 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_disp_regs.h +++ b/drivers/gpu/drm/xlnx/zynqmp_disp_regs.h @@ -165,10 +165,10 @@ #define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_10 0x2 #define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_12 0x3 #define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_BPC_MASK GENMASK(2, 0) -#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_RGB 0x0 -#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV444 0x1 -#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV422 0x2 -#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YONLY 0x3 +#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_RGB 0x00 +#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV444 0x10 +#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YUV422 0x20 +#define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_YONLY 0x30 #define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_FMT_MASK GENMASK(5, 4) #define ZYNQMP_DISP_AV_BUF_LIVE_CONFIG_CB_FIRST BIT(8) #define ZYNQMP_DISP_AV_BUF_PALETTE_MEMORY 0x400 diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index 9ed12244a429..6bcd1bbd1e26 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1295,7 +1295,7 @@ static void zynqmp_dp_disp_enable(struct zynqmp_dp *dp, /* TODO: Make the format configurable. */ info = drm_format_info(DRM_FORMAT_YUV422); zynqmp_disp_layer_set_format(layer, info); - zynqmp_disp_layer_enable(layer, ZYNQMP_DPSUB_LAYER_LIVE); + zynqmp_disp_layer_enable(layer); if (layer_id == ZYNQMP_DPSUB_LAYER_GFX) zynqmp_disp_blend_set_global_alpha(dp->dpsub->disp, true, 255); diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c index db3bb4afbfc4..43bf416b33d5 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c @@ -122,7 +122,7 @@ static void zynqmp_dpsub_plane_atomic_update(struct drm_plane *plane, /* Enable or re-enable the plane if the format has changed. */ if (format_changed) - zynqmp_disp_layer_enable(layer, ZYNQMP_DPSUB_LAYER_NONLIVE); + zynqmp_disp_layer_enable(layer); } static const struct drm_plane_helper_funcs zynqmp_dpsub_plane_helper_funcs = {