* [PATCH 1/2] ARM: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes
@ 2010-11-08 20:31 Vasily Khoruzhick
2010-11-08 20:31 ` [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes Vasily Khoruzhick
2010-11-16 9:20 ` [PATCH 1/2] ARM: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes Kukjin Kim
0 siblings, 2 replies; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-11-08 20:31 UTC (permalink / raw)
To: linux-arm-kernel
Replace in s3c_gpio_cfgpull with s3c_gpio_setpull.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
arch/arm/mach-s3c2410/h1940-bluetooth.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 8aa2f19..6b86a72 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -77,13 +77,13 @@ static int __devinit h1940bt_probe(struct platform_device *pdev)
/* Configures BT serial port GPIOs */
s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
- s3c_gpio_cfgpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
+ s3c_gpio_setpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT);
- s3c_gpio_cfgpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
+ s3c_gpio_setpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0);
- s3c_gpio_cfgpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
+ s3c_gpio_setpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
- s3c_gpio_cfgpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
+ s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
--
1.7.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes
2010-11-08 20:31 [PATCH 1/2] ARM: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes Vasily Khoruzhick
@ 2010-11-08 20:31 ` Vasily Khoruzhick
2010-11-15 3:55 ` Kukjin Kim
` (2 more replies)
2010-11-16 9:20 ` [PATCH 1/2] ARM: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes Kukjin Kim
1 sibling, 3 replies; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-11-08 20:31 UTC (permalink / raw)
To: linux-arm-kernel
Latch API was converted to gpiolib API as result we got this compile
error:
drivers/leds/leds-h1940.c: In function 'h1940_greenled_set':
drivers/leds/leds-h1940.c:33: error: implicit declaration of function
'h1940_latch_control
Adapt h1940-leds driver to new changes and fix compile issue.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
drivers/leds/leds-h1940.c | 67 ++++++++++++++++++++++++++++++++-------------
1 files changed, 48 insertions(+), 19 deletions(-)
diff --git a/drivers/leds/leds-h1940.c b/drivers/leds/leds-h1940.c
index 173d104..d9c2729 100644
--- a/drivers/leds/leds-h1940.c
+++ b/drivers/leds/leds-h1940.c
@@ -30,18 +30,18 @@ static void h1940_greenled_set(struct led_classdev *led_dev,
{
switch (value) {
case LED_HALF:
- h1940_latch_control(0, H1940_LATCH_LED_FLASH);
- s3c2410_gpio_setpin(S3C2410_GPA7, 1);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+ gpio_set_value(S3C2410_GPA(7), 1);
break;
case LED_FULL:
- h1940_latch_control(0, H1940_LATCH_LED_GREEN);
- s3c2410_gpio_setpin(S3C2410_GPA7, 1);
+ gpio_set_value(H1940_LATCH_LED_GREEN, 1);
+ gpio_set_value(S3C2410_GPA(7), 1);
break;
default:
case LED_OFF:
- h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
- h1940_latch_control(H1940_LATCH_LED_GREEN, 0);
- s3c2410_gpio_setpin(S3C2410_GPA7, 0);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+ gpio_set_value(H1940_LATCH_LED_GREEN, 0);
+ gpio_set_value(S3C2410_GPA(7), 0);
break;
}
}
@@ -60,18 +60,18 @@ static void h1940_redled_set(struct led_classdev *led_dev,
{
switch (value) {
case LED_HALF:
- h1940_latch_control(0, H1940_LATCH_LED_FLASH);
- s3c2410_gpio_setpin(S3C2410_GPA1, 1);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+ gpio_set_value(S3C2410_GPA(1), 1);
break;
case LED_FULL:
- h1940_latch_control(0, H1940_LATCH_LED_RED);
- s3c2410_gpio_setpin(S3C2410_GPA1, 1);
+ gpio_set_value(H1940_LATCH_LED_RED, 1);
+ gpio_set_value(S3C2410_GPA(1), 1);
break;
default:
case LED_OFF:
- h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
- h1940_latch_control(H1940_LATCH_LED_RED, 0);
- s3c2410_gpio_setpin(S3C2410_GPA1, 0);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+ gpio_set_value(H1940_LATCH_LED_RED, 0);
+ gpio_set_value(S3C2410_GPA(1), 0);
break;
}
}
@@ -91,11 +91,11 @@ static void h1940_blueled_set(struct led_classdev *led_dev,
{
if (value) {
/* flashing Blue */
- h1940_latch_control(0, H1940_LATCH_LED_FLASH);
- s3c2410_gpio_setpin(S3C2410_GPA3, 1);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 1);
+ gpio_set_value(S3C2410_GPA(3), 1);
} else {
- h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
- s3c2410_gpio_setpin(S3C2410_GPA3, 0);
+ gpio_set_value(H1940_LATCH_LED_FLASH, 0);
+ gpio_set_value(S3C2410_GPA(3), 0);
}
}
@@ -108,7 +108,24 @@ static struct led_classdev h1940_blueled = {
static int __devinit h1940leds_probe(struct platform_device *pdev)
{
- int ret;
+ int ret, gpioidx = 0;
+ int led_gpios[] = {
+ H1940_LATCH_LED_GREEN,
+ H1940_LATCH_LED_RED,
+ H1940_LATCH_LED_FLASH,
+ S3C2410_GPA(1),
+ S3C2410_GPA(3),
+ S3C2410_GPA(7),
+ };
+
+ for (gpioidx = 0; gpioidx < ARRAY_SIZE(led_gpios); gpioidx++) {
+ ret = gpio_request(led_gpios[gpioidx], "h1940 leds");
+ if (ret < 0)
+ goto err_gpio;
+ ret = gpio_direction_output(led_gpios[gpioidx], 0);
+ if (ret < 0)
+ goto err_gpio;
+ }
ret = led_classdev_register(&pdev->dev, &h1940_greenled);
if (ret)
@@ -129,6 +146,10 @@ err_blue:
err_red:
led_classdev_unregister(&h1940_greenled);
err_green:
+err_gpio:
+ while (--gpioidx >= 0)
+ gpio_free(led_gpios[gpioidx]);
+
return ret;
}
@@ -137,6 +158,14 @@ static int h1940leds_remove(struct platform_device *pdev)
led_classdev_unregister(&h1940_greenled);
led_classdev_unregister(&h1940_redled);
led_classdev_unregister(&h1940_blueled);
+
+ gpio_free(H1940_LATCH_LED_GREEN);
+ gpio_free(H1940_LATCH_LED_RED);
+ gpio_free(H1940_LATCH_LED_FLASH);
+ gpio_free(S3C2410_GPA(1));
+ gpio_free(S3C2410_GPA(3));
+ gpio_free(S3C2410_GPA(7));
+
return 0;
}
--
1.7.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes
2010-11-08 20:31 ` [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes Vasily Khoruzhick
@ 2010-11-15 3:55 ` Kukjin Kim
2010-11-16 23:12 ` Ben Dooks
2010-12-06 16:43 ` Vasily Khoruzhick
2 siblings, 0 replies; 7+ messages in thread
From: Kukjin Kim @ 2010-11-15 3:55 UTC (permalink / raw)
To: linux-arm-kernel
Hi Richard,
On Monday 08 November 2010 09:15:55 Kukjin Kim wrote:
> Now, happens following build error due to commit
> 14477095abc661a9f195ca4733bb739c54794b32 'ARM: h1940: Use gpiolib for
latch
> access' with s3c2410_defconfig.
>
> drivers/leds/leds-h1940.c: In function 'h1940_greenled_set':
> drivers/leds/leds-h1940.c:33: error: implicit declaration of function
> 'h1940_latch_control'
>
> The h1940_greenled_set(), h1940_redled_set(), and h1940_blueled_set() in
> drivers/leds/leds-h1940.c call h1940_latch_control()...
Please check below Vasily's patch about above error.
And as a note, latest Linus' tree has following error with
s3c2410_defconfig.
drivers/built-in.o: In function `led_trigger_set':
drivers/leds/led-triggers.c:116: undefined reference to `led_brightness_set'
make: *** [.tmp_vmlinux1] Error 1
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
Vasily Khoruzhick wrote:
>
> Latch API was converted to gpiolib API as result we got this compile
> error:
>
> drivers/leds/leds-h1940.c: In function 'h1940_greenled_set':
> drivers/leds/leds-h1940.c:33: error: implicit declaration of function
> 'h1940_latch_control
>
> Adapt h1940-leds driver to new changes and fix compile issue.
>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
> drivers/leds/leds-h1940.c | 67
++++++++++++++++++++++++++++++++-----------
> --
> 1 files changed, 48 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/leds/leds-h1940.c b/drivers/leds/leds-h1940.c
> index 173d104..d9c2729 100644
> --- a/drivers/leds/leds-h1940.c
> +++ b/drivers/leds/leds-h1940.c
> @@ -30,18 +30,18 @@ static void h1940_greenled_set(struct led_classdev
> *led_dev,
> {
> switch (value) {
> case LED_HALF:
> - h1940_latch_control(0, H1940_LATCH_LED_FLASH);
> - s3c2410_gpio_setpin(S3C2410_GPA7, 1);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 1);
> + gpio_set_value(S3C2410_GPA(7), 1);
> break;
> case LED_FULL:
> - h1940_latch_control(0, H1940_LATCH_LED_GREEN);
> - s3c2410_gpio_setpin(S3C2410_GPA7, 1);
> + gpio_set_value(H1940_LATCH_LED_GREEN, 1);
> + gpio_set_value(S3C2410_GPA(7), 1);
> break;
> default:
> case LED_OFF:
> - h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
> - h1940_latch_control(H1940_LATCH_LED_GREEN, 0);
> - s3c2410_gpio_setpin(S3C2410_GPA7, 0);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 0);
> + gpio_set_value(H1940_LATCH_LED_GREEN, 0);
> + gpio_set_value(S3C2410_GPA(7), 0);
> break;
> }
> }
> @@ -60,18 +60,18 @@ static void h1940_redled_set(struct led_classdev
*led_dev,
> {
> switch (value) {
> case LED_HALF:
> - h1940_latch_control(0, H1940_LATCH_LED_FLASH);
> - s3c2410_gpio_setpin(S3C2410_GPA1, 1);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 1);
> + gpio_set_value(S3C2410_GPA(1), 1);
> break;
> case LED_FULL:
> - h1940_latch_control(0, H1940_LATCH_LED_RED);
> - s3c2410_gpio_setpin(S3C2410_GPA1, 1);
> + gpio_set_value(H1940_LATCH_LED_RED, 1);
> + gpio_set_value(S3C2410_GPA(1), 1);
> break;
> default:
> case LED_OFF:
> - h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
> - h1940_latch_control(H1940_LATCH_LED_RED, 0);
> - s3c2410_gpio_setpin(S3C2410_GPA1, 0);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 0);
> + gpio_set_value(H1940_LATCH_LED_RED, 0);
> + gpio_set_value(S3C2410_GPA(1), 0);
> break;
> }
> }
> @@ -91,11 +91,11 @@ static void h1940_blueled_set(struct led_classdev
> *led_dev,
> {
> if (value) {
> /* flashing Blue */
> - h1940_latch_control(0, H1940_LATCH_LED_FLASH);
> - s3c2410_gpio_setpin(S3C2410_GPA3, 1);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 1);
> + gpio_set_value(S3C2410_GPA(3), 1);
> } else {
> - h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
> - s3c2410_gpio_setpin(S3C2410_GPA3, 0);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 0);
> + gpio_set_value(S3C2410_GPA(3), 0);
> }
>
> }
> @@ -108,7 +108,24 @@ static struct led_classdev h1940_blueled = {
>
> static int __devinit h1940leds_probe(struct platform_device *pdev)
> {
> - int ret;
> + int ret, gpioidx = 0;
> + int led_gpios[] = {
> + H1940_LATCH_LED_GREEN,
> + H1940_LATCH_LED_RED,
> + H1940_LATCH_LED_FLASH,
> + S3C2410_GPA(1),
> + S3C2410_GPA(3),
> + S3C2410_GPA(7),
> + };
> +
> + for (gpioidx = 0; gpioidx < ARRAY_SIZE(led_gpios); gpioidx++) {
> + ret = gpio_request(led_gpios[gpioidx], "h1940 leds");
> + if (ret < 0)
> + goto err_gpio;
> + ret = gpio_direction_output(led_gpios[gpioidx], 0);
> + if (ret < 0)
> + goto err_gpio;
> + }
>
> ret = led_classdev_register(&pdev->dev, &h1940_greenled);
> if (ret)
> @@ -129,6 +146,10 @@ err_blue:
> err_red:
> led_classdev_unregister(&h1940_greenled);
> err_green:
> +err_gpio:
> + while (--gpioidx >= 0)
> + gpio_free(led_gpios[gpioidx]);
> +
> return ret;
> }
>
> @@ -137,6 +158,14 @@ static int h1940leds_remove(struct platform_device
*pdev)
> led_classdev_unregister(&h1940_greenled);
> led_classdev_unregister(&h1940_redled);
> led_classdev_unregister(&h1940_blueled);
> +
> + gpio_free(H1940_LATCH_LED_GREEN);
> + gpio_free(H1940_LATCH_LED_RED);
> + gpio_free(H1940_LATCH_LED_FLASH);
> + gpio_free(S3C2410_GPA(1));
> + gpio_free(S3C2410_GPA(3));
> + gpio_free(S3C2410_GPA(7));
> +
> return 0;
> }
>
> --
> 1.7.3.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ARM: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes
2010-11-08 20:31 [PATCH 1/2] ARM: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes Vasily Khoruzhick
2010-11-08 20:31 ` [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes Vasily Khoruzhick
@ 2010-11-16 9:20 ` Kukjin Kim
1 sibling, 0 replies; 7+ messages in thread
From: Kukjin Kim @ 2010-11-16 9:20 UTC (permalink / raw)
To: linux-arm-kernel
Vasily Khoruzhick wrote:
>
> Replace in s3c_gpio_cfgpull with s3c_gpio_setpull.
>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
> arch/arm/mach-s3c2410/h1940-bluetooth.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c b/arch/arm/mach-
> s3c2410/h1940-bluetooth.c
> index 8aa2f19..6b86a72 100644
> --- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
> +++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
> @@ -77,13 +77,13 @@ static int __devinit h1940bt_probe(struct
platform_device
> *pdev)
>
> /* Configures BT serial port GPIOs */
> s3c_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
> - s3c_gpio_cfgpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
> + s3c_gpio_setpull(S3C2410_GPH(0), S3C_GPIO_PULL_NONE);
> s3c_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT);
> - s3c_gpio_cfgpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
> + s3c_gpio_setpull(S3C2410_GPH(1), S3C_GPIO_PULL_NONE);
> s3c_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0);
> - s3c_gpio_cfgpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
> + s3c_gpio_setpull(S3C2410_GPH(2), S3C_GPIO_PULL_NONE);
> s3c_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
> - s3c_gpio_cfgpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
> + s3c_gpio_setpull(S3C2410_GPH(3), S3C_GPIO_PULL_NONE);
>
>
> rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
> --
You're right..will apply.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes
2010-11-08 20:31 ` [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes Vasily Khoruzhick
2010-11-15 3:55 ` Kukjin Kim
@ 2010-11-16 23:12 ` Ben Dooks
2010-11-17 6:55 ` Vasily Khoruzhick
2010-12-06 16:43 ` Vasily Khoruzhick
2 siblings, 1 reply; 7+ messages in thread
From: Ben Dooks @ 2010-11-16 23:12 UTC (permalink / raw)
To: linux-arm-kernel
On 08/11/10 20:31, Vasily Khoruzhick wrote:
> Latch API was converted to gpiolib API as result we got this compile
> error:
>
> drivers/leds/leds-h1940.c: In function 'h1940_greenled_set':
> drivers/leds/leds-h1940.c:33: error: implicit declaration of function
> 'h1940_latch_control
>
> Adapt h1940-leds driver to new changes and fix compile issue.
>
it's a pitty we can't remove the driver totally and use the
gpio leds.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes
2010-11-16 23:12 ` Ben Dooks
@ 2010-11-17 6:55 ` Vasily Khoruzhick
0 siblings, 0 replies; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-11-17 6:55 UTC (permalink / raw)
To: linux-arm-kernel
On Wednesday 17 November 2010 01:12:58 Ben Dooks wrote:
> it's a pitty we can't remove the driver totally and use the
> gpio leds.
Why? It's possible to use leds-gpio driver. Additional gpios (blink, etc) can
be handled via platform_gpio_blink_set callback.
Regards
Vasily
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes
2010-11-08 20:31 ` [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes Vasily Khoruzhick
2010-11-15 3:55 ` Kukjin Kim
2010-11-16 23:12 ` Ben Dooks
@ 2010-12-06 16:43 ` Vasily Khoruzhick
2 siblings, 0 replies; 7+ messages in thread
From: Vasily Khoruzhick @ 2010-12-06 16:43 UTC (permalink / raw)
To: linux-arm-kernel
On Monday 08 November 2010 22:31:48 Vasily Khoruzhick wrote:
> Latch API was converted to gpiolib API as result we got this compile
> error:
>
> drivers/leds/leds-h1940.c: In function 'h1940_greenled_set':
> drivers/leds/leds-h1940.c:33: error: implicit declaration of function
> 'h1940_latch_control
>
> Adapt h1940-leds driver to new changes and fix compile issue.
>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
> drivers/leds/leds-h1940.c | 67
> ++++++++++++++++++++++++++++++++------------- 1 files changed, 48
> insertions(+), 19 deletions(-)
>
> diff --git a/drivers/leds/leds-h1940.c b/drivers/leds/leds-h1940.c
> index 173d104..d9c2729 100644
> --- a/drivers/leds/leds-h1940.c
> +++ b/drivers/leds/leds-h1940.c
> @@ -30,18 +30,18 @@ static void h1940_greenled_set(struct led_classdev
> *led_dev, {
> switch (value) {
> case LED_HALF:
> - h1940_latch_control(0, H1940_LATCH_LED_FLASH);
> - s3c2410_gpio_setpin(S3C2410_GPA7, 1);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 1);
> + gpio_set_value(S3C2410_GPA(7), 1);
> break;
> case LED_FULL:
> - h1940_latch_control(0, H1940_LATCH_LED_GREEN);
> - s3c2410_gpio_setpin(S3C2410_GPA7, 1);
> + gpio_set_value(H1940_LATCH_LED_GREEN, 1);
> + gpio_set_value(S3C2410_GPA(7), 1);
> break;
> default:
> case LED_OFF:
> - h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
> - h1940_latch_control(H1940_LATCH_LED_GREEN, 0);
> - s3c2410_gpio_setpin(S3C2410_GPA7, 0);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 0);
> + gpio_set_value(H1940_LATCH_LED_GREEN, 0);
> + gpio_set_value(S3C2410_GPA(7), 0);
> break;
> }
> }
> @@ -60,18 +60,18 @@ static void h1940_redled_set(struct led_classdev
> *led_dev, {
> switch (value) {
> case LED_HALF:
> - h1940_latch_control(0, H1940_LATCH_LED_FLASH);
> - s3c2410_gpio_setpin(S3C2410_GPA1, 1);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 1);
> + gpio_set_value(S3C2410_GPA(1), 1);
> break;
> case LED_FULL:
> - h1940_latch_control(0, H1940_LATCH_LED_RED);
> - s3c2410_gpio_setpin(S3C2410_GPA1, 1);
> + gpio_set_value(H1940_LATCH_LED_RED, 1);
> + gpio_set_value(S3C2410_GPA(1), 1);
> break;
> default:
> case LED_OFF:
> - h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
> - h1940_latch_control(H1940_LATCH_LED_RED, 0);
> - s3c2410_gpio_setpin(S3C2410_GPA1, 0);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 0);
> + gpio_set_value(H1940_LATCH_LED_RED, 0);
> + gpio_set_value(S3C2410_GPA(1), 0);
> break;
> }
> }
> @@ -91,11 +91,11 @@ static void h1940_blueled_set(struct led_classdev
> *led_dev, {
> if (value) {
> /* flashing Blue */
> - h1940_latch_control(0, H1940_LATCH_LED_FLASH);
> - s3c2410_gpio_setpin(S3C2410_GPA3, 1);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 1);
> + gpio_set_value(S3C2410_GPA(3), 1);
> } else {
> - h1940_latch_control(H1940_LATCH_LED_FLASH, 0);
> - s3c2410_gpio_setpin(S3C2410_GPA3, 0);
> + gpio_set_value(H1940_LATCH_LED_FLASH, 0);
> + gpio_set_value(S3C2410_GPA(3), 0);
> }
>
> }
> @@ -108,7 +108,24 @@ static struct led_classdev h1940_blueled = {
>
> static int __devinit h1940leds_probe(struct platform_device *pdev)
> {
> - int ret;
> + int ret, gpioidx = 0;
> + int led_gpios[] = {
> + H1940_LATCH_LED_GREEN,
> + H1940_LATCH_LED_RED,
> + H1940_LATCH_LED_FLASH,
> + S3C2410_GPA(1),
> + S3C2410_GPA(3),
> + S3C2410_GPA(7),
> + };
> +
> + for (gpioidx = 0; gpioidx < ARRAY_SIZE(led_gpios); gpioidx++) {
> + ret = gpio_request(led_gpios[gpioidx], "h1940 leds");
> + if (ret < 0)
> + goto err_gpio;
> + ret = gpio_direction_output(led_gpios[gpioidx], 0);
> + if (ret < 0)
> + goto err_gpio;
> + }
>
> ret = led_classdev_register(&pdev->dev, &h1940_greenled);
> if (ret)
> @@ -129,6 +146,10 @@ err_blue:
> err_red:
> led_classdev_unregister(&h1940_greenled);
> err_green:
> +err_gpio:
> + while (--gpioidx >= 0)
> + gpio_free(led_gpios[gpioidx]);
> +
> return ret;
> }
>
> @@ -137,6 +158,14 @@ static int h1940leds_remove(struct platform_device
> *pdev) led_classdev_unregister(&h1940_greenled);
> led_classdev_unregister(&h1940_redled);
> led_classdev_unregister(&h1940_blueled);
> +
> + gpio_free(H1940_LATCH_LED_GREEN);
> + gpio_free(H1940_LATCH_LED_RED);
> + gpio_free(H1940_LATCH_LED_FLASH);
> + gpio_free(S3C2410_GPA(1));
> + gpio_free(S3C2410_GPA(3));
> + gpio_free(S3C2410_GPA(7));
> +
> return 0;
> }
Added Richard Purdie to CC (it seems he changed email address).
Richard, could you review/merge this patch?
Regards
Vasily
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-12-06 16:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-08 20:31 [PATCH 1/2] ARM: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes Vasily Khoruzhick
2010-11-08 20:31 ` [PATCH 2/2] h1940-leds: Fix compile issue introduced by latch-related changes Vasily Khoruzhick
2010-11-15 3:55 ` Kukjin Kim
2010-11-16 23:12 ` Ben Dooks
2010-11-17 6:55 ` Vasily Khoruzhick
2010-12-06 16:43 ` Vasily Khoruzhick
2010-11-16 9:20 ` [PATCH 1/2] ARM: S3C2410: H1940: Adapt h1940-bluetooth to gpiolib changes Kukjin Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).