Skip to content

Commit

Permalink
ARM: mach-pxa: retire custom LED code
Browse files Browse the repository at this point in the history
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
  • Loading branch information
Bryan Wu committed Aug 1, 2012
1 parent 51891a4 commit 55f5d8e
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 411 deletions.
8 changes: 0 additions & 8 deletions arch/arm/mach-pxa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,4 @@ obj-$(CONFIG_MACH_RAUMFELD_CONNECTOR) += raumfeld.o
obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o
obj-$(CONFIG_MACH_ZIPIT2) += z2.o

# Support for blinky lights
led-y := leds.o
led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o
led-$(CONFIG_MACH_MAINSTONE) += leds-mainstone.o
led-$(CONFIG_ARCH_PXA_IDP) += leds-idp.o

obj-$(CONFIG_LEDS) += $(led-y)

obj-$(CONFIG_TOSA_BT) += tosa-bt.o
81 changes: 81 additions & 0 deletions arch/arm/mach-pxa/idp.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,87 @@ static void __init idp_map_io(void)
iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc));
}

/* LEDs */
#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
struct idp_led {
struct led_classdev cdev;
u8 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;
} idp_leds[] = {
{ "idp:green", "heartbeat", },
{ "idp:red", "cpu0", },
};

static void idp_led_set(struct led_classdev *cdev,
enum led_brightness b)
{
struct idp_led *led = container_of(cdev,
struct idp_led, cdev);
u32 reg = IDP_CPLD_LED_CONTROL;

if (b != LED_OFF)
reg &= ~led->mask;
else
reg |= led->mask;

IDP_CPLD_LED_CONTROL = reg;
}

static enum led_brightness idp_led_get(struct led_classdev *cdev)
{
struct idp_led *led = container_of(cdev,
struct idp_led, cdev);

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

static int __init idp_leds_init(void)
{
int i;

if (!machine_is_pxa_idp())
return -ENODEV;

for (i = 0; i < ARRAY_SIZE(idp_leds); i++) {
struct idp_led *led;

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

led->cdev.name = idp_leds[i].name;
led->cdev.brightness_set = idp_led_set;
led->cdev.brightness_get = idp_led_get;
led->cdev.default_trigger = idp_leds[i].trigger;

if (i == 0)
led->mask = IDP_HB_LED;
else
led->mask = IDP_BUSY_LED;

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(idp_leds_init);
#endif

MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
/* Maintainer: Vibren Technologies */
Expand Down
115 changes: 0 additions & 115 deletions arch/arm/mach-pxa/leds-idp.c

This file was deleted.

124 changes: 0 additions & 124 deletions arch/arm/mach-pxa/leds-lubbock.c

This file was deleted.

Loading

0 comments on commit 55f5d8e

Please sign in to comment.