mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-05 05:49:42 +02:00
115a129a30
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11933 3c298f89-4303-0410-b956-a3cf2f4a3e73
168 lines
3.7 KiB
Diff
168 lines
3.7 KiB
Diff
--- a/arch/arm/mach-at91/at91rm9200_devices.c
|
|
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
|
|
@@ -717,6 +717,26 @@
|
|
static void __init at91_add_device_watchdog(void) {}
|
|
#endif
|
|
|
|
+/* --------------------------------------------------------------------
|
|
+ * LEDs
|
|
+ * -------------------------------------------------------------------- */
|
|
+
|
|
+#if defined(CONFIG_LEDS)
|
|
+u8 at91_leds_cpu;
|
|
+u8 at91_leds_timer;
|
|
+
|
|
+void __init at91_init_leds(u8 cpu_led, u8 timer_led)
|
|
+{
|
|
+ /* Enable GPIO to access the LEDs */
|
|
+ at91_set_gpio_output(cpu_led, 1);
|
|
+ at91_set_gpio_output(timer_led, 1);
|
|
+
|
|
+ at91_leds_cpu = cpu_led;
|
|
+ at91_leds_timer = timer_led;
|
|
+}
|
|
+#else
|
|
+void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
|
|
+#endif
|
|
|
|
/* --------------------------------------------------------------------
|
|
* SSC -- Synchronous Serial Controller
|
|
--- a/arch/arm/mach-at91/Makefile
|
|
+++ b/arch/arm/mach-at91/Makefile
|
|
@@ -60,7 +60,12 @@
|
|
obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o
|
|
|
|
# Drivers
|
|
-obj-y += leds.o
|
|
+ifeq ($(CONFIG_MACH_VLINK),y)
|
|
+led-$(CONFIG_MACH_VLINK) += vlink_leds.o
|
|
+else
|
|
+led-y += leds.o
|
|
+endif
|
|
+obj-y += $(led-y)
|
|
obj-$(CONFIG_FB_S1D13XXX) += ics1523.o
|
|
|
|
# Power Management
|
|
--- /dev/null
|
|
+++ b/arch/arm/mach-at91/vlink_leds.c
|
|
@@ -0,0 +1,105 @@
|
|
+/*
|
|
+ * LED driver for Atmel AT91-based boards.
|
|
+ *
|
|
+ * Copyright (C) SAN People (Pty) Ltd
|
|
+ * Modified for FDL VersaLink Copyright (C) Guthrie Consulting
|
|
+ *
|
|
+ * This program is free software; you can redistribute it and/or
|
|
+ * modify it under the terms of the GNU General Public License
|
|
+ * as published by the Free Software Foundation; either version
|
|
+ * 2 of the License, or (at your option) any later version.
|
|
+*/
|
|
+
|
|
+#include <linux/kernel.h>
|
|
+#include <linux/module.h>
|
|
+#include <linux/init.h>
|
|
+
|
|
+#include <asm/mach-types.h>
|
|
+#include <asm/leds.h>
|
|
+#include <asm/arch/board.h>
|
|
+#include <asm/arch/gpio.h>
|
|
+
|
|
+
|
|
+static inline void at91_led_on(unsigned int led)
|
|
+{
|
|
+ at91_set_gpio_value(led, 0);
|
|
+}
|
|
+
|
|
+static inline void at91_led_off(unsigned int led)
|
|
+{
|
|
+ at91_set_gpio_value(led, 1);
|
|
+}
|
|
+
|
|
+static inline void at91_led_toggle(unsigned int led)
|
|
+{
|
|
+ unsigned long is_off = at91_get_gpio_value(led);
|
|
+ if (is_off) {
|
|
+ at91_led_on(led);
|
|
+ at91_led_off(at91_leds_cpu);
|
|
+ }
|
|
+ else {
|
|
+ at91_led_on(at91_leds_cpu);
|
|
+ at91_led_off(led);
|
|
+ }
|
|
+}
|
|
+
|
|
+
|
|
+/*
|
|
+ * Handle LED events.
|
|
+ */
|
|
+
|
|
+/*
|
|
+ * VersaLink has a single bi-coloured LED which changes colour when the
|
|
+ * polarity is reversed
|
|
+ */
|
|
+static void at91_leds_event(led_event_t evt)
|
|
+{
|
|
+ unsigned long flags;
|
|
+
|
|
+ local_irq_save(flags);
|
|
+
|
|
+ switch(evt) {
|
|
+ case led_start: /* System startup */
|
|
+ at91_led_toggle(at91_leds_timer);
|
|
+ break;
|
|
+
|
|
+ case led_stop: /* System stop / suspend */
|
|
+ at91_led_toggle(at91_leds_timer);
|
|
+ break;
|
|
+
|
|
+#ifdef CONFIG_LEDS_TIMER
|
|
+ case led_timer: /* Every 50 timer ticks */
|
|
+ at91_led_toggle(at91_leds_timer);
|
|
+ break;
|
|
+#endif
|
|
+
|
|
+#ifdef CONFIG_LEDS_CPU
|
|
+ case led_idle_start: /* Entering idle state */
|
|
+ at91_led_toggle(at91_leds_timer);
|
|
+ break;
|
|
+
|
|
+ case led_idle_end: /* Exit idle state */
|
|
+ at91_led_toggle(at91_leds_timer);
|
|
+ break;
|
|
+#endif
|
|
+
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ local_irq_restore(flags);
|
|
+}
|
|
+
|
|
+
|
|
+static int __init leds_init(void)
|
|
+{
|
|
+ if (!at91_leds_timer || !at91_leds_cpu)
|
|
+ return -ENODEV;
|
|
+
|
|
+ leds_event = at91_leds_event;
|
|
+
|
|
+ leds_event(led_start);
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+__initcall(leds_init);
|
|
--- a/include/asm-arm/arch-at91/board.h
|
|
+++ b/include/asm-arm/arch-at91/board.h
|
|
@@ -162,6 +162,11 @@
|
|
/* ISI */
|
|
extern void __init at91_add_device_isi(void);
|
|
|
|
+ /* LEDs */
|
|
+extern u8 at91_leds_cpu;
|
|
+extern u8 at91_leds_timer;
|
|
+extern void __init at91_init_leds(u8 cpu_led, u8 timer_led);
|
|
+
|
|
/* Touchscreen Controller */
|
|
extern void __init at91_add_device_tsadcc(void);
|
|
|