Patchwork [U-Boot,v3,2/5] drivers: video: Add ld9040 video driver

login
register
mail settings
Submitter Piotr Wilczek
Date Sept. 24, 2012, 1:04 p.m.
Message ID <1348491860-19224-3-git-send-email-p.wilczek@samsung.com>
Download mbox | patch
Permalink /patch/186399/
State Changes Requested
Delegated to: Anatolij Gustschin
Headers show

Comments

Piotr Wilczek - Sept. 24, 2012, 1:04 p.m.
This patch add ld9040 video driver:
new file:   drivers/video/ld9040.c
new file:   include/ld9040.h
modified:   drivers/video/Makefile

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
CC: Donghwa Lee <dh09.lee@samsung.com>
---
This patch depends on software SPI:
<1348487791-18435-2-git-send-email-p.wilczek@samsung.com>

Changes in v2:
- none.
Changes in v3:
- none

 drivers/video/Makefile |    1 +
 drivers/video/ld9040.c |  147 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/ld9040.h       |   32 ++++++++++
 3 files changed, 180 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h
Minkyu Kang - Sept. 27, 2012, 6:58 a.m.
Dear Piotr,

On 24 September 2012 22:04, Piotr Wilczek <p.wilczek@samsung.com> wrote:
> This patch add ld9040 video driver:
> new file:   drivers/video/ld9040.c
> new file:   include/ld9040.h
> modified:   drivers/video/Makefile

It's a unnecessary information.
Please remove it.

>
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Minkyu Kang <mk7.kang@samsung.com>
> CC: Donghwa Lee <dh09.lee@samsung.com>
> ---
> This patch depends on software SPI:
> <1348487791-18435-2-git-send-email-p.wilczek@samsung.com>
>
> Changes in v2:
> - none.
> Changes in v3:
> - none
>
>  drivers/video/Makefile |    1 +
>  drivers/video/ld9040.c |  147 ++++++++++++++++++++++++++++++++++++++++++++++++
>  include/ld9040.h       |   32 ++++++++++
>  3 files changed, 180 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/video/ld9040.c
>  create mode 100644 include/ld9040.h
>
> diff --git a/drivers/video/Makefile b/drivers/video/Makefile
> index ebb6da8..247b867 100644
> --- a/drivers/video/Makefile
> +++ b/drivers/video/Makefile
> @@ -37,6 +37,7 @@ COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
>  COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
>  COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
>  COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
> +COBJS-$(CONFIG_LD9040) += ld9040.o
>  COBJS-$(CONFIG_SED156X) += sed156x.o
>  COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
>  COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
> diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
> new file mode 100644
> index 0000000..6e94086
> --- /dev/null
> +++ b/drivers/video/ld9040.c
> @@ -0,0 +1,147 @@
> +/*
> + * ld9040 AMOLED LCD panel driver.
> + *
> + * Copyright (C) 2012 Samsung Electronics
> + * Donghwa Lee <dh09.lee@samsung.com>

is author Donghwa?

> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#include <common.h>
> +#include <spi.h>
> +
> +/* these machine specific platform data would be setting at universal.c */

is this panel driver for universal board only?

