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

drivers: mipi-dbi: use string for mipi-mode property #81293

Merged
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
2 changes: 1 addition & 1 deletion boards/adi/max32662evkit/max32662evkit.dts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
st7735: st7735@0 {
compatible = "sitronix,st7735r";
mipi-max-frequency = <DT_FREQ_M(6)>;
mipi-mode = <MIPI_DBI_MODE_SPI_3WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_3WIRE";

reg = <0>;
width = <130>;
Expand Down
2 changes: 1 addition & 1 deletion boards/adi/max32672evkit/max32672evkit.dts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
st7735: st7735@0 {
compatible = "sitronix,st7735r";
mipi-max-frequency = <DT_FREQ_M(6)>;
mipi-mode = <MIPI_DBI_MODE_SPI_3WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_3WIRE";

reg = <0>;
width = <130>;
Expand Down
2 changes: 1 addition & 1 deletion boards/adi/max32680evkit/max32680evkit_max32680_m4.dts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
st7735: st7735@0 {
compatible = "sitronix,st7735r";
mipi-max-frequency = <DT_FREQ_M(6)>;
mipi-mode = <MIPI_DBI_MODE_SPI_3WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_3WIRE";

reg = <0>;
width = <130>;
Expand Down
2 changes: 1 addition & 1 deletion boards/adi/max32690evkit/max32690evkit_max32690_m4.dts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
st7735: st7735@0 {
compatible = "sitronix,st7735r";
mipi-max-frequency = <DT_FREQ_M(6)>;
mipi-mode = <MIPI_DBI_MODE_SPI_3WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_3WIRE";

reg = <0>;
width = <130>;
Expand Down
2 changes: 1 addition & 1 deletion boards/espressif/esp32s3_eye/esp32s3_eye_procpu.dts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
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];
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion boards/m5stack/m5stack_atoms3/m5stack_atoms3_procpu.dts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
nvgam-param = [d0 00 02 07 0a 28 31 54 47 0e 1c 17 1b 1e];
ram-param = [00 E0];
rgb-param = [40 02 14];
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
};

};
Expand Down
2 changes: 1 addition & 1 deletion boards/m5stack/m5stickc_plus/m5stickc_plus_procpu.dts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
nvgam-param = [d0 00 02 07 0a 28 31 54 47 0e 1c 17 1b 1e];
ram-param = [00 F0];
rgb-param = [40 02 14];
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion boards/pine64/pinetime_devkit0/pinetime_devkit0.dts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
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];
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion boards/shields/lcd_par_s035/boards/rd_rw612_bga.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
};

&st7796s {
mipi-mode = <MIPI_DBI_MODE_8080_BUS_8_BIT>;
mipi-mode = "MIPI_DBI_MODE_8080_BUS_8_BIT";
/*
* Display supports minimum write cycle time of 66ns. This
* means we can clock the LCDIC module at 30MHz, as
Expand Down
2 changes: 1 addition & 1 deletion boards/shields/lcd_par_s035/lcd_par_s035_8080.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
reg = <0>;
/* Baud rate on each pin is 1MHz */
mipi-max-frequency = <10000000>;
mipi-mode = <MIPI_DBI_MODE_8080_BUS_16_BIT>;
mipi-mode = "MIPI_DBI_MODE_8080_BUS_16_BIT";
height = <320>;
width = <480>;
invert-mode = "1-dot";
Expand Down
2 changes: 1 addition & 1 deletion boards/shields/st7735r/st7735r_ada_160x128.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
st7735r_st7735r_ada_160x128: st7735r@0 {
compatible = "sitronix,st7735r";
mipi-max-frequency = <20000000>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
reg = <0>;
width = <160>;
height = <128>;
Expand Down
2 changes: 1 addition & 1 deletion boards/shields/st7789v_generic/st7789v_tl019fqv01.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
nvgam-param = [D0 00 02 07 05 15 2D 44 44 1C 18 16 1C 1D];
ram-param = [00 F8];
rgb-param = [CD 08 14];
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
};
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
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];
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion boards/sipeed/longan_nano/longan_nano-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
caset = [00 01 00 a0];
raset = [00 1a 00 69];

mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
mipi-max-frequency = <4000000>;
};
};
Expand Down
2 changes: 1 addition & 1 deletion boards/st/stm32l562e_dk/stm32l562e_dk_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
st7789v: lcd-panel@0 {
compatible = "sitronix,st7789v";
reg = <0>;
mipi-mode = <MIPI_DBI_MODE_8080_BUS_16_BIT>;
mipi-mode = "MIPI_DBI_MODE_8080_BUS_16_BIT";
/* A write cycle should be 68ns */
mipi-max-frequency = <14705882>;
width = <240>;
Expand Down
2 changes: 1 addition & 1 deletion boards/weact/mini_stm32h743/mini_stm32h743.dts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
st7735r_160x80: st7735r@0 {
compatible = "sitronix,st7735r";
mipi-max-frequency = <20000000>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
reg = <0>;
width = <160>;
height = <80>;
Expand Down
23 changes: 23 additions & 0 deletions doc/releases/migration-guide-4.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@ Controller Area Network (CAN)
Display
=======

* Displays using the MIPI DBI driver which set their MIPI DBI mode via the
``mipi-mode`` property in devicetree should now use a string property of
the same name, like so:

.. code-block:: devicetree

/* Legacy display definition */

st7735r: st7735r@0 {
...
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
...
};

/* New display definition */

st7735r: st7735r@0 {
...
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
...
};


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

Expand Down
3 changes: 2 additions & 1 deletion drivers/display/display_ili9xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@
.quirks = &ili##t##_quirks, \
.mipi_dev = DEVICE_DT_GET(DT_PARENT(INST_DT_ILI9XXX(n, t))), \
.dbi_config = { \
.mode = DT_PROP_OR(INST_DT_ILI9XXX(n, t), \
.mode = DT_STRING_UPPER_TOKEN_OR( \
INST_DT_ILI9XXX(n, t), \
mipi_mode, MIPI_DBI_MODE_SPI_4WIRE), \
.config = MIPI_DBI_SPI_CONFIG_DT( \
INST_DT_ILI9XXX(n, t), \
Expand All @@ -544,7 +545,7 @@
NULL, &ili9xxx_data_##n, \
&ili9xxx_config_##n, POST_KERNEL, \
CONFIG_DISPLAY_INIT_PRIORITY, &ili9xxx_api)

Check notice on line 548 in drivers/display/display_ili9xxx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/display/display_ili9xxx.c:548 -#define ILI9XXX_INIT(n, t) \ - ILI##t##_REGS_INIT(n); \ - \ - static const struct ili9xxx_config ili9xxx_config_##n = { \ - .quirks = &ili##t##_quirks, \ - .mipi_dev = DEVICE_DT_GET(DT_PARENT(INST_DT_ILI9XXX(n, t))), \ - .dbi_config = { \ - .mode = DT_STRING_UPPER_TOKEN_OR( \ - INST_DT_ILI9XXX(n, t), \ - mipi_mode, MIPI_DBI_MODE_SPI_4WIRE), \ - .config = MIPI_DBI_SPI_CONFIG_DT( \ - INST_DT_ILI9XXX(n, t), \ - SPI_OP_MODE_MASTER | \ - SPI_WORD_SET(8), \ - 0), \ - }, \ - .pixel_format = DT_PROP(INST_DT_ILI9XXX(n, t), pixel_format), \ - .rotation = DT_PROP(INST_DT_ILI9XXX(n, t), rotation), \ - .x_resolution = ILI##t##_X_RES, \ - .y_resolution = ILI##t##_Y_RES, \ - .inversion = DT_PROP(INST_DT_ILI9XXX(n, t), display_inversion),\ - .regs = &ili9xxx_regs_##n, \ - .regs_init_fn = ili##t##_regs_init, \ - }; \ - \ - static struct ili9xxx_data ili9xxx_data_##n; \ - \ - DEVICE_DT_DEFINE(INST_DT_ILI9XXX(n, t), ili9xxx_init, \ - NULL, &ili9xxx_data_##n, \ - &ili9xxx_config_##n, POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, &ili9xxx_api) +#define ILI9XXX_INIT(n, t) \ + ILI##t##_REGS_INIT(n); \ + \ + static const struct ili9xxx_config ili9xxx_config_##n = { \ + .quirks = &ili##t##_quirks, \ + .mipi_dev = DEVICE_DT_GET(DT_PARENT(INST_DT_ILI9XXX(n, t))), \ + .dbi_config = \ + { \ + .mode = DT_STRING_UPPER_TOKEN_OR(INST_DT_ILI9XXX(n, t), mipi_mode, \ + MIPI_DBI_MODE_SPI_4WIRE), \ + .config = MIPI_DBI_SPI_CONFIG_DT( \ + INST_DT_ILI9XXX(n, t), \ + SPI_OP_MODE_MASTER | SPI_WORD_SET(8), 0), \ + }, \ + .pixel_format = DT_PROP(INST_DT_ILI9XXX(n, t), pixel_format), \ + .rotation = DT_PROP(INST_DT_ILI9XXX(n, t), rotation), \ + .x_resolution = ILI##t##_X_RES, \ + .y_resolution = ILI##t##_Y_RES, \ + .inversion = DT_PROP(INST_DT_ILI9XXX(n, t), display_inversion), \ + .regs = &ili9xxx_regs_##n, \ + .regs_init_fn = ili##t##_regs_init, \ + }; \ + \ + static struct ili9xxx_data ili9xxx_data_##n; \ + \ + DEVICE_DT_DEFINE(INST_DT_ILI9XXX(n, t), ili9xxx_init, NULL, &ili9xxx_d
#define DT_INST_FOREACH_ILI9XXX_STATUS_OKAY(t) \
LISTIFY(DT_NUM_INST_STATUS_OKAY(ilitek_ili##t), ILI9XXX_INIT, (;), t)

Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_st7735r.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
.mipi_dev = DEVICE_DT_GET(DT_INST_PARENT(inst)), \
.dbi_config = MIPI_DBI_CONFIG_DT_INST(inst, \
SPI_OP_MODE_MASTER | \
((DT_INST_PROP(inst, mipi_mode) == \
((DT_INST_STRING_UPPER_TOKEN(inst, mipi_mode) == \
MIPI_DBI_MODE_SPI_4WIRE) ? SPI_WORD_SET(8) : \
SPI_WORD_SET(9)) | \
SPI_HOLD_ON_CS | SPI_LOCK_ON, 0), \
Expand Down Expand Up @@ -531,5 +531,5 @@
&st7735r_data_ ## inst, &st7735r_config_ ## inst, \
POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, \
&st7735r_api);

Check notice on line 534 in drivers/display/display_st7735r.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/display/display_st7735r.c:534 - -#define ST7735R_INIT(inst) \ - const static struct st7735r_config st7735r_config_ ## inst = { \ - .mipi_dev = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ - .dbi_config = MIPI_DBI_CONFIG_DT_INST(inst, \ - SPI_OP_MODE_MASTER | \ - ((DT_INST_STRING_UPPER_TOKEN(inst, mipi_mode) == \ - MIPI_DBI_MODE_SPI_4WIRE) ? SPI_WORD_SET(8) : \ - SPI_WORD_SET(9)) | \ - SPI_HOLD_ON_CS | SPI_LOCK_ON, 0), \ - .width = DT_INST_PROP(inst, width), \ - .height = DT_INST_PROP(inst, height), \ - .madctl = DT_INST_PROP(inst, madctl), \ - .colmod = DT_INST_PROP(inst, colmod), \ - .caset = DT_INST_PROP(inst, caset), \ - .raset = DT_INST_PROP(inst, raset), \ - .vmctr1 = DT_INST_PROP(inst, vmctr1), \ - .invctr = DT_INST_PROP(inst, invctr), \ - .pwctr1 = DT_INST_PROP(inst, pwctr1), \ - .pwctr2 = DT_INST_PROP(inst, pwctr2), \ - .pwctr3 = DT_INST_PROP(inst, pwctr3), \ - .pwctr4 = DT_INST_PROP(inst, pwctr4), \ - .pwctr5 = DT_INST_PROP(inst, pwctr5), \ - .frmctr1 = DT_INST_PROP(inst, frmctr1), \ - .frmctr2 = DT_INST_PROP(inst, frmctr2), \ - .frmctr3 = DT_INST_PROP(inst, frmctr3), \ - .gamctrp1 = DT_INST_PROP(inst, gamctrp1), \ - .gamctrn1 = DT_INST_PROP(inst, gamctrn1), \ - .inversion_on = DT_INST_PROP(inst, inversion_on), \ - .rgb_is_inverted = DT_INST_PROP(inst, rgb_is_inverted), \ - }; \ - \ - static struct st7735r_data st7735r_data_ ## inst = { \ - .x_offset = DT_INST_PROP(inst, x_offset), \ - .y_offset = DT_INST_PROP(inst, y_offset), \ - }; \ - \ - PM_DEVICE_DT_INST_DEFINE(inst, st7735r_pm_action); \ - \ - DEVICE_DT_INST_DEFINE(inst, st7735r_init, PM_DEVICE_DT_INST_GET(inst), \ - &st7735r_data_ ## inst, &st7735r_config_ ## inst, \ - POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, \ - &st7735r_api); +#define ST7735R_INIT(inst) \ + const static struct st7735r_config st7735r_config_##inst = { \ + .mipi_dev = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ + .dbi_config = MIPI_DBI_CONFIG_DT_INST( \ + inst, \ + SPI_OP_MODE_MASTER | \ + ((DT_INST_STRING_UPPER_TOKEN(inst, mipi_mode) == \ + MIPI_DBI_MODE_SPI_4WIRE) \ + ? SPI_WORD_SET(8) \ + : SPI_WORD_SET(9)) | \ + SPI_HOLD_ON_CS | SPI_LOCK_ON, \ + 0), \ + .width = DT_INST_PROP(inst, width), \ + .height = DT_INST_PROP(inst, height), \ + .madctl = DT_INST_PROP(inst, madctl), \ + .colmod = DT_INST_PROP(inst, colmod), \ + .caset = DT_INST_PROP(inst, caset), \ + .raset = DT_INST_PROP(inst, raset), \ + .vmctr1 = DT_INST_PROP(inst, vmctr1), \ + .invctr = DT_INST_PROP(inst, invctr), \ + .pwctr1 = DT_INST_PROP(inst, pwctr1), \ + .pwctr2 = DT_INST_PROP(inst, pwctr2), \ + .pwctr3 = DT_INST_PROP(inst, pwctr3), \ + .pwctr4 = DT_INST_PROP(inst, pwctr4), \ + .pwctr5 = DT_INST_PROP(inst, pwctr5), \ + .frmctr1 = DT_INST_PROP(inst, frmctr1),
DT_INST_FOREACH_STATUS_OKAY(ST7735R_INIT)
2 changes: 1 addition & 1 deletion drivers/display/display_st7789v.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@
};

#define ST7789V_WORD_SIZE(inst) \
((DT_INST_PROP(inst, mipi_mode) == MIPI_DBI_MODE_SPI_4WIRE) ? \
((DT_INST_STRING_UPPER_TOKEN(inst, mipi_mode) == MIPI_DBI_MODE_SPI_4WIRE) ? \
SPI_WORD_SET(8) : SPI_WORD_SET(9))
#define ST7789V_INIT(inst) \

Check notice on line 375 in drivers/display/display_st7789v.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/display/display_st7789v.c:375 -#define ST7789V_WORD_SIZE(inst) \ - ((DT_INST_STRING_UPPER_TOKEN(inst, mipi_mode) == MIPI_DBI_MODE_SPI_4WIRE) ? \ - SPI_WORD_SET(8) : SPI_WORD_SET(9)) +#define ST7789V_WORD_SIZE(inst) \ + ((DT_INST_STRING_UPPER_TOKEN(inst, mipi_mode) == MIPI_DBI_MODE_SPI_4WIRE) \ + ? SPI_WORD_SET(8) \ + : SPI_WORD_SET(9))
static const struct st7789v_config st7789v_config_ ## inst = { \
.mipi_dbi = DEVICE_DT_GET(DT_INST_PARENT(inst)), \
.dbi_config = MIPI_DBI_CONFIG_DT_INST(inst, \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_st7796s.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@
SPI_OP_MODE_MASTER | \
SPI_WORD_SET(8), \
0), \
.mode = DT_INST_PROP_OR(n, mipi_mode, \
.mode = DT_INST_STRING_UPPER_TOKEN_OR(n, mipi_mode, \
MIPI_DBI_MODE_SPI_4WIRE), \
}, \
.width = DT_INST_PROP(n, width), \
Expand Down Expand Up @@ -393,5 +393,5 @@
&st7796s_config_##n, \
POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, \
&st7796s_api);

Check notice on line 396 in drivers/display/display_st7796s.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/display/display_st7796s.c:396 - -#define ST7796S_INIT(n) \ - static const struct st7796s_config st7796s_config_##n = { \ - .mipi_dbi = DEVICE_DT_GET(DT_INST_PARENT(n)), \ - .dbi_config = { \ - .config = MIPI_DBI_SPI_CONFIG_DT( \ - DT_DRV_INST(n), \ - SPI_OP_MODE_MASTER | \ - SPI_WORD_SET(8), \ - 0), \ - .mode = DT_INST_STRING_UPPER_TOKEN_OR(n, mipi_mode, \ - MIPI_DBI_MODE_SPI_4WIRE), \ - }, \ - .width = DT_INST_PROP(n, width), \ - .height = DT_INST_PROP(n, height), \ - .inverted = DT_INST_PROP(n, color_invert), \ - .dic = DT_INST_ENUM_IDX(n, invert_mode), \ - .frmctl1 = DT_INST_PROP(n, frmctl1), \ - .frmctl2 = DT_INST_PROP(n, frmctl2), \ - .frmctl3 = DT_INST_PROP(n, frmctl3), \ - .bpc = DT_INST_PROP(n, bpc), \ - .dfc = DT_INST_PROP(n, dfc), \ - .pwr1 = DT_INST_PROP(n, pwr1), \ - .pwr2 = DT_INST_PROP(n, pwr2), \ - .pwr3 = DT_INST_PROP(n, pwr3), \ - .vcmpctl = DT_INST_PROP(n, vcmpctl), \ - .doca = DT_INST_PROP(n, doca), \ - .pgc = DT_INST_PROP(n, pgc), \ - .ngc = DT_INST_PROP(n, ngc), \ - .madctl = DT_INST_PROP(n, madctl), \ - .rgb_is_inverted = DT_INST_PROP(n, rgb_is_inverted), \ - }; \ - \ - DEVICE_DT_INST_DEFINE(n, st7796s_init, \ - NULL, \ - NULL, \ - &st7796s_config_##n, \ - POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, \ - &st7796s_api); +#define ST7796S_INIT(n) \ + static const struct st7796s_config st7796s_config_##n = { \ + .mipi_dbi = DEVICE_DT_GET(DT_INST_PARENT(n)), \ + .dbi_config = \ + { \ + .config = MIPI_DBI_SPI_CONFIG_DT( \ + DT_DRV_INST(n), SPI_OP_MODE_MASTER | SPI_WORD_SET(8), 0), \ + .mode = DT_INST_STRING_UPPER_TOKEN_OR(n, mipi_mode, \ + MIPI_DBI_MODE_SPI_4WIRE), \ + }, \ + .width = DT_INST_PROP(n, width), \ + .height = DT_INST_PROP(n, height), \ + .inverted = DT_INST_PROP(n, color_invert), \ + .dic = DT_INST_ENUM_IDX(n, invert_mode), \ + .frmctl1 = DT_INST_PROP(n, frmctl1), \ + .frmctl2 = DT_INST_PROP(n, frmctl2), \ + .frmctl3 = DT_INST_PROP(n, frmctl3), \ + .bpc = DT_INST_PROP(n, bpc), \ + .dfc = DT_INST_PROP(n, dfc), \ + .pwr1 = DT_INST_PROP(n, pwr1), \ + .pwr2 = DT_INST_PROP(n, pwr2), \ + .pwr3 = DT_INST_PROP(n, pwr3), \ + .vcmpctl = DT_INST_PROP(n, vcmpctl), \ + .doca = DT_INST_PROP(n, doca), \ + .pgc = DT_INST_PROP(n, pgc), \ + .ngc = DT_INST_PROP(n, ngc), \ + .madctl = DT_INST_PROP(n, madctl), \ + .rgb_is_inverted = DT_INST_PROP(n, rgb_is_inverted), \ + }; \ + \ + DEVICE_DT_INST_DEFINE(n, st7796s_init, NULL, NULL, &st77
DT_INST_FOREACH_STATUS_OKAY(ST7796S_INIT)
32 changes: 12 additions & 20 deletions dts/bindings/mipi-dbi/mipi-dbi-device.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 NXP
# Copyright 2023-2024 NXP
# SPDX-License-Identifier: Apache-2.0
#
# Common fields for MIPI-DBI devices
Expand All @@ -13,24 +13,16 @@ properties:
description: Maximum clock frequency of device's MIPI interface in Hz

mipi-mode:
type: int
type: string
description: |
MIPI DBI mode in use. Use the macros, not the actual enum value. Here is
the concordance list (see dt-bindings/mipi_dbi/mipi_dbi.h)
1 MIPI_DBI_MODE_SPI_3WIRE
2 MIPI_DBI_MODE_SPI_4WIRE
3 MIPI_DBI_MODE_6800_BUS_16_BIT
4 MIPI_DBI_MODE_6800_BUS_9_BIT
5 MIPI_DBI_MODE_6800_BUS_8_BIT
6 MIPI_DBI_MODE_8080_BUS_16_BIT
7 MIPI_DBI_MODE_8080_BUS_9_BIT
8 MIPI_DBI_MODE_8080_BUS_8_BIT
MIPI DBI mode in use. These definitions should match those in
dt-bindings/mipi_dbi/mipi_dbi.h
enum:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- "MIPI_DBI_MODE_SPI_3WIRE"
- "MIPI_DBI_MODE_SPI_4WIRE"
- "MIPI_DBI_MODE_6800_BUS_16_BIT"
- "MIPI_DBI_MODE_6800_BUS_9_BIT"
- "MIPI_DBI_MODE_6800_BUS_8_BIT"
- "MIPI_DBI_MODE_8080_BUS_16_BIT"
- "MIPI_DBI_MODE_8080_BUS_9_BIT"
- "MIPI_DBI_MODE_8080_BUS_8_BIT"
2 changes: 1 addition & 1 deletion include/zephyr/drivers/mipi_dbi.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@
*/
#define MIPI_DBI_CONFIG_DT(node_id, operation_, delay_) \
{ \
.mode = DT_PROP(node_id, mipi_mode), \
.mode = DT_STRING_UPPER_TOKEN(node_id, mipi_mode), \
.config = MIPI_DBI_SPI_CONFIG_DT(node_id, operation_, delay_), \
}

Check notice on line 101 in include/zephyr/drivers/mipi_dbi.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/drivers/mipi_dbi.h:101 -#define MIPI_DBI_CONFIG_DT(node_id, operation_, delay_) \ - { \ - .mode = DT_STRING_UPPER_TOKEN(node_id, mipi_mode), \ - .config = MIPI_DBI_SPI_CONFIG_DT(node_id, operation_, delay_), \ +#define MIPI_DBI_CONFIG_DT(node_id, operation_, delay_) \ + { \ + .mode = DT_STRING_UPPER_TOKEN(node_id, mipi_mode), \ + .config = MIPI_DBI_SPI_CONFIG_DT(node_id, operation_, delay_), \

/**
* @brief Initialize a MIPI DBI configuration from device instance
Expand Down
4 changes: 2 additions & 2 deletions tests/drivers/build_all/display/app.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
test_mipi_dbi_st7735r: st7735t@2 {
compatible = "sitronix,st7735r";
mipi-max-frequency = <250000000>;
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
reg = <2>;
/* Arbitrary values */
x-offset = <0>;
Expand Down Expand Up @@ -96,7 +96,7 @@
nvgam-param = [d0 00 02 07 0a 28 31 54 47 0e 1c 17 1b 1e];
ram-param = [00 E0];
rgb-param = [40 02 14];
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
};

test_mipi_dbi_ssd1680: ssd1680@4 {
Expand Down
Loading