Re: [PATCH v3] backlight: otm3225a: add support for ORISE OTM3225A LCD SoC

2018-04-16 Thread Lee Jones
On Sun, 08 Apr 2018, Felix Brack wrote:

> This patch adds a LCD driver supporting the OTM3225A LCD SoC
> from ORISE Technology. This device can drive TFT LC panels having a
> resolution of 240x320 pixels. After initializing the OTM3225A using
> it's SPI interface it switches to use 16-bib RGB as external
> display interface.
> 
> Signed-off-by: Felix Brack 
> Acked-by: Daniel Thompson 
> 
> Changes in v3:
> - fix a type in a comment
> - don't make useless calls to msleep() by callig it with delay 0
> - add Daniel Thompson's Acked-by
> 
> Changes in v2:
> - use descriptive names for registers instead of hard coding them
> - remove unnecessary registers in initialization sequence
> - make use of resource-managed functions like devm_kzalloc()
>   instead of kzalloc() which simplifies and shortens the code
> - replace mdelay() by msleep()
> - use module_spi_init() since we do not do anything special
>   in init/exit
> - use dev_name() instead of hard coding driver name multiple times
> - use static storage class for structure otm3225a_ops
> - sort include files alphabetically
> - use standardized licensing header
> - modify Makefile respecting alphabetical sort order
> ---
>  drivers/video/backlight/Kconfig|   7 ++
>  drivers/video/backlight/Makefile   |   1 +
>  drivers/video/backlight/otm3225a.c | 252 
> +
>  3 files changed, 260 insertions(+)
>  create mode 100644 drivers/video/backlight/otm3225a.c

Applied, thanks.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


[PATCH v3] backlight: otm3225a: add support for ORISE OTM3225A LCD SoC

2018-04-08 Thread Felix Brack
This patch adds a LCD driver supporting the OTM3225A LCD SoC
from ORISE Technology. This device can drive TFT LC panels having a
resolution of 240x320 pixels. After initializing the OTM3225A using
it's SPI interface it switches to use 16-bib RGB as external
display interface.

Signed-off-by: Felix Brack 
Acked-by: Daniel Thompson 

Changes in v3:
- fix a type in a comment
- don't make useless calls to msleep() by callig it with delay 0
- add Daniel Thompson's Acked-by

Changes in v2:
- use descriptive names for registers instead of hard coding them
- remove unnecessary registers in initialization sequence
- make use of resource-managed functions like devm_kzalloc()
  instead of kzalloc() which simplifies and shortens the code
- replace mdelay() by msleep()
- use module_spi_init() since we do not do anything special
  in init/exit
- use dev_name() instead of hard coding driver name multiple times
- use static storage class for structure otm3225a_ops
- sort include files alphabetically
- use standardized licensing header
- modify Makefile respecting alphabetical sort order
---
 drivers/video/backlight/Kconfig|   7 ++
 drivers/video/backlight/Makefile   |   1 +
 drivers/video/backlight/otm3225a.c | 252 +
 3 files changed, 260 insertions(+)
 create mode 100644 drivers/video/backlight/otm3225a.c

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 4e1d2ad..06e187b 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -150,6 +150,13 @@ config LCD_HX8357
  If you have a HX-8357 LCD panel, say Y to enable its LCD control
  driver.
 
+  config LCD_OTM3225A
+   tristate "ORISE Technology OTM3225A support"
+   depends on SPI
+   help
+ If you have a panel based on the OTM3225A controller
+ chip then say y to include a driver for it.
+
 endif # LCD_CLASS_DEVICE
 
 #
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 8905129..2473377 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_LCD_LD9040)  += ld9040.o
 obj-$(CONFIG_LCD_LMS283GF05)   += lms283gf05.o
 obj-$(CONFIG_LCD_LMS501KF03)   += lms501kf03.o
 obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o
+obj-$(CONFIG_LCD_OTM3225A) += otm3225a.o
 obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o
 obj-$(CONFIG_LCD_S6E63M0)  += s6e63m0.o
 obj-$(CONFIG_LCD_TDO24M)   += tdo24m.o
diff --git a/drivers/video/backlight/otm3225a.c 
b/drivers/video/backlight/otm3225a.c
new file mode 100644
index 000..2472e21
--- /dev/null
+++ b/drivers/video/backlight/otm3225a.c
@@ -0,0 +1,252 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Driver for ORISE Technology OTM3225A SOC for TFT LCD
+ * Copyright (C) 2017, EETS GmbH, Felix Brack 
+ *
+ * This driver implements a lcd device for the ORISE OTM3225A display
+ * controller. The control interface to the display is SPI and the display's
+ * memory is updated over the 16-bit RGB interface.
+ * The main source of information for writing this driver was provided by the
+ * OTM3225A datasheet from ORISE Technology. Some information arise from the
+ * ILI9328 datasheet from ILITEK as well as from the datasheets and sample code
+ * provided by Crystalfontz America Inc. who sells the CFAF240320A-032T, a 3.2"
+ * TFT LC display using the OTM3225A controller.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define OTM3225A_INDEX_REG 0x70
+#define OTM3225A_DATA_REG  0x72
+
+/* instruction register list */
+#define DRIVER_OUTPUT_CTRL_1   0x01
+#define DRIVER_WAVEFORM_CTRL   0x02
+#define ENTRY_MODE 0x03
+#define SCALING_CTRL   0x04
+#define DISPLAY_CTRL_1 0x07
+#define DISPLAY_CTRL_2 0x08
+#define DISPLAY_CTRL_3 0x09
+#define FRAME_CYCLE_CTRL   0x0A
+#define EXT_DISP_IFACE_CTRL_1  0x0C
+#define FRAME_MAKER_POS0x0D
+#define EXT_DISP_IFACE_CTRL_2  0x0F
+#define POWER_CTRL_1   0x10
+#define POWER_CTRL_2   0x11
+#define POWER_CTRL_3   0x12
+#define POWER_CTRL_4   0x13
+#define GRAM_ADDR_HORIZ_SET0x20
+#define GRAM_ADDR_VERT_SET 0x21
+#define GRAM_READ_WRITE0x22
+#define POWER_CTRL_7   0x29
+#define FRAME_RATE_CTRL0x2B
+#define GAMMA_CTRL_1   0x30
+#define GAMMA_CTRL_2   0x31
+#define GAMMA_CTRL_3   0x32
+#define GAMMA_CTRL_4   0x35
+#define GAMMA_CTRL_5   0x36
+#define GAMMA_CTRL_6   0x37
+#define GAMMA_CTRL_7   0x38
+#define GAMMA_CTRL_8   0x39
+#define GAMMA_CTRL_9   0x3C
+#define GAMMA_CTRL_10  0x3D
+#define WINDOW_HORIZ_RAM_START 0x50
+#define WINDOW_HORIZ_RAM_END   0x51
+#define WINDOW_VERT_RAM_START  0x52
+#define WINDOW_VERT_RAM_END0x53
+#define DRIVER_OUTPUT_CTRL_2   0x60
+#