Implement the video control framework with the following features: - Drivers initialize the control with a valid value range at boot which guides the application developer and the framework. Hence, the video framework could do all common works for drivers e.g., sanity check. - Controls need to be cached to memory. Video framework handles get_ctrl(), drivers don't need to implement this API. It is because reading control value directly from registers are not only inefficient but also sometimes impossible, e.g. controls that scatter through several registers. Only "volatile" control needs to be updated at runtime. - Only the devices (e.g., sensors) owning the controls need to implement set_ctrl(). Other devices of the pipeline do not need to propagate set_ctrl() and hence, do not need to implement this API Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
29 lines
924 B
C
29 lines
924 B
C
/*
|
|
* Copyright 2025 NXP
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef ZEPHYR_INCLUDE_DRIVERS_VIDEO_VIDEO_DEVICE_H_
|
|
#define ZEPHYR_INCLUDE_DRIVERS_VIDEO_VIDEO_DEVICE_H_
|
|
|
|
#include <zephyr/device.h>
|
|
#include <zephyr/sys/dlist.h>
|
|
|
|
struct video_device {
|
|
const struct device *dev;
|
|
const struct device *src_dev;
|
|
sys_dlist_t ctrls;
|
|
};
|
|
|
|
#define VIDEO_DEVICE_DEFINE(name, device, source) \
|
|
static STRUCT_SECTION_ITERABLE(video_device, name) = { \
|
|
.dev = device, \
|
|
.src_dev = source, \
|
|
.ctrls = SYS_DLIST_STATIC_INIT(&name.ctrls), \
|
|
}
|
|
|
|
struct video_device *video_find_vdev(const struct device *dev);
|
|
|
|
#endif /* ZEPHYR_INCLUDE_DRIVERS_VIDEO_VIDEO_DEVICE_H_ */
|