Date: Mon, 22 Feb 2010 18:49:43 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r204218 - head/sys/powerpc/powermac Message-ID: <201002221849.o1MInhmj028274@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Mon Feb 22 18:49:43 2010 New Revision: 204218 URL: http://svn.freebsd.org/changeset/base/204218 Log: Provide a new useless feature: an led(4) interface for the system's sleep LED. Modified: head/sys/powerpc/powermac/smu.c Modified: head/sys/powerpc/powermac/smu.c ============================================================================== --- head/sys/powerpc/powermac/smu.c Mon Feb 22 18:07:41 2010 (r204217) +++ head/sys/powerpc/powermac/smu.c Mon Feb 22 18:49:43 2010 (r204218) @@ -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 de 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); +} +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002221849.o1MInhmj028274>