Skip to content

Commit

Permalink
tests: pwm_gpio_loopback: esp32: Add test overlays
Browse files Browse the repository at this point in the history
Add test overlays for ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
  • Loading branch information
Raffael Rostagno authored and kartben committed Jan 6, 2025
1 parent ef96ed9 commit 16d7bbf
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/drivers/pwm/pwm_gpio_loopback/socs/esp32_procpu.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*/

#include <zephyr/dt-bindings/pwm/pwm.h>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/gpio/espressif-esp32-gpio.h>

/ {
zephyr,user {
/* GPIO input pins order must match PWM pinctrl config */
gpios = <&gpio0 2 ESP32_GPIO_PIN_OUT_EN>,
<&gpio0 3 ESP32_GPIO_PIN_OUT_EN>;

pwms = <&ledc0 0 160000 PWM_POLARITY_NORMAL>,
<&ledc0 5 80000 PWM_POLARITY_INVERTED>;
};
};

&pinctrl {
ledc0_default: ledc0_default {
group1 {
pinmux = <LEDC_CH0_GPIO2>,
<LEDC_CH5_GPIO3>;
input-enable;
};
};
};

&ledc0 {
pinctrl-0 = <&ledc0_default>;
pinctrl-names = "default";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

channel0@0 {
reg = <0x0>;
timer = <0>;
};

channel5@5 {
reg = <0x5>;
timer = <1>;
};
};
48 changes: 48 additions & 0 deletions tests/drivers/pwm/pwm_gpio_loopback/socs/esp32c2.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*/

#include <zephyr/dt-bindings/pwm/pwm.h>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/gpio/espressif-esp32-gpio.h>

/ {
zephyr,user {
/* GPIO input pins order must match PWM pinctrl config */
gpios = <&gpio0 2 ESP32_GPIO_PIN_OUT_EN>,
<&gpio0 3 ESP32_GPIO_PIN_OUT_EN>;

pwms = <&ledc0 0 160000 PWM_POLARITY_NORMAL>,
<&ledc0 5 80000 PWM_POLARITY_INVERTED>;
};
};

&pinctrl {
ledc0_default: ledc0_default {
group1 {
pinmux = <LEDC_CH0_GPIO2>,
<LEDC_CH5_GPIO3>;
input-enable;
};
};
};

&ledc0 {
pinctrl-0 = <&ledc0_default>;
pinctrl-names = "default";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

channel0@0 {
reg = <0x0>;
timer = <0>;
};

channel5@5 {
reg = <0x5>;
timer = <1>;
};
};
48 changes: 48 additions & 0 deletions tests/drivers/pwm/pwm_gpio_loopback/socs/esp32c3.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*/

#include <zephyr/dt-bindings/pwm/pwm.h>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/gpio/espressif-esp32-gpio.h>

/ {
zephyr,user {
/* GPIO input pins order must match PWM pinctrl config */
gpios = <&gpio0 2 ESP32_GPIO_PIN_OUT_EN>,
<&gpio0 3 ESP32_GPIO_PIN_OUT_EN>;

pwms = <&ledc0 0 160000 PWM_POLARITY_NORMAL>,
<&ledc0 5 80000 PWM_POLARITY_INVERTED>;
};
};

&pinctrl {
ledc0_default: ledc0_default {
group1 {
pinmux = <LEDC_CH0_GPIO2>,
<LEDC_CH5_GPIO3>;
input-enable;
};
};
};

&ledc0 {
pinctrl-0 = <&ledc0_default>;
pinctrl-names = "default";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

channel0@0 {
reg = <0x0>;
timer = <0>;
};

channel5@5 {
reg = <0x5>;
timer = <1>;
};
};
48 changes: 48 additions & 0 deletions tests/drivers/pwm/pwm_gpio_loopback/socs/esp32c6.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*/

#include <zephyr/dt-bindings/pwm/pwm.h>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/gpio/espressif-esp32-gpio.h>

/ {
zephyr,user {
/* GPIO input pins order must match PWM pinctrl config */
gpios = <&gpio0 2 ESP32_GPIO_PIN_OUT_EN>,
<&gpio0 3 ESP32_GPIO_PIN_OUT_EN>;

pwms = <&ledc0 0 160000 PWM_POLARITY_NORMAL>,
<&ledc0 5 80000 PWM_POLARITY_INVERTED>;
};
};

&pinctrl {
ledc0_default: ledc0_default {
group1 {
pinmux = <LEDC_CH0_GPIO2>,
<LEDC_CH5_GPIO3>;
input-enable;
};
};
};

&ledc0 {
pinctrl-0 = <&ledc0_default>;
pinctrl-names = "default";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

channel0@0 {
reg = <0x0>;
timer = <0>;
};

channel5@5 {
reg = <0x5>;
timer = <1>;
};
};
48 changes: 48 additions & 0 deletions tests/drivers/pwm/pwm_gpio_loopback/socs/esp32s2.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*/

#include <zephyr/dt-bindings/pwm/pwm.h>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/gpio/espressif-esp32-gpio.h>

/ {
zephyr,user {
/* GPIO input pins order must match PWM pinctrl config */
gpios = <&gpio0 2 ESP32_GPIO_PIN_OUT_EN>,
<&gpio0 3 ESP32_GPIO_PIN_OUT_EN>;

pwms = <&ledc0 0 160000 PWM_POLARITY_NORMAL>,
<&ledc0 5 80000 PWM_POLARITY_INVERTED>;
};
};

&pinctrl {
ledc0_default: ledc0_default {
group1 {
pinmux = <LEDC_CH0_GPIO2>,
<LEDC_CH5_GPIO3>;
input-enable;
};
};
};

&ledc0 {
pinctrl-0 = <&ledc0_default>;
pinctrl-names = "default";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

channel0@0 {
reg = <0x0>;
timer = <0>;
};

channel5@5 {
reg = <0x5>;
timer = <1>;
};
};
48 changes: 48 additions & 0 deletions tests/drivers/pwm/pwm_gpio_loopback/socs/esp32s3_procpu.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*/

#include <zephyr/dt-bindings/pwm/pwm.h>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/gpio/espressif-esp32-gpio.h>

/ {
zephyr,user {
/* GPIO input pins order must match PWM pinctrl config */
gpios = <&gpio0 2 ESP32_GPIO_PIN_OUT_EN>,
<&gpio0 3 ESP32_GPIO_PIN_OUT_EN>;

pwms = <&ledc0 0 160000 PWM_POLARITY_NORMAL>,
<&ledc0 5 80000 PWM_POLARITY_INVERTED>;
};
};

&pinctrl {
ledc0_default: ledc0_default {
group1 {
pinmux = <LEDC_CH0_GPIO2>,
<LEDC_CH5_GPIO3>;
input-enable;
};
};
};

&ledc0 {
pinctrl-0 = <&ledc0_default>;
pinctrl-names = "default";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

channel0@0 {
reg = <0x0>;
timer = <0>;
};

channel5@5 {
reg = <0x5>;
timer = <1>;
};
};

0 comments on commit 16d7bbf

Please sign in to comment.