Commit 18775a7b authored by Bryan Wu's avatar Bryan Wu
Browse files

ARM: mach-sa1100: retire custom LED code



Signed-off-by: default avatarBryan Wu <bryan.wu@canonical.com>
parent dafbeadf
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -7,21 +7,17 @@ obj-y := clock.o generic.o irq.o time.o #nmi-oopser.o
obj-m :=
obj-n :=
obj-  :=
led-y := leds.o

obj-$(CONFIG_CPU_FREQ_SA1100)		+= cpu-sa1100.o
obj-$(CONFIG_CPU_FREQ_SA1110)		+= cpu-sa1110.o

# Specific board support
obj-$(CONFIG_SA1100_ASSABET)		+= assabet.o
led-$(CONFIG_SA1100_ASSABET)		+= leds-assabet.o
obj-$(CONFIG_ASSABET_NEPONSET)		+= neponset.o

obj-$(CONFIG_SA1100_BADGE4)		+= badge4.o
led-$(CONFIG_SA1100_BADGE4)		+= leds-badge4.o

obj-$(CONFIG_SA1100_CERF)		+= cerf.o
led-$(CONFIG_SA1100_CERF)		+= leds-cerf.o

obj-$(CONFIG_SA1100_COLLIE)		+= collie.o

@@ -29,13 +25,11 @@ obj-$(CONFIG_SA1100_H3100) += h3100.o h3xxx.o
obj-$(CONFIG_SA1100_H3600)		+= h3600.o h3xxx.o

obj-$(CONFIG_SA1100_HACKKIT)		+= hackkit.o
led-$(CONFIG_SA1100_HACKKIT)		+= leds-hackkit.o

obj-$(CONFIG_SA1100_JORNADA720)		+= jornada720.o
obj-$(CONFIG_SA1100_JORNADA720_SSP)	+= jornada720_ssp.o

obj-$(CONFIG_SA1100_LART)		+= lart.o
led-$(CONFIG_SA1100_LART)		+= leds-lart.o

obj-$(CONFIG_SA1100_NANOENGINE)		+= nanoengine.o
obj-$(CONFIG_PCI_NANOENGINE)		+= pci-nanoengine.o
@@ -46,9 +40,6 @@ obj-$(CONFIG_SA1100_SHANNON) += shannon.o

obj-$(CONFIG_SA1100_SIMPAD)		+= simpad.o

# LEDs support
obj-$(CONFIG_LEDS) += $(led-y)

# Miscellaneous functions
obj-$(CONFIG_PM)			+= pm.o sleep.o
obj-$(CONFIG_SA1100_SSP)		+= ssp.o
+85 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
#include <linux/mtd/partitions.h>
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/leds.h>
#include <linux/slab.h>

#include <video/sa1100fb.h>

@@ -529,6 +531,89 @@ static void __init assabet_map_io(void)
	sa1100_register_uart(2, 3);
}

/* LEDs */
#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
struct assabet_led {
	struct led_classdev cdev;
	u32 mask;
};

/*
 * The triggers lines up below will only be used if the
 * LED triggers are compiled in.
 */
static const struct {
	const char *name;
	const char *trigger;
} assabet_leds[] = {
	{ "assabet:red", "cpu0",},
	{ "assabet:green", "heartbeat", },
};

/*
 * The LED control in Assabet is reversed:
 *  - setting bit means turn off LED
 *  - clearing bit means turn on LED
 */
static void assabet_led_set(struct led_classdev *cdev,
		enum led_brightness b)
{
	struct assabet_led *led = container_of(cdev,
			struct assabet_led, cdev);

	if (b != LED_OFF)
		ASSABET_BCR_clear(led->mask);
	else
		ASSABET_BCR_set(led->mask);
}

static enum led_brightness assabet_led_get(struct led_classdev *cdev)
{
	struct assabet_led *led = container_of(cdev,
			struct assabet_led, cdev);

	return (ASSABET_BCR & led->mask) ? LED_OFF : LED_FULL;
}

static int __init assabet_leds_init(void)
{
	int i;

	if (!machine_is_assabet())
		return -ENODEV;

	for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) {
		struct assabet_led *led;

		led = kzalloc(sizeof(*led), GFP_KERNEL);
		if (!led)
			break;

		led->cdev.name = assabet_leds[i].name;
		led->cdev.brightness_set = assabet_led_set;
		led->cdev.brightness_get = assabet_led_get;
		led->cdev.default_trigger = assabet_leds[i].trigger;

		if (!i)
			led->mask = ASSABET_BCR_LED_RED;
		else
			led->mask = ASSABET_BCR_LED_GREEN;

		if (led_classdev_register(NULL, &led->cdev) < 0) {
			kfree(led);
			break;
		}
	}

	return 0;
}

