Commit 38e89e79 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

media: ti-vpe: cal: Implement media controller centric API

The CAL driver is video node centric, it controls the whole device
through the video device nodes. This limits the possible use cases as it
can't support sources that are more complex than a single subdev. To
support more complex hardware pipelines, implement support for the media
controller centric API. The exposed API can be selected through a module
parameter.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent b8320917
......@@ -186,6 +186,20 @@ config VIDEO_TI_CAL
In TI Technical Reference Manual this module is referred as
Camera Interface Subsystem (CAMSS).
if VIDEO_TI_CAL
config VIDEO_TI_CAL_MC
bool "Media Controller centric mode by default"
default n
help
Enables Media Controller centric mode by default.
If set, CAL driver will start in Media Controller mode by
default. Note that this behavior can be overridden via
module parameter 'mc_api'.
endif # VIDEO_TI_CAL
endif # V4L_PLATFORM_DRIVERS
menuconfig V4L_MEM2MEM_DRIVERS
......
......@@ -830,6 +830,7 @@ struct cal_camerarx *cal_camerarx_create(struct cal_dev *cal,
sd = &phy->subdev;
v4l2_subdev_init(sd, &cal_camerarx_subdev_ops);
sd->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
snprintf(sd->name, sizeof(sd->name), "CAMERARX%u", instance);
sd->dev = cal->dev;
......
This diff is collapsed.
......@@ -43,6 +43,16 @@ unsigned int cal_debug;
module_param_named(debug, cal_debug, uint, 0644);
MODULE_PARM_DESC(debug, "activates debug info");
#ifdef CONFIG_VIDEO_TI_CAL_MC
#define CAL_MC_API_DEFAULT 1
#else
#define CAL_MC_API_DEFAULT 0
#endif
bool cal_mc_api = CAL_MC_API_DEFAULT;
module_param_named(mc_api, cal_mc_api, bool, 0444);
MODULE_PARM_DESC(mc_api, "activates the MC API");
/* ------------------------------------------------------------------
* Format Handling
* ------------------------------------------------------------------
......@@ -660,13 +670,17 @@ static int cal_async_notifier_complete(struct v4l2_async_notifier *notifier)
{
struct cal_dev *cal = container_of(notifier, struct cal_dev, notifier);
unsigned int i;
int ret = 0;
for (i = 0; i < ARRAY_SIZE(cal->ctx); ++i) {
if (cal->ctx[i])
cal_ctx_v4l2_register(cal->ctx[i]);
}
return 0;
if (cal_mc_api)
ret = v4l2_device_register_subdev_nodes(&cal->v4l2_dev);
return ret;
}
static const struct v4l2_async_notifier_operations cal_async_notifier_ops = {
......
......@@ -160,6 +160,7 @@ struct cal_camerarx {
struct device_node *sensor_ep_node;
struct device_node *sensor_node;
struct v4l2_subdev *sensor;
struct media_pipeline pipe;
struct v4l2_subdev subdev;
struct media_pad pads[2];
......@@ -224,6 +225,7 @@ struct cal_ctx {
extern unsigned int cal_debug;
extern int cal_video_nr;
extern bool cal_mc_api;
#define cal_dbg(level, cal, fmt, arg...) \
do { \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment