Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 187429
b: refs/heads/master
c: b2a731a
h: refs/heads/master
i:
  187427: a590581
v: v3
  • Loading branch information
Laurie Bradshaw authored and Nicolas Pitre committed Feb 10, 2010
1 parent 299272b commit 1a1d7e4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1afeea84bd821e9a8c1c6606ba677bc229dd57de
refs/heads/master: b2a731aa5cbca7e0252da75e16de7ae5feb1313a
36 changes: 33 additions & 3 deletions trunk/arch/arm/mach-orion5x/dns323-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
#define DNS323_GPIO_LED_RIGHT_AMBER 1
#define DNS323_GPIO_LED_LEFT_AMBER 2
#define DNS323_GPIO_SYSTEM_UP 3
#define DNS323_GPIO_LED_POWER 5
#define DNS323_GPIO_LED_POWER1 4
#define DNS323_GPIO_LED_POWER2 5
#define DNS323_GPIO_OVERTEMP 6
#define DNS323_GPIO_RTC 7
#define DNS323_GPIO_POWER_OFF 8
Expand Down Expand Up @@ -237,11 +238,31 @@ static int __init dns323_read_mac_addr(void)
* GPIO LEDs (simple - doesn't use hardware blinking support)
*/

#define ORION_BLINK_HALF_PERIOD 100 /* ms */

static int dns323_gpio_blink_set(unsigned gpio,
unsigned long *delay_on, unsigned long *delay_off)
{
static int value = 0;

if (!*delay_on && !*delay_off)
*delay_on = *delay_off = ORION_BLINK_HALF_PERIOD;

if (ORION_BLINK_HALF_PERIOD == *delay_on
&& ORION_BLINK_HALF_PERIOD == *delay_off) {
value = !value;
orion_gpio_set_blink(gpio, value);
return 0;
}

return -EINVAL;
}

static struct gpio_led dns323_leds[] = {
{
.name = "power:blue",
.gpio = DNS323_GPIO_LED_POWER,
.default_state = LEDS_GPIO_DEFSTATE_ON,
.gpio = DNS323_GPIO_LED_POWER2,
.default_trigger = "timer",
}, {
.name = "right:amber",
.gpio = DNS323_GPIO_LED_RIGHT_AMBER,
Expand All @@ -256,6 +277,7 @@ static struct gpio_led dns323_leds[] = {
static struct gpio_led_platform_data dns323_led_data = {
.num_leds = ARRAY_SIZE(dns323_leds),
.leds = dns323_leds,
.gpio_blink_set = dns323_gpio_blink_set,
};

static struct platform_device dns323_gpio_leds = {
Expand Down Expand Up @@ -412,6 +434,14 @@ static void __init dns323_init(void)
orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
platform_device_register(&dns323_nor_flash);

/* The 5181 power LED is active low and requires
* DNS323_GPIO_LED_POWER1 to also be low.
*/
if (dns323_dev_id() == MV88F5181_DEV_ID) {
dns323_leds[0].active_low = 1;
gpio_direction_output(DNS323_GPIO_LED_POWER1, 0);
}

platform_device_register(&dns323_gpio_leds);

platform_device_register(&dns323_button_device);
Expand Down

0 comments on commit 1a1d7e4

Please sign in to comment.