diff options
| -rw-r--r-- | Documentation/input/multi-touch-protocol.txt | 48 | ||||
| -rw-r--r-- | drivers/input/input.c | 1 | ||||
| -rw-r--r-- | drivers/input/misc/winbond-cir.c | 2 | ||||
| -rw-r--r-- | drivers/input/mouse/lifebook.c | 6 | ||||
| -rw-r--r-- | drivers/input/touchscreen/ad7879.c | 197 | ||||
| -rw-r--r-- | include/linux/input.h | 1 | ||||
| -rw-r--r-- | include/linux/spi/ad7879.h | 12 |
7 files changed, 198 insertions, 69 deletions
diff --git a/Documentation/input/multi-touch-protocol.txt b/Documentation/input/multi-touch-protocol.txt index a12ea3b586e6..8490480ce432 100644 --- a/Documentation/input/multi-touch-protocol.txt +++ b/Documentation/input/multi-touch-protocol.txt | |||
| @@ -27,12 +27,30 @@ set of events/packets. | |||
| 27 | 27 | ||
| 28 | A set of ABS_MT events with the desired properties is defined. The events | 28 | A set of ABS_MT events with the desired properties is defined. The events |
| 29 | are divided into categories, to allow for partial implementation. The | 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 | 30 | minimum set consists of ABS_MT_POSITION_X and ABS_MT_POSITION_Y, which |
| 31 | ABS_MT_POSITION_Y, which allows for multiple fingers to be tracked. If the | 31 | allows for multiple fingers to be tracked. If the device supports it, the |
| 32 | device supports it, the ABS_MT_WIDTH_MAJOR may be used to provide the size | 32 | ABS_MT_TOUCH_MAJOR and ABS_MT_WIDTH_MAJOR may be used to provide the size |
| 33 | of the approaching finger. Anisotropy and direction may be specified with | 33 | of the contact area and approaching finger, respectively. |
| 34 | ABS_MT_TOUCH_MINOR, ABS_MT_WIDTH_MINOR and ABS_MT_ORIENTATION. The | 34 | |
| 35 | ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a | 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 | finger or a pen or something else. Devices with more granular information | 54 | finger or a pen or something else. Devices with more granular information |
| 37 | may specify general shapes as blobs, i.e., as a sequence of rectangular | 55 | may specify general shapes as blobs, i.e., as a sequence of rectangular |
| 38 | shapes grouped together by an ABS_MT_BLOB_ID. Finally, for the few devices | 56 | shapes grouped together by an ABS_MT_BLOB_ID. Finally, for the few devices |
| @@ -42,11 +60,9 @@ report finger tracking from hardware [5]. | |||
| 42 | Here is what a minimal event sequence for a two-finger touch would look | 60 | Here is what a minimal event sequence for a two-finger touch would look |
| 43 | like: | 61 | like: |
| 44 | 62 | ||
| 45 | ABS_MT_TOUCH_MAJOR | ||
| 46 | ABS_MT_POSITION_X | 63 | ABS_MT_POSITION_X |
| 47 | ABS_MT_POSITION_Y | 64 | ABS_MT_POSITION_Y |
| 48 | SYN_MT_REPORT | 65 | SYN_MT_REPORT |
| 49 | ABS_MT_TOUCH_MAJOR | ||
| 50 | ABS_MT_POSITION_X | 66 | ABS_MT_POSITION_X |
| 51 | ABS_MT_POSITION_Y | 67 | ABS_MT_POSITION_Y |
| 52 | SYN_MT_REPORT | 68 | SYN_MT_REPORT |
| @@ -87,6 +103,12 @@ the contact. The ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximates | |||
| 87 | the notion of pressure. The fingers of the hand and the palm all have | 103 | the notion of pressure. The fingers of the hand and the palm all have |
| 88 | different characteristic widths [1]. | 104 | different characteristic widths [1]. |
| 89 | 105 | ||
| 106 | ABS_MT_PRESSURE | ||
| 107 | |||
| 108 | The pressure, in arbitrary units, on the contact area. May be used instead | ||
| 109 | of TOUCH and WIDTH for pressure-based devices or any device with a spatial | ||
| 110 | signal intensity distribution. | ||
| 111 | |||
| 90 | ABS_MT_ORIENTATION | 112 | ABS_MT_ORIENTATION |
| 91 | 113 | ||
| 92 | The orientation of the ellipse. The value should describe a signed quarter | 114 | The orientation of the ellipse. The value should describe a signed quarter |
| @@ -170,6 +192,16 @@ There are a few devices that support trackingID in hardware. User space can | |||
| 170 | make use of these native identifiers to reduce bandwidth and cpu usage. | 192 | make use of these native identifiers to reduce bandwidth and cpu usage. |
| 171 | 193 | ||
| 172 | 194 | ||
| 195 | Gestures | ||
| 196 | -------- | ||
| 197 | |||
| 198 | In the specific application of creating gesture events, the TOUCH and WIDTH | ||
| 199 | parameters can be used to, e.g., approximate finger pressure or distinguish | ||
| 200 | between index finger and thumb. With the addition of the MINOR parameters, | ||
| 201 | one can also distinguish between a sweeping finger and a pointing finger, | ||
| 202 | and with ORIENTATION, one can detect twisting of fingers. | ||
| 203 | |||
| 204 | |||
| 173 | Notes | 205 | Notes |
| 174 | ----- | 206 | ----- |
| 175 | 207 | ||
diff --git a/drivers/input/input.c b/drivers/input/input.c index 30b503b8d67b..86cb2d2196ff 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -46,6 +46,7 @@ static unsigned int input_abs_bypass_init_data[] __initdata = { | |||
| 46 | ABS_MT_TOOL_TYPE, | 46 | ABS_MT_TOOL_TYPE, |
| 47 | ABS_MT_BLOB_ID, | 47 | ABS_MT_BLOB_ID, |
| 48 | ABS_MT_TRACKING_ID, | 48 | ABS_MT_TRACKING_ID, |
| 49 | ABS_MT_PRESSURE, | ||
| 49 | 0 | 50 | 0 |
| 50 | }; | 51 | }; |
| 51 | static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)]; | 52 | static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)]; |
diff --git a/drivers/input/misc/winbond-cir.c b/drivers/input/misc/winbond-cir.c index 33309fe44e20..c8f5a9a3fa14 100644 --- a/drivers/input/misc/winbond-cir.c +++ b/drivers/input/misc/winbond-cir.c | |||
| @@ -768,7 +768,7 @@ wbcir_parse_rc6(struct device *dev, struct wbcir_data *data) | |||
| 768 | return; | 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 | "toggle %u mode %u scan 0x%08X\n", | 772 | "toggle %u mode %u scan 0x%08X\n", |
| 773 | address, | 773 | address, |
| 774 | command, | 774 | command, |
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 6d7aa10d10f0..7c1d7d420ae3 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
| @@ -53,6 +53,12 @@ static const struct dmi_system_id __initconst lifebook_dmi_table[] = { | |||
| 53 | { | 53 | { |
| 54 | /* LifeBook B */ | 54 | /* LifeBook B */ |
| 55 | .matches = { | 55 | .matches = { |
| 56 | DMI_MATCH(DMI_PRODUCT_NAME, "Lifebook B Series"), | ||
| 57 | }, | ||
| 58 | }, | ||
| 59 | { | ||
| 60 | /* LifeBook B */ | ||
| 61 | .matches = { | ||
| 56 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), | 62 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), |
| 57 | }, | 63 | }, |
| 58 | }, | 64 | }, |
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index c21e6d3a8844..794d070c6900 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | #include <linux/workqueue.h> | 47 | #include <linux/workqueue.h> |
| 48 | #include <linux/spi/spi.h> | 48 | #include <linux/spi/spi.h> |
| 49 | #include <linux/i2c.h> | 49 | #include <linux/i2c.h> |
| 50 | #include <linux/gpio.h> | ||
| 50 | 51 | ||
| 51 | #include <linux/spi/ad7879.h> | 52 | #include <linux/spi/ad7879.h> |
| 52 | 53 | ||
| @@ -132,7 +133,9 @@ struct ad7879 { | |||
| 132 | struct input_dev *input; | 133 | struct input_dev *input; |
| 133 | struct work_struct work; | 134 | struct work_struct work; |
| 134 | struct timer_list timer; | 135 | struct timer_list timer; |
| 135 | 136 | #ifdef CONFIG_GPIOLIB | |
| 137 | struct gpio_chip gc; | ||
| 138 | #endif | ||
| 136 | struct mutex mutex; | 139 | struct mutex mutex; |
| 137 | unsigned disabled:1; /* P: mutex */ | 140 | unsigned disabled:1; /* P: mutex */ |
| 138 | 141 | ||
| @@ -150,11 +153,9 @@ struct ad7879 { | |||
| 150 | u8 median; | 153 | u8 median; |
| 151 | u16 x_plate_ohms; | 154 | u16 x_plate_ohms; |
| 152 | u16 pressure_max; | 155 | u16 pressure_max; |
| 153 | u16 gpio_init; | ||
| 154 | u16 cmd_crtl1; | 156 | u16 cmd_crtl1; |
| 155 | u16 cmd_crtl2; | 157 | u16 cmd_crtl2; |
| 156 | u16 cmd_crtl3; | 158 | u16 cmd_crtl3; |
| 157 | unsigned gpio:1; | ||
| 158 | }; | 159 | }; |
| 159 | 160 | ||
| 160 | static int ad7879_read(bus_device *, u8); | 161 | static int ad7879_read(bus_device *, u8); |
| @@ -237,24 +238,6 @@ static irqreturn_t ad7879_irq(int irq, void *handle) | |||
| 237 | 238 | ||
| 238 | static void ad7879_setup(struct ad7879 *ts) | 239 | static void ad7879_setup(struct ad7879 *ts) |
| 239 | { | 240 | { |
| 240 | ts->cmd_crtl3 = AD7879_YPLUS_BIT | | ||
| 241 | AD7879_XPLUS_BIT | | ||
| 242 | AD7879_Z2_BIT | | ||
| 243 | AD7879_Z1_BIT | | ||
| 244 | AD7879_TEMPMASK_BIT | | ||
| 245 | AD7879_AUXVBATMASK_BIT | | ||
| 246 | AD7879_GPIOALERTMASK_BIT; | ||
| 247 | |||
| 248 | ts->cmd_crtl2 = AD7879_PM(AD7879_PM_DYN) | AD7879_DFR | | ||
| 249 | AD7879_AVG(ts->averaging) | | ||
| 250 | AD7879_MFS(ts->median) | | ||
| 251 | AD7879_FCD(ts->first_conversion_delay) | | ||
| 252 | ts->gpio_init; | ||
| 253 | |||
| 254 | ts->cmd_crtl1 = AD7879_MODE_INT | AD7879_MODE_SEQ1 | | ||
| 255 | AD7879_ACQ(ts->acquisition_time) | | ||
| 256 | AD7879_TMR(ts->pen_down_acc_interval); | ||
| 257 | |||
| 258 | ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2); | 241 | ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2); |
| 259 | ad7879_write(ts->bus, AD7879_REG_CTRL3, ts->cmd_crtl3); | 242 | ad7879_write(ts->bus, AD7879_REG_CTRL3, ts->cmd_crtl3); |
| 260 | ad7879_write(ts->bus, AD7879_REG_CTRL1, ts->cmd_crtl1); | 243 | ad7879_write(ts->bus, AD7879_REG_CTRL1, ts->cmd_crtl1); |
| @@ -324,48 +307,132 @@ static ssize_t ad7879_disable_store(struct device *dev, | |||
| 324 | 307 | ||
| 325 | static DEVICE_ATTR(disable, 0664, ad7879_disable_show, ad7879_disable_store); | 308 | static DEVICE_ATTR(disable, 0664, ad7879_disable_show, ad7879_disable_store); |
| 326 | 309 | ||
| 327 | static ssize_t ad7879_gpio_show(struct device *dev, | 310 | static struct attribute *ad7879_attributes[] = { |
| 328 | struct device_attribute *attr, char *buf) | 311 | &dev_attr_disable.attr, |
| 312 | NULL | ||
| 313 | }; | ||
| 314 | |||
| 315 | static const struct attribute_group ad7879_attr_group = { | ||
| 316 | .attrs = ad7879_attributes, | ||
| 317 | }; | ||
| 318 | |||
| 319 | #ifdef CONFIG_GPIOLIB | ||
| 320 | static int ad7879_gpio_direction_input(struct gpio_chip *chip, | ||
| 321 | unsigned gpio) | ||
| 329 | { | 322 | { |
| 330 | struct ad7879 *ts = dev_get_drvdata(dev); | 323 | struct ad7879 *ts = container_of(chip, struct ad7879, gc); |
| 324 | int err; | ||
| 331 | 325 | ||
| 332 | return sprintf(buf, "%u\n", ts->gpio); | 326 | mutex_lock(&ts->mutex); |
| 327 | ts->cmd_crtl2 |= AD7879_GPIO_EN | AD7879_GPIODIR | AD7879_GPIOPOL; | ||
| 328 | err = ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2); | ||
| 329 | mutex_unlock(&ts->mutex); | ||
| 330 | |||
| 331 | return err; | ||
| 333 | } | 332 | } |
| 334 | 333 | ||
| 335 | static ssize_t ad7879_gpio_store(struct device *dev, | 334 | static int ad7879_gpio_direction_output(struct gpio_chip *chip, |
| 336 | struct device_attribute *attr, | 335 | unsigned gpio, int level) |
| 337 | const char *buf, size_t count) | ||
| 338 | { | 336 | { |
| 339 | struct ad7879 *ts = dev_get_drvdata(dev); | 337 | struct ad7879 *ts = container_of(chip, struct ad7879, gc); |
| 340 | unsigned long val; | 338 | int err; |
| 341 | int error; | ||
| 342 | 339 | ||
| 343 | error = strict_strtoul(buf, 10, &val); | 340 | mutex_lock(&ts->mutex); |
| 344 | if (error) | 341 | ts->cmd_crtl2 &= ~AD7879_GPIODIR; |
| 345 | return error; | 342 | ts->cmd_crtl2 |= AD7879_GPIO_EN | AD7879_GPIOPOL; |
| 343 | if (level) | ||
| 344 | ts->cmd_crtl2 |= AD7879_GPIO_DATA; | ||
| 345 | else | ||
| 346 | ts->cmd_crtl2 &= ~AD7879_GPIO_DATA; | ||
| 347 | |||
| 348 | err = ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2); | ||
| 349 | mutex_unlock(&ts->mutex); | ||
| 350 | |||
| 351 | return err; | ||
| 352 | } | ||
| 353 | |||
| 354 | static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio) | ||
| 355 | { | ||
| 356 | struct ad7879 *ts = container_of(chip, struct ad7879, gc); | ||
| 357 | u16 val; | ||
| 346 | 358 | ||
| 347 | mutex_lock(&ts->mutex); | 359 | mutex_lock(&ts->mutex); |
| 348 | ts->gpio = !!val; | 360 | val = ad7879_read(ts->bus, AD7879_REG_CTRL2); |
| 349 | error = ad7879_write(ts->bus, AD7879_REG_CTRL2, | ||
| 350 | ts->gpio ? | ||
| 351 | ts->cmd_crtl2 & ~AD7879_GPIO_DATA : | ||
| 352 | ts->cmd_crtl2 | AD7879_GPIO_DATA); | ||
| 353 | mutex_unlock(&ts->mutex); | 361 | mutex_unlock(&ts->mutex); |
| 354 | 362 | ||
| 355 | return error ? : count; | 363 | return !!(val & AD7879_GPIO_DATA); |
| 356 | } | 364 | } |
| 357 | 365 | ||
| 358 | static DEVICE_ATTR(gpio, 0664, ad7879_gpio_show, ad7879_gpio_store); | 366 | static void ad7879_gpio_set_value(struct gpio_chip *chip, |
| 367 | unsigned gpio, int value) | ||
| 368 | { | ||
| 369 | struct ad7879 *ts = container_of(chip, struct ad7879, gc); | ||
| 359 | 370 | ||
| 360 | static struct attribute *ad7879_attributes[] = { | 371 | mutex_lock(&ts->mutex); |
| 361 | &dev_attr_disable.attr, | 372 | if (value) |
| 362 | &dev_attr_gpio.attr, | 373 | ts->cmd_crtl2 |= AD7879_GPIO_DATA; |
| 363 | NULL | 374 | else |
| 364 | }; | 375 | ts->cmd_crtl2 &= ~AD7879_GPIO_DATA; |
| 365 | 376 | ||
| 366 | static const struct attribute_group ad7879_attr_group = { | 377 | ad7879_write(ts->bus, AD7879_REG_CTRL2, ts->cmd_crtl2); |
| 367 | .attrs = ad7879_attributes, | 378 | mutex_unlock(&ts->mutex); |
| 368 | }; | 379 | } |
| 380 | |||
| 381 | static int __devinit ad7879_gpio_add(struct device *dev) | ||
| 382 | { | ||
| 383 | struct ad7879 *ts = dev_get_drvdata(dev); | ||
| 384 | struct ad7879_platform_data *pdata = dev->platform_data; | ||
| 385 | int ret = 0; | ||
| 386 | |||
| 387 | if (pdata->gpio_export) { | ||
| 388 | ts->gc.direction_input = ad7879_gpio_direction_input; | ||
| 389 | ts->gc.direction_output = ad7879_gpio_direction_output; | ||
| 390 | ts->gc.get = ad7879_gpio_get_value; | ||
| 391 | ts->gc.set = ad7879_gpio_set_value; | ||
| 392 | ts->gc.can_sleep = 1; | ||
| 393 | ts->gc.base = pdata->gpio_base; | ||
| 394 | ts->gc.ngpio = 1; | ||
| 395 | ts->gc.label = "AD7879-GPIO"; | ||
| 396 | ts->gc.owner = THIS_MODULE; | ||
| 397 | ts->gc.dev = dev; | ||
| 398 | |||
| 399 | ret = gpiochip_add(&ts->gc); | ||
| 400 | if (ret) | ||
| 401 | dev_err(dev, "failed to register gpio %d\n", | ||
| 402 | ts->gc.base); | ||
| 403 | } | ||
| 404 | |||
| 405 | return ret; | ||
| 406 | } | ||
| 407 | |||
| 408 | /* | ||
| 409 | * We mark ad7879_gpio_remove inline so there is a chance the code | ||
| 410 | * gets discarded when not needed. We can't do __devinit/__devexit | ||
| 411 | * markup since it is used in both probe and remove methods. | ||
| 412 | */ | ||
| 413 | static inline void ad7879_gpio_remove(struct device *dev) | ||
| 414 | { | ||
| 415 | struct ad7879 *ts = dev_get_drvdata(dev); | ||
| 416 | struct ad7879_platform_data *pdata = dev->platform_data; | ||
| 417 | int ret; | ||
| 418 | |||
| 419 | if (pdata->gpio_export) { | ||
| 420 | ret = gpiochip_remove(&ts->gc); | ||
| 421 | if (ret) | ||
| 422 | dev_err(dev, "failed to remove gpio %d\n", | ||
| 423 | ts->gc.base); | ||
| 424 | } | ||
| 425 | } | ||
| 426 | #else | ||
| 427 | static inline int ad7879_gpio_add(struct device *dev) | ||
| 428 | { | ||
| 429 | return 0; | ||
| 430 | } | ||
| 431 | |||
| 432 | static inline void ad7879_gpio_remove(struct device *dev) | ||
| 433 | { | ||
| 434 | } | ||
| 435 | #endif | ||
| 369 | 436 | ||
| 370 | static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts) | 437 | static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts) |
| 371 | { | 438 | { |
| @@ -403,12 +470,6 @@ static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts) | |||
| 403 | ts->pen_down_acc_interval = pdata->pen_down_acc_interval; | 470 | ts->pen_down_acc_interval = pdata->pen_down_acc_interval; |
| 404 | ts->median = pdata->median; | 471 | ts->median = pdata->median; |
| 405 | 472 | ||
| 406 | if (pdata->gpio_output) | ||
| 407 | ts->gpio_init = AD7879_GPIO_EN | | ||
| 408 | (pdata->gpio_default ? 0 : AD7879_GPIO_DATA); | ||
| 409 | else | ||
| 410 | ts->gpio_init = AD7879_GPIO_EN | AD7879_GPIODIR; | ||
| 411 | |||
| 412 | snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&bus->dev)); | 473 | snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&bus->dev)); |
| 413 | 474 | ||
| 414 | input_dev->name = "AD7879 Touchscreen"; | 475 | input_dev->name = "AD7879 Touchscreen"; |
| @@ -446,6 +507,23 @@ static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts) | |||
| 446 | goto err_free_mem; | 507 | goto err_free_mem; |
| 447 | } | 508 | } |
| 448 | 509 | ||
| 510 | ts->cmd_crtl3 = AD7879_YPLUS_BIT | | ||
| 511 | AD7879_XPLUS_BIT | | ||
| 512 | AD7879_Z2_BIT | | ||
| 513 | AD7879_Z1_BIT | | ||
| 514 | AD7879_TEMPMASK_BIT | | ||
| 515 | AD7879_AUXVBATMASK_BIT | | ||
| 516 | AD7879_GPIOALERTMASK_BIT; | ||
| 517 | |||
| 518 | ts->cmd_crtl2 = AD7879_PM(AD7879_PM_DYN) | AD7879_DFR | | ||
| 519 | AD7879_AVG(ts->averaging) | | ||
| 520 | AD7879_MFS(ts->median) | | ||
| 521 | AD7879_FCD(ts->first_conversion_delay); | ||
| 522 | |||
| 523 | ts->cmd_crtl1 = AD7879_MODE_INT | AD7879_MODE_SEQ1 | | ||
| 524 | AD7879_ACQ(ts->acquisition_time) | | ||
| 525 | AD7879_TMR(ts->pen_down_acc_interval); | ||
| 526 | |||
| 449 | ad7879_setup(ts); | 527 | ad7879_setup(ts); |
| 450 | 528 | ||
| 451 | err = request_irq(bus->irq, ad7879_irq, | 529 | err = request_irq(bus->irq, ad7879_irq, |
| @@ -460,15 +538,21 @@ static int __devinit ad7879_construct(bus_device *bus, struct ad7879 *ts) | |||
| 460 | if (err) | 538 | if (err) |
| 461 | goto err_free_irq; | 539 | goto err_free_irq; |
| 462 | 540 | ||
| 463 | err = input_register_device(input_dev); | 541 | err = ad7879_gpio_add(&bus->dev); |
| 464 | if (err) | 542 | if (err) |
| 465 | goto err_remove_attr; | 543 | goto err_remove_attr; |
| 466 | 544 | ||
| 545 | err = input_register_device(input_dev); | ||
| 546 | if (err) | ||
| 547 | goto err_remove_gpio; | ||
| 548 | |||
| 467 | dev_info(&bus->dev, "Rev.%d touchscreen, irq %d\n", | 549 | dev_info(&bus->dev, "Rev.%d touchscreen, irq %d\n", |
| 468 | revid >> 8, bus->irq); | 550 | revid >> 8, bus->irq); |
| 469 | 551 | ||
| 470 | return 0; | 552 | return 0; |
| 471 | 553 | ||
| 554 | err_remove_gpio: | ||
| 555 | ad7879_gpio_remove(&bus->dev); | ||
| 472 | err_remove_attr: | 556 | err_remove_attr: |
| 473 | sysfs_remove_group(&bus->dev.kobj, &ad7879_attr_group); | 557 | sysfs_remove_group(&bus->dev.kobj, &ad7879_attr_group); |
| 474 | err_free_irq: | 558 | err_free_irq: |
| @@ -481,6 +565,7 @@ err_free_mem: | |||
| 481 | 565 | ||
| 482 | static int __devexit ad7879_destroy(bus_device *bus, struct ad7879 *ts) | 566 | static int __devexit ad7879_destroy(bus_device *bus, struct ad7879 *ts) |
| 483 | { | 567 | { |
| 568 | ad7879_gpio_remove(&bus->dev); | ||
| 484 | ad7879_disable(ts); | 569 | ad7879_disable(ts); |
| 485 | sysfs_remove_group(&ts->bus->dev.kobj, &ad7879_attr_group); | 570 | sysfs_remove_group(&ts->bus->dev.kobj, &ad7879_attr_group); |
| 486 | free_irq(ts->bus->irq, ts); | 571 | free_irq(ts->bus->irq, ts); |
diff --git a/include/linux/input.h b/include/linux/input.h index 7be8a6537b57..735ceaf1bc2d 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -660,6 +660,7 @@ struct input_absinfo { | |||
| 660 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ | 660 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ |
| 661 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ | 661 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ |
| 662 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ | 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 | #define ABS_MAX 0x3f | 665 | #define ABS_MAX 0x3f |
| 665 | #define ABS_CNT (ABS_MAX+1) | 666 | #define ABS_CNT (ABS_MAX+1) |
diff --git a/include/linux/spi/ad7879.h b/include/linux/spi/ad7879.h index 4231104c9afa..6334cee1a3be 100644 --- a/include/linux/spi/ad7879.h +++ b/include/linux/spi/ad7879.h | |||
| @@ -28,8 +28,12 @@ struct ad7879_platform_data { | |||
| 28 | * 1 = 4, 2 = 8, 3 = 16 (median > averaging) | 28 | * 1 = 4, 2 = 8, 3 = 16 (median > averaging) |
| 29 | */ | 29 | */ |
| 30 | u8 median; | 30 | u8 median; |
| 31 | /* 1 = AUX/VBAT/GPIO set to GPIO Output */ | 31 | /* 1 = AUX/VBAT/GPIO export GPIO to gpiolib |
| 32 | u8 gpio_output; | 32 | * requires CONFIG_GPIOLIB |
| 33 | /* Initial GPIO pin state (valid if gpio_output = 1) */ | 33 | */ |
| 34 | u8 gpio_default; | 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 | }; |