/*
 * Since we may have triggers on any subsystem, defer registration
 * until after subsystem_init.
 */
fs_initcall(assabet_leds_init);
#endif

MACHINE_START(ASSABET, "Intel-Assabet")
	.atag_offset	= 0x100,
+30 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/errno.h>
#include <linux/gpio.h>
#include <linux/leds.h>

#include <mach/hardware.h>
#include <asm/mach-types.h>
@@ -76,8 +78,36 @@ static struct platform_device sa1111_device = {
	.resource	= sa1111_resources,
};

/* LEDs */
struct gpio_led badge4_gpio_leds[] = {
	{
		.name			= "badge4:red",
		.default_trigger	= "heartbeat",
		.gpio			= 7,
	},
	{
		.name			= "badge4:green",
		.default_trigger	= "cpu0",
		.gpio			= 9,
	},
};

static struct gpio_led_platform_data badge4_gpio_led_info = {
	.leds		= badge4_gpio_leds,
	.num_leds	= ARRAY_SIZE(badge4_gpio_leds),
};

static struct platform_device badge4_leds = {
	.name	= "leds-gpio",
	.id	= -1,
	.dev	= {
		.platform_data	= &badge4_gpio_led_info,
	}
};

static struct platform_device *devices[] __initdata = {
	&sa1111_device,
	&badge4_leds,
};

static int __init badge4_sa1111_init(void)
+42 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#include <linux/irq.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/gpio.h>
#include <linux/leds.h>

#include <mach/hardware.h>
#include <asm/setup.h>
@@ -43,8 +45,48 @@ static struct platform_device cerfuart2_device = {
	.resource	= cerfuart2_resources,
};

/* LEDs */
struct gpio_led cerf_gpio_leds[] = {
	{
		.name			= "cerf:d0",
		.default_trigger	= "heartbeat",
		.gpio			= 0,
	},
	{
		.name			= "cerf:d1",
		.default_trigger	= "cpu0",
		.gpio			= 1,
	},
	{
		.name			= "cerf:d2",
		.default_trigger	= "default-on",
		.gpio			= 2,
	},
	{
		.name			= "cerf:d3",
		.default_trigger	= "default-on",
		.gpio			= 3,
	},

};

static struct gpio_led_platform_data cerf_gpio_led_info = {
	.leds		= cerf_gpio_leds,
	.num_leds	= ARRAY_SIZE(cerf_gpio_leds),
};

static struct platform_device cerf_leds = {
	.name	= "leds-gpio",
	.id	= -1,
	.dev	= {
		.platform_data	= &cerf_gpio_led_info,
	}
};


static struct platform_device *cerf_devices[] __initdata = {
	&cerfuart2_device,
	&cerf_leds,
};

#ifdef CONFIG_SA1100_CERF_FLASH_32MB
+32 −0
Original line number Diff line number Diff line
@@ -21,6 +21,10 @@
#include <linux/serial_core.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/tty.h>
#include <linux/gpio.h>
#include <linux/leds.h>
#include <linux/platform_device.h>

#include <asm/mach-types.h>
#include <asm/setup.h>
@@ -183,9 +187,37 @@ static struct flash_platform_data hackkit_flash_data = {
static struct resource hackkit_flash_resource =
	DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);

/* LEDs */
struct gpio_led hackkit_gpio_leds[] = {
	{
		.name			= "hackkit:red",
		.default_trigger	= "cpu0",
		.gpio			= 22,
	},
	{
		.name			= "hackkit:green",
		.default_trigger	= "heartbeat",
		.gpio			= 23,
	},
};

static struct gpio_led_platform_data hackkit_gpio_led_info = {
	.leds		= hackkit_gpio_leds,
	.num_leds	= ARRAY_SIZE(hackkit_gpio_leds),
};

static struct platform_device hackkit_leds = {
	.name	= "leds-gpio",
	.id	= -1,
	.dev	= {
		.platform_data	= &hackkit_gpio_led_info,
	}
};

static void __init hackkit_init(void)
{
	sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1);
	platform_device_register(&hackkit_leds);
}

/**********************************************************************
Loading