public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Looijmans <mike.looijmans@topic.nl>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, martink@posteo.de,
	geert+renesas@glider.be, john@metanate.com, hechtb@gmail.com
Subject: Re: [PATCH] Input: st1232 - Support power supply regulators
Date: Mon, 30 May 2022 07:50:32 +0200	[thread overview]
Message-ID: <faa70977-311f-08fb-bb3d-5dfabdab2b15@topic.nl> (raw)
In-Reply-To: <YpGpdsAJicTqHbeY@google.com>

Comment inlined below (mailserver injects signature halfway through the 
mail usually).


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: mike.looijmans@topicproducts.com
W: www.topic.nl

Please consider the environment before printing this e-mail
On 28-05-2022 06:47, Dmitry Torokhov wrote:
> Hi Mike,
>
> On Tue, May 24, 2022 at 10:12:16AM +0200, Mike Looijmans wrote:
>> Add support for the VDD and IOVDD power supply inputs. This allows the
>> chip to share its supplies with other components (e.g. panel) and manage
>> them.
>>
>> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
>> ---
>>   .../input/touchscreen/sitronix,st1232.yaml    |  6 +++
>>   drivers/input/touchscreen/st1232.c            | 54 ++++++++++++++++---
>>   2 files changed, 52 insertions(+), 8 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml b/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml
>> index 1d8ca19fd37a..240be8d49232 100644
>> --- a/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml
>> +++ b/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml
>> @@ -28,6 +28,12 @@ properties:
>>       description: A phandle to the reset GPIO
>>       maxItems: 1
>>   
>> +  vdd-supply:
>> +    description: Power supply regulator for the chip
>> +
>> +  vddio-supply:
>> +    description: Power supply regulator for the I2C bus
>> +
>>   required:
>>     - compatible
>>     - reg
>> diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
>> index e38ba3e4f183..d9c9f6f1f11a 100644
>> --- a/drivers/input/touchscreen/st1232.c
>> +++ b/drivers/input/touchscreen/st1232.c
>> @@ -44,6 +44,11 @@
>>   #define REG_XY_COORDINATES	0x12
>>   #define ST_TS_MAX_FINGERS	10
>>   
>> +enum st1232_regulators {
>> +	ST1232_REGULATOR_VDD,
>> +	ST1232_REGULATOR_IOVDD,
>> +};
>> +
>>   struct st_chip_info {
>>   	bool	have_z;
>>   	u16	max_area;
>> @@ -56,6 +61,7 @@ struct st1232_ts_data {
>>   	struct touchscreen_properties prop;
>>   	struct dev_pm_qos_request low_latency_req;
>>   	struct gpio_desc *reset_gpio;
>> +	struct regulator_bulk_data regulators[2];
>>   	const struct st_chip_info *chip_info;
>>   	int read_buf_len;
>>   	u8 *read_buf;
>> @@ -197,17 +203,36 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id)
>>   	return IRQ_HANDLED;
>>   }
>>   
>> -static void st1232_ts_power(struct st1232_ts_data *ts, bool poweron)
>> +static int st1232_ts_power_on(struct st1232_ts_data *ts)
>> +{
>> +	int err;
>> +
>> +	err = regulator_bulk_enable(ARRAY_SIZE(ts->regulators), ts->regulators);
>> +	if (err)
>> +		return err;
> Does it really make sense to try and handle regulators when reset gpio
> is not defined? Would it not be better to tie them to the presence of
> reset gpio to make sure we implement proper power on sequence?

I thought that's what we're doing here. The datasheet says 5ms between 
power-good and reset de-assert. Whether or not the hardware guys 
bothered to actually connect the reset is out of our hands. The 
regulator is not mandatory either, we'll get a dummy supply from the 
framework when not defined.

The main use case here is that if for example the panel and touchscreen 
share a power supply, they can now turn off the power supply when not in 
use.

>
>> +
>> +	usleep_range(5000, 6000);
>> +
>> +	if (ts->reset_gpio)
>> +		gpiod_set_value_cansleep(ts->reset_gpio, 0);
>> +
>> +	return 0;
>> +}
> Thanks.
>

-- 
Mike Looijmans


  reply	other threads:[~2022-05-30  5:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24  8:12 [PATCH] Input: st1232 - Support power supply regulators Mike Looijmans
     [not found] ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.448f4393-43fc-4ee3-8849-d41a20e1be99@emailsignatures365.codetwo.com>
2022-05-28  4:47 ` Dmitry Torokhov
2022-05-30  5:50   ` Mike Looijmans [this message]
2022-06-02 13:38 ` Rob Herring

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=faa70977-311f-08fb-bb3d-5dfabdab2b15@topic.nl \
    --to=mike.looijmans@topic.nl \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=hechtb@gmail.com \
    --cc=john@metanate.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martink@posteo.de \
    --cc=robh+dt@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