1 /*
2  * Copyright (c) 2024 TOKITA Hiroshi
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /*
8  * This is not a real mipi-dsi driver. It is used to instantiate struct
9  * devices for the "vnd,mipi-dsi" devicetree compatible used in test code.
10  */
11 
12 #include <zephyr/drivers/mipi_dsi.h>
13 
14 #define DT_DRV_COMPAT vnd_mipi_dsi
15 
vnd_mipi_dsi_attach(const struct device * dev,uint8_t channel,const struct mipi_dsi_device * mdev)16 static int vnd_mipi_dsi_attach(const struct device *dev, uint8_t channel,
17 			       const struct mipi_dsi_device *mdev)
18 {
19 	ARG_UNUSED(dev);
20 	ARG_UNUSED(channel);
21 	ARG_UNUSED(mdev);
22 
23 	return -ENOTSUP;
24 }
25 
vnd_mipi_dsi_transfer(const struct device * dev,uint8_t channel,struct mipi_dsi_msg * msg)26 static ssize_t vnd_mipi_dsi_transfer(const struct device *dev, uint8_t channel,
27 				     struct mipi_dsi_msg *msg)
28 {
29 	ARG_UNUSED(dev);
30 	ARG_UNUSED(channel);
31 	ARG_UNUSED(msg);
32 
33 	return -1;
34 }
35 
vnd_mipi_dsi_detach(const struct device * dev,uint8_t channel,const struct mipi_dsi_device * mdev)36 static int vnd_mipi_dsi_detach(const struct device *dev, uint8_t channel,
37 			       const struct mipi_dsi_device *mdev)
38 {
39 	ARG_UNUSED(dev);
40 	ARG_UNUSED(channel);
41 	ARG_UNUSED(mdev);
42 
43 	return -ENOTSUP;
44 }
45 
46 static DEVICE_API(mipi_dsi, vnd_mipi_dsi_api) = {
47 	.attach = vnd_mipi_dsi_attach,
48 	.transfer = vnd_mipi_dsi_transfer,
49 	.detach = vnd_mipi_dsi_detach,
50 };
51 
52 #define VND_MIPI_DSI_INIT(n)                                                                       \
53 	DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, POST_KERNEL,                              \
54 			      CONFIG_MIPI_DSI_INIT_PRIORITY, &vnd_mipi_dsi_api);
55 
56 DT_INST_FOREACH_STATUS_OKAY(VND_MIPI_DSI_INIT)
57