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

Input: pixcir_i2c_ts - switch the device over to gpiod

This allows uniform parsing on legacy, DT and ACPI systems.

Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+9 -18
+9 -17
drivers/input/touchscreen/pixcir_i2c_ts.c
··· 25 25 #include <linux/input.h> 26 26 #include <linux/input/mt.h> 27 27 #include <linux/gpio.h> 28 + #include <linux/gpio/consumer.h> 28 29 #include <linux/of.h> 29 - #include <linux/of_gpio.h> 30 30 #include <linux/of_device.h> 31 31 #include <linux/platform_data/pixcir_i2c_ts.h> 32 32 ··· 35 35 struct pixcir_i2c_ts_data { 36 36 struct i2c_client *client; 37 37 struct input_dev *input; 38 + struct gpio_desc *gpio_attb; 38 39 const struct pixcir_ts_platform_data *pdata; 39 40 bool running; 40 41 int max_fingers; /* Max fingers supported in this instance */ ··· 162 161 static irqreturn_t pixcir_ts_isr(int irq, void *dev_id) 163 162 { 164 163 struct pixcir_i2c_ts_data *tsdata = dev_id; 165 - const struct pixcir_ts_platform_data *pdata = tsdata->pdata; 166 164 struct pixcir_report_data report; 167 165 168 166 while (tsdata->running) { ··· 171 171 /* report it */ 172 172 pixcir_ts_report(tsdata, &report); 173 173 174 - if (gpio_get_value(pdata->gpio_attb)) { 174 + if (gpiod_get_value(tsdata->gpio_attb)) { 175 175 if (report.num_touches) { 176 176 /* 177 177 * Last report with no finger up? ··· 427 427 428 428 pdata->chip = *(const struct pixcir_i2c_chip_data *)match->data; 429 429 430 - pdata->gpio_attb = of_get_named_gpio(np, "attb-gpio", 0); 431 - /* gpio_attb validity is checked in probe */ 432 - 433 430 if (of_property_read_u32(np, "touchscreen-size-x", &pdata->x_max)) { 434 431 dev_err(dev, "Failed to get touchscreen-size-x property\n"); 435 432 return ERR_PTR(-EINVAL); ··· 439 442 } 440 443 pdata->y_max -= 1; 441 444 442 - dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__, 443 - pdata->x_max + 1, pdata->y_max + 1, pdata->gpio_attb); 445 + dev_dbg(dev, "%s: x %d, y %d\n", __func__, 446 + pdata->x_max + 1, pdata->y_max + 1); 444 447 445 448 return pdata; 446 449 } ··· 470 473 471 474 if (!pdata) { 472 475 dev_err(&client->dev, "platform data not defined\n"); 473 - return -EINVAL; 474 - } 475 - 476 - if (!gpio_is_valid(pdata->gpio_attb)) { 477 - dev_err(dev, "Invalid gpio_attb in pdata\n"); 478 476 return -EINVAL; 479 477 } 480 478 ··· 522 530 523 531 input_set_drvdata(input, tsdata); 524 532 525 - error = devm_gpio_request_one(dev, pdata->gpio_attb, 526 - GPIOF_DIR_IN, "pixcir_i2c_attb"); 527 - if (error) { 528 - dev_err(dev, "Failed to request ATTB gpio\n"); 533 + tsdata->gpio_attb = devm_gpiod_get(dev, "attb", GPIOD_IN); 534 + if (IS_ERR(tsdata->gpio_attb)) { 535 + error = PTR_ERR(tsdata->gpio_attb); 536 + dev_err(dev, "Failed to request ATTB gpio: %d\n", error); 529 537 return error; 530 538 } 531 539
-1
include/linux/platform_data/pixcir_i2c_ts.h
··· 57 57 struct pixcir_ts_platform_data { 58 58 int x_max; 59 59 int y_max; 60 - int gpio_attb; /* GPIO connected to ATTB line */ 61 60 struct pixcir_i2c_chip_data chip; 62 61 }; 63 62