ST MIPID02 bridge format propagation fixes
Subsystems (2)
cover ST MIPID02 bridge format propagation fixes
Hello all
This small patchset just fixes some issues with format propagation in the MIPID02 bridge driver, which was either failing to propagate formats from sink to source pad at all or else propagating the ACTIVE format to the source when the sink's TRY format was set.
Thanks
Dan
Daniel Scally (2):
media: i2c: Correct format propagation for st-mipid02
media: i2c: Propagate format from sink to source pad
drivers/media/i2c/st-mipid02.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/2 media: i2c: Correct format propagation for st-mipid02
Format propagation in the st-mipid02 driver is incorrect in that when setting format for V4L2_SUBDEV_FORMAT_TRY on the source pad, the _active_ rather than _try_ format from the sink pad is propagated. This causes problems with format negotiation - update the function to propagate the correct format.
--- drivers/media/i2c/st-mipid02.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/media/i2c/st-mipid02.c +7 -2
@@ -736,8 +736,13 @@ static void mipid02_set_fmt_source(struct v4l2_subdev *sd, {struct mipid02_dev *bridge =to_mipid02_dev (sd); -/* source pad mirror active sink pad */ - format->format = bridge->fmt; +/* source pad mirror sink pad */ +if (format->which ==V4L2_SUBDEV_FORMAT_ACTIVE ) + format->format = bridge->fmt; +else + format->format = *v4l2_subdev_get_try_format (sd, sd_state, +MIPID02_SINK_0 ); +/* but code may need to be converted */ format->format.code =serial_to_parallel_code (format->format.code);
Signature · 1 line
2.34.1
PATCH 2/2 media: i2c: Propagate format from sink to source pad
In reply to Daniel ScallyWhen setting formats on the sink pad, propagate the adjusted format over to the subdev's source pad. Use the MIPID02_SOURCE macro to fetch the pad's try format rather than relying on the pad field of the format to facilitate this - the function is specific to the source pad anyway.
--- drivers/media/i2c/st-mipid02.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/i2c/st-mipid02.c +4 -1
@@ -750,7 +750,7 @@ static void mipid02_set_fmt_source(struct v4l2_subdev *sd,if (format->which !=V4L2_SUBDEV_FORMAT_TRY )return ; - *v4l2_subdev_get_try_format (sd, sd_state, format->pad) = format->format; + *v4l2_subdev_get_try_format (sd, sd_state,MIPID02_SOURCE ) = format->format; } static void mipid02_set_fmt_sink(struct v4l2_subdev *sd,
@@ -768,6 +768,9 @@ static void mipid02_set_fmt_sink(struct v4l2_subdev *sd, fmt = &bridge->fmt; *fmt = format->format; + +/* Propagate the format change to the source pad */ +mipid02_set_fmt_source (sd, sd_state, format); } static int mipid02_set_fmt(struct v4l2_subdev *sd,
Signature · 1 line
2.34.1
Benjamin Mugnier
maintainerRe: [PATCH 2/2] media: i2c: Propagate format from sink to source pad
Hi Daniel,
Thank you for your patch.
Quoted 24 lines · Daniel Scally
When setting formats on the sink pad, propagate the adjusted format over to the subdev's source pad. Use the
MIPID02_SOURCEmacro to fetch the pad's try format rather than relying on the pad field of the format to facilitate this - the function is specific to the source pad anyway.Signed-off-by Daniel Scally <[email protected]>--- drivers/media/i2c/st-mipid02.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/media/i2c/st-mipid02.c +1
-1@@ -750,7 +750,7 @@ static void mipid02_set_fmt_source(struct v4l2_subdev *sd,if (format->which !=V4L2_SUBDEV_FORMAT_TRY )return ; - *v4l2_subdev_get_try_format (sd, sd_state, format->pad) = format->format; + *v4l2_subdev_get_try_format (sd, sd_state,MIPID02_SOURCE ) = format->format; } static void mipid02_set_fmt_sink(struct v4l2_subdev *sd,
drivers/media/i2c/st-mipid02.c static void mipid02_set_fmt_sink(struct v4l2_subdev *sd, · line 776
Quoted 9 lines
drivers/media/i2c/st-mipid02.c +3
-0@@ -768,6 +768,9 @@ static void mipid02_set_fmt_sink(struct v4l2_subdev *sd, fmt = &bridge->fmt; *fmt = format->format; + +/* Propagate the format change to the source pad */ +mipid02_set_fmt_source (sd, sd_state, format); } static int mipid02_set_fmt(struct v4l2_subdev *sd,
By running checkpatch, I got 2 warnings :
$ ./scripts/checkpatch.pl --strict --max-line-length=80 WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) #7: over to the subdev's source pad. Use the MIPID02_SOURCE macro to fetch the pad's
WARNING: line length of 83 exceeds 80 columns
#25: FILE: drivers/media/i2c/st-mipid02.c:753:
+ *v4l2_subdev_get_try_format(sd, sd_state, MIPID02_SOURCE) =format->format;
Could you fix these in version 2 ? st-mipid02.c has other styling issues but I'd like not to add new ones ;)
Other than that, the code looks fine for me.
Thank you.
Signature · 3 lines
Regards, Benjamin
Re: [PATCH 2/2] media: i2c: Propagate format from sink to source pad
Hello Benjamin
Quoted 52 lines · Benjamin Mugnier
Hi Daniel,
Thank you for your patch.
Quoted 24 lines · Daniel Scally
When setting formats on the sink pad, propagate the adjusted format over to the subdev's source pad. Use the
MIPID02_SOURCEmacro to fetch the pad's try format rather than relying on the pad field of the format to facilitate this - the function is specific to the source pad anyway.Signed-off-by Daniel Scally <[email protected]>--- drivers/media/i2c/st-mipid02.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/media/i2c/st-mipid02.c +1
-1@@ -750,7 +750,7 @@ static void mipid02_set_fmt_source(struct v4l2_subdev *sd,if (format->which !=V4L2_SUBDEV_FORMAT_TRY )return ; - *v4l2_subdev_get_try_format (sd, sd_state, format->pad) = format->format; + *v4l2_subdev_get_try_format (sd, sd_state,MIPID02_SOURCE ) = format->format; } static void mipid02_set_fmt_sink(struct v4l2_subdev *sd,drivers/media/i2c/st-mipid02.c static void mipid02_set_fmt_sink(struct v4l2_subdev *sd, · line 776
Quoted 9 lines
drivers/media/i2c/st-mipid02.c +3
-0@@ -768,6 +768,9 @@ static void mipid02_set_fmt_sink(struct v4l2_subdev *sd, fmt = &bridge->fmt; *fmt = format->format; + +/* Propagate the format change to the source pad */ +mipid02_set_fmt_source (sd, sd_state, format); } static int mipid02_set_fmt(struct v4l2_subdev *sd,By running checkpatch, I got 2 warnings :
$ ./scripts/checkpatch.pl --strict --max-line-length=80 WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) #7: over to the subdev's source pad. Use the MIPID02_SOURCE macro to fetch the pad'sWARNING: line length of 83 exceeds 80 columns
#25: FILE:drivers/media/i2c/st-mipid02.c:753:(quoted diff) +1
-0+ *v4l2_subdev_get_try_format(sd, sd_state, MIPID02_SOURCE) =
format->format;
Quoted 2 lines
Could you fix these in version 2 ?
st-mipid02.chas other styling issues but I'd like not to add new ones ;)
Sure thing - thanks for the review
Quoted 6 lines
Other than that, the code looks fine for me.
Thank you.