Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add a skeleton driver for Asus EeePC acpiwmi(4) mappings.



details:   https://anonhg.NetBSD.org/src/rev/c907fe7c32cd
branches:  trunk
changeset: 762120:c907fe7c32cd
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Wed Feb 16 07:30:26 2011 +0000

description:
Add a skeleton driver for Asus EeePC acpiwmi(4) mappings.

diffstat:

 distrib/sets/lists/man/mi            |    5 +-
 doc/CHANGES                          |    6 +-
 share/man/man4/Makefile              |    3 +-
 share/man/man4/acpiwmi.4             |    7 +-
 sys/arch/i386/conf/ALL               |    5 +-
 sys/arch/i386/conf/GENERIC           |    5 +-
 sys/dev/acpi/wmi/files.wmi           |    7 +-
 sys/dev/acpi/wmi/wmi_eeepc.c         |  257 +++++++++++++++++++++++++++++++++++
 sys/modules/wmieeepc/Makefile        |   13 +
 sys/modules/wmieeepc/wmieeepc.ioconf |   10 +
 10 files changed, 306 insertions(+), 12 deletions(-)

diffs (truncated from 470 to 300 lines):

diff -r e870cc763d19 -r c907fe7c32cd distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Wed Feb 16 06:14:01 2011 +0000
+++ b/distrib/sets/lists/man/mi Wed Feb 16 07:30:26 2011 +0000
@@ -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 -r e870cc763d19 -r c907fe7c32cd doc/CHANGES
--- a/doc/CHANGES       Wed Feb 16 06:14:01 2011 +0000
+++ b/doc/CHANGES       Wed Feb 16 07:30:26 2011 +0000
@@ -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)).
diff -r e870cc763d19 -r c907fe7c32cd share/man/man4/Makefile
--- a/share/man/man4/Makefile   Wed Feb 16 06:14:01 2011 +0000
+++ b/share/man/man4/Makefile   Wed Feb 16 07:30:26 2011 +0000
@@ -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
diff -r e870cc763d19 -r c907fe7c32cd share/man/man4/acpiwmi.4
--- a/share/man/man4/acpiwmi.4  Wed Feb 16 06:14:01 2011 +0000
+++ b/share/man/man4/acpiwmi.4  Wed Feb 16 07:30:26 2011 +0000
@@ -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 <jruohonen%iki.fi@localhost>
 .\" 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
diff -r e870cc763d19 -r c907fe7c32cd sys/arch/i386/conf/ALL
--- a/sys/arch/i386/conf/ALL    Wed Feb 16 06:14:01 2011 +0000
+++ b/sys/arch/i386/conf/ALL    Wed Feb 16 07:30:26 2011 +0000
@@ -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
diff -r e870cc763d19 -r c907fe7c32cd sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC        Wed Feb 16 06:14:01 2011 +0000
+++ b/sys/arch/i386/conf/GENERIC        Wed Feb 16 07:30:26 2011 +0000
@@ -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
diff -r e870cc763d19 -r c907fe7c32cd sys/dev/acpi/wmi/files.wmi
--- a/sys/dev/acpi/wmi/files.wmi        Wed Feb 16 06:14:01 2011 +0000
+++ b/sys/dev/acpi/wmi/files.wmi        Wed Feb 16 07:30:26 2011 +0000
@@ -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
diff -r e870cc763d19 -r c907fe7c32cd sys/dev/acpi/wmi/wmi_eeepc.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/acpi/wmi/wmi_eeepc.c      Wed Feb 16 07:30:26 2011 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index