> +struct spi_platform_data *ld9040;
> +
> +static const unsigned char SEQ_SWRESET[] = {
> +       0x01,
> +};
> +
> +static const unsigned char SEQ_USER_SETTING[] = {
> +       0xF0, 0x5A, 0x5A
> +};
> +
> +static const unsigned char SEQ_ELVSS_ON[] = {
> +       0xB1, 0x0D, 0x00, 0x16,
> +};
> +
> +static const unsigned char SEQ_TEMP_SWIRE[] = {
> +       0xB2, 0x06, 0x06, 0x06, 0x06,
> +};
> +
> +static const unsigned char SEQ_GTCON[] = {
> +       0xF7, 0x09, 0x00, 0x00,
> +};
> +
> +static const unsigned char SEQ_PANEL_CONDITION[] = {
> +       0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
> +       0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
> +       0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02,
> +};
> +
> +static const unsigned char SEQ_GAMMA_SET1[] = {
> +       0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
> +       0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
> +       0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3,
> +};
> +
> +static const unsigned char SEQ_GAMMA_CTRL[] = {
> +       0xFB, 0x02, 0x5A,
> +};
> +
> +static const unsigned char SEQ_APON[] = {
> +       0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02,
> +};
> +
> +static const unsigned char SEQ_DISPCTL[] = {
> +       0xF2, 0x02, 0x08, 0x08, 0x10, 0x10,
> +};
> +
> +static const unsigned char SEQ_MANPWR[] = {
> +       0xB0, 0x04,
> +};
> +
> +static const unsigned char SEQ_PWR_CTRL[] = {
> +       0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88,
> +};
> +
> +static const unsigned char SEQ_SLPOUT[] = {
> +       0x11,
> +};
> +
> +static const unsigned char SEQ_SLPIN[] = {
> +       0x10,
> +};
> +
> +static const unsigned char SEQ_DISPON[] = {
> +       0x29,
> +};
> +
> +static const unsigned char SEQ_DISPOFF[] = {
> +       0x28,
> +};
> +
> +static void ld9040_spi_write(const unsigned char *wbuf, unsigned int size_cmd)
> +{
> +       int i = 0;
> +
> +       /*
> +        * Data are transmitted in 9-bit words:
> +        * the first bit is command/parameter, the other are the value.
> +        * The value's LSB is shifted to MSB position, to be sent as 9th bit
> +        */
> +
> +       unsigned int data_out = 0, data_in = 0;
> +       for (i = 0; i < size_cmd; i++) {
> +               data_out = wbuf[i] >> 1;
> +               if (i != 0)
> +                       data_out += 0x0080;
> +               if (wbuf[i] & 0x01)
> +                       data_out += 0x8000;
> +               spi_xfer(NULL, 9, &data_out, &data_in, SPI_XFER_BEGIN);
> +       }
> +}
> +
> +void ld9040_cfg_ldo(void)
> +{
> +       udelay(10);
> +
> +       ld9040_spi_write(SEQ_USER_SETTING,
> +                                       ARRAY_SIZE(SEQ_USER_SETTING));
> +       ld9040_spi_write(SEQ_PANEL_CONDITION,
> +                                       ARRAY_SIZE(SEQ_PANEL_CONDITION));
> +       ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
> +       ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
> +       ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
> +       ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
> +       ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
> +       ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
> +       ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
> +       ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
> +
> +       udelay(120);
> +}
> +
> +void ld9040_enable_ldo(unsigned int onoff)
> +{
> +       if (onoff)
> +               ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
> +       else
> +               ld9040_spi_write(SEQ_DISPOFF, ARRAY_SIZE(SEQ_DISPOFF));
> +}

Thanks.
Minkyu Kang.
Piotr Wilczek - Sept. 27, 2012, 7:39 a.m.
Dear Minkyu,

