diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-15 23:00:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-15 23:00:48 -0500 |
commit | d89b8f40fca43cab829fea5c0e7d3951db2fb4bd (patch) | |
tree | 7f40618ad5df75d0364de99527d362b909f7d62c | |
parent | 0b60afba5397a3e63264463cde49426d8dcb0de4 (diff) | |
parent | 02860ab6cd2c71dbe42fa70a65a97823c213635b (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
-rw-r--r-- | drivers/input/keyboard/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/misc/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/misc/ixp4xx-beeper.c | 1 | ||||
-rw-r--r-- | drivers/input/mouse/logips2pp.c | 1 | ||||
-rw-r--r-- | drivers/input/mouse/trackpoint.c | 20 | ||||
-rw-r--r-- | drivers/input/mouse/trackpoint.h | 4 | ||||
-rw-r--r-- | drivers/input/serio/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 147 |
8 files changed, 109 insertions, 67 deletions
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 6e0afbb22383..2708167ba175 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -11,7 +11,6 @@ obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o | |||
11 | obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o | 11 | obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o |
12 | obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o | 12 | obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o |
13 | obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o | 13 | obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o |
14 | obj-$(CONFIG_KEYBOARD_98KBD) += 98kbd.o | ||
15 | obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o | 14 | obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o |
16 | obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o | 15 | obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o |
17 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o | 16 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o |
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 184c4129470d..415c49178985 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile | |||
@@ -7,7 +7,6 @@ | |||
7 | obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o | 7 | obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o |
8 | obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o | 8 | obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o |
9 | obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o | 9 | obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o |
10 | obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o | ||
11 | obj-$(CONFIG_INPUT_UINPUT) += uinput.o | 10 | obj-$(CONFIG_INPUT_UINPUT) += uinput.o |
12 | obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o | 11 | obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o |
13 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o | 12 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o |
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index d448bb5e4869..3a6ae85cd69c 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/input.h> | 19 | #include <linux/input.h> |
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/interrupt.h> | ||
22 | #include <asm/hardware.h> | 23 | #include <asm/hardware.h> |
23 | 24 | ||
24 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | 25 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index c88520d3d13c..40333d61093c 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -232,6 +232,7 @@ static struct ps2pp_info *get_model_info(unsigned char model) | |||
232 | { 88, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 232 | { 88, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
233 | { 96, 0, 0 }, | 233 | { 96, 0, 0 }, |
234 | { 97, PS2PP_KIND_TP3, PS2PP_WHEEL | PS2PP_HWHEEL }, | 234 | { 97, PS2PP_KIND_TP3, PS2PP_WHEEL | PS2PP_HWHEEL }, |
235 | { 99, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | ||
235 | { 100, PS2PP_KIND_MX, /* MX510 */ | 236 | { 100, PS2PP_KIND_MX, /* MX510 */ |
236 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | | 237 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | |
237 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, | 238 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index b4898d8a68e2..6d9ec9ab1b90 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -68,15 +68,19 @@ struct trackpoint_attr_data { | |||
68 | size_t field_offset; | 68 | size_t field_offset; |
69 | unsigned char command; | 69 | unsigned char command; |
70 | unsigned char mask; | 70 | unsigned char mask; |
71 | unsigned char inverted; | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf) | 74 | static ssize_t trackpoint_show_int_attr(struct psmouse *psmouse, void *data, char *buf) |
74 | { | 75 | { |
75 | struct trackpoint_data *tp = psmouse->private; | 76 | struct trackpoint_data *tp = psmouse->private; |
76 | struct trackpoint_attr_data *attr = data; | 77 | struct trackpoint_attr_data *attr = data; |
77 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); | 78 | unsigned char value = *(unsigned char *)((char *)tp + attr->field_offset); |
79 | |||
80 | if (attr->inverted) | ||
81 | value = !value; | ||
78 | 82 | ||
79 | return sprintf(buf, "%u\n", *field); | 83 | return sprintf(buf, "%u\n", value); |
80 | } | 84 | } |
81 | 85 | ||
82 | static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, | 86 | static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, |
@@ -120,6 +124,9 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data, | |||
120 | if (*rest || value > 1) | 124 | if (*rest || value > 1) |
121 | return -EINVAL; | 125 | return -EINVAL; |
122 | 126 | ||
127 | if (attr->inverted) | ||
128 | value = !value; | ||
129 | |||
123 | if (*field != value) { | 130 | if (*field != value) { |
124 | *field = value; | 131 | *field = value; |
125 | trackpoint_toggle_bit(&psmouse->ps2dev, attr->command, attr->mask); | 132 | trackpoint_toggle_bit(&psmouse->ps2dev, attr->command, attr->mask); |
@@ -129,11 +136,12 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data, | |||
129 | } | 136 | } |
130 | 137 | ||
131 | 138 | ||
132 | #define TRACKPOINT_BIT_ATTR(_name, _command, _mask) \ | 139 | #define TRACKPOINT_BIT_ATTR(_name, _command, _mask, _inv) \ |
133 | static struct trackpoint_attr_data trackpoint_attr_##_name = { \ | 140 | static struct trackpoint_attr_data trackpoint_attr_##_name = { \ |
134 | .field_offset = offsetof(struct trackpoint_data, _name), \ | 141 | .field_offset = offsetof(struct trackpoint_data, _name), \ |
135 | .command = _command, \ | 142 | .command = _command, \ |
136 | .mask = _mask, \ | 143 | .mask = _mask, \ |
144 | .inverted = _inv, \ | ||
137 | }; \ | 145 | }; \ |
138 | PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ | 146 | PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO, \ |
139 | &trackpoint_attr_##_name, \ | 147 | &trackpoint_attr_##_name, \ |
@@ -150,9 +158,9 @@ TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH); | |||
150 | TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME); | 158 | TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME); |
151 | TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV); | 159 | TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV); |
152 | 160 | ||
153 | TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON); | 161 | TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0); |
154 | TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK); | 162 | TRACKPOINT_BIT_ATTR(skipback, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK, 0); |
155 | TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV); | 163 | TRACKPOINT_BIT_ATTR(ext_dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV, 1); |
156 | 164 | ||
157 | static struct attribute *trackpoint_attrs[] = { | 165 | static struct attribute *trackpoint_attrs[] = { |
158 | &psmouse_attr_sensitivity.dattr.attr, | 166 | &psmouse_attr_sensitivity.dattr.attr, |
diff --git a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h index 9857d8b6ad66..050298b1a09d 100644 --- a/drivers/input/mouse/trackpoint.h +++ b/drivers/input/mouse/trackpoint.h | |||
@@ -78,7 +78,7 @@ | |||
78 | 78 | ||
79 | #define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */ | 79 | #define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */ |
80 | #define TP_MASK_MB 0x01 | 80 | #define TP_MASK_MB 0x01 |
81 | #define TP_TOGGLE_EXT_DEV 0x23 /* Toggle external device */ | 81 | #define TP_TOGGLE_EXT_DEV 0x23 /* Disable external device */ |
82 | #define TP_MASK_EXT_DEV 0x02 | 82 | #define TP_MASK_EXT_DEV 0x02 |
83 | #define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */ | 83 | #define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */ |
84 | #define TP_MASK_DRIFT 0x80 | 84 | #define TP_MASK_DRIFT 0x80 |
@@ -125,7 +125,7 @@ | |||
125 | #define TP_DEF_MB 0x00 | 125 | #define TP_DEF_MB 0x00 |
126 | #define TP_DEF_PTSON 0x00 | 126 | #define TP_DEF_PTSON 0x00 |
127 | #define TP_DEF_SKIPBACK 0x00 | 127 | #define TP_DEF_SKIPBACK 0x00 |
128 | #define TP_DEF_EXT_DEV 0x01 | 128 | #define TP_DEF_EXT_DEV 0x00 /* 0 means enabled */ |
129 | 129 | ||
130 | #define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) | 130 | #define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) |
131 | 131 | ||
diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile index 678a8599f9ff..4155197867a3 100644 --- a/drivers/input/serio/Makefile +++ b/drivers/input/serio/Makefile | |||
@@ -13,7 +13,6 @@ obj-$(CONFIG_SERIO_RPCKBD) += rpckbd.o | |||
13 | obj-$(CONFIG_SERIO_SA1111) += sa1111ps2.o | 13 | obj-$(CONFIG_SERIO_SA1111) += sa1111ps2.o |
14 | obj-$(CONFIG_SERIO_AMBAKMI) += ambakmi.o | 14 | obj-$(CONFIG_SERIO_AMBAKMI) += ambakmi.o |
15 | obj-$(CONFIG_SERIO_Q40KBD) += q40kbd.o | 15 | obj-$(CONFIG_SERIO_Q40KBD) += q40kbd.o |
16 | obj-$(CONFIG_SERIO_98KBD) += 98kbd-io.o | ||
17 | obj-$(CONFIG_SERIO_GSCPS2) += gscps2.o | 16 | obj-$(CONFIG_SERIO_GSCPS2) += gscps2.o |
18 | obj-$(CONFIG_HP_SDC) += hp_sdc.o | 17 | obj-$(CONFIG_HP_SDC) += hp_sdc.o |
19 | obj-$(CONFIG_HIL_MLC) += hp_sdc_mlc.o hil_mlc.o | 18 | obj-$(CONFIG_HIL_MLC) += hp_sdc_mlc.o hil_mlc.o |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index b45a45ca7cc9..8c12a974b411 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -48,10 +48,13 @@ | |||
48 | 48 | ||
49 | #define TS_POLL_PERIOD msecs_to_jiffies(10) | 49 | #define TS_POLL_PERIOD msecs_to_jiffies(10) |
50 | 50 | ||
51 | /* this driver doesn't aim at the peak continuous sample rate */ | ||
52 | #define SAMPLE_BITS (8 /*cmd*/ + 16 /*sample*/ + 2 /* before, after */) | ||
53 | |||
51 | struct ts_event { | 54 | struct ts_event { |
52 | /* For portability, we can't read 12 bit values using SPI (which | 55 | /* For portability, we can't read 12 bit values using SPI (which |
53 | * would make the controller deliver them as native byteorder u16 | 56 | * would make the controller deliver them as native byteorder u16 |
54 | * with msbs zeroed). Instead, we read them as two 8-byte values, | 57 | * with msbs zeroed). Instead, we read them as two 8-bit values, |
55 | * which need byteswapping then range adjustment. | 58 | * which need byteswapping then range adjustment. |
56 | */ | 59 | */ |
57 | __be16 x; | 60 | __be16 x; |
@@ -60,7 +63,7 @@ struct ts_event { | |||
60 | }; | 63 | }; |
61 | 64 | ||
62 | struct ads7846 { | 65 | struct ads7846 { |
63 | struct input_dev input; | 66 | struct input_dev *input; |
64 | char phys[32]; | 67 | char phys[32]; |
65 | 68 | ||
66 | struct spi_device *spi; | 69 | struct spi_device *spi; |
@@ -68,6 +71,7 @@ struct ads7846 { | |||
68 | u16 vref_delay_usecs; | 71 | u16 vref_delay_usecs; |
69 | u16 x_plate_ohms; | 72 | u16 x_plate_ohms; |
70 | 73 | ||
74 | u8 read_x, read_y, read_z1, read_z2; | ||
71 | struct ts_event tc; | 75 | struct ts_event tc; |
72 | 76 | ||
73 | struct spi_transfer xfer[8]; | 77 | struct spi_transfer xfer[8]; |
@@ -117,10 +121,10 @@ struct ads7846 { | |||
117 | #define READ_12BIT_DFR(x) (ADS_START | ADS_A2A1A0_d_ ## x \ | 121 | #define READ_12BIT_DFR(x) (ADS_START | ADS_A2A1A0_d_ ## x \ |
118 | | ADS_12_BIT | ADS_DFR) | 122 | | ADS_12_BIT | ADS_DFR) |
119 | 123 | ||
120 | static const u8 read_y = READ_12BIT_DFR(y) | ADS_PD10_ADC_ON; | 124 | #define READ_Y (READ_12BIT_DFR(y) | ADS_PD10_ADC_ON) |
121 | static const u8 read_z1 = READ_12BIT_DFR(z1) | ADS_PD10_ADC_ON; | 125 | #define READ_Z1 (READ_12BIT_DFR(z1) | ADS_PD10_ADC_ON) |
122 | static const u8 read_z2 = READ_12BIT_DFR(z2) | ADS_PD10_ADC_ON; | 126 | #define READ_Z2 (READ_12BIT_DFR(z2) | ADS_PD10_ADC_ON) |
123 | static const u8 read_x = READ_12BIT_DFR(x) | ADS_PD10_PDOWN; /* LAST */ | 127 | #define READ_X (READ_12BIT_DFR(x) | ADS_PD10_PDOWN) /* LAST */ |
124 | 128 | ||
125 | /* single-ended samples need to first power up reference voltage; | 129 | /* single-ended samples need to first power up reference voltage; |
126 | * we leave both ADC and VREF powered | 130 | * we leave both ADC and VREF powered |
@@ -128,8 +132,8 @@ static const u8 read_x = READ_12BIT_DFR(x) | ADS_PD10_PDOWN; /* LAST */ | |||
128 | #define READ_12BIT_SER(x) (ADS_START | ADS_A2A1A0_ ## x \ | 132 | #define READ_12BIT_SER(x) (ADS_START | ADS_A2A1A0_ ## x \ |
129 | | ADS_12_BIT | ADS_SER) | 133 | | ADS_12_BIT | ADS_SER) |
130 | 134 | ||
131 | static const u8 ref_on = READ_12BIT_DFR(x) | ADS_PD10_ALL_ON; | 135 | #define REF_ON (READ_12BIT_DFR(x) | ADS_PD10_ALL_ON) |
132 | static const u8 ref_off = READ_12BIT_DFR(y) | ADS_PD10_PDOWN; | 136 | #define REF_OFF (READ_12BIT_DFR(y) | ADS_PD10_PDOWN) |
133 | 137 | ||
134 | /*--------------------------------------------------------------------------*/ | 138 | /*--------------------------------------------------------------------------*/ |
135 | 139 | ||
@@ -138,7 +142,9 @@ static const u8 ref_off = READ_12BIT_DFR(y) | ADS_PD10_PDOWN; | |||
138 | */ | 142 | */ |
139 | 143 | ||
140 | struct ser_req { | 144 | struct ser_req { |
145 | u8 ref_on; | ||
141 | u8 command; | 146 | u8 command; |
147 | u8 ref_off; | ||
142 | u16 scratch; | 148 | u16 scratch; |
143 | __be16 sample; | 149 | __be16 sample; |
144 | struct spi_message msg; | 150 | struct spi_message msg; |
@@ -152,7 +158,7 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) | |||
152 | struct ser_req *req = kzalloc(sizeof *req, SLAB_KERNEL); | 158 | struct ser_req *req = kzalloc(sizeof *req, SLAB_KERNEL); |
153 | int status; | 159 | int status; |
154 | int sample; | 160 | int sample; |
155 | int i; | 161 | int i; |
156 | 162 | ||
157 | if (!req) | 163 | if (!req) |
158 | return -ENOMEM; | 164 | return -ENOMEM; |
@@ -160,7 +166,8 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) | |||
160 | INIT_LIST_HEAD(&req->msg.transfers); | 166 | INIT_LIST_HEAD(&req->msg.transfers); |
161 | 167 | ||
162 | /* activate reference, so it has time to settle; */ | 168 | /* activate reference, so it has time to settle; */ |
163 | req->xfer[0].tx_buf = &ref_on; | 169 | req->ref_on = REF_ON; |
170 | req->xfer[0].tx_buf = &req->ref_on; | ||
164 | req->xfer[0].len = 1; | 171 | req->xfer[0].len = 1; |
165 | req->xfer[1].rx_buf = &req->scratch; | 172 | req->xfer[1].rx_buf = &req->scratch; |
166 | req->xfer[1].len = 2; | 173 | req->xfer[1].len = 2; |
@@ -182,7 +189,8 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) | |||
182 | /* REVISIT: take a few more samples, and compare ... */ | 189 | /* REVISIT: take a few more samples, and compare ... */ |
183 | 190 | ||
184 | /* turn off reference */ | 191 | /* turn off reference */ |
185 | req->xfer[4].tx_buf = &ref_off; | 192 | req->ref_off = REF_OFF; |
193 | req->xfer[4].tx_buf = &req->ref_off; | ||
186 | req->xfer[4].len = 1; | 194 | req->xfer[4].len = 1; |
187 | req->xfer[5].rx_buf = &req->scratch; | 195 | req->xfer[5].rx_buf = &req->scratch; |
188 | req->xfer[5].len = 2; | 196 | req->xfer[5].len = 2; |
@@ -236,11 +244,12 @@ SHOW(vbatt) | |||
236 | 244 | ||
237 | static void ads7846_rx(void *ads) | 245 | static void ads7846_rx(void *ads) |
238 | { | 246 | { |
239 | struct ads7846 *ts = ads; | 247 | struct ads7846 *ts = ads; |
240 | unsigned Rt; | 248 | struct input_dev *input_dev = ts->input; |
241 | unsigned sync = 0; | 249 | unsigned Rt; |
242 | u16 x, y, z1, z2; | 250 | unsigned sync = 0; |
243 | unsigned long flags; | 251 | u16 x, y, z1, z2; |
252 | unsigned long flags; | ||
244 | 253 | ||
245 | /* adjust: 12 bit samples (left aligned), built from | 254 | /* adjust: 12 bit samples (left aligned), built from |
246 | * two 8 bit values writen msb-first. | 255 | * two 8 bit values writen msb-first. |
@@ -276,21 +285,21 @@ static void ads7846_rx(void *ads) | |||
276 | * won't notice that, even if nPENIRQ never fires ... | 285 | * won't notice that, even if nPENIRQ never fires ... |
277 | */ | 286 | */ |
278 | if (!ts->pendown && Rt != 0) { | 287 | if (!ts->pendown && Rt != 0) { |
279 | input_report_key(&ts->input, BTN_TOUCH, 1); | 288 | input_report_key(input_dev, BTN_TOUCH, 1); |
280 | sync = 1; | 289 | sync = 1; |
281 | } else if (ts->pendown && Rt == 0) { | 290 | } else if (ts->pendown && Rt == 0) { |
282 | input_report_key(&ts->input, BTN_TOUCH, 0); | 291 | input_report_key(input_dev, BTN_TOUCH, 0); |
283 | sync = 1; | 292 | sync = 1; |
284 | } | 293 | } |
285 | 294 | ||
286 | if (Rt) { | 295 | if (Rt) { |
287 | input_report_abs(&ts->input, ABS_X, x); | 296 | input_report_abs(input_dev, ABS_X, x); |
288 | input_report_abs(&ts->input, ABS_Y, y); | 297 | input_report_abs(input_dev, ABS_Y, y); |
289 | input_report_abs(&ts->input, ABS_PRESSURE, Rt); | 298 | input_report_abs(input_dev, ABS_PRESSURE, Rt); |
290 | sync = 1; | 299 | sync = 1; |
291 | } | 300 | } |
292 | if (sync) | 301 | if (sync) |
293 | input_sync(&ts->input); | 302 | input_sync(input_dev); |
294 | 303 | ||
295 | #ifdef VERBOSE | 304 | #ifdef VERBOSE |
296 | if (Rt || ts->pendown) | 305 | if (Rt || ts->pendown) |
@@ -396,9 +405,10 @@ static int ads7846_resume(struct spi_device *spi) | |||
396 | static int __devinit ads7846_probe(struct spi_device *spi) | 405 | static int __devinit ads7846_probe(struct spi_device *spi) |
397 | { | 406 | { |
398 | struct ads7846 *ts; | 407 | struct ads7846 *ts; |
408 | struct input_dev *input_dev; | ||
399 | struct ads7846_platform_data *pdata = spi->dev.platform_data; | 409 | struct ads7846_platform_data *pdata = spi->dev.platform_data; |
400 | struct spi_transfer *x; | 410 | struct spi_transfer *x; |
401 | int i; | 411 | int err; |
402 | 412 | ||
403 | if (!spi->irq) { | 413 | if (!spi->irq) { |
404 | dev_dbg(&spi->dev, "no IRQ?\n"); | 414 | dev_dbg(&spi->dev, "no IRQ?\n"); |
@@ -411,9 +421,9 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
411 | } | 421 | } |
412 | 422 | ||
413 | /* don't exceed max specified sample rate */ | 423 | /* don't exceed max specified sample rate */ |
414 | if (spi->max_speed_hz > (125000 * 16)) { | 424 | if (spi->max_speed_hz > (125000 * SAMPLE_BITS)) { |
415 | dev_dbg(&spi->dev, "f(sample) %d KHz?\n", | 425 | dev_dbg(&spi->dev, "f(sample) %d KHz?\n", |
416 | (spi->max_speed_hz/16)/1000); | 426 | (spi->max_speed_hz/SAMPLE_BITS)/1000); |
417 | return -EINVAL; | 427 | return -EINVAL; |
418 | } | 428 | } |
419 | 429 | ||
@@ -423,13 +433,18 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
423 | * to discard the four garbage LSBs. | 433 | * to discard the four garbage LSBs. |
424 | */ | 434 | */ |
425 | 435 | ||
426 | if (!(ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL))) | 436 | ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL); |
427 | return -ENOMEM; | 437 | input_dev = input_allocate_device(); |
438 | if (!ts || !input_dev) { | ||
439 | err = -ENOMEM; | ||
440 | goto err_free_mem; | ||
441 | } | ||
428 | 442 | ||
429 | dev_set_drvdata(&spi->dev, ts); | 443 | dev_set_drvdata(&spi->dev, ts); |
444 | spi->dev.power.power_state = PMSG_ON; | ||
430 | 445 | ||
431 | ts->spi = spi; | 446 | ts->spi = spi; |
432 | spi->dev.power.power_state = PMSG_ON; | 447 | ts->input = input_dev; |
433 | 448 | ||
434 | init_timer(&ts->timer); | 449 | init_timer(&ts->timer); |
435 | ts->timer.data = (unsigned long) ts; | 450 | ts->timer.data = (unsigned long) ts; |
@@ -439,70 +454,80 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
439 | ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100; | 454 | ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100; |
440 | ts->x_plate_ohms = pdata->x_plate_ohms ? : 400; | 455 | ts->x_plate_ohms = pdata->x_plate_ohms ? : 400; |
441 | 456 | ||
442 | init_input_dev(&ts->input); | 457 | snprintf(ts->phys, sizeof(ts->phys), "%s/input0", spi->dev.bus_id); |
443 | 458 | ||
444 | ts->input.dev = &spi->dev; | 459 | input_dev->name = "ADS784x Touchscreen"; |
445 | ts->input.name = "ADS784x Touchscreen"; | 460 | input_dev->phys = ts->phys; |
446 | snprintf(ts->phys, sizeof ts->phys, "%s/input0", spi->dev.bus_id); | 461 | input_dev->cdev.dev = &spi->dev; |
447 | ts->input.phys = ts->phys; | ||
448 | 462 | ||
449 | ts->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 463 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); |
450 | ts->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); | 464 | input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); |
451 | input_set_abs_params(&ts->input, ABS_X, | 465 | input_set_abs_params(input_dev, ABS_X, |
452 | pdata->x_min ? : 0, | 466 | pdata->x_min ? : 0, |
453 | pdata->x_max ? : MAX_12BIT, | 467 | pdata->x_max ? : MAX_12BIT, |
454 | 0, 0); | 468 | 0, 0); |
455 | input_set_abs_params(&ts->input, ABS_Y, | 469 | input_set_abs_params(input_dev, ABS_Y, |
456 | pdata->y_min ? : 0, | 470 | pdata->y_min ? : 0, |
457 | pdata->y_max ? : MAX_12BIT, | 471 | pdata->y_max ? : MAX_12BIT, |
458 | 0, 0); | 472 | 0, 0); |
459 | input_set_abs_params(&ts->input, ABS_PRESSURE, | 473 | input_set_abs_params(input_dev, ABS_PRESSURE, |
460 | pdata->pressure_min, pdata->pressure_max, 0, 0); | 474 | pdata->pressure_min, pdata->pressure_max, 0, 0); |
461 | 475 | ||
462 | input_register_device(&ts->input); | ||
463 | |||
464 | /* set up the transfers to read touchscreen state; this assumes we | 476 | /* set up the transfers to read touchscreen state; this assumes we |
465 | * use formula #2 for pressure, not #3. | 477 | * use formula #2 for pressure, not #3. |
466 | */ | 478 | */ |
479 | INIT_LIST_HEAD(&ts->msg.transfers); | ||
467 | x = ts->xfer; | 480 | x = ts->xfer; |
468 | 481 | ||
469 | /* y- still on; turn on only y+ (and ADC) */ | 482 | /* y- still on; turn on only y+ (and ADC) */ |
470 | x->tx_buf = &read_y; | 483 | ts->read_y = READ_Y; |
484 | x->tx_buf = &ts->read_y; | ||
471 | x->len = 1; | 485 | x->len = 1; |
486 | spi_message_add_tail(x, &ts->msg); | ||
487 | |||
472 | x++; | 488 | x++; |
473 | x->rx_buf = &ts->tc.y; | 489 | x->rx_buf = &ts->tc.y; |
474 | x->len = 2; | 490 | x->len = 2; |
475 | x++; | 491 | spi_message_add_tail(x, &ts->msg); |
476 | 492 | ||
477 | /* turn y+ off, x- on; we'll use formula #2 */ | 493 | /* turn y+ off, x- on; we'll use formula #2 */ |
478 | if (ts->model == 7846) { | 494 | if (ts->model == 7846) { |
479 | x->tx_buf = &read_z1; | 495 | x++; |
496 | ts->read_z1 = READ_Z1; | ||
497 | x->tx_buf = &ts->read_z1; | ||
480 | x->len = 1; | 498 | x->len = 1; |
499 | spi_message_add_tail(x, &ts->msg); | ||
500 | |||
481 | x++; | 501 | x++; |
482 | x->rx_buf = &ts->tc.z1; | 502 | x->rx_buf = &ts->tc.z1; |
483 | x->len = 2; | 503 | x->len = 2; |
484 | x++; | 504 | spi_message_add_tail(x, &ts->msg); |
485 | 505 | ||
486 | x->tx_buf = &read_z2; | 506 | x++; |
507 | ts->read_z2 = READ_Z2; | ||
508 | x->tx_buf = &ts->read_z2; | ||
487 | x->len = 1; | 509 | x->len = 1; |
510 | spi_message_add_tail(x, &ts->msg); | ||
511 | |||
488 | x++; | 512 | x++; |
489 | x->rx_buf = &ts->tc.z2; | 513 | x->rx_buf = &ts->tc.z2; |
490 | x->len = 2; | 514 | x->len = 2; |
491 | x++; | 515 | spi_message_add_tail(x, &ts->msg); |
492 | } | 516 | } |
493 | 517 | ||
494 | /* turn y- off, x+ on, then leave in lowpower */ | 518 | /* turn y- off, x+ on, then leave in lowpower */ |
495 | x->tx_buf = &read_x; | 519 | x++; |
520 | ts->read_x = READ_X; | ||
521 | x->tx_buf = &ts->read_x; | ||
496 | x->len = 1; | 522 | x->len = 1; |
523 | spi_message_add_tail(x, &ts->msg); | ||
524 | |||
497 | x++; | 525 | x++; |
498 | x->rx_buf = &ts->tc.x; | 526 | x->rx_buf = &ts->tc.x; |
499 | x->len = 2; | 527 | x->len = 2; |
500 | x++; | 528 | CS_CHANGE(*x); |
501 | 529 | spi_message_add_tail(x, &ts->msg); | |
502 | CS_CHANGE(x[-1]); | ||
503 | 530 | ||
504 | for (i = 0; i < x - ts->xfer; i++) | ||
505 | spi_message_add_tail(&ts->xfer[i], &ts->msg); | ||
506 | ts->msg.complete = ads7846_rx; | 531 | ts->msg.complete = ads7846_rx; |
507 | ts->msg.context = ts; | 532 | ts->msg.context = ts; |
508 | 533 | ||
@@ -510,9 +535,8 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
510 | SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING, | 535 | SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING, |
511 | spi->dev.bus_id, ts)) { | 536 | spi->dev.bus_id, ts)) { |
512 | dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); | 537 | dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); |
513 | input_unregister_device(&ts->input); | 538 | err = -EBUSY; |
514 | kfree(ts); | 539 | goto err_free_mem; |
515 | return -EBUSY; | ||
516 | } | 540 | } |
517 | 541 | ||
518 | dev_info(&spi->dev, "touchscreen, irq %d\n", spi->irq); | 542 | dev_info(&spi->dev, "touchscreen, irq %d\n", spi->irq); |
@@ -534,7 +558,18 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
534 | device_create_file(&spi->dev, &dev_attr_vbatt); | 558 | device_create_file(&spi->dev, &dev_attr_vbatt); |
535 | device_create_file(&spi->dev, &dev_attr_vaux); | 559 | device_create_file(&spi->dev, &dev_attr_vaux); |
536 | 560 | ||
561 | err = input_register_device(input_dev); | ||
562 | if (err) | ||
563 | goto err_free_irq; | ||
564 | |||
537 | return 0; | 565 | return 0; |
566 | |||
567 | err_free_irq: | ||
568 | free_irq(spi->irq, ts); | ||
569 | err_free_mem: | ||
570 | input_free_device(input_dev); | ||
571 | kfree(ts); | ||
572 | return err; | ||
538 | } | 573 | } |
539 | 574 | ||
540 | static int __devexit ads7846_remove(struct spi_device *spi) | 575 | static int __devexit ads7846_remove(struct spi_device *spi) |
@@ -554,7 +589,7 @@ static int __devexit ads7846_remove(struct spi_device *spi) | |||
554 | device_remove_file(&spi->dev, &dev_attr_vbatt); | 589 | device_remove_file(&spi->dev, &dev_attr_vbatt); |
555 | device_remove_file(&spi->dev, &dev_attr_vaux); | 590 | device_remove_file(&spi->dev, &dev_attr_vaux); |
556 | 591 | ||
557 | input_unregister_device(&ts->input); | 592 | input_unregister_device(ts->input); |
558 | kfree(ts); | 593 | kfree(ts); |
559 | 594 | ||
560 | dev_dbg(&spi->dev, "unregistered touchscreen\n"); | 595 | dev_dbg(&spi->dev, "unregistered touchscreen\n"); |