boards: Raspberry Pi pico pwm led adjustment

The Raspberry Pi pico defines PWM leds, but on the Raspberry Pi pico
w-variant the gpio to the led is routed to the WiFi/Bluetooth module,
thus the led is not available.

Introduce a HAS_DT_PWM_LED define which allows devicetree overlays for
the rpi_pico board to distinguish between board variants with a pwm
controlled led, and those without.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2024-02-29 11:13:51 +01:00 committed by Carles Cufi
parent 7277cae6fa
commit 037a3b52a4
3 changed files with 10 additions and 1 deletions

View File

@ -8,6 +8,10 @@
#include "rpi_pico-common.dtsi"
/* Only the rpi_pico/rp2040 has a pwm. */
/* This define can be used to avoid sourcing board overlays when the PWM is not available */
#define HAS_DT_PWM_LED 1
/ {
leds {
compatible = "gpio-leds";

View File

@ -1,3 +1,7 @@
/* The rpi_pico/rp2040/w doesn't have a pwm. */
/* Use the HAS_DT_PWM defined by the based board to identify when this overlay is valid */
#if HAS_DT_PWM_LED
&{/pwm_leds} {
status = "okay";
};
@ -11,3 +15,5 @@
divider-frac-4 = <15>;
divider-int-4 = <255>;
};
#endif

View File

@ -8,4 +8,3 @@ tests:
- pwm
depends_on: pwm
harness: led
platform_exclude: rpi_pico/rp2040/w