mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: adv7180: Fix media bus format
@ 2022-01-27 10:09 Jean-Michel Hautbois
  2022-01-27 13:44 ` Laurent Pinchart
  2022-01-27 13:45 ` Dave Stevenson
  0 siblings, 2 replies; 3+ messages in thread
From: Jean-Michel Hautbois @ 2022-01-27 10:09 UTC (permalink / raw)
  To: linux-media
  Cc: lars, mchehab, linux-kernel, laurent.pinchart, Jean-Michel Hautbois

MEDIA_BUS_FMT_UYVY8_2X8 isn't correct for CSI-2. Use
MEDIA_BUS_FMT_UYVY8_1X16 instead.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
---
 drivers/media/i2c/adv7180.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index d9a99fcfacb1..cbededfb6b3f 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -655,7 +655,7 @@ static int adv7180_enum_mbus_code(struct v4l2_subdev *sd,
 	if (code->index != 0)
 		return -EINVAL;
 
-	code->code = MEDIA_BUS_FMT_UYVY8_2X8;
+	code->code = MEDIA_BUS_FMT_UYVY8_1X16;
 
 	return 0;
 }
@@ -665,7 +665,7 @@ static int adv7180_mbus_fmt(struct v4l2_subdev *sd,
 {
 	struct adv7180_state *state = to_state(sd);
 
-	fmt->code = MEDIA_BUS_FMT_UYVY8_2X8;
+	fmt->code = MEDIA_BUS_FMT_UYVY8_1X16;
 	fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
 	fmt->width = 720;
 	fmt->height = state->curr_norm & V4L2_STD_525_60 ? 480 : 576;
-- 
2.32.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: adv7180: Fix media bus format
  2022-01-27 10:09 [PATCH] media: adv7180: Fix media bus format Jean-Michel Hautbois
@ 2022-01-27 13:44 ` Laurent Pinchart
  2022-01-27 13:45 ` Dave Stevenson
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2022-01-27 13:44 UTC (permalink / raw)
  To: Jean-Michel Hautbois; +Cc: linux-media, lars, mchehab, linux-kernel

Hi Jean-Michel,

Thank you for the patch.

On Thu, Jan 27, 2022 at 11:09:47AM +0100, Jean-Michel Hautbois wrote:
> MEDIA_BUS_FMT_UYVY8_2X8 isn't correct for CSI-2. Use
> MEDIA_BUS_FMT_UYVY8_1X16 instead.

While that's right, I expect it will cause regressions. The driver
probably needs to support for media bus codes.

> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> ---
>  drivers/media/i2c/adv7180.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
> index d9a99fcfacb1..cbededfb6b3f 100644
> --- a/drivers/media/i2c/adv7180.c
> +++ b/drivers/media/i2c/adv7180.c
> @@ -655,7 +655,7 @@ static int adv7180_enum_mbus_code(struct v4l2_subdev *sd,
>  	if (code->index != 0)
>  		return -EINVAL;
>  
> -	code->code = MEDIA_BUS_FMT_UYVY8_2X8;
> +	code->code = MEDIA_BUS_FMT_UYVY8_1X16;
>  
>  	return 0;
>  }
> @@ -665,7 +665,7 @@ static int adv7180_mbus_fmt(struct v4l2_subdev *sd,
>  {
>  	struct adv7180_state *state = to_state(sd);
>  
> -	fmt->code = MEDIA_BUS_FMT_UYVY8_2X8;
> +	fmt->code = MEDIA_BUS_FMT_UYVY8_1X16;
>  	fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
>  	fmt->width = 720;
>  	fmt->height = state->curr_norm & V4L2_STD_525_60 ? 480 : 576;

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: adv7180: Fix media bus format
  2022-01-27 10:09 [PATCH] media: adv7180: Fix media bus format Jean-Michel Hautbois
  2022-01-27 13:44 ` Laurent Pinchart
@ 2022-01-27 13:45 ` Dave Stevenson
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Stevenson @ 2022-01-27 13:45 UTC (permalink / raw)
  To: Jean-Michel Hautbois
  Cc: Linux Media Mailing List, lars, Mauro Carvalho Chehab, LKML,
	Laurent Pinchart

Hi Jean-Michel

On Thu, 27 Jan 2022 at 10:09, Jean-Michel Hautbois
<jeanmichel.hautbois@ideasonboard.com> wrote:
>
> MEDIA_BUS_FMT_UYVY8_2X8 isn't correct for CSI-2. Use
> MEDIA_BUS_FMT_UYVY8_1X16 instead.

2X8 isn't correct for CSI-2, but it is correct for the parallel
configuration that is also supported by this driver.

Referencing the adv7180 datasheet[1] page 76, OF_SEL (bits [5:2] of
register 0x03) are 0010b for 16bit, or 0011b for 8 bit.
[2] in the driver sets these bits to 0011b, so it is in 2x8 mode.

You may be able to get away with a simple check of
if (state->chip_info->flags & ADV7180_FLAG_MIPI_CSI2)
  fmt->code = MEDIA_BUS_FMT_UYVY8_1X16;
else
  fmt->code = MEDIA_BUS_FMT_UYVY8_2X8;
but I haven't examined all the potential options.

  Dave

[1] https://www.analog.com/media/en/technical-documentation/data-sheets/ADV7180.pdf
[2] https://github.com/torvalds/linux/blob/master/drivers/media/i2c/adv7180.c#L1006

> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> ---
>  drivers/media/i2c/adv7180.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
> index d9a99fcfacb1..cbededfb6b3f 100644
> --- a/drivers/media/i2c/adv7180.c
> +++ b/drivers/media/i2c/adv7180.c
> @@ -655,7 +655,7 @@ static int adv7180_enum_mbus_code(struct v4l2_subdev *sd,
>         if (code->index != 0)
>                 return -EINVAL;
>
> -       code->code = MEDIA_BUS_FMT_UYVY8_2X8;
> +       code->code = MEDIA_BUS_FMT_UYVY8_1X16;
>
>         return 0;
>  }
> @@ -665,7 +665,7 @@ static int adv7180_mbus_fmt(struct v4l2_subdev *sd,
>  {
>         struct adv7180_state *state = to_state(sd);
>
> -       fmt->code = MEDIA_BUS_FMT_UYVY8_2X8;
> +       fmt->code = MEDIA_BUS_FMT_UYVY8_1X16;
>         fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
>         fmt->width = 720;
>         fmt->height = state->curr_norm & V4L2_STD_525_60 ? 480 : 576;
> --
> 2.32.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-27 13:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 10:09 [PATCH] media: adv7180: Fix media bus format Jean-Michel Hautbois
2022-01-27 13:44 ` Laurent Pinchart
2022-01-27 13:45 ` Dave Stevenson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®