From mboxrd@z Thu Jan 1 00:00:00 1970 From: thomas.abraham@linaro.org (Thomas Abraham) Date: Thu, 05 Jan 2012 21:12:26 +0530 Subject: [PATCH] backlight: lcd: add driver for raster-type lcd's with gpio controlled panel reset Message-ID: <1325778146-27056-1-git-send-email-thomas.abraham@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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 | 39 ++++ drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/lcd_pwrctrl.c | 231 ++++++++++++++++++++ include/video/lcd_pwrctrl.h | 30 +++ 5 files changed, 308 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..941e2ff --- /dev/null +++ b/Documentation/devicetree/bindings/lcd/lcd-pwrctrl.txt @@ -0,0 +1,39 @@ +* 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,powerctrl' +- gpios: 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,pwrctrl-nreset-gpio-invert: 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. +- lcd,pwrctrl-min-uV: If a regulator controls the Vcc voltage of the lcd panel, + this property specifies the minimum voltage the regulator should supply. + The value of this property should in in micro-volts. +- lcd,pwrctrl-max-uV: If a regulator controls the Vcc voltage of the lcd panel, + this property specifies the maximum voltage the regulator should limit to + on the Vcc line. The value of this property should in in micro-volts. +- vcc-lcd-supply: phandle of the regulator that controls the vcc supply to + the lcd panel. + +Example: + + lcd_pwrctrl { + compatible = "lcd,powerctrl"; + gpios = <&gpe0 4 1 0 0>; + lcd,pwrctrl-nreset-gpio-invert; + lcd,pwrctrl-min-uV = <2500000>; + lcd,pwrctrl-max-uV = <3300000>; + lcd-vcc-supply - <®ulator7>; + }; diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 278aeaa..fc1dc17 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 fdd1fc4..944482e 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..6f3110b --- /dev/null +++ b/drivers/video/backlight/lcd_pwrctrl.c @@ -0,0 +1,231 @@ +/* + * 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