Linux Input Archive mirror
 help / color / mirror / Atom feed
From: Kamel BOUHARA <kamel.bouhara@bootlin.com>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Henrik Rydberg <rydberg@bitmath.org>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, Jeff LaBundy <jeff@labundy.com>,
	catalin.popescu@leica-geosystems.com,
	mark.satterthwaite@touchnetix.com,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Gregory Clement <gregory.clement@bootlin.com>,
	bsp-development.geo@leica-geosystems.com
Subject: Re: [PATCH v9 3/3] Input: Add TouchNetix axiom i2c touchscreen driver
Date: Fri, 19 Apr 2024 10:33:21 +0200	[thread overview]
Message-ID: <2fdb461055af669d35b20f5d994c17c6@bootlin.com> (raw)
In-Reply-To: <20240318080533.GA35033@tpx1.home>

Le 2024-03-18 09:05, Kamel Bouhara a écrit :
> Le Wed, Mar 13, 2024 at 09:21:35PM +0100, Marco Felsch a écrit :
>> Hi Kamel,
>> 
> 
> Hello Marco,
> 
> [...]
> 

Hello,

>> > +static int axiom_i2c_probe(struct i2c_client *client)
>> > +{
>> > +	struct device *dev = &client->dev;
>> > +	struct input_dev *input_dev;
>> > +	struct axiom_data *ts;
>> > +	u32 poll_interval;
>> > +	int target;
>> > +	int error;
>> > +
>> > +	ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
>> > +	if (!ts)
>> > +		return -ENOMEM;
>> > +
>> > +	i2c_set_clientdata(client, ts);
>> > +	ts->client = client;
>> > +	ts->dev = dev;
>> > +
>> > +	ts->regmap = devm_regmap_init_i2c(client, &axiom_i2c_regmap_config);
>> > +	error = PTR_ERR_OR_ZERO(ts->regmap);
>> > +	if (error) {
>> > +		dev_err(dev, "Failed to initialize regmap: %d\n", error);
>> > +		return error;
>> > +	}
>> > +
>> > +	ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
>> > +	if (IS_ERR(ts->reset_gpio))
>> > +		return dev_err_probe(dev, PTR_ERR(ts->reset_gpio), "failed to get reset GPIO\n");
>> > +
>> > +	if (ts->reset_gpio)
>> > +		axiom_reset(ts->reset_gpio);
>> 
>> This seems useless, since you doing an reset without enabling the 
>> power
>> supply (below). I know there are systems which do have the supply 
>> always
>> connected or for ACPI the supply is managed via firmware, but the 
>> driver
>> should implement the correct logic and for DT/OF case this is not
>> correct.
>> 
>> > +
>> > +	ts->vddi = devm_regulator_get_optional(dev, "vddi");
>> > +	if (!IS_ERR(ts->vddi)) {
>> > +		error = devm_regulator_get_enable(dev, "vddi");
>> 
>> Regulators are ref counted and now you request the regulator twice. 
>> Also
>> the regulator is not optional, it is required for the device to work.
>> Same applies to the vdda below.
>> 
> 
> While it is true most of the time, it occurs that for x86 based boards,
> adding a regulator entirely is not always possible.
> 
> In our particular case, the I2C controller for this touchscreen is
> behind a CPLD (aka embedded controller) so I have no direct access to
> the I2C controller and it isn't described in the ACPI table.
> 
> In a normal case, I would use ACPI override to pass regulator
> properties, but here it's not possible.
> 
> Having a CPLD exposing this kind of controller is quite common on x86
> based boards. So, we need a way to support the case when a regulator
> can't be described. The optional regulator looked like a good option,
> but if you have a better alternative, I am open to considering it.
> 

I actually confirmed this case is already handled in 
acpi_subsystem_init():
                 ...
»       »       /*
»       »        * If the system is using ACPI then we can be reasonably
»       »        * confident that any regulators are managed by the 
firmware
»       »        * so tell the regulator core it has everything it needs 
to
»       »        * know.
»       »        */
»       »       regulator_has_full_constraints();

Thanks Marco for the clue :) !

Regards,

-- 
Kamel Bouhara, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

  reply	other threads:[~2024-04-19  8:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 10:39 [PATCH v9 0/3] Input: Add TouchNetix axiom touchscreen driver Kamel Bouhara
2024-03-01 10:39 ` [PATCH v9 1/3] dt-bindings: vendor-prefixes: Add TouchNetix AS Kamel Bouhara
2024-03-01 10:39 ` [PATCH v9 2/3] dt-bindings: input: Add TouchNetix axiom touchscreen Kamel Bouhara
2024-03-01 10:39 ` [PATCH v9 3/3] Input: Add TouchNetix axiom i2c touchscreen driver Kamel Bouhara
2024-03-13 20:21   ` Marco Felsch
2024-03-14  8:28     ` Kamel Bouhara
2024-03-17 16:32       ` Marco Felsch
2024-03-18  8:05     ` Kamel Bouhara
2024-04-19  8:33       ` Kamel BOUHARA [this message]
2024-03-01 16:05 ` [PATCH v9 0/3] Input: Add TouchNetix axiom " Kamel Bouhara
2024-03-06  9:40 ` Kamel BOUHARA

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=2fdb461055af669d35b20f5d994c17c6@bootlin.com \
    --to=kamel.bouhara@bootlin.com \
    --cc=bsp-development.geo@leica-geosystems.com \
    --cc=catalin.popescu@leica-geosystems.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregory.clement@bootlin.com \
    --cc=jeff@labundy.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=mark.satterthwaite@touchnetix.com \
    --cc=robh+dt@kernel.org \
    --cc=rydberg@bitmath.org \
    --cc=thomas.petazzoni@bootlin.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).