Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 112356
b: refs/heads/master
c: a7307bf
h: refs/heads/master
v: v3
  • Loading branch information
Andrew Victor authored and Russell King committed Sep 21, 2008
1 parent b9ebb02 commit 1572c75
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 11 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: bb1ad68b96a68e577a87ad62fe1aa26d052a52b5
refs/heads/master: a7307bf22557e1e029df0ea6f2a2973de4d9c135
25 changes: 17 additions & 8 deletions trunk/arch/arm/mach-at91/board-sam9263ek.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/fb.h>
#include <linux/gpio_keys.h>
#include <linux/input.h>
#include <linux/leds.h>

#include <video/atmel_lcdc.h>

Expand Down Expand Up @@ -339,25 +340,32 @@ static struct atmel_ac97_data ek_ac97_data = {
* LEDs ... these could all be PWM-driven, for variable brightness
*/
static struct gpio_led ek_leds[] = {
{ /* "left" led, green, userled1, pwm1 */
.name = "ds1",
.gpio = AT91_PIN_PB8,
.active_low = 1,
.default_trigger = "mmc0",
},
{ /* "right" led, green, userled2, pwm2 */
{ /* "right" led, green, userled2 (could be driven by pwm2) */
.name = "ds2",
.gpio = AT91_PIN_PC29,
.active_low = 1,
.default_trigger = "nand-disk",
},
{ /* "power" led, yellow, pwm0 */
{ /* "power" led, yellow (could be driven by pwm0) */
.name = "ds3",
.gpio = AT91_PIN_PB7,
.default_trigger = "heartbeat",
}
};

/*
* PWM Leds
*/
static struct gpio_led ek_pwm_led[] = {
/* For now only DS1 is PWM-driven (by pwm1) */
{
.name = "ds1",
.gpio = 1, /* is PWM channel number */
.active_low = 1,
.default_trigger = "none",
}
};


static void __init ek_board_init(void)
{
Expand Down Expand Up @@ -388,6 +396,7 @@ static void __init ek_board_init(void)
at91_add_device_ac97(&ek_ac97_data);
/* LEDs */
at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led));
}

MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/arm/mach-at91/include/mach/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ extern void __init at91_add_device_isi(void);
/* LEDs */
extern void __init at91_init_leds(u8 cpu_led, u8 timer_led);
extern void __init at91_gpio_leds(struct gpio_led *leds, int nr);
extern void __init at91_pwm_leds(struct gpio_led *leds, int nr);

/* FIXME: this needs a better location, but gets stuff building again */
extern int at91_suspend_entering_slow_clock(void);
Expand Down
41 changes: 39 additions & 2 deletions trunk/arch/arm/mach-at91/leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>

#include <mach/board.h>
#include <mach/gpio.h>
Expand All @@ -21,8 +22,6 @@

#if defined(CONFIG_NEW_LEDS)

#include <linux/platform_device.h>

/*
* New cross-platform LED support.
*/
Expand Down Expand Up @@ -55,6 +54,44 @@ void __init at91_gpio_leds(struct gpio_led *leds, int nr) {}
#endif


/* ------------------------------------------------------------------------- */

#if defined (CONFIG_LEDS_ATMEL_PWM)

/*
* PWM Leds
*/

static struct gpio_led_platform_data pwm_led_data;

static struct platform_device at91_pwm_leds = {
.name = "leds-atmel-pwm",
.id = -1,
.dev.platform_data = &pwm_led_data,
};

void __init at91_pwm_leds(struct gpio_led *leds, int nr)
{
int i;
u32 pwm_mask = 0;

if (!nr)
return;

for (i = 0; i < nr; i++)
pwm_mask |= (1 << leds[i].gpio);

pwm_led_data.leds = leds;
pwm_led_data.num_leds = nr;

at91_add_device_pwm(pwm_mask);
platform_device_register(&at91_pwm_leds);
}
#else
void __init at91_pwm_leds(struct gpio_led *leds, int nr){}
#endif


/* ------------------------------------------------------------------------- */

#if defined(CONFIG_LEDS)
Expand Down

0 comments on commit 1572c75

Please sign in to comment.