diff --git a/distrib/sets/lists/man/mi b/distrib/sets/lists/man/mi index 4373f51aca6e..93ff99081897 100644 --- a/distrib/sets/lists/man/mi +++ b/distrib/sets/lists/man/mi @@ -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 diff --git a/doc/CHANGES b/doc/CHANGES index 29b12862d2eb..d6f7340249d9 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -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 @@ Changes from NetBSD 5.0 to NetBSD 6.0: 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)). diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index adea835719cf..d2c87133a017 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -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+=drm.4 viadrm.4 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 diff --git a/share/man/man4/acpiwmi.4 b/share/man/man4/acpiwmi.4 index aaaf35d88af4..796cd287b3e5 100644 --- a/share/man/man4/acpiwmi.4 +++ b/share/man/man4/acpiwmi.4 @@ -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 .\" 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 @@ mappings are supported: .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 diff --git a/sys/arch/i386/conf/ALL b/sys/arch/i386/conf/ALL index 2100f8173202..11362c2d84dc 100644 --- a/sys/arch/i386/conf/ALL +++ b/sys/arch/i386/conf/ALL @@ -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 @@ include "arch/i386/conf/std.i386" 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 @@ ug* at acpi? # Abit uGuru Hardware monitor 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 diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index b8d38894c4c8..67668976fa83 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -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 @@ include "arch/i386/conf/std.i386" 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 @@ vald* at acpi? # Toshiba Libretto hotkeys 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 diff --git a/sys/dev/acpi/wmi/files.wmi b/sys/dev/acpi/wmi/files.wmi index b85da7951ef7..9bce14651bd1 100644 --- a/sys/dev/acpi/wmi/files.wmi +++ b/sys/dev/acpi/wmi/files.wmi @@ -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 @@ device wmidell: sysmon_power 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 diff --git a/sys/dev/acpi/wmi/wmi_eeepc.c b/sys/dev/acpi/wmi/wmi_eeepc.c new file mode 100644 index 000000000000..85666149c8fe --- /dev/null +++ b/sys/dev/acpi/wmi/wmi_eeepc.c @@ -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 +__KERNEL_RCSID(0, "$NetBSD: wmi_eeepc.c,v 1.1 2011/02/16 07:30:26 jruoho Exp $"); + +#include +#include +#include + +#include +#include +#include + +#include + +#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; +} diff --git a/sys/modules/wmieeepc/Makefile b/sys/modules/wmieeepc/Makefile new file mode 100644 index 000000000000..643716cb62b9 --- /dev/null +++ b/sys/modules/wmieeepc/Makefile @@ -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 diff --git a/sys/modules/wmieeepc/wmieeepc.ioconf b/sys/modules/wmieeepc/wmieeepc.ioconf new file mode 100644 index 000000000000..c7ac78baaf0e --- /dev/null +++ b/sys/modules/wmieeepc/wmieeepc.ioconf @@ -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?