Blame view

arch/arm/mach-omap1/leds.c 1.47 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
7c38cf021   Tony Lindgren   [ARM] 2890/1: OMA...
2
   * linux/arch/arm/mach-omap1/leds.c
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
3
4
5
   *
   * OMAP LEDs dispatcher
   */
2f8163baa   Russell King   ARM: gpio: conver...
6
  #include <linux/gpio.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
8
9
10
11
  #include <linux/kernel.h>
  #include <linux/init.h>
  
  #include <asm/leds.h>
  #include <asm/mach-types.h>
ce491cf85   Tony Lindgren   omap: headers: Mo...
12
  #include <plat/mux.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
14
15
16
17
18
  
  #include "leds.h"
  
  static int __init
  omap_leds_init(void)
  {
7f9187c26   Tony Lindgren   omap1: Add initca...
19
20
  	if (!cpu_class_is_omap1())
  		return -ENODEV;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
  	if (machine_is_omap_innovator())
  		leds_event = innovator_leds_event;
7c38cf021   Tony Lindgren   [ARM] 2890/1: OMA...
23
24
25
  	else if (machine_is_omap_h2()
  			|| machine_is_omap_h3()
  			|| machine_is_omap_perseus2())
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
26
27
28
29
30
31
32
33
34
  		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()
7c38cf021   Tony Lindgren   [ARM] 2890/1: OMA...
35
  			|| machine_is_omap_h3()
7c38cf021   Tony Lindgren   [ARM] 2890/1: OMA...
36
37
38
39
  #ifdef	CONFIG_OMAP_OSK_MISTRAL
  			|| machine_is_omap_osk()
  #endif
  			) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
40
41
42
43
44
45
46
47
48
49
  
  		/* 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);
f2d18fea8   Jarkko Nikula   ARM: OMAP: Switch...
50
  		if (gpio_request(3, "LED red") == 0)
e918edf7c   David Brownell   ARM: OMAP: switch...
51
  			gpio_direction_output(3, 1);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
53
54
55
56
  		else
  			printk(KERN_WARNING "LED: can't get GPIO3/red?
  ");
  
  		omap_cfg_reg(MPUIO4);
f2d18fea8   Jarkko Nikula   ARM: OMAP: Switch...
57
  		if (gpio_request(OMAP_MPUIO(4), "LED green") == 0)
e918edf7c   David Brownell   ARM: OMAP: switch...
58
  			gpio_direction_output(OMAP_MPUIO(4), 1);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
59
60
61
62
63
64
65
66
67
68
  		else
  			printk(KERN_WARNING "LED: can't get MPUIO4/green?
  ");
  	}
  
  	leds_event(led_start);
  	return 0;
  }
  
  __initcall(omap_leds_init);