Browse Source

drivers: pwm_led: esp32: Add inverted flag

Add inverted flag to bindings, as pwms field is supposed
to be used by application only.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
pull/84185/head
Raffael Rostagno 6 months ago committed by Benjamin Cabé
parent
commit
fc8119deed
  1. 2
      drivers/pwm/pwm_led_esp32.c
  2. 14
      dts/bindings/pwm/espressif,esp32-ledc.yaml

2
drivers/pwm/pwm_led_esp32.c

@ -400,7 +400,7 @@ PINCTRL_DT_INST_DEFINE(0); @@ -400,7 +400,7 @@ PINCTRL_DT_INST_DEFINE(0);
.timer_num = DT_PROP(node_id, timer), \
.speed_mode = DT_REG_ADDR(node_id) < SOC_LEDC_CHANNEL_NUM ? LEDC_LOW_SPEED_MODE \
: !LEDC_LOW_SPEED_MODE, \
.inverted = DT_PWMS_FLAGS(node_id), \
.inverted = DT_PROP(node_id, inverted), \
},
static struct pwm_ledc_esp32_channel_config channel_config[] = {

14
dts/bindings/pwm/espressif,esp32-ledc.yaml

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd.
# Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
description: |
@ -64,6 +64,7 @@ description: | @@ -64,6 +64,7 @@ description: |
channel9@9 {
reg = <0x9>;
timer = <0>;
inverted;
};
channel10@a {
reg = <0xa>;
@ -71,6 +72,9 @@ description: | @@ -71,6 +72,9 @@ description: |
};
};
For the channel to be initially inverted after the driver's init, the flag 'inverted' can
be declared, as shown above for channel 9.
Note: The channel's 'reg' property defines the ID of the channel. It must match the channel used
in the 'pinmux'.
@ -130,6 +134,14 @@ child-binding: @@ -130,6 +134,14 @@ child-binding:
For maximum flexibility, the high-speed as well as the low-speed channels can be driven from
one of four high-speed/low-speed timers.
inverted:
type: boolean
description: |
Initial channel output level.
This flag defines if the channel will remain initially inverted after driver init,
as any pwm_set() operation will re-evaluate if the output is inverted or not
according to the flag passed as parameter.
pwm-cells:
- channel
- period

Loading…
Cancel
Save