Re: [PATCH v2 1/2] media: i2c: ov5645: Report streams using frame descriptors

From: Sakari Ailus

Date: Sat Mar 28 2026 - 10:00:51 EST


Hi Prabhakar,

Thanks for the patch.

On Sat, Mar 28, 2026 at 01:29:01PM +0000, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Implement the .get_frame_desc() subdev operation to report information
> about streams to the connected CSI-2 receiver. This is required to let
> the CSI-2 receiver driver know about virtual channels and data types for
> each stream.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>
> ---
> Changes since v3 [0],
> - Added a macro for the source pad index.
> - Updated ov5645_init_state() to use the new macro.
>
> [0] https://lore.kernel.org/all/20241018153230.235647-9-prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx/
>
> Hi Laurent,
>
> Ive restored your RB tag with the above changes. Please let me know if
> you have any further comments.
> Cheers,
> Prabhakar
> ---
> drivers/media/i2c/ov5645.c | 29 ++++++++++++++++++++++++++++-
> 1 file changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
> index b10d408034a1..df9001fce44d 100644
> --- a/drivers/media/i2c/ov5645.c
> +++ b/drivers/media/i2c/ov5645.c
> @@ -28,6 +28,7 @@
> #include <linux/regulator/consumer.h>
> #include <linux/slab.h>
> #include <linux/types.h>
> +#include <media/mipi-csi2.h>
> #include <media/v4l2-ctrls.h>
> #include <media/v4l2-fwnode.h>
> #include <media/v4l2-subdev.h>
> @@ -68,6 +69,8 @@ static const char * const ov5645_supply_name[] = {
>
> #define OV5645_NUM_SUPPLIES ARRAY_SIZE(ov5645_supply_name)
>
> +#define OV5645_PAD_SOURCE 0
> +
> struct reg_value {
> u16 reg;
> u8 val;
> @@ -817,6 +820,29 @@ static const struct v4l2_ctrl_ops ov5645_ctrl_ops = {
> .s_ctrl = ov5645_s_ctrl,
> };
>
> +static int ov5645_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
> + struct v4l2_mbus_frame_desc *fd)
> +{
> + struct v4l2_subdev_state *state;
> + u32 code;
> +
> + state = v4l2_subdev_lock_and_get_active_state(sd);
> + code = v4l2_subdev_state_get_format(state, OV5645_PAD_SOURCE, 0)->code;
> + v4l2_subdev_unlock_state(state);
> +
> + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
> + fd->num_entries = 1;
> +
> + memset(fd->entry, 0, sizeof(fd->entry));
> +
> + fd->entry[0].pixelcode = code;
> + fd->entry[0].stream = 0;
> + fd->entry[0].bus.csi2.vc = 0;
> + fd->entry[0].bus.csi2.dt = MIPI_CSI2_DT_YUV422_8B;

Instead of doing this, could you use my patch here
<URL:https://git.linuxtv.org/sailus/media_tree.git/commit/?h=metadata&id=56eaab0eed55e5e777344e0b3973d8072786dd98>?

Every caller needs to be changed, too, but there are less than ten so
that's a non-issue.

> +
> + return 0;
> +}
> +
> static int ov5645_enum_mbus_code(struct v4l2_subdev *sd,
> struct v4l2_subdev_state *sd_state,
> struct v4l2_subdev_mbus_code_enum *code)

--
Regards,

Sakari Ailus