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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: update multi-touch protocol documentation
Input: add the ABS_MT_PRESSURE event
Input: winbond-cir - remove dmesg spam
Input: lifebook - add another Lifebook DMI signature
Input: ad7879 - support auxiliary GPIOs via gpiolib

+204 -75
+40 -8
Documentation/input/multi-touch-protocol.txt
··· 27 27 28 28 A set of ABS_MT events with the desired properties is defined. The events 29 29 are divided into categories, to allow for partial implementation. The 30 - minimum set consists of ABS_MT_TOUCH_MAJOR, ABS_MT_POSITION_X and 31 - ABS_MT_POSITION_Y, which allows for multiple fingers to be tracked. If the 32 - device supports it, the ABS_MT_WIDTH_MAJOR may be used to provide the size 33 - of the approaching finger. Anisotropy and direction may be specified with 34 - ABS_MT_TOUCH_MINOR, ABS_MT_WIDTH_MINOR and ABS_MT_ORIENTATION. The 35 - ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a 30 + minimum set consists of ABS_MT_POSITION_X and ABS_MT_POSITION_Y, which 31 + allows for multiple fingers to be tracked. If the device supports it, the 32 + ABS_MT_TOUCH_MAJOR and ABS_MT_WIDTH_MAJOR may be used to provide the size 33 + of the contact area and approaching finger, respectively. 34 + 35 + The TOUCH and WIDTH parameters have a geometrical interpretation; imagine 36 + looking through a window at someone gently holding a finger against the 37 + glass. You will see two regions, one inner region consisting of the part 38 + of the finger actually touching the glass, and one outer region formed by 39 + the perimeter of the finger. The diameter of the inner region is the 40 + ABS_MT_TOUCH_MAJOR, the diameter of the outer region is 41 + ABS_MT_WIDTH_MAJOR. Now imagine the person pressing the finger harder 42 + against the glass. The inner region will increase, and in general, the 43 + ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR, which is always smaller than 44 + unity, is related to the finger pressure. For pressure-based devices, 45 + ABS_MT_PRESSURE may be used to provide the pressure on the contact area 46 + instead. 47 + 48 + In addition to the MAJOR parameters, the oval shape of the finger can be 49 + described by adding the MINOR parameters, such that MAJOR and MINOR are the 50 + major and minor axis of an ellipse. Finally, the orientation of the oval 51 + shape can be describe with the ORIENTATION parameter. 52 + 53 + The ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a 36 54 finger or a pen or something else. Devices with more granular information 37 55 may specify general shapes as blobs, i.e., as a sequence of rectangular 38 56 shapes grouped together by an ABS_MT_BLOB_ID. Finally, for the few devices ··· 60 42 Here is what a minimal event sequence for a two-finger touch would look 61 43 like: 62 44 63 - ABS_MT_TOUCH_MAJOR 64 45 ABS_MT_POSITION_X 65 46 ABS_MT_POSITION_Y 66 47 SYN_MT_REPORT 67 - ABS_MT_TOUCH_MAJOR 68 48 ABS_MT_POSITION_X 69 49 ABS_MT_POSITION_Y 70 50 SYN_MT_REPORT ··· 102 86 the contact. The ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximates 103 87 the notion of pressure. The fingers of the hand and the palm all have 104 88 different characteristic widths [1]. 89 + 90 + ABS_MT_PRESSURE 91 + 92 + The pressure, in arbitrary units, on the contact area. May be used instead 93 + of TOUCH and WIDTH for pressure-based devices or any device with a spatial 94 + signal intensity distribution. 105 95 106 96 ABS_MT_ORIENTATION 107 97 ··· 190 168 191 169 There are a few devices that support trackingID in hardware. User space can 192 170 make use of these native identifiers to reduce bandwidth and cpu usage. 171 + 172 + 173 + Gestures 174 + -------- 175 + 176 + In the specific application of creating gesture events, the TOUCH and WIDTH 177 + parameters can be used to, e.g., approximate finger pressure or distinguish 178 + between index finger and thumb. With the addition of the MINOR parameters, 179 + one can also distinguish between a sweeping finger and a pointing finger, 180 + and with ORIENTATION, one can detect twisting of fingers. 193 181 194 182 195 183 Notes
+1
drivers/input/input.c
··· 46 46 ABS_MT_TOOL_TYPE, 47 47 ABS_MT_BLOB_ID, 48 48 ABS_MT_TRACKING_ID, 49 + ABS_MT_PRESSURE, 49 50 0 50 51 }; 51 52 static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)];
+1 -1
drivers/input/misc/winbond-cir.c
··· 768 768 return; 769 769 } 770 770 771 - dev_info(dev, "IR-RC6 ad 0x%02X cm 0x%02X cu 0x%04X " 771 + dev_dbg(dev, "IR-RC6 ad 0x%02X cm 0x%02X cu 0x%04X " 772 772 "toggle %u mode %u scan 0x%08X\n", 773 773 address, 774 774 command,
+6
drivers/input/mouse/lifebook.c
··· 53 53 { 54 54 /* LifeBook B */ 55 55 .matches = { 56 + DMI_MATCH(DMI_PRODUCT_NAME, "Lifebook B Series"), 57 + }, 58 + }, 59 + { 60 + /* LifeBook B */ 61 + .matches = { 56 62 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), 57 63 }, 58 64 },
+147 -62
drivers/input/touchscreen/ad7879.c
··· 47 47 #include <linux/workqueue.h> 48 48 #include <linux/spi/spi.h> 49 49 #include <linux/i2c.h> 50 + #include <linux/gpio.h> 50 51 51 52 #include <linux/spi/ad7879.h> 52 53 ··· 133 132 struct input_dev *input; 134 133 struct work_struct work; 135 134 struct timer_list timer; 136 - 135 + #ifdef CONFIG_GPIOLIB 136 + struct gpio_chip gc; 137 + #endif 137 138 struct mutex mutex; 138 139 unsigned disabled:1; /* P: mutex */ 139 140 ··· 153 150 u8 median; 154 151 u16 x_plate_ohms; 155 152 u16 pressure_max; 156 - u16 gpio_init; 157 153 u16 cmd_crtl1; 158 154 u16 cmd_crtl2; 159 155 u16 cmd_crtl3; 160 - unsigned gpio:1; 161 156 }; 162 157 163 158 static int ad7879_read(bus_device *, u8); ··· 238 237 239 238 static void ad7879_setup(struct ad7879 *ts) 240 239 { 241 - ts->cmd_crtl3 = AD7879_YPLUS_BIT | 242 - AD7879_XPLUS_BIT | 243 - AD7879_Z2_BIT | 244 - AD7879_Z1_BIT | 245 - AD7879_TEMPMASK_BIT | 246 - AD7879_AUXVBATMASK_BIT | 247 - AD7879_GPIOALERTMASK_BIT; 248 - 249 - ts->cmd_crtl2 = AD7879_PM(AD7879_PM_DYN) | AD7879_DFR | 250 - AD7879_AVG(ts->averaging) | 251 - AD7879_MFS(ts->median) | 252 - AD7879_FCD(ts->first_conversion_delay) | 253 - ts->gpio_init; 254 - 255 - ts->cmd_crtl1 = AD7879_MODE_INT | AD7879_MODE_SEQ1 | 256 - AD7879_ACQ(ts->acquisition_time) | 257 - AD7879_TMR(ts->pen_down_acc_interval); 258 - 259 240 ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2); 260 241 ad7879_write(ts->bus, AD7879_REG_CTRL3, ts->cmd_crtl3); 261 242 ad7879_write(ts->bus, AD7879_REG_CTRL1, ts->cmd_crtl1); ··· 307 324 308 325 static DEVICE_ATTR(disable, 0664, ad7879_disable_show, ad7879_disable_store); 309 326 310 - static ssize_t ad7879_gpio_show(struct device *dev, 311 - struct device_attribute *attr, char *buf) 312 - { 313 - struct ad7879 *ts = dev_get_drvdata(dev); 314 - 315 - return sprintf(buf, "%u\n", ts->gpio); 316 - } 317 - 318 - static ssize_t ad7879_gpio_store(struct device *dev, 319 - struct device_attribute *attr, 320 - const char *buf, size_t count) 321 - { 322 - struct ad7879 *ts = dev_get_drvdata(dev); 323 - unsigned long val; 324 - int error; 325 - 326 - error = strict_strtoul(buf, 10, &val); 327 - if (error) 328 - return error; 329 - 330 - mutex_lock(&ts->mutex); 331 - ts->gpio = !!val; 332 - error = ad7879_write(ts->bus, AD7879_REG_CTRL2, 333 - ts->gpio ? 334 - ts->cmd_crtl2 & ~AD7879_GPIO_DATA : 335 - ts->cmd_crtl2 | AD7879_GPIO_DATA); 336 - mutex_unlock(&ts->mutex); 337 - 338 - return error ? : count; 339 - } 340 - 341 - static DEVICE_ATTR(gpio, 0664, ad7879_gpio_show, ad7879_gpio_store); 342 - 343 327 static struct attribute *ad7879_attributes[] = { 344 328 &dev_attr_disable.attr, 345 - &dev_attr_gpio.attr, 346 329 NULL 347 330 }; 348 331 349 332 static const struct attribute_group ad7879_attr_group = { 350 333 .attrs = ad7879_attributes, 351 334 }; 335 + 336 + #ifdef CONFIG_GPIOLIB 337 + static int ad7879_gpio_direction_input(struct gpio_chip *chip, 338 + unsigned gpio) 339 + { 340 + struct ad7879 *ts = container_of(chip, struct ad7879, gc); 341 + int err; 342 + 343 + mutex_lock(&ts->mutex); 344 + ts->cmd_crtl2 |= AD7879_GPIO_EN | AD7879_GPIODIR | AD7879_GPIOPOL; 345 + err = ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2); 346 + mutex_unlock(&ts->mutex); 347 + 348 + return err; 349 + } 350 + 351 + static int ad7879_gpio_direction_output(struct gpio_chip *chip, 352 + unsigned gpio, int level) 353 + { 354 + struct ad7879 *ts = container_of(chip, struct ad7879, gc); 355 + int err; 356 + 357 + mutex_lock(&ts->mutex); 358 + ts->cmd_crtl2 &= ~AD7879_GPIODIR; 359 + ts->cmd_crtl2 |= AD7879_GPIO_EN | AD7879_GPIOPOL; 360 + if (level) 361 + ts->cmd_crtl2 |= AD7879_GPIO_DATA; 362 + else 363 + ts->cmd_crtl2 &= ~AD7879_GPIO_DATA; 364 + 365 + err = ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2); 366 + mutex_unlock(&ts->mutex); 367 + 368 + return err; 369 + } 370 + 371 + static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio) 372 + { 373 + struct ad7879 *ts = container_of(chip, struct ad7879, gc); 374 + u16 val; 375 + 376 + mutex_lock(&ts->mutex); 377 + val = ad7879_read(ts->bus, AD7879_REG_CTRL2); 378 + mutex_unlock(&ts->mutex); 379 + 380 + return !!(val & AD7879_GPIO_DATA); 381 + } 382 + 383 + static void ad7879_gpio_set_value(struct gpio_chip *chip, 384 + unsigned gpio, int value) 385 + { 386 + struct ad7879 *ts = container_of(chip, struct ad7879, gc); 387 + 388 + mutex_lock(&ts->mutex); 389 + if (value) 390 + ts->cmd_crtl2 |= AD7879_GPIO_DATA; 391 + else 392 + ts->cmd_crtl2 &= ~AD7879_GPIO_DATA; 393 + 394 + ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2); 395 + mutex_unlock(&ts->mutex); 396 + } 397 + 398 + static int __devinit ad7879_gpio_add(struct device *dev) 399 + { 400 + struct ad7879 *ts = dev_get_drvdata(dev); 401 + struct ad7879_platform_data *pdata = dev->platform_data; 402 + int ret = 0; 403 + 404 + if (pdata->gpio_export) { 405 + ts->gc.direction_input = ad7879_gpio_direction_input; 406 + ts->gc.direction_output = ad7879_gpio_direction_output; 407 + ts->gc.get = ad7879_gpio_get_value; 408 + ts->gc.set = ad7879_gpio_set_value; 409 + ts->gc.can_sleep = 1; 410 + ts->gc.base = pdata->gpio_base; 411 + ts->gc.ngpio = 1; 412 + ts->gc.label = "AD7879-GPIO"; 413 + ts->gc.owner = THIS_MODULE; 414 + ts->gc.dev = dev; 415 + 416 + ret = gpiochip_add(&ts->gc); 417 + if (ret) 418 + dev_err(dev, "failed to register gpio %d\n", 419 + ts->gc.base); 420 + } 421 + 422 + return ret; 423 + } 424 + 425 + /* 426 + * We mark ad7879_gpio_remove inline so there is a chance the code 427 + * gets discarded when not needed. We can't do __devinit/__devexit 428 + * markup since it is used in both probe and remove methods. 429 + */ 430 + static inline void ad7879_gpio_remove(struct device *dev) 431 + { 432 + struct ad7879 *ts = dev_get_drvdata(dev); 433 + struct ad7879_platform_data *pdata = dev->platform_data; 434 + int ret; 435 + 436 + if (pdata->gpio_export) { 437 + ret = gpiochip_remove(&ts->gc); 438 + if (ret) 439 + dev_err(dev, "failed to remove gpio %d\n", 440 + ts->gc.base); 441 + } 442 + } 443 + #else 444 + static inline int ad7879_gpio_add(struct device *dev) 445 + { 446 + return 0; 447 + } 448 + 449 + static inline void ad7879_gpio_remove(struct device *dev) 450 + { 451 + } 452 + #endif 352 453 353 454 static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts) 354 455 { ··· 469 402 ts->averaging = pdata->averaging; 470 403 ts->pen_down_acc_interval = pdata->pen_down_acc_interval; 471 404 ts->median = pdata->median; 472 - 473 - if (pdata->gpio_output) 474 - ts->gpio_init = AD7879_GPIO_EN | 475 - (pdata->gpio_default ? 0 : AD7879_GPIO_DATA); 476 - else 477 - ts->gpio_init = AD7879_GPIO_EN | AD7879_GPIODIR; 478 405 479 406 snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&bus->dev)); 480 407 ··· 507 446 goto err_free_mem; 508 447 } 509 448 449 + ts->cmd_crtl3 = AD7879_YPLUS_BIT | 450 + AD7879_XPLUS_BIT | 451 + AD7879_Z2_BIT | 452 + AD7879_Z1_BIT | 453 + AD7879_TEMPMASK_BIT | 454 + AD7879_AUXVBATMASK_BIT | 455 + AD7879_GPIOALERTMASK_BIT; 456 + 457 + ts->cmd_crtl2 = AD7879_PM(AD7879_PM_DYN) | AD7879_DFR | 458 + AD7879_AVG(ts->averaging) | 459 + AD7879_MFS(ts->median) | 460 + AD7879_FCD(ts->first_conversion_delay); 461 + 462 + ts->cmd_crtl1 = AD7879_MODE_INT | AD7879_MODE_SEQ1 | 463 + AD7879_ACQ(ts->acquisition_time) | 464 + AD7879_TMR(ts->pen_down_acc_interval); 465 + 510 466 ad7879_setup(ts); 511 467 512 468 err = request_irq(bus->irq, ad7879_irq, ··· 538 460 if (err) 539 461 goto err_free_irq; 540 462 541 - err = input_register_device(input_dev); 463 + err = ad7879_gpio_add(&bus->dev); 542 464 if (err) 543 465 goto err_remove_attr; 466 + 467 + err = input_register_device(input_dev); 468 + if (err) 469 + goto err_remove_gpio; 544 470 545 471 dev_info(&bus->dev, "Rev.%d touchscreen, irq %d\n", 546 472 revid >> 8, bus->irq); 547 473 548 474 return 0; 549 475 476 + err_remove_gpio: 477 + ad7879_gpio_remove(&bus->dev); 550 478 err_remove_attr: 551 479 sysfs_remove_group(&bus->dev.kobj, &ad7879_attr_group); 552 480 err_free_irq: ··· 565 481 566 482 static int __devexit ad7879_destroy(bus_device *bus, struct ad7879 *ts) 567 483 { 484 + ad7879_gpio_remove(&bus->dev); 568 485 ad7879_disable(ts); 569 486 sysfs_remove_group(&ts->bus->dev.kobj, &ad7879_attr_group); 570 487 free_irq(ts->bus->irq, ts);
+1
include/linux/input.h
··· 660 660 #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ 661 661 #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ 662 662 #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ 663 + #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ 663 664 664 665 #define ABS_MAX 0x3f 665 666 #define ABS_CNT (ABS_MAX+1)
+8 -4
include/linux/spi/ad7879.h
··· 28 28 * 1 = 4, 2 = 8, 3 = 16 (median > averaging) 29 29 */ 30 30 u8 median; 31 - /* 1 = AUX/VBAT/GPIO set to GPIO Output */ 32 - u8 gpio_output; 33 - /* Initial GPIO pin state (valid if gpio_output = 1) */ 34 - u8 gpio_default; 31 + /* 1 = AUX/VBAT/GPIO export GPIO to gpiolib 32 + * requires CONFIG_GPIOLIB 33 + */ 34 + bool gpio_export; 35 + /* identifies the first GPIO number handled by this chip; 36 + * or, if negative, requests dynamic ID allocation. 37 + */ 38 + s32 gpio_base; 35 39 };