2011-03-29 06:32:59

by Marek Belisko

[permalink] [raw]
Subject: [PATCH 0/4] s3c2440: mini2440: Add missing code parts to be fully working with latest kernel.

Patch add new LCD panels with which was board produced. Also add touchscreen
support. Enabling LCD backlight during early booting stage also added.

Some code parts are collected or inspired from other code (authors are in CC).

Marek Belisko (4):
s3c2440: mini2440: Add support for new LCD panels.
s3c2440: mini2440: Add touchscreen support for mini2440.
s3c2440: mini2440: Select touchscreen by default.
s3c2440: mini2440: Enable the backlight LED earlier at boot time.

arch/arm/mach-s3c2410/include/mach/leds-gpio.h | 1 +
arch/arm/mach-s3c2440/Kconfig | 1 +
arch/arm/mach-s3c2440/mach-mini2440.c | 55 +++++++++++++++++++++++-
drivers/leds/leds-s3c24xx.c | 6 ++-
4 files changed, 60 insertions(+), 3 deletions(-)


2011-03-29 06:33:02

by Marek Belisko

[permalink] [raw]
Subject: [PATCH 1/4] s3c2440: mini2440: Add support for new LCD panels.

This patch add support for new mini2440 board LCD's:
3.5" TFT + TS (TD035STED4)
5.6" TFT (Innolux AT056TN52).
3.5" TFT + TS (SONY X35)

Values overtaken from mini2440 kernel:
git://repo.or.cz/linux-2.6/mini2440.git
and https://github.com/a1ien/mini2440-linux-kernel

Signed-off-by: Marek Belisko <[email protected]>
---
arch/arm/mach-s3c2440/mach-mini2440.c | 37 +++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
index dfedc9c..ce152b4 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -167,6 +167,43 @@ static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
.lcdcon5 = (S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_HWSWP),
},
+ [3] = { /* mini2440 + 3.5" TFT + TS -- New model as Nov 2009 "T35" */
+ _LCD_DECLARE(
+ 7, /* The 3.5 is quite fast */
+ 240, 21, 25, 6, /* x timing */
+ 320, 2, 4, 2, /* y timing */
+ 40), /* refresh rate */
+ .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
+ S3C2410_LCDCON5_INVVLINE |
+ S3C2410_LCDCON5_INVVFRAME |
+ S3C2410_LCDCON5_INVVDEN |
+ S3C2410_LCDCON5_PWREN),
+ },
+ [4] = { /* mini2440 + 5.6" TFT + touchscreen -- Innolux AT056TN52 */
+ /* be sure the "power" jumper is set accordingly ! */
+ _LCD_DECLARE(
+ 10, /* the 5.3" runs slower */
+ 640, 41, 68, 22, /* x timing */
+ 480, 26, 6, 2, /* y timing */
+ 40), /* refresh rate */
+ .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
+ S3C2410_LCDCON5_INVVLINE |
+ S3C2410_LCDCON5_INVVFRAME |
+ S3C2410_LCDCON5_PWREN),
+ },
+ [5] = { /* mini2440 + 3,5" TFT + touchscreen -- SONY X35 */
+ _LCD_DECLARE(
+ 7,
+ 240, 1, 26, 5, /* x timing */
+ 320, 1, 5, 9, /* y timing */
+ 60), /* refresh rate */
+ .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
+ S3C2410_LCDCON5_INVVDEN |
+ S3C2410_LCDCON5_INVVFRAME |
+ S3C2410_LCDCON5_INVVLINE |
+ S3C2410_LCDCON5_INVVCLK |
+ S3C2410_LCDCON5_HWSWP),
+ },
};

/* todo - put into gpio header */
--
1.7.1

2011-03-29 06:33:10

by Marek Belisko

[permalink] [raw]
Subject: [PATCH 4/4] s3c2440: mini2440: Enable the backlight LED earlier at boot time.

Code overtaken from:
http://repo.or.cz/w/linux-2.6/mini2440.git

