[PATCH v1 1/7] spmi: Implement spmi_subdevice_alloc_and_add() and devm variant
AngeloGioacchino Del Regno
angelogioacchino.delregno at collabora.com
Mon Jul 21 06:00:13 PDT 2025
Il 21/07/25 13:34, Andy Shevchenko ha scritto:
> On Mon, Jul 21, 2025 at 09:55:19AM +0200, AngeloGioacchino Del Regno wrote:
>> Some devices connected over the SPMI bus may be big, in the sense
>> that those may be a complex of devices managed by a single chip
>> over the SPMI bus, reachable through a single SID.
>>
>> Add new functions aimed at managing sub-devices of a SPMI device
>> spmi_subdevice_alloc_and_add() and a spmi_subdevice_put_and_remove()
>> for adding a new subdevice and removing it respectively, and also
>> add their devm_* variants.
>>
>> The need for such functions comes from the existance of those
>> complex Power Management ICs (PMICs), which feature one or many
>> sub-devices, in some cases with these being even addressable on
>> the chip in form of SPMI register ranges.
>>
>> Examples of those devices can be found in both Qualcomm platforms
>> with their PMICs having PON, RTC, SDAM, GPIO controller, and other
>> sub-devices, and in newer MediaTek platforms showing similar HW
>> features and a similar layout with those also having many subdevs.
>
> ...
>
>> EXPORT_SYMBOL_GPL(devm_spmi_controller_add);
>
>> +EXPORT_SYMBOL_GPL(devm_spmi_subdevice_alloc_and_add);
>
> I am wondering how hard to move these to a dedicated namespace.
> Basically you can define a default namespace, and at the same time
> add import to all (current) users.
>
I can check if this can be done "relatively easily" (as in, if I can do that
without requiring "a hundred" immutable branches for every subsystem using
SPMI).
If turns out being feasible - I do actually like the idea so yes I'd be pleased
to do that... even though honestly it's completely out of scope for this series.
In case I can't - it's still something that can be done later.
> ...
>
>> + dev_set_name(&sdev->dev,
>> + "%d-%02x.%d.auto", sdev->ctrl->nr, sdev->usid, sub_sdev->devid);
>
> No error check?
>
Heh, whoops, forgot about it :-)
Thanks for catching that - adding the check for v2.
Cheers,
Angelo
More information about the linux-phy
mailing list