Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 326988
b: refs/heads/master
c: 18775a7
h: refs/heads/master
v: v3
  • Loading branch information
Bryan Wu committed Aug 1, 2012
1 parent 745e2bb commit 4917cc5
Show file tree
Hide file tree
Showing 14 changed files with 216 additions and 616 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: dafbeadf4a9e1b2765641b687e3343be76d2eacd
refs/heads/master: 18775a7bea8fbbebe8818db7a64aaeb40b40a0c5
9 changes: 0 additions & 9 deletions trunk/arch/arm/mach-sa1100/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,29 @@ 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

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
Expand All @@ -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
Expand Down
85 changes: 85 additions & 0 deletions trunk/arch/arm/mach-sa1100/assabet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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,
Expand Down
30 changes: 30 additions & 0 deletions trunk/arch/arm/mach-sa1100/badge4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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)
Expand Down
42 changes: 42 additions & 0 deletions trunk/arch/arm/mach-sa1100/cerf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Expand Down
32 changes: 32 additions & 0 deletions trunk/arch/arm/mach-sa1100/hackkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
}

/**********************************************************************
Expand Down
26 changes: 26 additions & 0 deletions trunk/arch/arm/mach-sa1100/lart.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/tty.h>
#include <linux/gpio.h>
#include <linux/leds.h>
#include <linux/platform_device.h>

#include <video/sa1100fb.h>

Expand Down Expand Up @@ -126,6 +129,27 @@ static struct map_desc lart_io_desc[] __initdata = {
}
};

/* LEDs */
struct gpio_led lart_gpio_leds[] = {
{
.name = "lart:red",
.default_trigger = "cpu0",
.gpio = 23,
},
};

static struct gpio_led_platform_data lart_gpio_led_info = {
.leds = lart_gpio_leds,
.num_leds = ARRAY_SIZE(lart_gpio_leds),
};

static struct platform_device lart_leds = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &lart_gpio_led_info,
}
};
static void __init lart_map_io(void)
{
sa1100_map_io();
Expand All @@ -139,6 +163,8 @@ static void __init lart_map_io(void)
GPDR |= GPIO_UART_TXD;
GPDR &= ~GPIO_UART_RXD;
PPAR |= PPAR_UPR;

platform_device_register(&lart_leds);
}

MACHINE_START(LART, "LART")
Expand Down
Loading

0 comments on commit 4917cc5

Please sign in to comment.