diff --git a/boards/adafruit/feather_esp32s2/Kconfig.defconfig b/boards/adafruit/feather_esp32s2/Kconfig.defconfig index 6b7701b885fa0..a1134a44a3717 100644 --- a/boards/adafruit/feather_esp32s2/Kconfig.defconfig +++ b/boards/adafruit/feather_esp32s2/Kconfig.defconfig @@ -5,10 +5,6 @@ if BOARD_ADAFRUIT_FEATHER_ESP32S2_TFT || BOARD_ADAFRUIT_FEATHER_ESP32S2_TFT_REVE if DISPLAY -choice ST7789V_PIXEL_FORMAT - default ST7789V_RGB565 -endchoice - if LVGL choice LV_COLOR_DEPTH diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft.dts b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft.dts index ae11a9e49b504..8f9b2d12ca2c3 100644 --- a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft.dts +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft.dts @@ -6,6 +6,7 @@ /dts-v1/; +#include #include "adafruit_feather_esp32s2_common.dtsi" #include "feather_connector_tft.dtsi" @@ -71,7 +72,7 @@ vdvs = <0x20>; mdac = <0x08>; gamma = <0x01>; - colmod = <0x55>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.dts b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.dts index 037147ae9ab7c..73bb420724e5d 100644 --- a/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.dts +++ b/boards/adafruit/feather_esp32s2/adafruit_feather_esp32s2_tft_reverse.dts @@ -6,6 +6,7 @@ /dts-v1/; +#include #include "adafruit_feather_esp32s2_common.dtsi" #include "feather_connector.dtsi" @@ -85,7 +86,7 @@ vdvs = <0x20>; mdac = <0x08>; gamma = <0x01>; - colmod = <0x55>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/adafruit/feather_esp32s3_tft/Kconfig.defconfig b/boards/adafruit/feather_esp32s3_tft/Kconfig.defconfig index 1b9c72242bc83..a136d2553fffc 100644 --- a/boards/adafruit/feather_esp32s3_tft/Kconfig.defconfig +++ b/boards/adafruit/feather_esp32s3_tft/Kconfig.defconfig @@ -8,10 +8,6 @@ if DISPLAY config BOARD_ADAFRUIT_FEATHER_ESP32S3_TFT select BOARD_LATE_INIT_HOOK -choice ST7789V_PIXEL_FORMAT - default ST7789V_RGB565 -endchoice - if LVGL choice LV_COLOR_DEPTH diff --git a/boards/adafruit/feather_esp32s3_tft/adafruit_feather_esp32s3_tft_procpu.dts b/boards/adafruit/feather_esp32s3_tft/adafruit_feather_esp32s3_tft_procpu.dts index 3295356dbf665..48f15f5a297cc 100644 --- a/boards/adafruit/feather_esp32s3_tft/adafruit_feather_esp32s3_tft_procpu.dts +++ b/boards/adafruit/feather_esp32s3_tft/adafruit_feather_esp32s3_tft_procpu.dts @@ -14,6 +14,7 @@ #include #include "feather_connector.dtsi" #include "adafruit_feather_esp32s3_tft-pinctrl.dtsi" +#include / { model = "Adafruit Feather ESP32S3 TFT PROCPU"; @@ -110,7 +111,7 @@ vdvs = <0x20>; mdac = <0x08>; gamma = <0x01>; - colmod = <0x55>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/adafruit/feather_esp32s3_tft_reverse/Kconfig.defconfig b/boards/adafruit/feather_esp32s3_tft_reverse/Kconfig.defconfig index c366b120d6843..12907c35c5641 100644 --- a/boards/adafruit/feather_esp32s3_tft_reverse/Kconfig.defconfig +++ b/boards/adafruit/feather_esp32s3_tft_reverse/Kconfig.defconfig @@ -9,10 +9,6 @@ if DISPLAY config BOARD_ADAFRUIT_FEATHER_ESP32S3_TFT_REVERSE select BOARD_LATE_INIT_HOOK -choice ST7789V_PIXEL_FORMAT - default ST7789V_RGB565 -endchoice - if LVGL choice LV_COLOR_DEPTH diff --git a/boards/adafruit/feather_esp32s3_tft_reverse/adafruit_feather_esp32s3_tft_reverse_procpu.dts b/boards/adafruit/feather_esp32s3_tft_reverse/adafruit_feather_esp32s3_tft_reverse_procpu.dts index 5e3ec0ec24a9b..90bf1cbacc757 100644 --- a/boards/adafruit/feather_esp32s3_tft_reverse/adafruit_feather_esp32s3_tft_reverse_procpu.dts +++ b/boards/adafruit/feather_esp32s3_tft_reverse/adafruit_feather_esp32s3_tft_reverse_procpu.dts @@ -14,6 +14,7 @@ #include #include "feather_connector.dtsi" #include "adafruit_feather_esp32s3_tft_reverse-pinctrl.dtsi" +#include / { model = "Adafruit ESP32-S3 Reverse TFT Feather PROCPU"; @@ -128,7 +129,7 @@ vdvs = <0x20>; mdac = <0x08>; gamma = <0x01>; - colmod = <0x55>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/alientek/dnesp32s3b/dnesp32s3b_procpu.dts b/boards/alientek/dnesp32s3b/dnesp32s3b_procpu.dts index 834e7658e68cd..0707b8a0f74ea 100644 --- a/boards/alientek/dnesp32s3b/dnesp32s3b_procpu.dts +++ b/boards/alientek/dnesp32s3b/dnesp32s3b_procpu.dts @@ -8,6 +8,7 @@ #include #include #include "dnesp32s3b-pinctrl.dtsi" +#include / { model = "DNESP32S3B PROCPU"; @@ -156,7 +157,7 @@ gctrl = <0x35>; mdac = <0x60>; /* RGB order, swap XY, mirror X */ lcm = <0x2c>; - colmod = <0x55>; /* RGB565 16bit */ + pixel-format = ; gamma = <0x01>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/espressif/esp32s3_eye/esp32s3_eye_procpu.dts b/boards/espressif/esp32s3_eye/esp32s3_eye_procpu.dts index 9d9e0f6d34347..0351d1b9a53ef 100644 --- a/boards/espressif/esp32s3_eye/esp32s3_eye_procpu.dts +++ b/boards/espressif/esp32s3_eye/esp32s3_eye_procpu.dts @@ -11,6 +11,7 @@ #include #include #include +#include / { model = "Espressif ESP32S3-EYE PROCPU"; @@ -104,7 +105,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x55>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/fanke/fk750m1_vbt6/fk750m1_vbt6.dts b/boards/fanke/fk750m1_vbt6/fk750m1_vbt6.dts index 7792ea0dfdd6b..22d792e406fbb 100644 --- a/boards/fanke/fk750m1_vbt6/fk750m1_vbt6.dts +++ b/boards/fanke/fk750m1_vbt6/fk750m1_vbt6.dts @@ -10,6 +10,7 @@ #include #include #include +#include / { model = "FANKE FK750M1-VBT6 board"; @@ -57,7 +58,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x05>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/fobe/quill_nrf52840_mesh/quill_nrf52840_mesh_common.dtsi b/boards/fobe/quill_nrf52840_mesh/quill_nrf52840_mesh_common.dtsi index b9470bd9f8c80..2677e406055f5 100644 --- a/boards/fobe/quill_nrf52840_mesh/quill_nrf52840_mesh_common.dtsi +++ b/boards/fobe/quill_nrf52840_mesh/quill_nrf52840_mesh_common.dtsi @@ -12,6 +12,7 @@ #include #include "quill_nrf52840_mesh-pinctrl.dtsi" #include "fobe_quill_connector.dtsi" +#include / { chosen { @@ -81,7 +82,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x05>; + pixel-format = ; lcm = <0x2c>; porch-param = [05 05 00 33 33]; cmd2en-param = [5a 69 02 00]; diff --git a/boards/lilygo/twatch_s3/Kconfig.defconfig b/boards/lilygo/twatch_s3/Kconfig.defconfig index c8b14cc5e4e2f..3d47d11ebdcdb 100644 --- a/boards/lilygo/twatch_s3/Kconfig.defconfig +++ b/boards/lilygo/twatch_s3/Kconfig.defconfig @@ -3,10 +3,6 @@ if DISPLAY -choice ST7789V_PIXEL_FORMAT - default ST7789V_RGB565X -endchoice - if LVGL config LV_COLOR_16_SWAP diff --git a/boards/lilygo/twatch_s3/twatch_s3_procpu.dts b/boards/lilygo/twatch_s3/twatch_s3_procpu.dts index 5ae55e124baa1..a11b9ba9b9a5e 100644 --- a/boards/lilygo/twatch_s3/twatch_s3_procpu.dts +++ b/boards/lilygo/twatch_s3/twatch_s3_procpu.dts @@ -9,6 +9,7 @@ #include "twatch_s3-pinctrl.dtsi" #include #include +#include / { model = "T-Watch S3 PROCPU"; @@ -55,7 +56,7 @@ y-offset = <80>; mdac = <0xc8>; ram-param = [00 e0]; - colmod = <0x55>; + pixel-format = ; porch-param = [0c 0c 00 33 33]; gctrl = <0x35>; vcom = <0x28>; diff --git a/boards/m5stack/m5stack_atoms3/m5stack_atoms3_procpu.dts b/boards/m5stack/m5stack_atoms3/m5stack_atoms3_procpu.dts index 5d8684322f935..0163ed1c6e455 100644 --- a/boards/m5stack/m5stack_atoms3/m5stack_atoms3_procpu.dts +++ b/boards/m5stack/m5stack_atoms3/m5stack_atoms3_procpu.dts @@ -11,6 +11,7 @@ #include #include #include +#include / { model = "M5Stack AtomS3 PROCPU"; @@ -76,7 +77,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x55>; + pixel-format = ; lcm = <0x0c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 00]; diff --git a/boards/m5stack/m5stickc_plus/m5stickc_plus_procpu.dts b/boards/m5stack/m5stickc_plus/m5stickc_plus_procpu.dts index 426cb6973a3ca..6ce55f0c443db 100644 --- a/boards/m5stack/m5stickc_plus/m5stickc_plus_procpu.dts +++ b/boards/m5stack/m5stickc_plus/m5stickc_plus_procpu.dts @@ -11,6 +11,7 @@ #include #include #include +#include / { model = "M5StickC Plus PROCPU"; @@ -88,7 +89,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x55>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 00]; diff --git a/boards/pine64/pinetime_devkit0/pinetime_devkit0.dts b/boards/pine64/pinetime_devkit0/pinetime_devkit0.dts index eafed89a9142c..9ba5bf62be8f9 100644 --- a/boards/pine64/pinetime_devkit0/pinetime_devkit0.dts +++ b/boards/pine64/pinetime_devkit0/pinetime_devkit0.dts @@ -13,6 +13,7 @@ #include "pinetime_devkit0-pinctrl.dtsi" #include #include +#include / { model = "Pine64 PineTime DevKit0"; @@ -104,7 +105,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x05>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/shields/m5stack_cardputer/Kconfig.defconfig b/boards/shields/m5stack_cardputer/Kconfig.defconfig index 6912142ae56b3..a122b6b71a047 100644 --- a/boards/shields/m5stack_cardputer/Kconfig.defconfig +++ b/boards/shields/m5stack_cardputer/Kconfig.defconfig @@ -8,10 +8,6 @@ config INPUT if DISPLAY -choice ST7789V_PIXEL_FORMAT - default ST7789V_RGB565 -endchoice - if LVGL choice LV_COLOR_DEPTH diff --git a/boards/shields/m5stack_cardputer/m5stack_cardputer.overlay b/boards/shields/m5stack_cardputer/m5stack_cardputer.overlay index eedec0175646a..32f2cc158a224 100644 --- a/boards/shields/m5stack_cardputer/m5stack_cardputer.overlay +++ b/boards/shields/m5stack_cardputer/m5stack_cardputer.overlay @@ -4,6 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include + / { zephyr,user { io-channels = <&adc0 9>; @@ -42,7 +44,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x55>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 00]; diff --git a/boards/shields/st7789v_generic/Kconfig.defconfig b/boards/shields/st7789v_generic/Kconfig.defconfig index b28cf38f78cf5..d65001c4e73a8 100644 --- a/boards/shields/st7789v_generic/Kconfig.defconfig +++ b/boards/shields/st7789v_generic/Kconfig.defconfig @@ -5,11 +5,6 @@ if SHIELD_ST7789V_TL019FQV01 || SHIELD_ST7789V_WAVESHARE_240X240 if DISPLAY -choice ST7789V_PIXEL_FORMAT - default ST7789V_RGB888 if SHIELD_ST7789V_TL019FQV01 - default ST7789V_RGB565 if SHIELD_ST7789V_WAVESHARE_240X240 -endchoice - if LVGL config LV_Z_BITS_PER_PIXEL diff --git a/boards/shields/st7789v_generic/st7789v_tl019fqv01.overlay b/boards/shields/st7789v_generic/st7789v_tl019fqv01.overlay index 64ad7436769a6..c21ef60338449 100644 --- a/boards/shields/st7789v_generic/st7789v_tl019fqv01.overlay +++ b/boards/shields/st7789v_generic/st7789v_tl019fqv01.overlay @@ -5,6 +5,7 @@ */ #include #include +#include / { chosen { @@ -34,7 +35,7 @@ vdvs = <0x20>; mdac = <0x60>; gamma = <0x01>; - colmod = <0x55>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/shields/st7789v_generic/st7789v_waveshare_240x240.overlay b/boards/shields/st7789v_generic/st7789v_waveshare_240x240.overlay index 93f9e0d76406e..ec0cf03c6c56a 100644 --- a/boards/shields/st7789v_generic/st7789v_waveshare_240x240.overlay +++ b/boards/shields/st7789v_generic/st7789v_waveshare_240x240.overlay @@ -7,6 +7,7 @@ #include #include +#include / { chosen { @@ -36,7 +37,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x05>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/shields/waveshare_pico_lcd_1_14/Kconfig.defconfig b/boards/shields/waveshare_pico_lcd_1_14/Kconfig.defconfig index 4d2eca39a40eb..be56bcfc6cce3 100644 --- a/boards/shields/waveshare_pico_lcd_1_14/Kconfig.defconfig +++ b/boards/shields/waveshare_pico_lcd_1_14/Kconfig.defconfig @@ -5,10 +5,6 @@ if SHIELD_WAVESHARE_PICO_LCD_1_14 || SHIELD_WAVESHARE_PICO_LCD_1_14_DISPLAY if DISPLAY -choice ST7789V_PIXEL_FORMAT - default ST7789V_RGB565 -endchoice - if LVGL config LV_DPI_DEF diff --git a/boards/shields/waveshare_pico_lcd_1_14/waveshare_pico_lcd_1_14_display.overlay b/boards/shields/waveshare_pico_lcd_1_14/waveshare_pico_lcd_1_14_display.overlay index 674101776aa77..b0e31dc4c045f 100644 --- a/boards/shields/waveshare_pico_lcd_1_14/waveshare_pico_lcd_1_14_display.overlay +++ b/boards/shields/waveshare_pico_lcd_1_14/waveshare_pico_lcd_1_14_display.overlay @@ -6,6 +6,7 @@ #include #include +#include / { chosen { @@ -38,7 +39,7 @@ vdvs = <0x20>; mdac = <0x77>; gamma = <0x00>; - colmod = <0x05>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 00]; diff --git a/boards/st/stm32h573i_dk/Kconfig.defconfig b/boards/st/stm32h573i_dk/Kconfig.defconfig index 6ee413ec4d2ca..f3177bbfde28e 100644 --- a/boards/st/stm32h573i_dk/Kconfig.defconfig +++ b/boards/st/stm32h573i_dk/Kconfig.defconfig @@ -15,10 +15,6 @@ configdefault SDMMC_STM32_CLOCK_CHECK if DISPLAY -choice ST7789V_PIXEL_FORMAT - default ST7789V_RGB565X -endchoice - # Required to enable LCD backlight config REGULATOR default y diff --git a/boards/st/stm32h573i_dk/stm32h573i_dk-common.dtsi b/boards/st/stm32h573i_dk/stm32h573i_dk-common.dtsi index 99788f9b4b1d2..32912087b23a0 100644 --- a/boards/st/stm32h573i_dk/stm32h573i_dk-common.dtsi +++ b/boards/st/stm32h573i_dk/stm32h573i_dk-common.dtsi @@ -12,6 +12,7 @@ #include #include #include +#include / { model = "STMicroelectronics STM32H573I DISCOVERY KIT board"; @@ -134,7 +135,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x05>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 00]; diff --git a/boards/st/stm32h5f5j_dk/Kconfig.defconfig b/boards/st/stm32h5f5j_dk/Kconfig.defconfig index 6b47869c9283d..02237363f8491 100644 --- a/boards/st/stm32h5f5j_dk/Kconfig.defconfig +++ b/boards/st/stm32h5f5j_dk/Kconfig.defconfig @@ -15,10 +15,6 @@ configdefault SDMMC_STM32_CLOCK_CHECK if DISPLAY -choice ST7789V_PIXEL_FORMAT - default ST7789V_RGB565X -endchoice - # Required to enable LCD backlight configdefault REGULATOR default y diff --git a/boards/st/stm32l562e_dk/Kconfig.defconfig b/boards/st/stm32l562e_dk/Kconfig.defconfig index 99056537fbe87..32f06b14ba329 100644 --- a/boards/st/stm32l562e_dk/Kconfig.defconfig +++ b/boards/st/stm32l562e_dk/Kconfig.defconfig @@ -22,14 +22,6 @@ endif # BT config MIPI_DBI_STM32_FMC_MEM_BARRIER default n if MIPI_DBI_STM32_FMC -if DISPLAY - -choice ST7789V_PIXEL_FORMAT - default ST7789V_RGB565X -endchoice - -endif # DISPLAY - if INPUT config INPUT_FT5336_INTERRUPT diff --git a/boards/st/stm32l562e_dk/stm32l562e_dk_common.dtsi b/boards/st/stm32l562e_dk/stm32l562e_dk_common.dtsi index 6d5f8cca7e9ff..1641da8396774 100644 --- a/boards/st/stm32l562e_dk/stm32l562e_dk_common.dtsi +++ b/boards/st/stm32l562e_dk/stm32l562e_dk_common.dtsi @@ -10,6 +10,7 @@ #include #include #include +#include / { leds { @@ -103,7 +104,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x05>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 00]; diff --git a/boards/waveshare/esp32s3_geek/esp32s3_geek_esp32s3_procpu.dts b/boards/waveshare/esp32s3_geek/esp32s3_geek_esp32s3_procpu.dts index 454ce31dd8d7e..868ef8a4d7235 100644 --- a/boards/waveshare/esp32s3_geek/esp32s3_geek_esp32s3_procpu.dts +++ b/boards/waveshare/esp32s3_geek/esp32s3_geek_esp32s3_procpu.dts @@ -9,6 +9,7 @@ #include #include #include "esp32s3_geek-pinctrl.dtsi" +#include / { model = "ESP32-S3-GEEK PROCPU"; @@ -64,7 +65,7 @@ vdvs = <0x20>; mdac = <0x70>; lcm = <0x2c>; - colmod = <0x05>; + pixel-format = ; gamma = <0x01>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/boards/waveshare/rp2040_geek/rp2040_geek.dts b/boards/waveshare/rp2040_geek/rp2040_geek.dts index ea7c2c8bff2dd..aff3a1ebafe80 100644 --- a/boards/waveshare/rp2040_geek/rp2040_geek.dts +++ b/boards/waveshare/rp2040_geek/rp2040_geek.dts @@ -14,6 +14,7 @@ #include #include #include "rp2040_geek-pincontrol.dtsi" +#include / { model = "Waveshare RP2040 GEEK"; @@ -58,7 +59,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x05>; + pixel-format = ; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; diff --git a/drivers/display/Kconfig.st7789v b/drivers/display/Kconfig.st7789v index 88721d2e90988..de60ff8f5a6ff 100644 --- a/drivers/display/Kconfig.st7789v +++ b/drivers/display/Kconfig.st7789v @@ -3,28 +3,10 @@ # Copyright (c) 2019 Marc Reilly # SPDX-License-Identifier: Apache-2.0 -menuconfig ST7789V +config ST7789V bool "ST7789V display driver" default y depends on DT_HAS_SITRONIX_ST7789V_ENABLED select MIPI_DBI help Enable driver for ST7789V display driver. - -choice ST7789V_PIXEL_FORMAT - prompt "Color pixel format" - default ST7789V_RGB565 - depends on ST7789V - help - Specify the color pixel format for the ST7789V display controller. - -config ST7789V_RGB888 - bool "RGB888" - -config ST7789V_RGB565 - bool "RGB565" - -config ST7789V_RGB565X - bool "RGB565X" - -endchoice diff --git a/drivers/display/display_st7789v.c b/drivers/display/display_st7789v.c index 5d9408fbae16d..45d0fe8339485 100644 --- a/drivers/display/display_st7789v.c +++ b/drivers/display/display_st7789v.c @@ -5,6 +5,7 @@ * Copyright (c) 2019 PHYTEC Messtechnik GmbH * Copyright (c) 2020 Endian Technologies AB * Copyright (c) 2022 Basalte bv + * SPDX-FileCopyrightText: 2026 Abderrahmane JARMOUNI * * SPDX-License-Identifier: Apache-2.0 */ @@ -33,7 +34,6 @@ struct st7789v_config { uint8_t vdv_value; uint8_t mdac; uint8_t gamma; - uint8_t colmod; uint8_t lcm; bool inversion_on; uint8_t porch_param[5]; @@ -46,6 +46,7 @@ struct st7789v_config { uint16_t height; uint16_t width; uint8_t ready_time_ms; + uint32_t pixel_format; }; struct st7789v_data { @@ -53,11 +54,7 @@ struct st7789v_data { uint16_t y_offset; }; -#ifdef CONFIG_ST7789V_RGB888 -#define ST7789V_PIXEL_SIZE 3u -#else -#define ST7789V_PIXEL_SIZE 2u -#endif +#define ST7789V_PIXEL_SIZE(fmt) DISPLAY_BITS_PER_PIXEL(fmt) / BITS_PER_BYTE static void st7789v_set_lcd_margins(const struct device *dev, uint16_t x_offset, uint16_t y_offset) @@ -157,11 +154,12 @@ static int st7789v_write(const struct device *dev, const uint8_t *write_data_start = (uint8_t *) buf; uint16_t nbr_of_writes; uint16_t write_h; - enum display_pixel_format pixfmt; + enum display_pixel_format pixfmt = config->pixel_format; + uint8_t pixel_size = ST7789V_PIXEL_SIZE(config->pixel_format); int ret; __ASSERT(desc->width <= desc->pitch, "Pitch is smaller than width"); - __ASSERT((desc->pitch * ST7789V_PIXEL_SIZE * desc->height) <= desc->buf_size, + __ASSERT((desc->pitch * pixel_size * desc->height) <= desc->buf_size, "Input buffer too small"); LOG_DBG("Writing %dx%d (w,h) @ %dx%d (x,y)", @@ -175,19 +173,12 @@ static int st7789v_write(const struct device *dev, write_h = 1U; nbr_of_writes = desc->height; mipi_desc.height = 1; - mipi_desc.buf_size = desc->pitch * ST7789V_PIXEL_SIZE; + mipi_desc.buf_size = desc->pitch * pixel_size; } else { write_h = desc->height; nbr_of_writes = 1U; mipi_desc.height = desc->height; - mipi_desc.buf_size = desc->width * write_h * ST7789V_PIXEL_SIZE; - } - if (IS_ENABLED(CONFIG_ST7789V_RGB565)) { - pixfmt = PIXEL_FORMAT_RGB_565; - } else if (IS_ENABLED(CONFIG_ST7789V_RGB565X)) { - pixfmt = PIXEL_FORMAT_RGB_565X; - } else { - pixfmt = PIXEL_FORMAT_RGB_888; + mipi_desc.buf_size = desc->width * write_h * pixel_size; } mipi_desc.width = desc->width; @@ -207,7 +198,7 @@ static int st7789v_write(const struct device *dev, return ret; } - write_data_start += (desc->pitch * ST7789V_PIXEL_SIZE); + write_data_start += (desc->pitch * pixel_size); } return ret; @@ -222,32 +213,34 @@ static void st7789v_get_capabilities(const struct device *dev, capabilities->x_resolution = config->width; capabilities->y_resolution = config->height; -#ifdef CONFIG_ST7789V_RGB565 - capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_565; - capabilities->current_pixel_format = PIXEL_FORMAT_RGB_565; -#elif CONFIG_ST7789V_RGB565X - capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_565X; - capabilities->current_pixel_format = PIXEL_FORMAT_RGB_565X; -#else - capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_888; - capabilities->current_pixel_format = PIXEL_FORMAT_RGB_888; -#endif + capabilities->supported_pixel_formats = config->pixel_format; + capabilities->current_pixel_format = config->pixel_format; capabilities->current_orientation = DISPLAY_ORIENTATION_NORMAL; } +static inline uint8_t st7789v_get_colmod(enum display_pixel_format fmt) +{ + switch (fmt) { + case PIXEL_FORMAT_RGB_888: + return ST7789V_COLMOD_RGB_262K | ST7789V_COLMOD_FMT_18bit; + case PIXEL_FORMAT_RGB_565: + case PIXEL_FORMAT_RGB_565X: + return ST7789V_COLMOD_RGB_65K | ST7789V_COLMOD_FMT_16bit; + default: + return ST7789V_COLMOD_RGB_65K | ST7789V_COLMOD_FMT_16bit; + } +} + static int st7789v_set_pixel_format(const struct device *dev, const enum display_pixel_format pixel_format) { -#ifdef CONFIG_ST7789V_RGB565 - if (pixel_format == PIXEL_FORMAT_RGB_565) { -#elif CONFIG_ST7789V_RGB565X - if (pixel_format == PIXEL_FORMAT_RGB_565X) { -#else - if (pixel_format == PIXEL_FORMAT_RGB_888) { -#endif + const struct st7789v_config *config = dev->config; + + if (pixel_format == config->pixel_format) { return 0; } - LOG_ERR("Pixel format change not implemented"); + LOG_ERR("Runtime pixel format change not supported (configured: %d, requested: %d)", + config->pixel_format, pixel_format); return -ENOTSUP; } @@ -346,7 +339,7 @@ static int st7789v_lcd_init(const struct device *dev) } /* Interface Pixel Format */ - tmp = config->colmod; + tmp = st7789v_get_colmod(config->pixel_format); ret = st7789v_transmit(dev, ST7789V_CMD_COLMOD, &tmp, 1); if (ret < 0) { return ret; @@ -487,7 +480,6 @@ static DEVICE_API(display, st7789v_api) = { .vdv_value = DT_INST_PROP_OR(inst, vdvs, 0), \ .mdac = DT_INST_PROP(inst, mdac), \ .gamma = DT_INST_PROP(inst, gamma), \ - .colmod = DT_INST_PROP(inst, colmod), \ .lcm = DT_INST_PROP(inst, lcm), \ .inversion_on = !DT_INST_PROP(inst, inversion_off), \ .porch_param = DT_INST_PROP(inst, porch_param), \ @@ -500,6 +492,7 @@ static DEVICE_API(display, st7789v_api) = { .width = DT_INST_PROP(inst, width), \ .height = DT_INST_PROP(inst, height), \ .ready_time_ms = DT_INST_PROP(inst, ready_time_ms), \ + .pixel_format = DT_INST_PROP(inst, pixel_format), \ }; \ \ static struct st7789v_data st7789v_data_ ## inst = { \ diff --git a/dts/bindings/display/sitronix,st7789v.yaml b/dts/bindings/display/sitronix,st7789v.yaml index 8b582061ed6be..d126eb3ff4922 100644 --- a/dts/bindings/display/sitronix,st7789v.yaml +++ b/dts/bindings/display/sitronix,st7789v.yaml @@ -10,7 +10,7 @@ description: | compatible: "sitronix,st7789v" -include: [mipi-dbi-spi-device.yaml, display-controller.yaml] +include: [mipi-dbi-spi-device.yaml, lcd-controller.yaml] properties: x-offset: @@ -51,11 +51,6 @@ properties: required: true description: LCM Setting - colmod: - type: int - required: true - description: Interface Pixel Format - gamma: type: int required: true diff --git a/tests/drivers/build_all/display/app.overlay b/tests/drivers/build_all/display/app.overlay index b7a1fb89cfcd9..e4cf6d3935ce2 100644 --- a/tests/drivers/build_all/display/app.overlay +++ b/tests/drivers/build_all/display/app.overlay @@ -12,6 +12,7 @@ #include #include +#include / { test { @@ -87,7 +88,7 @@ vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; - colmod = <0x55>; + pixel-format = ; lcm = <0x0c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 00];