All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Mike Looijmans <mike.looijmans@topic.nl>
Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] Input: exc3000 - Support power supply regulators
Date: Wed, 5 Jul 2023 14:49:21 -0700	[thread overview]
Message-ID: <ZKXlYbsk+6MPfeWy@google.com> (raw)
In-Reply-To: <20230703084536.8429-2-mike.looijmans@topic.nl>

Hi Mike,

On Mon, Jul 03, 2023 at 10:45:36AM +0200, Mike Looijmans wrote:
> Add power supply regulator support to the exc3000 devices.
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> 
> ---
> 
>  drivers/input/touchscreen/exc3000.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/exc3000.c b/drivers/input/touchscreen/exc3000.c
> index 4af4c1e5d0da..3e50af8a4a2d 100644
> --- a/drivers/input/touchscreen/exc3000.c
> +++ b/drivers/input/touchscreen/exc3000.c
> @@ -18,6 +18,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
> +#include <linux/regulator/consumer.h>
>  #include <linux/sizes.h>
>  #include <linux/timer.h>
>  #include <asm/unaligned.h>
> @@ -360,6 +361,12 @@ static int exc3000_probe(struct i2c_client *client)
>  	if (IS_ERR(data->reset))
>  		return PTR_ERR(data->reset);
>  
> +	/* For proper reset sequence, enable power while reset asserted */
> +	error = devm_regulator_get_enable_optional(&client->dev, "vdd");
> +	if (error && error != -ENODEV)
> +		dev_err_probe(&client->dev, error,
> +			      "failed to request vdd regulator\n");


If there is a regulator described in the firmware we should not continue
with initializing the device if we fail to grab/enable it. Think about
what happens if you get -EPROBE_DEFER here. You should return here.

Also, why are you using the _optional() variant? VDD is not an optional
for the controller. regulator_get_optional() is needed when you need to
alter the behavior of the device/driver depending on the presence of an
optional supply, whereas here it should work fine with a sub supply that
will be created if you simply call devm_regulator_get_enable() and there
is not regulator mentioned in DT/ACPI for the board.

Thanks.

-- 
Dmitry

  reply	other threads:[~2023-07-05 21:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.056940e6-2612-4bc3-a2f6-33121e64866d@emailsignatures365.codetwo.com>
2023-07-03  8:45 ` [PATCH 1/2] dt-bindings: Input: exc3000 - Support power supply regulators Mike Looijmans
2023-07-03  8:45   ` [PATCH 2/2] " Mike Looijmans
2023-07-05 21:49     ` Dmitry Torokhov [this message]
2023-07-06 15:36       ` Mike Looijmans
2023-07-03 16:25   ` [PATCH 1/2] dt-bindings: " Krzysztof Kozlowski

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=ZKXlYbsk+6MPfeWy@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --cc=u.kleine-koenig@pengutronix.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.