Skip to contentSkip to conversation

Exynos: Support for display drivers

PATCH Superseded Piotr Wilczek 5 participants 32 messages Sep 19, 2012 – Dec 9, 2012

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

v2 cover Exynos: Support for display drivers

This patchset add support for display on Universal C210 board. Max8998 is modified to power on display, new driver ld9040 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

Piotr Wilczek (5):
misc:max8998 Add LDO macros
drivers: video: Add ld9040 video driver
arm: exynos4: cpu: Add definition for display
drivers: video: fix image position
arm: exynos4: universal_C210: add display support

 arch/arm/include/asm/arch-exynos/cpu.h   |    1 +
 board/samsung/universal_c210/universal.c |  201 +++++++++++++++++++++++++++---
 drivers/video/Makefile                   |    1 +
 drivers/video/exynos_fb.c                |   15 ++-
 drivers/video/ld9040.c                   |  147 ++++++++++++++++++++++
 include/configs/s5pc210_universal.h      |   13 ++
 include/ld9040.h                         |   32 +++++
 include/max8998_pmic.h                   |    2 +
 8 files changed, 392 insertions(+), 20 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH v2 1/5 misc:max8998 Add LDO macros

Add LDO7 and LDO17 macros to max8998_pmic.h necessary to power on the LCD.

Changes in v2:
- none.

---
 include/max8998_pmic.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/max8998_pmic.h +2 -0
index ca21f88..0e559f9 100644
@@ -76,7 +76,9 @@ enum {
 
 #define MAX8998_LDO3		(1 << 2)
 #define MAX8998_LDO4		(1 << 1)
+#define MAX8998_LDO7		(1 << 6)
 #define MAX8998_LDO8		(1 << 5)
+#define MAX8998_LDO17		(1 << 4)
 #define MAX8998_SAFEOUT1	(1 << 4)
 
 #define MAX8998_I2C_ADDR        (0xCC >> 1)
Signature · 1 line
1.7.5.4
#2 lore raw

v3 cover Exynos: Support for display drivers

This patchset add support for display on Universal C210 board. Max8998 is modified to power on display, new driver ld9040 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=<[email protected]> on which this patch depends on.

Piotr Wilczek (5):
misc: max8998: Add LDO macros
drivers: video: Add ld9040 video driver
arm: exynos4: cpu: Add definition for display
drivers: video: fix image position
arm: exynos4: universal_C210: add display support

 arch/arm/include/asm/arch-exynos/cpu.h   |    1 +
 board/samsung/universal_c210/universal.c |  202 +++++++++++++++++++++++++++---
 drivers/video/Makefile                   |    1 +
 drivers/video/exynos_fb.c                |   15 ++-
 drivers/video/ld9040.c                   |  147 ++++++++++++++++++++++
 include/configs/s5pc210_universal.h      |   13 ++
 include/ld9040.h                         |   32 +++++
 include/max8998_pmic.h                   |    2 +
 8 files changed, 393 insertions(+), 20 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH v3 1/5 misc: max8998: Add LDO macros

Add LDO7 and LDO17 macros to max8998_pmic.h necessary to power on the LCD.

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

 include/max8998_pmic.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/max8998_pmic.h +2 -0
index ca21f88..0e559f9 100644
@@ -76,7 +76,9 @@ enum {
 
 #define MAX8998_LDO3		(1 << 2)
 #define MAX8998_LDO4		(1 << 1)
+#define MAX8998_LDO7		(1 << 6)
 #define MAX8998_LDO8		(1 << 5)
+#define MAX8998_LDO17		(1 << 4)
 #define MAX8998_SAFEOUT1	(1 << 4)
 
 #define MAX8998_I2C_ADDR        (0xCC >> 1)
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH v3 2/5 drivers: video: Add ld9040 video driver

In reply to Piotr Wilczek

This patch add ld9040 video driver:

new file:   drivers/video/ld9040.c
new file:   include/ld9040.h
modified:   drivers/video/Makefile

---
This patch depends on software SPI:
<[email protected]>

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
drivers/video/Makefile +1 -0
index ebb6da8..247b867 100644
@@ -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
drivers/video/ld9040.c new file +147 -0

147 lines not on this page · raw message

include/ld9040.h new file +32 -0
new file mode 100644
index 0000000..fe99390
@@ -0,0 +1,32 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <[email protected]>
+ *
+ * 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_ */
Signature · 1 line
1.7.5.4
#5 lore raw

PATCH v3 2/5 drivers: video: Add ld9040 video driver

Dear Piotr,

Quoted 4 lines · Piotr Wilczek

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.

Quoted 39 lines

---
This patch depends on software SPI:
<[email protected]>

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
drivers/video/Makefile +1 -0
index ebb6da8..247b867 100644
@@ -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
drivers/video/ld9040.c new file +0 -0
new file mode 100644
index 0000000..6e94086

drivers/video/ld9040.c line 5

Quoted 5 lines
drivers/video/ld9040.c new file +5 -0
@@ -0,0 +1,147 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <[email protected]>

is author Donghwa?

Quoted 14 lines
drivers/video/ld9040.c new file +14 -0
+ *
+ * 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.
+ *

drivers/video/ld9040.c line 29

Quoted 10 lines
drivers/video/ld9040.c new file +10 -0
+ * 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?

Quoted 108 lines
drivers/video/ld9040.c new file +108 -0
+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));
+

drivers/video/ld9040.c line 147

Quoted 10 lines
drivers/video/ld9040.c new file +10 -0
+       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.

Signature · 2 lines
from. prom.
www.promsoft.net
#6 lore raw

PATCH v3 2/5 drivers: video: Add ld9040 video driver

Dear Minkyu,

Quoted 12 lines

-----Original Message-----
From: Minkyu Kang [mailto:promsoft at gmail.com]
Sent: Thursday, September 27, 2012 8:59 AM
To: Piotr Wilczek
Cc: u-boot at 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 <[email protected]> wrote:

Quoted 7 lines
Quoted 4 lines

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.

Quoted 36 lines
Quoted 10 lines

---
This patch depends on software SPI:
<[email protected]>

Quoted 7 lines

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

 drivers/video/Makefile |    1 +
 drivers/video/ld9040.c |  147

++++++++++++++++++++++++++++++++++++++++++++++++

Quoted 16 lines
 include/ld9040.h       |   32 ++++++++++
 3 files changed, 180 insertions(+), 0 deletions(-)  create mode

100644 drivers/video/ld9040.c create mode 100644 include/ld9040.h

drivers/video/Makefile index renamed from drivers/video/Makefile +0 -0

ebb6da8..247b867 100644

drivers/video/Makefile +1 -0
@@ -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
Quoted 1 line

a/drivers/video/ld9040.c b/drivers/video/ld9040.c new file mode

100644

Quoted 11 lines

drivers/video/ld9040.c line 5

Quoted 9 lines

index 0000000..6e94086

drivers/video/ld9040.c new file +5 -0
@@ -0,0 +1,147 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <[email protected]>

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.

Quoted 20 lines
Quoted 20 lines
drivers/video/ld9040.c new file +19 -0
+ *
+ * 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
+ */
Quoted 8 lines

drivers/video/ld9040.c

Quoted 6 lines
drivers/video/ld9040.c new file +6 -0
+
+#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.

