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>
31 lines
657 B
Plaintext
31 lines
657 B
Plaintext
/*
|
|
* Copyright (c) The Libre Solar Project Contributors
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/ {
|
|
fake_pwm: fake-pwm {
|
|
compatible = "zephyr,fake-pwm";
|
|
#pwm-cells = <2>;
|
|
frequency = <1000000>;
|
|
};
|
|
|
|
basic_switch: basic-switch {
|
|
compatible = "libresolar,gpio-power-switch";
|
|
gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
|
|
};
|
|
|
|
latching_switch: latching-switch {
|
|
compatible = "libresolar,gpio-power-switch";
|
|
gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
|
|
latching-pgood;
|
|
};
|
|
|
|
charge_pump_switch: charge-pump-switch {
|
|
compatible = "libresolar,gpio-power-switch";
|
|
gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
|
|
charge-pump-pwms = <&fake_pwm 0 200000>;
|
|
};
|
|
};
|