diff options
-rw-r--r-- | drivers/leds/leds-gpio.c | 15 | ||||
-rw-r--r-- | include/linux/leds.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 1aae8b332134..b13bd2950e95 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
@@ -24,6 +24,8 @@ struct gpio_led_data { | |||
24 | u8 new_level; | 24 | u8 new_level; |
25 | u8 can_sleep; | 25 | u8 can_sleep; |
26 | u8 active_low; | 26 | u8 active_low; |
27 | int (*platform_gpio_blink_set)(unsigned gpio, | ||
28 | unsigned long *delay_on, unsigned long *delay_off); | ||
27 | }; | 29 | }; |
28 | 30 | ||
29 | static void gpio_led_work(struct work_struct *work) | 31 | static void gpio_led_work(struct work_struct *work) |
@@ -60,6 +62,15 @@ static void gpio_led_set(struct led_classdev *led_cdev, | |||
60 | gpio_set_value(led_dat->gpio, level); | 62 | gpio_set_value(led_dat->gpio, level); |
61 | } | 63 | } |
62 | 64 | ||
65 | static int gpio_blink_set(struct led_classdev *led_cdev, | ||
66 | unsigned long *delay_on, unsigned long *delay_off) | ||
67 | { | ||
68 | struct gpio_led_data *led_dat = | ||
69 | container_of(led_cdev, struct gpio_led_data, cdev); | ||
70 | |||
71 | return led_dat->platform_gpio_blink_set(led_dat->gpio, delay_on, delay_off); | ||
72 | } | ||
73 | |||
63 | static int gpio_led_probe(struct platform_device *pdev) | 74 | static int gpio_led_probe(struct platform_device *pdev) |
64 | { | 75 | { |
65 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; | 76 | struct gpio_led_platform_data *pdata = pdev->dev.platform_data; |
@@ -88,6 +99,10 @@ static int gpio_led_probe(struct platform_device *pdev) | |||
88 | led_dat->gpio = cur_led->gpio; | 99 | led_dat->gpio = cur_led->gpio; |
89 | led_dat->can_sleep = gpio_cansleep(cur_led->gpio); | 100 | led_dat->can_sleep = gpio_cansleep(cur_led->gpio); |
90 | led_dat->active_low = cur_led->active_low; | 101 | led_dat->active_low = cur_led->active_low; |
102 | if (pdata->gpio_blink_set) { | ||
103 | led_dat->platform_gpio_blink_set = pdata->gpio_blink_set; | ||
104 | led_dat->cdev.blink_set = gpio_blink_set; | ||
105 | } | ||
91 | led_dat->cdev.brightness_set = gpio_led_set; | 106 | led_dat->cdev.brightness_set = gpio_led_set; |
92 | led_dat->cdev.brightness = LED_OFF; | 107 | led_dat->cdev.brightness = LED_OFF; |
93 | 108 | ||
diff --git a/include/linux/leds.h b/include/linux/leds.h index b07e3d400bd6..c195a674b6ca 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -126,6 +126,9 @@ struct gpio_led { | |||
126 | struct gpio_led_platform_data { | 126 | struct gpio_led_platform_data { |
127 | int num_leds; | 127 | int num_leds; |
128 | struct gpio_led *leds; | 128 | struct gpio_led *leds; |
129 | int (*gpio_blink_set)(unsigned gpio, | ||
130 | unsigned long *delay_on, | ||
131 | unsigned long *delay_off); | ||
129 | }; | 132 | }; |
130 | 133 | ||
131 | 134 | ||