Quoted 116 lines
Quoted 63 lines
drivers/video/ld9040.c new file +62 -0
+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[] = {

drivers/video/ld9040.c

Quoted 10 lines
drivers/video/ld9040.c new file +10 -0
+       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.

drivers/video/ld9040.c line 103

Quoted 1 line
drivers/video/ld9040.c new file +1 -0
+        * The value's LSB is shifted to MSB position, to be sent as

9th bit

drivers/video/ld9040.c

Quoted 10 lines
drivers/video/ld9040.c new file +10 -0
+        */
+
+       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);

drivers/video/ld9040.c line 137

Quoted 9 lines
drivers/video/ld9040.c new file +9 -0
+       }
+}
+
+void ld9040_cfg_ldo(void)
+{
+       udelay(10);
+
+       ld9040_spi_write(SEQ_USER_SETTING,
+

ARRAY_SIZE(SEQ_USER_SETTING));

drivers/video/ld9040.c line 124

Quoted 2 lines
drivers/video/ld9040.c new file +2 -0
+       ld9040_spi_write(SEQ_PANEL_CONDITION,
+

ARRAY_SIZE(SEQ_PANEL_CONDITION));

Quoted 16 lines
drivers/video/ld9040.c new file +16 -0
+       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
Quoted 8 lines

drivers/video/ld9040.c line 142

Quoted 2 lines
drivers/video/ld9040.c new file +2 -0
+               ld9040_spi_write(SEQ_DISPOFF,
+ARRAY_SIZE(SEQ_DISPOFF)); }

Thanks.
Minkyu Kang.
--
from. prom.
www.promsoft.net

Thank you,
Piotr Wilczek

#7 lore raw

v4 cover Exynos: Support for display drivers

In reply to Piotr Wilczek

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=<[email protected]> 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
Signature · 1 line
1.7.5.4
#8 lore raw

PATCH v4 1/4 misc:max8998 Add LDO macros

Add LDO7 and LDO17 macros to max8998_pmic.h necessary to power on the LCD.

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

 include/max8998_pmic.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/max8998_pmic.h +2 -0
index ca21f88..0e559f9 100644
@@ -76,7 +76,9 @@ enum {
 
 #define MAX8998_LDO3		(1 << 2)
 #define MAX8998_LDO4		(1 << 1)
+#define MAX8998_LDO7		(1 << 6)
 #define MAX8998_LDO8		(1 << 5)
+#define MAX8998_LDO17		(1 << 4)
 #define MAX8998_SAFEOUT1	(1 << 4)
 
 #define MAX8998_I2C_ADDR        (0xCC >> 1)
Signature · 1 line
1.7.5.4
#9 lore raw

v5 cover arm:exynos: Support for display drivers

This patchset add support for display on Universal C210 board. Software SPI support is added to universal C210.
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:
- code cleanup
Changes in v4:
- removed comment and unused struct
- removed patch with unused display control define
Changes in v5:
- add patch to support soft SPI on Universal_C210

Piotr Wilczek (5):
exynos4: universal_C210: use software SPI
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 |  253 +++++++++++++++++++++++++++--
 drivers/video/Makefile                   |    1 +
 drivers/video/exynos_fb.c                |   15 ++-
 drivers/video/ld9040.c                   |  144 +++++++++++++++++
 include/configs/s5pc210_universal.h      |   34 ++++
 include/ld9040.h                         |   32 ++++
 include/max8998_pmic.h                   |    2 +
 7 files changed, 461 insertions(+), 20 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h
Signature · 1 line
1.7.5.4
#10 lore raw

PATCH v5 1/5 exynos4: universal_C210: use software SPI

This patch use software spi on Samsung Universal C210 board.

---
New path added in v5.

 board/samsung/universal_c210/universal.c |   87 +++++++++++++++++++++++------
 include/configs/s5pc210_universal.h      |   21 +++++++
 2 files changed, 90 insertions(+), 18 deletions(-)
board/samsung/universal_c210/universal.c +69 -18
index ded97ca..4c1163e 100644
@@ -23,7 +23,9 @@
  */
 
 #include <common.h>
+#include <spi.h>
 #include <asm/io.h>
+#include <asm/gpio.h>
 #include <asm/arch/adc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
@@ -52,24 +54,6 @@ static int get_hwrev(void)
 
 static void check_hw_revision(void);
 
-int board_init(void)
-{
-	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
-	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
-
-	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
-	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
-#if defined(CONFIG_PMIC)
-	pmic_init();
-#endif
-
-	check_hw_revision();
-	printf("HW Revision:\t0x%x\n", board_rev);
-
-	return 0;
-}
-
 int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
@@ -284,3 +268,70 @@ int board_early_init_f(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_SOFT_SPI
+static void soft_spi_init(void)
+{
+	gpio_direction_output(CONFIG_SOFT_SPI_GPIO_SCLK,
+		CONFIG_SOFT_SPI_MODE & SPI_CPOL);
+	gpio_direction_output(CONFIG_SOFT_SPI_GPIO_MOSI, 1);
+	gpio_direction_input(CONFIG_SOFT_SPI_GPIO_MISO);
+	gpio_direction_output(CONFIG_SOFT_SPI_GPIO_CS,
+		!(CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH));
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+	gpio_set_value(CONFIG_SOFT_SPI_GPIO_CS,
+		!(CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH));
+	SPI_SCL(1);
+	gpio_set_value(CONFIG_SOFT_SPI_GPIO_CS,
+		CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	gpio_set_value(CONFIG_SOFT_SPI_GPIO_CS,
+		!(CONFIG_SOFT_SPI_MODE & SPI_CS_HIGH));
+}
+
+int  spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus == 0 && cs == 0;
+}
+
+void universal_spi_scl(int bit)
+{
+	gpio_set_value(CONFIG_SOFT_SPI_GPIO_SCLK, bit);
+}
+
+void universal_spi_sda(int bit)
+{
+	gpio_set_value(CONFIG_SOFT_SPI_GPIO_MOSI, bit);
+}
+
+int universal_spi_read(void)
+{
+	return gpio_get_value(CONFIG_SOFT_SPI_GPIO_MISO);
+}
+#endif
+
+int board_init(void)
+{
+	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
+	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
+
+	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
+	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+#if defined(CONFIG_PMIC)
+	pmic_init();
+#endif
+#ifdef CONFIG_SOFT_SPI
+	soft_spi_init();
+#endif
+	check_hw_revision();
+	printf("HW Revision:\t0x%x\n", board_rev);
+
+	return 0;
+}
include/configs/s5pc210_universal.h +21 -0
index 07849fb..54ee8c4 100644
@@ -263,4 +263,25 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 
+/*
+ * SPI Settings
+ */
+#define CONFIG_SOFT_SPI
+#define CONFIG_SOFT_SPI_MODE SPI_MODE_3
+#define CONFIG_SOFT_SPI_GPIO_SCLK exynos4_gpio_part2_get_nr(y3, 1)
+#define CONFIG_SOFT_SPI_GPIO_MOSI exynos4_gpio_part2_get_nr(y3, 3)
+#define CONFIG_SOFT_SPI_GPIO_MISO exynos4_gpio_part2_get_nr(y3, 0)
+#define CONFIG_SOFT_SPI_GPIO_CS exynos4_gpio_part2_get_nr(y4, 3)
+
+#define SPI_DELAY udelay(1)
+#undef SPI_INIT
+#define SPI_SCL(bit) universal_spi_scl(bit)
+#define SPI_SDA(bit) universal_spi_sda(bit)
+#define SPI_READ universal_spi_read()
+#ifndef	__ASSEMBLY__
+void universal_spi_scl(int bit);
+void universal_spi_sda(int bit);
+int universal_spi_read(void);
+#endif
+
 #endif	/* __CONFIG_H */
Signature · 1 line
1.7.5.4
#11 lore raw

PATCH v5 1/5 exynos4: universal_C210: use software SPI

Hi Piotr,

Quoted 7 lines · Piotr Wilczek

This patch use software spi on Samsung Universal C210 board.

---
New path added in v5.

This patch, committed in Minkuy's tree as ff0fedd5, as well as "exynos4: universal_C210: add display support", committed too, as d984b9f8, conflict with PMIC/POWER reworks now in u-boot/master.

Piotr, can you see what neds reworking?

Minkyu, can you provide a pull request the same way as Stefano did for the woodburn issue? See

<http://www.mail-archive.com/[email protected]/msg101115.html>

Thanks in advance!

Amicalement,

Signature · 1 line
Albert.
#12 lore raw

PATCH v5 2/5 misc:max8998 Add LDO macros

In reply to Piotr Wilczek

Add LDO7 and LDO17 macros to max8998_pmic.h necessary to power on the LCD.

---
Changes in v2:
- none
Changes in v3:
- none
Changes in v4:
- none
Changes in v5:
- none

 include/max8998_pmic.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/max8998_pmic.h +2 -0
index ca21f88..0e559f9 100644
@@ -76,7 +76,9 @@ enum {
 
 #define MAX8998_LDO3		(1 << 2)
 #define MAX8998_LDO4		(1 << 1)
+#define MAX8998_LDO7		(1 << 6)
 #define MAX8998_LDO8		(1 << 5)
+#define MAX8998_LDO17		(1 << 4)
 #define MAX8998_SAFEOUT1	(1 << 4)
 
 #define MAX8998_I2C_ADDR        (0xCC >> 1)
Signature · 1 line
1.7.5.4
#13 lore raw

PATCH v5 3/5 drivers: video: Add ld9040 video driver

In reply to Piotr Wilczek

---
Changes in v2:
- none
Changes in v3:
- none
Changes in v4:
- removed comment and unused struct
Changes in v5:
- none

 drivers/video/Makefile |    1 +
 drivers/video/ld9040.c |  144 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/ld9040.h       |   32 +++++++++++
 3 files changed, 177 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h
drivers/video/Makefile +1 -0
index ebb6da8..247b867 100644
@@ -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
drivers/video/ld9040.c new file +144 -0

144 lines not on this page · raw message

include/ld9040.h new file +32 -0
new file mode 100644
index 0000000..fe99390
@@ -0,0 +1,32 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <[email protected]>
+ *
+ * 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_ */
Signature · 1 line
1.7.5.4
#14 lore raw

PATCH v5 4/5 drivers: video: fix image position

In reply to Piotr Wilczek

This patch fixes image position on screen when images's height or width is biger then the lcd's.

---
Changes in v2:
- none
Changes in v3:
- none
Changes in v4:
- none
Changes in v4:
- none

 drivers/video/exynos_fb.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
drivers/video/exynos_fb.c +13 -2
index e31a0fd..d9a3f9a 100644
@@ -70,8 +70,19 @@ static void draw_logo(void)
 	int x, y;
 	ulong addr;
 
-	x = ((panel_width - panel_info.logo_width) >> 1);
-	y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	if (panel_width >= panel_info.logo_width) {
+		x = ((panel_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_height >= panel_info.logo_height) {
+		y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
 
 	addr = panel_info.logo_addr;
 	bmp_display(addr, x, y);
Signature · 1 line
1.7.5.4
#15 lore raw

PATCH v5 5/5 exynos4: universal_C210: add display support

In reply to Piotr Wilczek

This patch add support for display on Universal C210 board. Width of displyed logo must be not bigger than 480 pixel and is limited by width of the screen.
Tizen logo size is 520x120 pixels and should be resized.

---
Changes in v2:
- removed unnecessary function for fimd clock set;
- removed unnecessary return;
- moved init_pmic_lcd to CONFIG_PMIC
Changes in v3:
- code cleanup
Changes in v4:
- none
Changes in v5:
- none

 board/samsung/universal_c210/universal.c |  166 ++++++++++++++++++++++++++++++
 include/configs/s5pc210_universal.h      |   13 +++
 2 files changed, 179 insertions(+), 0 deletions(-)
board/samsung/universal_c210/universal.c +166 -0
index 4c1163e..afe3bb0 100644
@@ -24,6 +24,7 @@
 
 #include <common.h>
 #include <spi.h>
+#include <lcd.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/arch/adc.h>
@@ -35,6 +36,8 @@
 #include <asm/arch/cpu.h>
 #include <max8998_pmic.h>
 #include <asm/arch/watchdog.h>
+#include <libtizen.h>
+#include <ld9040.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -316,6 +319,168 @@ int universal_spi_read(void)
 }
 #endif
 
+static void init_pmic_lcd(void)
+{
+	unsigned char val;
+	int ret = 0;
+
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	/* LDO7 1.8V */
+	val = 0x02; /* (1800 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO7, val);
+
+	/* LDO17 3.0V */
+	val = 0xe; /* (3000 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO17, val);
+
+	/* Disable unneeded regulators */
+	/*
+	 * ONOFF1
+	 * Buck1 ON, Buck2 OFF, Buck3 ON, Buck4 ON
+	 * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON
+	 */
+	val = 0xB9;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF1, val);
+
+	/* ONOFF2
+	 * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON,
+	 * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF
+	 */
+	val = 0x50;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF2, val);
+
+	/* ONOFF3
+	 * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF
+	 * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF
+	 */
+	val = 0x00;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF3, val);
+
+	if (ret)
+		puts("LCD pmic initialisation error!\n");
+}
+
+static void lcd_cfg_gpio(void)
+{
+	unsigned int i, f3_end = 4;
+
+	for (i = 0; i < 8; i++) {
+		/* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f0, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f1, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f2, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f0, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f1, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f2, i, GPIO_PULL_NONE);
+
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f0, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f1, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f1, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f2, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+	}
+
+	for (i = 0; i < f3_end; i++) {
+		/* set GPF3[0:3] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f3, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f3, i, GPIO_PULL_NONE);
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f3, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f3, i, GPIO_DRV_SLOW);
+	}
+
+	/* gpio pad configuration for LCD reset. */
+	s5p_gpio_cfg_pin(&gpio2->y4, 5, GPIO_OUTPUT);
+
+	spi_init();
+}
+
+static void reset_lcd(void)
+{
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 0);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(100);
+}
+
+static void lcd_power_on(void)
+{
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON);
+	pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
+}
+
+vidinfo_t panel_info = {
+	.vl_freq	= 60,
+	.vl_col		= 480,
+	.vl_row		= 800,
+	.vl_width	= 480,
+	.vl_height	= 800,
+	.vl_clkp	= CONFIG_SYS_HIGH,
+	.vl_hsp		= CONFIG_SYS_HIGH,
+	.vl_vsp		= CONFIG_SYS_HIGH,
+	.vl_dp		= CONFIG_SYS_HIGH,
+
+	.vl_bpix	= 5,	/* Bits per pixel */
+
+	/* LD9040 LCD Panel */
+	.vl_hspw	= 2,
+	.vl_hbpd	= 16,
+	.vl_hfpd	= 16,
+
+	.vl_vspw	= 2,
+	.vl_vbpd	= 8,
+	.vl_vfpd	= 8,
+	.vl_cmd_allow_len = 0xf,
+
+	.win_id		= 0,
+	.cfg_gpio	= lcd_cfg_gpio,
+	.backlight_on	= NULL,
+	.lcd_power_on	= lcd_power_on,
+	.reset_lcd	= reset_lcd,
+	.dual_lcd_enabled = 0,
+
+	.init_delay	= 0,
+	.power_on_delay = 10000,
+	.reset_delay	= 10000,
+	.interface_mode = FIMD_RGB_INTERFACE,
+	.mipi_enabled	= 0,
+};
+
+void init_panel_info(vidinfo_t *vid)
+{
+	vid->logo_on	= 1;
+	vid->resolution	= HD_RESOLUTION;
+	vid->rgb_mode	= MODE_RGB_P;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(vid);
+#endif
+
+	/* for LD9040. */
+	vid->pclk_name = 1;	/* MPLL */
+	vid->sclk_div = 1;
+
+	vid->cfg_ldo = ld9040_cfg_ldo;
+	vid->enable_ldo = ld9040_enable_ldo;
+
+	setenv("lcdinfo", "lcd=ld9040");
+}
+
 int board_init(void)
 {
 	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
@@ -326,6 +491,7 @@ int board_init(void)
 
 #if defined(CONFIG_PMIC)
 	pmic_init();
+	init_pmic_lcd();
 #endif
 #ifdef CONFIG_SOFT_SPI
 	soft_spi_init();
include/configs/s5pc210_universal.h +13 -0
index 54ee8c4..035c27f 100644
@@ -34,6 +34,7 @@
 #define CONFIG_S5P		1	/* which is in a S5P Family */
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
+#define CONFIG_TIZEN		1	/* TIZEN lib */
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -284,4 +285,16 @@ void universal_spi_sda(int bit);
 int universal_spi_read(void);
 #endif
 
+/*
+ * LCD Settings
+ */
+#define CONFIG_EXYNOS_FB
+#define CONFIG_LCD
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_32BPP
+#define CONFIG_LD9040
+#define CONFIG_EXYNOS_MIPI_DSIM
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((520 * 120 * 4) + (1 << 12))
+
 #endif	/* __CONFIG_H */
Signature · 1 line
1.7.5.4
#16 lore raw

v5 cover arm:exynos: Support for display drivers

In reply to Piotr Wilczek
Quoted 24 lines · Piotr Wilczek

This patchset add support for display on Universal C210 board. Software SPI support is added to universal C210.
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:
- code cleanup
Changes in v4:
- removed comment and unused struct
- removed patch with unused display control define
Changes in v5:
- add patch to support soft SPI on Universal_C210

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

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

applied to u-boot-samsung.

Thanks.
Minkyu Kang.

#17 lore raw

PATCH v4 2/4 drivers: video: Add ld9040 video driver

In reply to Piotr Wilczek

---
This patch depends on software SPI:
<[email protected]>

Changes in v2:
- none
Changes in v3:
- none
Changes in v4:
- removed comment and unused struct

 drivers/video/Makefile |    1 +
 drivers/video/ld9040.c |  144 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/ld9040.h       |   32 +++++++++++
 3 files changed, 177 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h
drivers/video/Makefile +1 -0
index ebb6da8..247b867 100644
@@ -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
drivers/video/ld9040.c new file +144 -0

144 lines not on this page · raw message

include/ld9040.h new file +32 -0
new file mode 100644
index 0000000..fe99390
@@ -0,0 +1,32 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <[email protected]>
+ *
+ * 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_ */
Signature · 1 line
1.7.5.4
#18 lore raw

PATCH v4 3/4 drivers: video: fix image position

In reply to Piotr Wilczek

This patch fixes image position on screen when images's height or width is biger than the lcd's.

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

 drivers/video/exynos_fb.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
drivers/video/exynos_fb.c +13 -2
index e31a0fd..d9a3f9a 100644
@@ -70,8 +70,19 @@ static void draw_logo(void)
 	int x, y;
 	ulong addr;
 
-	x = ((panel_width - panel_info.logo_width) >> 1);
-	y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	if (panel_width >= panel_info.logo_width) {
+		x = ((panel_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_height >= panel_info.logo_height) {
+		y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
 
 	addr = panel_info.logo_addr;
 	bmp_display(addr, x, y);
Signature · 1 line
1.7.5.4
#19 lore raw

PATCH v4 4/4 exynos4: universal_C210: add display support

In reply to Piotr Wilczek

This patch add support for display on Universal C210 board. Width of displyed logo must be not bigger than 480 pixel and is limited by width of the screen.
Tizen logo size is 520x120 pixels and should be resized.

---
Changes in v2:
- removed unnecessary function for fimd clock set;
- removed unnecessary return;
- moved init_pmic_lcd to CONFIG_PMIC Changes in v3:
- code cleanup
Changes in v4:
- none

 board/samsung/universal_c210/universal.c |  202 +++++++++++++++++++++++++++---
 include/configs/s5pc210_universal.h      |   13 ++
 2 files changed, 197 insertions(+), 18 deletions(-)
board/samsung/universal_c210/universal.c +184 -18
index 72999d9..f1ff299 100644
@@ -24,6 +24,7 @@
 
 #include <common.h>
 #include <spi.h>
+#include <lcd.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/arch/adc.h>
@@ -35,6 +36,8 @@
 #include <asm/arch/cpu.h>
 #include <max8998_pmic.h>
 #include <asm/arch/watchdog.h>
+#include <libtizen.h>
+#include <ld9040.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -54,24 +57,6 @@ static int get_hwrev(void)
 
 static void check_hw_revision(void);
 
-int board_init(void)
-{
-	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
-	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
-
-	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
-	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
-#if defined(CONFIG_PMIC)
-	pmic_init();
-#endif
-
-	check_hw_revision();
-	printf("HW Revision:\t0x%x\n", board_rev);
-
-	return 0;
-}
-
 int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
@@ -318,3 +303,184 @@ int  spi_cs_is_valid(unsigned int bus, unsigned int cs)
 	return bus == 0 && cs == 0;
 }
 #endif
+
+static void init_pmic_lcd(void)
+{
+	unsigned char val;
+	int ret = 0;
+
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	/* LDO7 1.8V */
+	val = 0x02; /* (1800 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO7, val);
+
+	/* LDO17 3.0V */
+	val = 0xe; /* (3000 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO17, val);
+
+	/* Disable unneeded regulators */
+	/*
+	 * ONOFF1
+	 * Buck1 ON, Buck2 OFF, Buck3 ON, Buck4 ON
+	 * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON
+	 */
+	val = 0xB9;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF1, val);
+
+	/* ONOFF2
+	 * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON,
+	 * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF
+	 */
+	val = 0x50;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF2, val);
+
+	/* ONOFF3
+	 * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF
+	 * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF
+	 */
+	val = 0x00;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF3, val);
+
+	if (ret)
+		puts("LCD pmic initialisation error!\n");
+}
+
+static void lcd_cfg_gpio(void)
+{
+	unsigned int i, f3_end = 4;
+
+	for (i = 0; i < 8; i++) {
+		/* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f0, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f1, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f2, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f0, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f1, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f2, i, GPIO_PULL_NONE);
+
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f0, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f1, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f1, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f2, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+	}
+
+	for (i = 0; i < f3_end; i++) {
+		/* set GPF3[0:3] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f3, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f3, i, GPIO_PULL_NONE);
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f3, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f3, i, GPIO_DRV_SLOW);
+	}
+
+	/* gpio pad configuration for LCD reset. */
+	s5p_gpio_cfg_pin(&gpio2->y4, 5, GPIO_OUTPUT);
+
+	spi_init();
+}
+
+static void reset_lcd(void)
+{
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 0);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(100);
+}
+
+static void lcd_power_on(void)
+{
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON);
+	pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
+}
+
+vidinfo_t panel_info = {
+	.vl_freq	= 60,
+	.vl_col		= 480,
+	.vl_row		= 800,
+	.vl_width	= 480,
+	.vl_height	= 800,
+	.vl_clkp	= CONFIG_SYS_HIGH,
+	.vl_hsp		= CONFIG_SYS_HIGH,
+	.vl_vsp		= CONFIG_SYS_HIGH,
+	.vl_dp		= CONFIG_SYS_HIGH,
+
+	.vl_bpix	= 5,	/* Bits per pixel */
+
+	/* LD9040 LCD Panel */
+	.vl_hspw	= 2,
+	.vl_hbpd	= 16,
+	.vl_hfpd	= 16,
+
+	.vl_vspw	= 2,
+	.vl_vbpd	= 8,
+	.vl_vfpd	= 8,
+	.vl_cmd_allow_len = 0xf,
+
+	.win_id		= 0,
+	.cfg_gpio	= lcd_cfg_gpio,
+	.backlight_on	= NULL,
+	.lcd_power_on	= lcd_power_on,
+	.reset_lcd	= reset_lcd,
+	.dual_lcd_enabled = 0,
+
+	.init_delay	= 0,
+	.power_on_delay = 10000,
+	.reset_delay	= 10000,
+	.interface_mode = FIMD_RGB_INTERFACE,
+	.mipi_enabled	= 0,
+};
+
+void init_panel_info(vidinfo_t *vid)
+{
+	vid->logo_on	= 1;
+	vid->resolution	= HD_RESOLUTION;
+	vid->rgb_mode	= MODE_RGB_P;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(vid);
+#endif
+
+	/* for LD9040. */
+	vid->pclk_name = 1;	/* MPLL */
+	vid->sclk_div = 1;
+
+	vid->cfg_ldo = ld9040_cfg_ldo;
+	vid->enable_ldo = ld9040_enable_ldo;
+
+	setenv("lcdinfo", "lcd=ld9040");
+}
+
+int board_init(void)
+{
+	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
+	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
+
+	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
+	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+#if defined(CONFIG_PMIC)
+	pmic_init();
+	init_pmic_lcd();
+#endif
+
+	check_hw_revision();
+	printf("HW Revision:\t0x%x\n", board_rev);
+
+	return 0;
+}
include/configs/s5pc210_universal.h +13 -0
index f7a7443..ca0989c 100644
@@ -34,6 +34,7 @@
 #define CONFIG_S5P		1	/* which is in a S5P Family */
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
+#define CONFIG_TIZEN		1	/* TIZEN lib */
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -283,4 +284,16 @@
 void soft_spi_init(void);
 #endif
 
