[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a5abd83b62220e86fd5ce627aa67c7236efb57e3.camel@ndufresne.ca>
Date: Wed, 24 Dec 2025 11:00:37 -0500
From: Nicolas Dufresne <nicolas@...fresne.ca>
To: Sven Püschel <s.pueschel@...gutronix.de>, Jacob Chen
<jacob-chen@...wrt.com>, Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
Mauro Carvalho Chehab
<mchehab@...nel.org>, Heiko Stuebner <heiko@...ech.de>, Rob Herring
<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>
Cc: linux-media@...r.kernel.org, linux-rockchip@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, kernel@...gutronix.de
Subject: Re: [PATCH v2 19/22] media: rockchip: rga: add feature flags
Le mercredi 03 décembre 2025 à 16:52 +0100, Sven Püschel a écrit :
> 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.
>
> Signed-off-by: Sven Püschel <s.pueschel@...gutronix.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@...labora.com>
> ---
> drivers/media/platform/rockchip/rga/rga-hw.c | 4 ++++
> drivers/media/platform/rockchip/rga/rga.c | 23 +++++++++++++++--------
> drivers/media/platform/rockchip/rga/rga.h | 7 +++++++
> 3 files changed, 26 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/platform/rockchip/rga/rga-hw.c
> b/drivers/media/platform/rockchip/rga/rga-hw.c
> index a868a34a1452e..0d1cf911af0d5 100644
> --- a/drivers/media/platform/rockchip/rga/rga-hw.c
> +++ b/drivers/media/platform/rockchip/rga/rga-hw.c
> @@ -658,6 +658,10 @@ 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
> + | RGA_FEATURE_SELECTION,
>
> .setup_cmdbuf = rga_hw_setup_cmdbuf,
> .start = rga_hw_start,
> diff --git a/drivers/media/platform/rockchip/rga/rga.c
> b/drivers/media/platform/rockchip/rga/rga.c
> index c991cc64b4b7f..3958e71b8987d 100644
> --- a/drivers/media/platform/rockchip/rga/rga.c
> +++ b/drivers/media/platform/rockchip/rga/rga.c
> @@ -162,17 +162,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;
> @@ -489,6 +493,9 @@ static int vidioc_s_selection(struct file *file, void
> *priv,
> struct rga_frame *f;
> int ret = 0;
>
> + if (!(rga->hw->features & RGA_FEATURE_SELECTION))
> + return -EINVAL;
> +
> f = rga_get_frame(ctx, s->type);
> if (IS_ERR(f))
> return PTR_ERR(f);
> diff --git a/drivers/media/platform/rockchip/rga/rga.h
> b/drivers/media/platform/rockchip/rga/rga.h
> index 980f70f842317..b9c75b5fda4dc 100644
> --- a/drivers/media/platform/rockchip/rga/rga.h
> +++ b/drivers/media/platform/rockchip/rga/rga.h
> @@ -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>
> @@ -132,6 +133,11 @@ 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)
> +#define RGA_FEATURE_SELECTION BIT(3)
> +
> struct rga_hw {
> const char *card_type;
> bool has_internal_iommu;
> @@ -140,6 +146,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,
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists