lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4fe0c7c3-f5eb-4c01-8607-ce79a768cb06@wanadoo.fr>
Date:   Thu, 17 Nov 2022 22:16:40 +0100
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     linmengbo0689@...tonmail.com
Cc:     alistair@...stair23.me, devicetree@...r.kernel.org,
        dmitry.torokhov@...il.com, krzysztof.kozlowski+dt@...aro.org,
        linus.walleij@...aro.org, linux-input@...r.kernel.org,
        linux-kernel@...r.kernel.org, robh+dt@...nel.org
Subject: Re: [PATCH 2/2] Input: cyttsp5 - add vddio regulator

Le 17/11/2022 à 20:05, Lin, Meng-Bo a écrit :
> The Samsung touchscreen controllers are often used with external pull-up
> for the interrupt line and the I2C lines, so we might need to enable
> a regulator to bring the lines into usable state. Otherwise, this might
> cause spurious interrupts and reading from I2C will fail.
> 
> Implement support for a "vddio-supply" that is enabled by the cyttsp5
> driver so that the regulator gets enabled when needed.
> 
> Signed-off-by: Lin, Meng-Bo <linmengbo0689-g/b1ySJe57IN+BqQ9rBEUg@...lic.gmane.org>
> ---
>   drivers/input/touchscreen/cyttsp5.c | 19 ++++++++++++-------
>   1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
> index 24ab1df9fc07..d02fdb940edf 100644
> --- a/drivers/input/touchscreen/cyttsp5.c
> +++ b/drivers/input/touchscreen/cyttsp5.c
> @@ -190,7 +190,7 @@ struct cyttsp5 {
>   	int num_prv_rec;
>   	struct regmap *regmap;
>   	struct touchscreen_properties prop;
> -	struct regulator *vdd;
> +	struct regulator_bulk_data supplies[2];
>   };
>   
>   /*
> @@ -767,7 +767,7 @@ static void cyttsp5_cleanup(void *data)
>   {
>   	struct cyttsp5 *ts = data;
>   
> -	regulator_disable(ts->vdd);
> +	regulator_bulk_disable(ARRAY_SIZE(ts->supplies), ts->supplies);
>   }
>   
>   static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
> @@ -790,9 +790,12 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
>   	init_completion(&ts->cmd_done);
>   
>   	/* Power up the device */
> -	ts->vdd = devm_regulator_get(dev, "vdd");
> -	if (IS_ERR(ts->vdd)) {
> -		error = PTR_ERR(ts->vdd);
> +	ts->supplies[0].supply = "vdd";
> +	ts->supplies[1].supply = "vddio";
> +	error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->supplies),
> +				      ts->supplies);
> +	if (error < 0) {
> +		dev_err(ts->dev, "Failed to get regulators, error %d\n", error);

Hi,

dev_err_probe()?
I think that devm_regulator_bulk_get() can return -EPROBE_DEFER;

>   		return error;
>   	}
>   
> @@ -800,9 +803,11 @@ static int cyttsp5_probe(struct device *dev, struct regmap *regmap, int irq,
>   	if (error)
>   		return error;
>   
> -	error = regulator_enable(ts->vdd);
> -	if (error)
> +	error = regulator_bulk_enable(ARRAY_SIZE(ts->supplies), ts->supplies);
> +	if (error < 0) {
> +		dev_err(ts->dev, "Failed to enable regulators, error %d\n", error);

Eventually, the same here in order to be consistent.

CJ

>   		return error;
> +	}
>   
>   	ts->input = devm_input_allocate_device(dev);
>   	if (!ts->input) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