> -----Original Message-----
> From: Minkyu Kang [mailto:promsoft@gmail.com]
> Sent: Thursday, September 27, 2012 8:59 AM
> To: Piotr Wilczek
> Cc: u-boot@lists.denx.de; Kyungmin Park; Donghwa Lee
> Subject: Re: [U-Boot] [PATCH v3 2/5] drivers: video: Add ld9040 video
> driver
> 
> Dear Piotr,
> 
> On 24 September 2012 22:04, Piotr Wilczek <p.wilczek@samsung.com>
> wrote:
> > This patch add ld9040 video driver:
> > new file:   drivers/video/ld9040.c
> > new file:   include/ld9040.h
> > modified:   drivers/video/Makefile
> 
> It's a unnecessary information.
> Please remove it.
Ok.
> 
> >
> > Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > CC: Minkyu Kang <mk7.kang@samsung.com>
> > CC: Donghwa Lee <dh09.lee@samsung.com>
> > ---
> > This patch depends on software SPI:
> > <1348487791-18435-2-git-send-email-p.wilczek@samsung.com>
> >
> > Changes in v2:
> > - none.
> > Changes in v3:
> > - none
> >
> >  drivers/video/Makefile |    1 +
> >  drivers/video/ld9040.c |  147
> ++++++++++++++++++++++++++++++++++++++++++++++++
> >  include/ld9040.h       |   32 ++++++++++
> >  3 files changed, 180 insertions(+), 0 deletions(-)  create mode
> > 100644 drivers/video/ld9040.c  create mode 100644 include/ld9040.h
> >
> > diff --git a/drivers/video/Makefile b/drivers/video/Makefile index
> > ebb6da8..247b867 100644
> > --- a/drivers/video/Makefile
> > +++ b/drivers/video/Makefile
> > @@ -37,6 +37,7 @@ COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
> >  COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
> >  COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
> >  COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
> > +COBJS-$(CONFIG_LD9040) += ld9040.o
> >  COBJS-$(CONFIG_SED156X) += sed156x.o
> >  COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
> >  COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o diff --git
> > a/drivers/video/ld9040.c b/drivers/video/ld9040.c new file mode
> 100644
> > index 0000000..6e94086
> > --- /dev/null
> > +++ b/drivers/video/ld9040.c
> > @@ -0,0 +1,147 @@
> > +/*
> > + * ld9040 AMOLED LCD panel driver.
> > + *
> > + * Copyright (C) 2012 Samsung Electronics
> > + * Donghwa Lee <dh09.lee@samsung.com>
> 
> is author Donghwa?
I believe so. This driver is a modification of the driver that can be found
in Kernel and the author is Mr. Donghwa Lee.
> 
> > + *
> > + * See file CREDITS for list of people who contributed to this
> > + * project.
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License as
> > + * published by the Free Software Foundation; either version 2 of
> > + * the License, or (at your option) any later version.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> > + * MA 02111-1307 USA
> > + */
> > +
> > +#include <common.h>
> > +#include <spi.h>
> > +
> > +/* these machine specific platform data would be setting at
> > +universal.c */
> 
> is this panel driver for universal board only?
No it's not. This comment is unnecessary. Also, the following 'struct
spi_platform_data *ld9040' is not used. I should remove both.
> 
> > +struct spi_platform_data *ld9040;
> > +
> > +static const unsigned char SEQ_SWRESET[] = {
> > +       0x01,
> > +};
> > +
> > +static const unsigned char SEQ_USER_SETTING[] = {
> > +       0xF0, 0x5A, 0x5A
> > +};
> > +
> > +static const unsigned char SEQ_ELVSS_ON[] = {
> > +       0xB1, 0x0D, 0x00, 0x16,
> > +};
> > +
> > +static const unsigned char SEQ_TEMP_SWIRE[] = {
> > +       0xB2, 0x06, 0x06, 0x06, 0x06,
> > +};
> > +
> > +static const unsigned char SEQ_GTCON[] = {
> > +       0xF7, 0x09, 0x00, 0x00,
> > +};
> > +
> > +static const unsigned char SEQ_PANEL_CONDITION[] = {
> > +       0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
> > +       0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
> > +       0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02, };
> > +
> > +static const unsigned char SEQ_GAMMA_SET1[] = {
> > +       0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
> > +       0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
> > +       0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3, };
> > +
> > +static const unsigned char SEQ_GAMMA_CTRL[] = {
> > +       0xFB, 0x02, 0x5A,
> > +};
> > +
> > +static const unsigned char SEQ_APON[] = {
> > +       0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02, };
> > +
> > +static const unsigned char SEQ_DISPCTL[] = {
> > +       0xF2, 0x02, 0x08, 0x08, 0x10, 0x10, };
> > +
> > +static const unsigned char SEQ_MANPWR[] = {
> > +       0xB0, 0x04,
> > +};
> > +
> > +static const unsigned char SEQ_PWR_CTRL[] = {
> > +       0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88, };
> > +
> > +static const unsigned char SEQ_SLPOUT[] = {
> > +       0x11,
> > +};
> > +
> > +static const unsigned char SEQ_SLPIN[] = {
> > +       0x10,
> > +};
> > +
> > +static const unsigned char SEQ_DISPON[] = {
> > +       0x29,
> > +};
> > +
> > +static const unsigned char SEQ_DISPOFF[] = {
> > +       0x28,
> > +};
> > +
> > +static void ld9040_spi_write(const unsigned char *wbuf, unsigned int
> > +size_cmd) {
> > +       int i = 0;
> > +
> > +       /*
> > +        * Data are transmitted in 9-bit words:
> > +        * the first bit is command/parameter, the other are the
> value.
> > +        * The value's LSB is shifted to MSB position, to be sent as
> 9th bit
> > +        */
> > +
> > +       unsigned int data_out = 0, data_in = 0;
> > +       for (i = 0; i < size_cmd; i++) {
> > +               data_out = wbuf[i] >> 1;
> > +               if (i != 0)
> > +                       data_out += 0x0080;
> > +               if (wbuf[i] & 0x01)
> > +                       data_out += 0x8000;
> > +               spi_xfer(NULL, 9, &data_out, &data_in,
> SPI_XFER_BEGIN);
> > +       }
> > +}
> > +
> > +void ld9040_cfg_ldo(void)
> > +{
> > +       udelay(10);
> > +
> > +       ld9040_spi_write(SEQ_USER_SETTING,
> > +
> ARRAY_SIZE(SEQ_USER_SETTING));
> > +       ld9040_spi_write(SEQ_PANEL_CONDITION,
> > +
> ARRAY_SIZE(SEQ_PANEL_CONDITION));
> > +       ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
> > +       ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
> > +       ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
> > +       ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
> > +       ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
> > +       ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
> > +       ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
> > +       ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
> > +
> > +       udelay(120);
> > +}
> > +
> > +void ld9040_enable_ldo(unsigned int onoff) {
> > +       if (onoff)
> > +               ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
> > +       else
> > +               ld9040_spi_write(SEQ_DISPOFF,
> > +ARRAY_SIZE(SEQ_DISPOFF)); }
> 
> Thanks.
> Minkyu Kang.
> --
> from. prom.
> www.promsoft.net

