summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/ti-vpe/cal.h
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2021-06-14 13:23:44 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-07-12 14:22:11 +0200
commit71e3a18114ebdb48482d731d04bff7a222036381 (patch)
tree7ec056cd5cd7ccb08090e5633b8e2206950d75c1 /drivers/media/platform/ti-vpe/cal.h
parent9eaca40c0d13a21848b5a35dc8c37dc3690a4ff1 (diff)
downloadlinux-71e3a18114ebdb48482d731d04bff7a222036381.tar.bz2
media: ti-vpe: cal: allow more than 1 source pads
CAL RX has a single sink and a single source pad. To support multiple streams, we will have multiple source pads (up to 8, one for each CAL context). Change the driver to allow creating more source pads and change the code accordingly to handle multiple source pads. We still keep CAL_CAMERARX_NUM_SOURCE_PADS as 1, and the behavior is unchanged. Also rename CAL_CAMERARX_PAD_SOURCE to CAL_CAMERARX_PAD_FIRST_SOURCE to highlight that it's the first source. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/platform/ti-vpe/cal.h')
-rw-r--r--drivers/media/platform/ti-vpe/cal.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/media/platform/ti-vpe/cal.h b/drivers/media/platform/ti-vpe/cal.h
index 006374be3f9f..d3e89d2ee10f 100644
--- a/drivers/media/platform/ti-vpe/cal.h
+++ b/drivers/media/platform/ti-vpe/cal.h
@@ -44,7 +44,22 @@
#define CAL_MAX_HEIGHT_LINES 16383
#define CAL_CAMERARX_PAD_SINK 0
-#define CAL_CAMERARX_PAD_SOURCE 1
+#define CAL_CAMERARX_PAD_FIRST_SOURCE 1
+#define CAL_CAMERARX_NUM_SOURCE_PADS 1
+#define CAL_CAMERARX_NUM_PADS (1 + CAL_CAMERARX_NUM_SOURCE_PADS)
+
+static inline bool cal_rx_pad_is_sink(u32 pad)
+{
+ /* Camera RX has 1 sink pad, and N source pads */
+ return pad == 0;
+}
+
+static inline bool cal_rx_pad_is_source(u32 pad)
+{
+ /* Camera RX has 1 sink pad, and N source pads */
+ return pad >= CAL_CAMERARX_PAD_FIRST_SOURCE &&
+ pad <= CAL_CAMERARX_NUM_SOURCE_PADS;
+}
struct device;
struct device_node;
@@ -161,8 +176,8 @@ struct cal_camerarx {
struct media_pipeline pipe;
struct v4l2_subdev subdev;
- struct media_pad pads[2];
- struct v4l2_mbus_framefmt formats[2];
+ struct media_pad pads[CAL_CAMERARX_NUM_PADS];
+ struct v4l2_mbus_framefmt formats[CAL_CAMERARX_NUM_PADS];
/*
* Lock for camerarx ops. Protects: