Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add acpiwmi(4) mappings for MSI laptops.
details: https://anonhg.NetBSD.org/src/rev/3add042e69a6
branches: trunk
changeset: 758168:3add042e69a6
user: jruoho <jruoho%NetBSD.org@localhost>
date: Sun Oct 24 08:54:14 2010 +0000
description:
Add acpiwmi(4) mappings for MSI laptops.
XXX: It may be necessary to fix PR # 43659 before this works on all models.
diffstat:
distrib/sets/lists/man/mi | 5 +-
share/man/man4/acpiwmi.4 | 26 ++---
sys/arch/amd64/conf/GENERIC | 5 +-
sys/arch/i386/conf/GENERIC | 5 +-
sys/dev/acpi/wmi/files.wmi | 7 +-
sys/dev/acpi/wmi/wmi_msi.c | 194 ++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 220 insertions(+), 22 deletions(-)
diffs (truncated from 370 to 300 lines):
diff -r 6a81bd854ca7 -r 3add042e69a6 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Sun Oct 24 08:31:49 2010 +0000
+++ b/distrib/sets/lists/man/mi Sun Oct 24 08:54:14 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1241 2010/10/19 11:58:00 pgoyette Exp $
+# $NetBSD: mi,v 1.1242 2010/10/24 08:54:14 jruoho Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -1719,6 +1719,7 @@
./usr/share/man/cat4/wm.0 man-sys-catman .cat
./usr/share/man/cat4/wmidell.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
./usr/share/man/cat4/wscons.0 man-sys-catman .cat
./usr/share/man/cat4/wsdisplay.0 man-sys-catman .cat
@@ -4326,6 +4327,7 @@
./usr/share/man/html4/wm.html man-sys-htmlman html
./usr/share/man/html4/wmidell.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
./usr/share/man/html4/wscons.html man-sys-htmlman html
./usr/share/man/html4/wsdisplay.html man-sys-htmlman html
@@ -6871,6 +6873,7 @@
./usr/share/man/man4/wm.4 man-sys-man .man
./usr/share/man/man4/wmidell.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
./usr/share/man/man4/wscons.4 man-sys-man .man
./usr/share/man/man4/wsdisplay.4 man-sys-man .man
diff -r 6a81bd854ca7 -r 3add042e69a6 share/man/man4/acpiwmi.4
--- a/share/man/man4/acpiwmi.4 Sun Oct 24 08:31:49 2010 +0000
+++ b/share/man/man4/acpiwmi.4 Sun Oct 24 08:54:14 2010 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: acpiwmi.4,v 1.4 2010/04/08 18:31:53 jruoho Exp $
+.\" $NetBSD: acpiwmi.4,v 1.5 2010/10/24 08:54:15 jruoho Exp $
.\"
.\" Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
.\" All rights reserved.
@@ -36,10 +36,11 @@
.Cd "acpiwmibus* at acpiwmi?"
.Cd "wmidell* at acpiwmibus?"
.Cd "wmihp* at acpiwmibus?"
+.Cd "wmimsi* at acpiwmibus?"
.Sh DESCRIPTION
The
.Nm
-driver provides an
+device driver provides an
.Tn ACPI
interface for Windows Management Instrumentation
.Pq Tn WMI .
@@ -57,13 +58,16 @@
Dell laptops
.It Sy wmihp
Hewlett-Packard laptops
+.It Sy wmimsi
+MSI laptops
.El
.Pp
The functionality varies from vendor to vendor.
Typically the interface is used for function and hotkey handling,
but additional features may be present.
.Sh SEE ALSO
-.Xr acpi 4
+.Xr acpi 4 ,
+.Xr acpidalb 4
.Rs
.%A Microsoft Corporation
.%D December 4, 2001
@@ -78,19 +82,9 @@
.Sh AUTHORS
.An Jukka Ruohonen
.Aq jruohonen%iki.fi@localhost
-wrote the actual
+wrote
.Nm
-as well as
-.Sy wmidell
-and
-.Sy wmihp .
-The
-.Sy wmihp
-was based on the earlier work done by
-.An Michael Gmelin
-.Aq freebsd%grem.de@localhost
-for
-.Fx .
+and most of the mappings.
.Sh CAVEATS
While
.Tn WMI
@@ -100,5 +94,5 @@
.Pp
The
.Sy wmihp
-driver conflicts with
+driver may conflict with
.Xr hpqlb 4 .
diff -r 6a81bd854ca7 -r 3add042e69a6 sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC Sun Oct 24 08:31:49 2010 +0000
+++ b/sys/arch/amd64/conf/GENERIC Sun Oct 24 08:54:14 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.286 2010/10/12 19:10:49 gsutre Exp $
+# $NetBSD: GENERIC,v 1.287 2010/10/24 08:54:14 jruoho Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.286 $"
+#ident "GENERIC-$Revision: 1.287 $"
maxusers 64 # estimated number of users
@@ -310,6 +310,7 @@
sdmmc* at wb? # SD/MMC bus
wmidell* at acpiwmibus? # Dell WMI mappings
#wmihp* at acpiwmibus? # HP WMI mappings
+wmimsi* at acpiwmibus? # MSI WMI mappings
#apm0 at mainbus0 # Advanced power management
diff -r 6a81bd854ca7 -r 3add042e69a6 sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC Sun Oct 24 08:31:49 2010 +0000
+++ b/sys/arch/i386/conf/GENERIC Sun Oct 24 08:54:14 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.994 2010/10/12 19:10:50 gsutre Exp $
+# $NetBSD: GENERIC,v 1.995 2010/10/24 08:54:14 jruoho Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.994 $"
+#ident "GENERIC-$Revision: 1.995 $"
maxusers 64 # estimated number of users
@@ -390,6 +390,7 @@
sdmmc* at wb? # SD/MMC bus
wmidell* at acpiwmibus? # Dell WMI mappings
#wmihp* at acpiwmibus? # HP WMI mappings
+wmimsi* at acpiwmibus? # MSI WMI mappings
wss* at acpi? # NeoMagic 256AV in wss mode
ym* at acpi? # Yamaha OPL3-SA[23] audio
diff -r 6a81bd854ca7 -r 3add042e69a6 sys/dev/acpi/wmi/files.wmi
--- a/sys/dev/acpi/wmi/files.wmi Sun Oct 24 08:31:49 2010 +0000
+++ b/sys/dev/acpi/wmi/files.wmi Sun Oct 24 08:54:14 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.wmi,v 1.6 2010/08/06 22:45:00 jruoho Exp $
+# $NetBSD: files.wmi,v 1.7 2010/10/24 08:54:15 jruoho Exp $
define acpiwmibus { }
@@ -16,3 +16,8 @@
device wmihp: sysmon_envsys
attach wmihp at acpiwmibus
file dev/acpi/wmi/wmi_hp.c wmihp
+
+# MSI WMI mappings
+device wmimsi
+attach wmimsi at acpiwmibus
+file dev/acpi/wmi/wmi_msi.c wmimsi
diff -r 6a81bd854ca7 -r 3add042e69a6 sys/dev/acpi/wmi/wmi_msi.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/acpi/wmi/wmi_msi.c Sun Oct 24 08:54:14 2010 +0000
@@ -0,0 +1,194 @@
+/* $NetBSD: wmi_msi.c,v 1.1 2010/10/24 08:54:15 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2010 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_msi.c,v 1.1 2010/10/24 08:54:15 jruoho Exp $");
+
+#include <sys/param.h>
+#include <sys/device.h>
+
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+#include <dev/acpi/wmi/wmi_acpivar.h>
+
+#define _COMPONENT ACPI_RESOURCE_COMPONENT
+ACPI_MODULE_NAME ("wmi_msi")
+
+#define WMI_MSI_HOTKEY_BRIGHTNESS_UP 0xD0
+#define WMI_MSI_HOTKEY_BRIGHTNESS_DOWN 0xD1
+#define WMI_MSI_HOTKEY_VOLUME_UP 0xD2
+#define WMI_MSI_HOTKEY_VOLUME_DOWN 0xD3
+/* WMI_MSI_HOTKEY_UNKNOWN 0xXXXX */
+
+#define WMI_MSI_GUID_EVENT "B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2"
+
+struct wmi_msi_softc {
+ device_t sc_dev;
+ device_t sc_parent;
+};
+
+static int wmi_msi_match(device_t, cfdata_t, void *);
+static void wmi_msi_attach(device_t, device_t, void *);
+static int wmi_msi_detach(device_t, int);
+static void wmi_msi_notify_handler(ACPI_HANDLE, uint32_t, void *);
+static bool wmi_msi_suspend(device_t, const pmf_qual_t *);
+static bool wmi_msi_resume(device_t, const pmf_qual_t *);
+
+CFATTACH_DECL_NEW(wmimsi, sizeof(struct wmi_msi_softc),
+ wmi_msi_match, wmi_msi_attach, wmi_msi_detach, NULL);
+
+static int
+wmi_msi_match(device_t parent, cfdata_t match, void *aux)
+{
+ return acpi_wmi_guid_match(parent, WMI_MSI_GUID_EVENT);
+}
+
+static void
+wmi_msi_attach(device_t parent, device_t self, void *aux)
+{
+ struct wmi_msi_softc *sc = device_private(self);
+ ACPI_STATUS rv;
+
+ sc->sc_dev = self;
+ sc->sc_parent = parent;
+
+ rv = acpi_wmi_event_register(parent, wmi_msi_notify_handler);
+
+ if (ACPI_FAILURE(rv)) {
+ aprint_error(": failed to install WMI notify handler\n");
+ return;
+ }
+
+ aprint_naive("\n");
+ aprint_normal(": MSI WMI mappings\n");
+
+ (void)pmf_device_register(self, wmi_msi_suspend, wmi_msi_resume);
+}
+
+static int
+wmi_msi_detach(device_t self, int flags)
+{
+ struct wmi_msi_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_msi_suspend(device_t self, const pmf_qual_t *qual)
+{
+ struct wmi_msi_softc *sc = device_private(self);
+ device_t parent = sc->sc_parent;
+
+ (void)acpi_wmi_event_deregister(parent);
+
+ return true;
+}
+
+static bool
+wmi_msi_resume(device_t self, const pmf_qual_t *qual)
+{
+ struct wmi_msi_softc *sc = device_private(self);
+ device_t parent = sc->sc_parent;
Home |
Main Index |
Thread Index |
Old Index