From patchwork Wed Sep 30 15:30:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 7299391 Return-Path: X-Original-To: patchwork-linux-mediatek@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AC150BEEA4 for ; Wed, 30 Sep 2015 15:31:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A873206C5 for ; Wed, 30 Sep 2015 15:31:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 09FED20263 for ; Wed, 30 Sep 2015 15:31:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZhJLX-0000Cj-Ml; Wed, 30 Sep 2015 15:31:07 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZhJLR-0008T8-7s for linux-mediatek@lists.infradead.org; Wed, 30 Sep 2015 15:31:05 +0000 Received: from dude.hi.4.pengutronix.de ([10.1.0.7] helo=dude.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1ZhJKh-00006J-TI; Wed, 30 Sep 2015 17:30:15 +0200 From: Philipp Zabel To: dri-devel@lists.freedesktop.org Subject: [RFC v3 3/7] drm/mediatek: Add DSI sub driver Date: Wed, 30 Sep 2015 17:30:02 +0200 Message-Id: <1443627006-15319-4-git-send-email-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.5.3 In-Reply-To: <1443627006-15319-1-git-send-email-p.zabel@pengutronix.de> References: <1443627006-15319-1-git-send-email-p.zabel@pengutronix.de> X-SA-Exim-Connect-IP: 10.1.0.7 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mediatek@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150930_083101_687939_6570C7D7 X-CRM114-Status: GOOD ( 22.72 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Paul Bolle , YT Shen , Jitao Shi , Jie Qiu , Pawel Moll , Ian Campbell , Cawa Cheng , Daniel Stone , CK Hu , Rob Herring , linux-mediatek@lists.infradead.org, Daniel Vetter , Kumar Gala , Matthias Brugger , Philipp Zabel , Dave Airlie , kernel@pengutronix.de MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: CK Hu This patch add a drm encoder/connector driver for the MIPI DSI function block of the Mediatek display subsystem and a phy driver for the MIPI TX D-PHY control module. Signed-off-by: Jitao Shi Signed-off-by: Philipp Zabel --- Changes since v2: - Split DSI and MIPI TX (MIPI D-PHY) drivers - Replaced dpms/prepare/commit with enable/disable encoder helper funcs --- drivers/gpu/drm/mediatek/Makefile | 4 +- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 19 + drivers/gpu/drm/mediatek/mtk_drm_drv.h | 2 + drivers/gpu/drm/mediatek/mtk_dsi.c | 797 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_dsi.h | 54 +++ drivers/gpu/drm/mediatek/mtk_mipi_tx.c | 375 ++++++++++++++++ drivers/gpu/drm/mediatek/mtk_mipi_tx.h | 21 + 7 files changed, 1271 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/mediatek/mtk_dsi.c create mode 100644 drivers/gpu/drm/mediatek/mtk_dsi.h create mode 100644 drivers/gpu/drm/mediatek/mtk_mipi_tx.c create mode 100644 drivers/gpu/drm/mediatek/mtk_mipi_tx.h diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile index ba6d3fc..0d4aeeb 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -4,7 +4,9 @@ mediatek-drm-y := mtk_drm_drv.o \ mtk_drm_ddp_comp.o \ mtk_drm_fb.o \ mtk_drm_gem.o \ - mtk_drm_plane.o + mtk_drm_plane.o \ + mtk_dsi.o \ + mtk_mipi_tx.o obj-$(CONFIG_DRM_MEDIATEK) += mediatek-drm.o diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index b94d3c1..7b0804a 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -496,8 +496,25 @@ static int __init mtk_drm_init(void) goto drm_err; } + ret = platform_driver_register(&mtk_dsi_driver); + if (ret < 0) { + pr_err("Failed to register DSI platform driver: %d\n!", ret); + goto disp_ovl_err; + } + + ret = platform_driver_register(&mtk_mipi_tx_driver); + if (ret < 0) { + pr_err("Failed to register MIPI TX platform driver: %d\n!", + ret); + goto dsi_err; + } + return 0; +dsi_err: + platform_driver_unregister(&mtk_dsi_driver); +disp_ovl_err: + platform_driver_unregister(&mtk_disp_ovl_driver); drm_err: platform_driver_unregister(&mtk_drm_platform_driver); err: @@ -506,6 +523,8 @@ err: static void __exit mtk_drm_exit(void) { + platform_driver_unregister(&mtk_mipi_tx_driver); + platform_driver_unregister(&mtk_dsi_driver); platform_driver_unregister(&mtk_disp_ovl_driver); platform_driver_unregister(&mtk_drm_platform_driver); } diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h index 2cdf515..13f487e 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -52,5 +52,7 @@ struct mtk_drm_private { }; extern struct platform_driver mtk_disp_ovl_driver; +extern struct platform_driver mtk_dsi_driver; +extern struct platform_driver mtk_mipi_tx_driver; #endif /* MTK_DRM_DRV_H */ diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c new file mode 100644 index 0000000..39cbd92 --- /dev/null +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -0,0 +1,797 @@ +/* + * Copyright (c) 2015 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 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 +#include +#include +#include +#include +#include +#include +#include