diff --git a/drivers/mipi_dsi/CMakeLists.txt b/drivers/mipi_dsi/CMakeLists.txt index 2fcae1d0bce21b..35477023c6bb9b 100644 --- a/drivers/mipi_dsi/CMakeLists.txt +++ b/drivers/mipi_dsi/CMakeLists.txt @@ -2,3 +2,4 @@ zephyr_sources_ifdef(CONFIG_MIPI_DSI mipi_dsi.c) zephyr_sources_ifdef(CONFIG_MIPI_DSI_MCUX dsi_mcux.c) zephyr_sources_ifdef(CONFIG_MIPI_DSI_MCUX_2L dsi_mcux_2l.c) zephyr_sources_ifdef(CONFIG_MIPI_DSI_STM32 dsi_stm32.c) +zephyr_sources_ifdef(CONFIG_MIPI_DSI_TEST dsi_test.c) diff --git a/drivers/mipi_dsi/Kconfig b/drivers/mipi_dsi/Kconfig index dd896de7c981ed..3f5928ff6c18f6 100644 --- a/drivers/mipi_dsi/Kconfig +++ b/drivers/mipi_dsi/Kconfig @@ -17,11 +17,12 @@ source "subsys/logging/Kconfig.template.log_config" config MIPI_DSI_INIT_PRIORITY int "Initialization priority" - default 86 + default 85 help MIPI-DSI Host Controllers initialization priority. source "drivers/mipi_dsi/Kconfig.mcux" source "drivers/mipi_dsi/Kconfig.stm32" +source "drivers/mipi_dsi/Kconfig.test" endif diff --git a/drivers/mipi_dsi/Kconfig.test b/drivers/mipi_dsi/Kconfig.test new file mode 100644 index 00000000000000..f9a3942b1faf37 --- /dev/null +++ b/drivers/mipi_dsi/Kconfig.test @@ -0,0 +1,6 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +config MIPI_DSI_TEST + def_bool DT_HAS_VND_MIPI_DSI_ENABLED + depends on DT_HAS_VND_MIPI_DSI_ENABLED diff --git a/drivers/mipi_dsi/dsi_test.c b/drivers/mipi_dsi/dsi_test.c new file mode 100644 index 00000000000000..59e892e506e606 --- /dev/null +++ b/drivers/mipi_dsi/dsi_test.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * This is not a real mipi-dsi driver. It is used to instantiate struct + * devices for the "vnd,mipi-dsi" devicetree compatible used in test code. + */ + +#include + +#define DT_DRV_COMPAT vnd_mipi_dsi + +static int vnd_mipi_dsi_attach(const struct device *dev, uint8_t channel, + const struct mipi_dsi_device *mdev) +{ + ARG_UNUSED(dev); + ARG_UNUSED(channel); + ARG_UNUSED(mdev); + + return -ENOTSUP; +} + +static ssize_t vnd_mipi_dsi_transfer(const struct device *dev, uint8_t channel, + struct mipi_dsi_msg *msg) +{ + ARG_UNUSED(dev); + ARG_UNUSED(channel); + ARG_UNUSED(msg); + + return -1; +} + +static int vnd_mipi_dsi_detach(const struct device *dev, uint8_t channel, + const struct mipi_dsi_device *mdev) +{ + ARG_UNUSED(dev); + ARG_UNUSED(channel); + ARG_UNUSED(mdev); + + return -ENOTSUP; +} + +static struct mipi_dsi_driver_api vnd_mipi_dsi_api = { + .attach = vnd_mipi_dsi_attach, + .transfer = vnd_mipi_dsi_transfer, + .detach = vnd_mipi_dsi_detach, +}; + +#define VND_MIPI_DSI_INIT(n) \ + DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, POST_KERNEL, \ + CONFIG_MIPI_DSI_INIT_PRIORITY, &vnd_mipi_dsi_api); + +DT_INST_FOREACH_STATUS_OKAY(VND_MIPI_DSI_INIT) diff --git a/dts/bindings/test/vnd,mipi-dsi.yaml b/dts/bindings/test/vnd,mipi-dsi.yaml new file mode 100644 index 00000000000000..6e3027819d5a45 --- /dev/null +++ b/dts/bindings/test/vnd,mipi-dsi.yaml @@ -0,0 +1,11 @@ +# +# Copyright (c) 2024 TOKITA Hiroshi +# +# SPDX-License-Identifier: Apache-2.0 +# + +description: Test MIPI DSI host + +compatible: "vnd,mipi-dsi" + +include: [mipi-dsi-host.yaml] diff --git a/tests/drivers/build_all/display/app.overlay b/tests/drivers/build_all/display/app.overlay index d425bf103b976f..3c4ba1a5967ca2 100644 --- a/tests/drivers/build_all/display/app.overlay +++ b/tests/drivers/build_all/display/app.overlay @@ -135,8 +135,90 @@ width = <240>; height = <240>; }; + + test_spi_ssd1327fb: ssd1327fb@7 { + compatible = "solomon,ssd1327fb"; + reg = <7>; + mipi-max-frequency = <100000000>; + + width = <240>; + height = <240>; + oscillator-freq = <0>; + display-offset = <0>; + start-line = <0>; + multiplex-ratio = <0>; + prechargep = <0>; + remap-value = <0>; + }; }; + test_mipi_dsi { + compatible = "vnd,mipi-dsi"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + test_hx8394: hx8394@0 { + status = "okay"; + compatible = "himax,hx8394"; + reg = <0x0>; + reset-gpios = <&test_gpio 0 0>; + data-lanes = <2>; + width = <720>; + height = <1280>; + pixel-format = <0>; + }; + + test_nt35510: nt35510@1 { + status = "okay"; + compatible = "frida,nt35510"; + reg = <0x1>; + height = <800>; + width = <480>; + reset-gpios = <&test_gpio 0 0>; + bl-gpios = <&test_gpio 0 0>; + data-lanes = <2>; + pixel-format = <0>; + rotation = <90>; + }; + + test_otm8009a: otm8009a@2 { + status = "okay"; + compatible = "orisetech,otm8009a"; + reg = <0x2>; + height = <800>; + width = <480>; + reset-gpios = <&test_gpio 0 0>; + bl-gpios = <&test_gpio 0 0>; + data-lanes = <2>; + pixel-format = <0>; + rotation = <90>; + }; + + test_rm67162: rm67162@3 { + status = "okay"; + compatible = "raydium,rm67162"; + reg = <0x3>; + reset-gpios = <&test_gpio 0 0>; + bl-gpios = <&test_gpio 0 0>; + te-gpios = <&test_gpio 0 0>; + data-lanes = <1>; + width = <400>; + height = <392>; + pixel-format = <0>; + }; + + test_rm68200: rm68200@4 { + status = "okay"; + compatible = "raydium,rm68200"; + reg = <0x4>; + reset-gpios = <&test_gpio 0 0>; + data-lanes = <2>; + width = <720>; + height = <1280>; + pixel-format = <0>; + }; + }; test_spi: spi@33334444 { #address-cells = <1>; diff --git a/tests/drivers/build_all/display/prj.conf b/tests/drivers/build_all/display/prj.conf index 8b2c0984e43765..b7328a4325ce7c 100644 --- a/tests/drivers/build_all/display/prj.conf +++ b/tests/drivers/build_all/display/prj.conf @@ -2,3 +2,4 @@ CONFIG_TEST=y CONFIG_SPI=y CONFIG_GPIO=y CONFIG_DISPLAY=y +CONFIG_MIPI_DSI=y