+/*
+ * LCD Settings
+ */
+#define CONFIG_EXYNOS_FB
+#define CONFIG_LCD
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_32BPP
+#define CONFIG_LD9040
+#define CONFIG_EXYNOS_MIPI_DSIM
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((520 * 120 * 4) + (1 << 12))
+
 #endif	/* __CONFIG_H */
Signature · 1 line
1.7.5.4
#20 lore raw

PATCH v3 3/5 arm: exynos4: cpu: Add definition for display

In reply to Piotr Wilczek

Add EXYNOS4_DISPLAY_CONTROL definition

---
Changes in v2:
- removed definions for fimd.
Changes in v3:
- none.

 arch/arm/include/asm/arch-exynos/cpu.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-exynos/cpu.h +1 -0
index 2cd4ae1..5056b37 100644
@@ -54,6 +54,7 @@
 #define EXYNOS4_PWMTIMER_BASE		0x139D0000
 #define EXYNOS4_MODEM_BASE		0x13A00000
 #define EXYNOS4_USBPHY_CONTROL		0x10020704
+#define EXYNOS4_DISPLAY_CONTROL		0x10010210
 
 #define EXYNOS4_GPIO_PART4_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS4_DP_BASE			DEVICE_NOT_AVAILABLE
Signature · 1 line
1.7.5.4
#21 lore raw

