feat(lte): command to reboot modem#487
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for rebooting (power-cycling) the LTE modem power rail via the existing power_cycle_supply() mechanism, enabling it on Diamond production builds while keeping Pearl gated.
Changes:
- Allow
orb_mcu_main_PowerCycle_Line_LTE_3V3power-cycling onCONFIG_BOARD_DIAMOND_MAINoutside ofCONFIG_DEBUG. - Explicitly return
RET_ERROR_FORBIDDENforLTE_3V3on Pearl when not in debug. - Adjust the board-conditional GPIO configuration path used when power-cycling LTE.
Comments suppressed due to low confidence (1)
main_board/src/power/boot/boot.c:515
case orb_mcu_main_PowerCycle_Line_LTE_3V3is now defined inside#ifdef CONFIG_DEBUG, butretis only assigned under#if defined(CONFIG_BOARD_PEARL_MAIN). On Diamond (or any non-Pearl debug build), this leavesretuninitialized beforeASSERT_SOFT(ret), and also makes this case overlap with the later Diamond/PearlLTE_3V3cases (duplicatecaselabels when CONFIG_DEBUG is enabled). Restructure the preprocessor conditions so only oneLTE_3V3case is compiled per build and ensureretis always initialized in the compiled path.
case orb_mcu_main_PowerCycle_Line_LTE_3V3:
#if defined(CONFIG_BOARD_PEARL_MAIN)
ret = gpio_pin_configure_dt(<e_gps_usb_reset_gpio_spec,
GPIO_OUTPUT_INACTIVE);
#endif
ASSERT_SOFT(ret);
k_work_schedule(&power_cycle_lte_3v3_line_work,
duration_off_ms != 0 ? K_MSEC(duration_off_ms)
: K_MSEC(3000));
break;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| case orb_mcu_main_PowerCycle_Line_LTE_3V3: | ||
| ret = gpio_pin_configure_dt(&supply_3v3_lte_enable_gpio_spec, | ||
| GPIO_OUTPUT_INACTIVE); | ||
| ASSERT_SOFT(ret); | ||
| k_work_schedule(&power_cycle_lte_3v3_line_work, | ||
| duration_off_ms != 0 ? K_MSEC(duration_off_ms) | ||
| : K_MSEC(3000)); | ||
| break; |
There was a problem hiding this comment.
This Diamond LTE_3V3 power-cycle path schedules power_cycle_lte_3v3_line_work, but that work item (and its handler) are currently defined under #ifdef CONFIG_DEBUG above. In non-debug (prod) builds, this will fail to link/compile. Consider moving the LTE work handler/K_WORK_DELAYABLE_DEFINE behind a condition like CONFIG_DEBUG || CONFIG_BOARD_DIAMOND_MAIN, or defining a separate always-on handler for Diamond.
| break; | ||
| case orb_mcu_main_PowerCycle_Line_LTE_3V3: | ||
| /* forbidden on Pearl if not DEBUG */ | ||
| ret = RET_ERROR_FORBIDDEN; | ||
| break; | ||
| #endif |
There was a problem hiding this comment.
The Pearl-side case orb_mcu_main_PowerCycle_Line_LTE_3V3 added here is compiled whenever CONFIG_BOARD_DIAMOND_MAIN is not set, even in debug builds. Since there is already an LTE_3V3 case inside the earlier #ifdef CONFIG_DEBUG block, enabling CONFIG_DEBUG on Pearl will produce a duplicate case label compile error. Gate this forbidden case with #if !defined(CONFIG_DEBUG) (or otherwise refactor the switch) so only one LTE_3V3 case exists per configuration.
| break; | |
| case orb_mcu_main_PowerCycle_Line_LTE_3V3: | |
| /* forbidden on Pearl if not DEBUG */ | |
| ret = RET_ERROR_FORBIDDEN; | |
| break; | |
| #endif | |
| break; | |
| #if !defined(CONFIG_DEBUG) | |
| case orb_mcu_main_PowerCycle_Line_LTE_3V3: | |
| /* forbidden on Pearl if not DEBUG */ | |
| ret = RET_ERROR_FORBIDDEN; | |
| break; | |
| #endif | |
| #endif |
on diamond prod devices still gated on pearl (debug only) Signed-off-by: Cyril Fougeray <cyril.fougeray@toolsforhumanity.com>
fd9be35 to
79ad6be
Compare
on diamond prod devices
still gated on pearl (debug only)