Skip to content
Draft
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
9 changes: 9 additions & 0 deletions doc/releases/migration-guide-4.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ Comparator
and :c:macro:`NRF_COMP_AIN_VDDH_DIV5` represents VDDH/5.
The old ``string`` properties type is deprecated.

Display
===

* The macros :c:macro:`MIPI_DBI_SPI_CONFIG_DT` :c:macro:`MIPI_DBI_SPI_CONFIG_DT_INST`,
:c:macro:`MIPI_DBI_CONFIG_DT`, and :c:macro:`MIPI_DBI_CONFIG_DT_INST` have been changed so that
they do not need to be provided a delay parameter anymore. This is because the timing parameters
of a SPI peripheral chip select should now be specified in DT with the
``spi-cs-setup-delay-ns`` and ``spi-cs-hold-delay-ns`` properties.

MFD
===

Expand Down
3 changes: 3 additions & 0 deletions doc/releases/release-notes-4.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Deprecated APIs and options
:c:macro:`SPI_DT_SPEC_GET`, :c:macro:`SPI_DT_SPEC_INST_GET` is deprecated. Providing a
second argument to :c:macro:`SPI_CS_CONTROL_INIT` is deprecated. Use new DT properties
``spi-cs-setup-delay-ns`` and ``spi-cs-hold-delay-ns`` to specify delay instead.
* Providing a third agument to :c:macro:`MIPI_DBI_SPI_CONFIG_DT`, :c:macro:`MIPI_DBI_SPI_CONFIG_DT_INST`,
:c:macro:`MIPI_DBI_CONFIG_DT`, :c:macro:`MIPI_DBI_CONFIG_DT_INST` is deprecated. Use new DT properties
``spi-cs-setup-delay-ns`` and ``spi-cs-hold-delay-ns`` to specify delay instead.

* :c:enum:`bt_hci_bus` was deprecated as it was not used. :c:macro:`BT_DT_HCI_BUS_GET` should be
used instead.
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_gc9x01x.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ static DEVICE_API(display, gc9x01x_api) = {
.mode = MIPI_DBI_MODE_SPI_4WIRE, \
.config = MIPI_DBI_SPI_CONFIG_DT_INST(inst, \
SPI_OP_MODE_MASTER | \
SPI_WORD_SET(8), 0), \
SPI_WORD_SET(8)), \
}, \
.pixel_format = DT_INST_PROP(inst, pixel_format), \
.orientation = DT_INST_ENUM_IDX(inst, orientation), \
Expand Down
3 changes: 1 addition & 2 deletions drivers/display/display_ili9xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,7 @@ static const struct ili9xxx_quirks ili9488_quirks = {
.config = MIPI_DBI_SPI_CONFIG_DT( \
INST_DT_ILI9XXX(n, t), \
SPI_OP_MODE_MASTER | \
SPI_WORD_SET(8), \
0), \
SPI_WORD_SET(8)), \
}, \
.pixel_format = DT_PROP(INST_DT_ILI9XXX(n, t), pixel_format), \
.rotation = DT_PROP(INST_DT_ILI9XXX(n, t), rotation), \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_sh1122.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static DEVICE_API(display, sh1122_driver_api) = {
static const struct sh1122_config config##node_id = { \
.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
.dbi_config = MIPI_DBI_CONFIG_DT( \
node_id, SH1122_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER, 0), \
node_id, SH1122_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER), \
.height = DT_PROP(node_id, height), \
.width = DT_PROP(node_id, width), \
.oscillator_freq = DT_PROP(node_id, oscillator_freq), \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_ssd1320.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ static DEVICE_API(display, ssd1320_driver_api) = {
static const struct ssd1320_config config##node_id = { \
.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
.dbi_config = MIPI_DBI_CONFIG_DT( \
node_id, SSD1320_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER, 0), \
node_id, SSD1320_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER), \
.height = DT_PROP(node_id, height), \
.width = DT_PROP(node_id, width), \
.oscillator_freq = DT_PROP(node_id, oscillator_freq), \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_ssd1331.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ static DEVICE_API(display, ssd1331_driver_api) = {
static const struct ssd1331_config config##node_id = { \
.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
.dbi_config = MIPI_DBI_CONFIG_DT( \
node_id, SSD1331_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER, 0), \
node_id, SSD1331_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER), \
.height = DT_PROP(node_id, height), \
.width = DT_PROP(node_id, width), \
.display_offset = DT_PROP(node_id, display_offset), \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_ssd135x.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ static DEVICE_API(display, ssd135x_driver_api) = {
static const struct ssd135x_config config##node_id = { \
.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
.dbi_config = MIPI_DBI_CONFIG_DT( \
node_id, SSD135X_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER, 0), \
node_id, SSD135X_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER), \
.height = DT_PROP(node_id, height), \
.width = DT_PROP(node_id, width), \
.display_offset = DT_PROP(node_id, display_offset), \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_ssd1363.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ static DEVICE_API(display, ssd1363_driver_api) = {
static const struct ssd1363_config config##node_id = { \
.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
.dbi_config = MIPI_DBI_CONFIG_DT( \
node_id, SSD1363_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER, 0), \
node_id, SSD1363_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER), \
.height = DT_PROP(node_id, height), \
.width = DT_PROP(node_id, width), \
.oscillator_freq = DT_PROP(node_id, oscillator_freq), \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_st730x.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ static const struct st730x_specific st7306_specifics = {
static const struct st730x_config config##node_id = { \
.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
.dbi_config = MIPI_DBI_CONFIG_DT( \
node_id, ST730X_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER, 0), \
node_id, ST730X_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER), \
.height = DT_PROP(node_id, height), \
.width = DT_PROP(node_id, width), \
.start_line = DT_PROP(node_id, start_line), \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_st75256.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ static DEVICE_API(display, st75256_driver_api) = {
.inversion_on = DT_PROP(node_id, inversion_on), \
.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
.dbi_config = MIPI_DBI_CONFIG_DT( \
node_id, ST75256_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER, 0), \
node_id, ST75256_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER), \
.conversion_buf = conversion_buf##node_id, \
.conversion_buf_size = sizeof(conversion_buf##node_id), \
}; \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_st7567.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ static DEVICE_API(display, st7567_driver_api) = {

#define ST7567_CONFIG_DBI(node_id) \
.bus = {.dbi.dbi_config = MIPI_DBI_CONFIG_DT( \
node_id, ST7567_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER, 0), \
node_id, ST7567_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER), \
.dbi.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)),}, \
.bus_ready = st7567_bus_ready_dbi, \
.write_cmd_bus = st7567_write_cmd_bus_dbi, .write_pixels_bus = st7567_write_pixels_bus_dbi,\
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 @@ -497,7 +497,7 @@ static DEVICE_API(display, st7735r_api) = {
((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), \
SPI_HOLD_ON_CS | SPI_LOCK_ON), \
.width = DT_INST_PROP(inst, width), \
.height = DT_INST_PROP(inst, height), \
.madctl = DT_INST_PROP(inst, madctl), \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/display_st7789v.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ static DEVICE_API(display, st7789v_api) = {
.mipi_dbi = DEVICE_DT_GET(DT_INST_PARENT(inst)), \
.dbi_config = MIPI_DBI_CONFIG_DT_INST(inst, \
ST7789V_WORD_SIZE(inst) | \
SPI_OP_MODE_MASTER, 0), \
SPI_OP_MODE_MASTER), \
.vcom = DT_INST_PROP(inst, vcom), \
.gctrl = DT_INST_PROP(inst, gctrl), \
.vdv_vrh_enable = (DT_INST_NODE_HAS_PROP(inst, vrhs) \
Expand Down
3 changes: 1 addition & 2 deletions drivers/display/display_st7796s.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ static DEVICE_API(display, st7796s_api) = {
.config = MIPI_DBI_SPI_CONFIG_DT( \
DT_DRV_INST(n), \
SPI_OP_MODE_MASTER | \
SPI_WORD_SET(8), \
0), \
SPI_WORD_SET(8)), \
.mode = DT_INST_STRING_UPPER_TOKEN_OR(n, mipi_mode, \
MIPI_DBI_MODE_SPI_4WIRE), \
}, \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/ssd1322.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ static DEVICE_API(display, ssd1322_driver_api) = {
.color_inversion = DT_PROP(node_id, inversion_on), \
.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
.dbi_config = MIPI_DBI_CONFIG_DT( \
node_id, SSD1322_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER, 0), \
node_id, SSD1322_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER), \
.conversion_buf = conversion_buf##node_id, \
.conversion_buf_size = sizeof(conversion_buf##node_id), \
}; \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/ssd1327.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ static DEVICE_API(display, ssd1327_driver_api) = {
static const struct ssd1327_config config##node_id = { \
.mipi_dev = DEVICE_DT_GET(DT_PARENT(node_id)), \
.dbi_config = MIPI_DBI_CONFIG_DT( \
node_id, SSD1327_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER, 0), \
node_id, SSD1327_WORD_SIZE(node_id) | SPI_OP_MODE_MASTER), \
.height = DT_PROP(node_id, height), \
.width = DT_PROP(node_id, width), \
.oscillator_freq = DT_PROP(node_id, oscillator_freq), \
Expand Down
2 changes: 1 addition & 1 deletion drivers/display/ssd16xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ static struct ssd16xx_quirks quirks_solomon_ssd1681 = {
.mode = MIPI_DBI_MODE_SPI_4WIRE, \
.config = MIPI_DBI_SPI_CONFIG_DT(n, \
SPI_OP_MODE_MASTER | SPI_WORD_SET(8) | \
SPI_HOLD_ON_CS | SPI_LOCK_ON, 0), \
SPI_HOLD_ON_CS | SPI_LOCK_ON), \
}, \
.busy_gpio = GPIO_DT_SPEC_GET(n, busy_gpios), \
.quirks = quirks_ptr, \
Expand Down
3 changes: 1 addition & 2 deletions drivers/display/uc81xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,7 @@ static DEVICE_API(display, uc81xx_driver_api) = {
.mode = MIPI_DBI_MODE_SPI_4WIRE, \
.config = MIPI_DBI_SPI_CONFIG_DT(n, \
SPI_OP_MODE_MASTER | \
SPI_LOCK_ON | SPI_WORD_SET(8), \
0), \
SPI_LOCK_ON | SPI_WORD_SET(8)), \
}, \
.busy_gpio = GPIO_DT_SPEC_GET(n, busy_gpios), \
\
Expand Down
33 changes: 10 additions & 23 deletions include/zephyr/drivers/mipi_dbi.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've created an RFC for the proposed API changes. An alternative approach to fix the immediate issue introduced in #87427 which caused hardware CS to no longer work would be to set .cs_is_gpio = DT_SPI_DEV_HAS_CS_GPIOS(node_id) in the macro instead of always true. I can create a new PR for just that if it is better in the short term

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes if a fix is possible without API change, it's better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standalone PR is #97366. Will keep this RFC open since the delay parameter has been deprecated for SPI CS, so should probably be removed from MIPI DBI SPI

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @brief Interfaces for MIPI-DBI (Display Bus Interface).
* @defgroup mipi_dbi_interface MIPI-DBI
* @since 3.6
* @version 0.8.0
* @version 0.9.0
* @ingroup display_interface
* @{
*/
Expand All @@ -49,10 +49,8 @@ extern "C" {
* @param node_id Devicetree node identifier for the MIPI DBI device whose
* struct spi_config to create an initializer for
* @param operation_ the desired operation field in the struct spi_config
* @param delay_ the desired delay field in the struct spi_config's
* spi_cs_control, if there is one
*/
#define MIPI_DBI_SPI_CONFIG_DT(node_id, operation_, delay_) \
#define MIPI_DBI_SPI_CONFIG_DT(node_id, operation_) \
{ \
.frequency = DT_PROP(node_id, mipi_max_frequency), \
.operation = (operation_) | \
Expand All @@ -61,12 +59,7 @@ extern "C" {
COND_CODE_1(DT_PROP(node_id, mipi_cpha), SPI_MODE_CPHA, (0)) | \
COND_CODE_1(DT_PROP(node_id, mipi_hold_cs), SPI_HOLD_ON_CS, (0)), \
.slave = DT_REG_ADDR(node_id), \
.cs = { \
COND_CODE_1(DT_SPI_DEV_HAS_CS_GPIOS(node_id), \
(SPI_CS_CONTROL_INIT_GPIO(node_id, _delay)), \
(SPI_CS_CONTROL_INIT_NATIVE(node_id))) \
.cs_is_gpio = DT_SPI_DEV_HAS_CS_GPIOS(node_id), \
}, \
.cs = SPI_CS_CONTROL_INIT(node_id), \
}

/**
Expand All @@ -76,11 +69,9 @@ extern "C" {
* instance. It is equivalent to MIPI_DBI_SPI_CONFIG_DT(DT_DRV_INST(inst))
* @param inst Instance number to initialize configuration from
* @param operation_ the desired operation field in the struct spi_config
* @param delay_ the desired delay field in the struct spi_config's
* spi_cs_control, if there is one
*/
#define MIPI_DBI_SPI_CONFIG_DT_INST(inst, operation_, delay_) \
MIPI_DBI_SPI_CONFIG_DT(DT_DRV_INST(inst), operation_, delay_)
#define MIPI_DBI_SPI_CONFIG_DT_INST(inst, operation_) \
MIPI_DBI_SPI_CONFIG_DT(DT_DRV_INST(inst), operation_)

/**
* @brief Initialize a MIPI DBI configuration from devicetree
Expand All @@ -91,26 +82,22 @@ extern "C" {
* @param node_id Devicetree node identifier for the MIPI DBI device to
* initialize
* @param operation_ the desired operation field in the struct spi_config
* @param delay_ the desired delay field in the struct spi_config's
* spi_cs_control, if there is one
*/
#define MIPI_DBI_CONFIG_DT(node_id, operation_, delay_) \
#define MIPI_DBI_CONFIG_DT(node_id, operation_) \
{ \
.mode = DT_STRING_UPPER_TOKEN(node_id, mipi_mode), \
.config = MIPI_DBI_SPI_CONFIG_DT(node_id, operation_, delay_), \
.config = MIPI_DBI_SPI_CONFIG_DT(node_id, operation_), \
}

/**
* @brief Initialize a MIPI DBI configuration from device instance
*
* Equivalent to MIPI_DBI_CONFIG_DT(DT_DRV_INST(inst), operation_, delay_)
* Equivalent to MIPI_DBI_CONFIG_DT(DT_DRV_INST(inst), operation_)
* @param inst Instance of the device to initialize a MIPI DBI configuration for
* @param operation_ the desired operation field in the struct spi_config
* @param delay_ the desired delay field in the struct spi_config's
* spi_cs_control, if there is one
*/
#define MIPI_DBI_CONFIG_DT_INST(inst, operation_, delay_) \
MIPI_DBI_CONFIG_DT(DT_DRV_INST(inst), operation_, delay_)
#define MIPI_DBI_CONFIG_DT_INST(inst, operation_) \
MIPI_DBI_CONFIG_DT(DT_DRV_INST(inst), operation_)

/**
* @brief Get the MIPI DBI TE mode from devicetree
Expand Down