Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hpcarm Added keypad driver for WS011SH.
details: https://anonhg.NetBSD.org/src/rev/08f8e6b36c43
branches: trunk
changeset: 755272:08f8e6b36c43
user: nonaka <nonaka%NetBSD.org@localhost>
date: Sun May 30 10:00:27 2010 +0000
description:
Added keypad driver for WS011SH.
diffstat:
sys/arch/hpcarm/conf/WZERO3 | 12 +-
sys/arch/hpcarm/conf/files.pxa2x0 | 9 +-
sys/arch/hpcarm/dev/wzero3_keypad.c | 541 ++++++++++++++++++++++++++++++++++++
sys/arch/hpcarm/dev/wzero3_reg.h | 4 +-
sys/arch/hpcarm/dev/wzero3_ssp.c | 71 ++++-
sys/arch/hpcarm/dev/wzero3_sspvar.h | 9 +-
sys/arch/hpcarm/dev/wzero3_tp.c | 16 +-
7 files changed, 632 insertions(+), 30 deletions(-)
diffs (truncated from 881 to 300 lines):
diff -r 86ec2f8c83a6 -r 08f8e6b36c43 sys/arch/hpcarm/conf/WZERO3
--- a/sys/arch/hpcarm/conf/WZERO3 Sun May 30 08:28:53 2010 +0000
+++ b/sys/arch/hpcarm/conf/WZERO3 Sun May 30 10:00:27 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: WZERO3,v 1.4 2010/05/09 10:39:59 nonaka Exp $
+# $NetBSD: WZERO3,v 1.5 2010/05/30 10:00:27 nonaka Exp $
#
# WZERO3 -- Sharp Windows Mobile 5 based PDA
#
@@ -7,7 +7,7 @@
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.4 $"
+#ident "GENERIC-$Revision: 1.5 $"
# estimated number of users
maxusers 32
@@ -175,18 +175,22 @@
lcd* at pxaip?
wsdisplay* at lcd? console ?
-# for touchpad
+# for touchpad, keypad
wzero3ssp0 at pxaip?
# touchpad
wzero3tp0 at pxaip?
wsmouse* at wzero3tp? mux 0
-# Keyboard
+# keyboard
wzero3kbd0 at pxaip?
hpckbd* at wzero3kbd?
wskbd0 at hpckbd? mux 1
+# keypad
+wzero3keypad0 at pxaip?
+wskbd1 at wzero3keypad? mux 1
+
# integrated MMC/SD contoller
pxamci0 at pxaip? addr 0x41100000 size 0x48
sdmmc* at pxamci?
diff -r 86ec2f8c83a6 -r 08f8e6b36c43 sys/arch/hpcarm/conf/files.pxa2x0
--- a/sys/arch/hpcarm/conf/files.pxa2x0 Sun May 30 08:28:53 2010 +0000
+++ b/sys/arch/hpcarm/conf/files.pxa2x0 Sun May 30 10:00:27 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.pxa2x0,v 1.2 2010/05/09 10:39:59 nonaka Exp $
+# $NetBSD: files.pxa2x0,v 1.3 2010/05/30 10:00:27 nonaka Exp $
#
# PXA2x0 specific configuration info
#
@@ -12,7 +12,7 @@
# W-ZERO3 specific configuration info
#
-# Dedicated SSP unit for touch screen
+# Dedicated SSP unit for touch screen, keypad
device wzero3ssp
attach wzero3ssp at pxaip
file arch/hpcarm/dev/wzero3_ssp.c wzero3ssp
@@ -26,6 +26,11 @@
attach wzero3kbd at pxaip
file arch/hpcarm/dev/wzero3_kbd.c wzero3kbd
+# keypad
+device wzero3keypad: wskbddev
+attach wzero3keypad at pxaip
+file arch/hpcarm/dev/wzero3_keypad.c wzero3keypad
+
# touchpad
device wzero3tp: wsmousedev, hpctpanel
attach wzero3tp at pxaip
diff -r 86ec2f8c83a6 -r 08f8e6b36c43 sys/arch/hpcarm/dev/wzero3_keypad.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpcarm/dev/wzero3_keypad.c Sun May 30 10:00:27 2010 +0000
@@ -0,0 +1,541 @@
+/* $NetBSD: wzero3_keypad.c,v 1.1 2010/05/30 10:00:27 nonaka Exp $ */
+
+/*
+ * Copyright (c) 2010 NONAKA Kimihiro <nonaka%netbsd.org@localhost>
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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: wzero3_keypad.c,v 1.1 2010/05/30 10:00:27 nonaka Exp $");
+
+#include "wzero3lcd.h"
+#include "opt_wsdisplay_compat.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/callout.h>
+
+#include <arm/xscale/pxa2x0cpu.h>
+#include <arm/xscale/pxa2x0var.h>
+#include <arm/xscale/pxa2x0_gpio.h>
+
+#include <machine/bus.h>
+#include <machine/bootinfo.h>
+#include <machine/config_hook.h>
+#include <machine/platid.h>
+#include <machine/platid_mask.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wskbdvar.h>
+#include <dev/wscons/wsksymvar.h>
+#include <dev/wscons/wsksymdef.h>
+
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+#include <dev/hpc/pckbd_encode.h>
+#endif
+
+#include <arch/hpcarm/dev/wzero3_reg.h>
+#include <arch/hpcarm/dev/wzero3_sspvar.h>
+
+enum {
+ KD_0,
+ KD_1,
+ KD_2,
+ KD_3,
+ KD_4,
+ KD_5,
+ KD_6,
+ KD_7,
+ KD_8,
+ KD_9,
+ KD_ASTERISK,
+ KD_NUMBER,
+ KD_WINDOWS,
+ KD_OK,
+ KD_ONHOOK,
+ KD_OFFHOOK,
+ KD_CLEAR,
+ KD_MOJI,
+ KD_UP,
+ KD_DOWN,
+ KD_LEFT,
+ KD_RIGHT,
+ KD_CENTER_BUTTON,
+ KD_LSOFT,
+ KD_RSOFT,
+ KD_NUM,
+
+ KD_INVALID = -1
+};
+
+static int ws011sh_keyscan2keydown[32] = {
+ KD_INVALID,
+ KD_CLEAR,
+ KD_INVALID,
+ KD_OK,
+ KD_INVALID,
+ KD_LEFT,
+ KD_INVALID,
+ KD_ONHOOK,
+ KD_INVALID,
+ KD_UP,
+ KD_DOWN,
+ KD_MOJI,
+ KD_INVALID,
+ KD_WINDOWS,
+ KD_INVALID,
+ KD_RIGHT,
+ KD_INVALID,
+ KD_1,
+ KD_4,
+ KD_7,
+ KD_ASTERISK,
+ KD_2,
+ KD_5,
+ KD_8,
+ KD_0,
+ KD_CENTER_BUTTON,
+ KD_INVALID,
+ KD_3,
+ KD_6,
+ KD_9,
+ KD_NUMBER,
+ KD_INVALID,
+};
+
+struct wzero3keypad_softc {
+ device_t sc_dev;
+
+ void *sc_ih;
+ int sc_intr_pin;
+
+ uint32_t sc_okeystat;
+
+ struct callout sc_poll_ch;
+ int sc_poll_interval;
+
+ device_t sc_wskbddev;
+
+#ifdef WSDISPLAY_COMPAT_RAWKBD
+ int sc_rawkbd;
+#endif
+};
+
+static int wzero3keypad_match(device_t, cfdata_t, void *);
+static void wzero3keypad_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(wzero3keypad, sizeof(struct wzero3keypad_softc),
+ wzero3keypad_match, wzero3keypad_attach, NULL, NULL);
+
+static int wzero3keypad_wskbd_enable(void *, int);
+static void wzero3keypad_wskbd_set_leds(void *, int);
+static int wzero3keypad_wskbd_ioctl(void *, u_long, void *, int, struct lwp *);
+
+static const int wzero3keypad_wskbd_keys[] = {
+ 82, /* KD_0: 0 */
+ 79, /* KD_1: 1 */
+ 80, /* KD_2: 2 */
+ 81, /* KD_3: 3 */
+ 75, /* KD_4: 4 */
+ 76, /* KD_5: 5 */
+ 77, /* KD_6: 6 */
+ 71, /* KD_7: 7 */
+ 72, /* KD_8: 8 */
+ 73, /* KD_9: 9 */
+ 64, /* KD_ASTERISK: f6 */
+ 65, /* KD_NUMBER: f7 */
+ 221, /* KD_WINDOWS: Menu */
+ 61, /* KD_OK: f3 */
+ 59, /* KD_ONHOOK: f1 */
+ 60, /* KD_OFFHOOK: f2 */
+ 62, /* KD_CLEAR: f4 */
+ 63, /* KD_MOJI: f5 */
+ 200, /* KD_UP: Up */
+ 208, /* KD_DOWN: Down */
+ 203, /* KD_LEFT: Left */
+ 205, /* KD_RIGHT: Right */
+ 156, /* KD_CENTER_BUTTON: KP_Enter */
+ 87, /* KD_LSOFT: f11 */
+ 88, /* KD_RSOFT: f12 */
+};
+
+static const keysym_t wzero3keypad_wskbd_keydesc[] = {
+ KS_KEYCODE(59), KS_f1,
+ KS_KEYCODE(60), KS_f2,
+ KS_KEYCODE(61), KS_f3,
+ KS_KEYCODE(62), KS_f4,
+ KS_KEYCODE(63), KS_f5,
+ KS_KEYCODE(64), KS_f6,
+ KS_KEYCODE(65), KS_f7,
+ KS_KEYCODE(71), KS_7,
+ KS_KEYCODE(72), KS_8,
+ KS_KEYCODE(73), KS_9,
+ KS_KEYCODE(75), KS_4,
+ KS_KEYCODE(76), KS_5,
+ KS_KEYCODE(77), KS_6,
+ KS_KEYCODE(79), KS_1,
+ KS_KEYCODE(80), KS_2,
+ KS_KEYCODE(81), KS_3,
+ KS_KEYCODE(82), KS_0,
+ KS_KEYCODE(87), KS_f11,
+ KS_KEYCODE(88), KS_f12,
+ KS_KEYCODE(156), KS_KP_Enter,
+ KS_KEYCODE(200), KS_Up,
+ KS_KEYCODE(203), KS_Left,
+ KS_KEYCODE(205), KS_Right,
+ KS_KEYCODE(208), KS_Down,
+ KS_KEYCODE(221), KS_Menu,
+};
+
+static const struct wscons_keydesc wzero3keypad_wskbd_keydesctab[] = {
+ { KB_JP, 0,
+ sizeof(wzero3keypad_wskbd_keydesc) / sizeof(keysym_t),
+ wzero3keypad_wskbd_keydesc
+ },
+
+ { 0, 0, 0, 0 }
+};
+
+static const struct wskbd_mapdata wzero3keypad_wskbd_keymapdata = {
+ wzero3keypad_wskbd_keydesctab, KB_JP
Home |
Main Index |
Thread Index |
Old Index