drivers: mipi-dbi-spi: use string for xfr-min-bits property
Use a string for the xfr-min-bits property over an integer value, as this significantly improves the readability of the MIPI DBI SPI device binding. Signed-off-by: Stephan Linz <linz@li-pro.net>
This commit is contained in:
parent
ee5c520326
commit
7cd7c82aa1
3 changed files with 10 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright 2023 NXP
|
||||
* Copyright 2024 TiaC Systems
|
||||
* Copyright 2024-2025 TiaC Systems
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
|
@ -43,8 +43,8 @@ struct mipi_dbi_spi_data {
|
|||
uint32_t var = MIPI_DBI_SPI_READ_REQUIRED;
|
||||
|
||||
/* Expands to 1 if the node does reflect the enum in `xfr-min-bits` property */
|
||||
#define _XFR_8BITS(n) (DT_INST_PROP(n, xfr_min_bits) == MIPI_DBI_SPI_XFR_8BIT) |
|
||||
#define _XFR_16BITS(n) (DT_INST_PROP(n, xfr_min_bits) == MIPI_DBI_SPI_XFR_16BIT) |
|
||||
#define _XFR_8BITS(n) (DT_INST_STRING_UPPER_TOKEN(n, xfr_min_bits) == MIPI_DBI_SPI_XFR_8BIT) |
|
||||
#define _XFR_16BITS(n) (DT_INST_STRING_UPPER_TOKEN(n, xfr_min_bits) == MIPI_DBI_SPI_XFR_16BIT) |
|
||||
|
||||
/* This macros will evaluate to 1 if any of the nodes with zephyr,mipi-dbi-spi
|
||||
* have the `xfr-min-bits` property to corresponding enum value. The intention
|
||||
|
|
@ -560,7 +560,7 @@ static DEVICE_API(mipi_dbi, mipi_dbi_spi_driver_api) = {
|
|||
DT_INST_PHANDLE(n, spi_dev)), \
|
||||
.cmd_data = GPIO_DT_SPEC_INST_GET_OR(n, dc_gpios, {}), \
|
||||
.reset = GPIO_DT_SPEC_INST_GET_OR(n, reset_gpios, {}), \
|
||||
.xfr_min_bits = DT_INST_PROP(n, xfr_min_bits) \
|
||||
.xfr_min_bits = DT_INST_STRING_UPPER_TOKEN(n, xfr_min_bits) \
|
||||
}; \
|
||||
static struct mipi_dbi_spi_data mipi_dbi_spi_data_##n; \
|
||||
\
|
||||
|
|
|
|||
|
|
@ -28,20 +28,16 @@ properties:
|
|||
Reset GPIO pin. Set high to reset the display
|
||||
|
||||
xfr-min-bits:
|
||||
type: int
|
||||
default: 8
|
||||
type: string
|
||||
default: "MIPI_DBI_SPI_XFR_8BIT"
|
||||
description:
|
||||
On rare types of SPI interfaces, discrete shift registers can be found
|
||||
whose task is to convert the serial SPI bit stream to the parallel MCU
|
||||
interface with clock and bit accuracy. Typically, these are 16 bits wide.
|
||||
|
||||
Use the macros, not the actual enum value. Here is the concordance list
|
||||
(see dt-bindings/mipi_dbi/mipi_dbi.h)
|
||||
8 MIPI_DBI_SPI_XFR_8BIT
|
||||
16 MIPI_DBI_SPI_XFR_16BIT
|
||||
These definitions should match those in dt-bindings/mipi_dbi/mipi_dbi.h
|
||||
enum:
|
||||
- 8
|
||||
- 16
|
||||
- "MIPI_DBI_SPI_XFR_8BIT"
|
||||
- "MIPI_DBI_SPI_XFR_16BIT"
|
||||
|
||||
write-only:
|
||||
type: boolean
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@
|
|||
spi-dev = <&test_spi>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
xfr-min-bits = <MIPI_DBI_SPI_XFR_16BIT>;
|
||||
xfr-min-bits = "MIPI_DBI_SPI_XFR_16BIT";
|
||||
write-only;
|
||||
|
||||
test_mipi_dbi_xfr_16bit_ili9342c: ili9342c@0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue