Commit e3dd12f0 authored by Martin Kepplinger's avatar Martin Kepplinger Committed by Dmitry Torokhov

Input: st1232 - switch to gpiod API

Use devm_gpiod_get_optional() and gpiod_set_value_cansleep() instead
of the old API. The st1232_ts_power() now passes on the inverted "poweron"
value to reflect the correct logical value.
Signed-off-by: default avatarMartin Kepplinger <martin.kepplinger@ginzinger.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent f67cc3e9
...@@ -11,13 +11,12 @@ ...@@ -11,13 +11,12 @@
*/ */
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio.h> #include <linux/gpio/consumer.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/pm_qos.h> #include <linux/pm_qos.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -45,7 +44,7 @@ struct st1232_ts_data { ...@@ -45,7 +44,7 @@ struct st1232_ts_data {
struct i2c_client *client; struct i2c_client *client;
struct input_dev *input_dev; struct input_dev *input_dev;
struct dev_pm_qos_request low_latency_req; struct dev_pm_qos_request low_latency_req;
int reset_gpio; struct gpio_desc *reset_gpio;
const struct st_chip_info *chip_info; const struct st_chip_info *chip_info;
int read_buf_len; int read_buf_len;
u8 *read_buf; u8 *read_buf;
...@@ -142,8 +141,8 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id) ...@@ -142,8 +141,8 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id)
static void st1232_ts_power(struct st1232_ts_data *ts, bool poweron) static void st1232_ts_power(struct st1232_ts_data *ts, bool poweron)
{ {
if (gpio_is_valid(ts->reset_gpio)) if (ts->reset_gpio)
gpio_direction_output(ts->reset_gpio, poweron); gpiod_set_value_cansleep(ts->reset_gpio, !poweron);
} }
static const struct st_chip_info st1232_chip_info = { static const struct st_chip_info st1232_chip_info = {
...@@ -215,16 +214,14 @@ static int st1232_ts_probe(struct i2c_client *client, ...@@ -215,16 +214,14 @@ static int st1232_ts_probe(struct i2c_client *client,
ts->client = client; ts->client = client;
ts->input_dev = input_dev; ts->input_dev = input_dev;
ts->reset_gpio = of_get_gpio(client->dev.of_node, 0); ts->reset_gpio = devm_gpiod_get_optional(&client->dev, NULL,
if (gpio_is_valid(ts->reset_gpio)) { GPIOD_OUT_HIGH);
error = devm_gpio_request(&client->dev, ts->reset_gpio, NULL); if (IS_ERR(ts->reset_gpio)) {
if (error) { error = PTR_ERR(ts->reset_gpio);
dev_err(&client->dev, dev_err(&client->dev, "Unable to request GPIO pin: %d.\n",
"Unable to request GPIO pin %d.\n", error);
ts->reset_gpio);
return error; return error;
} }
}
st1232_ts_power(ts, true); st1232_ts_power(ts, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment