All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: "Ondřej Jirman" <megous@megous.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org,
	Simon Budig <simon.budig@kernelconcepts.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Marco Felsch <m.felsch@pengutronix.de>
Subject: Re: [PATCH v2 2/2] Input: edt-ft5x06 - add support for iovcc-supply
Date: Mon, 10 May 2021 22:16:41 +0200	[thread overview]
Message-ID: <YJmUm/6Vm3d9hp1z@gerhold.net> (raw)
In-Reply-To: <20210510194848.g7cgty3lirxkht5g@core>

Hi!

On Mon, May 10, 2021 at 09:48:48PM +0200, Ondřej Jirman wrote:
> Hello Stephan,
> 
> On Mon, May 10, 2021 at 09:31:08PM +0200, Stephan Gerhold wrote:
> > At the moment, the edt-ft5x06 driver can control a single regulator
> > ("vcc"). However, some FocalTech touch controllers have an additional
> > IOVCC pin that should be supplied with the digital I/O voltage.
> > 
> > The I/O voltage might be provided by another regulator that should also
> > be kept on. Otherwise, the touchscreen can randomly stop functioning if
> > the regulator is turned off because no other components still require it.
> > 
> > Implement (optional) support for also enabling an "iovcc-supply".
> > The datasheet specifies a delay of ~ 10us before enabling VDD/VCC
> > after IOVCC is enabled, so make sure to enable IOVCC first.
> > 
> > Cc: Ondrej Jirman <megous@megous.com>
> > Cc: Marco Felsch <m.felsch@pengutronix.de>
> > Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> > ---
> > Sorry about the long delay, couldn't find the time to test the new changes :)
> > 
> > Changes in v2:
> >   - Respect 10us delay between enabling IOVCC and VDD/VCC line
> >     (suggested by Marco Felsch)
> > 
> > v1: https://lore.kernel.org/linux-input/20210108192337.563679-2-stephan@gerhold.net/
> > ---
> >  drivers/input/touchscreen/edt-ft5x06.c | 34 ++++++++++++++++++++++++++
> >  1 file changed, 34 insertions(+)
> > 
> > diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> > index 2eefbc2485bc..d3271856bb5c 100644
> > --- a/drivers/input/touchscreen/edt-ft5x06.c
> > +++ b/drivers/input/touchscreen/edt-ft5x06.c
> > @@ -104,6 +104,7 @@ struct edt_ft5x06_ts_data {
> >  	u16 num_x;
> >  	u16 num_y;
> >  	struct regulator *vcc;
> > +	struct regulator *iovcc;
> >  
> >  	struct gpio_desc *reset_gpio;
> >  	struct gpio_desc *wake_gpio;
> > @@ -1067,6 +1068,7 @@ static void edt_ft5x06_disable_regulator(void *arg)
> >  	struct edt_ft5x06_ts_data *data = arg;
> >  
> >  	regulator_disable(data->vcc);
> > +	regulator_disable(data->iovcc);
> >  }
> >  
> >  static int edt_ft5x06_ts_probe(struct i2c_client *client,
> > @@ -1107,9 +1109,28 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
> >  		return error;
> >  	}
> >  
> > +	tsdata->iovcc = devm_regulator_get(&client->dev, "iovcc");
> > +	if (IS_ERR(tsdata->iovcc)) {
> > +		error = PTR_ERR(tsdata->iovcc);
> > +		if (error != -EPROBE_DEFER)
> > +			dev_err(&client->dev,
> > +				"failed to request iovcc regulator: %d\n", error);
> 
> Please use dev_err_probe instead. If this pattern is used for vcc-supply, maybe
> change that too. Maybe also consider using a bulk regulator API.
>

I had both of that in v1 but reverted both of that as discussed.
I didn't make that very clear in the changelog, sorry about that. :)

The reasons were:

  - Bulk regulator API: AFAICT there is no way to use it while also
    maintaining the correct enable/disable order plus the 10us delay.
    See https://lore.kernel.org/linux-input/X%2Fwj+bxe%2FIlznCj6@gerhold.net/

  - dev_err_probe(): For some reason the patch set that converted a lot of
    input drivers (including edt-ft5x06) to dev_err_probe() was never applied:
    https://lore.kernel.org/linux-input/20200827185829.30096-12-krzk@kernel.org/
    I dropped the change from my patch since Andy already mentioned
    a similar thing back then.

Thanks!
Stephan

  parent reply	other threads:[~2021-05-10 20:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 19:31 [PATCH v2 1/2] dt-bindings: input: touchscreen: edt-ft5x06: add iovcc-supply Stephan Gerhold
2021-05-10 19:31 ` [PATCH v2 2/2] Input: edt-ft5x06 - add support for iovcc-supply Stephan Gerhold
2021-05-10 19:48   ` Ondřej Jirman
2021-05-10 20:09     ` Andy Shevchenko
2021-05-10 20:17       ` Ondřej Jirman
2021-05-10 20:16     ` Stephan Gerhold [this message]
2021-05-10 21:14       ` Ondřej Jirman
2021-05-11  7:21       ` Andy Shevchenko
2021-05-11  7:42         ` Marco Felsch
2021-05-11  8:50         ` Stephan Gerhold

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=YJmUm/6Vm3d9hp1z@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=megous@megous.com \
    --cc=robh+dt@kernel.org \
    --cc=simon.budig@kernelconcepts.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.