From patchwork Wed May 2 00:31:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyun Kwon X-Patchwork-Id: 10374653 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 711E56053D for ; Wed, 2 May 2018 00:32:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59B8128D15 for ; Wed, 2 May 2018 00:32:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E2E328D63; Wed, 2 May 2018 00:32:43 +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=-5.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, 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 7909E28D15 for ; Wed, 2 May 2018 00:32:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 31B466E0C2; Wed, 2 May 2018 00:32:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0041.outbound.protection.outlook.com [104.47.40.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2CC826E0C2 for ; Wed, 2 May 2018 00:32: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=sp3WYrb7eGj0d2wFc65uuS8Aff/umjA66cG4aL1PuDgC87ZeCuTGcTvgvZm4CpCHX+lyEJKVKtIHBu8p7N8+NqQZ0/gLmjQSV+HIU5FVnpmnaz9VBEOrtPMGXqdsothfpc/+8SYdCId+ZD/fUyxM12zbCtvJ8/c1nWkNcEc39Jo= Received: from MWHPR02CA0043.namprd02.prod.outlook.com (2603:10b6:301:60::32) by CY1PR02MB1673.namprd02.prod.outlook.com (2a01:111:e400:529a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.17; Wed, 2 May 2018 00:32:37 +0000 Received: from SN1NAM02FT031.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::201) by MWHPR02CA0043.outlook.office365.com (2603:10b6:301:60::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.715.18 via Frontend Transport; Wed, 2 May 2018 00:32:37 +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 SN1NAM02FT031.mail.protection.outlook.com (10.152.72.116) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.715.13 via Frontend Transport; Wed, 2 May 2018 00:32:36 +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 1fDfhD-0000zL-SN; Tue, 01 May 2018 17:32:35 -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 1fDfh8-0006EE-Mr; Tue, 01 May 2018 17:32:30 -0700 Received: from xsj-pvapsmtp01 (smtp2.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w420WT5D012164; Tue, 1 May 2018 17:32:30 -0700 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1fDfh7-0006Dv-PK; Tue, 01 May 2018 17:32:29 -0700 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id BE4512C735A; Tue, 1 May 2018 17:32:29 -0700 (PDT) From: Hyun Kwon To: , , Laurent Pinchart Subject: [PATCH v7 5/5] drm: xlnx: ZynqMP DP subsystem DRM KMS driver Date: Tue, 1 May 2018 17:31:46 -0700 Message-ID: <1525221106-32269-6-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525221106-32269-1-git-send-email-hyun.kwon@xilinx.com> References: <1525221106-32269-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)(346002)(39380400002)(39860400002)(396003)(376002)(2980300002)(438002)(189003)(199004)(486006)(48376002)(106002)(76176011)(5660300001)(26005)(63266004)(52956003)(6266002)(107886003)(51416003)(59450400001)(8676002)(36756003)(476003)(110136005)(186003)(54906003)(50466002)(2616005)(316002)(446003)(11346002)(81156014)(42186006)(90966002)(356003)(6666003)(50226002)(126002)(16586007)(426003)(47776003)(336012)(305945005)(478600001)(4326008)(44832011)(81166006)(8936002)(103686004)(2906002)(106466001)(107986001)(2101003)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR02MB1673; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-83.xilinx.com; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT031; 1:bUsCv6Y9/tX7jfJ6KN73sLxm8ikvFdshTPnoo39JLc4ujQBeywvDOUgNyj3czhzOaF2BzXBTSyJS4e+ADqUrhewxlK2EQ68tBQVG46OsHKw1mCRWDcalyvnkHX5/pD4i MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:CY1PR02MB1673; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1673; 3:ovmZlQ2hmwjwBVyqfHHB66JAhc3mR4EqX5X3658MfExouqHg7528cCcDcGxI9eE1tPDdpFPBSWA72Xn1VUooNcO7no3TMKwe7KKIPNno2iQkFiUa6mBbqc8aAUwsiP+IzR9VL/kh/yzy+gy0+IpxJhJxuowx9B/dBs7LFJwOBR63YyEtdsEqV5alo/VuTu2RJUtm+w0sfZm5Ja3tPD/g24tbKY9eRe9zf+YsjsPZGweFBrz20KjronQg7gduodudWYayMbjiOakeVneWGRO7htOeEJPR+6OU3qM4UVY1kKp308F8QoAYuTfWOLcR+pBpTciS8yEYg28At0NW8MeQrOiu9Ru5K00du6qKdl7nFwQ=; 25:aayt7EM2xr30JhSqy5UALUmOFX2gT1RPTQjfMa1hMbp6HlTndXfFvnYZwMcZoj1hxWEZL7hQMN6G402KibcnlCavsGbTBQETYf0FtvIc8dBOWOHkr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N, 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)(5005006)(8121501046)(93006095)(93004095)(3002001)(3231254)(944501410)(52105095)(10201501046)(6055026)(6041310)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY1PR02MB1673; BCL:0; PCL:0; RULEID:; SRVR:CY1PR02MB1673; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1673; 4:QWOpT1p4/VO9cLyV97AokQ2MbIEAIeB5P6AkafhuH95qD2nrvMLGk4ccVqZjUPcFvE/u4Ri+V/dpJ9mu0Fa13chZv8c+V/aLuNpcfMnqOQlD6Z0CQLAKgaIjq3AuHVQyzPOh6MDxcWk4CMWCB0Q8xHlj7vK80hKL2H1PfgXfgRgy8QxcSYhEIIX35cuHLSmSENfhsDBm4C+I1UfExDCGW2cTYmuVexFKAPES55hZbN4cHqVBennstUt5CYnPgAZ+Ulfo2rVT2R8RI6JeC2bUZ4FrKKgq2fZJucNo3EJOnPGYaqNu1ungQmPk19NZYdUe X-Forefront-PRVS: 06607E485E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR02MB1673; 23:af9xzwAsj7x2yTY2amUPFta/AEXZKjLCBk6NGzXRU?= =?us-ascii?Q?ZCGAlVZQiQ0JlXg7UeNYsy2aZ014HK5NgCFZU7jMKyHD7/MY8/TtLU9aXqd6?= =?us-ascii?Q?5R3SSTtmqBtNNqUluQx/RRozdY//y2lXhp0xDfl20pmdrhEfGzrX6mdZz4dB?= =?us-ascii?Q?M0M8vaVK4sbfZMbg+uai/nyUx6k1I/IJUjT6BxVe+waz95UPV5pRSCLYzXO6?= =?us-ascii?Q?HFDNZOarLt5TFvKxQqMsEBvMhkbsSTLz+LmN9nhBf7G/X4P1J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c9mijjA2H4VHZtMxmRj/U+kuCgIp/6UfzQe9gbNGTIzhWf+e7OpMTv5muOwDQY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1673; 7:axPcX4BdP36o74UC6xPsuSUepZI5XhAEyV8qHiwSZir02qjG6dWIqp3c2nkuRrVWIi1kOrdwl406waEjLTkXcbWpp7hBCc7PsNvWsmBAOIoCuVzeHDwpfuvkPX0gV3a2l3hA7NiYb8UUGwVSCBpRYBvD+cp+UbQhJDu6zm9v+vropvnem7mID30lFPwXo+wehO7HM0St+vPOC/5mA425/25ed8V/ZbIDwt5uMDR7xbc/voRv+3Zb7ZcYoVZD5db7 X-MS-Office365-Filtering-Correlation-Id: 464bf0d0-b430-4b1f-9406-08d5afc4343c X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2018 00:32:36.4504 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 464bf0d0-b430-4b1f-9406-08d5afc4343c 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: CY1PR02MB1673 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 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_ */