From patchwork Wed Feb 7 01:36:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyun Kwon X-Patchwork-Id: 10204409 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 BB6FD605BA for ; Wed, 7 Feb 2018 01:37:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABD6428D9F for ; Wed, 7 Feb 2018 01:37:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9155E28D9D; Wed, 7 Feb 2018 01:37:04 +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 0263628D9A for ; Wed, 7 Feb 2018 01:37:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 45BF389EB4; Wed, 7 Feb 2018 01:36:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0064.outbound.protection.outlook.com [104.47.42.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E2F46E100 for ; Wed, 7 Feb 2018 01:36:56 +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=IsE4GraAKFAxlKQFj5MSEUfli241m5KJ+gBCVwKPmVA=; b=k0McAzCv4Q/isdjzcoJTuH/3zxhmFU7IcIBqOf2hXToIFVNR9jmHF6ggt+ZmxEuJW2I3NSBpJ6wWauEahFElpgmBGJCpu0qr2KSNsQ9bpKw4DK2hmXixF92A1REeQKbSwaXWYtF2z5K3fiU+f53XuRX44vkU3pBrzdvnzW4Ve3A= Received: from CY4PR02CA0014.namprd02.prod.outlook.com (10.169.188.24) by SN1PR02MB1342.namprd02.prod.outlook.com (10.162.0.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Wed, 7 Feb 2018 01:36:54 +0000 Received: from BL2NAM02FT059.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::203) by CY4PR02CA0014.outlook.office365.com (2603:10b6:903:18::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.464.11 via Frontend Transport; Wed, 7 Feb 2018 01:36:54 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) 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.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by BL2NAM02FT059.mail.protection.outlook.com (10.152.76.247) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.444.13 via Frontend Transport; Wed, 7 Feb 2018 01:36:53 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:50989 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1ejEfM-00039Y-KJ; Tue, 06 Feb 2018 17:36:52 -0800 Received: from [127.0.0.1] (helo=xsj-smtp-dlp2.xlnx.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1ejEfM-0004aN-GE; Tue, 06 Feb 2018 17:36:52 -0800 Received: from xsj-pvapsmtp01 (smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w171apZA029865; Tue, 6 Feb 2018 17:36:51 -0800 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1ejEfL-0004a8-Fe; Tue, 06 Feb 2018 17:36:51 -0800 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id 7516B2C6982; Tue, 6 Feb 2018 17:36:51 -0800 (PST) From: Hyun Kwon To: , Subject: [PATCH v5 5/5] drm: xlnx: ZynqMP DP subsystem DRM KMS driver Date: Tue, 6 Feb 2018 17:36:40 -0800 Message-ID: <1517967400-16993-5-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517967400-16993-1-git-send-email-hyun.kwon@xilinx.com> References: <1517967400-16993-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.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39380400002)(376002)(396003)(39850400004)(346002)(2980300002)(438002)(189003)(199004)(2950100002)(6666003)(54906003)(42186006)(5660300001)(81166006)(110136005)(81156014)(8676002)(8936002)(50226002)(16586007)(316002)(36756003)(63266004)(4326008)(356003)(59450400001)(103686004)(48376002)(107886003)(106466001)(305945005)(106002)(47776003)(478600001)(50466002)(2906002)(51416003)(6266002)(336011)(76176011)(90966002)(26005)(186003)(52956003)(2004002)(107986001)(2101003)(217873001)(5001870100001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR02MB1342; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT059; 1:Y+thXi9Ysa9SSOMXVungDQUZgb9AEUkh6AwEIPqzVrcOwsGMuMpdaOuJI5pYsRCW4SVVdYYMhQGqq55JrdTrC0yp5jD5cCdO/gAkSvt6eLNDNVJ28EaRZjfuJQC5M4Uw MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 41b4e17a-6f1d-48f6-8cb1-08d56dcb447a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:SN1PR02MB1342; X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB1342; 3:azqjDXL2/PT18fhC+3SuORJmLFZT7VpqUVdfRfg/urWRkOI4obfLzGK49RoegbGmaFKCKJGJeeQEpXJmV4J/lpAYTDpwk5BzSLzXoq6zDq/yeN03UZAy4WnRThWX/62+255WojQBMXkaxp+dF+SOZHKjjQqq4D8d0X+KlReAxZJlGvCt5CaqGmk+kuJDWGgVOdjPw1ndGwM03sR8CIipm3YgZ2EAE9HvMxnKfjPSVfK4zyhsQwmLCDodK49c4lyI9rDFQoD9Rjixy7pQjFzlhv16drej1frEUq85FIPhqG1V63FdN+VAk0/aP2/q4TTLp7Gx8Ygr0lXfs7vN32JYRJcC9Yn4YuyG13Vyt46cpmo=; 25:ubW2VBfr6T7k6Qe5sbaBOTeEiMb2GmCOUEyexYgEUad8VC5EQ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ilPiSc6SwzoX2s3CRmIrrcOm9w 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:(6040501)(2401047)(5005006)(8121501046)(3002001)(3231101)(2400082)(944501161)(10201501046)(93006095)(93004095)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:SN1PR02MB1342; BCL:0; PCL:0; RULEID:; SRVR:SN1PR02MB1342; X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB1342; 4:inr4QioySZTzvPkha1ZsotWVIo7H3jO0qGWhct0nn159eaaDMu0qFkFq3udi0258tupM1Ytd8qZ88/mUuztX4ZPDAfNllWnIsoVdavlwr/bg+m6bzXVGjO4aKo3ikGVGRCBRkf1b21Gb+bi+853QuuXjRorDPhoJCfNZlAV6fNVgYaFKDSq2rpRUL7NxkB4JjhPvFWZJCRfckUjnu6mYCrvySdJE8SL3AZNiz7qFUYdBqtUWswxCm+BBzHfOy15UpnsdfkGs4C+psk9SZKxJNkzS+YM8n1xZEVfebuqO0/DsD9OwSpCLarGuY/v4Zon5 X-Forefront-PRVS: 0576145E86 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR02MB1342; 23:9BRSkqa8jr4/rPL8GUnU1kUqfMa/11exd+uaMpAF2?= =?us-ascii?Q?NpV/BpKJ9rcoDBFX2UqSc20b+wm2Ck7sO3J+ghIebHhybcmqCRLNvedKxiNK?= =?us-ascii?Q?n0qGWHM12oqDe4PUsQFCY/fcz1euOpO0b9ilWuc/Y7yN9dpAZWa9ogDrgbGI?= =?us-ascii?Q?b2wxtmv+A+AAMlJqTXpNWPXI31CrdJ/Xlwgjnj+FwIBzCYi+rCIhSArzYox7?= =?us-ascii?Q?ucQD/4fOwhFqC6XkN3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qXWENV?= =?us-ascii?Q?2n0cRYWMC32vacMPHUYc/KZsJnpXsfQlyBsahY7ulZhx7OuqKE8LA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR02MB1342; 6:gSITJ36rJNm8SOIQ7vqyGQ01bwAsnbS4NMZdr4c83XmJNEbkby2sHq9KTiD2Nsn3cTmPM8iwNiEJNrL7b6++BmMk69WG4pf9fyytf+QobwNUjQKhkLKtS/0kY60fj/FeajMeHVIM5Nj2RuST5bGao0VdQ6VSjdWIob/AC615lxPuxiLWn5ECXDNRl8qjbTrXG3LbxDXgMQIoD3CFDV8o8XzSQ+uGwb8h5EkPl6WE/j13jMog6BaDaiauu72KynhOPHeWXgx0YdTTozcSV2hu5sEU3oXHfwBT1qeIw+ait5h4cxW3DIoyd1m0AJnFADCdpaRye7rL8MqWZ9C7Zaoczg==; 5:TXfMoMdyakBbPVoX9/lzvvTFcW98oeSMWYqY/KQepZ5QcIyav722dZgtvwml5rSL61SI95PfyBcXysSRl71/bLKi3RPQfhpjC+w4Oxoxd9ah+EbawplohyIFRAYoIVyBc3KlaBSOkKrjliwOsbDpDMgiQw/rkRIJzVtYB2Eqq5g=; 24:cTMvXdsKo+gRpSZyc3FUwbhpsW+jM1RxW+e2m4esz3KtopQ6NBzCgJLHB9fLa4vnSfXSE71TaSncyjMcBZTrbmj85FgtO1qsw6Ez8qYQzHc=; 7:YSDag2AWD9rA4aN0wCP6DufTDg4tZN5xD6heD2MHdA9LIGLOj0cD2DM+rEHwH+juDgJoI+KW40cTu30mEjsxgh3aiK4kFQmMlW2eMTpIrOVhAPbnMouIYPgvReNWv9/9xwX4OkkgCEx1C1mR8GFGvkVsOPBcAa5DQctI2/2y7Nl/LdPSfzcyzOZb6Z0UH6pwTfBXwzButS5E/VWUDIPBBc9JEIPAPLledDwL4WW8IewBwj5fV2lciV6exoHpwEu0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2018 01:36:53.4495 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 41b4e17a-6f1d-48f6-8cb1-08d56dcb447a 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.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR02MB1342 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 --- 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 | 155 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/xlnx/zynqmp_dpsub.h | 28 +++++++ 4 files changed, 197 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..5aaf9fb --- /dev/null +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c @@ -0,0 +1,155 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * ZynqMP DP Subsystem Driver + * + * Copyright (C) 2017 - 2018 Xilinx, Inc. + * + * Author: Hyun Woo Kwon + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#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; + } + + dev_info(&pdev->dev, "ZynqMP DisplayPort Subsystem driver probed"); + + dpsub->master = xlnx_drm_pipeline_init(pdev); + + 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) +{ + 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..6606bef --- /dev/null +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.h @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * ZynqMP DPSUB Subsystem Driver + * + * Copyright (C) 2017 - 2018 Xilinx, Inc. + * + * Author: Hyun Woo Kwon + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _ZYNQMP_DPSUB_H_ +#define _ZYNQMP_DPSUB_H_ + +struct zynqmp_dpsub { + struct zynqmp_dp *dp; + struct zynqmp_disp *disp; + struct platform_device *master; +}; + +#endif /* _ZYNQMP_DPSUB_H_ */