summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-06 20:36:22 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-07-19 10:28:45 +0200
commit8fcb7576ad197b0d65fe68ef60b7e1097e18df0c (patch)
treea35c5b8c359a07c8c41932a5e40ca7fb621a1faa /drivers
parenta439e57358ee1562257668d77b19f8f1a629a1fd (diff)
media: ti-vpe: cal: Allow multiple contexts per subdev notifier
The subdev notifier handling assumes a 1:1 mapping between CAL contexts and notifiers. To prepare for merging the multiple notifiers into a single one, retrieve the CAL context from the async subdev structure instead of from the notifier. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/platform/ti-vpe/cal.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index b5eb6a640d70..83e790941e22 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -2115,11 +2115,22 @@ static void cal_ctx_v4l2_cleanup(struct cal_ctx *ctx)
* ------------------------------------------------------------------
*/
+struct cal_v4l2_async_subdev {
+ struct v4l2_async_subdev asd;
+ struct cal_ctx *ctx;
+};
+
+static inline struct cal_v4l2_async_subdev *
+to_cal_asd(struct v4l2_async_subdev *asd)
+{
+ return container_of(asd, struct cal_v4l2_async_subdev, asd);
+}
+
static int cal_async_bound(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev,
struct v4l2_async_subdev *asd)
{
- struct cal_ctx *ctx = notifier_to_ctx(notifier);
+ struct cal_ctx *ctx = to_cal_asd(asd)->ctx;
if (ctx->phy->sensor) {
ctx_info(ctx, "Rejecting subdev %s (Already set!!)",
@@ -2148,6 +2159,7 @@ static const struct v4l2_async_notifier_operations cal_async_ops = {
static int of_cal_create_instance(struct cal_ctx *ctx, int inst)
{
+ struct cal_v4l2_async_subdev *casd;
struct v4l2_async_subdev *asd;
struct fwnode_handle *fwnode;
int ret;
@@ -2163,6 +2175,9 @@ static int of_cal_create_instance(struct cal_ctx *ctx, int inst)
return PTR_ERR(asd);
}
+ casd = to_cal_asd(asd);
+ casd->ctx = ctx;
+
ret = v4l2_async_notifier_register(&ctx->cal->v4l2_dev,
&ctx->notifier);
if (ret) {