diff mbox series

[05/11] media: adv748x-csi2: Initialize subdev format

Message ID 20240503155127.105235-6-jacopo.mondi@ideasonboard.com (mailing list archive)
State Superseded
Delegated to: Kieran Bingham
Headers show
Series media: renesas: rcar-csi2: Use the subdev active state | expand

Commit Message

Jacopo Mondi May 3, 2024, 3:51 p.m. UTC
Initialize the subdevice format to the default 1280x720 YUV 4:2:2.

The subdevice format is propagated from the frontend (HDMI or AFE) to
the CSI-2 tx, but it was not initialized during the CSI-2 tx
registration.

Use YUYV8 1280x720 as default format as it's supported by both TXes in
all supported configurations (1, 2 or 4 CSI-2 lanes).

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 drivers/media/i2c/adv748x/adv748x-csi2.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Laurent Pinchart May 5, 2024, 9:01 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Fri, May 03, 2024 at 05:51:20PM +0200, Jacopo Mondi wrote:
> Initialize the subdevice format to the default 1280x720 YUV 4:2:2.
> 
> The subdevice format is propagated from the frontend (HDMI or AFE) to
> the CSI-2 tx, but it was not initialized during the CSI-2 tx
> registration.
> 
> Use YUYV8 1280x720 as default format as it's supported by both TXes in
> all supported configurations (1, 2 or 4 CSI-2 lanes).
> 
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> ---
>  drivers/media/i2c/adv748x/adv748x-csi2.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
> index 5b265b722394..9da7f6742a2b 100644
> --- a/drivers/media/i2c/adv748x/adv748x-csi2.c
> +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
> @@ -14,6 +14,13 @@
>  
>  #include "adv748x.h"
>  
> +static const struct v4l2_mbus_framefmt adv748x_csi2_default_fmt = {
> +	.width = 1280,
> +	.height = 720,
> +	.code = MEDIA_BUS_FMT_YUYV8_1X16,
> +	.field = V4L2_FIELD_NONE,
> +};
> +
>  int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx, unsigned int vc)
>  {
>  	return tx_write(tx, ADV748X_CSI_VC_REF, vc << ADV748X_CSI_VC_REF_SHIFT);
> @@ -311,6 +318,8 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
>  	if (ret)
>  		return ret;
>  
> +	tx->format = adv748x_csi2_default_fmt;
> +

This looks OK, so

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

But patch 08/11 removes the tx->format field, so I think you could as
well drop this patch.

>  	ret = v4l2_async_subdev_endpoint_add(&tx->sd,
>  					     of_fwnode_handle(state->endpoints[tx->port]));
>  	if (ret)
diff mbox series

Patch

diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 5b265b722394..9da7f6742a2b 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -14,6 +14,13 @@ 
 
 #include "adv748x.h"
 
+static const struct v4l2_mbus_framefmt adv748x_csi2_default_fmt = {
+	.width = 1280,
+	.height = 720,
+	.code = MEDIA_BUS_FMT_YUYV8_1X16,
+	.field = V4L2_FIELD_NONE,
+};
+
 int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx, unsigned int vc)
 {
 	return tx_write(tx, ADV748X_CSI_VC_REF, vc << ADV748X_CSI_VC_REF_SHIFT);
@@ -311,6 +318,8 @@  int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
 	if (ret)
 		return ret;
 
+	tx->format = adv748x_csi2_default_fmt;
+
 	ret = v4l2_async_subdev_endpoint_add(&tx->sd,
 					     of_fwnode_handle(state->endpoints[tx->port]));
 	if (ret)