Skip to content

Commit

Permalink
drivers: mipi_dsi: Add dummy driver for vnd,mipi-dsi
Browse files Browse the repository at this point in the history
Add dummy driver for "vnd,mipi-dsi" to use in build_all tests.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
  • Loading branch information
soburi committed Sep 27, 2024
1 parent 2485102 commit 85aaccb
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/mipi_dsi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions drivers/mipi_dsi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ config MIPI_DSI_INIT_PRIORITY

source "drivers/mipi_dsi/Kconfig.mcux"
source "drivers/mipi_dsi/Kconfig.stm32"
source "drivers/mipi_dsi/Kconfig.test"

endif
6 changes: 6 additions & 0 deletions drivers/mipi_dsi/Kconfig.test
Original file line number Diff line number Diff line change
@@ -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
56 changes: 56 additions & 0 deletions drivers/mipi_dsi/dsi_test.c
Original file line number Diff line number Diff line change
@@ -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 <zephyr/drivers/mipi_dsi.h>

#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)
11 changes: 11 additions & 0 deletions dts/bindings/test/vnd,mipi-dsi.yaml
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit 85aaccb

Please sign in to comment.