Skip to contentSkip to conversation

video: backlight: add ili922x lcd driver

PATCH In review Anatolij Gustschin 2 participants 2 messages Mar 13, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 video: backlight: add ili922x lcd driver

From: Stefano Babic <[email protected]>

Add LCD driver for Ilitek ILI9221/ILI9222 controller. The driver uses SPI interface for controller access and configuration and RGB interface for graphics data transfer.

Cc Richard Purdie <[email protected]>
Cc Florian Tobias Schandinat <[email protected]>

---
Changes in v2:
- simplify licence header (remove old FSF address)
- sort include statements
- drop send_dummy() as it was a NOP
- use 'msg' for spi message vars
- fix spi xfer length in read_reg()
- use dev_dbg() instead of pr_info()
- drop not needed local variable initialisations
- replace short mdelay() with usleep_range() and longer mdelay() with msleep()
- rewise read_status() to consider spi errors and add a comment explaining the xfer length
- use 'ili922x_' prefix for register read/write and status functions
- rebased on top of linux-next tree

 drivers/video/backlight/Kconfig   |    7 +
 drivers/video/backlight/Makefile  |    1 +
 drivers/video/backlight/ili922x.c |  555 +++++++++++++++++++++++++++++++++++++
 3 files changed, 563 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/backlight/ili922x.c
drivers/video/backlight/Kconfig +7 -0
index db10d01..8613b87 100644
@@ -59,6 +59,13 @@ config LCD_LTV350QV
 
 	  The LTV350QV panel is present on all ATSTK1000 boards.
 
+config LCD_ILI922X
+	tristate "ILI Technology ILI9221/ILI9222 support"
+	depends on SPI
+	help
+	  If you have a panel based on the ILI9221/9222 controller
+	  chip then say y to include a driver for it.
+
 config LCD_ILI9320
 	tristate "ILI Technology ILI9320 controller support"
 	depends on SPI
drivers/video/backlight/Makefile +1 -0
index 96c4d62..92711fe 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_LCD_CLASS_DEVICE)		+= lcd.o
 obj-$(CONFIG_LCD_CORGI)			+= corgi_lcd.o
 obj-$(CONFIG_LCD_HP700)			+= jornada720_lcd.o
 obj-$(CONFIG_LCD_HX8357)		+= hx8357.o
+obj-$(CONFIG_LCD_ILI922X)		+= ili922x.o
 obj-$(CONFIG_LCD_ILI9320)		+= ili9320.o
 obj-$(CONFIG_LCD_L4F00242T03)		+= l4f00242t03.o
 obj-$(CONFIG_LCD_LD9040)		+= ld9040.o
drivers/video/backlight/ili922x.c new file +555 -0

555 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 9 lines · On Wed, 13 Mar 2013 13:43:37 +0100 Anatolij Gustschin <[email protected]> wrote:

From: Stefano Babic <[email protected]>

Add LCD driver for Ilitek ILI9221/ILI9222 controller. The driver uses SPI interface for controller access and configuration and RGB interface for graphics data transfer.

...

drivers/video/backlight/ili922x.c line 126

Quoted 10 lines
drivers/video/backlight/ili922x.c new file +10 -0
+#define START_BYTE(id, rs, rw)	\
+	(0x70 | (((id) & 0x01) << 2) | (((rs) & 0x01) << 1) | ((rw) & 0x01))
+#define CHECK_FREQ_REG(s, x)	\
+	do {			\
+		if (s->max_speed_hz > ILITEK_MAX_FREQ_REG)	\
+			((struct spi_transfer *)x)->speed_hz =	\
+					ILITEK_MAX_FREQ_REG;	\
+	} while (0)
+#define POWER_IS_ON(pwr)	((pwr) <= FB_BLANK_NORMAL)
+#define set_tx_byte(b)		(tx_invert ? ~(b) : b)

All of the above could have been implemented as regular old C functions, and would be better if they were!

It otherwise all looks nice.