mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	<linux-input@vger.kernel.org>
Cc: Jianchun Bian <jcbian@pixcir.com.cn>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] Input: pixcir_i2c_ts - switch the device over to gpiod
Date: Tue, 7 Jul 2015 13:55:15 +0300	[thread overview]
Message-ID: <559BB013.1060004@ti.com> (raw)
In-Reply-To: <1436229011-29655-2-git-send-email-dmitry.torokhov@gmail.com>

On 07/07/15 03:30, Dmitry Torokhov wrote:
> This allows uniform parsing on legacy, DT and ACPI systems.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> ---
>   drivers/input/touchscreen/pixcir_i2c_ts.c   | 26 +++++++++-----------------
>   include/linux/platform_data/pixcir_i2c_ts.h |  1 -
>   2 files changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index ccafa75..9093aa9 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -25,8 +25,8 @@
>   #include <linux/input.h>
>   #include <linux/input/mt.h>
>   #include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
>   #include <linux/of.h>
> -#include <linux/of_gpio.h>
>   #include <linux/of_device.h>
>   #include <linux/platform_data/pixcir_i2c_ts.h>
>
> @@ -35,6 +35,7 @@
>   struct pixcir_i2c_ts_data {
>   	struct i2c_client *client;
>   	struct input_dev *input;
> +	struct gpio_desc *gpio_attb;
>   	const struct pixcir_ts_platform_data *pdata;
>   	bool running;
>   	int max_fingers;	/* Max fingers supported in this instance */
> @@ -161,7 +162,6 @@ static void pixcir_ts_report(struct pixcir_i2c_ts_data *ts,
>   static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
>   {
>   	struct pixcir_i2c_ts_data *tsdata = dev_id;
> -	const struct pixcir_ts_platform_data *pdata = tsdata->pdata;
>   	struct pixcir_report_data report;
>
>   	while (tsdata->running) {
> @@ -171,7 +171,7 @@ static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
>   		/* report it */
>   		pixcir_ts_report(tsdata, &report);
>
> -		if (gpio_get_value(pdata->gpio_attb)) {
> +		if (gpiod_get_value(tsdata->gpio_attb)) {
>   			if (report.num_touches) {
>   				/*
>   				 * Last report with no finger up?
> @@ -427,9 +427,6 @@ static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
>
>   	pdata->chip = *(const struct pixcir_i2c_chip_data *)match->data;
>
> -	pdata->gpio_attb = of_get_named_gpio(np, "attb-gpio", 0);
> -	/* gpio_attb validity is checked in probe */
> -
>   	if (of_property_read_u32(np, "touchscreen-size-x", &pdata->x_max)) {
>   		dev_err(dev, "Failed to get touchscreen-size-x property\n");
>   		return ERR_PTR(-EINVAL);
> @@ -442,8 +439,8 @@ static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
>   	}
>   	pdata->y_max -= 1;
>
> -	dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__,
> -		pdata->x_max + 1, pdata->y_max + 1, pdata->gpio_attb);
> +	dev_dbg(dev, "%s: x %d, y %d\n", __func__,
> +		pdata->x_max + 1, pdata->y_max + 1);
>
>   	return pdata;
>   }
> @@ -476,11 +473,6 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>   		return -EINVAL;
>   	}
>
> -	if (!gpio_is_valid(pdata->gpio_attb)) {
> -		dev_err(dev, "Invalid gpio_attb in pdata\n");
> -		return -EINVAL;
> -	}
> -
>   	if (!pdata->chip.max_fingers) {
>   		dev_err(dev, "Invalid max_fingers in pdata\n");
>   		return -EINVAL;
> @@ -530,10 +522,10 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>
>   	input_set_drvdata(input, tsdata);
>
> -	error = devm_gpio_request_one(dev, pdata->gpio_attb,
> -				      GPIOF_DIR_IN, "pixcir_i2c_attb");
> -	if (error) {
> -		dev_err(dev, "Failed to request ATTB gpio\n");
> +	tsdata->gpio_attb = devm_gpiod_get(dev, "attb", GPIOD_IN);
> +	if (IS_ERR(tsdata->gpio_attb)) {
> +		error = PTR_ERR(tsdata->gpio_attb);
> +		dev_err(dev, "Failed to request ATTB gpio: %d\n", error);
>   		return error;
>   	}
>
> diff --git a/include/linux/platform_data/pixcir_i2c_ts.h b/include/linux/platform_data/pixcir_i2c_ts.h
> index 7bae83b..646af6f 100644
> --- a/include/linux/platform_data/pixcir_i2c_ts.h
> +++ b/include/linux/platform_data/pixcir_i2c_ts.h
> @@ -57,7 +57,6 @@ struct pixcir_i2c_chip_data {
>   struct pixcir_ts_platform_data {
>   	int x_max;
>   	int y_max;
> -	int gpio_attb;		/* GPIO connected to ATTB line */
>   	struct pixcir_i2c_chip_data chip;
>   };
>
>

  reply	other threads:[~2015-07-07 10:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07  0:30 [PATCH 1/6] Input: pixcir_i2c_ts - move platform data Dmitry Torokhov
2015-07-07  0:30 ` [PATCH 2/6] Input: pixcir_i2c_ts - switch the device over to gpiod Dmitry Torokhov
2015-07-07 10:55   ` Roger Quadros [this message]
2015-07-07  0:30 ` [PATCH 3/6] Input: pixcir_i2c_ts - allow using with GPIO expanders Dmitry Torokhov
2015-07-07 10:55   ` Roger Quadros
2015-07-07  0:30 ` [PATCH 4/6] Input: pixcir_i2c_ts - add RESET gpio Dmitry Torokhov
2015-07-07  0:30 ` [PATCH 5/6] Input: pixcir_i2c_ts - simplify input device initialization Dmitry Torokhov
2015-07-07 11:39   ` Roger Quadros
2015-07-07  0:30 ` [PATCH 6/6] Input: pixcir_i2c_ts - use standard OF touchscreen parsing code Dmitry Torokhov
2015-07-07 11:47   ` Roger Quadros
2015-07-07 10:46 ` [PATCH 1/6] Input: pixcir_i2c_ts - move platform data Roger Quadros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=559BB013.1060004@ti.com \
    --to=rogerq@ti.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jcbian@pixcir.com.cn \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome