From patchwork Sun Jul 8 02:05:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyun Kwon X-Patchwork-Id: 10512995 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 D29BE600CA for ; Sun, 8 Jul 2018 02:07:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6559289CB for ; Sun, 8 Jul 2018 02:07:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9CC9289CD; Sun, 8 Jul 2018 02:07:40 +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.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 2DB1C289CB for ; Sun, 8 Jul 2018 02:07:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9164C6E068; Sun, 8 Jul 2018 02:07:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0075.outbound.protection.outlook.com [104.47.32.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA4736E35B for ; Sun, 8 Jul 2018 02:07:33 +0000 (UTC) Received: from SN4PR0201CA0007.namprd02.prod.outlook.com (2603:10b6:803:2b::17) by BYAPR02MB4325.namprd02.prod.outlook.com (2603:10b6:a03:56::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.19; Sun, 8 Jul 2018 02:07:31 +0000 Received: from SN1NAM02FT040.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::207) by SN4PR0201CA0007.outlook.office365.com (2603:10b6:803:2b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.930.20 via Frontend Transport; Sun, 8 Jul 2018 02:07:30 +0000 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 SN1NAM02FT040.mail.protection.outlook.com (10.152.72.195) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.906.15 via Frontend Transport; Sun, 8 Jul 2018 02:07:30 +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 1fbz6n-00085i-Ru; Sat, 07 Jul 2018 19:07:29 -0700 Received: from [127.0.0.1] (helo=xsj-smtp-dlp1.xlnx.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1fbz6i-0003VX-NK; Sat, 07 Jul 2018 19:07:24 -0700 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 w6827NWl021837; Sat, 7 Jul 2018 19:07:24 -0700 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1fbz6h-0003VN-RW; Sat, 07 Jul 2018 19:07:23 -0700 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id 6FE6E2C73CE; Sat, 7 Jul 2018 19:05:40 -0700 (PDT) From: Hyun Kwon To: , , Laurent Pinchart Subject: [PATCH v8 5/5] drm: xlnx: ZynqMP DP subsystem DRM KMS driver Date: Sat, 7 Jul 2018 19:05:38 -0700 Message-ID: <1531015538-32268-6-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531015538-32268-1-git-send-email-hyun.kwon@xilinx.com> References: <1531015538-32268-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)(39850400004)(136003)(376002)(396003)(2980300002)(438002)(199004)(189003)(36756003)(6266002)(8936002)(81166006)(478600001)(8676002)(81156014)(76176011)(50226002)(103686004)(51416003)(90966002)(14444005)(356003)(305945005)(50466002)(4326008)(52956003)(426003)(47776003)(63266004)(2906002)(48376002)(110136005)(54906003)(5660300001)(26005)(336012)(186003)(42186006)(44832011)(476003)(106002)(316002)(2616005)(126002)(486006)(446003)(11346002)(16586007)(107886003)(106466001)(107986001)(217873001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR02MB4325; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-83.xilinx.com; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT040; 1:64gwZdZCTaHPHPK/nLebXRQW6PYzCSlOrdiLsSLJdMud5/guTS0juMau5yKRGXaTMVjG9LADLdKOl9HZXFYtsFCXjZRAEqaGlYdNgXd+xyeP2bXc0vg48ZH+LWovhSHG MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ddd7df56-73a4-499c-3391-08d5e4778fad X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060); SRVR:BYAPR02MB4325; X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4325; 3:n5gj3LsqQhSHy5o5iWNxgLmAIgdRhiEltXZ76IB5C/o9i6p6GwlzkAuAzDL0bRb1aiA6QAtBJcd124ZjysfIg/yg889zwdDUJDgPiYIJ7aL9jTv5tOhUkbGNveghjF0EfvkEVMd1OfYkqo09YbhzKZwio50YoekHyPO4jqb/lWFgNgr8LnhLYdje9engNyTVInn1qHjVgeeL+gyU+04McnM4cTPjK7qssI5HIAWEk0/dV12GKRnUxLkSt3+mslYz0s1stXNlWxQ1ZNwoB8a4OvXY7yqxAh5g866wr2LC+huk2nxm04J4weuTfeVZfjezAYx0hBEiqUWKoSs2Za2CwHwzdmcMFLJsETh1wbG9urE=; 25:B39AvrpnoI3W2Hu8DHAoQlkxQ2Tp55/vDV4wiP8B8syaTBcXolC6oh0fiRKICLWnWXvAdjS7Sx+Eb+1XBJZO5RNeIOpxcJukYLfBuNhF0rmCFlN/au+Il/AdgojLQOYLR8zMo8jgT3XVyiJGczGB6CXOfwl5ZtkjaFNkGVNQ/z4SU4A3ARje653LR0u9qTJIMuEft//dMGdQtbGJpH2OGlHxHxs+mMrgBzkPy7v6DmRGtjwjnRmUho/HnoWaT1qS9a7uu74sQdW0iKny/88bWHnOg/pckHwFzQi/YFuxII8XGP/YJUTUD6iQGbowtwstgb2YQgzgaJ+uGlEKicOhXA== X-MS-TrafficTypeDiagnostic: BYAPR02MB4325: X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4325; 31:Yxyg+gAGIdNqL3XRT8Eow28fUUYDqG5DqbFnnF7ayF1jAs+lk+C7CMm9XIcUlWPkFjZ+rQF6vGuKPWHOs30d0fQOx0F85z/sPA8oQHOHzMKNWbCQcqxW6DtR10KIkUWqpvdtanpxCo35bzSU6ahRTUg/KiZeTrzo9hZ3PvOpO1OT9uGMJ6IdZHI7tbQh1p8zC9jS//Gy5n+iH4x5twaFPL1KlFO6rzW+mcB/wpUOs6g=; 20:wAla8ROWCN/m38Tr1v2BgC8zkYz711/uUegsj4optqxyZOX7egwbWCa5KP4WB+97sjdgvPu3TxqCPg6Ch7q7/s/+GCUTdNK7NHzrLbM8Rb+YUGx+BlRDlWfJjVvbjnv6xAv7thALOnWEz2GKyTPc/GU6IEEVTuKND3frKU39VdlsY0GntSBeshbpgTlnW5BTBkNgyqTkY4Tv4/JV4BRs3YgKVJCjmZf2NanHRGCx1NurvvUeOMrZ6NxGKDKel4uT5SCCjZR07rxoPD93Cq8Qofrpk7iEOsa6T6RRtAMRAqw5S5h/Oc3yxSI082mTpN9Pj6pJFT+tsDRk2v7KsLiEHzcW7jQDwMsXI3nrmz+6r84cP7IKxSqV8Z1FDabVEEUbV9l1feJrdHPQR4t9YUVy+zBryMNYo+jrHSQfwCkiueCvJz1YSyiXa5Zw6R2zPQu2434N8Yzh+5lIP8KaXYxtgxAa3kpLTZyW7VQZLz+FarjqwLTHs3KcYc3wYaVnIuEY X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231311)(944501410)(52105095)(3002001)(93006095)(93004095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:BYAPR02MB4325; BCL:0; PCL:0; RULEID:; SRVR:BYAPR02MB4325; X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4325; 4:jYIw8Dd9EZoDA/z42XoS0A0gBNljZ1sTvDNC2yOH0PZzsOlXSFBkThR4cIMkfvhpfPPecgQVvO5tbpB9ErHrj/pNPfsmQ8zzpvH0dukExAylshkO+AYpfyGQDZMvZQ+PT+rZFu5vI7odSK9R3EhyOXGqCDEgOY66noT9pp5O6JGv00d1bdBAvDEzr0ICE84ayswvBSCpLbg9nmqNEN+5de+p/amH6ghNrB9sElIilXJtpqAXpN8QTXceujnbvSTyztb1f95jzMSEOlPcFwzqsX9y1Tf/7lufk6SXDq3HVdbYK7CUJlkjoRlQBtaPYSeD X-Forefront-PRVS: 0727122FC6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BYAPR02MB4325; 23:mkpa5bxOv1jeh7M8ny+p7S3tQ4INia8OlaNmTSnBm?= =?us-ascii?Q?+xCWiffrjbOATcIFZ2AX8zg3Rl+9j5KcGYi3WbZKd1P4UsfTptHdiC/CZLTH?= =?us-ascii?Q?21uaw/sY6+BGuLhnFuU7FE9U9ii6ah/n25gbOwzGKLv5iR5Id4pj6nmsBTJ+?= =?us-ascii?Q?7llvb2k1E3VUsrVWMhJkYPGxdkQya3z+KpzrAvmN+MoG4uPol26cQUMaEyVd?= =?us-ascii?Q?JSb9OmuyehKmbfDOgf0M3+6eLmA6GkEoBvcxG7eSrXAv2j3ge471lfzuQHTa?= =?us-ascii?Q?Xh/KxlpQPMFLkayKxSlVez0TI4I13OaBVVyLvLebjdIT4hD/+b/T24Z2GZVi?= =?us-ascii?Q?1NtB5C9I/EdpJEYFM8nawc7hMZq210EmZtwJjgbRsemYGS0wxLrJfkCi5r1Y?= =?us-ascii?Q?asnUq+BTAbJ7cD5AXFAjf6o+byQ+GydqFr8Me3STDDcSUYdtIYirV5D0VtbY?= =?us-ascii?Q?UZqITA9jPOxhHUcSZuKXKfglNPOWSP3oBd8RnbAnFiDzQcBlN4hmkU5jXG1o?= =?us-ascii?Q?WIqsywGSplzQ5QLbMtvs/8s6XYATnk0akTcsKfOkwr8yWdF4jJvfDgmtcVay?= =?us-ascii?Q?QUjy4cYit4j6WAeb3LDniGngQrEDNcrDPZrT976zZ3QpFP1rj3opo0n86Wf8?= =?us-ascii?Q?4lnF1+73/lC6fFa9zvxKyBZ/7VmLWfb4RVc19gqnzHDhveK7mfQIscO2a4KK?= =?us-ascii?Q?OTaPBLKdrDRLtI/837yWzCyJQGOQzjCVyUSmbSuIxgdMxan/sbUQURB67YIb?= =?us-ascii?Q?L1eMN+sambcEVhYe9F3/VxXlB5SSmWDxpbllaMuuYdIMcyxgu88l5KwkCe9G?= =?us-ascii?Q?5O7VTUdCu3SpNwYrmvEEpDA1F9EK7lAa5pBB7wz8qoIWXoTGdAjCayVfY6sI?= =?us-ascii?Q?Lf18U1ysE+L2t+icJZF81dkK7ui3pbS6InXgA0lqs1jnZY/UKOR3qOwDHb2N?= =?us-ascii?Q?K2JuNGLuMhH+Y95x27wKW260VMbkD5YhQe8XX+c2YGD4NXIHw2hP+xo+r/gq?= =?us-ascii?Q?Nv6bcJmopN9U0JFhvFy8ND0hHGuMA58plTF3eYNXLjCEuE7yYvu51uo3yPG5?= =?us-ascii?Q?vhtGCN6uQNWsp0kwLgZk9eFpotpksufrlw8g/e2+n0E5rh+J7XwnXhAtRWEe?= =?us-ascii?Q?Galb777qvK5w03sK7ism8enMrPToa9MLzqojS9b4jaKqLG/kpvdVsTqbYElm?= =?us-ascii?Q?6ZXLqtv2dg5ezo=3D?= X-Microsoft-Antispam-Message-Info: xZC8/95knTRsNcGc47qu0c+fmqrZZuYxCqYRW2QC2uaaurg8umNa8oneFcBM1wTzNFD1Ll36X5yuZbSmhKQvLiH6LyL5cbJJ7guLOzdBZVLA6owCIR3R4WuCCt07Di8SjJnFqNAwvqucNFMTMjQ5kE2T9Q4G+WtVym6+4ZVoHee3uoQ323a8mlUJ3vB3ji3Pe1RW/uzWxWXpMFgdHV3jHF06tmrTzsO7UxQRc04gnMvRLFsHoB8zrPYtbQhWLffDiIFbT+4zjlD/5obpcsuyGzP4jhHVdShk7K8o9SV9pS4/SAyfcklshmH4jqkJ3gOXasT/lgqZ0yqeEV23C7vd7e8Ds0aMRmONCgnYlsZITHY= X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4325; 6:EAun3E5qfS6l+8uOEgH3de6kJSqyfa7Ush1j9s7xL03zPKc1v2C3PZQ+9xuxmEfQd9pxE7xMmnQXMPzkrUC+Et+xH7RZLE58fZbPfImEbboXzI6cwbPDD1e2EgENgGSyHE2jq3iFYjUeeCZcNvtBLGGcvAAA9HnZOGL6BbhtQfBVPREmEy6MZ+CDmJgA3jrVkReE6umco1BMBQ1jMnIOGE0070I38S2TLDK6OqpUT3nwUHYKKwfMZ7oXWhZuEoamutiNrboZRG6J8J6UFfOT5TiVqURPAgnG20PQatAFhtRSKBrz25S7GTaYyo7b92omnm5wdaFc+AgGz/Q3gpr/aPfUYZ6TXqu+oJenbyowqsCa9GtDGHcr+GCWZNKUoU8LryTxcuiK8f8KaCjPLK6vr3B5G+7+zu+lLHPjV9NagpOlfQLop5a1cCiYilSiOYJ84bHNn9a3AAlaLUvfpmhx5Q==; 5:lGLZmYE1cGuf6t85iAPFzFJZWHBJXqyTh5bPsAE62FjITHP7z5fbX60b3X4Pdy9dwMRiHur5QUGhdcvaKm7usKav3UThENCDiRZ+O5eHkSQhiIrnu1ydCfFeeS64YWf28EEXNBh2IsoKoc67qBya+yuGYjCUAHyHHYTnBI4n4Qg=; 24:T92LXwOLZCw8yB5dRUJpTxA8euZqpWZwRraNT+WBadCuXPmlJE7kKPQ+2rhJR8uwWcDhBrTvUR5zd9OEe3d866w8RLNkcNbgUCGLc56TuKM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4325; 7:14P6PKKayU9zRqNzKLNazJ6FA+OG9vneplDbYw3LqFs1mK8pqHkzNwZZyJdAAGYGFjDhWPw9HzkPGEs8H5CWoR78LGL/YZvWihGIdkOTybIb2UbRYRgOYOLzqrCSnnUi2RukGIjyoOwR4TXOEJAHKf/Q+OUMWT2D+pW7k658WAmdk+6L0apZ40NZtL/3p5Vx1fx/pliEJ1/LujOlkOOf6VQYqzm3FtqOVU0UPdCumxFTEyz6ShdSHEg+e6KbFmow X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2018 02:07:30.2558 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ddd7df56-73a4-499c-3391-08d5e4778fad 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: BYAPR02MB4325 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 --- v8 - Support reserved memory through memory-region dt binding 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 | 158 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/xlnx/zynqmp_dpsub.h | 23 ++++++ 4 files changed, 195 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..34e81d0 --- /dev/null +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c @@ -0,0 +1,158 @@ +// 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 + +#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; + + /* Try the reserved memory. Proceed if there's none */ + of_reserved_mem_device_init(&pdev->dev); + + /* 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_rmem; + } + + 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_rmem: + of_reserved_mem_device_release(&pdev->dev); + 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); + of_reserved_mem_device_release(&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_ */