[PATCH v2 0/2] power: pmic: add TPS65913 support

Jonas Karlman jonas at kwiboo.se
Sun Jul 16 10:07:15 CEST 2023


On 2023-07-16 05:57, Svyatoslav Ryhel wrote:
> 
> 
> 16 липня 2023 р. 02:37:39 GMT+03:00, Jonas Karlman <jonas at kwiboo.se> написав(-ла):
>> On 2023-07-15 20:34, Svyatoslav Ryhel wrote:
>>> Existing PALMAS PMIC driver is fully compatible with TI TPS65913
>>> PMIC found in many Tegra 4 devices, like Tegra Note 7 and ASUS
>>> TF701T. Add TPS65913 dts compatible with TPS659038 data.
>>>
>>> Issue with regulators is more general then I though initially.
>>> It touches all pmic regulators.
>>>
>>> Currently device tree entries of regulators are completely
>>> ignored and regulators are probed only if they are called
>>> by the device which uses it. This results into two issues:
>>> regulators which must run under boot-on or always-on mode
>>> are ignored and not enabled; dts props like voltage are
>>> not applied to the regulator so the regulator may be enabled
>>> with random actual voltage, which may have unexpected
>>> consequences.
>>
>> This sounds like something a call to regulators_enable_boot_on like is
>> done on other platforms/boards could solve?
> 
> Yes, regulators_enable_boot_on can solve this if called from the board, but why should every device call this from the board if this should be done automatically? What should do devices without board? Isn't u-boot moving towards all in device tree setup?

Main diff is that regulators_enable_boot_on covers all regulators,
including fixed/gpio/pwm regulators, not just regulators that are
children of a pmic. Meaning platforms/boards would still need to somehow
autoset non-pmic regulators.

Maybe regulators_enable_boot_on could be called from the default
power_init_board or similar, when a Kconfig is enabled, to cover more
platforms/boards.

Regards,
Jonas

> 
> Best regards,
> Svyatoslav R.
> 
>> Regards,
>> Jonas
>>
>>>
>>> Second patch changes this behavior. Post-probe function is
>>> introduced which performs probing of each pmics child and if
>>> it is a regulator, regulator_autoset function is called, which
>>> handles always-on and boot-on regulators, but if none of those
>>> props are set, the regulator is disabled.
>>>
>>> Later disabled regulators can be re-enabled by devices which
>>> use them without issues.
>>>
>>> I have tested this change on multiple devices with different
>>> PMICs (LG P895, max77663; TF300T with TPS65911; HTC One X with
>>> TPS80031; Tegratab with TPS65913). Without this patch they behave
>>> as described in the third paragraph. With patch behavior is correct.
>>>
>>> ---
>>> Changes from v1:
>>>  - implemented general fix of regulator behavior, which include:
>>>   - introduction of post-probe into pmic-uclass driver
>>>   - probing all pmic childs in post-probe
>>>   - check if device is regulator > autoset if regulator is
>>>     boot-on or always-on  else  disable regulator
>>> --- 
>>>
>>> Svyatoslav Ryhel (2):
>>>   power: pmic: support TI TPS65913 PMIC
>>>   power: pmic: fix regulators behaviour
>>>
>>>  drivers/power/pmic/palmas.c      |  1 +
>>>  drivers/power/pmic/pmic-uclass.c | 18 ++++++++++++++++++
>>>  2 files changed, 19 insertions(+)
>>>
>>



More information about the U-Boot mailing list