Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert to MIPI DBI driver class #235

Merged
merged 3 commits into from
Jun 18, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@

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

&lcd_backlight_en {
enable-gpios = <&rpipico_header 13 GPIO_ACTIVE_HIGH>; /* GP13 */
&rpipico_spi_lcd {
pinctrl-0 = <&spi1_lcd>;
pinctrl-names = "default";
cs-gpios = <&rpipico_header 9 GPIO_ACTIVE_LOW>; /* GP9 */
};

&lcd_panel {
&mipi_dbi {
status = "okay";
reset-gpios = <&rpipico_header 12 GPIO_ACTIVE_LOW>; /* GP12 */
cmd-data-gpios = <&rpipico_header 8 GPIO_ACTIVE_LOW>; /* GP8 */
dc-gpios = <&rpipico_header 8 GPIO_ACTIVE_HIGH>; /* GP8 */
spi-dev = <&rpipico_spi_lcd>;
#address-cells = <1>;
#size-cells = <0>;
};

&rpipico_spi_lcd {
pinctrl-0 = <&spi1_lcd>;
pinctrl-names = "default";
cs-gpios = <&rpipico_header 9 GPIO_ACTIVE_LOW>; /* GP9 */
&lcd_panel {
status = "okay";
};

&lcd_backlight_en {
status = "okay";
enable-gpios = <&rpipico_header 13 GPIO_ACTIVE_HIGH>; /* GP13 */
};

&button_0 { /* GP15 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
*/

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

&rpipico_spi_lcd {
&mipi_dbi {
st7789v_135x240: st7789v@0 {
compatible = "sitronix,st7789v";
spi-max-frequency = <DT_FREQ_M(20)>;
mipi-max-frequency = <DT_FREQ_M(20)>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
reg = <0>;

status = "disabled";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
*/

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

&rpipico_spi_lcd {
&mipi_dbi {
st7789v_240x135: st7789v@0 {
compatible = "sitronix,st7789v";
spi-max-frequency = <DT_FREQ_M(20)>;
mipi-max-frequency = <DT_FREQ_M(20)>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
reg = <0>;

status = "disabled";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@

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

&lcd_backlight_en {
enable-gpios = <&rpipico_header 13 GPIO_ACTIVE_HIGH>; /* GP13 */
&rpipico_spi_lcd {
pinctrl-0 = <&spi1_lcd>;
pinctrl-names = "default";
cs-gpios = <&rpipico_header 9 GPIO_ACTIVE_LOW>; /* GP9 */
};

&lcd_panel {
&mipi_dbi {
status = "okay";
reset-gpios = <&rpipico_header 12 GPIO_ACTIVE_LOW>; /* GP12 */
cmd-data-gpios = <&rpipico_header 8 GPIO_ACTIVE_LOW>; /* GP8 */
dc-gpios = <&rpipico_header 8 GPIO_ACTIVE_HIGH>; /* GP8 */
spi-dev = <&rpipico_spi_lcd>;
#address-cells = <1>;
#size-cells = <0>;
};

&rpipico_spi_lcd {
pinctrl-0 = <&spi1_lcd>;
pinctrl-names = "default";
cs-gpios = <&rpipico_header 9 GPIO_ACTIVE_LOW>; /* GP9 */
&lcd_panel {
status = "okay";
};

&lcd_backlight_en {
status = "okay";
enable-gpios = <&rpipico_header 13 GPIO_ACTIVE_HIGH>; /* GP13 */
};

&button_0 { /* GP15 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
*/

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

&rpipico_spi_lcd {
&mipi_dbi {
st7789v_240x320: st7789v@0 {
compatible = "sitronix,st7789v";
spi-max-frequency = <DT_FREQ_M(20)>;
mipi-max-frequency = <DT_FREQ_M(20)>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
reg = <0>;

status = "disabled";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
*/

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

&rpipico_spi_lcd {
&mipi_dbi {
st7789v_320x240: st7789v@0 {
compatible = "sitronix,st7789v";
spi-max-frequency = <DT_FREQ_M(20)>;
mipi-max-frequency = <DT_FREQ_M(20)>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
reg = <0>;

status = "disabled";
Expand Down
4 changes: 4 additions & 0 deletions boards/shields/rpi_pico_lcd/waveshare_pico_lcd_1_14.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
zephyr,display = &lcd_panel;
};

mipi_dbi: mipi-dbi {
compatible = "zephyr,mipi-dbi-spi";
};

lcd_backlight_en: lcd-backlight-en {
compatible = "regulator-fixed";
regulator-name = "lcd_backlight_enable";
Expand Down
4 changes: 4 additions & 0 deletions boards/shields/rpi_pico_lcd/waveshare_pico_lcd_2.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
zephyr,display = &lcd_panel;
};

mipi_dbi: mipi-dbi {
compatible = "zephyr,mipi-dbi-spi";
};

lcd_backlight_en: lcd-backlight-en {
compatible = "regulator-fixed";
regulator-name = "lcd_backlight_enable";
Expand Down
78 changes: 46 additions & 32 deletions boards/waveshare/rp2040/rpigeek_lcd_st7789v.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,68 @@

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

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

mipi_dbi_st7789v_240x135: mipi-dbi-st7789v-240x135 {
compatible = "zephyr,mipi-dbi-spi";
status = "okay";

reset-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
dc-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
spi-dev = <&spi1>;

#address-cells = <1>;
#size-cells = <0>;

/* LCD with ST7789V controller. */
st7789v_240x135: st7789v@0 {
compatible = "sitronix,st7789v";
status = "okay";

reg = <0>;
mipi-max-frequency = <DT_FREQ_M(20)>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;

width = <240>;
height = <135>;
x-offset = <40>;
y-offset = <53>;

vcom = <0x19>;
gctrl = <0x35>;
vrhs = <0x12>;
vdvs = <0x20>;
mdac = <0x70>;
gamma = <0x01>;
colmod = <0x05>;
lcm = <0x2C>;
porch-param = [0C 0C 00 33 33];
cmd2en-param = [5A 69 02 01];
pwctrl1-param = [A4 A1];
pvgam-param = [D0 04 0D 11 13 2B 3F 54 4C 18 0D 0B 1F 23];
nvgam-param = [D0 04 0C 11 13 2C 3F 44 51 2F 1F 1F 20 23];
ram-param = [00 F0];
rgb-param = [CD 08 14];
};
};
};

lcd_panel: &st7789v_240x135 {};

&spi1 {
status = "okay";
pinctrl-0 = <&spi1_lcd>;
pinctrl-names = "default";

clock-frequency = <DT_FREQ_M(20)>;
cs-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;

/* LCD with ST7789V controller. */
st7789v_240x135: st7789v@0 {
compatible = "sitronix,st7789v";
reg = <0>;
status = "okay";
reset-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
cmd-data-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
width = <240>;
height = <135>;
x-offset = <40>;
y-offset = <53>;
vcom = <0x19>;
gctrl = <0x35>;
vrhs = <0x12>;
vdvs = <0x20>;
mdac = <0x70>;
gamma = <0x01>;
colmod = <0x05>;
lcm = <0x2C>;
porch-param = [0C 0C 00 33 33];
cmd2en-param = [5A 69 02 01];
pwctrl1-param = [A4 A1];
pvgam-param = [D0 04 0D 11 13 2B 3F 54 4C 18 0D 0B 1F 23];
nvgam-param = [D0 04 0C 11 13 2C 3F 44 51 2F 1F 1F 20 23];
ram-param = [00 F0];
rgb-param = [CD 08 14];

spi-max-frequency = <DT_FREQ_M(20)>;
};
};

lcd_panel: &st7789v_240x135 {};

&gpio0 {
status = "okay";
};
85 changes: 50 additions & 35 deletions boards/waveshare/rp2040/rpipico_lcd_st7735s.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,72 @@

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

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

mipi_dbi_st7735s_160x80: mipi-dbi-st7735s-160x80 {
compatible = "zephyr,mipi-dbi-spi";
status = "okay";

reset-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
dc-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
spi-dev = <&spi1>;

#address-cells = <1>;
#size-cells = <0>;

/* LCD with ST7735S controller can use with ST7735R driver. */
st7735s_160x80: st7735s@0 {
compatible = "sitronix,st7735r";
status = "okay";

reg = <0>;
mipi-max-frequency = <DT_FREQ_M(20)>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;

width = <160>;
height = <80>;
x-offset = <1>;
y-offset = <26>;

inversion-on;
rgb-is-inverted;

pwctr1 = [62 02 04];
pwctr2 = [C0];
pwctr3 = [0D 00];
pwctr4 = [8D 6A];
pwctr5 = [8D EE];
vmctr1 = <0x0E>;
frmctr1 = [05 3A 3A];
frmctr2 = [05 3A 3A];
frmctr3 = [05 3A 3A 05 3A 3A];
invctr = <0x03>;
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 = <0x05>;
madctl = <0xA8>; /* rotated: madctl = <0x78>; */
caset = [00 01 00 A0];
raset = [00 1A 00 69];
};
};
};

lcd_panel: &st7735s_160x80 {};

&spi1 {
status = "okay";
pinctrl-0 = <&spi1_lcd>;
pinctrl-names = "default";

clock-frequency = <DT_FREQ_M(20)>;
cs-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;

/* LCD with ST7735S controller can use with ST7735R driver. */
st7735s_160x80: st7735s@0 {
compatible = "sitronix,st7735r";
reg = <0>;
status = "okay";
reset-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
cmd-data-gpios = <&gpio0 8 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];
vmctr1 = <0x0E>;
frmctr1 = [05 3A 3A];
frmctr2 = [05 3A 3A];
frmctr3 = [05 3A 3A 05 3A 3A];
invctr = <0x03>;
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 = <0x05>;
madctl = <0xA8>; /* rotated: madctl = <0x78>; */
caset = [00 01 00 A0];
raset = [00 1A 00 69];

spi-max-frequency = <DT_FREQ_M(20)>;
};
};

lcd_panel: &st7735s_160x80 {};

&gpio0 {
status = "okay";
};
3 changes: 3 additions & 0 deletions doc/bridle/releases/release-notes-3.7.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ Take over the new build principles from Zephyr:
* tbd.
* tbd.
* tbd.
* Use the new upstream *MIPI DBI driver class* for all *ST7735R* based displays.
* Use the new upstream *MIPI DBI driver class* for all *ST7789V* based displays.
* Convert all Bridle *boards* and *SoCs* to the **new Hardware Model v2**.
* Hook up ``board.cmake`` in Bridle's board extension folder.
* Hook up ``Kconfig.defconfig`` in Bridle's board extension folder.
Expand Down Expand Up @@ -204,6 +206,7 @@ Issue Related Items

These GitHub issues were addressed since project bootstrapping:

* :github:`234` - [BUG] boards and shields with LCD do not support the new MIPI-DBI mode
* :github:`231` - [BUG] build Zephyr docset fails
* :github:`229` - [BUG] magpie_f777ni: wdt_basic_api/drivers.watchdog.stm32wwdg FAILED
* :github:`227` - [BUG] Unable to build any application referencing bridle version information
Expand Down
Loading