fw/drivers/pmic: replace npm1300 platform ifdefs with board-level config#829
Open
leopoldch wants to merge 2 commits intocoredevices:mainfrom
Open
fw/drivers/pmic: replace npm1300 platform ifdefs with board-level config#829leopoldch wants to merge 2 commits intocoredevices:mainfrom
leopoldch wants to merge 2 commits intocoredevices:mainfrom
Conversation
gmarull
requested changes
Feb 16, 2026
src/fw/board/boards/board_asterix.c
Outdated
Comment on lines
211
to
215
| .chg_current_ma = 128, | ||
| .dischg_limit_ma = 200, | ||
| .term_current_pct = 10, | ||
| .thermistor_beta = 3380, | ||
| .vterm_setting = NPM1300_VTERM_4V20, |
Member
There was a problem hiding this comment.
please, expose human readable settings at board level, no magic constants that are impl details
…ble per board Signed-off-by: Léopold Chappuis <leopold@lchappuis.fr>
d1e9643 to
4cf3e38
Compare
…le via the Npm1300Config struct Signed-off-by: Léopold Chappuis <leopold@lchappuis.fr>
4cf3e38 to
18e06ed
Compare
Author
|
@gmarull I rewrote my commit messages to include |
gmarull
reviewed
Feb 16, 2026
Comment on lines
+214
to
+223
| .vterm_setting = NPM1300_VTERM_4V20, | ||
|
|
||
| // Buck1 (1.8V) | ||
| .buck1_enable = true, | ||
| .buck1_voltage_sel = 8, // 1.8V | ||
|
|
||
| // Buck2 (3.0V) | ||
| .buck2_enable = true, | ||
| .buck2_voltage_sel = 20, // 3.0V | ||
| .buck_sw_ctrl_sel = 3, // both of them, load |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #233
Why
The npm1300 driver used hardcoded
#if PLATFORM_XXX. SeveralTODOandFIXMEcomments 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 innpm1300.capplies 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