Files
charge-controller-firmware/drivers/power_switch/Kconfig
T
Martin JägerandClaude Opus 5.5 01b48b26e1 drivers: power_switch: add power switch driver
Add a driver class for power switches, e.g. used for load and USB
outputs. Besides switching on and off, drivers may provide a power-good
feedback and report faults that were already handled in hardware.

Two backends are available:

- libresolar,gpio-power-switch: Switch driven by a GPIO with optional
  latching power-good feedback and charge pump PWM for high-side gate
  drivers. The latch time is handled by delayable work instead of
  blocking the caller.
- libresolar,stm32-lptim-power-switch: Switch driven by LPTIM1 of
  STM32L0, which is triggered by COMP2 to switch off within a few
  microseconds in case of a short circuit (PWM 2420 LUS).

The GPIO backend is tested on native_sim using the GPIO emulator and the
fake PWM driver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 13:43:57 +01:00

55 lines
1.6 KiB
Plaintext

# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
menuconfig POWER_SWITCH
bool "Power switch drivers"
default y if DT_HAS_LIBRESOLAR_GPIO_POWER_SWITCH_ENABLED
default y if DT_HAS_LIBRESOLAR_STM32_LPTIM_POWER_SWITCH_ENABLED
help
Enable drivers for power switches, e.g. used for load or USB outputs.
if POWER_SWITCH
config POWER_SWITCH_INIT_PRIORITY
int "Power switch init priority"
default 70
help
Power switch driver device initialization priority. Must be lower than the priority
of the GPIO and PWM drivers.
module = POWER_SWITCH
module-str = power_switch
source "subsys/logging/Kconfig.template.log_config"
config POWER_SWITCH_GPIO
bool "GPIO power switch driver"
default y
depends on DT_HAS_LIBRESOLAR_GPIO_POWER_SWITCH_ENABLED
select GPIO
help
Enable driver for power switches driven by a GPIO.
DT_COMPAT_LIBRESOLAR_GPIO_POWER_SWITCH := libresolar,gpio-power-switch
config POWER_SWITCH_GPIO_CHARGE_PUMP
bool
default y
depends on POWER_SWITCH_GPIO
depends on $(dt_compat_any_has_prop,$(DT_COMPAT_LIBRESOLAR_GPIO_POWER_SWITCH),charge-pump-pwms)
select PWM
help
Support for charge pump PWM signals of GPIO power switches.
config POWER_SWITCH_STM32_LPTIM
bool "STM32 LPTIM power switch driver with short-circuit protection"
default y
depends on DT_HAS_LIBRESOLAR_STM32_LPTIM_POWER_SWITCH_ENABLED
depends on SOC_SERIES_STM32L0X
select GPIO
select PINCTRL
help
Enable power switch driver using LPTIM1 and COMP2 of STM32L0 for hardware short-circuit
protection.
endif # POWER_SWITCH