Skip to content

Commit

Permalink
drivers: mipi_dbi: mipi_dbi_spi: change reset pin polarity
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
danieldegrasse authored and henrikbrixandersen committed Feb 8, 2024
1 parent 801fbdd commit c734280
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion boards/arm/bl5340_dvk/bl5340_dvk_cpuapp_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/wio_terminal/wio_terminal.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
2 changes: 1 addition & 1 deletion boards/xtensa/esp_wrover_kit/esp_wrover_kit.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
2 changes: 1 addition & 1 deletion boards/xtensa/m5stack_core2/m5stack_core2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
4 changes: 2 additions & 2 deletions drivers/mipi_dbi/mipi_dbi_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions dts/bindings/mipi-dbi/zephyr,mipi-dbi-spi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c734280

Please sign in to comment.