Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys PR/50261: Added newer Toshiba hotkeys support.
details: https://anonhg.NetBSD.org/src/rev/7d71db6c1cc8
branches: trunk
changeset: 340634:7d71db6c1cc8
user: nonaka <nonaka%NetBSD.org@localhost>
date: Mon Sep 21 12:32:06 2015 +0000
description:
PR/50261: Added newer Toshiba hotkeys support.
diffstat:
sys/arch/amd64/conf/GENERIC | 5 +-
sys/arch/i386/conf/GENERIC | 5 +-
sys/dev/acpi/files.acpi | 7 +-
sys/dev/acpi/valz_acpi.c | 643 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 655 insertions(+), 5 deletions(-)
diffs (truncated from 720 to 300 lines):
diff -r 1b5b7c314adb -r 7d71db6c1cc8 sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC Mon Sep 21 10:10:19 2015 +0000
+++ b/sys/arch/amd64/conf/GENERIC Mon Sep 21 12:32:06 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.416 2015/08/27 14:04:07 nonaka Exp $
+# $NetBSD: GENERIC,v 1.417 2015/09/21 12:32:06 nonaka Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.416 $"
+#ident "GENERIC-$Revision: 1.417 $"
maxusers 64 # estimated number of users
@@ -325,6 +325,7 @@
thinkpad* at acpi? # IBM/Lenovo Thinkpad hotkeys
#tpm* at acpi? # ACPI TPM (Experimental)
ug* at acpi? # Abit uGuru Hardware monitor
+valz* at acpi? # Toshiba Dynabook hotkeys
wb* at acpi? # Winbond W83L518D SD/MMC reader
sdmmc* at wb? # SD/MMC bus
wmidell* at acpiwmibus? # Dell WMI mappings
diff -r 1b5b7c314adb -r 7d71db6c1cc8 sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC Mon Sep 21 10:10:19 2015 +0000
+++ b/sys/arch/i386/conf/GENERIC Mon Sep 21 12:32:06 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1126 2015/08/27 14:04:07 nonaka Exp $
+# $NetBSD: GENERIC,v 1.1127 2015/09/21 12:32:06 nonaka Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.1126 $"
+#ident "GENERIC-$Revision: 1.1127 $"
maxusers 64 # estimated number of users
@@ -375,6 +375,7 @@
#tpm* at acpi? # ACPI TPM (Experimental)
ug* at acpi? # Abit uGuru Hardware monitor
vald* at acpi? # Toshiba Libretto hotkeys
+valz* at acpi? # Toshiba Dynabook hotkeys
wb* at acpi? # Winbond W83L518D SD/MMC reader
sdmmc* at wb? # SD/MMC bus
wmidell* at acpiwmibus? # Dell WMI mappings
diff -r 1b5b7c314adb -r 7d71db6c1cc8 sys/dev/acpi/files.acpi
--- a/sys/dev/acpi/files.acpi Mon Sep 21 10:10:19 2015 +0000
+++ b/sys/dev/acpi/files.acpi Mon Sep 21 12:32:06 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.acpi,v 1.95 2014/09/14 19:54:05 mrg Exp $
+# $NetBSD: files.acpi,v 1.96 2015/09/21 12:32:06 nonaka Exp $
include "dev/acpi/acpica/files.acpica"
@@ -169,6 +169,11 @@
attach vald at acpinodebus with vald_acpi
file dev/acpi/vald_acpi.c vald_acpi
+# Toshiba Dynabook hotkeys
+device valz
+attach valz at acpinodebus with valz_acpi
+file dev/acpi/valz_acpi.c valz_acpi
+
# Sony SPIC (jog dial etc.)
attach spic at acpinodebus with spic_acpi
file dev/acpi/spic_acpi.c spic_acpi
diff -r 1b5b7c314adb -r 7d71db6c1cc8 sys/dev/acpi/valz_acpi.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/acpi/valz_acpi.c Mon Sep 21 12:32:06 2015 +0000
@@ -0,0 +1,643 @@
+/* $NetBSD: valz_acpi.c,v 1.5 2015/09/21 12:32:06 nonaka Exp $ */
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Masanori Kanaoka.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * Copyright 2001 Bill Sommerfeld.
+ * All rights reserved.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+/*
+ * ACPI VALZ Driver for Toshiba dynabook R63/PS
+ * This driver is based on vald_acpi.c
+ */
+
+/*
+ * Obtain information of Toshiba "GHCI" Method from next URL.
+ * http://www.buzzard.me.uk/toshiba/docs.html
+ * http://memebeam.org/toys/ToshibaAcpiDriver
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: valz_acpi.c,v 1.5 2015/09/21 12:32:06 nonaka Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <dev/acpi/acpica.h>
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+
+#define _COMPONENT ACPI_RESOURCE_COMPONENT
+ACPI_MODULE_NAME ("valz_acpi")
+
+#define METHOD_HCI "GHCI"
+#define METHOD_HCI_ENABLE "ENAB"
+
+/* Operations */
+/* Get */
+#define HCI_GET 0xfe00
+#define SCI_CHECK 0xf000
+#define SCI_GET 0xf300
+
+/* Set */
+#define HCI_SET 0xff00
+#define SCI_OPEN 0xf100
+#define SCI_CLOSE 0xf200
+#define SCI_SET 0xf400
+
+/* Return codes */
+#define HCI_SUCCESS 0x0000
+#define HCI_FAILURE 0x1000
+#define HCI_NOT_SUPPORTED 0x8000
+#define HCI_INPUT_ERROR 0x8300
+#define HCI_FIFO_EMPTY 0x8c00
+
+#define SCI_OPENCLOSE_OK 0x0044
+#define SCI_NOT_SUPPORTED 0x8000
+#define SCI_ALREADY_OPEN 0x8100
+#define SCI_NOT_OPEN 0x8200
+#define SCI_NOT_PRESENT 0x8600
+
+/* Functions */
+#define HCI_LCD_BACKLIGHT 0x0002
+#define HCI_ACADAPTOR 0x0003
+#define HCI_SYSTEM_EVENT_FIFO 0x0016
+#define HCI_KBD_BACKLIGHT 0x0017
+#define HCI_DISPLAY_DEV 0x001c
+#define HCI_HOTKEY_EVENT 0x001e
+#define HCI_LCD_BRIGHTNESS 0x002a
+#define HCI_CPU_SPEED 0x0032
+
+#define SCI_USB_OFF_CHARGE 0x0150
+#define SCI_TOUCHPAD 0x050e
+#define SCI_KBD_BACKLIGHT_STS 0x015c
+#define SCI_KBD_BACKLIGHT 0x0095
+
+#define SCI_KBD_BL_TIME_SHIFT 0x10
+
+/* Field definitions */
+#define HCI_LCD_BRIGHTNESS_BITS 3
+#define HCI_LCD_BRIGHTNESS_SFT (16 - HCI_LCD_BRIGHTNESS_BITS)
+#define HCI_LCD_BRIGHTNESS_MIN 0
+#define HCI_LCD_BRIGHTNESS_MAX 7
+#define HCI_VIDEO_DEVICE_FLG 0x0100
+#define HCI_CPU_SPEED_BITS 3
+#define HCI_CPU_SPEED_SFT (16 - HCI_CPU_SPEED_BITS)
+#define HCI_CPU_SPEED_MAX ((1 << HCI_CPU_SPEED_BITS) - 1)
+
+/* Key press/release events */
+
+/* Key press/release events */
+#define FN_RELEASE_OFFSET 0x80
+# if 0
+/* Not used */
+#define FN_PRESS 0x01ff
+#define FN_RELEASE 0x0100
+# endif
+#define FN_ESC_PRESS 0x0101
+#define FN_ESC_RELEASE (FN_ESC_PRESS + FN_RELEASE_OFFSET)
+#define FN_F1_PRESS 0x013b
+#define FN_F1_RELEASE (FN_F1_PRESS + FN_RELEASE_OFFSET)
+#define FN_F2_PRESS 0x013c
+#define FN_F2_RELEASE (FN_F2_PRESS + FN_RELEASE_OFFSET)
+#define FN_F3_PRESS 0x013d
+#define FN_F3_RELEASE (FN_F3_PRESS + FN_RELEASE_OFFSET)
+#define FN_F4_PRESS 0x013e
+#define FN_F4_RELEASE (FN_F4_PRESS + FN_RELEASE_OFFSET)
+#define FN_F5_PRESS 0x013f
+#define FN_F5_RELEASE (FN_F5_PRESS + FN_RELEASE_OFFSET)
+#define FN_F6_PRESS 0x0140
+#define FN_F6_RELEASE (FN_F6_PRESS + FN_RELEASE_OFFSET)
+#define FN_F7_PRESS 0x0141
+#define FN_F7_RELEASE (FN_F7_PRESS + FN_RELEASE_OFFSET)
+#define FN_F8_PRESS 0x0142
+#define FN_F8_RELEASE (FN_F8_PRESS + FN_RELEASE_OFFSET)
+#define FN_F9_PRESS 0x0143
+#define FN_F9_RELEASE (FN_F9_PRESS + FN_RELEASE_OFFSET)
+/* Toggle, they are controlled by hardware */
+#define FN_F10_ON 0x1bb0
+#define FN_F10_OFF 0x1bb1
+#define FN_F11_ON 0x1bb2
+#define FN_F11_OFF 0x1bb3
+/* Fn+F12 does not emit keycode */
+/* dynabook R63/PS does not have KANJI keytop print */
+#define FN_KNJ_PRESS 0x0129
+#define FN_KNJ_RELEASE (FN_KNJ_PRESS + FN_RELEASE_OFFSET)
+#define FN_1_PRESS 0x0102
+#define FN_1_RELEASE (FN_1_PRESS + FN_RELEASE_OFFSET)
+#define FN_2_PRESS 0x0103
+#define FN_2_RELEASE (FN_2_PRESS + FN_RELEASE_OFFSET)
+/* Fn+3 and Fn+4 do not emit keybode */
+#define FN_Z_PRESS 0x012c
+#define FN_Z_RELEASE (FN_1_PRESS + FN_RELEASE_OFFSET)
+#define FN_SPACE_PRESS 0x0139
+#define FN_SPACE_RELEASE (FN_1_PRESS + FN_RELEASE_OFFSET)
+#define FN_TAB_PRESS 0x010f
+#define FN_TAB_RELEASE (FN_TAB_PRESS + FN_RELEASE_OFFSET)
+#define FN_CAPS_PRESS 0x013a
+#define FN_CAPS_RELEASE (FN_CAPS_PRESS + FN_RELEASE_OFFSET)
+#define FN_BACKSPACE_PRESS 0x010e
+#define FN_BACKSPACE_RELEASE (FN_BACKSPACE_PRESS + FN_RELEASE_OFFSET)
+#define FN_INS_PRESS 0x0152
+#define FN_INS_RELEASE (FN_INS_PRESS + FN_RELEASE_OFFSET)
+#define FN_DEL_PRESS 0x0153
+#define FN_DEL_RELEASE (FN_DEL_PRESS + FN_RELEASE_OFFSET)
+#define FN_PRTSC_PRESS 0x0137
+#define FN_PRTSC_RELEASE (FN_PRTSC_PRESS + FN_RELEASE_OFFSET)
+
+/* HCI register definitions */
+#define HCI_WORDS 6 /* number of registers */
+#define HCI_REG_AX 0 /* Operation -> return value */
+#define HCI_REG_BX 1 /* Function */
+#define HCI_REG_CX 2 /* Argument (in or out) */
+#define HCI_REG_DX 3 /* unused */
+#define HCI_REG_SI 4 /* unused */
+#define HCI_REG_DI 5 /* unused */
+
+#define HCI_ON 0x0001
+#define HCI_OFF 0x0000
+#define HCI_ENABLE 0x0001
+#define HCI_DISABLE 0x0000
+
+#define HCI_LCD 0x1
+#define HCI_CRT 0x2
+#define HCI_TV 0x4
+
+#define SCI_KBD_BL_MODE_MASK 0x1f
Home |
Main Index |
Thread Index |
Old Index