2010-04-30 03:34:14 +00:00
|
|
|
/*
|
|
|
|
* Status LED driver based on GPIO access conventions of Linux
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
|
2010-06-09 05:32:46 +00:00
|
|
|
* Licensed under the GPL-2 or later.
|
2010-04-30 03:34:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <status_led.h>
|
|
|
|
#include <asm/gpio.h>
|
|
|
|
|
|
|
|
void __led_init(led_id_t mask, int state)
|
|
|
|
{
|
2010-06-09 05:32:46 +00:00
|
|
|
gpio_request(mask, "gpio_led");
|
|
|
|
gpio_direction_output(mask, state == STATUS_LED_ON);
|
2010-04-30 03:34:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void __led_set(led_id_t mask, int state)
|
|
|
|
{
|
2010-06-09 05:32:46 +00:00
|
|
|
gpio_set_value(mask, state == STATUS_LED_ON);
|
2010-04-30 03:34:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void __led_toggle(led_id_t mask)
|
|
|
|
{
|
|
|
|
gpio_set_value(mask, !gpio_get_value(mask));
|
|
|
|
}
|