mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Looijmans <mike.looijmans@topic.nl>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 5/5] power: supply: ltc3350-charger: Add driver
Date: Tue, 28 May 2024 11:41:36 +0200	[thread overview]
Message-ID: <fb93cdd9-0c9b-4cb1-91c1-ccf832fcba75@topic.nl> (raw)
In-Reply-To: <t4avn7fmzw355a73hu3yu4wzdxyc5gkupi5s4yfio5iyiygkx6@5eubzdbqthqx>

On 27-05-2024 22:40, Sebastian Reichel wrote:
>> ...
>> +static int ltc3350_get_property(struct power_supply *psy, enum power_supply_property psp,
>> +				union power_supply_propval *val)
>> +{
>> +	struct ltc3350_info *info = power_supply_get_drvdata(psy);
>> +
>> +	switch (psp) {
>> +	case POWER_SUPPLY_PROP_STATUS:
>> +		return ltc3350_get_status(info, val);
>> +	case POWER_SUPPLY_PROP_CHARGE_TYPE:
>> +		return ltc3350_get_charge_type(info, val);
>> +	case POWER_SUPPLY_PROP_ONLINE:
>> +		return ltc3350_get_online(info, val);
>> +	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
>> +		return ltc3350_get_scaled(info, LTC3350_REG_MEAS_VOUT, 22100, &val->intval);
>> +	case POWER_SUPPLY_PROP_VOLTAGE_MIN:
>> +		return ltc3350_get_scaled(info, LTC3350_REG_VOUT_UV_LVL, 22100, &val->intval);
>> +	case POWER_SUPPLY_PROP_VOLTAGE_MAX:
>> +		return ltc3350_get_scaled(info, LTC3350_REG_VOUT_OV_LVL, 22100, &val->intval);
> For USB chargers VOLTAGE_NOW/MIN/MAX refers to VBUS, which is the
> voltage on the USB lines and thus the input voltage. From my
> understanding of the LTC3350 this would be VIN and not VOUT. With
> VOUT being supplied by either VIN or the Capacitors.
>
> So I think your custom vin/vin_uv/vin_ov should be exposed with the
> above properties.

Yeah, power supplies report their input voltage. So this should report VIN.


> My understanding for VOUT is, that this is basically the system
> supply - I would expect more regulators to follow, which convert
> it to typical voltages like 3.3V or 1.8V. In that case it would
> make sense to expose VOUT as regulator, so that it can be referenced
> as vin-supply. You can find a few examples for charger drivers doing
> that for USB-OTG functionality.

Looked at other drivers for that. Significant difference is that those 
have something useful to supply to other drivers, e.g. being able to 
enable/disable the output for one thing.

For the LTC3350, the output (voltage) is just a measurement and there's 
nothing for the driver to configure. Any regulator_ops would be 
completely empty.

Given that, I think it should get the same treatment as GPI, so either a 
custom property or some other device (IIO). Or maybe add a VOLTAGE_OUT 
property? It's not uncommon for power management devices to report their 
output voltage.


>

-- 
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@topic.nl
W: www.topic.nl




  parent reply	other threads:[~2024-05-28  9:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.e2aac3eb-919a-41c3-81e9-f9030f4f80eb@emailsignatures365.codetwo.com>
2024-04-16 12:18 ` [PATCH v5 1/5] dt-bindings: power: Extend battery chemistry with capacitor Mike Looijmans
     [not found]   ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.846cb2ab-fcec-478e-9752-6c7d0b6a347c@emailsignatures365.codetwo.com>
2024-04-16 12:18     ` [PATCH v5 2/5] power: supply: core: Add POWER_SUPPLY_TECHNOLOGY_CAPACITOR Mike Looijmans
     [not found]   ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.dc197200-74ec-4cd3-a0dd-4f7fd874c623@emailsignatures365.codetwo.com>
2024-04-16 12:18     ` [PATCH v5 3/5] power: supply: core: Add POWER_SUPPLY_PROP_*CELL* entries Mike Looijmans
     [not found]   ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.217e6bb9-ab43-4da3-b354-1d8d288df2de@emailsignatures365.codetwo.com>
2024-04-16 12:18     ` [PATCH v5 4/5] dt-bindings: power: supply: ltc3350-charger: Add bindings Mike Looijmans
     [not found]   ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.4a7cccf3-e7cb-4980-be8e-de8bd2795354@emailsignatures365.codetwo.com>
2024-04-16 12:18     ` [PATCH v5 5/5] power: supply: ltc3350-charger: Add driver Mike Looijmans
2024-05-27 20:40       ` Sebastian Reichel
2024-05-28  5:18         ` Mike Looijmans
2024-05-28  9:41         ` Mike Looijmans [this message]
2024-06-02 22:40           ` Sebastian Reichel
2024-04-20  0:56   ` [PATCH v5 1/5] dt-bindings: power: Extend battery chemistry with capacitor 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=fb93cdd9-0c9b-4cb1-91c1-ccf832fcba75@topic.nl \
    --to=mike.looijmans@topic.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sebastian.reichel@collabora.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

all inboxes | Powered by JetHome®