drivers: i3c: add dummy driver for vnd,i3c
It is just used to be able to DEVICE_DT_GET() bus devices from tests/drivers/build_all in an upcoming commit. Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
parent
2c19de53bc
commit
0d9654670f
|
@ -30,3 +30,8 @@ zephyr_library_sources_ifdef(
|
||||||
CONFIG_I3C_CADENCE
|
CONFIG_I3C_CADENCE
|
||||||
i3c_cdns.c
|
i3c_cdns.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef(
|
||||||
|
CONFIG_I3C_TEST
|
||||||
|
i3c_test.c
|
||||||
|
)
|
||||||
|
|
|
@ -100,5 +100,6 @@ comment "Device Drivers"
|
||||||
|
|
||||||
rsource "Kconfig.nxp"
|
rsource "Kconfig.nxp"
|
||||||
rsource "Kconfig.cdns"
|
rsource "Kconfig.cdns"
|
||||||
|
rsource "Kconfig.test"
|
||||||
|
|
||||||
endif # I3C
|
endif # I3C
|
||||||
|
|
11
drivers/i3c/Kconfig.test
Normal file
11
drivers/i3c/Kconfig.test
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Copyright (c) 2021, Commonwealth Scientific and Industrial Research
|
||||||
|
# Organisation (CSIRO) ABN 41 687 119 230.
|
||||||
|
# Copyright (c) 2023 STMicroelectronics
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# Hidden option for turning on the dummy driver for vnd,i3c devices
|
||||||
|
# used in testing.
|
||||||
|
config I3C_TEST
|
||||||
|
def_bool DT_HAS_VND_I3C_ENABLED
|
||||||
|
depends on DT_HAS_VND_I3C_ENABLED
|
47
drivers/i3c/i3c_test.c
Normal file
47
drivers/i3c/i3c_test.c
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is not a real I3C driver. It is used to instantiate struct
|
||||||
|
* devices for the "vnd,i3c" devicetree compatible used in test code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DT_DRV_COMPAT vnd_i3c
|
||||||
|
|
||||||
|
#include <zephyr/drivers/i3c.h>
|
||||||
|
#include <zephyr/device.h>
|
||||||
|
#include <zephyr/kernel.h>
|
||||||
|
|
||||||
|
static int vnd_i3c_configure(const struct device *dev,
|
||||||
|
enum i3c_config_type type, void *config)
|
||||||
|
{
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int vnd_i3c_config_get(const struct device *dev,
|
||||||
|
enum i3c_config_type type, void *config)
|
||||||
|
{
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int vnd_i3c_recover_bus(const struct device *dev)
|
||||||
|
{
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct i3c_driver_api vnd_i3c_api = {
|
||||||
|
.configure = vnd_i3c_configure,
|
||||||
|
.config_get = vnd_i3c_config_get,
|
||||||
|
.recover_bus = vnd_i3c_recover_bus,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define VND_I3C_INIT(n) \
|
||||||
|
DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, \
|
||||||
|
POST_KERNEL, \
|
||||||
|
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
||||||
|
&vnd_i3c_api);
|
||||||
|
|
||||||
|
DT_INST_FOREACH_STATUS_OKAY(VND_I3C_INIT)
|
Loading…
Reference in a new issue