aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKenan Esau <kenan.esau@conan.de>2005-05-29 03:30:22 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2005-05-29 03:30:22 -0400
commit02d7f5895005bd559c6c12d0f1b4e3dd5d91b927 (patch)
tree00d991a932cbb6c13ce1c2a6c09896f5cada7b66 /drivers
parent41e979f822b34e789560ae2752f26f4a018f5d7e (diff)
Input: Add Fujitsu Lifebook B-series touchscreen driver.
From: Kenan Esau <kenan.esau@conan.de> Signed-off-by: Vojtech Pavlik <vojtech@suse.cz> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/mouse/Makefile2
-rw-r--r--drivers/input/mouse/lifebook.c126
-rw-r--r--drivers/input/mouse/lifebook.h17
-rw-r--r--drivers/input/mouse/psmouse-base.c12
-rw-r--r--drivers/input/mouse/psmouse.h1
5 files changed, 154 insertions, 4 deletions
diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile
index a7864195806a..c4909b49337d 100644
--- a/drivers/input/mouse/Makefile
+++ b/drivers/input/mouse/Makefile
@@ -15,4 +15,4 @@ obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o
15obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o 15obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o
16obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o 16obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o
17 17
18psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o 18psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
new file mode 100644
index 000000000000..5b8883857b80
--- /dev/null
+++ b/drivers/input/mouse/lifebook.c
@@ -0,0 +1,126 @@
1/*
2 * Fujitsu B-series Lifebook PS/2 TouchScreen driver
3 *
4 * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz>
5 * Copyright (c) 2005 Kenan Esau <kenan.esau@conan.de>
6 *
7 * TouchScreen detection, absolute mode setting and packet layout is taken from
8 * Harald Hoyer's description of the device.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published by
12 * the Free Software Foundation.
13 */
14
15#include <linux/input.h>
16#include <linux/serio.h>
17#include <linux/libps2.h>
18#include <linux/dmi.h>
19
20#include "psmouse.h"
21#include "lifebook.h"
22
23static int max_y = 1024;
24
25
26static struct dmi_system_id lifebook_dmi_table[] = {
27 {
28 .ident = "Fujitsu Siemens Lifebook B-Sereis",
29 .matches = {
30 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"),
31 },
32 },
33 { }
34};
35
36
37static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse, struct pt_regs *regs)
38{
39 unsigned char *packet = psmouse->packet;
40 struct input_dev *dev = &psmouse->dev;
41
42 if ( psmouse->pktcnt != 3 )
43 return PSMOUSE_GOOD_DATA;
44
45 input_regs(dev, regs);
46
47 /* calculate X and Y */
48 if ((packet[0] & 0x08) == 0x00) {
49 input_report_abs(dev, ABS_X,
50 (packet[1] | ((packet[0] & 0x30) << 4)));
51 input_report_abs(dev, ABS_Y,
52 max_y - (packet[2] | ((packet[0] & 0xC0) << 2)));
53 } else {
54 input_report_rel(dev, REL_X,
55 ((packet[0] & 0x10) ? packet[1]-256 : packet[1]));
56 input_report_rel(dev, REL_Y,
57 (- (int)((packet[0] & 0x20) ? packet[2]-256 : packet[2])));
58 }
59
60 input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
61 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
62 input_report_key(dev, BTN_TOUCH, packet[0] & 0x04);
63
64 input_sync(dev);
65
66 return PSMOUSE_FULL_PACKET;
67}
68
69static int lifebook_initialize(struct psmouse *psmouse)
70{
71 struct ps2dev *ps2dev = &psmouse->ps2dev;
72 unsigned char param;
73
74 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE))
75 return -1;
76
77 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_BAT))
78 return -1;
79
80 /*
81 Enable absolute output -- ps2_command fails always but if
82 you leave this call out the touchsreen will never send
83 absolute coordinates
84 */
85 param = 0x07;
86 ps2_command(ps2dev, &param, PSMOUSE_CMD_SETRES);
87
88 psmouse->set_rate(psmouse, psmouse->rate);
89 psmouse->set_resolution(psmouse, psmouse->resolution);
90
91 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE))
92 return -1;
93
94 return 0;
95}
96
97static void lifebook_disconnect(struct psmouse *psmouse)
98{
99 psmouse_reset(psmouse);
100}
101
102int lifebook_detect(struct psmouse *psmouse, unsigned int max_proto,
103 int set_properties)
104{
105 if (!dmi_check_system(lifebook_dmi_table) &&
106 (max_proto != PSMOUSE_LIFEBOOK) )
107 return -1;
108
109 if (set_properties) {
110 psmouse->vendor = "Fujitsu Lifebook";
111 psmouse->name = "TouchScreen";
112 psmouse->dev.evbit[0] = BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL);
113 psmouse->dev.keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
114 psmouse->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
115 psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
116 input_set_abs_params(&psmouse->dev, ABS_X, 0, 1024, 0, 0);
117 input_set_abs_params(&psmouse->dev, ABS_Y, 0, 1024, 0, 0);
118
119 psmouse->protocol_handler = lifebook_process_byte;
120 psmouse->disconnect = lifebook_disconnect;
121 psmouse->reconnect = lifebook_initialize;
122 psmouse->pktsize = 3;
123 }
124
125 return lifebook_initialize(psmouse);
126}
diff --git a/drivers/input/mouse/lifebook.h b/drivers/input/mouse/lifebook.h
new file mode 100644
index 000000000000..11489b45cee2
--- /dev/null
+++ b/drivers/input/mouse/lifebook.h
@@ -0,0 +1,17 @@
1/*
2 * Fujitsu B-series Lifebook PS/2 TouchScreen driver
3 *
4 * Copyright (c) 2005 Vojtech Pavlik
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10
11#ifndef _LIFEBOOK_H
12#define _LIFEBOOK_H
13
14int lifebook_detect(struct psmouse *psmouse, unsigned int max_proto,
15 int set_properties);
16
17#endif
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 019034b21a0b..abb575f2b0c7 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -24,6 +24,7 @@
24#include "synaptics.h" 24#include "synaptics.h"
25#include "logips2pp.h" 25#include "logips2pp.h"
26#include "alps.h" 26#include "alps.h"
27#include "lifebook.h"
27 28
28#define DRIVER_DESC "PS/2 mouse driver" 29#define DRIVER_DESC "PS/2 mouse driver"
29 30
@@ -34,12 +35,12 @@ MODULE_LICENSE("GPL");
34static unsigned int psmouse_max_proto = -1U; 35static unsigned int psmouse_max_proto = -1U;
35static int psmouse_set_maxproto(const char *val, struct kernel_param *kp); 36static int psmouse_set_maxproto(const char *val, struct kernel_param *kp);
36static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp); 37static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp);
37static char *psmouse_proto_abbrev[] = { NULL, "bare", NULL, NULL, NULL, "imps", "exps", NULL, NULL, NULL }; 38static char *psmouse_proto_abbrev[] = { NULL, "bare", NULL, NULL, NULL, "imps", "exps", NULL, NULL, "lifebook" };
38#define param_check_proto_abbrev(name, p) __param_check(name, p, unsigned int) 39#define param_check_proto_abbrev(name, p) __param_check(name, p, unsigned int)
39#define param_set_proto_abbrev psmouse_set_maxproto 40#define param_set_proto_abbrev psmouse_set_maxproto
40#define param_get_proto_abbrev psmouse_get_maxproto 41#define param_get_proto_abbrev psmouse_get_maxproto
41module_param_named(proto, psmouse_max_proto, proto_abbrev, 0644); 42module_param_named(proto, psmouse_max_proto, proto_abbrev, 0644);
42MODULE_PARM_DESC(proto, "Highest protocol extension to probe (bare, imps, exps, any). Useful for KVM switches."); 43MODULE_PARM_DESC(proto, "Highest protocol extension to probe (bare, imps, exps, lifebook, any). Useful for KVM switches.");
43 44
44static unsigned int psmouse_resolution = 200; 45static unsigned int psmouse_resolution = 200;
45module_param_named(resolution, psmouse_resolution, uint, 0644); 46module_param_named(resolution, psmouse_resolution, uint, 0644);
@@ -67,7 +68,7 @@ __obsolete_setup("psmouse_smartscroll=");
67__obsolete_setup("psmouse_resetafter="); 68__obsolete_setup("psmouse_resetafter=");
68__obsolete_setup("psmouse_rate="); 69__obsolete_setup("psmouse_rate=");
69 70
70static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "ThinkPS/2", "GenPS/2", "ImPS/2", "ImExPS/2", "SynPS/2", "AlpsPS/2" }; 71static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "ThinkPS/2", "GenPS/2", "ImPS/2", "ImExPS/2", "SynPS/2", "AlpsPS/2", "LBPS/2" };
71 72
72/* 73/*
73 * psmouse_process_byte() analyzes the PS/2 data stream and reports 74 * psmouse_process_byte() analyzes the PS/2 data stream and reports
@@ -423,6 +424,9 @@ static int psmouse_extensions(struct psmouse *psmouse,
423{ 424{
424 int synaptics_hardware = 0; 425 int synaptics_hardware = 0;
425 426
427 if (lifebook_detect(psmouse, max_proto, set_properties) == 0)
428 return PSMOUSE_LIFEBOOK;
429
426/* 430/*
427 * Try Kensington ThinkingMouse (we try first, because synaptics probe 431 * Try Kensington ThinkingMouse (we try first, because synaptics probe
428 * upsets the thinkingmouse). 432 * upsets the thinkingmouse).
@@ -575,6 +579,8 @@ static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate)
575 579
576static void psmouse_initialize(struct psmouse *psmouse) 580static void psmouse_initialize(struct psmouse *psmouse)
577{ 581{
582 if (psmouse->type==PSMOUSE_LIFEBOOK)
583 return;
578/* 584/*
579 * We set the mouse into streaming mode. 585 * We set the mouse into streaming mode.
580 */ 586 */
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 7e3adc192eff..4848be627a6f 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -77,6 +77,7 @@ enum psmouse_type {
77 PSMOUSE_IMEX, 77 PSMOUSE_IMEX,
78 PSMOUSE_SYNAPTICS, 78 PSMOUSE_SYNAPTICS,
79 PSMOUSE_ALPS, 79 PSMOUSE_ALPS,
80 PSMOUSE_LIFEBOOK,
80}; 81};
81 82
82int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command); 83int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command);