···2525#include <linux/input.h>2626#include <linux/input/mt.h>2727#include <linux/gpio.h>2828+#include <linux/gpio/consumer.h>2829#include <linux/of.h>2929-#include <linux/of_gpio.h>3030#include <linux/of_device.h>3131#include <linux/platform_data/pixcir_i2c_ts.h>3232···3535struct pixcir_i2c_ts_data {3636 struct i2c_client *client;3737 struct input_dev *input;3838+ struct gpio_desc *gpio_attb;3839 const struct pixcir_ts_platform_data *pdata;3940 bool running;4041 int max_fingers; /* Max fingers supported in this instance */···162161static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)163162{164163 struct pixcir_i2c_ts_data *tsdata = dev_id;165165- const struct pixcir_ts_platform_data *pdata = tsdata->pdata;166164 struct pixcir_report_data report;167165168166 while (tsdata->running) {···171171 /* report it */172172 pixcir_ts_report(tsdata, &report);173173174174- if (gpio_get_value(pdata->gpio_attb)) {174174+ if (gpiod_get_value(tsdata->gpio_attb)) {175175 if (report.num_touches) {176176 /*177177 * Last report with no finger up?···427427428428 pdata->chip = *(const struct pixcir_i2c_chip_data *)match->data;429429430430- pdata->gpio_attb = of_get_named_gpio(np, "attb-gpio", 0);431431- /* gpio_attb validity is checked in probe */432432-433430 if (of_property_read_u32(np, "touchscreen-size-x", &pdata->x_max)) {434431 dev_err(dev, "Failed to get touchscreen-size-x property\n");435432 return ERR_PTR(-EINVAL);···439442 }440443 pdata->y_max -= 1;441444442442- dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__,443443- pdata->x_max + 1, pdata->y_max + 1, pdata->gpio_attb);445445+ dev_dbg(dev, "%s: x %d, y %d\n", __func__,446446+ pdata->x_max + 1, pdata->y_max + 1);444447445448 return pdata;446449}···470473471474 if (!pdata) {472475 dev_err(&client->dev, "platform data not defined\n");473473- return -EINVAL;474474- }475475-476476- if (!gpio_is_valid(pdata->gpio_attb)) {477477- dev_err(dev, "Invalid gpio_attb in pdata\n");478476 return -EINVAL;479477 }480478···522530523531 input_set_drvdata(input, tsdata);524532525525- error = devm_gpio_request_one(dev, pdata->gpio_attb,526526- GPIOF_DIR_IN, "pixcir_i2c_attb");527527- if (error) {528528- dev_err(dev, "Failed to request ATTB gpio\n");533533+ tsdata->gpio_attb = devm_gpiod_get(dev, "attb", GPIOD_IN);534534+ if (IS_ERR(tsdata->gpio_attb)) {535535+ error = PTR_ERR(tsdata->gpio_attb);536536+ dev_err(dev, "Failed to request ATTB gpio: %d\n", error);529537 return error;530538 }531539
-1
include/linux/platform_data/pixcir_i2c_ts.h
···5757struct pixcir_ts_platform_data {5858 int x_max;5959 int y_max;6060- int gpio_attb; /* GPIO connected to ATTB line */6160 struct pixcir_i2c_chip_data chip;6261};6362