From: Hans de Goede <hdegoede@redhat.com>
To: "Marek Vasut" <marex@denx.de>,
"Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: linux-pm@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: Re: [PATCH 1/2] power: supply: bq25890: Add CC voltage to ADC properties
Date: Tue, 11 Oct 2022 09:38:50 +0200 [thread overview]
Message-ID: <e26abfe6-850a-32e5-fa2e-5dd633c72a62@redhat.com> (raw)
In-Reply-To: <c528ae92-26bd-e6a9-a406-93a077d2fab7@denx.de>
Hi,
On 10/10/22 21:22, Marek Vasut wrote:
> On 10/10/22 15:50, Hans de Goede wrote:
>> Hi,
>
> Hi,
>
> [...]
>
>>> Though I think there is no proper property
>>> for the VSYS value that is currently occupying VOLTAGE_NOW - this
>>> might be better modelled as a separate regulator maybe?
>>
>> Ack, see above.
>
> We already do have a regulator in the bq25890 driver. The regulator is used as a switch to toggle OTG boost mode (supply from battery to VBUS), but I don't see any users of this functionality, and I cannot imagine how this would be modeled in DT. (Hans, can you clarify?)
Ah, with the Ack I meant ack for the "I think there is no proper property for the VSYS value" I did not meant to ack the regulator bit, I don't directly see how having registering a regulator device for Vsys would be useful, sorry. As mentioned in my original email I believe that just adding a new property for Vsys makes the most sense.
Note the OTG regulator is useful to enable/disable 5V boost output when used with e.g. a micro-usb connector and that micro-usb connector is used with an micro-USB OTG host-mode cable / dongle.
> There is the usb_work (usb_register_notifier()) which triggers workqueue which does the same, toggles OTG boost mode, but this is only used in case a valid USB PHY is found. I didn't find any users of this either.
This is used, but the use is hidden away pretty well I admit. Some X86 tablets from the Cherry Trail era have ACPI tables where the charging / fuel-gauge ICs are not handled in ACPI (as they typically are on x86) so we need to do it ourselves.
Specifically the charger IC is connected to a special I2c bus of the PMIC (which itself is an i2c-device so we have an i2c-attached i2c-controller, crazy ...) the driver for this special PMIC embedded i2c-controller is also responsible for instantiating the charger chip i2c-client and this setup uses the OTG regulator device, see: drivers/i2c/busses/i2c-cht-wc.c specifically these bits:
/********** Xiaomi Mi Pad 2 charger IC settings **********/
static struct regulator_consumer_supply bq2589x_vbus_consumer = {
.supply = "vbus",
.dev_name = "cht_wcove_pwrsrc",
};
static const struct regulator_init_data bq2589x_vbus_init_data = {
.constraints = {
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
},
.consumer_supplies = &bq2589x_vbus_consumer,
.num_consumer_supplies = 1,
};
static struct bq25890_platform_data bq2589x_pdata = {
.regulator_init_data = &bq2589x_vbus_init_data,
};
static const struct property_entry xiaomi_mipad2_props[] = {
PROPERTY_ENTRY_BOOL("linux,skip-reset"),
PROPERTY_ENTRY_BOOL("linux,read-back-settings"),
{ }
};
static const struct software_node xiaomi_mipad2_node = {
.properties = xiaomi_mipad2_props,
};
static struct i2c_board_info xiaomi_mipad2_board_info = {
.type = "bq25890",
.addr = 0x6a,
.dev_name = "bq25890",
.swnode = &xiaomi_mipad2_node,
.platform_data = &bq2589x_pdata,
};
And then the drivers/extcon/extcon-intel-cht-wc.c uses
the vbus regulator to control the 5V out on the micro-USB.
(also note these devices do not instantiate a usb_phy device anywhere, which is why the V5 boost is handled through the regulator framework)
TL;DR: the regulator device for the V5 boost output is used, please don't remove it :)
> Anyway, maybe we can extend the regulator to report VBus and register another one to report VSys, where the VSys one can be plugged e.g. as supply for PMIC in DT ?
I'm not sure if a regulator device for Vsys is really useful, AFAIK Vsys can not be turned off, nor can the voltage level be controlled...
Regards,
Hans
next prev parent reply other threads:[~2022-10-11 7:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-09 19:18 [PATCH 1/2] power: supply: bq25890: Add CC voltage to ADC properties Marek Vasut
2022-10-09 19:18 ` [PATCH 2/2] power: supply: bq25890: Rename POWER_SUPPLY_PROP_CURRENT_NOW to CC current Marek Vasut
2022-10-09 22:58 ` Michał Mirosław
2022-10-10 0:00 ` Marek Vasut
2022-10-10 13:27 ` Hans de Goede
2022-10-10 16:45 ` Marek Vasut
2022-10-10 17:31 ` Hans de Goede
2022-10-10 17:39 ` Marek Vasut
2022-10-09 23:08 ` [PATCH 1/2] power: supply: bq25890: Add CC voltage to ADC properties Michał Mirosław
2022-10-10 13:50 ` Hans de Goede
2022-10-10 19:22 ` Marek Vasut
2022-10-11 7:38 ` Hans de Goede [this message]
2022-10-11 16:35 ` Marek Vasut
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=e26abfe6-850a-32e5-fa2e-5dd633c72a62@redhat.com \
--to=hdegoede@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=marex@denx.de \
--cc=mirq-linux@rere.qmqm.pl \
--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