From patchwork Thu Jun 5 19:10:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4309391 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41622BEEAA for ; Fri, 6 Jun 2014 00:33:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 09FAB2020F for ; Fri, 6 Jun 2014 00:33:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B4CE520222 for ; Fri, 6 Jun 2014 00:33:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 36AEA6E9F7; Thu, 5 Jun 2014 17:32:58 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B69E6E9BC for ; Thu, 5 Jun 2014 12:12:47 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N6P00FTWMPAFWA0@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 06 Jun 2014 04:12:46 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.124]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id E6.75.14704.D21C0935; Fri, 06 Jun 2014 04:12:46 +0900 (KST) X-AuditID: cbfee68f-b7fef6d000003970-f9-5390c12db0e3 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id DA.67.07139.D21C0935; Fri, 06 Jun 2014 04:12:45 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N6P00FLRMOSKS30@mmp2.samsung.com>; Fri, 06 Jun 2014 04:12:45 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH V3 5/8] drm/panel: Add driver for lvds/edp based panels Date: Fri, 06 Jun 2014 00:40:49 +0530 Message-id: <1401995452-15798-6-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1401995452-15798-1-git-send-email-ajaykumar.rs@samsung.com> References: <1401995452-15798-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBIsWRmVeSWpSXmKPExsWyRsSkRlfv4IRggym32C0OvD/IYrHhzUJm i4UP7zJbXPn6ns1i0v0JLBaXF15itfi+6wu7xYzz+5gsVh3ewG4xZdFhVovnC38wW8w9mGvx c9c8Fgdej73fFrB47Jx1l91jwaZSj/vdx5k8+rasYvT4vEkugC2KyyYlNSezLLVI3y6BK+ND +ymmghcxFRfmNjE3MP706WLk5JAQMJHY+ukBE4QtJnHh3nq2LkYuDiGBpYwS9273McEUrVq1 hBEiMZ1R4v/bBlYIZwKTxNpZB1lBqtgEtCW2Tb/JAmKLCLhJNB2eCVbELDCfSeLx2w9sIAlh AXeJTb+WMYLYLAKqEpMfTQdr5hXwkOh/OAdoHQfQOgWJOZNsQMKcAp4Se/dOA5spBFSybOI5 sPMkBC6xS3S19jJDzBGQ+Db5EAtEr6zEpgPMEFdLShxccYNlAqPwAkaGVYyiqQXJBcVJ6UXG esWJucWleel6yfm5mxiBsXL637P+HYx3D1gfYkwGGje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J/1b4XGtZ6E+y6+N55/ j17EfUPScc6W3Z2rjfdtfDFn+kTZsw+qj9yYU+lyVul66KU/7DlM+455yu6sPVOhcGLiCjuT ywxad87M61iT1rewWurT9iwG8cr9SizFGYmGWsxFxYkA+oBkSwgDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Thu, 05 Jun 2014 17:32:52 -0700 Cc: seanpaul@google.com, daniel.vetter@ffwll.ch, joshi@samsung.com, ajaynumb@gmail.com, prashanth.g@samsung.com, Ajay Kumar , Rahul Sharma X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 This patch adds a simple driver to handle all the LCD and LED powerup/down routines needed to support eDP/LVDS panels. The LCD and LED units are usually powered up via regulators, and almost on all boards, we will have a BACKLIGHT_EN pin to enable/ disable the backlight. Sometimes, we can have LCD_EN switches as well. The routines in this driver can be used to control panel power sequence on such boards. Signed-off-by: Ajay Kumar Signed-off-by: Rahul Sharma --- .../devicetree/bindings/panel/panel-lvds.txt | 50 ++++ drivers/gpu/drm/panel/Kconfig | 18 ++ drivers/gpu/drm/panel/Makefile | 2 + drivers/gpu/drm/panel/panel-lvds.c | 262 ++++++++++++++++++++ 4 files changed, 332 insertions(+) create mode 100644 Documentation/devicetree/bindings/panel/panel-lvds.txt create mode 100644 drivers/gpu/drm/panel/panel-lvds.c diff --git a/Documentation/devicetree/bindings/panel/panel-lvds.txt b/Documentation/devicetree/bindings/panel/panel-lvds.txt new file mode 100644 index 0000000..465016d --- /dev/null +++ b/Documentation/devicetree/bindings/panel/panel-lvds.txt @@ -0,0 +1,50 @@ +panel interface for eDP/lvds panels + +Required properties: + - compatible: "panel-lvds" + +Optional properties: + -lcd-en-gpio: + panel LCD poweron GPIO. + Indicates which GPIO needs to be powered up as output + to powerup/enable the switch to the LCD panel. + -led-en-gpio: + panel LED enable GPIO. + Indicates which GPIO needs to be powered up as output + to enable the backlight. + -panel-prepare-delay: + delay value in ms required for panel_prepare process + Delay in ms needed for the panel LCD unit to + powerup completely. + ex: delay needed till eDP panel throws HPD. + delay needed so that we cans tart reading edid. + -panel-enable-delay: + delay value in ms required for panel_enable process + Delay in ms needed for the panel backlight/LED unit + to powerup, and delay needed between video_enable and + backlight_enable. + -panel-disable-delay: + delay value in ms required for panel_disable process + Delay in ms needed for the panel backlight/LED unit + powerdown, and delay needed between backlight_disable + and video_disable. + -panel-unprepare-delay: + delay value in ms required for panel_post_disable process + Delay in ms needed for the panel LCD unit to + to powerdown completely, and the minimum delay needed + before powering it on again. + -panel-width-mm: physical panel width [mm] + -panel-height-mm: physical panel height [mm] + +Example: + + panel-lvds { + compatible = "panel-lvds"; + led-en-gpio = <&gpx3 0 1>; + panel-pre-enable-delay = <40>; + panel-enable-delay = <20>; + panel-disable-delay = <20>; + panel-post-disable-delay = <30>; + panel-width-mm = <256>; + panel-height-mm = <144>; + }; diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 4ec874d..3743947 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -30,4 +30,22 @@ config DRM_PANEL_S6E8AA0 select DRM_MIPI_DSI select VIDEOMODE_HELPERS +config DRM_PANEL_LVDS + tristate "support for LVDS panels" + depends on OF && DRM_PANEL + help + DRM panel driver for LVDS connected via DP bridges that need at most + a regulator for LCD unit, a regulator for LED unit and/or enable + GPIOs for LCD or LED units. Delay values can also be + specified to support powerup and powerdown process. + +config DRM_PANEL_EDP + tristate "support for eDP panels" + depends on OF && DRM_PANEL + help + DRM panel driver for eDP panels that need at most a + regulator for LCD unit, a regulator for LED unit and/or enable + GPIOs for LCD or LED units. Delay values can also be + specified to support powerup and powerdown process. + endmenu diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 8b92921..9c4f120 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -1,3 +1,5 @@ obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o +obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o +obj-$(CONFIG_DRM_PANEL_EDP) += panel-lvds.o diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c new file mode 100644 index 0000000..4dfb322 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -0,0 +1,262 @@ +/* + * panel driver for lvds and eDP panels + * + * Copyright (c) 2014 Samsung Electronics Co., Ltd + * + * Ajay Kumar + * + * 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. + */ + +#include +#include +#include +#include +#include +#include + +#include