Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 35 additions & 25 deletions boards/shields/st7735r/st7735r_ada_160x128.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,48 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>

/ {
chosen {
zephyr,display = &st7735r_st7735r_ada_160x128;
};

mipi_dbi_st7735r_ada_160x128 {
compatible = "zephyr,mipi-dbi-spi";
spi-dev = <&arduino_spi>;
dc-gpios = <&arduino_header 15 GPIO_ACTIVE_HIGH>; /* D9 */
reset-gpios = <&arduino_header 14 GPIO_ACTIVE_LOW>; /* D8 */
#address-cells = <1>;
#size-cells = <0>;

st7735r_st7735r_ada_160x128: st7735r@0 {
compatible = "sitronix,st7735r";
mipi-max-frequency = <20000000>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
reg = <0>;
width = <160>;
height = <128>;
x-offset = <0>;
y-offset = <0>;
madctl = <0x60>;
colmod = <0x55>;
vmctr1 = <0x0e>;
pwctr1 = [a2 02 84];
pwctr2 = [c5];
pwctr3 = [0a 00];
pwctr4 = [8a 2a];
pwctr5 = [8a ee];
frmctr1 = [01 2c 2d];
frmctr2 = [01 2c 2d];
frmctr3 = [01 2c 2d 01 2c 2d];
gamctrp1 = [02 1c 07 12 37 32 29 2d 29 25 2b 39 00 01 03 10];
gamctrn1 = [03 1d 07 06 2e 2c 29 2d 2e 2e 37 3f 00 00 02 10];
};
};
};

&arduino_spi {
status = "okay";
cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */

st7735r_st7735r_ada_160x128: st7735r@0 {
compatible = "sitronix,st7735r";
spi-max-frequency = <20000000>;
reg = <0>;
cmd-data-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>; /* D9 */
reset-gpios = <&arduino_header 14 GPIO_ACTIVE_LOW>; /* D8 */
width = <160>;
height = <128>;
x-offset = <0>;
y-offset = <0>;
madctl = <0x60>;
colmod = <0x55>;
vmctr1 = <0x0e>;
pwctr1 = [a2 02 84];
pwctr2 = [c5];
pwctr3 = [0a 00];
pwctr4 = [8a 2a];
pwctr5 = [8a ee];
frmctr1 = [01 2c 2d];
frmctr2 = [01 2c 2d];
frmctr3 = [01 2c 2d 01 2c 2d];
gamctrp1 = [02 1c 07 12 37 32 29 2d 29 25 2b 39 00 01 03 10];
gamctrn1 = [03 1d 07 06 2e 2c 29 2d 2e 2e 37 3f 00 00 02 10];
};
};
80 changes: 45 additions & 35 deletions boards/sipeed/longan_nano/longan_nano-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>

/ {
chosen {
Expand Down Expand Up @@ -65,6 +66,50 @@
sw0 = &button_boot0;
watchdog0 = &fwdgt;
};

mipi_dbi {
compatible = "zephyr,mipi-dbi-spi";
reset-gpios = <&gpiob 1 GPIO_ACTIVE_LOW>;
dc-gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>;
spi-dev = <&spi0>;
write-only;
#address-cells = <1>;
#size-cells = <0>;

/* longan nano has LCD with st7735s controller.
* It can use with st7735r driver.
*/
lcd0: lcd@0 {
compatible = "sitronix,st7735r";
reg = <0>;
status = "okay";
width = <160>;
height = <80>;
inversion-on;
rgb-is-inverted;
x-offset = <1>;
y-offset = <26>;
pwctr1 = [62 02 04];
pwctr2 = [C0];
pwctr3 = [0D 00];
pwctr4 = [8D 6A];
pwctr5 = [8D EE];
invctr = <3>;
frmctr1 = [05 3A 3A];
frmctr2 = [05 3A 3A];
frmctr3 = [05 3A 3A 05 3A 3A];
vmctr1 = <14>;
gamctrp1 = [10 0E 02 03 0E 07 02 07 0A 12 27 37 00 0D 0E 10];
gamctrn1 = [10 0E 03 03 0F 06 02 08 0A 13 26 36 00 0D 0E 10];
colmod = <5>;
madctl = <120>;
caset = [00 01 00 a0];
raset = [00 1a 00 69];

mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-max-frequency = <4000000>;
};
};
};

&gpioa {
Expand Down Expand Up @@ -109,41 +154,6 @@
pinctrl-names = "default";

cs-gpios = <&gpiob 2 GPIO_ACTIVE_LOW>;

/* longan nano has LCD with st7735s controller.
* It can use with st7735r driver.
*/
lcd0: lcd@0 {
compatible = "sitronix,st7735r";
reg = <0>;
status = "okay";
reset-gpios = <&gpiob 1 GPIO_ACTIVE_LOW>;
cmd-data-gpios = <&gpiob 0 GPIO_ACTIVE_LOW>;
width = <160>;
height = <80>;
inversion-on;
rgb-is-inverted;
x-offset = <1>;
y-offset = <26>;
pwctr1 = [62 02 04];
pwctr2 = [C0];
pwctr3 = [0D 00];
pwctr4 = [8D 6A];
pwctr5 = [8D EE];
invctr = <3>;
frmctr1 = [05 3A 3A];
frmctr2 = [05 3A 3A];
frmctr3 = [05 3A 3A 05 3A 3A];
vmctr1 = <14>;
gamctrp1 = [10 0E 02 03 0E 07 02 07 0A 12 27 37 00 0D 0E 10];
gamctrn1 = [10 0E 03 03 0F 06 02 08 0A 13 26 36 00 0D 0E 10];
colmod = <5>;
madctl = <120>;
caset = [00 01 00 a0];
raset = [00 1a 00 69];

spi-max-frequency = <4000000>;
};
};

&spi1 {
Expand Down
43 changes: 43 additions & 0 deletions doc/releases/migration-guide-3.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,49 @@ Controller Area Network (CAN)
Display
=======

* ST7735R based displays now use the MIPI DBI driver class. These displays
must now be declared within a MIPI DBI driver wrapper device, which will
manage interfacing with the display. Note that the `cmd-data-gpios` pin has
changed polarity with this update, to align better with the new
`dc-gpios` name. For an example, see below:

.. code-block:: devicetree

/* Legacy ST7735R display definition */
&spi0 {
st7735r: st7735r@0 {
compatible = "sitronix,st7735r";
reg = <0>;
spi-max-frequency = <32000000>;
reset-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
cmd-data-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
...
};
};

/* New display definition with MIPI DBI device */

#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>

...

mipi_dbi {
compatible = "zephyr,mipi-dbi-spi";
reset-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
dc-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
spi-dev = <&spi0>;
#address-cells = <1>;
#size-cells = <0>;

st7735r: st7735r@0 {
compatible = "sitronix,st7735r";
reg = <0>;
mipi-max-frequency = <32000000>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
...
};
};

Enhanced Serial Peripheral Interface (eSPI)
===========================================

Expand Down
2 changes: 1 addition & 1 deletion drivers/display/Kconfig.st7735r
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ config ST7735R
bool "ST7735R/ST7735S display driver"
default y
depends on DT_HAS_SITRONIX_ST7735R_ENABLED
select SPI
select MIPI_DBI
help
Enable driver for ST7735R/ST7735S display driver.
Loading