From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ajay Kumar Subject: [PATCH V4 04/10] drm/panel: Add driver for lvds/edp based panels Date: Wed, 11 Jun 2014 23:57:02 +0530 Message-ID: <1402511228-18945-5-git-send-email-ajaykumar.rs@samsung.com> References: <1402511228-18945-1-git-send-email-ajaykumar.rs@samsung.com> Return-path: In-reply-to: <1402511228-18945-1-git-send-email-ajaykumar.rs@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org Cc: inki.dae@samsung.com, seanpaul@google.com, ajaynumb@gmail.com, robdclark@gmail.com, daniel.vetter@ffwll.ch, thierry.reding@gmail.com, joshi@samsung.com, prashanth.g@samsung.com, marcheu@chromium.org, Ajay Kumar , Rahul Sharma List-Id: devicetree@vger.kernel.org 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 | 10 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-lvds.c | 262 ++++++++++++++++++++ 4 files changed, 323 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..7cb6084 --- /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-prepare-delay = <40>; + panel-enable-delay = <20>; + panel-disable-delay = <20>; + panel-unprepare-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..8fe7ee5 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -30,4 +30,14 @@ config DRM_PANEL_S6E8AA0 select DRM_MIPI_DSI select VIDEOMODE_HELPERS +config DRM_PANEL_EDP_LVDS + tristate "support for eDP/LVDS panels" + depends on OF && DRM_PANEL + select VIDEOMODE_HELPERS + help + DRM panel driver for direct eDP panels or 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. endmenu diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 8b92921..eaafa01 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -1,3 +1,4 @@ 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_EDP_LVDS) += 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..2124fcb --- /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