From c73428062d4952665573d6e39d02ead59f287be9 Mon Sep 17 00:00:00 2001 From: Daniel DeGrasse Date: Mon, 5 Feb 2024 09:42:37 -0600 Subject: [PATCH] drivers: mipi_dbi: mipi_dbi_spi: change reset pin polarity Change reset pin polarity for MIPI DBI SPI controller, so that the board devicetree is responsible for setting the GPIO to active low, and the driver always sets the pin to a logic 1 to reset the display. Fixes #68562 Signed-off-by: Daniel DeGrasse --- boards/arm/bl5340_dvk/bl5340_dvk_cpuapp_common.dtsi | 2 +- boards/arm/wio_terminal/wio_terminal.dts | 2 +- .../buydisplay_2_8_tft_touch_arduino.overlay | 2 +- .../buydisplay_3_5_tft_touch_arduino.overlay | 2 +- boards/xtensa/esp_wrover_kit/esp_wrover_kit.dts | 2 +- boards/xtensa/m5stack_core2/m5stack_core2.dts | 2 +- drivers/mipi_dbi/mipi_dbi_spi.c | 4 ++-- dts/bindings/mipi-dbi/zephyr,mipi-dbi-spi.yaml | 3 +-- 8 files changed, 9 insertions(+), 10 deletions(-) diff --git a/boards/arm/bl5340_dvk/bl5340_dvk_cpuapp_common.dtsi b/boards/arm/bl5340_dvk/bl5340_dvk_cpuapp_common.dtsi index 5a748b1bf9..7b51c398c9 100644 --- a/boards/arm/bl5340_dvk/bl5340_dvk_cpuapp_common.dtsi +++ b/boards/arm/bl5340_dvk/bl5340_dvk_cpuapp_common.dtsi @@ -110,7 +110,7 @@ mipi_dbi { compatible = "zephyr,mipi-dbi-spi"; - reset-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; dc-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; spi-dev = <&spi2>; write-only; diff --git a/boards/arm/wio_terminal/wio_terminal.dts b/boards/arm/wio_terminal/wio_terminal.dts index a88eeee9e9..42df242515 100644 --- a/boards/arm/wio_terminal/wio_terminal.dts +++ b/boards/arm/wio_terminal/wio_terminal.dts @@ -128,7 +128,7 @@ mipi_dbi { compatible = "zephyr,mipi-dbi-spi"; dc-gpios = <&portc 6 GPIO_ACTIVE_HIGH>; - reset-gpios = <&portc 7 GPIO_ACTIVE_HIGH>; + reset-gpios = <&portc 7 GPIO_ACTIVE_LOW>; #address-cells = <1>; #size-cells = <0>; spi-dev = <&sercom7>; diff --git a/boards/shields/buydisplay_2_8_tft_touch_arduino/buydisplay_2_8_tft_touch_arduino.overlay b/boards/shields/buydisplay_2_8_tft_touch_arduino/buydisplay_2_8_tft_touch_arduino.overlay index 162b145011..dcc87b2c62 100644 --- a/boards/shields/buydisplay_2_8_tft_touch_arduino/buydisplay_2_8_tft_touch_arduino.overlay +++ b/boards/shields/buydisplay_2_8_tft_touch_arduino/buydisplay_2_8_tft_touch_arduino.overlay @@ -22,7 +22,7 @@ buydisplay_2_8_tft_touch_arduino_mipi_dbi { compatible = "zephyr,mipi-dbi-spi"; dc-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>; /* D7 */ - reset-gpios = <&arduino_header 16 GPIO_ACTIVE_HIGH>; /* D10 */ + reset-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */ spi-dev = <&arduino_spi>; write-only; #address-cells = <1>; diff --git a/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay b/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay index 0ba02cb564..67b679f124 100644 --- a/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay +++ b/boards/shields/buydisplay_3_5_tft_touch_arduino/buydisplay_3_5_tft_touch_arduino.overlay @@ -22,7 +22,7 @@ buydisplay_3_5_tft_touch_arduino_mipi_dbi { compatible = "zephyr,mipi-dbi-spi"; dc-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>; /* D7 */ - reset-gpios = <&arduino_header 16 GPIO_ACTIVE_HIGH>; /* D10 */ + reset-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */ spi-dev = <&arduino_spi>; write-only; #address-cells = <1>; diff --git a/boards/xtensa/esp_wrover_kit/esp_wrover_kit.dts b/boards/xtensa/esp_wrover_kit/esp_wrover_kit.dts index f738503760..3a31d745d6 100644 --- a/boards/xtensa/esp_wrover_kit/esp_wrover_kit.dts +++ b/boards/xtensa/esp_wrover_kit/esp_wrover_kit.dts @@ -74,7 +74,7 @@ mipi_dbi { compatible = "zephyr,mipi-dbi-spi"; dc-gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>; - reset-gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; spi-dev = <&spi3>; write-only; #address-cells = <1>; diff --git a/boards/xtensa/m5stack_core2/m5stack_core2.dts b/boards/xtensa/m5stack_core2/m5stack_core2.dts index c8c56b75ff..17cbe3fe63 100644 --- a/boards/xtensa/m5stack_core2/m5stack_core2.dts +++ b/boards/xtensa/m5stack_core2/m5stack_core2.dts @@ -52,7 +52,7 @@ mipi_dbi { compatible = "zephyr,mipi-dbi-spi"; dc-gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; - reset-gpios = <&axp192_gpio 4 (GPIO_OPEN_DRAIN | GPIO_ACTIVE_HIGH)>; + reset-gpios = <&axp192_gpio 4 (GPIO_OPEN_DRAIN | GPIO_ACTIVE_LOW)>; spi-dev = <&spi3>; write-only; #address-cells = <1>; diff --git a/drivers/mipi_dbi/mipi_dbi_spi.c b/drivers/mipi_dbi/mipi_dbi_spi.c index bf1c1388e1..87456868e0 100644 --- a/drivers/mipi_dbi/mipi_dbi_spi.c +++ b/drivers/mipi_dbi/mipi_dbi_spi.c @@ -251,12 +251,12 @@ static int mipi_dbi_spi_reset(const struct device *dev, uint32_t delay) return -ENOTSUP; } - ret = gpio_pin_set_dt(&config->reset, 0); + ret = gpio_pin_set_dt(&config->reset, 1); if (ret < 0) { return ret; } k_msleep(delay); - return gpio_pin_set_dt(&config->reset, 1); + return gpio_pin_set_dt(&config->reset, 0); } static int mipi_dbi_spi_init(const struct device *dev) diff --git a/dts/bindings/mipi-dbi/zephyr,mipi-dbi-spi.yaml b/dts/bindings/mipi-dbi/zephyr,mipi-dbi-spi.yaml index 06ca9a2f46..b06ba5fb8e 100644 --- a/dts/bindings/mipi-dbi/zephyr,mipi-dbi-spi.yaml +++ b/dts/bindings/mipi-dbi/zephyr,mipi-dbi-spi.yaml @@ -25,8 +25,7 @@ properties: reset-gpios: type: phandle-array description: | - Reset GPIO pin. Used to reset the display during initialization. - Active low pin. + Reset GPIO pin. Set high to reset the display write-only: type: boolean