PATCH v3 3/5 arm: exynos4: cpu: Add definition for display

Dear Piotr,

Quoted 19 lines · Piotr Wilczek

Add EXYNOS4_DISPLAY_CONTROL definition

---
Changes in v2:
- removed definions for fimd.
Changes in v3:
- none.

 arch/arm/include/asm/arch-exynos/cpu.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-exynos/cpu.h +0 -0
index 2cd4ae1..5056b37 100644

arch/arm/include/asm/arch-exynos/cpu.h line 57

Quoted 4 lines
arch/arm/include/asm/arch-exynos/cpu.h +1 -0
@@ -54,6 +54,7 @@
 #define EXYNOS4_PWMTIMER_BASE          0x139D0000
 #define EXYNOS4_MODEM_BASE             0x13A00000
 #define EXYNOS4_USBPHY_CONTROL         0x10020704
+#define EXYNOS4_DISPLAY_CONTROL                0x10010210

This define is not used.

Thanks.
Minkyu Kang.

Signature · 2 lines
from. prom.
www.promsoft.net
#22 lore raw

PATCH v3 3/5 arm: exynos4: cpu: Add definition for display

Dear Minkyu,

Quoted 28 lines

-----Original Message-----
From: Minkyu Kang [mailto:promsoft at gmail.com]
Sent: Thursday, September 27, 2012 2:21 AM
To: Piotr Wilczek
Cc: u-boot at lists.denx.de; Kyungmin Park; Donghwa Lee
Subject: Re: [U-Boot] [PATCH v3 3/5] arm: exynos4: cpu: Add definition for display

Dear Piotr,

Quoted 11 lines · Piotr Wilczek

Add EXYNOS4_DISPLAY_CONTROL definition

---
Changes in v2:
- removed definions for fimd.
Changes in v3:
- none.

Review

Quoted 4 lines
 arch/arm/include/asm/arch-exynos/cpu.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-exynos/cpu.h

Quoted 10 lines

arch/arm/include/asm/arch-exynos/cpu.h line 57

Quoted 8 lines

index 2cd4ae1..5056b37 100644

arch/arm/include/asm/arch-exynos/cpu.h +1 -0
@@ -54,6 +54,7 @@
 #define EXYNOS4_PWMTIMER_BASE          0x139D0000
 #define EXYNOS4_MODEM_BASE             0x13A00000
 #define EXYNOS4_USBPHY_CONTROL         0x10020704
+#define EXYNOS4_DISPLAY_CONTROL                0x10010210

This define is not used.

That is correct, thank you.

Quoted 6 lines

Thanks.
Minkyu Kang.
--
from. prom.
www.promsoft.net

Best regards,
Piotr Wilczek

#23 lore raw

PATCH v3 4/5 drivers: video: fix image position

In reply to Piotr Wilczek

