linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Heiko Stuebner <heiko@sntech.de>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] Input: auo-pixcir-ts - switch to using gpiod API
Date: Wed, 14 Sep 2022 08:15:21 -0700	[thread overview]
Message-ID: <YyHwCSTNK2jCvJyg@google.com> (raw)
In-Reply-To: <2115487.irdbgypaU6@phil>

On Wed, Sep 14, 2022 at 05:04:14PM +0200, Heiko Stuebner wrote:
> Am Mittwoch, 14. September 2022, 16:14:25 CEST schrieb Dmitry Torokhov:
> > This switches the driver to gpiod API and drops uses of of_get_gpio() API.
> > 
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> >  drivers/input/touchscreen/auo-pixcir-ts.c | 47 ++++++++++-------------
> >  1 file changed, 20 insertions(+), 27 deletions(-)
> 
> [...]
> 
> > @@ -578,23 +566,28 @@ static int auo_pixcir_probe(struct i2c_client *client,
> >  
> >  	input_set_drvdata(ts->input, ts);
> >  
> > -	error = devm_gpio_request_one(&client->dev, ts->gpio_int,
> > -				      GPIOF_DIR_IN, "auo_pixcir_ts_int");
> > +	ts->gpio_int = devm_gpiod_get_index(&client->dev, NULL, 0, GPIOD_IN);
> > +	error = PTR_ERR_OR_ZERO(ts->gpio_int);
> >  	if (error) {
> > -		dev_err(&client->dev, "request of gpio %d failed, %d\n",
> > -			ts->gpio_int, error);
> > +		dev_err(&client->dev,
> > +			"request of int gpio failed: %d\n", error);
> >  		return error;
> >  	}
> >  
> > -	error = devm_gpio_request_one(&client->dev, ts->gpio_rst,
> > -				      GPIOF_DIR_OUT | GPIOF_INIT_HIGH,
> > -				      "auo_pixcir_ts_rst");
> > +	gpiod_set_consumer_name(ts->gpio_int, "auo_pixcir_ts_int");
> > +
> > +	/* Take the chip out of reset */
> > +	ts->gpio_rst = devm_gpiod_get_index(&client->dev, NULL, 1,
> > +					    GPIOD_OUT_LOW);
> 
> hmm, is this really equivalent? It looks like above we're startig
> with GPIOF_INIT_HIGH, while here it is LOW?

Yes, I believe the behavior will not change. You need to remember that
legacy gpio API operates on raw line states, whereas gpiod API is
normally logical state that gets converted to raw state (and the
conversion takes into account the polarity).

Here we are dealing with ACTIVE_LOW gpio, so setting it into logical
"low" (== inactive) means that the raw state is "high", as it was with
gpio_request_oneio_request_one(...GPIOF_DIR_OUT | GPIOF_INIT_HIGH, ...);

Thanks.

-- 
Dmitry

  reply	other threads:[~2022-09-14 15:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 14:14 [PATCH 1/5] Input: auo-pixcir-ts - drop support for platform data Dmitry Torokhov
2022-09-14 14:14 ` [PATCH 2/5] Input: auo-pixcir-ts - switch to using gpiod API Dmitry Torokhov
2022-09-14 15:04   ` Heiko Stuebner
2022-09-14 15:15     ` Dmitry Torokhov [this message]
2022-09-15 13:08   ` Heiko Stuebner
2022-09-18 14:40   ` Linus Walleij
2022-09-14 14:14 ` [PATCH 3/5] Input: auo-pixcir-ts - do not force rising edge interrupt trigger Dmitry Torokhov
2022-09-14 15:05   ` Heiko Stuebner
2022-09-14 14:14 ` [PATCH 4/5] Input: auo-pixcir-ts - switch to using generic device properties Dmitry Torokhov
2022-09-14 15:06   ` Heiko Stuebner
2022-09-14 14:14 ` [PATCH 5/5] dt-bindings: input: auo-pixcir-ts: fix gpio and interrupt properties Dmitry Torokhov
2022-09-14 15:07   ` Heiko Stuebner
2022-09-14 14:40 ` [PATCH 1/5] Input: auo-pixcir-ts - drop support for platform data Heiko Stuebner

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=YyHwCSTNK2jCvJyg@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=heiko@sntech.de \
    --cc=linus.walleij@linaro.org \
    --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;
as well as URLs for NNTP newsgroup(s).