Use flag that allows s3c24xx LED to start in the "on" state.
This is necesary to enable LCD backlight during early boot stage.

Signed-off-by: Marek Belisko <[email protected]>
Signed-off-by: Michel Pollet <[email protected]>
---
arch/arm/mach-s3c2410/include/mach/leds-gpio.h | 1 +
arch/arm/mach-s3c2440/mach-mini2440.c | 1 +
drivers/leds/leds-s3c24xx.c | 6 +++++-
3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-s3c2410/include/mach/leds-gpio.h b/arch/arm/mach-s3c2410/include/mach/leds-gpio.h
index d8a7672..c3ae81f 100644
--- a/arch/arm/mach-s3c2410/include/mach/leds-gpio.h
+++ b/arch/arm/mach-s3c2410/include/mach/leds-gpio.h
@@ -16,6 +16,7 @@

#define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */
#define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */
+#define S3C24XX_LEDF_STARTON (1<<2) /* Initialise 'on' */

struct s3c24xx_led_platdata {
unsigned int gpio;
diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
index 163d318..46f2034 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -451,6 +451,7 @@ static struct s3c24xx_led_platdata mini2440_led4_pdata = {
static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
.name = "backlight",
.gpio = S3C2410_GPG(4),
+ .flags = S3C24XX_LEDF_STARTON,
.def_trigger = "backlight",
};

diff --git a/drivers/leds/leds-s3c24xx.c b/drivers/leds/leds-s3c24xx.c
index a77771d..42d0a08 100644
--- a/drivers/leds/leds-s3c24xx.c
+++ b/drivers/leds/leds-s3c24xx.c
@@ -95,7 +95,11 @@ static int s3c24xx_led_probe(struct platform_device *dev)
s3c2410_gpio_cfgpin(pdata->gpio, S3C2410_GPIO_INPUT);
} else {
s3c2410_gpio_pullup(pdata->gpio, 0);
- s3c2410_gpio_setpin(pdata->gpio, 0);
+
+ if (pdata->flags & S3C24XX_LEDF_STARTON)
+ s3c2410_gpio_setpin(pdata->gpio, 1);
+ else
+ s3c2410_gpio_setpin(pdata->gpio, 0);
s3c2410_gpio_cfgpin(pdata->gpio, S3C2410_GPIO_OUTPUT);
}

--
1.7.1

2011-03-29 06:33:11

by Marek Belisko

[permalink] [raw]
Subject: [PATCH 3/4] s3c2440: mini2440: Select touchscreen by default.

Signed-off-by: Marek Belisko <[email protected]>
---
arch/arm/mach-s3c2440/Kconfig | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index 50825a3..e713eea 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -186,6 +186,7 @@ config MACH_MINI2440
select LEDS_TRIGGER_BACKLIGHT
select S3C_DEV_NAND
select S3C_DEV_USB_HOST
+ select TOUCHSCREEN_S3C2410
help
Say Y here to select support for the MINI2440. Is a 10cm x 10cm board
available via various sources. It can come with a 3.5" or 7" touch LCD.
--
1.7.1

2011-03-29 06:33:08

by Marek Belisko

[permalink] [raw]
Subject: [PATCH 2/4] s3c2440: mini2440: Add touchscreen support for mini2440.

Patch add support for mini2440 touchscreen.
Some code borrowed from:
git://repo.or.cz/linux-2.6/mini2440.git

Signed-off-by: Marek Belisko <[email protected]>
---
arch/arm/mach-s3c2440/mach-mini2440.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
index ce152b4..163d318 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -47,6 +47,7 @@
#include <plat/iic.h>
#include <plat/mci.h>
#include <plat/udc.h>
+#include <plat/ts.h>

#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
@@ -530,6 +531,11 @@ static struct platform_device uda1340_codec = {
.id = -1,
};

+static struct s3c2410_ts_mach_info mini2440_ts_cfg __initdata = {
+ .delay = 10000,
+ .presc = 0xff, /* slow as we can go */
+};
+
static struct platform_device *mini2440_devices[] __initdata = {
&s3c_device_ohci,
&s3c_device_wdt,
@@ -548,6 +554,7 @@ static struct platform_device *mini2440_devices[] __initdata = {
&uda1340_codec,
&mini2440_audio,
&samsung_asoc_dma,
+ &s3c_device_adc,
};

static void __init mini2440_map_io(void)
@@ -631,8 +638,13 @@ static void mini2440_parse_features(
features->done |= FEATURE_BACKLIGHT;
break;
case 't':
- printk(KERN_INFO "MINI2440: '%c' ignored, "
- "touchscreen not compiled in\n", f);
+ if (features->done & FEATURE_TOUCH)
+ printk(KERN_INFO "MINI2440: '%c' ignored, "
+ "touchscreen already set\n", f);
+ else
+ features->optional[features->count++] =
+ &s3c_device_ts;
+ features->done |= FEATURE_TOUCH;
break;
case 'c':
if (features->done & FEATURE_CAMERA)
@@ -699,6 +711,7 @@ static void __init mini2440_init(void)
s3c24xx_mci_set_platdata(&mini2440_mmc_cfg);
s3c_nand_set_platdata(&mini2440_nand_info);
s3c_i2c0_set_platdata(NULL);
+ s3c24xx_ts_set_platdata(&mini2440_ts_cfg);

i2c_register_board_info(0, mini2440_i2c_devs,
ARRAY_SIZE(mini2440_i2c_devs));
--
1.7.1

2011-03-29 07:20:21

by M P

[permalink] [raw]
Subject: Re: [PATCH 0/4] s3c2440: mini2440: Add missing code parts to be fully working with latest kernel.

On Tue, Mar 29, 2011 at 7:32 AM, Marek Belisko
<[email protected]> wrote:
> Patch add new LCD panels with which was board produced. Also add touchscreen
> support. Enabling LCD backlight during early booting stage also added.
>
> Some code parts are collected or inspired from other code (authors are in CC).

Actually, I'm not in CC, and most of this was from my own mini2440
tree on repo.or.cz, I'm also listed as maintainer at the bottom of the
mach-mini2440.c file.

Michael

> Marek Belisko (4):
> ?s3c2440: mini2440: Add support for new LCD panels.
> ?s3c2440: mini2440: Add touchscreen support for mini2440.
> ?s3c2440: mini2440: Select touchscreen by default.
> ?s3c2440: mini2440: Enable the backlight LED earlier at boot time.
>
> ?arch/arm/mach-s3c2410/include/mach/leds-gpio.h | ? ?1 +
> ?arch/arm/mach-s3c2440/Kconfig ? ? ? ? ? ? ? ? ?| ? ?1 +
> ?arch/arm/mach-s3c2440/mach-mini2440.c ? ? ? ? ?| ? 55 +++++++++++++++++++++++-
> ?drivers/leds/leds-s3c24xx.c ? ? ? ? ? ? ? ? ? ?| ? ?6 ++-
> ?4 files changed, 60 insertions(+), 3 deletions(-)
>
>

2011-03-29 07:23:14

by Belisko Marek

[permalink] [raw]
Subject: Re: [PATCH 0/4] s3c2440: mini2440: Add missing code parts to be fully working with latest kernel.

On Tue, Mar 29, 2011 at 9:20 AM, M P <[email protected]> wrote:
> On Tue, Mar 29, 2011 at 7:32 AM, Marek Belisko
> <[email protected]> wrote:
>> Patch add new LCD panels with which was board produced. Also add touchscreen
>> support. Enabling LCD backlight during early booting stage also added.
>>
>> Some code parts are collected or inspired from other code (authors are in CC).
>
> Actually, I'm not in CC, and most of this was from my own mini2440
> tree on repo.or.cz, I'm also listed as maintainer at the bottom of the
> mach-mini2440.c file.
If you were not on CC how you get this email? I don't care about maintainers at
the bottom of file. I just check get_maintainer.pl script.
>
> Michael
>
>> Marek Belisko (4):
>>  s3c2440: mini2440: Add support for new LCD panels.
>>  s3c2440: mini2440: Add touchscreen support for mini2440.
>>  s3c2440: mini2440: Select touchscreen by default.
>>  s3c2440: mini2440: Enable the backlight LED earlier at boot time.
>>
>>  arch/arm/mach-s3c2410/include/mach/leds-gpio.h |    1 +
>>  arch/arm/mach-s3c2440/Kconfig                  |    1 +
>>  arch/arm/mach-s3c2440/mach-mini2440.c          |   55 +++++++++++++++++++++++-
>>  drivers/leds/leds-s3c24xx.c                    |    6 ++-
>>  4 files changed, 60 insertions(+), 3 deletions(-)
>>
>>
>

regards,

marek

--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com

2011-03-29 08:51:44

by Vasily Khoruzhick

[permalink] [raw]
Subject: Re: [PATCH 4/4] s3c2440: mini2440: Enable the backlight LED earlier at boot time.

On Tuesday 29 March 2011 09:32:43 Marek Belisko wrote:
> Code overtaken from:
> http://repo.or.cz/w/linux-2.6/mini2440.git
>
> Use flag that allows s3c24xx LED to start in the "on" state.
> This is necesary to enable LCD backlight during early boot stage.

Why are you still using leds-s3c24xx driver? mini2440 should work OK with
leds-gpio. Anyway, looks like patch should be splitted into 2 patches: first
adds flag to leds-s3c24xx driver, second enables this flag for mini2440.

Regards
Vasily

> Signed-off-by: Marek Belisko <[email protected]>
> Signed-off-by: Michel Pollet <[email protected]>
> ---
> arch/arm/mach-s3c2410/include/mach/leds-gpio.h | 1 +
> arch/arm/mach-s3c2440/mach-mini2440.c | 1 +
> drivers/leds/leds-s3c24xx.c | 6 +++++-
> 3 files changed, 7 insertions(+), 1 deletions(-)

2011-03-29 08:55:58

by Belisko Marek

[permalink] [raw]
Subject: Re: [PATCH 4/4] s3c2440: mini2440: Enable the backlight LED earlier at boot time.

On Tue, Mar 29, 2011 at 10:50 AM, Vasily Khoruzhick <[email protected]> wrote:
> On Tuesday 29 March 2011 09:32:43 Marek Belisko wrote:
>> Code overtaken from:
>> http://repo.or.cz/w/linux-2.6/mini2440.git
>>
>> Use flag that allows s3c24xx LED to start in the "on" state.
>> This is necesary to enable LCD backlight during early boot stage.
>
> Why are you still using leds-s3c24xx driver? mini2440 should work OK with
> leds-gpio. Anyway, looks like patch should be splitted into 2 patches: first
> adds flag to leds-s3c24xx driver, second enables this flag for mini2440.
Right with leds-gpio I can use .default_state = LEDS_GPIO_DEFSTATE_ON,
which is same like implemented in this patch. Will change and resend.
Thanks for hint.
>
> Regards
> Vasily
>
>> Signed-off-by: Marek Belisko <[email protected]>
>> Signed-off-by: Michel Pollet <[email protected]>
>> ---
>>  arch/arm/mach-s3c2410/include/mach/leds-gpio.h |    1 +
>>  arch/arm/mach-s3c2440/mach-mini2440.c          |    1 +
>>  drivers/leds/leds-s3c24xx.c                    |    6 +++++-
>>  3 files changed, 7 insertions(+), 1 deletions(-)
>

regards,

marek

--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com

2011-03-29 09:53:17

by Marek Belisko

[permalink] [raw]
Subject: [PATCH] s3c2440: mini2440: Use leds-gpio driver for board leds handling.

Intention of this patch is convert existing usage of leds-s3c24xx driver
to use generic gpio-leds driver. Leds are separated to 2 devices.
First device handle 4 available leds. Second device is used to drive
LCD backlight. Backlight can be controlled via parameter b so we need
separate device which is registered or not depending on parameter.

Signed-off-by: Marek Belisko <[email protected]>
---
arch/arm/mach-s3c2440/mach-mini2440.c | 121 +++++++++++++++------------------
1 files changed, 54 insertions(+), 67 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
index 163d318..28ef6eb 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -419,81 +419,71 @@ static struct platform_device mini2440_button_device = {
};

/* LEDS */
-
-static struct s3c24xx_led_platdata mini2440_led1_pdata = {
- .name = "led1",
- .gpio = S3C2410_GPB(5),
- .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
- .def_trigger = "heartbeat",
-};
-
-static struct s3c24xx_led_platdata mini2440_led2_pdata = {
- .name = "led2",
- .gpio = S3C2410_GPB(6),
- .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
- .def_trigger = "nand-disk",
-};
-
-static struct s3c24xx_led_platdata mini2440_led3_pdata = {
- .name = "led3",
- .gpio = S3C2410_GPB(7),
- .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
- .def_trigger = "mmc0",
-};
-
-static struct s3c24xx_led_platdata mini2440_led4_pdata = {
- .name = "led4",
- .gpio = S3C2410_GPB(8),
- .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
- .def_trigger = "",
-};
-
-static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
- .name = "backlight",
- .gpio = S3C2410_GPG(4),
- .def_trigger = "backlight",
+static struct gpio_led gpio_leds[] = {
+ {
+ .name = "led1",
+ .gpio = S3C2410_GPB(5),
+ .active_low = 1,
+ .default_trigger = "heartbeat",
+ },
+ {
+ .name = "led2",
+ .gpio = S3C2410_GPB(6),
+ .active_low = 1,
+ .default_trigger = "nand-disk",
+ .default_state = LEDS_GPIO_DEFSTATE_OFF,
+ },
+ {
+ .name = "led3",
+ .gpio = S3C2410_GPB(7),
+ .active_low = 1,
+ .default_trigger = "mmc0",
+ .default_state = LEDS_GPIO_DEFSTATE_OFF,
+ },
+ {
+ .name = "led4",
+ .gpio = S3C2410_GPB(8),
+ .active_low = 1,
+ .default_trigger = "none",
+ .default_state = LEDS_GPIO_DEFSTATE_OFF,
+ }
};

-static struct platform_device mini2440_led1 = {
- .name = "s3c24xx_led",
- .id = 1,
- .dev = {
- .platform_data = &mini2440_led1_pdata,
- },
+static struct gpio_led backlight_led[] = {
+ {
+ .name = "backlight",
+ .gpio = S3C2410_GPG(4),
+ .active_low = 0,
+ .default_trigger = "backlight",
+ .default_state = LEDS_GPIO_DEFSTATE_ON,
+ }
};

-static struct platform_device mini2440_led2 = {
- .name = "s3c24xx_led",
- .id = 2,
- .dev = {
- .platform_data = &mini2440_led2_pdata,
- },
+static struct gpio_led_platform_data gpio_led_info = {
+ .leds = gpio_leds,
+ .num_leds = ARRAY_SIZE(gpio_leds),
};

-static struct platform_device mini2440_led3 = {
- .name = "s3c24xx_led",
- .id = 3,
- .dev = {
- .platform_data = &mini2440_led3_pdata,
- },
+static struct gpio_led_platform_data backlight_info = {
+ .leds = backlight_led,
+ .num_leds = ARRAY_SIZE(backlight_led),
};

-static struct platform_device mini2440_led4 = {
- .name = "s3c24xx_led",
- .id = 4,
- .dev = {
- .platform_data = &mini2440_led4_pdata,
- },
+static struct platform_device mini2440_leds = {
+ .name = "leds-gpio",
+ .id = 0,
+ .dev = {
+ .platform_data = &gpio_led_info,
+ }
};

static struct platform_device mini2440_led_backlight = {
- .name = "s3c24xx_led",
- .id = 5,
- .dev = {
- .platform_data = &mini2440_led_backlight_pdata,
- },
+ .name = "leds-gpio",
+ .id = 1,
+ .dev = {
+ .platform_data = &backlight_info,
+ }
};
-
/* AUDIO */

static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
@@ -543,10 +533,7 @@ static struct platform_device *mini2440_devices[] __initdata = {
&s3c_device_rtc,
&s3c_device_usbgadget,
&mini2440_device_eth,
- &mini2440_led1,
- &mini2440_led2,
- &mini2440_led3,
- &mini2440_led4,
+ &mini2440_leds,
&mini2440_button_device,
&s3c_device_nand,
&s3c_device_sdi,
--
1.7.1

2011-03-29 09:59:17

by Belisko Marek

[permalink] [raw]
Subject: Re: [PATCH] s3c2440: mini2440: Use leds-gpio driver for board leds handling.

This should be in-reply-to https://lkml.org/lkml/2011/3/29/79 comments

On Tue, Mar 29, 2011 at 11:53 AM, Marek Belisko
<[email protected]> wrote:
> Intention of this patch is convert existing usage of leds-s3c24xx driver
> to use generic gpio-leds driver. Leds are separated to 2 devices.
> First device handle 4 available leds. Second device is used to drive
> LCD backlight. Backlight can be controlled via parameter b so we need
> separate device which is registered or not depending on parameter.
>
> Signed-off-by: Marek Belisko <[email protected]>
> ---
>  arch/arm/mach-s3c2440/mach-mini2440.c |  121 +++++++++++++++------------------
>  1 files changed, 54 insertions(+), 67 deletions(-)
>
> diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
> index 163d318..28ef6eb 100644
> --- a/arch/arm/mach-s3c2440/mach-mini2440.c
> +++ b/arch/arm/mach-s3c2440/mach-mini2440.c
> @@ -419,81 +419,71 @@ static struct platform_device mini2440_button_device = {
>  };
>
>  /* LEDS */
> -
> -static struct s3c24xx_led_platdata mini2440_led1_pdata = {
> -       .name           = "led1",
> -       .gpio           = S3C2410_GPB(5),
> -       .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
> -       .def_trigger    = "heartbeat",
> -};
> -
> -static struct s3c24xx_led_platdata mini2440_led2_pdata = {
> -       .name           = "led2",
> -       .gpio           = S3C2410_GPB(6),
> -       .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
> -       .def_trigger    = "nand-disk",
> -};
> -
> -static struct s3c24xx_led_platdata mini2440_led3_pdata = {
> -       .name           = "led3",
> -       .gpio           = S3C2410_GPB(7),
> -       .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
> -       .def_trigger    = "mmc0",
> -};
> -
> -static struct s3c24xx_led_platdata mini2440_led4_pdata = {
> -       .name           = "led4",
> -       .gpio           = S3C2410_GPB(8),
> -       .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
> -       .def_trigger    = "",
> -};
> -
> -static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
> -       .name           = "backlight",
> -       .gpio           = S3C2410_GPG(4),
> -       .def_trigger    = "backlight",
> +static struct gpio_led gpio_leds[] = {
> +       {
> +               .name                   = "led1",
> +               .gpio                   = S3C2410_GPB(5),
> +               .active_low             = 1,
> +               .default_trigger        = "heartbeat",
> +       },
> +       {
> +               .name                   = "led2",
> +               .gpio                   = S3C2410_GPB(6),
> +               .active_low             = 1,
> +               .default_trigger        = "nand-disk",
> +               .default_state          = LEDS_GPIO_DEFSTATE_OFF,
> +       },
> +       {
> +               .name                   = "led3",
> +               .gpio                   = S3C2410_GPB(7),
> +               .active_low             = 1,
> +               .default_trigger        = "mmc0",
> +               .default_state          = LEDS_GPIO_DEFSTATE_OFF,
> +       },
> +       {
> +               .name                   = "led4",
> +               .gpio                   = S3C2410_GPB(8),
> +               .active_low             = 1,
> +               .default_trigger        = "none",
> +               .default_state          = LEDS_GPIO_DEFSTATE_OFF,
> +       }
>  };
>
> -static struct platform_device mini2440_led1 = {
> -       .name           = "s3c24xx_led",
> -       .id             = 1,
> -       .dev            = {
> -               .platform_data  = &mini2440_led1_pdata,
> -       },
> +static struct gpio_led backlight_led[] = {
> +       {
> +               .name                   = "backlight",
> +               .gpio                   = S3C2410_GPG(4),
> +               .active_low             = 0,
> +               .default_trigger        = "backlight",
> +               .default_state          = LEDS_GPIO_DEFSTATE_ON,
> +       }
>  };
>
> -static struct platform_device mini2440_led2 = {
> -       .name           = "s3c24xx_led",
> -       .id             = 2,
> -       .dev            = {
> -               .platform_data  = &mini2440_led2_pdata,
> -       },
> +static struct gpio_led_platform_data gpio_led_info = {
> +       .leds           = gpio_leds,
> +       .num_leds       = ARRAY_SIZE(gpio_leds),
>  };
>
> -static struct platform_device mini2440_led3 = {
> -       .name           = "s3c24xx_led",
> -       .id             = 3,
> -       .dev            = {
> -               .platform_data  = &mini2440_led3_pdata,
> -       },
> +static struct gpio_led_platform_data backlight_info = {
> +       .leds           = backlight_led,
> +       .num_leds       = ARRAY_SIZE(backlight_led),
>  };
>
> -static struct platform_device mini2440_led4 = {
> -       .name           = "s3c24xx_led",
> -       .id             = 4,
> -       .dev            = {
> -               .platform_data  = &mini2440_led4_pdata,
> -       },
> +static struct platform_device mini2440_leds = {
> +       .name   = "leds-gpio",
> +       .id     = 0,
> +       .dev    = {
> +               .platform_data  = &gpio_led_info,
> +       }
>  };
>
>  static struct platform_device mini2440_led_backlight = {
> -       .name           = "s3c24xx_led",
> -       .id             = 5,
> -       .dev            = {
> -               .platform_data  = &mini2440_led_backlight_pdata,
> -       },
> +       .name   = "leds-gpio",
> +       .id     = 1,
> +       .dev    = {
> +               .platform_data  = &backlight_info,
> +       }
>  };
> -
>  /* AUDIO */
>
>  static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
> @@ -543,10 +533,7 @@ static struct platform_device *mini2440_devices[] __initdata = {
>        &s3c_device_rtc,
>        &s3c_device_usbgadget,
>        &mini2440_device_eth,
> -       &mini2440_led1,
> -       &mini2440_led2,
> -       &mini2440_led3,
> -       &mini2440_led4,
> +       &mini2440_leds,
>        &mini2440_button_device,
>        &s3c_device_nand,
>        &s3c_device_sdi,
> --
> 1.7.1
>
>

regards,

marek

--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2011-03-29 12:59:33

by Vasily Khoruzhick

[permalink] [raw]
Subject: Re: [PATCH] s3c2440: mini2440: Use leds-gpio driver for board leds handling.

On Tuesday 29 March 2011 12:53:00 Marek Belisko wrote:
> Intention of this patch is convert existing usage of leds-s3c24xx driver
> to use generic gpio-leds driver. Leds are separated to 2 devices.
> First device handle 4 available leds. Second device is used to drive
> LCD backlight. Backlight can be controlled via parameter b so we need
> separate device which is registered or not depending on parameter.
>
> Signed-off-by: Marek Belisko <[email protected]>

You also need to remove mach/leds-gpio.h include, you don't need it anymore,
right? Rest part looks good for me.

Regards
Vasily