-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Add 5V power regulators and snippets for external outputs on CoreS3/S3-SE #99466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
45507fa to
b27aaf6
Compare
nordicjm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, shouldn't the bus just have a reference to the regulator itself? So that when it is enabled the PM code will power on the regulator, and power it off if the device is suspended? @fabiobaltieri ?
| # Takes good care of initialization priorities | ||
|
|
||
| if REGULATOR_FIXED | ||
| config REGULATOR_FIXED_INIT_PRIORITY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not properly formatted https://docs.zephyrproject.org/latest/contribute/style/kconfig.html
The bus can also be externally powered. For example the Base LAN PoE v1.2 feeds 5V back into pin 28 of the bus. The |
b27aaf6 to
80773d9
Compare
For those interested in the overall approach, here is a WIP branch: xingrz/zephyr@cores3-power/pr...m5-bytebutton/dev. I'm still gathering more Units to verify the design, and will submit a follow-up PR for the Unit support once it’s ready. |
Like having the USB stack call the regulator APIs to control the supply before initializing? Sounds reasonable to me, may be worth a followup |
Add a `bus_5v` fixed-regulator node driven by the `BOOST_EN` pin. This enables drivers and shields to reference the 5V supply through the standard `vin-supply` property, providing correct power sequencing and runtime control via Zephyr’s regulator API. This regulator is equivalent to the `bus_5v` already defined on the M5Stack Core2 board. Signed-off-by: Chen Xingyu <hi@xingrz.me>
Add two fixed-regulator nodes on the M5Stack CoreS3 to model the load switches controlled by the AW9523B GPIO expander: - `bus_out_reg`: drives 5V output on the M-Bus/Grove connectors via the `BUS_OUT_EN` control signal. - `usb_otg_reg`: drives 5V VBUS output on the USB port via the `USB_OTG_EN` control signal, enabling USB-OTG/host-power mode. Both regulators are defined but off by default. Two new snippets (`cores3-bus-out-en` and `cores3-usb-otg-en`) are added to allow enabling these rails at build time when needed. This keeps the default power configuration unchanged while providing an opt-in mechanism for applications and shields that require external 5V output. Signed-off-by: Chen Xingyu <hi@xingrz.me>
80773d9 to
695a9e6
Compare
| endif # REGULATOR_AXP192_AXP2101 | ||
|
|
||
| if MIPI_DBI | ||
| # Needs to init after MFD_AW9523B (80), since reset-gpios uses aw9523b_gpio on this board. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see this impacts multiple drivers, would it not be easier to change the aw9523b_gpio priority instead and leave the others alone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aw9523b_gpio already initializes at priority 40, which is not late. The issue is that it relies on a k_sem from the aw9523b MFD, so anything using aw9523b_gpio must be initialized after the MFD itself.
zephyr/drivers/gpio/gpio_aw9523b.c
Line 96 in 5973b55
| k_sem_take(aw9523b_get_lock(config->mfd_dev), K_FOREVER); |
|



This PR models all GPIO-controlled 5V rails on the M5Stack CoreS3/CoreS3-SE as fixed regulators:
bus_5v,bus_out_reg, andusb_otg_reg. Thebus_5vregulator matches the equivalent node present on the M5Stack Core2. (See #67280)Two optional snippets (
cores3-bus-out-enandcores3-usb-otg-en) are added to enable the external 5V outputs at build time. All regulators remain disabled by default to preserve existing behavior.The board documentation is updated to describe the CoreS3 power routing matrix and the behavior of the
BUS_OUT_ENandUSB_OTG_ENcontrol signals.These additions allow shields and applications to use the standard
vin-supplyproperty and Zephyr’s regulator API for correct power sequencing and runtime control.