From patchwork Fri Jan 26 01:34:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyun Kwon X-Patchwork-Id: 10184991 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 F390460388 for ; Fri, 26 Jan 2018 01:34:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3EC9289EF for ; Fri, 26 Jan 2018 01:34:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D81AA1FEB1; Fri, 26 Jan 2018 01:34: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=-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 301D21FEB1 for ; Fri, 26 Jan 2018 01:34:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 94944896B5; Fri, 26 Jan 2018 01:34:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0079.outbound.protection.outlook.com [104.47.36.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id 056146E0B2 for ; Fri, 26 Jan 2018 01:34:33 +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=gEVUZaJy13ECNkkmqI2NeJM4njB97qY8oxDtugJrEKqKM1iKx7flY1xiIDH7gP8hxuwY5aLAeFpIKVw1UyJ+ee6C84MZwjUQw2kYPCD1KiAeqZ5IQluFEU0bzGhSLIP7FtmNP9mVyAfolPTcFQdng8lk/UirPJ/M3sTMecMTz5g= Received: from MWHPR0201CA0107.namprd02.prod.outlook.com (10.167.161.48) by MWHPR02MB3391.namprd02.prod.outlook.com (10.164.192.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Fri, 26 Jan 2018 01:34:26 +0000 Received: from BL2NAM02FT017.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::205) by MWHPR0201CA0107.outlook.office365.com (2603:10b6:301:75::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.444.14 via Frontend Transport; Fri, 26 Jan 2018 01:34:26 +0000 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 BL2NAM02FT017.mail.protection.outlook.com (10.152.77.174) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.444.13 via Frontend Transport; Fri, 26 Jan 2018 01:34:23 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:40618 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1eesuM-0003FY-T0; Thu, 25 Jan 2018 17:34:22 -0800 Received: from localhost ([127.0.0.1] helo=xsj-pvapsmtp01) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eesuM-0002Uc-PV; Thu, 25 Jan 2018 17:34:22 -0800 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eesuM-0002UW-5H; Thu, 25 Jan 2018 17:34:22 -0800 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id 26B432C6944; Thu, 25 Jan 2018 17:34:22 -0800 (PST) From: Hyun Kwon To: , Subject: [PATCH v4 5/5] drm: xlnx: ZynqMP DP subsystem DRM KMS driver Date: Thu, 25 Jan 2018 17:34:02 -0800 Message-ID: <1516930442-10285-5-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516930442-10285-1-git-send-email-hyun.kwon@xilinx.com> References: <1516930442-10285-1-git-send-email-hyun.kwon@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23618.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.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(346002)(376002)(39380400002)(396003)(2980300002)(438002)(189003)(199004)(186003)(6266002)(2950100002)(4326008)(6666003)(36756003)(107886003)(63266004)(47776003)(110136005)(106002)(16586007)(54906003)(2906002)(336011)(42186006)(316002)(356003)(478600001)(90966002)(103686004)(76176011)(81166006)(8676002)(8936002)(81156014)(52956003)(106466001)(6346003)(26005)(48376002)(305945005)(5660300001)(50226002)(51416003)(50466002)(59450400001)(2004002)(107986001)(5001870100001)(2101003)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR02MB3391; 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; BL2NAM02FT017; 1:7UT8F3MjXliCjhVd0KJ+L/8m/CJsIPIIgnD+HiZdivLw7+AbON530oZeu7YCsRvgOV56+AOrY9zcOC6V4tqWj59CJ6ZIbzDmFv1d/ffsLzrK7Gy5Ib39fXmaFJw+HPig MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 124e0ae7-2fa7-4335-2fe8-08d5645cef41 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:MWHPR02MB3391; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3391; 3:JRejIF0V1wo4Bav8AeCQOvFxQG/hCJQd4KCHWpM1YUqwFBEf6F9NA1678tLf3ujnMWQqg3kqXVNTntjNO2OahIWbsGd6j5UVCFCAH70GXtO295cmpcSm9/lGDp9hJqa6GLmlfCJkXswr4oVmvj1Lb7nBlgeSbkD59jwKAd19DfsdW4MBL+wo4bJRlobF331YR73NQPX6DrOfd58xLbg8T6RBEp8oGK22l9f799JjB0V9bNE4z9D8WsRhdhgdL1seUTgqmlAASY4pFPlZq8l7WDw7ag4R8Tcqf1YQhKYZkTTu2MgSSg/84q4WM/d9UfrkfmDdgUZhKxvrneuTpS3sDaz3KAnmDfMKmz7Zs9Kr5pM=; 25:Aoryq9yeWYpJRGyJUjcI+g9NeXBDFsze8cLCNWgrdXPb1MGlvWAnIsdu2/gp6eZCV4kLEnY+Sz4U1RwOw0HFnuRvIS4yq9YxyXBgZ/1a8rtLKXbKaBqOZ5MZNR4qi3/lYGomex4Wx7TcNqQ2dEmTmR8NDj9/SfWn3ePhb/jRxhCajiZzJsuhFd2SedO/3VPsV6SuB9fcU/+QLTmBfCI8zKuWPPHktXs3l7anW+UR2yvqg82ik5moRSfo5IH4KziVP9rrMHG+EROLVLIeD9qgJZP4lut/wcORWyOUcR4PuvKt0tPAh/APdypCANclP8u9bNSjTFPmY4KoK5wr5/GtWg== X-MS-TrafficTypeDiagnostic: MWHPR02MB3391: X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3391; 31:CatxUkvBMvGi1N0UiTn3qI/ZzZbawU+SBCWSTb9vXUvJz2EP1wsLh2U8+G5g/UFL/s1rPjZfhTRKQ2FD+P3Q7pceYodO1j4vZ2SsQgWSNmFVnwPxBEqnfDNtSNSaAiAPbdmDDyJd9o/QOfn596HwQbYglkJ/zWUerdzv0c2TKPQmJo1ELe0BSqiWMPGjXBAq9bKgLn1Ggl9MRRy9REiwW0fk2lz2fmnbD5tsysaIRx0=; 20:AgrZjyw1vCpE674HufuYNmFJ/fdIwQ76O5JSaA2EDGSg3Ubq3TQ5yPP+AmU3c0FjQXe6pBgkb7YKpx8jMveuIxRGQfyTIdlWlLRhF3F7YsMP5QCSGMTHh5w+17CGyTZGeMddIX3cmgwq+PbGIBrBpxPMe4hH25vnN2jotugr0BDov+lF8RHfKN1kUlfo2+vLhunWNx4vrwHkPft+L2vuRH9gKAqHZ6gYxmDLRjE97Y96aSrHecdmnM/S9BJ1M1LQP5wBArd75DqwPX9mhfnyKnfgBdpDUsBh1YL2NGCgJ5RRgPrJUurcx6pmYAuNRVdBpQCbI4pA35ySwgPr5tuMBFxWaY7esgfH7w7Cqjv70RoKTHcJqrdGL8xBVeG48eEx/ZypAWV76JzaSN3t4RVcQwIIB0DCh5QEyoR6UsPI9YnbKoboTWGl9GlBwPX/9k4TodJCHCOF4pUK1qMxdcrLA5UeCXLbd1oY7kl8isGOxWXiHqd8+IJqklKD7jYtUHvx 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)(8121501046)(5005006)(3231064)(2400081)(944501161)(3002001)(93006095)(93004095)(10201501046)(6055026)(6041288)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:MWHPR02MB3391; BCL:0; PCL:0; RULEID:; SRVR:MWHPR02MB3391; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3391; 4:NZo9A2io3fvwaWCZ6q6T4buWYEgMSEun5RgEO2CFfpyhW0Rv9VwGeFtTDUpNLXjAgbTdHf4WeG7AyjLrsptcLKY1szPp5AvDZ2OkeQT6C4YpN2TqD8dv7naaq+hXYZ3ThW8c5Qnr1AenU2n4Cqx7fPHDUInLPC2U2yglmTDtBqn4LpwcUFHrKWAXp5hbGvMDVA4fOToMj4eu70w4AZdrXcXfpPmbFkLIKJmMIkrblQraMrOOLQWpJ9nxT3RbfxmGnQNqrz/P638495ke786p4xGI3u785P7halLX3d85MjeXfcIu4BSados6Ro82qkR4 X-Forefront-PRVS: 05641FD966 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR02MB3391; 23:UjluudqC6s68giE7Uth7529ocb6WZcmo5KS5LR1oK?= =?us-ascii?Q?j8KDTSUpCQQFOEuLdXdPs8laDaX8kFPnTjBhGLjpQAH5ejFqjYa9xDZBBYSd?= =?us-ascii?Q?uH7aVEPyy7LPJLugZyAzXOIbfiAMdgvF6c1ZJ/MKM/GlIC4WUi6BU7bLrz36?= =?us-ascii?Q?DBlV0VsAh3dnS7k4Buq5gN0LP6naAmaduQK8ntXYwxoTXiixZcInMheXqO5E?= =?us-ascii?Q?IspZP3CD7rUbTCSPxkrkMvf899y7cobQM7IwmE0PIKOaJMHaJ0QjAD3bdrrh?= =?us-ascii?Q?HBLDwNYlMOgKhMJ4+dZU3LQjU45iNE6oQoxBelZ6zxKMMX4UwBd/FgDZ+4Mf?= =?us-ascii?Q?8R4TVjPyMviGSS5EAD/SyVRuLJnk0u/T6ZEdyOh3BJj5+2dgOWKgnOFJJCrT?= =?us-ascii?Q?6VqwofY7YQF9YOTbMJtLTwb4CTUNf2Nt6+9nclzcyODFIVnctpNjUQTY7/XM?= =?us-ascii?Q?InczCl3iE0mQHhRB4ShmpUGWJ3Q1+7Z6eJpd5YyuTbzAyEyjw8EVbnQnDCMU?= =?us-ascii?Q?RDVX6YssEt9bT4eeTqrQM5Ss3hBK0FydUUvLPaekl2v9Y47Xgk5+DuUOPk9F?= =?us-ascii?Q?E4DptiCLWmb/yKW4GOl5fIykFgyMEP5lRpex8uDnKe53nrQjjArpqr12Vam+?= =?us-ascii?Q?wI2pDzcF5vodm/urrIkNmXbmt8EG9EaFkYcfhVrec/RxQXF7lOcsYBtXKlQE?= =?us-ascii?Q?vRRb5BAz1b4Xq3cY6JvCEP3NP+pbPNlt1gIKVIQv8jtQmcUFS7LR1SAJo77P?= =?us-ascii?Q?5twegdctLb/a5cgqEcedf2zcFjRSYMniu70d7lP9DMMeeAooQykPucd9Am8I?= =?us-ascii?Q?yL0fKfeYB1hqgWu8b9O2HOp0ePuH9IdWYlibi+xgKAV+qMHLW+RXzGcyd2UU?= =?us-ascii?Q?0rWkujR6blvzpMgusWhaRNA5u+DyAAkEyXSdgtOYNQ9bKVZpYpwsRMIBQs24?= =?us-ascii?Q?OFeZJYawu7yBYElezkoj8TdZ4ptvMoCVWfnQaEDtfBS4ES9jrgthjnA1icUi?= =?us-ascii?Q?cJT1eVFyyErFtO6CITy581Fe7Q9OYg7ZRqNlDAF1oyr2chgu9H7dW0R6YZpl?= =?us-ascii?Q?SV2o7onuy2Mr9bs/lrekX5SkjdyGUdY8Ez2oBrmWSEKHjbSQxK5EJKAbW3wc?= =?us-ascii?Q?6w749yrK0xWVtjMPzoR6kO2OfzN7RS2rR5Mg0zDgMzfZ9ebJer+bC2BrJnxf?= =?us-ascii?Q?b0yUlSEnT8UhTc=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3391; 6:45In7Gb4zfdZirU+JymFZoPi9YA4tnVXLW8qZoDorhqqSFM8o82y5p6wvk8MjcymMDBvYkPdhKmeOixRqwqMB3j/ImE1men8AtSPj+bcMFH/JFQhzD6HEj5UCLHnFdrYsHFFEG8IFK3Jc4hFK2WBrB7709mMvbvPXjU+02sZPxcy22c7OpvVVCg9zuXp9csvxss+BSD4HcHvY4hmw2eVS9U5NiIKjTddQ2ZzF//BJDwrdZPS6iVc+/ZliaRFCHA/Yb2DI/ubtrmwYEz9Jwuf7dvAiBSCgbi8O80PfslOx/x5/gIBJEC6guE3V7TR7RXt78o8aGdftYrvrfSgKUnnlQ==; 5:NFehc2FngKgf0o/+tOkxPwW8KT5udnLN80t5fFbnK0jrv8Dj8S4EMT0AX2JNuzAhex1guI73cJFvLb/Y/gJ7Q0ek5iJAwEet8uYT78Xupp0UTg8K/DsF6Xsru+3ReI8mQfx9393fB1Vq32HkxgqAn8FeyR9qiccuYrshz1MJ2bc=; 24:WqxCVxU23C+VHl1flVRT7btfc9RCTU7yEcV/oLYCrYxIi+qEufJHb7l9sf6yuAV7xcozWUfNMBbf0kRll4Ryc2WPTLfoSu14vrLhVMMp11E=; 7:QKLxy7oB4Oel1kLXt0QKQ9+ZmL01XNas/Gko+2tC5rmQmTFcg3HFcR+CYVhvgm0g21/6ZXlCmMQ6rbFcZp9s2ZQ8myRvySE92OFmJT4HxTz8+jTi/4SeyTfjuveVlDmdqgIe4IOZlW6V3FgkQfSOVdHZdcsm8+lkF9/RSuvEQwQO8bDceOB9bA9mF8eMgZ70mdu2jOxMPyf6iGco3SVrFc2tJ21hhy+xBKMCskm5T9I9z4PzYDCzhVSBxTr4nlIW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2018 01:34:23.6119 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 124e0ae7-2fa7-4335-2fe8-08d5645cef41 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: MWHPR02MB3391 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: Laurent Pinchart , Michal Simek , Hyun Kwon , Daniel Vetter 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_ */