Skip to content

fw/drivers/pmic: replace npm1300 platform ifdefs with board-level config#829

Closed
leopoldch wants to merge 3 commits into
coredevices:mainfrom
leopoldch:refactor/nPM1300
Closed

fw/drivers/pmic: replace npm1300 platform ifdefs with board-level config#829
leopoldch wants to merge 3 commits into
coredevices:mainfrom
leopoldch:refactor/nPM1300

Conversation

@leopoldch
Copy link
Copy Markdown

Issue #233

Why

The npm1300 driver used hardcoded #if PLATFORM_XXX. Several TODO and FIXME comments in the code already acknowledged this needed to be cleaned up. Adding a new board meant editing the driver itself, which is fragile and hard to review.

What

All platform-specific PMIC configuration is moved into new fields in Npm1300Config (voltages, enable flags, modes, SW control, erratum workaround). Each board file (board_asterix.c, board_obelix.c, board_getafix.c) now declares its own complete power rail config, and the driver in npm1300.c applies it generically without any #if PLATFORM_*.

Note

The patch compiles cleanly but has not been tested on hardware.
Also note that some magic values remain in this part of the codebase

Copy link
Copy Markdown
Member

@gmarull gmarull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow commit guidelines

Comment thread src/fw/board/boards/board_asterix.c Outdated
@leopoldch leopoldch force-pushed the refactor/nPM1300 branch 2 times, most recently from 4cf3e38 to 18e06ed Compare February 16, 2026 18:20
@leopoldch
Copy link
Copy Markdown
Author

@gmarull I rewrote my commit messages to include Signed-off-by: and added comments to avoid magic values. Let me know if you’d like me to store these in separate variables 🙂

Comment thread src/fw/board/boards/board_asterix.c Outdated
…ble per board

Signed-off-by: Léopold Chappuis <leopold@lchappuis.fr>
…le via the Npm1300Config struct

Signed-off-by: Léopold Chappuis <leopold@lchappuis.fr>
Signed-off-by: Léopold Chappuis <leopold@lchappuis.fr>
@github-actions
Copy link
Copy Markdown

This pull request has been marked as stale because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 7 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions Bot added the stale label May 10, 2026
@github-actions github-actions Bot closed this May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants