summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2010-02-22 18:49:43 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2010-02-22 18:49:43 +0000
commit896dff6fe70220a554a113992ae7778e9c870f6b (patch)
tree97c859e453ee46415eee08e2a8201d87dd721e2a
parent48a4a57e8d5177299c9f6dca6c39f816dee96365 (diff)
downloadFreeBSD-src-896dff6fe70220a554a113992ae7778e9c870f6b.zip
FreeBSD-src-896dff6fe70220a554a113992ae7778e9c870f6b.tar.gz
Provide a new useless feature: an led(4) interface for the system's sleep
LED.
-rw-r--r--sys/powerpc/powermac/smu.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/powerpc/powermac/smu.c b/sys/powerpc/powermac/smu.c
index f0e17d5..2692757 100644
--- a/sys/powerpc/powermac/smu.c
+++ b/sys/powerpc/powermac/smu.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/md_var.h>
+#include <dev/led/led.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <powerpc/powermac/macgpiovar.h>
@@ -114,6 +115,8 @@ struct smu_softc {
/* Thermal management parameters */
int sc_target_temp; /* Default 55 C */
int sc_critical_temp; /* Default 90 C */
+
+ struct cdev *sc_leddev;
};
/* regular bus attachment functions */
@@ -133,6 +136,7 @@ static int smu_get_datablock(device_t dev, int8_t id, uint8_t *buf,
static void smu_attach_fans(device_t dev, phandle_t fanroot);
static void smu_attach_sensors(device_t dev, phandle_t sensroot);
static void smu_fanmgt_callout(void *xdev);
+static void smu_set_sleepled(void *xdev, int onoff);
/* where to find the doorbell GPIO */
@@ -292,6 +296,11 @@ smu_attach(device_t dev)
callout_init(&sc->sc_fanmgt_callout, 1);
smu_fanmgt_callout(dev);
+ /*
+ * Set up LED interface
+ */
+ sc->sc_leddev = led_create(smu_set_sleepled, dev, "sleepled");
+
return (0);
}
@@ -853,3 +862,18 @@ smu_fanmgt_callout(void *xdev) {
ms_to_ticks(SMU_FANMGT_INTERVAL), smu_fanmgt_callout, smu);
}
+static void
+smu_set_sleepled(void *xdev, int onoff)
+{
+ struct smu_cmd cmd;
+ device_t smu = xdev;
+
+ cmd.cmd = SMU_MISC;
+ cmd.len = 3;
+ cmd.data[0] = SMU_MISC_LED_CTRL;
+ cmd.data[1] = 0;
+ cmd.data[2] = onoff;
+
+ smu_run_cmd(smu, &cmd);
+}
+
OpenPOWER on IntegriCloud