Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: bcm5974 - report ABS_MT events

Make bcm5974 report raw multi-touch (MT) data in the form of ABS_MT events.

[dtor@mail.ru: get rid of module option, always report all events]
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

authored by

Henrik Rydberg and committed by
Dmitry Torokhov
6f2701b7 861a6442

+43 -1
+43 -1
drivers/input/mouse/bcm5974.c
··· 139 139 /* trackpad finger data size, empirically at least ten fingers */ 140 140 #define SIZEOF_FINGER sizeof(struct tp_finger) 141 141 #define SIZEOF_ALL_FINGERS (16 * SIZEOF_FINGER) 142 + #define MAX_FINGER_ORIENTATION 16384 142 143 143 144 /* device-specific parameters */ 144 145 struct bcm5974_param { ··· 285 284 input_set_abs_params(input_dev, ABS_Y, 286 285 0, cfg->y.dim, cfg->y.fuzz, 0); 287 286 287 + /* finger touch area */ 288 + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 289 + cfg->w.devmin, cfg->w.devmax, 0, 0); 290 + input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 291 + cfg->w.devmin, cfg->w.devmax, 0, 0); 292 + /* finger approach area */ 293 + input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 294 + cfg->w.devmin, cfg->w.devmax, 0, 0); 295 + input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 296 + cfg->w.devmin, cfg->w.devmax, 0, 0); 297 + /* finger orientation */ 298 + input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 299 + -MAX_FINGER_ORIENTATION, 300 + MAX_FINGER_ORIENTATION, 0, 0); 301 + /* finger position */ 302 + input_set_abs_params(input_dev, ABS_MT_POSITION_X, 303 + cfg->x.devmin, cfg->x.devmax, 0, 0); 304 + input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 305 + cfg->y.devmin, cfg->y.devmax, 0, 0); 306 + 288 307 __set_bit(EV_KEY, input_dev->evbit); 289 308 __set_bit(BTN_TOUCH, input_dev->keybit); 290 309 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); ··· 331 310 return 0; 332 311 } 333 312 313 + static void report_finger_data(struct input_dev *input, 314 + const struct bcm5974_config *cfg, 315 + const struct tp_finger *f) 316 + { 317 + input_report_abs(input, ABS_MT_TOUCH_MAJOR, raw2int(f->force_major)); 318 + input_report_abs(input, ABS_MT_TOUCH_MINOR, raw2int(f->force_minor)); 319 + input_report_abs(input, ABS_MT_WIDTH_MAJOR, raw2int(f->size_major)); 320 + input_report_abs(input, ABS_MT_WIDTH_MINOR, raw2int(f->size_minor)); 321 + input_report_abs(input, ABS_MT_ORIENTATION, 322 + MAX_FINGER_ORIENTATION - raw2int(f->orientation)); 323 + input_report_abs(input, ABS_MT_POSITION_X, raw2int(f->abs_x)); 324 + input_report_abs(input, ABS_MT_POSITION_Y, 325 + cfg->y.devmin + cfg->y.devmax - raw2int(f->abs_y)); 326 + input_mt_sync(input); 327 + } 328 + 334 329 /* report trackpad data as logical trackpad state */ 335 330 static int report_tp_state(struct bcm5974 *dev, int size) 336 331 { 337 332 const struct bcm5974_config *c = &dev->cfg; 338 333 const struct tp_finger *f; 339 334 struct input_dev *input = dev->input; 340 - int raw_p, raw_w, raw_x, raw_y, raw_n; 335 + int raw_p, raw_w, raw_x, raw_y, raw_n, i; 341 336 int ptest, origin, ibt = 0, nmin = 0, nmax = 0; 342 337 int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; 343 338 ··· 366 329 367 330 /* always track the first finger; when detached, start over */ 368 331 if (raw_n) { 332 + 333 + /* report raw trackpad data */ 334 + for (i = 0; i < raw_n; i++) 335 + report_finger_data(input, c, &f[i]); 336 + 369 337 raw_p = raw2int(f->force_major); 370 338 raw_w = raw2int(f->size_major); 371 339 raw_x = raw2int(f->abs_x);