summaryrefslogtreecommitdiff
path: root/arch/arm/mach-s3c24xx/mach-n30.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2020-07-08 09:11:49 +0200
committerKrzysztof Kozlowski <krzk@kernel.org>2020-07-09 09:56:14 +0200
commitf7f611f2b1dc69547d425de0daeac548add2c761 (patch)
treea9bf264746e5c3741b8190cf5ac34d476f340cca /arch/arm/mach-s3c24xx/mach-n30.c
parentea9dd8f61c8a890843f68e8dc0062ce78365aab8 (diff)
ARM: s3c24xx: leds: Convert to use GPIO descriptors
This converts the s3c24xx LED driver to use GPIO descriptors and also modify all board files to account for these changes by registering the appropriate GPIO tables for each board. The driver was using a custom flag to indicate open drain (tristate) but this can be handled by standard descriptor machine tables. The driver was setting non-pull-up for the pin using the custom S3C24xx GPIO API, but this is a custom pin control system used by the S3C24xx and no generic GPIO function, so this has simply been pushed back into the respective board files. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Diffstat (limited to 'arch/arm/mach-s3c24xx/mach-n30.c')
-rw-r--r--arch/arm/mach-s3c24xx/mach-n30.c54
1 files changed, 48 insertions, 6 deletions
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index d856f23939af..58a64f6d5fd0 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -45,6 +45,7 @@
#include <plat/cpu.h>
#include <plat/devs.h>
+#include <plat/gpio-cfg.h>
#include <linux/platform_data/mmc-s3cmci.h>
#include <linux/platform_data/usb-s3c2410_udc.h>
#include <plat/samsung-time.h>
@@ -246,17 +247,33 @@ static struct platform_device n35_button_device = {
};
/* This is the bluetooth LED on the device. */
+
+static struct gpiod_lookup_table n30_blue_led_gpio_table = {
+ .dev_id = "s3c24xx_led.1",
+ .table = {
+ GPIO_LOOKUP("GPG", 6, NULL, GPIO_ACTIVE_HIGH),
+ { },
+ },
+};
+
static struct s3c24xx_led_platdata n30_blue_led_pdata = {
.name = "blue_led",
- .gpio = S3C2410_GPG(6),
.def_trigger = "",
};
/* This is the blue LED on the device. Originally used to indicate GPS activity
* by flashing. */
+
+static struct gpiod_lookup_table n35_blue_led_gpio_table = {
+ .dev_id = "s3c24xx_led.1",
+ .table = {
+ GPIO_LOOKUP("GPD", 8, NULL, GPIO_ACTIVE_HIGH),
+ { },
+ },
+};
+
static struct s3c24xx_led_platdata n35_blue_led_pdata = {
.name = "blue_led",
- .gpio = S3C2410_GPD(8),
.def_trigger = "",
};
@@ -264,17 +281,30 @@ static struct s3c24xx_led_platdata n35_blue_led_pdata = {
* red, blinking green or solid green when the battery is low,
* charging or full respectively. By driving GPD9 low, it's possible
* to force the LED to blink red, so call that warning LED. */
+
+static struct gpiod_lookup_table n30_warning_led_gpio_table = {
+ .dev_id = "s3c24xx_led.2",
+ .table = {
+ GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW),
+ { },
+ },
+};
+
static struct s3c24xx_led_platdata n30_warning_led_pdata = {
.name = "warning_led",
- .flags = S3C24XX_LEDF_ACTLOW,
- .gpio = S3C2410_GPD(9),
.def_trigger = "",
};
+static struct gpiod_lookup_table n35_warning_led_gpio_table = {
+ .dev_id = "s3c24xx_led.2",
+ .table = {
+ GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
+ { },
+ },
+};
+
static struct s3c24xx_led_platdata n35_warning_led_pdata = {
.name = "warning_led",
- .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
- .gpio = S3C2410_GPD(9),
.def_trigger = "",
};
@@ -577,6 +607,12 @@ static void __init n30_init(void)
S3C2410_MISCCR_USBSUSPND0 |
S3C2410_MISCCR_USBSUSPND1, 0x0);
+ /* Disable pull-up and add GPIO tables */
+ s3c_gpio_setpull(S3C2410_GPG(6), S3C_GPIO_PULL_NONE);
+ s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
+ gpiod_add_lookup_table(&n30_blue_led_gpio_table);
+ gpiod_add_lookup_table(&n30_warning_led_gpio_table);
+
platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
}
@@ -594,6 +630,12 @@ static void __init n30_init(void)
S3C2410_MISCCR_USBSUSPND1,
S3C2410_MISCCR_USBSUSPND0);
+ /* Disable pull-up and add GPIO tables */
+ s3c_gpio_setpull(S3C2410_GPD(8), S3C_GPIO_PULL_NONE);
+ s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
+ gpiod_add_lookup_table(&n35_blue_led_gpio_table);
+ gpiod_add_lookup_table(&n35_warning_led_gpio_table);
+
platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
}
}