This patch fixes image position on screen when images's height or width is biger then the lcd's.

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

 drivers/video/exynos_fb.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
drivers/video/exynos_fb.c +13 -2
index e31a0fd..d9a3f9a 100644
@@ -70,8 +70,19 @@ static void draw_logo(void)
 	int x, y;
 	ulong addr;
 
-	x = ((panel_width - panel_info.logo_width) >> 1);
-	y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	if (panel_width >= panel_info.logo_width) {
+		x = ((panel_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_height >= panel_info.logo_height) {
+		y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
 
 	addr = panel_info.logo_addr;
 	bmp_display(addr, x, y);
Signature · 1 line
1.7.5.4
#24 lore raw

PATCH v3 5/5 arm: exynos4: universal_C210: add display support

In reply to Piotr Wilczek

This patch add support for display on Universal C210 board. Width of displayed logo must be not bigger than 480 pixel and is limited by width of the screen.
Tizen logo size is 520x120 pixels should be reseized.

---
Changes in v2:
- removed unnecessary function for fimd clock set;
- removed unnecessary return;
- moved init_pmic_lcd to CONFIG_PMIC Changes in v3:
- code cleanup.

 board/samsung/universal_c210/universal.c |  202 +++++++++++++++++++++++++++---
 include/configs/s5pc210_universal.h      |   13 ++
 2 files changed, 197 insertions(+), 18 deletions(-)
board/samsung/universal_c210/universal.c +184 -18
index 72999d9..f1ff299 100644
@@ -24,6 +24,7 @@
 
 #include <common.h>
 #include <spi.h>
+#include <lcd.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/arch/adc.h>
@@ -35,6 +36,8 @@
 #include <asm/arch/cpu.h>
 #include <max8998_pmic.h>
 #include <asm/arch/watchdog.h>
+#include <libtizen.h>
+#include <ld9040.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -54,24 +57,6 @@ static int get_hwrev(void)
 
 static void check_hw_revision(void);
 
-int board_init(void)
-{
-	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
-	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
-
-	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
-	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
-#if defined(CONFIG_PMIC)
-	pmic_init();
-#endif
-
-	check_hw_revision();
-	printf("HW Revision:\t0x%x\n", board_rev);
-
-	return 0;
-}
-
 int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
@@ -318,3 +303,184 @@ int  spi_cs_is_valid(unsigned int bus, unsigned int cs)
 	return bus == 0 && cs == 0;
 }
 #endif
+
+static void init_pmic_lcd(void)
+{
+	unsigned char val;
+	int ret = 0;
+
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	/* LDO7 1.8V */
+	val = 0x02; /* (1800 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO7, val);
+
+	/* LDO17 3.0V */
+	val = 0xe; /* (3000 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO17, val);
+
+	/* Disable unneeded regulators */
+	/*
+	 * ONOFF1
+	 * Buck1 ON, Buck2 OFF, Buck3 ON, Buck4 ON
+	 * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON
+	 */
+	val = 0xB9;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF1, val);
+
+	/* ONOFF2
+	 * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON,
+	 * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF
+	 */
+	val = 0x50;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF2, val);
+
+	/* ONOFF3
+	 * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF
+	 * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF
+	 */
+	val = 0x00;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF3, val);
+
+	if (ret)
+		puts("LCD pmic initialisation error!\n");
+}
+
+static void lcd_cfg_gpio(void)
+{
+	unsigned int i, f3_end = 4;
+
+	for (i = 0; i < 8; i++) {
+		/* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f0, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f1, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f2, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f0, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f1, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f2, i, GPIO_PULL_NONE);
+
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f0, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f1, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f1, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f2, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+	}
+
+	for (i = 0; i < f3_end; i++) {
+		/* set GPF3[0:3] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f3, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f3, i, GPIO_PULL_NONE);
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f3, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f3, i, GPIO_DRV_SLOW);
+	}
+
+	/* gpio pad configuration for LCD reset. */
+	s5p_gpio_cfg_pin(&gpio2->y4, 5, GPIO_OUTPUT);
+
+	spi_init();
+}
+
+static void reset_lcd(void)
+{
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 0);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(100);
+}
+
+static void lcd_power_on(void)
+{
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON);
+	pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
+}
+
+vidinfo_t panel_info = {
+	.vl_freq	= 60,
+	.vl_col		= 480,
+	.vl_row		= 800,
+	.vl_width	= 480,
+	.vl_height	= 800,
+	.vl_clkp	= CONFIG_SYS_HIGH,
+	.vl_hsp		= CONFIG_SYS_HIGH,
+	.vl_vsp		= CONFIG_SYS_HIGH,
+	.vl_dp		= CONFIG_SYS_HIGH,
+
+	.vl_bpix	= 5,	/* Bits per pixel */
+
+	/* LD9040 LCD Panel */
+	.vl_hspw	= 2,
+	.vl_hbpd	= 16,
+	.vl_hfpd	= 16,
+
+	.vl_vspw	= 2,
+	.vl_vbpd	= 8,
+	.vl_vfpd	= 8,
+	.vl_cmd_allow_len = 0xf,
+
+	.win_id		= 0,
+	.cfg_gpio	= lcd_cfg_gpio,
+	.backlight_on	= NULL,
+	.lcd_power_on	= lcd_power_on,
+	.reset_lcd	= reset_lcd,
+	.dual_lcd_enabled = 0,
+
+	.init_delay	= 0,
+	.power_on_delay = 10000,
+	.reset_delay	= 10000,
+	.interface_mode = FIMD_RGB_INTERFACE,
+	.mipi_enabled	= 0,
+};
+
+void init_panel_info(vidinfo_t *vid)
+{
+	vid->logo_on	= 1;
+	vid->resolution	= HD_RESOLUTION;
+	vid->rgb_mode	= MODE_RGB_P;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(vid);
+#endif
+
+	/* for LD9040. */
+	vid->pclk_name = 1;	/* MPLL */
+	vid->sclk_div = 1;
+
+	vid->cfg_ldo = ld9040_cfg_ldo;
+	vid->enable_ldo = ld9040_enable_ldo;
+
+	setenv("lcdinfo", "lcd=ld9040");
+}
+
+int board_init(void)
+{
+	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
+	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
+
+	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
+	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+#if defined(CONFIG_PMIC)
+	pmic_init();
+	init_pmic_lcd();
+#endif
+
+	check_hw_revision();
+	printf("HW Revision:\t0x%x\n", board_rev);
+
+	return 0;
+}
include/configs/s5pc210_universal.h +13 -0
index f7a7443..ca0989c 100644
@@ -34,6 +34,7 @@
 #define CONFIG_S5P		1	/* which is in a S5P Family */
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
+#define CONFIG_TIZEN		1	/* TIZEN lib */
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -283,4 +284,16 @@
 void soft_spi_init(void);
 #endif
 
+/*
+ * LCD Settings
+ */
+#define CONFIG_EXYNOS_FB
+#define CONFIG_LCD
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_32BPP
+#define CONFIG_LD9040
+#define CONFIG_EXYNOS_MIPI_DSIM
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((520 * 120 * 4) + (1 << 12))
+
 #endif	/* __CONFIG_H */
Signature · 1 line
1.7.5.4
#25 lore raw

PATCH v2 2/5 drivers: video: Add ld9040 video driver

In reply to Piotr Wilczek

This patch add ld9040 video driver:

