From owner-svn-src-head@FreeBSD.ORG Mon Feb 22 18:49:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 657D11065672; Mon, 22 Feb 2010 18:49:43 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 542548FC13; Mon, 22 Feb 2010 18:49:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1MInhui028276; Mon, 22 Feb 2010 18:49:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1MInhmj028274; Mon, 22 Feb 2010 18:49:43 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201002221849.o1MInhmj028274@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 22 Feb 2010 18:49:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204218 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 18:49:43 -0000 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 #include +#include #include #include #include @@ -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); +} +