mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 09:34:17 +00:00
ARM: mach-orion5x: convert custom LED code to gpio_led and LED CPU trigger
Signed-off-by: Bryan Wu <bryan.wu@canonical.com> Acked-by: Nicolas Pitre <nico@fluxnic.net>
This commit is contained in:
parent
408a4b2e0f
commit
77a4949436
@ -18,7 +18,6 @@
|
|||||||
#include <linux/ethtool.h>
|
#include <linux/ethtool.h>
|
||||||
#include <net/dsa.h>
|
#include <net/dsa.h>
|
||||||
#include <asm/mach-types.h>
|
#include <asm/mach-types.h>
|
||||||
#include <asm/leds.h>
|
|
||||||
#include <asm/mach/arch.h>
|
#include <asm/mach/arch.h>
|
||||||
#include <asm/mach/pci.h>
|
#include <asm/mach/pci.h>
|
||||||
#include <mach/orion5x.h>
|
#include <mach/orion5x.h>
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <net/dsa.h>
|
#include <net/dsa.h>
|
||||||
#include <asm/mach-types.h>
|
#include <asm/mach-types.h>
|
||||||
#include <asm/leds.h>
|
|
||||||
#include <asm/mach/arch.h>
|
#include <asm/mach/arch.h>
|
||||||
#include <asm/mach/pci.h>
|
#include <asm/mach/pci.h>
|
||||||
#include <mach/orion5x.h>
|
#include <mach/orion5x.h>
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#include <linux/mv643xx_eth.h>
|
#include <linux/mv643xx_eth.h>
|
||||||
#include <linux/ata_platform.h>
|
#include <linux/ata_platform.h>
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
|
#include <linux/leds.h>
|
||||||
#include <asm/mach-types.h>
|
#include <asm/mach-types.h>
|
||||||
#include <asm/leds.h>
|
|
||||||
#include <asm/mach/arch.h>
|
#include <asm/mach/arch.h>
|
||||||
#include <asm/mach/pci.h>
|
#include <asm/mach/pci.h>
|
||||||
#include <mach/orion5x.h>
|
#include <mach/orion5x.h>
|
||||||
@ -53,12 +53,6 @@
|
|||||||
#define RD88F5182_PCI_SLOT0_IRQ_A_PIN 7
|
#define RD88F5182_PCI_SLOT0_IRQ_A_PIN 7
|
||||||
#define RD88F5182_PCI_SLOT0_IRQ_B_PIN 6
|
#define RD88F5182_PCI_SLOT0_IRQ_B_PIN 6
|
||||||
|
|
||||||
/*
|
|
||||||
* GPIO Debug LED
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define RD88F5182_GPIO_DBG_LED 0
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* 16M NOR Flash on Device bus CS1
|
* 16M NOR Flash on Device bus CS1
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -83,55 +77,32 @@ static struct platform_device rd88f5182_nor_flash = {
|
|||||||
.resource = &rd88f5182_nor_flash_resource,
|
.resource = &rd88f5182_nor_flash_resource,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_LEDS
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Use GPIO debug led as CPU active indication
|
* Use GPIO LED as CPU active indication
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void rd88f5182_dbgled_event(led_event_t evt)
|
#define RD88F5182_GPIO_LED 0
|
||||||
{
|
|
||||||
int val;
|
|
||||||
|
|
||||||
if (evt == led_idle_end)
|
static struct gpio_led rd88f5182_gpio_led_pins[] = {
|
||||||
val = 1;
|
{
|
||||||
else if (evt == led_idle_start)
|
.name = "rd88f5182:cpu",
|
||||||
val = 0;
|
.default_trigger = "cpu0",
|
||||||
else
|
.gpio = RD88F5182_GPIO_LED,
|
||||||
return;
|
},
|
||||||
|
};
|
||||||
|
|
||||||
gpio_set_value(RD88F5182_GPIO_DBG_LED, val);
|
static struct gpio_led_platform_data rd88f5182_gpio_led_data = {
|
||||||
}
|
.leds = rd88f5182_gpio_led_pins,
|
||||||
|
.num_leds = ARRAY_SIZE(rd88f5182_gpio_led_pins),
|
||||||
|
};
|
||||||
|
|
||||||
static int __init rd88f5182_dbgled_init(void)
|
static struct platform_device rd88f5182_gpio_leds = {
|
||||||
{
|
.name = "leds-gpio",
|
||||||
int pin;
|
.id = -1,
|
||||||
|
.dev = {
|
||||||
if (machine_is_rd88f5182()) {
|
.platform_data = &rd88f5182_gpio_led_data,
|
||||||
pin = RD88F5182_GPIO_DBG_LED;
|
},
|
||||||
|
};
|
||||||
if (gpio_request(pin, "DBGLED") == 0) {
|
|
||||||
if (gpio_direction_output(pin, 0) != 0) {
|
|
||||||
printk(KERN_ERR "rd88f5182_dbgled_init failed "
|
|
||||||
"to set output pin %d\n", pin);
|
|
||||||
gpio_free(pin);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printk(KERN_ERR "rd88f5182_dbgled_init failed "
|
|
||||||
"to request gpio %d\n", pin);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
leds_event = rd88f5182_dbgled_event;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
__initcall(rd88f5182_dbgled_init);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* PCI
|
* PCI
|
||||||
@ -298,6 +269,7 @@ static void __init rd88f5182_init(void)
|
|||||||
|
|
||||||
orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
|
orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
|
||||||
platform_device_register(&rd88f5182_nor_flash);
|
platform_device_register(&rd88f5182_nor_flash);
|
||||||
|
platform_device_register(&rd88f5182_gpio_leds);
|
||||||
|
|
||||||
i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
|
i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include <linux/ethtool.h>
|
#include <linux/ethtool.h>
|
||||||
#include <net/dsa.h>
|
#include <net/dsa.h>
|
||||||
#include <asm/mach-types.h>
|
#include <asm/mach-types.h>
|
||||||
#include <asm/leds.h>
|
|
||||||
#include <asm/mach/arch.h>
|
#include <asm/mach/arch.h>
|
||||||
#include <asm/mach/pci.h>
|
#include <asm/mach/pci.h>
|
||||||
#include <mach/orion5x.h>
|
#include <mach/orion5x.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user