new file:   drivers/video/ld9040.c
new file:   include/ld9040.h
modified:   drivers/video/Makefile

This patch depends on software SPI:
<[email protected]>

Changes in v2:
- 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
drivers/video/Makefile +1 -0
index ebb6da8..247b867 100644
@@ -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
drivers/video/ld9040.c new file +147 -0

147 lines not on this page · raw message

include/ld9040.h new file +32 -0
new file mode 100644
index 0000000..fe99390
@@ -0,0 +1,32 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <[email protected]>
+ *
+ * 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_ */
Signature · 1 line
1.7.5.4
#26 lore raw

PATCH v2 2/5 drivers: video: Add ld9040 video driver

Add Mr.Lee to CC.

Quoted 226 lines · Piotr Wilczek

This patch add ld9040 video driver:

new file:   drivers/video/ld9040.c
new file:   include/ld9040.h
modified:   drivers/video/Makefile

This patch depends on software SPI:
<[email protected]>

Changes in v2:
- 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
drivers/video/Makefile +1 -0
index ebb6da8..247b867 100644
@@ -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
drivers/video/ld9040.c new file +147 -0
new file mode 100644
index 0000000..6e94086
@@ -0,0 +1,147 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <[email protected]>
+ *
+ * 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));
+}
include/ld9040.h new file +32 -0
new file mode 100644
index 0000000..fe99390
@@ -0,0 +1,32 @@
+/*
+ * ld9040 AMOLED LCD panel driver.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Donghwa Lee <[email protected]>
+ *
+ * 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_ */
#27 lore raw

PATCH v2 3/5 arm: exynos4: cpu: Add definition for display

In reply to Piotr Wilczek

Add EXYNOS4_DISPLAY_CONTROL definition

Changes in v2:
- removed definions for fimd.

---
 arch/arm/include/asm/arch-exynos/cpu.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-exynos/cpu.h +1 -0
index 2cd4ae1..5056b37 100644
@@ -54,6 +54,7 @@
 #define EXYNOS4_PWMTIMER_BASE		0x139D0000
 #define EXYNOS4_MODEM_BASE		0x13A00000
 #define EXYNOS4_USBPHY_CONTROL		0x10020704
+#define EXYNOS4_DISPLAY_CONTROL		0x10010210
 
 #define EXYNOS4_GPIO_PART4_BASE		DEVICE_NOT_AVAILABLE
 #define EXYNOS4_DP_BASE			DEVICE_NOT_AVAILABLE
Signature · 1 line
1.7.5.4
#28 lore raw

PATCH v2 4/5 drivers: video: fix image position

In reply to Piotr Wilczek

This patch fixes image position on screen when images's height or width is biger then the lcd's.

Changes in v2:
- none.

---
 drivers/video/exynos_fb.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
drivers/video/exynos_fb.c +13 -2
index e31a0fd..d9a3f9a 100644
@@ -70,8 +70,19 @@ static void draw_logo(void)
 	int x, y;
 	ulong addr;
 
-	x = ((panel_width - panel_info.logo_width) >> 1);
-	y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	if (panel_width >= panel_info.logo_width) {
+		x = ((panel_width - panel_info.logo_width) >> 1);
+	} else {
+		x = 0;
+		printf("Warning: image width is bigger than display width\n");
+	}
+
+	if (panel_height >= panel_info.logo_height) {
+		y = ((panel_height - panel_info.logo_height) >> 1) - 4;
+	} else {
+		y = 0;
+		printf("Warning: image height is bigger than display height\n");
+	}
 
 	addr = panel_info.logo_addr;
 	bmp_display(addr, x, y);
Signature · 1 line
1.7.5.4
#29 lore raw

PATCH v2 5/5 arm: exynos4: universal_C210: add display support

In reply to Piotr Wilczek

This patch add support for display on Universal C210 board. Width of displayed logo must be not bigger than 480 pixel and is limited by width of the screen.
Tizen logo size is 520x120 pixels should be reseized.

Changes in v2:
- removed unnecessary function for fimd clock set;
- removed unnecessary return;
- moved init_pmic_lcd to CONFIG_PMIC

---
 board/samsung/universal_c210/universal.c |  201 +++++++++++++++++++++++++++---
 include/configs/s5pc210_universal.h      |   13 ++
 2 files changed, 196 insertions(+), 18 deletions(-)
board/samsung/universal_c210/universal.c +183 -18
index 4a23b1c..5128bef 100644
@@ -23,6 +23,7 @@
  */
 
 #include <common.h>
+#include <lcd.h>
 #include <asm/io.h>
 #include <spi.h>
 #include <asm/arch/adc.h>
@@ -34,6 +35,8 @@
 #include <asm/arch/cpu.h>
 #include <max8998_pmic.h>
 #include <asm/arch/watchdog.h>
+#include <libtizen.h>
+#include <ld9040.h>
 #if defined(CONFIG_SOFT_SPI)
 # include <asm/gpio.h>
 #endif
@@ -56,24 +59,6 @@ static int get_hwrev(void)
 
 static void check_hw_revision(void);
 
-int board_init(void)
-{
-	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
-	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
-
-	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
-	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
-#if defined(CONFIG_PMIC)
-	pmic_init();
-#endif
-
-	check_hw_revision();
-	printf("HW Revision:\t0x%x\n", board_rev);
-
-	return 0;
-}
-
 int dram_init(void)
 {
 	gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
@@ -323,3 +308,183 @@ int  spi_cs_is_valid(unsigned int bus, unsigned int cs)
 	return bus == 0 && cs == 0;
 }
 
