diff options
Diffstat (limited to 'drivers/input/mouse/bcm5974.c')
-rw-r--r-- | drivers/input/mouse/bcm5974.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 0d1d33468b43..4f8fe0886b2a 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
@@ -139,6 +139,7 @@ struct tp_finger { | |||
139 | /* trackpad finger data size, empirically at least ten fingers */ | 139 | /* trackpad finger data size, empirically at least ten fingers */ |
140 | #define SIZEOF_FINGER sizeof(struct tp_finger) | 140 | #define SIZEOF_FINGER sizeof(struct tp_finger) |
141 | #define SIZEOF_ALL_FINGERS (16 * SIZEOF_FINGER) | 141 | #define SIZEOF_ALL_FINGERS (16 * SIZEOF_FINGER) |
142 | #define MAX_FINGER_ORIENTATION 16384 | ||
142 | 143 | ||
143 | /* device-specific parameters */ | 144 | /* device-specific parameters */ |
144 | struct bcm5974_param { | 145 | struct bcm5974_param { |
@@ -284,6 +285,26 @@ static void setup_events_to_report(struct input_dev *input_dev, | |||
284 | input_set_abs_params(input_dev, ABS_Y, | 285 | input_set_abs_params(input_dev, ABS_Y, |
285 | 0, cfg->y.dim, cfg->y.fuzz, 0); | 286 | 0, cfg->y.dim, cfg->y.fuzz, 0); |
286 | 287 | ||
288 | /* finger touch area */ | ||
289 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, | ||
290 | cfg->w.devmin, cfg->w.devmax, 0, 0); | ||
291 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, | ||
292 | cfg->w.devmin, cfg->w.devmax, 0, 0); | ||
293 | /* finger approach area */ | ||
294 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, | ||
295 | cfg->w.devmin, cfg->w.devmax, 0, 0); | ||
296 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, | ||
297 | cfg->w.devmin, cfg->w.devmax, 0, 0); | ||
298 | /* finger orientation */ | ||
299 | input_set_abs_params(input_dev, ABS_MT_ORIENTATION, | ||
300 | -MAX_FINGER_ORIENTATION, | ||
301 | MAX_FINGER_ORIENTATION, 0, 0); | ||
302 | /* finger position */ | ||
303 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | ||
304 | cfg->x.devmin, cfg->x.devmax, 0, 0); | ||
305 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | ||
306 | cfg->y.devmin, cfg->y.devmax, 0, 0); | ||
307 | |||
287 | __set_bit(EV_KEY, input_dev->evbit); | 308 | __set_bit(EV_KEY, input_dev->evbit); |
288 | __set_bit(BTN_TOUCH, input_dev->keybit); | 309 | __set_bit(BTN_TOUCH, input_dev->keybit); |
289 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | 310 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); |
@@ -310,13 +331,29 @@ static int report_bt_state(struct bcm5974 *dev, int size) | |||
310 | return 0; | 331 | return 0; |
311 | } | 332 | } |
312 | 333 | ||
334 | static void report_finger_data(struct input_dev *input, | ||
335 | const struct bcm5974_config *cfg, | ||
336 | const struct tp_finger *f) | ||
337 | { | ||
338 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, raw2int(f->force_major)); | ||
339 | input_report_abs(input, ABS_MT_TOUCH_MINOR, raw2int(f->force_minor)); | ||
340 | input_report_abs(input, ABS_MT_WIDTH_MAJOR, raw2int(f->size_major)); | ||
341 | input_report_abs(input, ABS_MT_WIDTH_MINOR, raw2int(f->size_minor)); | ||
342 | input_report_abs(input, ABS_MT_ORIENTATION, | ||
343 | MAX_FINGER_ORIENTATION - raw2int(f->orientation)); | ||
344 | input_report_abs(input, ABS_MT_POSITION_X, raw2int(f->abs_x)); | ||
345 | input_report_abs(input, ABS_MT_POSITION_Y, | ||
346 | cfg->y.devmin + cfg->y.devmax - raw2int(f->abs_y)); | ||
347 | input_mt_sync(input); | ||
348 | } | ||
349 | |||
313 | /* report trackpad data as logical trackpad state */ | 350 | /* report trackpad data as logical trackpad state */ |
314 | static int report_tp_state(struct bcm5974 *dev, int size) | 351 | static int report_tp_state(struct bcm5974 *dev, int size) |
315 | { | 352 | { |
316 | const struct bcm5974_config *c = &dev->cfg; | 353 | const struct bcm5974_config *c = &dev->cfg; |
317 | const struct tp_finger *f; | 354 | const struct tp_finger *f; |
318 | struct input_dev *input = dev->input; | 355 | struct input_dev *input = dev->input; |
319 | int raw_p, raw_w, raw_x, raw_y, raw_n; | 356 | int raw_p, raw_w, raw_x, raw_y, raw_n, i; |
320 | int ptest, origin, ibt = 0, nmin = 0, nmax = 0; | 357 | int ptest, origin, ibt = 0, nmin = 0, nmax = 0; |
321 | int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; | 358 | int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; |
322 | 359 | ||
@@ -329,6 +366,11 @@ static int report_tp_state(struct bcm5974 *dev, int size) | |||
329 | 366 | ||
330 | /* always track the first finger; when detached, start over */ | 367 | /* always track the first finger; when detached, start over */ |
331 | if (raw_n) { | 368 | if (raw_n) { |
369 | |||
370 | /* report raw trackpad data */ | ||
371 | for (i = 0; i < raw_n; i++) | ||
372 | report_finger_data(input, c, &f[i]); | ||
373 | |||
332 | raw_p = raw2int(f->force_major); | 374 | raw_p = raw2int(f->force_major); |
333 | raw_w = raw2int(f->size_major); | 375 | raw_w = raw2int(f->size_major); |
334 | raw_x = raw2int(f->abs_x); | 376 | raw_x = raw2int(f->abs_x); |