]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: rockchip: rga: add feature flags
authorSven Püschel <s.pueschel@pengutronix.de>
Wed, 20 May 2026 22:44:30 +0000 (00:44 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Thu, 21 May 2026 10:32:21 +0000 (12:32 +0200)
In preparation to the RGA3 addition add feature flags, which can limit
the exposed feature set of the video device, like rotating or selection
support. This is necessary as the RGA3 doesn't initially implement the
full feature set currently exposed by the driver.

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/rockchip/rga/rga-hw.c
drivers/media/platform/rockchip/rga/rga.c
drivers/media/platform/rockchip/rga/rga.h

index 616ea1bc11311f9d359a55d2348f879090815e1c..be1bc8ddbd03bf10630589bd180e4c795d9c0a36 100644 (file)
@@ -602,6 +602,9 @@ const struct rga_hw rga2_hw = {
        .max_height = MAX_HEIGHT,
        .max_scaling_factor = MAX_SCALING_FACTOR,
        .stride_alignment = 4,
+       .features = RGA_FEATURE_FLIP
+                 | RGA_FEATURE_ROTATE
+                 | RGA_FEATURE_BG_COLOR,
 
        .setup_cmdbuf = rga_hw_setup_cmdbuf,
        .start = rga_hw_start,
index 1878b4e26360b2924cb2cad3fa5e6fbf57071f2f..8d60e94da32d8a0c3c8dc3e65e4de09fbf508f77 100644 (file)
@@ -177,17 +177,21 @@ static int rga_setup_ctrls(struct rga_ctx *ctx)
 
        v4l2_ctrl_handler_init(&ctx->ctrl_handler, 4);
 
-       v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
-                         V4L2_CID_HFLIP, 0, 1, 1, 0);
+       if (rga->hw->features & RGA_FEATURE_FLIP) {
+               v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
+                                 V4L2_CID_HFLIP, 0, 1, 1, 0);
 
-       v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
-                         V4L2_CID_VFLIP, 0, 1, 1, 0);
+               v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
+                                 V4L2_CID_VFLIP, 0, 1, 1, 0);
+       }
 
-       v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
-                         V4L2_CID_ROTATE, 0, 270, 90, 0);
+       if (rga->hw->features & RGA_FEATURE_ROTATE)
+               v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
+                                 V4L2_CID_ROTATE, 0, 270, 90, 0);
 
-       v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
-                         V4L2_CID_BG_COLOR, 0, 0xffffffff, 1, 0);
+       if (rga->hw->features & RGA_FEATURE_BG_COLOR)
+               v4l2_ctrl_new_std(&ctx->ctrl_handler, &rga_ctrl_ops,
+                                 V4L2_CID_BG_COLOR, 0, 0xffffffff, 1, 0);
 
        if (ctx->ctrl_handler.error) {
                int err = ctx->ctrl_handler.error;
index effe364a86b02821df5d533b297b4da0f5e5abd0..feaf40acd4ee45db804d80f1989ebe159661846d 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef __RGA_H__
 #define __RGA_H__
 
+#include <linux/bits.h>
 #include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <media/videobuf2-v4l2.h>
@@ -137,6 +138,10 @@ static inline void rga_mod(struct rockchip_rga *rga, u32 reg, u32 val, u32 mask)
        rga_write(rga, reg, temp);
 };
 
+#define RGA_FEATURE_FLIP       BIT(0)
+#define RGA_FEATURE_ROTATE     BIT(1)
+#define RGA_FEATURE_BG_COLOR   BIT(2)
+
 struct rga_hw {
        const char *card_type;
        bool has_internal_iommu;
@@ -145,6 +150,7 @@ struct rga_hw {
        u32 max_width, max_height;
        u8 max_scaling_factor;
        u8 stride_alignment;
+       u8 features;
 
        void (*setup_cmdbuf)(struct rga_ctx *ctx);
        void (*start)(struct rockchip_rga *rga,