From patchwork Sat Jan 13 02:03:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyun Kwon X-Patchwork-Id: 10162097 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 5E7A8600CA for ; Sat, 13 Jan 2018 02:03:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DB1728B66 for ; Sat, 13 Jan 2018 02:03:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4255D28B68; Sat, 13 Jan 2018 02:03:58 +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 B2D0028B66 for ; Sat, 13 Jan 2018 02:03:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E6606EACD; Sat, 13 Jan 2018 02:03:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0085.outbound.protection.outlook.com [104.47.33.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6E126E588 for ; Sat, 13 Jan 2018 02:03:34 +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=cq/9XAESmnlyyvUi1o90CwEfm3AV2LkXuWnewB68rCE=; b=fvk+oiKgnO+Je9FNhGDi5eNRrHDHhzGqa7qgvzMthmjQnbRGB43IezJ3pElMltwRVih55mQk3w3oFY9LxsD3XEIDoif2Bq6gNyr8nx5P+BM/58tBuWAL2IrP/kb0oiObOW7Sgq9fJTy8aCk7F95Jr5VXScwcXHgZA9qcBEnlXzc= Received: from MWHPR0201CA0012.namprd02.prod.outlook.com (10.167.160.153) by BN6PR02MB3377.namprd02.prod.outlook.com (10.161.152.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Sat, 13 Jan 2018 02:03:32 +0000 Received: from CY1NAM02FT037.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::204) by MWHPR0201CA0012.outlook.office365.com (2603:10b6:301:74::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Sat, 13 Jan 2018 02:03: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 CY1NAM02FT037.mail.protection.outlook.com (10.152.75.77) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Sat, 13 Jan 2018 02:03:31 +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 1eaBAQ-0004uD-De; Fri, 12 Jan 2018 18:03:30 -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 1eaBAQ-0001mJ-9p; Fri, 12 Jan 2018 18:03:30 -0800 Received: from xsj-pvapsmtp01 (mailhost.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w0D23Tvu003096; Fri, 12 Jan 2018 18:03:29 -0800 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eaBAP-0001ln-9b; Fri, 12 Jan 2018 18:03:29 -0800 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id 47EFF2C6910; Fri, 12 Jan 2018 18:03:29 -0800 (PST) From: Hyun Kwon To: , Subject: [PATCH v2 6/8] drm: xlnx: ZynqMP DP subsystem DRM KMS driver Date: Fri, 12 Jan 2018 18:03:26 -0800 Message-ID: <1515809008-14518-6-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515809008-14518-1-git-send-email-hyun.kwon@xilinx.com> References: <1515809008-14518-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-23590.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)(39380400002)(396003)(376002)(346002)(39860400002)(2980300002)(438002)(189003)(199004)(305945005)(2906002)(50226002)(8746002)(8936002)(6666003)(90966002)(52956003)(76176011)(51416003)(59450400001)(2950100002)(107886003)(6266002)(4326008)(5660300001)(316002)(103686004)(42186006)(5890100001)(110136005)(54906003)(478600001)(106466001)(36756003)(81156014)(8676002)(81166006)(63266004)(50466002)(48376002)(356003)(47776003)(106002)(2004002)(107986001)(217873001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR02MB3377; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1NAM02FT037; 1:kdJcNF/I0rwwqyXGYH9az6bDVhytaI1WEpjX4HFm1CQO6vgfX257MYdsERXWDxQsGHljCfLxTlMoaPl86TWBgGm9p0VFBrhpfaL/uw2sz9kSoJkBbqCnY7m93xlVauSb MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7510b870-ff54-4edc-b842-08d55a29d863 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020090)(4652020)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BN6PR02MB3377; X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB3377; 3:hFmGXaiYvfO4N8xd251wU0LOkDg9wK9k8WnZ1dJyK6pgtU9OvIaQDicb13YyOom0VfH1fCV38vwflpPqQToVNUNzgf8DK5zGk29+qFxfAPhVAkQJ9sjOOYEKpM0HYjVN9uNUVuDKiHYX4jB4i0hHy8VzzMmGBDgJ3fBkyGL6gFa+RvXqVeEvLUoyuJ2wqE0525qO5UVRhNyD1mm1OONzmcX8Wts2oNXQ0VQv5dxKzpT7EvvvQcy889o3+TxTRZ6LCMoyNVfdA4BMvWvDaPb8p2tLPxw3zj1CJD6X2L+FKV2o2vBvJmV0YaAt+YkE+KTdUxAejcaliW3pns1bjTXesWXQBFlAuNJaeqKAJzOqqrU=; 25:THi+hkC+fvsop1CUtm6xScCLXpwR2iXKUJ9beBJdvDpTOxYabbX+ajPOXY3D1MB3DlN9JGPKzhnA5yYcxGM85mYWIMJ1XhN/eLPabOZMkb/KF+xvX00bEQwPaEYyDK1JZJSRyEIKMk/TvFc9fNZ32o7FGBlh5FQ/o1yZ2J91dC83MFQ3jE5dRjWyadxUMeJBquT7N6phQ2BonX26qKama8FsSXykRpHRt8P7hJlTB5qrgL9JymvdF6vG63tRRjkC27Y4/CP9k0eVLxX+KLD00ypoegw9P4tNkZE2FwdIole+xILIjfb0zDpLa16eFiZb4iqYR+JX611o+g5y67Xq4w== X-MS-TrafficTypeDiagnostic: BN6PR02MB3377: X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB3377; 31:n9WgWvswI2i+FSzIagM8YbmO6o8DH/tQDPm+Vn7wJ7szwrfHx1TDt/TkXY5GsmDi+RydYVnR/OYMrxF0SSSUBy3jy90mZzYyo0OwCFUSY8zrEfIHOCcqs0NhceqOCIyfNeblVwXsaKzLKkHr2hje20xjtLUOkpxig6p+LezBMAkx2c5KE+tk+R2RGuip91mcGzSZzJtmUuADjJnbL/tNacozC6gk8fTlcEn4JtXSU9s=; 20:0yFxuF2DzvioiICADA9QsLfOiQb9vLYuL7MArcClzQX6NUX7BhtKHETdgw2pD7kS/h2D7wWrPgWYoaBJWuN6TROG2TBySgoazUWJXOThcBdES3zH9WdfwonNH95vxank1JL3NvrPxnOsxcP7DS7EmaTMhsVRvy4nQ6RFLGdM6ASyycWBKrugTIffvTEF3dYYE5lV5qAw4jxJvvCJsLVp4b4m6jk6h1V+zkcITAFFLJLyUBGkypC4tjKsH2qq6f0DK3mXXsHYCPv/A2kVcIN2NHZMt3oHRMevODfamGvKBAJEiuzFd0xDTopEAr4SrEasaUpUWJhkojI2Na4PDdgTfLu1Ia8i12mbbEc1lp2T+YdAXvH7cxF4VPFqQVYQd8cbLypi7rw1Ojsxno0B5xB+7VdtXRj720apg8j/iWeQvvEUdiIDUW9suMhMKQuJLCCAniKYnm5YGkreV+OcjBMDVavanvJ3owIraQ7c+zZN4/Fi9RXbTKORuK4UyJItIOwK 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:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501150)(93006095)(93004095)(10201501046)(3002001)(6055026)(6041268)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:BN6PR02MB3377; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN6PR02MB3377; X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB3377; 4:xr+w2QQ7PbHVy/2KizCz9cKRHW6wbDFxj/J3C4jiDwxKd/u3NLoGSRinVHQNh3jdH3IsAkWHKAF+IL6sS8fdsvBl0mHLOS5oPbXQloEzxWzRFiC5ZYwEC0eT9JTJ5gMi0CzzDbn0r3sz0625II7RCG+PQFryPgRV93fzMYtKaB9TS5lodmtrA4Iat73rkoeqwk8PYUWgXklXKL4p0Qjffdpl0jbnZ9PC+P2EGGP2JiGtRjYDEi3WSHaL0h8gUuB0NmoOIib1pB+c6euycMOt6K92Y3wqEHcV9rpU6r9RnHpFkpB8JMItLVusYKNHunIk X-Forefront-PRVS: 05514B7026 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR02MB3377; 23:UtKpzjJcBs3N3dnei2hmNUtsvAcla7VaEYLiUfLwX?= =?us-ascii?Q?aF2uK90eRV/883RcaxmwbFBY57LfKCbyJnFO/3BmpMzSTs7K/AHTPXyfiUWR?= =?us-ascii?Q?XtInqOaTp5mgqFtHeykGOaalzrxtZAWPK+lzOLxWbIXR9RtrNP+McwZv0sZ0?= =?us-ascii?Q?o1ZQgllOkXB/YrK0HrzmT82p/LDwJldXHMjUyrwR4T1aMw4p0idvVdf1rGHa?= =?us-ascii?Q?ZLIFtPD8xLyjcdQmvruTP0C2LcqhP9o8t4kku1+T51m/qx7mXPd29tcGsGHW?= =?us-ascii?Q?4SOM5oQ1q8M0pS5MF1MXKCENB+Ur7uDs4U7LBIAoSQ11KeVNIly3fk6rWpRN?= =?us-ascii?Q?Rtas+o7XgU09BTp2iB5B3hpfeA/tXRqlR4eRv+mISm4EoVqdxyXwHEbjxkWq?= =?us-ascii?Q?xJj0dF09qU7xLYa+PNm5VBrgdogAZL8zGJMz0cgDDCqQ49Oj2fucC0ar2grd?= =?us-ascii?Q?7Knp3QDCr+/cF/TqvWvPSctXkzMcbPYzvHT+UZIaHGdPgDA3J6FkIrfOGLI2?= =?us-ascii?Q?wrC3saQyDqLbFeywrxwc9bAhKHJ01LK3bPuZy9D5H023STBgZJEVLazcaOgE?= =?us-ascii?Q?M1ON5ADT6EIwqM7XEHsZLtdYKtSEC7/jvLJ/eO4YWEU+w933cCWawiDgnDI4?= =?us-ascii?Q?Mkd+JTbdZgk880/5uFO67CA4677g1xdFXrRuqaXZFjxrX1ptTnGPvJavKWxj?= =?us-ascii?Q?OsFAE6MIRg5bA/PVlm/h6gjR/wgbAkQf0GbJHHDMa9Hxn6F9BAiy9B6J/jf4?= =?us-ascii?Q?AsAOqVqkYVOpC/Y+HkcVd/XKX8XPqWBNnIZowp0FPEfrz4yY3ROAxfLcF8K6?= =?us-ascii?Q?MOKrzdsAzXXYgvEhPDbQuCDqFebrgNoMmOm43awiUxPeQB1ziHDjfhH6qaDN?= =?us-ascii?Q?LTXexWS2A1LqaM4XGuQ2aX27mSg2rP3fvG1cPMe8Ye7rkCy0X+nq7FMHFvJt?= =?us-ascii?Q?6wfrptKHA2MIDLZRA5Sze26yO7xbDj7uiDchs6k0J1xDRP8yT7revcfHSsRL?= =?us-ascii?Q?cXtXbH1lfLRMAN/1rYAwDYZtt8aatYGNIZrBNt8KK+AQCSUVXDt4HxRPWYqv?= =?us-ascii?Q?MHXHs0WikURvLcwfEIV1pnEszPQFfJn0rhPSJNEYUidd80PA0zl0IIRS0+I2?= =?us-ascii?Q?wMXbbB4X78=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB3377; 6:DH7zc91mJnYxr4E2Ckzc18JXdyB5RIaPXxRcMG0sx9oJ+SlUZXoxY00Bdr228C9TIjhA3M6dJ7qy6QnJSLK44uLzS3AzGkLYj/KRXl7KE4Nh6Sqsz236Z/Wp6YwwkN78MBwCO1d8MUHkynViLLyV3WNcvBhWznYQ9XcMUsvh7ptyqB6DcaIIozdHG26o4FvkX/LBKS63eGVpnqT/0Nivq5vMcp/nVVCMTLtNVM5W9zqY+833nDze5NvVSfemnL6S3O/9DY8V4gChweQZwcn/riTk2KymlAlDESmPWCKc5iwDnNt1Tke4xnQbPzGHMbya0xQ3itHdzaRmdBuyZ7yUaNPUqMtuZCywrctKS0m9A+0=; 5:9LKxGJQfp3UnKyoXx/ILS3bTr1FDyxTJYNACAeedZ9OcTy8h45iN4mNu7ocrbPrWmpJxficX0gmkV7L2F7uPYpGL1Z/YQ9G5d3d707C/EnvCyZTRkIxaxCeULsZC/aGj4zbxNNNjhIyFHoYLWNpc+90zF5xizfkQ51bvjFtBmak=; 24:uiRcLNdVgLrg/rOEZjMee9688nyo5FL2DQ+XtHu5FMIrTNCtwessSBjQzrky6THX8D0+A2KEF5bsqi8p3HJZkG32HlIHsXTL6BZHkeaQrHw=; 7:N5airgrh3FZahbr81qLMUD0QIrZElMFQonQBbLcgpILtv4qd186W+ZxeCr5KXHQZh4XmrGBEMB15XgYtAZUOgqnx60/p0wFZHFnsyRwoklLLRE6M08wuWgpbb8s2EZd9lu8y0sNPk7H5Z+1CVQSRl+rxjVbgUTNwKwvHktGlDBg+8ULRthz7pndskBP1cBo7HYmuz2VvP9npcO+EH2HdygpvrkFsasbh4wD7JwyFPVC4Addn/5fWw1w+xDp1FaP7 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2018 02:03:31.0084 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7510b870-ff54-4edc-b842-08d55a29d863 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: BN6PR02MB3377 Cc: Michal Simek , Hyun Kwon , Daniel Vetter 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 --- - Change the SPDX identifier format --- --- drivers/gpu/drm/xlnx/Kconfig | 11 +++ drivers/gpu/drm/xlnx/Makefile | 3 + drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 149 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/xlnx/zynqmp_dpsub.h | 27 +++++++ 4 files changed, 190 insertions(+) create mode 100644 drivers/gpu/drm/xlnx/zynqmp_dpsub.c create mode 100644 drivers/gpu/drm/xlnx/zynqmp_dpsub.h -- 2.7.4 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. 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..517b492 --- /dev/null +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c @@ -0,0 +1,149 @@ +// 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 "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..2c1455f --- /dev/null +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.h @@ -0,0 +1,27 @@ +// 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; +}; + +#endif /* _ZYNQMP_DPSUB_H_ */