From patchwork Sat Mar 17 01:06:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyun Kwon X-Patchwork-Id: 10290573 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7C76D602BD for ; Sat, 17 Mar 2018 01:06:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DBF4290F9 for ; Sat, 17 Mar 2018 01:06:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61EEB2910C; Sat, 17 Mar 2018 01:06:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C5A76290F9 for ; Sat, 17 Mar 2018 01:06:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 916CC6EC23; Sat, 17 Mar 2018 01:06:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0050.outbound.protection.outlook.com [104.47.37.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id BF21B6EC1F for ; Sat, 17 Mar 2018 01:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dIRSjPnDiKdPMaQ4RHSqUTAMDlkWnOLDZCgl1Fj5ag8=; b=Ij5PtPMefjYprHIiBa8jr/urO3vZZ7QtBYIJns8h/aH4lKKUzeYR6oNPTkPcREFDqORgheIppqVB7NG7XyULzagJcivBZJVWmdEHg3ZcEEsFKgPsYwTtX1c66JsCRPHb2UZcaflC8uX0TfF+SDoYsSRoYI91R0X/RHn+RYXrU4Y= Received: from MWHPR0201CA0021.namprd02.prod.outlook.com (2603:10b6:301:74::34) by CY1PR02MB1301.namprd02.prod.outlook.com (2a01:111:e400:50f0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Sat, 17 Mar 2018 01:06:37 +0000 Received: from CY1NAM02FT025.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::209) by MWHPR0201CA0021.outlook.office365.com (2603:10b6:301:74::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.588.14 via Frontend Transport; Sat, 17 Mar 2018 01:06:31 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT025.mail.protection.outlook.com (10.152.75.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.567.18 via Frontend Transport; Sat, 17 Mar 2018 01:06:30 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1ex0Io-0003kb-6x; Fri, 16 Mar 2018 18:06:30 -0700 Received: from [127.0.0.1] (helo=xsj-smtp-dlp2.xlnx.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1ex0Ih-00051X-Ur; Fri, 16 Mar 2018 18:06:24 -0700 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w2H16NFN008038; Fri, 16 Mar 2018 18:06:23 -0700 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1ex0Ih-00051N-2T; Fri, 16 Mar 2018 18:06:23 -0700 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id 11CBE2C732B; Fri, 16 Mar 2018 18:06:23 -0700 (PDT) From: Hyun Kwon To: , Subject: [PATCH v6 5/5] drm: xlnx: ZynqMP DP subsystem DRM KMS driver Date: Fri, 16 Mar 2018 18:06:08 -0700 Message-ID: <1521248768-16202-5-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521248768-16202-1-git-send-email-hyun.kwon@xilinx.com> References: <1521248768-16202-1-git-send-email-hyun.kwon@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(376002)(39380400002)(346002)(396003)(2980300002)(438002)(199004)(189003)(5660300001)(2950100002)(6666003)(106466001)(336012)(51416003)(47776003)(426003)(186003)(59450400001)(2906002)(76176011)(50466002)(48376002)(26005)(36756003)(52956003)(356003)(16586007)(103686004)(106002)(478600001)(8676002)(110136005)(54906003)(305945005)(90966002)(50226002)(42186006)(316002)(107886003)(6266002)(8936002)(63266004)(81156014)(81166006)(4326008)(107986001)(217873001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR02MB1301; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1NAM02FT025; 1:msx+KRukVGDQVobL/PSEV6/6oQNCC19tBm6DRNl8dwdzFM4CC6v/9pKwOqokaISRHEFaQbnX/h3V8Z82CZxrw6coeW+GdDpqBFzlLJnkXwpqGPo1mW4mw6wu1fr1n9wQ MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67e739bd-0fb6-4ff9-2b52-08d58ba351c6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:CY1PR02MB1301; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1301; 3:FXJN+0jZNNAfzm1lcDjaVZmD4sODdEYv8KyAY+36yqyCyXj/g2yZqWGLS1r/YpDz91JiswsfbgIarpvrmaV7EM8IBU0EOCQ5M8+SPKmro5Nh5RRfy23HxuG2H3uHAF3KWzFymH+F0gWw8u+/3xfcRg9B+Ly0xxaizhlMcNBR3ddwfXVx34QeT6fUXHqO2DOOO2TKwc6jc40i4MxqC+4XCLqB33JitFRF5BN820ao6f2FiF0/X3Bx80k0WPmUNlceDi57a2Js1fztDU6S4wXv+/U0OFBHralIISGY+uKS46M7ao8LfTUEG4lbSlKZLFbyC8J1UgGlLWG3rJmIbsG8avVVrEUxXeQHJrF97ypeG8w=; 25:ZpKy13aukpoS8B50g7yinXKtp+IdYovDTZmXNu7Vva4zrew8F/xj99zJM5kA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sv9Ao1QdiEYWrlHB/pTR6YlW6nKSI6U+rwU X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93004095)(3231221)(944501244)(52105095)(6055026)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:CY1PR02MB1301; BCL:0; PCL:0; RULEID:; SRVR:CY1PR02MB1301; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1301; 4:3DTFTp0aG3QVMCilNyS/QoaEb46lXq49xoXgAWnplU1KleV+Jr3V/VDto0wkrDn9rRepNNAyv/BiTxOlk7nFJwHwvx9rcMce2qxR/0qKM35XkvXRZ0lfcFQxcKdlWVFOx/2AbnfBdYmwOhz0YQo/tmbmaoZdupd/uzQt2iaCb0kX9z//UEsO5dahfsqy4dJUPH8a0z1hlBS3T/74SaGhudyKwHnvBaNbCRtY8lU3xo1qkqugVLWUbMOhWYkZZ/uDEge1fMFlxdAAsKu1hsdrWR/9fJ0rYx8Di2deqinjyLtMbf8c1LW3GjVjG/qjMmog X-Forefront-PRVS: 06141B80DC X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR02MB1301; 23:HVB4cq4ynUb1zIpzX7CDKBETzWECue3lOxcx1mkjV?= =?us-ascii?Q?qI/1bHoU5dwvEga1m/qMQCuQSWwgljeMBBKBPkaGq+cHiKLI0+RG58xqyKc5?= =?us-ascii?Q?M8P2Ku3QjylzyPzGWW3ImLKLIP+CnN3lCi40HnAumNEmK9P7J0KvMscW9D3t?= =?us-ascii?Q?xNBrIiyFO2GYxhRoPt2tLwR1Z/4oEeh37vo3csZ+qGZVHXBIV/tp0y+uR6kG?= =?us-ascii?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G0iJk+2cJAj0Xx5fwuIGEhZgnI9WVSN+zu3Q02pRTwmC+/0jFSYoF1fNqBi47PQqK1APQLkOgosnaEnwRuOZngwOCW1+tKRec7mskhKVqdYtiQ2n6Lh5s1h8HobOOgbVawEwuhe+xxRbIj2+VOA6N SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2018 01:06:30.6758 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67e739bd-0fb6-4ff9-2b52-08d58ba351c6 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR02MB1301 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Rob Herring , Michal Simek , Hyun Kwon , Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is a wrapper around the ZynqMP Display and DisplayPort drivers. Signed-off-by: Hyun Kwon Acked-by: Daniel Vetter --- v6 - Accomodate the migration of logical master from platform device to device - Remove the duplicate license paragraphs - Do complete forward declaration in the header v5 - Add an error handling of pipeline initialization v4 - Use the newly added xlnx pipeline calls to initialize drm device v2 - Change the SPDX identifier format --- --- drivers/gpu/drm/xlnx/Kconfig | 11 +++ drivers/gpu/drm/xlnx/Makefile | 3 + drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 152 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/xlnx/zynqmp_dpsub.h | 23 ++++++ 4 files changed, 189 insertions(+) create mode 100644 drivers/gpu/drm/xlnx/zynqmp_dpsub.c create mode 100644 drivers/gpu/drm/xlnx/zynqmp_dpsub.h diff --git a/drivers/gpu/drm/xlnx/Kconfig b/drivers/gpu/drm/xlnx/Kconfig index 19fd7cd..7c5529c 100644 --- a/drivers/gpu/drm/xlnx/Kconfig +++ b/drivers/gpu/drm/xlnx/Kconfig @@ -10,3 +10,14 @@ config DRM_XLNX display pipeline using Xilinx IPs in FPGA. This module provides the kernel mode setting functionalities for Xilinx display drivers. + +config DRM_ZYNQMP_DPSUB + tristate "ZynqMP DP Subsystem Driver" + depends on ARCH_ZYNQMP && OF && DRM_XLNX && COMMON_CLK + select DMA_ENGINE + select GENERIC_PHY + help + DRM KMS driver for ZynqMP DP Subsystem controller. Choose + this option if you have a Xilinx ZynqMP SoC with DisplayPort + subsystem. The driver provides the kernel mode setting + functionlaities for ZynqMP DP subsystem. diff --git a/drivers/gpu/drm/xlnx/Makefile b/drivers/gpu/drm/xlnx/Makefile index c60a281..064a05a 100644 --- a/drivers/gpu/drm/xlnx/Makefile +++ b/drivers/gpu/drm/xlnx/Makefile @@ -1,2 +1,5 @@ xlnx_drm-objs += xlnx_crtc.o xlnx_drv.o xlnx_fb.o xlnx_gem.o obj-$(CONFIG_DRM_XLNX) += xlnx_drm.o + +zynqmp-dpsub-objs += zynqmp_disp.o zynqmp_dpsub.o zynqmp_dp.o +obj-$(CONFIG_DRM_ZYNQMP_DPSUB) += zynqmp-dpsub.o diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c new file mode 100644 index 0000000..7c6981b --- /dev/null +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c @@ -0,0 +1,152 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * ZynqMP DP Subsystem Driver + * + * Copyright (C) 2017 - 2018 Xilinx, Inc. + * + * Author: Hyun Woo Kwon + */ + +#include +#include +#include +#include +#include + +#include "xlnx_drv.h" + +#include "zynqmp_disp.h" +#include "zynqmp_dp.h" +#include "zynqmp_dpsub.h" + +static int +zynqmp_dpsub_bind(struct device *dev, struct device *master, void *data) +{ + int ret; + + ret = zynqmp_disp_bind(dev, master, data); + if (ret) + return ret; + + /* zynqmp_disp should bind first, so zynqmp_dp encoder can find crtc */ + ret = zynqmp_dp_bind(dev, master, data); + if (ret) + return ret; + + return 0; +} + +static void +zynqmp_dpsub_unbind(struct device *dev, struct device *master, void *data) +{ + zynqmp_dp_unbind(dev, master, data); + zynqmp_disp_unbind(dev, master, data); +} + +static const struct component_ops zynqmp_dpsub_component_ops = { + .bind = zynqmp_dpsub_bind, + .unbind = zynqmp_dpsub_unbind, +}; + +static int zynqmp_dpsub_probe(struct platform_device *pdev) +{ + struct zynqmp_dpsub *dpsub; + int ret; + + dpsub = devm_kzalloc(&pdev->dev, sizeof(*dpsub), GFP_KERNEL); + if (!dpsub) + return -ENOMEM; + + /* Sub-driver will access dpsub from drvdata */ + platform_set_drvdata(pdev, dpsub); + pm_runtime_enable(&pdev->dev); + + /* + * DP should be probed first so that the zynqmp_disp can set the output + * format accordingly. + */ + ret = zynqmp_dp_probe(pdev); + if (ret) + goto err_pm; + + ret = zynqmp_disp_probe(pdev); + if (ret) + goto err_dp; + + ret = component_add(&pdev->dev, &zynqmp_dpsub_component_ops); + if (ret) + goto err_disp; + + /* Populate the sound child nodes */ + ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); + if (ret) { + dev_err(&pdev->dev, "failed to populate child nodes\n"); + goto err_component; + } + + dpsub->master = xlnx_drm_pipeline_init(&pdev->dev); + if (IS_ERR(dpsub->master)) { + dev_err(&pdev->dev, "failed to initialize the drm pipeline\n"); + goto err_populate; + } + + dev_info(&pdev->dev, "ZynqMP DisplayPort Subsystem driver probed"); + + return 0; + +err_populate: + of_platform_depopulate(&pdev->dev); +err_component: + component_del(&pdev->dev, &zynqmp_dpsub_component_ops); +err_disp: + zynqmp_disp_remove(pdev); +err_dp: + zynqmp_dp_remove(pdev); +err_pm: + pm_runtime_disable(&pdev->dev); + return ret; +} + +static int zynqmp_dpsub_remove(struct platform_device *pdev) +{ + struct zynqmp_dpsub *dpsub = platform_get_drvdata(pdev); + int err, ret = 0; + + xlnx_drm_pipeline_exit(dpsub->master); + of_platform_depopulate(&pdev->dev); + component_del(&pdev->dev, &zynqmp_dpsub_component_ops); + + err = zynqmp_disp_remove(pdev); + if (err) + ret = -EIO; + + err = zynqmp_dp_remove(pdev); + if (err) + ret = -EIO; + + pm_runtime_disable(&pdev->dev); + + return err; +} + +static const struct of_device_id zynqmp_dpsub_of_match[] = { + { .compatible = "xlnx,zynqmp-dpsub-1.7", }, + { /* end of table */ }, +}; +MODULE_DEVICE_TABLE(of, zynqmp_dpsub_of_match); + +static struct platform_driver zynqmp_dpsub_driver = { + .probe = zynqmp_dpsub_probe, + .remove = zynqmp_dpsub_remove, + .driver = { + .owner = THIS_MODULE, + .name = "zynqmp-display", + .of_match_table = zynqmp_dpsub_of_match, + }, +}; + +module_platform_driver(zynqmp_dpsub_driver); + +MODULE_AUTHOR("Xilinx, Inc."); +MODULE_DESCRIPTION("ZynqMP DP Subsystem Driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.h b/drivers/gpu/drm/xlnx/zynqmp_dpsub.h new file mode 100644 index 0000000..95239bb --- /dev/null +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * ZynqMP DPSUB Subsystem Driver + * + * Copyright (C) 2017 - 2018 Xilinx, Inc. + * + * Author: Hyun Woo Kwon + */ + +#ifndef _ZYNQMP_DPSUB_H_ +#define _ZYNQMP_DPSUB_H_ + +struct device; +struct zynqmp_dp; +struct zynqmp_disp; + +struct zynqmp_dpsub { + struct zynqmp_dp *dp; + struct zynqmp_disp *disp; + struct device *master; +}; + +#endif /* _ZYNQMP_DPSUB_H_ */