From patchwork Mon Mar 26 08:46:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 7459 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 10E0623E40 for ; Mon, 26 Mar 2012 08:44:19 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id B2FF1A18816 for ; Mon, 26 Mar 2012 08:44:18 +0000 (UTC) Received: by iage36 with SMTP id e36so10523620iag.11 for ; Mon, 26 Mar 2012 01:44:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:x-tm-as-mml:x-gm-message-state; bh=ZTNVXvlSrLoWHZ+w7u/AI8v66rJ/JiDgJeI4mal1jXE=; b=VkSG4UoWpUAOzbxUVq4/pGNXF8KxUNUuwFuMsTTw8Otr4NAr3iy19T3C7EHS1eQAqX mbHiUMftCN0xCsrAXeRsaPcuJSyf0IKyYBM2GPLG2wlG8ZYotMJ8jj6ynOMpeAR9N+Fb m5kQuk5CmF9YaLRLckmlxWwLWeTAd5mvPCFHGLq+4rMd154z/lY82hnkwxY5dqO/r0xw Vxx+HQBBAt80C89tnaQXxDs225vYmjDj7/Gnjndj3TaOh7HnoVKmcTndtDlcPzZp8L32 GAC0rDeoQrhgGlKWlTT/6Bij7IQV/jBWdeHGBPpCSpdCDl0pZQ58hzBsYtKvmKavY498 0Q7g== Received: by 10.50.45.234 with SMTP id q10mr4989065igm.54.1332751458136; Mon, 26 Mar 2012 01:44:18 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.5.205 with SMTP id 13csp13013ibw; Mon, 26 Mar 2012 01:44:17 -0700 (PDT) Received: by 10.68.136.10 with SMTP id pw10mr51612702pbb.134.1332751456355; Mon, 26 Mar 2012 01:44:16 -0700 (PDT) Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by mx.google.com with ESMTP id o5si17731385pbd.148.2012.03.26.01.44.15; Mon, 26 Mar 2012 01:44:16 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.33 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.33; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.33 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm2.samsung.com (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0M1H00EUJHLL9QJ0@mailout3.samsung.com> for patches@linaro.org; Mon, 26 Mar 2012 17:44:09 +0900 (KST) X-AuditID: cbfee61b-b7baeae000004fa7-cf-4f702c58b351 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id 5C.7F.20391.85C207F4; Mon, 26 Mar 2012 17:44:08 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp1.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTPA id <0M1H00GF1HHE1S40@mmp1.samsung.com> for patches@linaro.org; Mon, 26 Mar 2012 17:44:08 +0900 (KST) From: Thomas Abraham To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: rpurdie@rpsys.net, florianSchandinat@gmx.de, devicetree-discuss@lists.ozlabs.org, linux-fbdev@vger.kernel.org, linux-samsung-soc@vger.kernel.org, grant.likely@secretlab.ca, rob.herring@calxeda.com, kgene.kim@samsung.com, jg1.han@samsung.com, broonie@opensource.wolfsonmicro.com, kyungmin.park@samsung.com, augulis.darius@gmail.com, ben-linux@fluff.org, lars@metafoo.de, patches@linaro.org Subject: [PATCH v3 1/2] backlight: lcd: add driver for raster-type lcd's with gpio controlled panel reset Date: Mon, 26 Mar 2012 14:16:39 +0530 Message-id: <1332751600-11371-2-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1332751600-11371-1-git-send-email-thomas.abraham@linaro.org> References: <1332751600-11371-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: AAAAAA== X-TM-AS-MML: No X-Gm-Message-State: ALoCoQn2tAKjs6kwaGDuK5zC677FOjLm2ol+meQ4a8XhtmTymqmNoaJUAquQZtUF9xN/gdXvGAws Add a lcd panel driver for simple raster-type lcd's which uses a gpio controlled panel reset. The driver controls the nRESET line of the panel using a gpio connected from the host system. The Vcc supply to the panel is (optionally) controlled using a voltage regulator. This driver excludes support for lcd panels that use a serial command interface or direct memory mapped IO interface. Suggested-by: Lars-Peter Clausen Signed-off-by: Thomas Abraham --- .../devicetree/bindings/lcd/lcd-pwrctrl.txt | 36 +++ drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/lcd_pwrctrl.c | 226 ++++++++++++++++++++ include/video/lcd_pwrctrl.h | 24 ++ 5 files changed, 294 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/lcd/lcd-pwrctrl.txt create mode 100644 drivers/video/backlight/lcd_pwrctrl.c create mode 100644 include/video/lcd_pwrctrl.h diff --git a/Documentation/devicetree/bindings/lcd/lcd-pwrctrl.txt b/Documentation/devicetree/bindings/lcd/lcd-pwrctrl.txt new file mode 100644 index 0000000..22604a2 --- /dev/null +++ b/Documentation/devicetree/bindings/lcd/lcd-pwrctrl.txt @@ -0,0 +1,36 @@ +* Power controller for simple lcd panels + +Some LCD panels provide a simple control interface for the host system. The +control mechanism would include a nRESET line connected to a gpio of the host +system and a Vcc supply line which the host can optionally be controlled using +a voltage regulator. Such simple panels do not support serial command +interface (such as i2c or spi) or memory-mapped-io interface. + +Required properties: +- compatible: should be 'lcd-powercontrol' + +- lcd-reset-gpio: The GPIO number of the host system used to control the + nRESET line. The format of the gpio specifier depends on the gpio controller + of the host system. + +Optional properties: +- lcd-reset-active-high: When the nRESET line is asserted low, the lcd panel + is reset and stays in reset mode as long as the nRESET line is asserted low. + This is the default behaviour of most lcd panels. If a lcd panel requires the + nRESET line to be asserted high for panel reset, then this property is used. + Note: Some platforms might allow inverting the polarity of the gpio output + in the 'lcd-reset-gpio' gpio specifier. On such platforms, if the polarity + is used to control the output of the gpio, then this property should not be + used. + +- vcc-lcd-supply: phandle of the regulator that controls the vcc supply to + the lcd panel. + +Example: + + lcd_pwrctrl { + compatible = "lcd-powercontrol"; + lcd-reset-gpio = <&gpe0 4 1 0 0>; + lcd-reset-active-high; + lcd-vcc-supply = <®ulator7>; + }; diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 681b369..9b52ea8 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -86,6 +86,13 @@ config LCD_PLATFORM This driver provides a platform-device registered LCD power control interface. +config LCD_PWRCTRL + tristate "LCD panel power control" + help + Say y here, if you have a lcd panel that allows reset and vcc to be + controlled by the host system, and which does not use a serial command + interface (such as i2c or spi) or memory-mapped-io interface. + config LCD_TOSA tristate "Sharp SL-6000 LCD Driver" depends on SPI && MACH_TOSA diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index af5cf65..d85c8d2 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_LCD_LMS283GF05) += lms283gf05.o obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o obj-$(CONFIG_LCD_ILI9320) += ili9320.o obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o +obj-$(CONFIG_LCD_PWRCTRL) += lcd_pwrctrl.o obj-$(CONFIG_LCD_VGG2432A4) += vgg2432a4.o obj-$(CONFIG_LCD_TDO24M) += tdo24m.o obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o diff --git a/drivers/video/backlight/lcd_pwrctrl.c b/drivers/video/backlight/lcd_pwrctrl.c new file mode 100644 index 0000000..917d842 --- /dev/null +++ b/drivers/video/backlight/lcd_pwrctrl.c @@ -0,0 +1,226 @@ +/* + * Simple lcd panel power control driver. + * + * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. + * Copyright (c) 2011-2012 Linaro Ltd. + * + * This driver is for controlling power for raster type lcd panels that requires + * its nRESET interface line to be connected and controlled by a GPIO of the + * host system and the Vcc line controlled by a voltage regulator. This + * excludes support for lcd panels that use a serial command interface or direct + * memory mapped IO interface. + * + * The nRESET interface line of the panel should be connected to a gpio of the + * host system. The Vcc pin is controlled using a external volatage regulator. + * Panel backlight is not controlled by this driver. + * + * This driver is derived from platform-lcd.c which was written by + * Ben Dooks + * + * 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 +#include +#include