diff options
-rw-r--r-- | arch/arm/mach-s3c24xx/h1940-bluetooth.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-s3c24xx/h1940.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-s3c24xx/mach-h1940.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-s3c24xx/mach-rx1950.c | 3 | ||||
-rw-r--r-- | arch/arm/plat-orion/gpio.c | 3 | ||||
-rw-r--r-- | arch/arm/plat-orion/include/plat/orion-gpio.h | 5 | ||||
-rw-r--r-- | drivers/leds/leds-gpio.c | 31 | ||||
-rw-r--r-- | include/linux/leds.h | 2 |
8 files changed, 29 insertions, 26 deletions
diff --git a/arch/arm/mach-s3c24xx/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c index b4d14b864367..9c8b1279a4ba 100644 --- a/arch/arm/mach-s3c24xx/h1940-bluetooth.c +++ b/arch/arm/mach-s3c24xx/h1940-bluetooth.c | |||
@@ -41,7 +41,7 @@ static void h1940bt_enable(int on) | |||
41 | mdelay(10); | 41 | mdelay(10); |
42 | gpio_set_value(S3C2410_GPH(1), 0); | 42 | gpio_set_value(S3C2410_GPH(1), 0); |
43 | 43 | ||
44 | h1940_led_blink_set(-EINVAL, GPIO_LED_BLINK, NULL, NULL); | 44 | h1940_led_blink_set(NULL, GPIO_LED_BLINK, NULL, NULL); |
45 | } | 45 | } |
46 | else { | 46 | else { |
47 | gpio_set_value(S3C2410_GPH(1), 1); | 47 | gpio_set_value(S3C2410_GPH(1), 1); |
@@ -50,7 +50,7 @@ static void h1940bt_enable(int on) | |||
50 | mdelay(10); | 50 | mdelay(10); |
51 | gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0); | 51 | gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0); |
52 | 52 | ||
53 | h1940_led_blink_set(-EINVAL, GPIO_LED_NO_BLINK_LOW, NULL, NULL); | 53 | h1940_led_blink_set(NULL, GPIO_LED_NO_BLINK_LOW, NULL, NULL); |
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
diff --git a/arch/arm/mach-s3c24xx/h1940.h b/arch/arm/mach-s3c24xx/h1940.h index 2950cc466840..596d9f64c5b6 100644 --- a/arch/arm/mach-s3c24xx/h1940.h +++ b/arch/arm/mach-s3c24xx/h1940.h | |||
@@ -19,8 +19,10 @@ | |||
19 | #define H1940_SUSPEND_RESUMEAT (0x30081000) | 19 | #define H1940_SUSPEND_RESUMEAT (0x30081000) |
20 | #define H1940_SUSPEND_CHECK (0x30080000) | 20 | #define H1940_SUSPEND_CHECK (0x30080000) |
21 | 21 | ||
22 | struct gpio_desc; | ||
23 | |||
22 | extern void h1940_pm_return(void); | 24 | extern void h1940_pm_return(void); |
23 | extern int h1940_led_blink_set(unsigned gpio, int state, | 25 | extern int h1940_led_blink_set(struct gpio_desc *desc, int state, |
24 | unsigned long *delay_on, | 26 | unsigned long *delay_on, |
25 | unsigned long *delay_off); | 27 | unsigned long *delay_off); |
26 | 28 | ||
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c index d35ddc1d9991..d40d4f5244c6 100644 --- a/arch/arm/mach-s3c24xx/mach-h1940.c +++ b/arch/arm/mach-s3c24xx/mach-h1940.c | |||
@@ -359,10 +359,11 @@ static struct platform_device h1940_battery = { | |||
359 | 359 | ||
360 | static DEFINE_SPINLOCK(h1940_blink_spin); | 360 | static DEFINE_SPINLOCK(h1940_blink_spin); |
361 | 361 | ||
362 | int h1940_led_blink_set(unsigned gpio, int state, | 362 | int h1940_led_blink_set(struct gpio_desc *desc, int state, |
363 | unsigned long *delay_on, unsigned long *delay_off) | 363 | unsigned long *delay_on, unsigned long *delay_off) |
364 | { | 364 | { |
365 | int blink_gpio, check_gpio1, check_gpio2; | 365 | int blink_gpio, check_gpio1, check_gpio2; |
366 | int gpio = desc ? desc_to_gpio(desc) : -EINVAL; | ||
366 | 367 | ||
367 | switch (gpio) { | 368 | switch (gpio) { |
368 | case H1940_LATCH_LED_GREEN: | 369 | case H1940_LATCH_LED_GREEN: |
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c index c3f2682d0c62..1d35ff375a01 100644 --- a/arch/arm/mach-s3c24xx/mach-rx1950.c +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c | |||
@@ -250,9 +250,10 @@ static void rx1950_disable_charger(void) | |||
250 | 250 | ||
251 | static DEFINE_SPINLOCK(rx1950_blink_spin); | 251 | static DEFINE_SPINLOCK(rx1950_blink_spin); |
252 | 252 | ||
253 | static int rx1950_led_blink_set(unsigned gpio, int state, | 253 | static int rx1950_led_blink_set(struct gpio_desc *desc, int state, |
254 | unsigned long *delay_on, unsigned long *delay_off) | 254 | unsigned long *delay_on, unsigned long *delay_off) |
255 | { | 255 | { |
256 | int gpio = desc_to_gpio(desc); | ||
256 | int blink_gpio, check_gpio; | 257 | int blink_gpio, check_gpio; |
257 | 258 | ||
258 | switch (gpio) { | 259 | switch (gpio) { |
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c index b61a3bcc2fa8..b357053f40d9 100644 --- a/arch/arm/plat-orion/gpio.c +++ b/arch/arm/plat-orion/gpio.c | |||
@@ -306,9 +306,10 @@ EXPORT_SYMBOL(orion_gpio_set_blink); | |||
306 | 306 | ||
307 | #define ORION_BLINK_HALF_PERIOD 100 /* ms */ | 307 | #define ORION_BLINK_HALF_PERIOD 100 /* ms */ |
308 | 308 | ||
309 | int orion_gpio_led_blink_set(unsigned gpio, int state, | 309 | int orion_gpio_led_blink_set(struct gpio_desc *desc, int state, |
310 | unsigned long *delay_on, unsigned long *delay_off) | 310 | unsigned long *delay_on, unsigned long *delay_off) |
311 | { | 311 | { |
312 | unsigned gpio = desc_to_gpio(desc); | ||
312 | 313 | ||
313 | if (delay_on && delay_off && !*delay_on && !*delay_off) | 314 | if (delay_on && delay_off && !*delay_on && !*delay_off) |
314 | *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD; | 315 | *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD; |
diff --git a/arch/arm/plat-orion/include/plat/orion-gpio.h b/arch/arm/plat-orion/include/plat/orion-gpio.h index e763988b04b9..e856b073a9c8 100644 --- a/arch/arm/plat-orion/include/plat/orion-gpio.h +++ b/arch/arm/plat-orion/include/plat/orion-gpio.h | |||
@@ -14,12 +14,15 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/irqdomain.h> | 16 | #include <linux/irqdomain.h> |
17 | |||
18 | struct gpio_desc; | ||
19 | |||
17 | /* | 20 | /* |
18 | * Orion-specific GPIO API extensions. | 21 | * Orion-specific GPIO API extensions. |
19 | */ | 22 | */ |
20 | void orion_gpio_set_unused(unsigned pin); | 23 | void orion_gpio_set_unused(unsigned pin); |
21 | void orion_gpio_set_blink(unsigned pin, int blink); | 24 | void orion_gpio_set_blink(unsigned pin, int blink); |
22 | int orion_gpio_led_blink_set(unsigned gpio, int state, | 25 | int orion_gpio_led_blink_set(struct gpio_desc *desc, int state, |
23 | unsigned long *delay_on, unsigned long *delay_off); | 26 | unsigned long *delay_on, unsigned long *delay_off); |
24 | 27 | ||
25 | #define GPIO_INPUT_OK (1 << 0) | 28 | #define GPIO_INPUT_OK (1 << 0) |
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index edd370dbb22f..ba4698c32bb0 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
@@ -28,7 +28,7 @@ struct gpio_led_data { | |||
28 | u8 new_level; | 28 | u8 new_level; |
29 | u8 can_sleep; | 29 | u8 can_sleep; |
30 | u8 blinking; | 30 | u8 blinking; |
31 | int (*platform_gpio_blink_set)(unsigned gpio, int state, | 31 | int (*platform_gpio_blink_set)(struct gpio_desc *desc, int state, |
32 | unsigned long *delay_on, unsigned long *delay_off); | 32 | unsigned long *delay_on, unsigned long *delay_off); |
33 | }; | 33 | }; |
34 | 34 | ||
@@ -38,13 +38,8 @@ static void gpio_led_work(struct work_struct *work) | |||
38 | container_of(work, struct gpio_led_data, work); | 38 | container_of(work, struct gpio_led_data, work); |
39 | 39 | ||
40 | if (led_dat->blinking) { | 40 | if (led_dat->blinking) { |
41 | int gpio = desc_to_gpio(led_dat->gpiod); | 41 | led_dat->platform_gpio_blink_set(led_dat->gpiod, |
42 | int level = led_dat->new_level; | 42 | led_dat->new_level, NULL, NULL); |
43 | |||
44 | if (gpiod_is_active_low(led_dat->gpiod)) | ||
45 | level = !level; | ||
46 | |||
47 | led_dat->platform_gpio_blink_set(gpio, level, NULL, NULL); | ||
48 | led_dat->blinking = 0; | 43 | led_dat->blinking = 0; |
49 | } else | 44 | } else |
50 | gpiod_set_value_cansleep(led_dat->gpiod, led_dat->new_level); | 45 | gpiod_set_value_cansleep(led_dat->gpiod, led_dat->new_level); |
@@ -71,13 +66,8 @@ static void gpio_led_set(struct led_classdev *led_cdev, | |||
71 | schedule_work(&led_dat->work); | 66 | schedule_work(&led_dat->work); |
72 | } else { | 67 | } else { |
73 | if (led_dat->blinking) { | 68 | if (led_dat->blinking) { |
74 | int gpio = desc_to_gpio(led_dat->gpiod); | 69 | led_dat->platform_gpio_blink_set(led_dat->gpiod, level, |
75 | 70 | NULL, NULL); | |
76 | if (gpiod_is_active_low(led_dat->gpiod)) | ||
77 | level = !level; | ||
78 | |||
79 | led_dat->platform_gpio_blink_set(gpio, level, NULL, | ||
80 | NULL); | ||
81 | led_dat->blinking = 0; | 71 | led_dat->blinking = 0; |
82 | } else | 72 | } else |
83 | gpiod_set_value(led_dat->gpiod, level); | 73 | gpiod_set_value(led_dat->gpiod, level); |
@@ -89,20 +79,25 @@ static int gpio_blink_set(struct led_classdev *led_cdev, | |||
89 | { | 79 | { |
90 | struct gpio_led_data *led_dat = | 80 | struct gpio_led_data *led_dat = |
91 | container_of(led_cdev, struct gpio_led_data, cdev); | 81 | container_of(led_cdev, struct gpio_led_data, cdev); |
92 | int gpio = desc_to_gpio(led_dat->gpiod); | ||
93 | 82 | ||
94 | led_dat->blinking = 1; | 83 | led_dat->blinking = 1; |
95 | return led_dat->platform_gpio_blink_set(gpio, GPIO_LED_BLINK, | 84 | return led_dat->platform_gpio_blink_set(led_dat->gpiod, GPIO_LED_BLINK, |
96 | delay_on, delay_off); | 85 | delay_on, delay_off); |
97 | } | 86 | } |
98 | 87 | ||
99 | static int create_gpio_led(const struct gpio_led *template, | 88 | static int create_gpio_led(const struct gpio_led *template, |
100 | struct gpio_led_data *led_dat, struct device *parent, | 89 | struct gpio_led_data *led_dat, struct device *parent, |
101 | int (*blink_set)(unsigned, int, unsigned long *, unsigned long *)) | 90 | int (*blink_set)(struct gpio_desc *, int, unsigned long *, |
91 | unsigned long *)) | ||
102 | { | 92 | { |
103 | int ret, state; | 93 | int ret, state; |
104 | 94 | ||
105 | if (!template->gpiod) { | 95 | if (!template->gpiod) { |
96 | /* | ||
97 | * This is the legacy code path for platform code that | ||
98 | * still uses GPIO numbers. Ultimately we would like to get | ||
99 | * rid of this block completely. | ||
100 | */ | ||
106 | unsigned long flags = 0; | 101 | unsigned long flags = 0; |
107 | 102 | ||
108 | /* skip leds that aren't available */ | 103 | /* skip leds that aren't available */ |
diff --git a/include/linux/leds.h b/include/linux/leds.h index f3af5c4d9084..361101fef270 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -274,7 +274,7 @@ struct gpio_led_platform_data { | |||
274 | #define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */ | 274 | #define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */ |
275 | #define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */ | 275 | #define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */ |
276 | #define GPIO_LED_BLINK 2 /* Please, blink */ | 276 | #define GPIO_LED_BLINK 2 /* Please, blink */ |
277 | int (*gpio_blink_set)(unsigned gpio, int state, | 277 | int (*gpio_blink_set)(struct gpio_desc *desc, int state, |
278 | unsigned long *delay_on, | 278 | unsigned long *delay_on, |
279 | unsigned long *delay_off); | 279 | unsigned long *delay_off); |
280 | }; | 280 | }; |