aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c2440
diff options
context:
space:
mode:
authorVasily Khoruzhick <anarsoul@gmail.com>2011-01-06 14:52:52 -0500
committerBen Dooks <ben-linux@fluff.org>2011-03-20 19:14:55 -0400
commit62235dcd2ad4f46ea9e5d4f71c5ea3111341c6e8 (patch)
tree9e8b605c0f37f71a1d400974aff47e4b5cf06ff3 /arch/arm/mach-s3c2440
parentfed7fdbef48d513b1a470bc3d76923d156996448 (diff)
ARM: S3C2442: RX1950: Add support for LED blinking
Add .gpio_set_blink callback to support HW blinking available on RX1950 Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/mach-s3c2440')
-rw-r--r--arch/arm/mach-s3c2440/mach-rx1950.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
index 0f6821ba9b2..22f18d9e2d7 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -263,6 +263,52 @@ void rx1950_disable_charger(void)
263 gpio_direction_output(S3C2410_GPJ(3), 0); 263 gpio_direction_output(S3C2410_GPJ(3), 0);
264} 264}
265 265
266DEFINE_SPINLOCK(rx1950_blink_spin);
267
268static int rx1950_led_blink_set(unsigned gpio, int state,
269 unsigned long *delay_on, unsigned long *delay_off)
270{
271 int blink_gpio, check_gpio;
272
273 switch (gpio) {
274 case S3C2410_GPA(6):
275 blink_gpio = S3C2410_GPA(4);
276 check_gpio = S3C2410_GPA(3);
277 break;
278 case S3C2410_GPA(7):
279 blink_gpio = S3C2410_GPA(3);
280 check_gpio = S3C2410_GPA(4);
281 break;
282 default:
283 return -EINVAL;
284 break;
285 }
286
287 if (delay_on && delay_off && !*delay_on && !*delay_off)
288 *delay_on = *delay_off = 500;
289
290 spin_lock(&rx1950_blink_spin);
291
292 switch (state) {
293 case GPIO_LED_NO_BLINK_LOW:
294 case GPIO_LED_NO_BLINK_HIGH:
295 if (!gpio_get_value(check_gpio))
296 gpio_set_value(S3C2410_GPJ(6), 0);
297 gpio_set_value(blink_gpio, 0);
298 gpio_set_value(gpio, state);
299 break;
300 case GPIO_LED_BLINK:
301 gpio_set_value(gpio, 0);
302 gpio_set_value(S3C2410_GPJ(6), 1);
303 gpio_set_value(blink_gpio, 1);
304 break;
305 }
306
307 spin_unlock(&rx1950_blink_spin);
308
309 return 0;
310}
311
266static struct gpio_led rx1950_leds_desc[] = { 312static struct gpio_led rx1950_leds_desc[] = {
267 { 313 {
268 .name = "Green", 314 .name = "Green",
@@ -287,6 +333,7 @@ static struct gpio_led rx1950_leds_desc[] = {
287static struct gpio_led_platform_data rx1950_leds_pdata = { 333static struct gpio_led_platform_data rx1950_leds_pdata = {
288 .num_leds = ARRAY_SIZE(rx1950_leds_desc), 334 .num_leds = ARRAY_SIZE(rx1950_leds_desc),
289 .leds = rx1950_leds_desc, 335 .leds = rx1950_leds_desc,
336 .gpio_blink_set = rx1950_led_blink_set,
290}; 337};
291 338
292static struct platform_device rx1950_leds = { 339static struct platform_device rx1950_leds = {
@@ -755,6 +802,13 @@ static void __init rx1950_init_machine(void)
755 802
756 WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power")); 803 WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power"));
757 804
805 WARN_ON(gpio_request(S3C2410_GPA(3), "Red blink"));
806 WARN_ON(gpio_request(S3C2410_GPA(4), "Green blink"));
807 WARN_ON(gpio_request(S3C2410_GPJ(6), "LED blink"));
808 gpio_direction_output(S3C2410_GPA(3), 0);
809 gpio_direction_output(S3C2410_GPA(4), 0);
810 gpio_direction_output(S3C2410_GPJ(6), 0);
811
758 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices)); 812 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
759 813
760 i2c_register_board_info(0, rx1950_i2c_devices, 814 i2c_register_board_info(0, rx1950_i2c_devices,