+static void init_pmic_lcd(void)
+{
+	unsigned char val;
+	int ret = 0;
+
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	/* LDO7 1.8V */
+	val = 0x02; /* (1800 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO7, val);
+
+	/* LDO17 3.0V */
+	val = 0xe; /* (3000 - 1600) / 100; */
+	ret |= pmic_reg_write(p,  MAX8998_REG_LDO17, val);
+
+	/* Disable unneeded regulators */
+	/*
+	 * ONOFF1
+	 * Buck1 ON, Buck2 OFF, Buck3 ON, Buck4 ON
+	 * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON
+	 */
+	val = 0xB9;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF1, val);
+
+	/* ONOFF2
+	 * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON,
+	 * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF
+	 */
+	val = 0x50;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF2, val);
+
+	/* ONOFF3
+	 * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF
+	 * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF
+	 */
+	val = 0x00;
+	ret |= pmic_reg_write(p,  MAX8998_REG_ONOFF3, val);
+
+	if (ret)
+		puts("LCD pmic initialisation error!\n");
+}
+
+static void lcd_cfg_gpio(void)
+{
+	unsigned int i, f3_end = 4;
+
+	for (i = 0; i < 8; i++) {
+		/* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f0, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f1, i, GPIO_FUNC(2));
+		s5p_gpio_cfg_pin(&gpio1->f2, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f0, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f1, i, GPIO_PULL_NONE);
+		s5p_gpio_set_pull(&gpio1->f2, i, GPIO_PULL_NONE);
+
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f0, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f1, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f1, i, GPIO_DRV_SLOW);
+		s5p_gpio_set_drv(&gpio1->f2, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f0, i, GPIO_DRV_SLOW);
+	}
+
+	for (i = 0; i < f3_end; i++) {
+		/* set GPF3[0:3] for RGB Interface and Data lines (32bit) */
+		s5p_gpio_cfg_pin(&gpio1->f3, i, GPIO_FUNC(2));
+		/* pull-up/down disable */
+		s5p_gpio_set_pull(&gpio1->f3, i, GPIO_PULL_NONE);
+		/* drive strength to max (24bit) */
+		s5p_gpio_set_drv(&gpio1->f3, i, GPIO_DRV_4X);
+		s5p_gpio_set_rate(&gpio1->f3, i, GPIO_DRV_SLOW);
+	}
+
+	/* gpio pad configuration for LCD reset. */
+	s5p_gpio_cfg_pin(&gpio2->y4, 5, GPIO_OUTPUT);
+
+	spi_init();
+}
+
+static void reset_lcd(void)
+{
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 0);
+	udelay(10000);
+	s5p_gpio_set_value(&gpio2->y4, 5, 1);
+	udelay(100);
+}
+
+static void lcd_power_on(void)
+{
+	struct pmic *p = get_pmic();
+
+	if (pmic_probe(p))
+		return;
+
+	pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON);
+	pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON);
+}
+
+vidinfo_t panel_info = {
+	.vl_freq	= 60,
+	.vl_col		= 480,
+	.vl_row		= 800,
+	.vl_width	= 480,
+	.vl_height	= 800,
+	.vl_clkp	= CONFIG_SYS_HIGH,
+	.vl_hsp		= CONFIG_SYS_HIGH,
+	.vl_vsp		= CONFIG_SYS_HIGH,
+	.vl_dp		= CONFIG_SYS_HIGH,
+
+	.vl_bpix	= 5,	/* Bits per pixel */
+
+	/* LD9040 LCD Panel */
+	.vl_hspw	= 2,
+	.vl_hbpd	= 16,
+	.vl_hfpd	= 16,
+
+	.vl_vspw	= 2,
+	.vl_vbpd	= 8,
+	.vl_vfpd	= 8,
+	.vl_cmd_allow_len = 0xf,
+
+	.win_id		= 0,
+	.cfg_gpio	= lcd_cfg_gpio,
+	.backlight_on	= NULL,
+	.lcd_power_on	= lcd_power_on,
+	.reset_lcd	= reset_lcd,
+	.dual_lcd_enabled = 0,
+
+	.init_delay	= 0,
+	.power_on_delay = 10000,
+	.reset_delay	= 10000,
+	.interface_mode = FIMD_RGB_INTERFACE,
+	.mipi_enabled	= 0,
+};
+
+void init_panel_info(vidinfo_t *vid)
+{
+	vid->logo_on	= 1;
+	vid->resolution	= HD_RESOLUTION;
+	vid->rgb_mode	= MODE_RGB_P;
+
+#ifdef CONFIG_TIZEN
+	get_tizen_logo_info(vid);
+#endif
+
+	/* for LD9040. */
+	vid->pclk_name = 1;	/* MPLL */
+	vid->sclk_div = 1;
+
+	vid->cfg_ldo = ld9040_cfg_ldo;
+	vid->enable_ldo = ld9040_enable_ldo;
+
+	setenv("lcdinfo", "lcd=ld9040");
+}
+
+int board_init(void)
+{
+	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
+	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
+
+	gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
+	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+
+#if defined(CONFIG_PMIC)
+	pmic_init();
+	init_pmic_lcd();
+#endif
+
+	check_hw_revision();
+	printf("HW Revision:\t0x%x\n", board_rev);
+
+	return 0;
+}
include/configs/s5pc210_universal.h +13 -0
index f7a7443..ca0989c 100644
@@ -34,6 +34,7 @@
 #define CONFIG_S5P		1	/* which is in a S5P Family */
 #define CONFIG_EXYNOS4210	1	/* which is in a EXYNOS4210 */
 #define CONFIG_UNIVERSAL	1	/* working with Universal */
+#define CONFIG_TIZEN		1	/* TIZEN lib */
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
@@ -283,4 +284,16 @@
 void soft_spi_init(void);
 #endif
 
+/*
+ * LCD Settings
+ */
+#define CONFIG_EXYNOS_FB
+#define CONFIG_LCD
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_32BPP
+#define CONFIG_LD9040
+#define CONFIG_EXYNOS_MIPI_DSIM
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((520 * 120 * 4) + (1 << 12))
+
 #endif	/* __CONFIG_H */
Signature · 1 line
1.7.5.4
#30 lore raw

v2 cover Exynos: Support for display drivers

In reply to Piotr Wilczek

Hi Piotr,

Could you add Mr.Kang to CC, plz?

Best Regards,
Jaehoon Chung

Quoted 28 lines · Piotr Wilczek

This patchset add support for display on Universal C210 board. Max8998 is modified to power on display, new driver ld9040 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

Piotr Wilczek (5):
misc:max8998 Add LDO macros
drivers: video: Add ld9040 video driver
arm: exynos4: cpu: Add definition for display
drivers: video: fix image position
arm: exynos4: universal_C210: add display support

 arch/arm/include/asm/arch-exynos/cpu.h   |    1 +
 board/samsung/universal_c210/universal.c |  201 +++++++++++++++++++++++++++---
 drivers/video/Makefile                   |    1 +
 drivers/video/exynos_fb.c                |   15 ++-
 drivers/video/ld9040.c                   |  147 ++++++++++++++++++++++
 include/configs/s5pc210_universal.h      |   13 ++
 include/ld9040.h                         |   32 +++++
 include/max8998_pmic.h                   |    2 +
 8 files changed, 392 insertions(+), 20 deletions(-)
 create mode 100644 drivers/video/ld9040.c
 create mode 100644 include/ld9040.h
#31 lore raw

v2 cover Exynos: Support for display drivers

Hi,

I will, of course.

Best regards,
Piotr Wilczek

Quoted 46 lines

-----Original Message-----
From: Jaehoon Chung [mailto:jh80.chung at samsung.com]
Sent: Thursday, September 20, 2012 11:56 AM
To: Piotr Wilczek
Cc: u-boot at lists.denx.de; Kyungmin Park; mk7.kang at samsung.com
Subject: Re: [U-Boot] [PATCH v2 0/5] Exynos: Support for display drivers

Hi Piotr,

Could you add Mr.Kang to CC, plz?

Best Regards,
Jaehoon Chung

Quoted 2 lines · Piotr Wilczek

This patchset add support for display on Universal C210 board. Max8998 is modified to power on display, new driver ld9040 and

support

Quoted 14 lines

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

Piotr Wilczek (5):
misc:max8998 Add LDO macros
drivers: video: Add ld9040 video driver
arm: exynos4: cpu: Add definition for display
drivers: video: fix image position
arm: exynos4: universal_C210: add display support

Quoted 2 lines
 arch/arm/include/asm/arch-exynos/cpu.h   |    1 +
 board/samsung/universal_c210/universal.c |  201

+++++++++++++++++++++++++++---

Quoted 3 lines
 drivers/video/Makefile                   |    1 +
 drivers/video/exynos_fb.c                |   15 ++-
 drivers/video/ld9040.c                   |  147

++++++++++++++++++++++

Quoted 6 lines
 include/configs/s5pc210_universal.h      |   13 ++
 include/ld9040.h                         |   32 +++++
 include/max8998_pmic.h                   |    2 +
 8 files changed, 392 insertions(+), 20 deletions(-)  create mode

100644 drivers/video/ld9040.c create mode 100644 include/ld9040.h