-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 25296 b: refs/heads/master c: cc2832a h: refs/heads/master v: v3
- Loading branch information
Andrew Victor
authored and
Russell King
committed
Apr 2, 2006
1 parent
a64771c
commit 8a1623e
Showing
9 changed files
with
142 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: b2e6f75597af8fc765707111d3a71077167bdeb1 | ||
refs/heads/master: cc2832a1313340ff1de55f15fac5b7fe48fa2a72 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* LED driver for Atmel AT91-based boards. | ||
* | ||
* Copyright (C) SAN People (Pty) Ltd | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version | ||
* 2 of the License, or (at your option) any later version. | ||
*/ | ||
|
||
#include <linux/config.h> | ||
#include <linux/kernel.h> | ||
#include <linux/module.h> | ||
#include <linux/init.h> | ||
|
||
#include <asm/mach-types.h> | ||
#include <asm/leds.h> | ||
#include <asm/arch/board.h> | ||
#include <asm/arch/gpio.h> | ||
|
||
|
||
static inline void at91_led_on(unsigned int led) | ||
{ | ||
at91_set_gpio_value(led, 0); | ||
} | ||
|
||
static inline void at91_led_off(unsigned int led) | ||
{ | ||
at91_set_gpio_value(led, 1); | ||
} | ||
|
||
static inline void at91_led_toggle(unsigned int led) | ||
{ | ||
unsigned long is_off = at91_get_gpio_value(led); | ||
if (is_off) | ||
at91_led_on(led); | ||
else | ||
at91_led_off(led); | ||
} | ||
|
||
|
||
/* | ||
* Handle LED events. | ||
*/ | ||
static void at91_leds_event(led_event_t evt) | ||
{ | ||
unsigned long flags; | ||
|
||
local_irq_save(flags); | ||
|
||
switch(evt) { | ||
case led_start: /* System startup */ | ||
at91_led_on(at91_leds_cpu); | ||
break; | ||
|
||
case led_stop: /* System stop / suspend */ | ||
at91_led_off(at91_leds_cpu); | ||
break; | ||
|
||
#ifdef CONFIG_LEDS_TIMER | ||
case led_timer: /* Every 50 timer ticks */ | ||
at91_led_toggle(at91_leds_timer); | ||
break; | ||
#endif | ||
|
||
#ifdef CONFIG_LEDS_CPU | ||
case led_idle_start: /* Entering idle state */ | ||
at91_led_off(at91_leds_cpu); | ||
break; | ||
|
||
case led_idle_end: /* Exit idle state */ | ||
at91_led_on(at91_leds_cpu); | ||
break; | ||
#endif | ||
|
||
default: | ||
break; | ||
} | ||
|
||
local_irq_restore(flags); | ||
} | ||
|
||
|
||
static int __init leds_init(void) | ||
{ | ||
if (!at91_leds_timer || !at91_leds_cpu) | ||
return -ENODEV; | ||
|
||
/* Enable PIO to access the LEDs */ | ||
at91_set_gpio_output(at91_leds_timer, 1); | ||
at91_set_gpio_output(at91_leds_cpu, 1); | ||
|
||
leds_event = at91_leds_event; | ||
|
||
leds_event(led_start); | ||
return 0; | ||
} | ||
|
||
__initcall(leds_init); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters