summaryrefslogtreecommitdiff
path: root/api/api_platform.c
diff options
context:
space:
mode:
authorKaustabh Chakraborty <kauschluss@disroot.org>2025-10-17 20:58:18 +0530
committerPeng Fan <peng.fan@nxp.com>2025-10-30 10:11:18 +0800
commit2d49a7e75ce176b07288397742fb9a72d6caf134 (patch)
treeb20bdfb1bf5dc774a011fa44b1b9088ff377f9ce /api/api_platform.c
parent73a85502bd2a4373d82f638b1b4c3e1f79e394e3 (diff)
power: regulator: s2mps11: declaratively define LDOs and BUCKs
In the Linux kernel driver, all information related to LDO and BUCK regulators are stored in descriptive arrays. This also allows multiple variants to be supported by the same driver. Define a struct sec_regulator_desc which holds all values required by a regulator. Create an array of said struct containing all regulators. The descriptors are designed to follow a style similar to what's seen in the Linux driver, so comparing one with the other is simple. In functions such as s2mps11_{buck,ldo}_{val,mode} these values are to be used, make necessary modifications to pull them from the descriptors. Since multiple variants have varying descriptors, select them from within a switch-case block. Functions s2mps11_{buck,ldo}_{volt2hex,hex2volt} and arrays s2mps11_buck_{ctrl,out} are phased out as the calculations are now hardcoded in descriptors, thusly, it reduces clutter and enhances readability. Two macros in s2mps11.h, S2MPS11_LDO_NUM and S2MPS11_BUCK_NUM are removed as they are no longer being used. Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org> Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'api/api_platform.c')
0 files changed, 0 insertions, 0 deletions