video: backlight: support s6e8ax0 panel driver based on MIPI DSI
Subsystems (2)
PATCH v5 2/2 video: backlight: support s6e8ax0 panel driver based on MIPI DSI
This patch is amoled panel driver based MIPI DSI interface. S6E8AX0 means it may includes many other ldi controllers, for example, S6E8AA0, S6E8AB0, and so on.
This patch can be modified depending on each panel properites. For example, second parameter of panel condition register can be changed depending on ldi controller or amoled type.
--- drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/s6e8ax0.c | 898 +++++++++++++++++++++++++++++++++++++ drivers/video/backlight/s6e8ax0.h | 26 ++ 4 files changed, 932 insertions(+), 0 deletions(-) create mode 100644 drivers/video/backlight/s6e8ax0.c create mode 100644 drivers/video/backlight/s6e8ax0.h
drivers/video/backlight/Kconfig +7 -0
@@ -125,6 +125,13 @@ config LCD_AMS369FG06 If you have an AMS369FG06 AMOLED Panel, say Y to enable its LCD control driver. +config LCD_S6E8AX0 + tristate "S6E8AX0 MIPI AMOLED LCD Driver" + depends on S5P_MIPI_DSI && BACKLIGHT_CLASS_DEVICE + default n + help + If you have an S6E8AX0 MIPI AMOLED LCD Panel, say Y to enable its + LCD control driver. endif # LCD_CLASS_DEVICE #
drivers/video/backlight/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o obj-$(CONFIG_LCD_S6E63M0) += s6e63m0.o obj-$(CONFIG_LCD_LD9040) += ld9040.o obj-$(CONFIG_LCD_AMS369FG06) += ams369fg06.o +obj-$(CONFIG_LCD_S6E8AX0) += s6e8ax0.o obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o
drivers/video/backlight/s6e8ax0.c new file +898 -0
898 lines not on this page · raw message
drivers/video/backlight/s6e8ax0.h new file +26 -0
@@ -0,0 +1,26 @@ +/* linux/drivers/video/backlight/s6e8ax0.h +* +* MIPI-DSI based s6e8ax0 AMOLED LCD Panel definitions. +* +* Copyright (c) 2011 Samsung Electronics +* +* Inki Dae, <[email protected]> +* Donghwa Lee <[email protected]> +* +* 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. +*/ + +#ifndef _S6E8AX0_H +#define _S6E8AX0_H + +extern void s6e8ax0_init (void ); +extern void s6e8ax0_set_link (void *pd,unsigned int dsim_base, +unsigned char (*cmd_write) (unsigned int dsim_base,unsigned int data0, +unsigned int data1,unsigned int data2), +unsigned char (*cmd_read) (unsigned int dsim_base,unsigned int data0, +unsigned int data1,unsigned int data2)); + +#endif +
Signature · 1 line
1.7.4.1
PATCH v5 2/2 video: backlight: support s6e8ax0 panel driver based on MIPI DSI
Quoted 44 lines · On Wed, 21 Dec 2011 13:25:00 +0900 Donghwa Lee <[email protected]> wrote:
This patch is amoled panel driver based MIPI DSI interface. S6E8AX0 means it may includes many other ldi controllers, for example, S6E8AA0, S6E8AB0, and so on.
This patch can be modified depending on each panel properites. For example, second parameter of panel condition register can be changed depending on ldi controller or amoled type.
...
(quoted diff) +29
-0+static unsigned char s6e8ax0_22_gamma_30[] = { + 0xFA, 0x01, 0x60, 0x10, 0x60, 0xF5, 0x00, 0xFF, 0xAD, 0xAF, + 0xBA, 0xC3, 0xD8, 0xC5, 0x9F, 0xC6, 0x9E, 0xC1, 0xDC, 0xC0, + 0x00, 0x61, 0x00, 0x5A, 0x00, 0x74, +}; + +static unsigned char s6e8ax0_22_gamma_300[] = { + 0xFA, 0x01, 0x60, 0x10, 0x60, 0xB5, 0xD3, 0xBD, 0xB1, 0xD2, + 0xB0, 0xC0, 0xDC, 0xC0, 0x94, 0xBA, 0x91, 0xAC, 0xC5, 0xA9, + 0x00, 0xC2, 0x00, 0xB7, 0x00, 0xED, +}; + +static unsigned char *s6e8ax0_22_gamma_table[] = { + s6e8ax0_22_gamma_30, + s6e8ax0_22_gamma_50, + s6e8ax0_22_gamma_60, + s6e8ax0_22_gamma_70, + s6e8ax0_22_gamma_80, + s6e8ax0_22_gamma_90, + s6e8ax0_22_gamma_100, + s6e8ax0_22_gamma_120, + s6e8ax0_22_gamma_130, + s6e8ax0_22_gamma_140, + s6e8ax0_22_gamma_150, + s6e8ax0_22_gamma_160, + s6e8ax0_22_gamma_170, + s6e8ax0_22_gamma_180, + s6e8ax0_22_gamma_190, + s6e8ax0_22_gamma_200,
Review
Quoted 10 lines
(quoted diff) +10
-0+ s6e8ax0_22_gamma_210, + s6e8ax0_22_gamma_220, + s6e8ax0_22_gamma_230, + s6e8ax0_22_gamma_240, + s6e8ax0_22_gamma_250, + s6e8ax0_22_gamma_260, + s6e8ax0_22_gamma_270, + s6e8ax0_22_gamma_280, + s6e8ax0_22_gamma_300, +};
I suggest making all the above arrays const. Otherwise the compiler might end up deciding to needlessly allocate space in writeable storage for them.
If that means that ops->cmd_write() needs constification as well then let's just do that, for it is the right thing to do.
drivers/video/backlight/s6e8ax0.c line 295
Quoted 11 lines
drivers/video/backlight/s6e8ax0.c new file +11
-0+static void s6e8ax0_panel_cond (struct s6e8ax0 *lcd) +{ +struct mipi_dsim_master_ops *ops =lcd_to_master_ops (lcd); + +unsigned char data_to_send[] = { +0xf8 ,0x3d ,0x35 ,0x00 ,0x00 ,0x00 ,0x93 ,0x00 ,0x3c , +0x7d ,0x08 ,0x27 ,0x7d ,0x3f ,0x00 ,0x00 ,0x00 ,0x20 , +0x04 ,0x08 ,0x6e ,0x00 ,0x00 ,0x00 ,0x02 ,0x08 ,0x08 , +0x23 ,0x23 ,0xc0 ,0xc8 ,0x08 ,0x48 ,0xc1 ,0x00 ,0xc1 , +0xff ,0xff ,0xc8 + };
Arrays like this certainly should be const. As it stands, the compiler needs to generate room on the stack and generate a local copy of the array each time this function is called!
Quoted 14 lines
drivers/video/backlight/s6e8ax0.c new file +14
-0+ ops->cmd_write (lcd_to_master (lcd),MIPI_DSI_DCS_LONG_WRITE , + data_to_send,ARRAY_SIZE (data_to_send)); +} + +static void s6e8ax0_display_cond (struct s6e8ax0 *lcd) +{ +struct mipi_dsim_master_ops *ops =lcd_to_master_ops (lcd); +unsigned char data_to_send[] = { +0xf2 ,0x80 ,0x03 ,0x0d + }; + + ops->cmd_write (lcd_to_master (lcd),MIPI_DSI_DCS_LONG_WRITE , + data_to_send,ARRAY_SIZE (data_to_send)); +}
drivers/video/backlight/s6e8ax0.c line 320
Quoted 10 lines
drivers/video/backlight/s6e8ax0.c new file +10
-0+ +/* Gamma 2.2 Setting (200cd, 7500K, 10MPCD) */ +static void s6e8ax0_gamma_cond (struct s6e8ax0 *lcd) +{ +struct mipi_dsim_master_ops *ops =lcd_to_master_ops (lcd); +unsigned int gamma = lcd->bd->props.brightness; + + ops->cmd_write (lcd_to_master (lcd),MIPI_DSI_DCS_LONG_WRITE , + s6e8ax0_22_gamma_table[gamma], +ARRAY_SIZE (s6e8ax0_22_gamma_table));
This seems wrong. ARRAY_SIZE(s6e8ax0_22_gamma_table) does not represent the size of s6e8ax0_22_gamma_table[gamma]!
drivers/video/backlight/s6e8ax0.c line 639
Quoted 12 lines
drivers/video/backlight/s6e8ax0.c new file +9
-0+} + +static int s6e8ax0_update_gamma_ctrl (struct s6e8ax0 *lcd,int brightness) +{ +struct mipi_dsim_master_ops *ops =lcd_to_master_ops (lcd); + + ops->cmd_write (lcd_to_master (lcd),MIPI_DSI_DCS_LONG_WRITE , + s6e8ax0_22_gamma_table[brightness], +ARRAY_SIZE (s6e8ax0_22_gamma_table));
Ditto.
Quoted 19 lines
drivers/video/backlight/s6e8ax0.c new file +16
-0+/* update gamma table. */ +s6e8ax0_gamma_update (lcd); + lcd->gamma = brightness; + +return 0 ; +} + +static void s6e8ax0_power_on (struct mipi_dsim_lcd_device *dsim_dev,int power) +{ +struct s6e8ax0 *lcd =dev_get_drvdata (&dsim_dev->dev); + +msleep (lcd->ddi_pd->power_on_delay); + +/* lcd power on */ +if (power) +s6e8ax0_regulator_enable (lcd);
drivers/video/backlight/s6e8ax0.c line 750
Quoted 10 lines
drivers/video/backlight/s6e8ax0.c new file +10
-0+else +s6e8ax0_regulator_disable (lcd); + +msleep (lcd->ddi_pd->reset_delay); + +/* lcd reset */ +if (lcd->ddi_pd->reset) + lcd->ddi_pd->reset (lcd->ld); +msleep (5 ); +}
Maybe we should hold lcd->lock across this function to prevent other code paths from getting in and fiddling with the hardware while it is powering on?
Quoted 3 lines
...
PATCH v5 2/2 video: backlight: support s6e8ax0 panel driver based on MIPI DSI
Quoted 62 lines · Andrew Morton
Quoted 44 lines · On Wed, 21 Dec 2011 13:25:00 +0900 Donghwa Lee <[email protected]> wrote:
This patch is amoled panel driver based MIPI DSI interface. S6E8AX0 means it may includes many other ldi controllers, for example, S6E8AA0, S6E8AB0, and so on.
This patch can be modified depending on each panel properites. For example, second parameter of panel condition register can be changed depending on ldi controller or amoled type.
...
(quoted diff) +29
-0+static unsigned char s6e8ax0_22_gamma_30[] = { + 0xFA, 0x01, 0x60, 0x10, 0x60, 0xF5, 0x00, 0xFF, 0xAD, 0xAF, + 0xBA, 0xC3, 0xD8, 0xC5, 0x9F, 0xC6, 0x9E, 0xC1, 0xDC, 0xC0, + 0x00, 0x61, 0x00, 0x5A, 0x00, 0x74, +}; + +static unsigned char s6e8ax0_22_gamma_300[] = { + 0xFA, 0x01, 0x60, 0x10, 0x60, 0xB5, 0xD3, 0xBD, 0xB1, 0xD2, + 0xB0, 0xC0, 0xDC, 0xC0, 0x94, 0xBA, 0x91, 0xAC, 0xC5, 0xA9, + 0x00, 0xC2, 0x00, 0xB7, 0x00, 0xED, +}; + +static unsigned char *s6e8ax0_22_gamma_table[] = { + s6e8ax0_22_gamma_30, + s6e8ax0_22_gamma_50, + s6e8ax0_22_gamma_60, + s6e8ax0_22_gamma_70, + s6e8ax0_22_gamma_80, + s6e8ax0_22_gamma_90, + s6e8ax0_22_gamma_100, + s6e8ax0_22_gamma_120, + s6e8ax0_22_gamma_130, + s6e8ax0_22_gamma_140, + s6e8ax0_22_gamma_150, + s6e8ax0_22_gamma_160, + s6e8ax0_22_gamma_170, + s6e8ax0_22_gamma_180, + s6e8ax0_22_gamma_190, + s6e8ax0_22_gamma_200,Review
Quoted 10 lines
(quoted diff) +10
-0+ s6e8ax0_22_gamma_210, + s6e8ax0_22_gamma_220, + s6e8ax0_22_gamma_230, + s6e8ax0_22_gamma_240, + s6e8ax0_22_gamma_250, + s6e8ax0_22_gamma_260, + s6e8ax0_22_gamma_270, + s6e8ax0_22_gamma_280, + s6e8ax0_22_gamma_300, +};I suggest making all the above arrays const. Otherwise the compiler might end up deciding to needlessly allocate space in writeable storage for them.
Quoted 3 lines
If that means that
ops->cmd_write()needs constification as well then let's just do that, for it is the right thing to do.
Ok, I will change it to const arrays with ops->cmd_write() function parameter.
Quoted 84 lines
drivers/video/backlight/s6e8ax0.c line 295
Quoted 11 lines
drivers/video/backlight/s6e8ax0.c new file +11
-0+static void s6e8ax0_panel_cond (struct s6e8ax0 *lcd) +{ +struct mipi_dsim_master_ops *ops =lcd_to_master_ops (lcd); + +unsigned char data_to_send[] = { +0xf8 ,0x3d ,0x35 ,0x00 ,0x00 ,0x00 ,0x93 ,0x00 ,0x3c , +0x7d ,0x08 ,0x27 ,0x7d ,0x3f ,0x00 ,0x00 ,0x00 ,0x20 , +0x04 ,0x08 ,0x6e ,0x00 ,0x00 ,0x00 ,0x02 ,0x08 ,0x08 , +0x23 ,0x23 ,0xc0 ,0xc8 ,0x08 ,0x48 ,0xc1 ,0x00 ,0xc1 , +0xff ,0xff ,0xc8 + };Arrays like this certainly should be const. As it stands, the compiler needs to generate room on the stack and generate a local copy of the array each time this function is called!
Quoted 14 lines
drivers/video/backlight/s6e8ax0.c new file +14
-0+ ops->cmd_write (lcd_to_master (lcd),MIPI_DSI_DCS_LONG_WRITE , + data_to_send,ARRAY_SIZE (data_to_send)); +} + +static void s6e8ax0_display_cond (struct s6e8ax0 *lcd) +{ +struct mipi_dsim_master_ops *ops =lcd_to_master_ops (lcd); +unsigned char data_to_send[] = { +0xf2 ,0x80 ,0x03 ,0x0d + }; + + ops->cmd_write (lcd_to_master (lcd),MIPI_DSI_DCS_LONG_WRITE , + data_to_send,ARRAY_SIZE (data_to_send)); +}drivers/video/backlight/s6e8ax0.c line 320
Quoted 10 lines
drivers/video/backlight/s6e8ax0.c new file +10
-0+ +/* Gamma 2.2 Setting (200cd, 7500K, 10MPCD) */ +static void s6e8ax0_gamma_cond (struct s6e8ax0 *lcd) +{ +struct mipi_dsim_master_ops *ops =lcd_to_master_ops (lcd); +unsigned int gamma = lcd->bd->props.brightness; + + ops->cmd_write (lcd_to_master (lcd),MIPI_DSI_DCS_LONG_WRITE , + s6e8ax0_22_gamma_table[gamma], +ARRAY_SIZE (s6e8ax0_22_gamma_table));This seems wrong.
ARRAY_SIZE(s6e8ax0_22_gamma_table)does not represent the size of s6e8ax0_22_gamma_table[gamma]!drivers/video/backlight/s6e8ax0.c line 639
Quoted 12 lines
drivers/video/backlight/s6e8ax0.c new file +9
-0+} + +static int s6e8ax0_update_gamma_ctrl (struct s6e8ax0 *lcd,int brightness) +{ +struct mipi_dsim_master_ops *ops =lcd_to_master_ops (lcd); + + ops->cmd_write (lcd_to_master (lcd),MIPI_DSI_DCS_LONG_WRITE , + s6e8ax0_22_gamma_table[brightness], +ARRAY_SIZE (s6e8ax0_22_gamma_table));Ditto.
Quoted 25 lines
drivers/video/backlight/s6e8ax0.c new file +22
-0+/* update gamma table. */ +s6e8ax0_gamma_update (lcd); + lcd->gamma = brightness; + +return 0 ; +} + +static void s6e8ax0_power_on (struct mipi_dsim_lcd_device *dsim_dev,int power) +{ +struct s6e8ax0 *lcd =dev_get_drvdata (&dsim_dev->dev); + +msleep (lcd->ddi_pd->power_on_delay); + +/* lcd power on */ +if (power) +s6e8ax0_regulator_enable (lcd); +else +s6e8ax0_regulator_disable (lcd); + +msleep (lcd->ddi_pd->reset_delay); + +/* lcd reset */
Quoted 9 lines
drivers/video/backlight/s6e8ax0.c line 750
Quoted 4 lines
drivers/video/backlight/s6e8ax0.c new file +4
-0+if (lcd->ddi_pd->reset) + lcd->ddi_pd->reset (lcd->ld); +msleep (5 ); +}Maybe we should hold
lcd->lockacross this function to prevent other code paths from getting in and fiddling with the hardware while it is powering on?
In s6e8ax0_regulator_enable()/disable() functions, lcd->lock was used to hold.
Quoted 9 lines
Quoted 3 lines
...
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html