summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/leds.c
blob: 8ab21fe98e1bc388c0e3a40a4b83bb919a88c622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * linux/arch/arm/mach-omap/leds.c
 *
 * OMAP LEDs dispatcher
 */
#include <linux/kernel.h>
#include <linux/init.h>

#include <asm/leds.h>
#include <asm/mach-types.h>

#include <asm/arch/gpio.h>
#include <asm/arch/mux.h>

#include "leds.h"

static int __init
omap_leds_init(void)
{
	if (machine_is_omap_innovator())
		leds_event = innovator_leds_event;

	else if (machine_is_omap_h2() || machine_is_omap_perseus2())
		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()
			|| machine_is_omap_perseus2()
			|| machine_is_omap_osk()) {

		/* 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);
		if (omap_request_gpio(3) == 0)
			omap_set_gpio_direction(3, 0);
		else
			printk(KERN_WARNING "LED: can't get GPIO3/red?\n");

		omap_cfg_reg(MPUIO4);
		if (omap_request_gpio(OMAP_MPUIO(4)) == 0)
			omap_set_gpio_direction(OMAP_MPUIO(4), 0);
		else
			printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
	}

	leds_event(led_start);
	return 0;
}

__initcall(omap_leds_init);
OpenPOWER on IntegriCloud