From 3501c0716c24890a945c711e1ad7c6c218121b66 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Wed, 8 Aug 2007 12:23:41 +0000 Subject: [PATCH] Use the dmz led as diagnostic led SVN-Revision: 8380 --- .../rdc-2.6/base-files/default/etc/diag.sh | 19 +++++++++++++++++++ target/linux/rdc-2.6/config/default | 2 +- .../rdc-2.6/files/drivers/leds/leds-rdc3211.c | 9 ++------- 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 target/linux/rdc-2.6/base-files/default/etc/diag.sh diff --git a/target/linux/rdc-2.6/base-files/default/etc/diag.sh b/target/linux/rdc-2.6/base-files/default/etc/diag.sh new file mode 100644 index 0000000000..8d5c38262c --- /dev/null +++ b/target/linux/rdc-2.6/base-files/default/etc/diag.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Copyright (C) 2007 OpenWrt.org + +set_led() { + local led="$1" + local state="$2" + [ -d "/sys/class/leds/rdc321x:$led" ] && echo "$state" > "/sys/class/leds/rdc321x:$led/brightness" +} + +set_state() { + case "$1" in + preinit) + set_led dmz 1 + ;; + done) + set_led dmz 0 + ;; + esac +} diff --git a/target/linux/rdc-2.6/config/default b/target/linux/rdc-2.6/config/default index d64a9fb077..b3681d0f11 100644 --- a/target/linux/rdc-2.6/config/default +++ b/target/linux/rdc-2.6/config/default @@ -104,7 +104,7 @@ CONFIG_KEXEC=y CONFIG_KTIME_SCALAR=y # CONFIG_KVM is not set CONFIG_LBD=y -CONFIG_LEDS_RDC3211=m +CONFIG_LEDS_RDC3211=y CONFIG_LSF=y # CONFIG_M386 is not set CONFIG_M486=y diff --git a/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c b/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c index f29047340e..ae068af14f 100644 --- a/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c +++ b/target/linux/rdc-2.6/files/drivers/leds/leds-rdc3211.c @@ -18,14 +18,9 @@ #include -/* This is just for testing purpose */ -int gpio=-1; -module_param(gpio, int, 0444); -MODULE_PARM_DESC(gpio, " GPIO line"); - static void rdc321x_led_set(struct led_classdev *led_cdev, enum led_brightness brightness) { - gpio_set_value(gpio, brightness ? 1 : 0); + gpio_set_value(1, brightness ? 1 : 0); } /* The DMZ led is at GPIO line 1 */ @@ -58,7 +53,7 @@ static int __init rdc321x_leds_init(void) { int ret; - ret = gpio+1?platform_driver_register(&rdc321x_leds_driver):-EINVAL; + ret = platform_driver_register(&rdc321x_leds_driver); return ret; } -- 2.25.1