[PATCH v2 4/6] power: pmic: sunxi: add AXP717 SPL support

Ryan Walklin ryan at testtoast.com
Mon Jul 15 11:35:50 CEST 2024


On Mon, 15 Jul 2024, at 11:38 AM, Andre Przywara wrote:
> On Sun, 14 Jul 2024 20:20:44 +1200
> "Ryan Walklin" <ryan at testtoast.com> wrote:
>
> Hi Ryan,
>
> I consider the fact that the AXP209 and the AXP717 use the same I2C
> address a sheer coincidence, so would like to keep the code readable
> and maintainable. This "IS_ENABLED(AXPyyy) return AXPyyy_I2C_ADDR"
> patterns seems to be easy to understand and copy, IMHO. If you are
> concerned about generated code size: this whole function is optimised
> away, and is replaced with a single "mov w0, #0x34" assembly
> instruction, just before the respective i2c function calls. This is due
> to the fact that those "if" statements have compile-time constant
> input, so the compiler knows the final result already, and just
> replaces the function call with this constant load. That's a neat
> feature of IS_ENABLED(), and a pattern we are exercising in U-Boot for
> years, to keep the code both readable, but also minimal.

I did wonder if the compiler might optimise this down to a single instruction, makes perfect sense in that case and agree regarding code clarity.

In that case, and having also checked the DCDC voltage defaults are reasonable for known AXP717-integrating devices in the updated Kconfig:

Reviewed-by: Ryan Walklin <ryan at testtoast.com>

Regards,

Ryan


More information about the U-Boot mailing list