aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-09-05 15:26:16 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-09-05 15:58:12 -0400
commitbc73dd39e78dd6e5b34cd938b7f037a8bc041bdd (patch)
tree9a2a8c5ea217708646e76429d274cbf25d1ebd2e /drivers
parent4a88081e739a41d6d70bace7e0a027f9054ab540 (diff)
Input: wacom - collect device quirks into single function
Collect device-specific code into a single function, and use quirks to flag specific behavior instead. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Acked-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/tablet/wacom.h1
-rw-r--r--drivers/input/tablet/wacom_sys.c11
-rw-r--r--drivers/input/tablet/wacom_wac.c16
-rw-r--r--drivers/input/tablet/wacom_wac.h4
4 files changed, 24 insertions, 8 deletions
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index 284dfaab6b8c..de5adb109030 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -118,6 +118,7 @@ struct wacom {
118extern const struct usb_device_id wacom_ids[]; 118extern const struct usb_device_id wacom_ids[];
119 119
120void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len); 120void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
121void wacom_setup_device_quirks(struct wacom_features *features);
121void wacom_setup_input_capabilities(struct input_dev *input_dev, 122void wacom_setup_input_capabilities(struct input_dev *input_dev,
122 struct wacom_wac *wacom_wac); 123 struct wacom_wac *wacom_wac);
123#endif 124#endif
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 98cba08bb96e..fc6fd53c1af1 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -381,12 +381,6 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
381 if (error) 381 if (error)
382 goto out; 382 goto out;
383 383
384 /* touch device found but size is not defined. use default */
385 if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) {
386 features->x_max = 1023;
387 features->y_max = 1023;
388 }
389
390 out: 384 out:
391 return error; 385 return error;
392} 386}
@@ -522,10 +516,11 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
522 if (error) 516 if (error)
523 goto fail2; 517 goto fail2;
524 518
519 wacom_setup_device_quirks(features);
520
525 strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); 521 strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
526 522
527 if (features->type == TABLETPC || features->type == TABLETPC2FG || 523 if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
528 features->type == BAMBOO_PT) {
529 /* Append the device type to the name */ 524 /* Append the device type to the name */
530 strlcat(wacom_wac->name, 525 strlcat(wacom_wac->name,
531 features->device_type == BTN_TOOL_PEN ? 526 features->device_type == BTN_TOOL_PEN ?
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 6d7e1647715f..44b4a59750d8 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -941,6 +941,22 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
941 input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); 941 input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0);
942} 942}
943 943
944
945void wacom_setup_device_quirks(struct wacom_features *features)
946{
947
948 /* touch device found but size is not defined. use default */
949 if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) {
950 features->x_max = 1023;
951 features->y_max = 1023;
952 }
953
954 /* these device have multiple inputs */
955 if (features->type == TABLETPC || features->type == TABLETPC2FG ||
956 features->type == BAMBOO_PT)
957 features->quirks |= WACOM_QUIRK_MULTI_INPUT;
958}
959
944void wacom_setup_input_capabilities(struct input_dev *input_dev, 960void wacom_setup_input_capabilities(struct input_dev *input_dev,
945 struct wacom_wac *wacom_wac) 961 struct wacom_wac *wacom_wac)
946{ 962{
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index fb30895d63e3..6a1ff10b095a 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -38,6 +38,9 @@
38#define WACOM_REPORT_TPC1FG 6 38#define WACOM_REPORT_TPC1FG 6
39#define WACOM_REPORT_TPC2FG 13 39#define WACOM_REPORT_TPC2FG 13
40 40
41/* device quirks */
42#define WACOM_QUIRK_MULTI_INPUT 0x0001
43
41enum { 44enum {
42 PENPARTNER = 0, 45 PENPARTNER = 0,
43 GRAPHIRE, 46 GRAPHIRE,
@@ -79,6 +82,7 @@ struct wacom_features {
79 int y_fuzz; 82 int y_fuzz;
80 int pressure_fuzz; 83 int pressure_fuzz;
81 int distance_fuzz; 84 int distance_fuzz;
85 unsigned quirks;
82}; 86};
83 87
84struct wacom_shared { 88struct wacom_shared {