2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2005-09-09 06:07:38 +08:00
|
|
|
* linux/arch/arm/mach-omap1/leds.c
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* OMAP LEDs dispatcher
|
|
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
|
|
|
|
#include <asm/leds.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/gpio.h>
|
2009-10-21 00:40:47 +08:00
|
|
|
#include <plat/mux.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include "leds.h"
|
|
|
|
|
|
|
|
static int __init
|
|
|
|
omap_leds_init(void)
|
|
|
|
{
|
2010-12-11 01:46:24 +08:00
|
|
|
if (!cpu_class_is_omap1())
|
|
|
|
return -ENODEV;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
if (machine_is_omap_innovator())
|
|
|
|
leds_event = innovator_leds_event;
|
|
|
|
|
2005-09-09 06:07:38 +08:00
|
|
|
else if (machine_is_omap_h2()
|
|
|
|
|| machine_is_omap_h3()
|
|
|
|
|| machine_is_omap_perseus2())
|
2005-04-17 06:20:36 +08:00
|
|
|
leds_event = h2p2_dbg_leds_event;
|
|
|
|
|
|
|
|
else if (machine_is_omap_osk())
|
|
|
|
leds_event = osk_leds_event;
|
|
|
|
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (machine_is_omap_h2()
|
2005-09-09 06:07:38 +08:00
|
|
|
|| machine_is_omap_h3()
|
|
|
|
#ifdef CONFIG_OMAP_OSK_MISTRAL
|
|
|
|
|| machine_is_omap_osk()
|
|
|
|
#endif
|
|
|
|
) {
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* LED1/LED2 pins can be used as GPIO (as done here), or by
|
|
|
|
* the LPG (works even in deep sleep!), to drive a bicolor
|
|
|
|
* LED on the H2 sample board, and another on the H2/P2
|
|
|
|
* "surfer" expansion board.
|
|
|
|
*
|
|
|
|
* The same pins drive a LED on the OSK Mistral board, but
|
|
|
|
* that's a different kind of LED (just one color at a time).
|
|
|
|
*/
|
|
|
|
omap_cfg_reg(P18_1610_GPIO3);
|
2008-12-11 09:35:30 +08:00
|
|
|
if (gpio_request(3, "LED red") == 0)
|
2008-12-11 09:35:26 +08:00
|
|
|
gpio_direction_output(3, 1);
|
2005-04-17 06:20:36 +08:00
|
|
|
else
|
|
|
|
printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
|
|
|
|
|
|
|
|
omap_cfg_reg(MPUIO4);
|
2008-12-11 09:35:30 +08:00
|
|
|
if (gpio_request(OMAP_MPUIO(4), "LED green") == 0)
|
2008-12-11 09:35:26 +08:00
|
|
|
gpio_direction_output(OMAP_MPUIO(4), 1);
|
2005-04-17 06:20:36 +08:00
|
|
|
else
|
|
|
|
printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
leds_event(led_start);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
__initcall(omap_leds_init);
|