diff options
| author | Tejun Heo <tj@kernel.org> | 2011-02-21 03:43:56 -0500 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2011-02-21 03:43:56 -0500 |
| commit | 43d133c18b44e7d82d82ef0dcc2bddd55d5dfe81 (patch) | |
| tree | 8de75c837b55874cc8a81a29bdedbc62668d4481 /drivers/input/touchscreen | |
| parent | 4149efb22da66e326fc48baf80d628834509f7f0 (diff) | |
| parent | 6f576d57f1fa0d6026b495d8746d56d949989161 (diff) | |
Merge branch 'master' into for-2.6.39
Diffstat (limited to 'drivers/input/touchscreen')
| -rw-r--r-- | drivers/input/touchscreen/ads7846.c | 38 | ||||
| -rw-r--r-- | drivers/input/touchscreen/bu21013_ts.c | 39 | ||||
| -rw-r--r-- | drivers/input/touchscreen/tnetv107x-ts.c | 5 | ||||
| -rw-r--r-- | drivers/input/touchscreen/wacom_w8001.c | 13 |
4 files changed, 72 insertions, 23 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 14ea54b78e4..4bf2316e328 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
| @@ -941,28 +941,29 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 | |||
| 941 | struct ads7846_platform_data *pdata = spi->dev.platform_data; | 941 | struct ads7846_platform_data *pdata = spi->dev.platform_data; |
| 942 | int err; | 942 | int err; |
| 943 | 943 | ||
| 944 | /* REVISIT when the irq can be triggered active-low, or if for some | 944 | /* |
| 945 | * REVISIT when the irq can be triggered active-low, or if for some | ||
| 945 | * reason the touchscreen isn't hooked up, we don't need to access | 946 | * reason the touchscreen isn't hooked up, we don't need to access |
| 946 | * the pendown state. | 947 | * the pendown state. |
| 947 | */ | 948 | */ |
| 948 | if (!pdata->get_pendown_state && !gpio_is_valid(pdata->gpio_pendown)) { | ||
| 949 | dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); | ||
| 950 | return -EINVAL; | ||
| 951 | } | ||
| 952 | 949 | ||
| 953 | if (pdata->get_pendown_state) { | 950 | if (pdata->get_pendown_state) { |
| 954 | ts->get_pendown_state = pdata->get_pendown_state; | 951 | ts->get_pendown_state = pdata->get_pendown_state; |
| 955 | return 0; | 952 | } else if (gpio_is_valid(pdata->gpio_pendown)) { |
| 956 | } | ||
| 957 | 953 | ||
| 958 | err = gpio_request(pdata->gpio_pendown, "ads7846_pendown"); | 954 | err = gpio_request(pdata->gpio_pendown, "ads7846_pendown"); |
| 959 | if (err) { | 955 | if (err) { |
| 960 | dev_err(&spi->dev, "failed to request pendown GPIO%d\n", | 956 | dev_err(&spi->dev, "failed to request pendown GPIO%d\n", |
| 961 | pdata->gpio_pendown); | 957 | pdata->gpio_pendown); |
| 962 | return err; | 958 | return err; |
| 963 | } | 959 | } |
| 964 | 960 | ||
| 965 | ts->gpio_pendown = pdata->gpio_pendown; | 961 | ts->gpio_pendown = pdata->gpio_pendown; |
| 962 | |||
| 963 | } else { | ||
| 964 | dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); | ||
| 965 | return -EINVAL; | ||
| 966 | } | ||
| 966 | 967 | ||
| 967 | return 0; | 968 | return 0; |
| 968 | } | 969 | } |
| @@ -1353,7 +1354,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
| 1353 | err_put_regulator: | 1354 | err_put_regulator: |
| 1354 | regulator_put(ts->reg); | 1355 | regulator_put(ts->reg); |
| 1355 | err_free_gpio: | 1356 | err_free_gpio: |
| 1356 | if (ts->gpio_pendown != -1) | 1357 | if (!ts->get_pendown_state) |
| 1357 | gpio_free(ts->gpio_pendown); | 1358 | gpio_free(ts->gpio_pendown); |
| 1358 | err_cleanup_filter: | 1359 | err_cleanup_filter: |
| 1359 | if (ts->filter_cleanup) | 1360 | if (ts->filter_cleanup) |
| @@ -1383,8 +1384,13 @@ static int __devexit ads7846_remove(struct spi_device *spi) | |||
| 1383 | regulator_disable(ts->reg); | 1384 | regulator_disable(ts->reg); |
| 1384 | regulator_put(ts->reg); | 1385 | regulator_put(ts->reg); |
| 1385 | 1386 | ||
| 1386 | if (ts->gpio_pendown != -1) | 1387 | if (!ts->get_pendown_state) { |
| 1388 | /* | ||
| 1389 | * If we are not using specialized pendown method we must | ||
| 1390 | * have been relying on gpio we set up ourselves. | ||
| 1391 | */ | ||
| 1387 | gpio_free(ts->gpio_pendown); | 1392 | gpio_free(ts->gpio_pendown); |
| 1393 | } | ||
| 1388 | 1394 | ||
| 1389 | if (ts->filter_cleanup) | 1395 | if (ts->filter_cleanup) |
| 1390 | ts->filter_cleanup(ts->filter_data); | 1396 | ts->filter_cleanup(ts->filter_data); |
diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index f7fa9ef4cd6..1507ce108d5 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/input.h> | 12 | #include <linux/input.h> |
| 13 | #include <linux/input/bu21013.h> | 13 | #include <linux/input/bu21013.h> |
| 14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
| 15 | #include <linux/regulator/consumer.h> | ||
| 15 | 16 | ||
| 16 | #define PEN_DOWN_INTR 0 | 17 | #define PEN_DOWN_INTR 0 |
| 17 | #define MAX_FINGERS 2 | 18 | #define MAX_FINGERS 2 |
| @@ -139,6 +140,7 @@ | |||
| 139 | * @chip: pointer to the touch panel controller | 140 | * @chip: pointer to the touch panel controller |
| 140 | * @in_dev: pointer to the input device structure | 141 | * @in_dev: pointer to the input device structure |
| 141 | * @intr_pin: interrupt pin value | 142 | * @intr_pin: interrupt pin value |
| 143 | * @regulator: pointer to the Regulator used for touch screen | ||
| 142 | * | 144 | * |
| 143 | * Touch panel device data structure | 145 | * Touch panel device data structure |
| 144 | */ | 146 | */ |
| @@ -149,6 +151,7 @@ struct bu21013_ts_data { | |||
| 149 | const struct bu21013_platform_device *chip; | 151 | const struct bu21013_platform_device *chip; |
| 150 | struct input_dev *in_dev; | 152 | struct input_dev *in_dev; |
| 151 | unsigned int intr_pin; | 153 | unsigned int intr_pin; |
| 154 | struct regulator *regulator; | ||
| 152 | }; | 155 | }; |
| 153 | 156 | ||
| 154 | /** | 157 | /** |
| @@ -456,6 +459,20 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
| 456 | bu21013_data->in_dev = in_dev; | 459 | bu21013_data->in_dev = in_dev; |
| 457 | bu21013_data->chip = pdata; | 460 | bu21013_data->chip = pdata; |
| 458 | bu21013_data->client = client; | 461 | bu21013_data->client = client; |
| 462 | |||
| 463 | bu21013_data->regulator = regulator_get(&client->dev, "V-TOUCH"); | ||
| 464 | if (IS_ERR(bu21013_data->regulator)) { | ||
| 465 | dev_err(&client->dev, "regulator_get failed\n"); | ||
| 466 | error = PTR_ERR(bu21013_data->regulator); | ||
| 467 | goto err_free_mem; | ||
| 468 | } | ||
| 469 | |||
| 470 | error = regulator_enable(bu21013_data->regulator); | ||
| 471 | if (error < 0) { | ||
| 472 | dev_err(&client->dev, "regulator enable failed\n"); | ||
| 473 | goto err_put_regulator; | ||
| 474 | } | ||
| 475 | |||
| 459 | bu21013_data->touch_stopped = false; | 476 | bu21013_data->touch_stopped = false; |
| 460 | init_waitqueue_head(&bu21013_data->wait); | 477 | init_waitqueue_head(&bu21013_data->wait); |
| 461 | 478 | ||
| @@ -464,7 +481,7 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
| 464 | error = pdata->cs_en(pdata->cs_pin); | 481 | error = pdata->cs_en(pdata->cs_pin); |
| 465 | if (error < 0) { | 482 | if (error < 0) { |
| 466 | dev_err(&client->dev, "chip init failed\n"); | 483 | dev_err(&client->dev, "chip init failed\n"); |
| 467 | goto err_free_mem; | 484 | goto err_disable_regulator; |
| 468 | } | 485 | } |
| 469 | } | 486 | } |
| 470 | 487 | ||
| @@ -485,9 +502,9 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
| 485 | __set_bit(EV_ABS, in_dev->evbit); | 502 | __set_bit(EV_ABS, in_dev->evbit); |
| 486 | 503 | ||
| 487 | input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, | 504 | input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, |
| 488 | pdata->x_max_res, 0, 0); | 505 | pdata->touch_x_max, 0, 0); |
| 489 | input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, | 506 | input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, |
| 490 | pdata->y_max_res, 0, 0); | 507 | pdata->touch_y_max, 0, 0); |
| 491 | input_set_drvdata(in_dev, bu21013_data); | 508 | input_set_drvdata(in_dev, bu21013_data); |
| 492 | 509 | ||
| 493 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, | 510 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, |
| @@ -513,6 +530,10 @@ err_free_irq: | |||
| 513 | bu21013_free_irq(bu21013_data); | 530 | bu21013_free_irq(bu21013_data); |
| 514 | err_cs_disable: | 531 | err_cs_disable: |
| 515 | pdata->cs_dis(pdata->cs_pin); | 532 | pdata->cs_dis(pdata->cs_pin); |
| 533 | err_disable_regulator: | ||
| 534 | regulator_disable(bu21013_data->regulator); | ||
| 535 | err_put_regulator: | ||
| 536 | regulator_put(bu21013_data->regulator); | ||
| 516 | err_free_mem: | 537 | err_free_mem: |
| 517 | input_free_device(in_dev); | 538 | input_free_device(in_dev); |
| 518 | kfree(bu21013_data); | 539 | kfree(bu21013_data); |
| @@ -535,6 +556,10 @@ static int __devexit bu21013_remove(struct i2c_client *client) | |||
| 535 | bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin); | 556 | bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin); |
| 536 | 557 | ||
| 537 | input_unregister_device(bu21013_data->in_dev); | 558 | input_unregister_device(bu21013_data->in_dev); |
| 559 | |||
| 560 | regulator_disable(bu21013_data->regulator); | ||
| 561 | regulator_put(bu21013_data->regulator); | ||
| 562 | |||
| 538 | kfree(bu21013_data); | 563 | kfree(bu21013_data); |
| 539 | 564 | ||
| 540 | device_init_wakeup(&client->dev, false); | 565 | device_init_wakeup(&client->dev, false); |
| @@ -561,6 +586,8 @@ static int bu21013_suspend(struct device *dev) | |||
| 561 | else | 586 | else |
| 562 | disable_irq(bu21013_data->chip->irq); | 587 | disable_irq(bu21013_data->chip->irq); |
| 563 | 588 | ||
| 589 | regulator_disable(bu21013_data->regulator); | ||
| 590 | |||
| 564 | return 0; | 591 | return 0; |
| 565 | } | 592 | } |
| 566 | 593 | ||
| @@ -577,6 +604,12 @@ static int bu21013_resume(struct device *dev) | |||
| 577 | struct i2c_client *client = bu21013_data->client; | 604 | struct i2c_client *client = bu21013_data->client; |
| 578 | int retval; | 605 | int retval; |
| 579 | 606 | ||
| 607 | retval = regulator_enable(bu21013_data->regulator); | ||
| 608 | if (retval < 0) { | ||
| 609 | dev_err(&client->dev, "bu21013 regulator enable failed\n"); | ||
| 610 | return retval; | ||
| 611 | } | ||
| 612 | |||
| 580 | retval = bu21013_init_chip(bu21013_data); | 613 | retval = bu21013_init_chip(bu21013_data); |
| 581 | if (retval < 0) { | 614 | if (retval < 0) { |
| 582 | dev_err(&client->dev, "bu21013 controller config failed\n"); | 615 | dev_err(&client->dev, "bu21013 controller config failed\n"); |
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c index cf1dba2e267..22a3411e93c 100644 --- a/drivers/input/touchscreen/tnetv107x-ts.c +++ b/drivers/input/touchscreen/tnetv107x-ts.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/err.h> | ||
| 17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
| 18 | #include <linux/input.h> | 19 | #include <linux/input.h> |
| 19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
| @@ -289,9 +290,9 @@ static int __devinit tsc_probe(struct platform_device *pdev) | |||
| 289 | } | 290 | } |
| 290 | 291 | ||
| 291 | ts->clk = clk_get(dev, NULL); | 292 | ts->clk = clk_get(dev, NULL); |
| 292 | if (!ts->clk) { | 293 | if (IS_ERR(ts->clk)) { |
| 293 | dev_err(dev, "cannot claim device clock\n"); | 294 | dev_err(dev, "cannot claim device clock\n"); |
| 294 | error = -EINVAL; | 295 | error = PTR_ERR(ts->clk); |
| 295 | goto error_clk; | 296 | goto error_clk; |
| 296 | } | 297 | } |
| 297 | 298 | ||
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index 5cb8449c909..c14412ef464 100644 --- a/drivers/input/touchscreen/wacom_w8001.c +++ b/drivers/input/touchscreen/wacom_w8001.c | |||
| @@ -51,6 +51,10 @@ MODULE_LICENSE("GPL"); | |||
| 51 | #define W8001_PKTLEN_TPCCTL 11 /* control packet */ | 51 | #define W8001_PKTLEN_TPCCTL 11 /* control packet */ |
| 52 | #define W8001_PKTLEN_TOUCH2FG 13 | 52 | #define W8001_PKTLEN_TOUCH2FG 13 |
| 53 | 53 | ||
| 54 | /* resolution in points/mm */ | ||
| 55 | #define W8001_PEN_RESOLUTION 100 | ||
| 56 | #define W8001_TOUCH_RESOLUTION 10 | ||
| 57 | |||
| 54 | struct w8001_coord { | 58 | struct w8001_coord { |
| 55 | u8 rdy; | 59 | u8 rdy; |
| 56 | u8 tsw; | 60 | u8 tsw; |
| @@ -198,7 +202,7 @@ static void parse_touchquery(u8 *data, struct w8001_touch_query *query) | |||
| 198 | query->y = 1024; | 202 | query->y = 1024; |
| 199 | if (query->panel_res) | 203 | if (query->panel_res) |
| 200 | query->x = query->y = (1 << query->panel_res); | 204 | query->x = query->y = (1 << query->panel_res); |
| 201 | query->panel_res = 10; | 205 | query->panel_res = W8001_TOUCH_RESOLUTION; |
| 202 | } | 206 | } |
| 203 | } | 207 | } |
| 204 | 208 | ||
| @@ -394,6 +398,8 @@ static int w8001_setup(struct w8001 *w8001) | |||
| 394 | 398 | ||
| 395 | input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); | 399 | input_set_abs_params(dev, ABS_X, 0, coord.x, 0, 0); |
| 396 | input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); | 400 | input_set_abs_params(dev, ABS_Y, 0, coord.y, 0, 0); |
| 401 | input_abs_set_res(dev, ABS_X, W8001_PEN_RESOLUTION); | ||
| 402 | input_abs_set_res(dev, ABS_Y, W8001_PEN_RESOLUTION); | ||
| 397 | input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); | 403 | input_set_abs_params(dev, ABS_PRESSURE, 0, coord.pen_pressure, 0, 0); |
| 398 | if (coord.tilt_x && coord.tilt_y) { | 404 | if (coord.tilt_x && coord.tilt_y) { |
| 399 | input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); | 405 | input_set_abs_params(dev, ABS_TILT_X, 0, coord.tilt_x, 0, 0); |
| @@ -418,14 +424,17 @@ static int w8001_setup(struct w8001 *w8001) | |||
| 418 | w8001->max_touch_x = touch.x; | 424 | w8001->max_touch_x = touch.x; |
| 419 | w8001->max_touch_y = touch.y; | 425 | w8001->max_touch_y = touch.y; |
| 420 | 426 | ||
| 421 | /* scale to pen maximum */ | ||
| 422 | if (w8001->max_pen_x && w8001->max_pen_y) { | 427 | if (w8001->max_pen_x && w8001->max_pen_y) { |
| 428 | /* if pen is supported scale to pen maximum */ | ||
| 423 | touch.x = w8001->max_pen_x; | 429 | touch.x = w8001->max_pen_x; |
| 424 | touch.y = w8001->max_pen_y; | 430 | touch.y = w8001->max_pen_y; |
| 431 | touch.panel_res = W8001_PEN_RESOLUTION; | ||
| 425 | } | 432 | } |
| 426 | 433 | ||
| 427 | input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); | 434 | input_set_abs_params(dev, ABS_X, 0, touch.x, 0, 0); |
| 428 | input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); | 435 | input_set_abs_params(dev, ABS_Y, 0, touch.y, 0, 0); |
| 436 | input_abs_set_res(dev, ABS_X, touch.panel_res); | ||
| 437 | input_abs_set_res(dev, ABS_Y, touch.panel_res); | ||
| 429 | 438 | ||
| 430 | switch (touch.sensor_id) { | 439 | switch (touch.sensor_id) { |
| 431 | case 0: | 440 | case 0: |
