From patchwork Fri Jan 5 02:05:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyun Kwon X-Patchwork-Id: 10145967 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 4261F60329 for ; Fri, 5 Jan 2018 02:21:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59AC028922 for ; Fri, 5 Jan 2018 02:21:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CE6528925; Fri, 5 Jan 2018 02:21:15 +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 A6DEA28922 for ; Fri, 5 Jan 2018 02:21:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EEB76E29A; Fri, 5 Jan 2018 02:21:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 894 seconds by postgrey-1.35 at gabe; Fri, 05 Jan 2018 02:21:12 UTC Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0089.outbound.protection.outlook.com [104.47.32.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7975E6E29A for ; Fri, 5 Jan 2018 02:21:12 +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=n8KJCdrLt6L46nWXNLJwZN0EmlTwrT4jAkeVW1CKkLo=; b=ymXKE9ww1E8T3Ii9GqlUcM3Cxg+7/0467SyFgA14vgjB8PSS1Q1n12DRW1Mc6wcu9ZW8WHSzIp7zrv07ZTYrURKvbUnQrSnKEL24dp7bKKPO7vG9v6XDjwOB7CXllcpprySIf++FzNZirMEaG/N890rZnbG6Emrc7rIWXDkKEP8= Received: from MWHPR0201CA0066.namprd02.prod.outlook.com (2603:10b6:301:73::43) by DM2PR02MB1337.namprd02.prod.outlook.com (2a01:111:e400:50c8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Fri, 5 Jan 2018 02:06:15 +0000 Received: from BL2NAM02FT027.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::209) by MWHPR0201CA0066.outlook.office365.com (2603:10b6:301:73::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Fri, 5 Jan 2018 02:06:15 +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 BL2NAM02FT027.mail.protection.outlook.com (10.152.77.160) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Fri, 5 Jan 2018 02:06:14 +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 1eXHOg-0005vD-29; Thu, 04 Jan 2018 18:06:14 -0800 Received: from [127.0.0.1] (helo=xsj-smtp-dlp1.xlnx.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eXHOf-0003Pq-P2; Thu, 04 Jan 2018 18:06:13 -0800 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w0526BHu003030; Thu, 4 Jan 2018 18:06:11 -0800 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eXHOd-0003OY-A6; Thu, 04 Jan 2018 18:06:11 -0800 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id 4B63F2C68EA; Thu, 4 Jan 2018 18:06:11 -0800 (PST) From: Hyun Kwon To: , Subject: [PATCH 09/10] drm: xlnx: ZynqMP DP subsystem DRM KMS driver Date: Thu, 4 Jan 2018 18:05:58 -0800 Message-ID: <1515117959-18068-10-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515117959-18068-1-git-send-email-hyun.kwon@xilinx.com> References: <1515117959-18068-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-23572.006 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)(376002)(39860400002)(396003)(39380400002)(2980300002)(438002)(199004)(189003)(76176011)(356003)(6266002)(6666003)(305945005)(110136005)(2906002)(106002)(50226002)(5660300001)(50466002)(48376002)(2950100002)(51416003)(107886003)(52956003)(59450400001)(4326008)(16586007)(103686004)(47776003)(42186006)(8936002)(54906003)(316002)(478600001)(90966002)(36756003)(81166006)(81156014)(8676002)(63266004)(106466001)(107986001)(2101003)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR02MB1337; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT027; 1:xlu0HvCU6ghLxUtBLs1fiN3Towf2A/viFQF84ZDYefHFspSvNyiz+uC9WjypHP/Qn1a4YYgEfXh1d9ckjJDihMByeYuY6rog5NalKBiPhFq0a9U6jSUfv+wuoJ5fl25R MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 95800eac-63ef-4ca8-5e20-08d553e0e66d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:DM2PR02MB1337; X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB1337; 3:IPKs986tMFPzI3TTaH+EaTIWRdhZ4WAj/vawRXdnErl1nrb4MGk+aZ7kbymX35S42ZEz6eMXVynTZl6cW6ZjMtVhvvgVBkX+8Gbi/1ujQhGLVVvDcvUPiaPK8dfYTI2n0Cw7QP0ZdkULWWR8uD2eN5mnUubH2ZaoxCGMmmxapeTi8rBbCf2TGQRvVV9BE8cwDR5ZhSaUYYDLb8eze/L4BAsQjkM0M8q6H1w5PYg4l3JF4ax3E+O9uQpxp8ydg+aZoW6XIxVc3xsfrVYIfTmqDl5vaWNEMl0Ld//yCZuiohexJKSEIEmbEW3DRU1oDPhAadqyi6tit5mz9iA/AoE4AWuR7vCWiCZLoK7uj0Yz4VA=; 25:rMZhxM4hsCvc3+Xp1pqA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eftWKGpCV6Ey8mTmD7roqbECSpsfQnXWO7i+Gydfo+8/IKfAR12/xHlW3mFehr7Ck X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93004095)(10201501046)(3002001)(3231023)(944501075)(6055026)(6041268)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:DM2PR02MB1337; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM2PR02MB1337; X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB1337; 4:Jh6ElHlnkTASxdbh3XDcdEGVRjtfC5OXEh0fWv3rygKyMveRJtBjQTSxA2mx7QR6IOecZZnKLWOZCDKiOdheMyQhu5e+9iQBw02oljJVtK/7B4TBaoYIw7bIyYzu9ei1OYk8nGUeofQbuxRkrC94FAjq4evP68nTi+DDPzG6lRDldgIYqvvFiVuCkAFES3WNqth8CCs8+xoElt2gxZqTcewHoUCmfqGXQ5XjgYTYelGgfLL/cEYCRJeIbJiJ9lXXytJynWYKpEPHH9L9fwUjBk5G8nbxE7jDkxPG3jlYgzFu7P9xnxwD702qEse9aXhq X-Forefront-PRVS: 05437568AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR02MB1337; 23:GRZJrjeYJUpj4QYK+t2ux+iojvdsU8ovdtkiicnNB?= =?us-ascii?Q?O8NHFTg0WnpF86LEKdLDP3bc1X273j2s0v3JLnQQAumlH1edz7VmOMnUh3Mh?= =?us-ascii?Q?vNmCFlnD3VB8tXIw4NnJtgXQyHEDWN0TljsiN2r61BTaidBKrmhswYTNR8oI?= =?us-ascii?Q?+bwK7ju0cMEiA1H7usw3RSeDJRTc8MKAgGWH/jqwfVWw+AFI5yAcw442uUMk?= =?us-ascii?Q?IEG1qyGPvv5Y7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ics: 1; DM2PR02MB1337; 6:mXKPBGHrgLlEFLDX/YignrJrZlcCK2hEZbLuVhoUI7F3/I/6o98c/CGoGHow2OducmdXBpYfk1KG4m9fAGVPk1M5fmtV7DFHP0ksM1kgAsbvC6VBCD+6WeRVvTarc4qHWJ7ZXw9J28Fzrxz8WsZn07VQuuRCebDFHJIJo7KvgzJR6B4WDZ7DGEWJLKAbvNQi92yu8Ec4f7up6JX1yE/5axBvbdhw+iejqMMOMxDXyi1RNZTnmbV8rlS59QsEtpmpPMmzpZFHQYpp+mjjCBZFkk4+896CGjErSojW/gg/8a4SrKVVkkAzgscSttR3QtYXFvFJt3nhCkoS2gLwh4FrAV2+BhCTOyjKaP2kGww7RF0=; 5:kerREwVHoAGZVwLDPZq/Nc335V12dbzh/E3oGx0Kv71/RUAEizQV+Tv+4CktpmEwMiGaNqamhhTq/MprTSaYQFMjyf0zStJxxslPMsytKwIc6/UhlrOV52iMQsvxgl+0+8gfuSoAWp4aHv6kEBRU6rFa16jb7hSuZlsSUxTMsWU=; 24:bC7kDuPefyHZIB0UK9kS5YCIY16i2UvF1wQ59O+BDLQml5jtL4GJiLmYrWIiQUi116YIpSS49IddqFhlz9CfwyDVIHVLBdU6NohTziLxMHY=; 7:gCHmUZ2cDkv54u+EaOT85/hsIEpMIZLth5aI+pwRZ7FLxjX7x/ZHpB0FTXcrx+8dYsltFguU73QHzCljqJ9OWDtwFhHEm02Pe+q26qK+pwOCz/qA3IOXUJuNPwkahUPQTkpmwvS4AqRsipfWaO03vaj6NqMMCnHIg7o1pFFQ1vyMGSQYFm0IKlH8Ewtm0lFRtJM4BtpNFt2NbJTCCd6IuLhEkJq6a7tAMJpJEdI/7Muw6EmcC4KFN3JagSkuw+OA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2018 02:06:14.3843 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 95800eac-63ef-4ca8-5e20-08d553e0e66d 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: DM2PR02MB1337 Cc: Michal Simek , Hyun Kwon X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 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" X-Virus-Scanned: ClamAV using ClamSMTP This is a wrapper around the ZynqMP Display and DisplayPort drivers. Signed-off-by: Hyun Kwon --- drivers/gpu/drm/xlnx/Kconfig | 11 +++ drivers/gpu/drm/xlnx/Makefile | 3 + drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 141 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/xlnx/zynqmp_dpsub.h | 19 +++++ 4 files changed, 174 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..ccca798 --- /dev/null +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c @@ -0,0 +1,141 @@ +/* + * ZynqMP DP Subsystem Driver + * + * Copyright (C) 2017 - 2018 Xilinx, Inc. + * + * Author: Hyun Woo Kwon + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#include +#include +#include +#include +#include + +#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; + } + + dev_info(&pdev->dev, "ZynqMP DisplayPort Subsystem driver probed"); + + return 0; + +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) +{ + int err, ret = 0; + + 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..df5713a --- /dev/null +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.h @@ -0,0 +1,19 @@ +/* + * ZynqMP DPSUB Subsystem Driver + * + * Copyright (C) 2017 - 2018 Xilinx, Inc. + * + * Author: Hyun Woo Kwon + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#ifndef _ZYNQMP_DPSUB_H_ +#define _ZYNQMP_DPSUB_H_ + +struct zynqmp_dpsub { + struct zynqmp_dp *dp; + struct zynqmp_disp *disp; +}; + +#endif /* _ZYNQMP_DPSUB_H_ */