Thank you,
Piotr Wilczek
Piotr Wilczek - Sept. 28, 2012, 10:34 a.m.
This patchset add support for display on Universal C210 board.
Max8998 is modified to power on display, new driver ld9040 is added
and support for LCD display on universal C210 board is added.

Changes in v2:
- removed unnecessary function for fimd clock set;
- code cleanup
- removed patch for fix exynos4_fb structure
Changes in v3:
- small changes in Patch 5/5 after some changes in another
 patch ID=<1348487791-18435-2-git-send-email-p.wilczek@samsung.com>
 on which this patch depends on.
Changes in v4:
- removed comment and unused struct
- removed patch with unused display control define

Piotr Wilczek (4):
  misc:max8998 Add LDO macros
  drivers: video: Add ld9040 video driver
  drivers: video: fix image position
  exynos4: universal_C210: add display support

 board/samsung/universal_c210/universal.c |  202 +++++++++++++++++++++++++++---
 drivers/video/Makefile                   |    1 +
 drivers/video/exynos_fb.c                |   15 ++-
 drivers/video/ld9040.c                   |  144 +++++++++++++++++++++
 include/configs/s5pc210_universal.h      |   13 ++
 include/ld9040.h                         |   32 +++++
 include/max8998_pmic.h                   |    2 +
 7 files changed, 389 insertions(+), 20 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h

Patch

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index ebb6da8..247b867 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -37,6 +37,7 @@  COBJS-$(CONFIG_EXYNOS_PWM_BL) += exynos_pwm_bl.o
 COBJS-$(CONFIG_FSL_DIU_FB) += fsl_diu_fb.o videomodes.o
 COBJS-$(CONFIG_S6E8AX0) += s6e8ax0.o
 COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
+COBJS-$(CONFIG_LD9040) += ld9040.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
 COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
 COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o
diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
new file mode 100644
index 0000000..6e94086
--- /dev/null
+++ b/drivers/video/ld9040.c
@@ -0,0 +1,147 @@ 
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <spi.h>
+
+/* these machine specific platform data would be setting at universal.c */
+struct spi_platform_data *ld9040;
+
+static const unsigned char SEQ_SWRESET[] = {
+	0x01,
+};
+
+static const unsigned char SEQ_USER_SETTING[] = {
+	0xF0, 0x5A, 0x5A
+};
+
+static const unsigned char SEQ_ELVSS_ON[] = {
+	0xB1, 0x0D, 0x00, 0x16,
+};
+
+static const unsigned char SEQ_TEMP_SWIRE[] = {
+	0xB2, 0x06, 0x06, 0x06, 0x06,
+};
+
+static const unsigned char SEQ_GTCON[] = {
+	0xF7, 0x09, 0x00, 0x00,
+};
+
+static const unsigned char SEQ_PANEL_CONDITION[] = {
+	0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
+	0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
+	0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02,
+};
+
+static const unsigned char SEQ_GAMMA_SET1[] = {
+	0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
+	0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
+	0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3,
+};
+
+static const unsigned char SEQ_GAMMA_CTRL[] = {
+	0xFB, 0x02, 0x5A,
+};
+
+static const unsigned char SEQ_APON[] = {
+	0xF3, 0x00, 0x00, 0x00, 0x0A, 0x02,
+};
+
+static const unsigned char SEQ_DISPCTL[] = {
+	0xF2, 0x02, 0x08, 0x08, 0x10, 0x10,
+};
+
+static const unsigned char SEQ_MANPWR[] = {
+	0xB0, 0x04,
+};
+
+static const unsigned char SEQ_PWR_CTRL[] = {
+	0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88,
+};
+
+static const unsigned char SEQ_SLPOUT[] = {
+	0x11,
+};
+
+static const unsigned char SEQ_SLPIN[] = {
+	0x10,
+};
+
+static const unsigned char SEQ_DISPON[] = {
+	0x29,
+};
+
+static const unsigned char SEQ_DISPOFF[] = {
+	0x28,
+};
+
+static void ld9040_spi_write(const unsigned char *wbuf, unsigned int size_cmd)
+{
+	int i = 0;
+
+	/*
+	 * Data are transmitted in 9-bit words:
+	 * the first bit is command/parameter, the other are the value.
+	 * The value's LSB is shifted to MSB position, to be sent as 9th bit
+	 */
+
+	unsigned int data_out = 0, data_in = 0;
+	for (i = 0; i < size_cmd; i++) {
+		data_out = wbuf[i] >> 1;
+		if (i != 0)
+			data_out += 0x0080;
+		if (wbuf[i] & 0x01)
+			data_out += 0x8000;
+		spi_xfer(NULL, 9, &data_out, &data_in, SPI_XFER_BEGIN);
+	}
+}
+
+void ld9040_cfg_ldo(void)
+{
+	udelay(10);
+
+	ld9040_spi_write(SEQ_USER_SETTING,
+					ARRAY_SIZE(SEQ_USER_SETTING));
+	ld9040_spi_write(SEQ_PANEL_CONDITION,
+					ARRAY_SIZE(SEQ_PANEL_CONDITION));
+	ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
+	ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
+	ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
+	ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
+	ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
+	ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
+	ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
+	ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
+
+	udelay(120);
+}
+
+void ld9040_enable_ldo(unsigned int onoff)
+{
+	if (onoff)
+		ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
+	else
+		ld9040_spi_write(SEQ_DISPOFF, ARRAY_SIZE(SEQ_DISPOFF));
+}
diff --git a/include/ld9040.h b/include/ld9040.h
new file mode 100644
index 0000000..fe99390
--- /dev/null
+++ b/include/ld9040.h
@@ -0,0 +1,32 @@ 
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <dh09.lee@samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __LD9040_H_
+#define __LD9040_H_
+
+void ld9040_cfg_ldo(void);
+void ld9040_enable_ldo(unsigned int onoff);
+
+#endif /* __LD9040_H_ */