Module Name: src
Committed By: jruoho
Date: Wed Feb 16 07:30:28 UTC 2011
Modified Files:
src/distrib/sets/lists/man: mi
src/doc: CHANGES
src/share/man/man4: Makefile acpiwmi.4
src/sys/arch/i386/conf: ALL GENERIC
src/sys/dev/acpi/wmi: files.wmi
Added Files:
src/sys/dev/acpi/wmi: wmi_eeepc.c
src/sys/modules/wmieeepc: Makefile wmieeepc.ioconf
Log Message:
Add a skeleton driver for Asus EeePC acpiwmi(4) mappings.
To generate a diff of this commit:
cvs rdiff -u -r1.1288 -r1.1289 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.1506 -r1.1507 src/doc/CHANGES
cvs rdiff -u -r1.550 -r1.551 src/share/man/man4/Makefile
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/acpiwmi.4
cvs rdiff -u -r1.287 -r1.288 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1015 -r1.1016 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/wmi/files.wmi
cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/wmi/wmi_eeepc.c
cvs rdiff -u -r0 -r1.1 src/sys/modules/wmieeepc/Makefile \
src/sys/modules/wmieeepc/wmieeepc.ioconf
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1288 src/distrib/sets/lists/man/mi:1.1289
--- src/distrib/sets/lists/man/mi:1.1288 Mon Feb 14 08:50:38 2011
+++ src/distrib/sets/lists/man/mi Wed Feb 16 07:30:27 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1288 2011/02/14 08:50:38 hannken Exp $
+# $NetBSD: mi,v 1.1289 2011/02/16 07:30:27 jruoho Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -1762,6 +1762,7 @@
./usr/share/man/cat4/wi.0 man-sys-catman .cat
./usr/share/man/cat4/wm.0 man-sys-catman .cat
./usr/share/man/cat4/wmidell.0 man-sys-catman .cat
+./usr/share/man/cat4/wmieeepc.0 man-sys-catman .cat
./usr/share/man/cat4/wmihp.0 man-sys-catman .cat
./usr/share/man/cat4/wmimsi.0 man-sys-catman .cat
./usr/share/man/cat4/wpi.0 man-sys-catman .cat
@@ -4443,6 +4444,7 @@
./usr/share/man/html4/wi.html man-sys-htmlman html
./usr/share/man/html4/wm.html man-sys-htmlman html
./usr/share/man/html4/wmidell.html man-sys-htmlman html
+./usr/share/man/html4/wmieeepc.html man-sys-htmlman html
./usr/share/man/html4/wmihp.html man-sys-htmlman html
./usr/share/man/html4/wmimsi.html man-sys-htmlman html
./usr/share/man/html4/wpi.html man-sys-htmlman html
@@ -7059,6 +7061,7 @@
./usr/share/man/man4/wi.4 man-sys-man .man
./usr/share/man/man4/wm.4 man-sys-man .man
./usr/share/man/man4/wmidell.4 man-sys-man .man
+./usr/share/man/man4/wmieeepc.4 man-sys-man .man
./usr/share/man/man4/wmihp.4 man-sys-man .man
./usr/share/man/man4/wmimsi.4 man-sys-man .man
./usr/share/man/man4/wpi.4 man-sys-man .man
Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1506 src/doc/CHANGES:1.1507
--- src/doc/CHANGES:1.1506 Wed Feb 16 03:45:23 2011
+++ src/doc/CHANGES Wed Feb 16 07:30:27 2011
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1506 $>
+# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.1507 $>
#
#
# [Note: This file does not mention every change made to the NetBSD source tree.
@@ -614,8 +614,8 @@
hpcarm: Add support for Sharp W-ZERO3 series. [nonaka 20100417]
acpi(4): The sysctl(8) tree was reorganized into hw.acpi.
[jruoho 20100419]
- acpiwmi(4): Add three mappings, wmidell(4), wmihp(4), and wmimsi(4).
- [jruoho 20100419]
+ acpiwmi(4): Add four mappings; wmidell(4), wmieeepc(4),
+ wmihp(4), and wmimsi(4). [jruoho 20100419]
kernel: Enforce RLIMIT_FSIZE above the file system. This fixes
the feature for some file systems. [pooka 20100423]
libc: Added a space-efficient write-once database (cdbr(3), cdbw(3)).
Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.550 src/share/man/man4/Makefile:1.551
--- src/share/man/man4/Makefile:1.550 Mon Feb 14 08:50:39 2011
+++ src/share/man/man4/Makefile Wed Feb 16 07:30:26 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.550 2011/02/14 08:50:39 hannken Exp $
+# $NetBSD: Makefile,v 1.551 2011/02/16 07:30:26 jruoho Exp $
# @(#)Makefile 8.1 (Berkeley) 6/18/93
MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -155,6 +155,7 @@
MLINKS+=acpiec.4 acpiecdt.4
MLINKS+=acpivga.4 acpiout.4
MLINKS+=acpiwmi.4 wmidell.4 \
+ acpiwmi.4 wmieeepc.4 \
acpiwmi.4 wmihp.4 \
acpiwmi.4 wmimsi.4
MLINKS+=aibs.4 aiboost.4
Index: src/share/man/man4/acpiwmi.4
diff -u src/share/man/man4/acpiwmi.4:1.6 src/share/man/man4/acpiwmi.4:1.7
--- src/share/man/man4/acpiwmi.4:1.6 Mon Oct 25 07:34:30 2010
+++ src/share/man/man4/acpiwmi.4 Wed Feb 16 07:30:26 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: acpiwmi.4,v 1.6 2010/10/25 07:34:30 wiz Exp $
+.\" $NetBSD: acpiwmi.4,v 1.7 2011/02/16 07:30:26 jruoho Exp $
.\"
.\" Copyright (c) 2010 Jukka Ruohonen <[email protected]>
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd October 24, 2010
+.Dd February 16, 2011
.Dt ACPIWMI 4
.Os
.Sh NAME
@@ -35,6 +35,7 @@
.Cd "acpiwmi* at acpi?"
.Cd "acpiwmibus* at acpiwmi?"
.Cd "wmidell* at acpiwmibus?"
+.Cd "wmieeepc* at acpiwmibus?"
.Cd "wmihp* at acpiwmibus?"
.Cd "wmimsi* at acpiwmibus?"
.Sh DESCRIPTION
@@ -56,6 +57,8 @@
.Bl -tag -width "wmidell " -offset indent
.It Sy wmidell
Dell laptops
+.It Sy wmieeepc
+Some models of Asus Eee PC
.It Sy wmihp
Hewlett-Packard laptops
.It Sy wmimsi
Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.287 src/sys/arch/i386/conf/ALL:1.288
--- src/sys/arch/i386/conf/ALL:1.287 Mon Feb 14 08:50:39 2011
+++ src/sys/arch/i386/conf/ALL Wed Feb 16 07:30:27 2011
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.287 2011/02/14 08:50:39 hannken Exp $
+# $NetBSD: ALL,v 1.288 2011/02/16 07:30:27 jruoho Exp $
# From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
#
# ALL machine description file
@@ -17,7 +17,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "ALL-$Revision: 1.287 $"
+#ident "ALL-$Revision: 1.288 $"
maxusers 64 # estimated number of users
@@ -400,6 +400,7 @@
wb* at acpi? # Winbond W83L518D SD/MMC reader
sdmmc* at wb? # SD/MMC bus
wmidell* at acpiwmibus? # Dell WMI mappings
+wmieeepc* at acpiwmibus? # Asus Eee PC WMI mappings
wmihp* at acpiwmibus? # HP WMI mappings
wmimsi* at acpiwmibus? # MSI WMI mappings
wss* at acpi? # NeoMagic 256AV in wss mode
Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1015 src/sys/arch/i386/conf/GENERIC:1.1016
--- src/sys/arch/i386/conf/GENERIC:1.1015 Tue Feb 15 12:06:22 2011
+++ src/sys/arch/i386/conf/GENERIC Wed Feb 16 07:30:27 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1015 2011/02/15 12:06:22 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.1016 2011/02/16 07:30:27 jruoho Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.1015 $"
+#ident "GENERIC-$Revision: 1.1016 $"
maxusers 64 # estimated number of users
@@ -391,6 +391,7 @@
wb* at acpi? # Winbond W83L518D SD/MMC reader
sdmmc* at wb? # SD/MMC bus
wmidell* at acpiwmibus? # Dell WMI mappings
+wmieeepc* at acpiwmibus? # Asus Eee PC WMI mappings
#wmihp* at acpiwmibus? # HP WMI mappings
wmimsi* at acpiwmibus? # MSI WMI mappings
wss* at acpi? # NeoMagic 256AV in wss mode
Index: src/sys/dev/acpi/wmi/files.wmi
diff -u src/sys/dev/acpi/wmi/files.wmi:1.7 src/sys/dev/acpi/wmi/files.wmi:1.8
--- src/sys/dev/acpi/wmi/files.wmi:1.7 Sun Oct 24 08:54:15 2010
+++ src/sys/dev/acpi/wmi/files.wmi Wed Feb 16 07:30:26 2011
@@ -1,4 +1,4 @@
-# $NetBSD: files.wmi,v 1.7 2010/10/24 08:54:15 jruoho Exp $
+# $NetBSD: files.wmi,v 1.8 2011/02/16 07:30:26 jruoho Exp $
define acpiwmibus { }
@@ -12,6 +12,11 @@
attach wmidell at acpiwmibus
file dev/acpi/wmi/wmi_dell.c wmidell
+# Asus Eee PC WMI mappings
+device wmieeepc: sysmon_power
+attach wmieeepc at acpiwmibus
+file dev/acpi/wmi/wmi_eeepc.c wmieeepc
+
# HP WMI mappings
device wmihp: sysmon_envsys
attach wmihp at acpiwmibus
Added files:
Index: src/sys/dev/acpi/wmi/wmi_eeepc.c
diff -u /dev/null src/sys/dev/acpi/wmi/wmi_eeepc.c:1.1
--- /dev/null Wed Feb 16 07:30:28 2011
+++ src/sys/dev/acpi/wmi/wmi_eeepc.c Wed Feb 16 07:30:26 2011
@@ -0,0 +1,257 @@
+/* $NetBSD: wmi_eeepc.c,v 1.1 2011/02/16 07:30:26 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jukka Ruohonen.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: wmi_eeepc.c,v 1.1 2011/02/16 07:30:26 jruoho Exp $");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/module.h>
+
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+#include <dev/acpi/wmi/wmi_acpivar.h>
+
+#include <dev/sysmon/sysmonvar.h>
+
+#define _COMPONENT ACPI_RESOURCE_COMPONENT
+ACPI_MODULE_NAME ("wmi_eeepc")
+
+#define WMI_EEEPC_HK_VOLUME_UP 0x30
+#define WMI_EEEPC_HK_VOLUME_DOWN 0x31
+#define WMI_EEEPC_HK_VOLUME_MUTE 0x32
+#define WMI_EEEPC_HK_DISPLAY_CYCLE 0xCC
+#define WMI_EEEPC_HK_DISPLAY_OFF 0xE9
+/* WMI_EEEPC_HK_UNKNOWN 0xXX */
+
+#define WMI_EEEPC_PSW_DISPLAY_CYCLE 0
+#define WMI_EEEPC_PSW_COUNT 1
+
+#define WMI_EEEPC_GUID_EVENT "ABBC0F72-8EA1-11D1-00A0-C90629100000"
+
+struct wmi_eeepc_softc {
+ device_t sc_dev;
+ device_t sc_parent;
+ struct sysmon_pswitch sc_smpsw[WMI_EEEPC_PSW_COUNT];
+ bool sc_smpsw_valid;
+};
+
+static int wmi_eeepc_match(device_t, cfdata_t, void *);
+static void wmi_eeepc_attach(device_t, device_t, void *);
+static int wmi_eeepc_detach(device_t, int);
+static void wmi_eeepc_notify_handler(ACPI_HANDLE, uint32_t, void *);
+static bool wmi_eeepc_suspend(device_t, const pmf_qual_t *);
+static bool wmi_eeepc_resume(device_t, const pmf_qual_t *);
+
+CFATTACH_DECL_NEW(wmieeepc, sizeof(struct wmi_eeepc_softc),
+ wmi_eeepc_match, wmi_eeepc_attach, wmi_eeepc_detach, NULL);
+
+static int
+wmi_eeepc_match(device_t parent, cfdata_t match, void *aux)
+{
+ return acpi_wmi_guid_match(parent, WMI_EEEPC_GUID_EVENT);
+}
+
+static void
+wmi_eeepc_attach(device_t parent, device_t self, void *aux)
+{
+ static const int dc = WMI_EEEPC_PSW_DISPLAY_CYCLE;
+ struct wmi_eeepc_softc *sc = device_private(self);
+ ACPI_STATUS rv;
+
+ sc->sc_dev = self;
+ sc->sc_parent = parent;
+ sc->sc_smpsw_valid = false;
+
+ rv = acpi_wmi_event_register(parent, wmi_eeepc_notify_handler);
+
+ if (ACPI_FAILURE(rv)) {
+ aprint_error(": failed to install WMI notify handler\n");
+ return;
+ }
+
+ aprint_naive("\n");
+ aprint_normal(": Asus Eee PC WMI mappings\n");
+
+ sc->sc_smpsw[dc].smpsw_type = PSWITCH_TYPE_HOTKEY;
+ sc->sc_smpsw[dc].smpsw_name = PSWITCH_HK_DISPLAY_CYCLE;
+
+ if (sysmon_pswitch_register(&sc->sc_smpsw[dc]) == 0)
+ sc->sc_smpsw_valid = true;
+
+ (void)pmf_device_register(self, wmi_eeepc_suspend, wmi_eeepc_resume);
+}
+
+static int
+wmi_eeepc_detach(device_t self, int flags)
+{
+ struct wmi_eeepc_softc *sc = device_private(self);
+ device_t parent = sc->sc_parent;
+
+ (void)pmf_device_deregister(self);
+ (void)acpi_wmi_event_deregister(parent);
+
+ return 0;
+}
+
+static bool
+wmi_eeepc_suspend(device_t self, const pmf_qual_t *qual)
+{
+ struct wmi_eeepc_softc *sc = device_private(self);
+ device_t parent = sc->sc_parent;
+
+ (void)acpi_wmi_event_deregister(parent);
+
+ return true;
+}
+
+static bool
+wmi_eeepc_resume(device_t self, const pmf_qual_t *qual)
+{
+ struct wmi_eeepc_softc *sc = device_private(self);
+ device_t parent = sc->sc_parent;
+
+ (void)acpi_wmi_event_register(parent, wmi_eeepc_notify_handler);
+
+ return true;
+}
+
+static void
+wmi_eeepc_notify_handler(ACPI_HANDLE hdl, uint32_t evt, void *aux)
+{
+ static const int dc = WMI_EEEPC_PSW_DISPLAY_CYCLE;
+ struct wmi_eeepc_softc *sc;
+ device_t self = aux;
+ ACPI_OBJECT *obj;
+ ACPI_BUFFER buf;
+ ACPI_STATUS rv;
+ uint32_t val;
+
+ buf.Pointer = NULL;
+
+ sc = device_private(self);
+ rv = acpi_wmi_event_get(sc->sc_parent, evt, &buf);
+
+ if (ACPI_FAILURE(rv))
+ goto out;
+
+ obj = buf.Pointer;
+
+ if (obj->Type != ACPI_TYPE_INTEGER) {
+ rv = AE_TYPE;
+ goto out;
+ }
+
+ if (obj->Integer.Value > UINT32_MAX) {
+ rv = AE_LIMIT;
+ goto out;
+ }
+
+ val = obj->Integer.Value;
+
+ switch (val) {
+
+ case WMI_EEEPC_HK_VOLUME_UP:
+ pmf_event_inject(NULL, PMFE_AUDIO_VOLUME_UP);
+ break;
+
+ case WMI_EEEPC_HK_VOLUME_DOWN:
+ pmf_event_inject(NULL, PMFE_AUDIO_VOLUME_DOWN);
+ break;
+
+ case WMI_EEEPC_HK_VOLUME_MUTE:
+ pmf_event_inject(NULL, PMFE_AUDIO_VOLUME_TOGGLE);
+ break;
+
+ case WMI_EEEPC_HK_DISPLAY_CYCLE:
+
+ if (sc->sc_smpsw_valid != true) {
+ rv = AE_ABORT_METHOD;
+ break;
+ }
+
+ sysmon_pswitch_event(&sc->sc_smpsw[dc], PSWITCH_EVENT_PRESSED);
+ break;
+
+ case WMI_EEEPC_HK_DISPLAY_OFF:
+ break;
+
+ default:
+ aprint_debug_dev(sc->sc_dev,
+ "unknown key 0x%02X for event 0x%02X\n", val, evt);
+ break;
+ }
+
+out:
+ if (buf.Pointer != NULL)
+ ACPI_FREE(buf.Pointer);
+
+ if (ACPI_FAILURE(rv))
+ aprint_error_dev(sc->sc_dev, "failed to get data for "
+ "event 0x%02X: %s\n", evt, AcpiFormatException(rv));
+}
+
+MODULE(MODULE_CLASS_DRIVER, wmieeepc, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+wmieeepc_modcmd(modcmd_t cmd, void *aux)
+{
+ int rv = 0;
+
+ switch (cmd) {
+
+ case MODULE_CMD_INIT:
+
+#ifdef _MODULE
+ rv = config_init_component(cfdriver_ioconf_wmieeepc,
+ cfattach_ioconf_wmieeepc, cfdata_ioconf_wmieeepc);
+#endif
+ break;
+
+ case MODULE_CMD_FINI:
+
+#ifdef _MODULE
+ rv = config_fini_component(cfdriver_ioconf_wmieeepc,
+ cfattach_ioconf_wmieeepc, cfdata_ioconf_wmieeepc);
+#endif
+ break;
+
+ default:
+ rv = ENOTTY;
+ }
+
+ return rv;
+}
Index: src/sys/modules/wmieeepc/Makefile
diff -u /dev/null src/sys/modules/wmieeepc/Makefile:1.1
--- /dev/null Wed Feb 16 07:30:28 2011
+++ src/sys/modules/wmieeepc/Makefile Wed Feb 16 07:30:28 2011
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.1 2011/02/16 07:30:28 jruoho Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/dev/acpi/wmi
+
+KMOD= wmieeepc
+IOCONF= wmieeepc.ioconf
+SRCS= wmi_eeepc.c
+
+WARNS= 4
+
+.include <bsd.kmodule.mk>
Index: src/sys/modules/wmieeepc/wmieeepc.ioconf
diff -u /dev/null src/sys/modules/wmieeepc/wmieeepc.ioconf:1.1
--- /dev/null Wed Feb 16 07:30:28 2011
+++ src/sys/modules/wmieeepc/wmieeepc.ioconf Wed Feb 16 07:30:28 2011
@@ -0,0 +1,10 @@
+# $NetBSD: wmieeepc.ioconf,v 1.1 2011/02/16 07:30:28 jruoho Exp $
+
+ioconf wmieeepc
+
+include "conf/files"
+include "dev/acpi/wmi/files.wmi"
+
+pseudo-root acpiwmi*
+
+wmieeepc* at acpiwmibus?