Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH 0/4] Various CCS fixes
@ 2026-11-23 12:02 David Heidelberg via B4 Relay
  2026-11-23 12:02 ` [PATCH 1/4] media: ccs: Use dev_dbg() instead of dev_err() in ccs_enum_mbus_code() David Heidelberg via B4 Relay
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: David Heidelberg via B4 Relay @ 2026-11-23 12:02 UTC (permalink / raw)
  To: Sakari Ailus, Mauro Carvalho Chehab, Hans Verkuil,
	Laurent Pinchart
  Cc: linux-media, David Heidelberg

First two seems to be no-brainers. Next two seems to be correct too.

Signed-off-by: David Heidelberg <david@ixit.cz>
---
David Heidelberg (4):
      media: ccs: Use dev_dbg() instead of dev_err() in ccs_enum_mbus_code()
      media: ccs: Fix sub-device index in ccs_cleanup()
      media: ccs: Update PLL and blanking limits when pixel_array crop changes
      media: ccs: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flip controls

 drivers/media/i2c/ccs/ccs-core.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726
change-id: 20261123-ccs-clanked-fixes-609bb0754028

Best regards,
--  
David Heidelberg <david@ixit.cz>



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

* [PATCH 1/4] media: ccs: Use dev_dbg() instead of dev_err() in ccs_enum_mbus_code()
  2026-11-23 12:02 [PATCH 0/4] Various CCS fixes David Heidelberg via B4 Relay
@ 2026-11-23 12:02 ` David Heidelberg via B4 Relay
  2026-11-23 16:53   ` Laurent Pinchart
  2026-11-23 12:02 ` [PATCH 2/4] media: ccs: Fix sub-device index in ccs_cleanup() David Heidelberg via B4 Relay
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: David Heidelberg via B4 Relay @ 2026-11-23 12:02 UTC (permalink / raw)
  To: Sakari Ailus, Mauro Carvalho Chehab, Hans Verkuil,
	Laurent Pinchart
  Cc: linux-media, David Heidelberg

From: David Heidelberg <david@ixit.cz>

Commit 63bd19442f08 accidentally converted two dev_dbg() calls in
ccs_enum_mbus_code() to dev_err(), flooding the kernel log with error
messages whenever userspace enumerates media bus codes.

Restore them to dev_dbg().

Fixes: 63bd19442f08 ("media: ccs: Use %u for printing unsigned values, remove extra debug print")
Signed-off-by: David Heidelberg <david@ixit.cz>
---
 drivers/media/i2c/ccs/ccs-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index c3592317ee575..284cfbd89349c 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -2104,17 +2104,17 @@ static int ccs_enum_mbus_code(struct v4l2_subdev *subdev,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_mbus_code_enum *code)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(subdev);
 	struct ccs_sensor *sensor = to_ccs_sensor(subdev);
 	unsigned int i;
 	int idx = -1;
 
-	dev_err(&client->dev, "subdev %s, pad %u, index %u\n",
+	dev_dbg(&client->dev, "subdev %s, pad %u, index %u\n",
 		subdev->name, code->pad, code->index);
 
 	if (subdev != &sensor->src->sd || code->pad != CCS_PAD_SRC) {
 		if (code->index)
 			return -EINVAL;
 
 		code->code = sensor->internal_csi_format->code;
 
@@ -2122,17 +2122,17 @@ static int ccs_enum_mbus_code(struct v4l2_subdev *subdev,
 	}
 
 	for (i = 0; i < ARRAY_SIZE(ccs_csi_data_formats); i++) {
 		if (sensor->mbus_frame_fmts & BIT_U64(i))
 			idx++;
 
 		if (idx == code->index) {
 			code->code = ccs_csi_data_formats[i].code;
-			dev_err(&client->dev, "found index %u, i %u, code %x\n",
+			dev_dbg(&client->dev, "found index %u, i %u, code %x\n",
 				code->index, i, code->code);
 			return 0;
 		}
 	}
 
 	return -EINVAL;
 }
 

-- 
2.55.0



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

* [PATCH 2/4] media: ccs: Fix sub-device index in ccs_cleanup()
  2026-11-23 12:02 [PATCH 0/4] Various CCS fixes David Heidelberg via B4 Relay
  2026-11-23 12:02 ` [PATCH 1/4] media: ccs: Use dev_dbg() instead of dev_err() in ccs_enum_mbus_code() David Heidelberg via B4 Relay
@ 2026-11-23 12:02 ` David Heidelberg via B4 Relay
  2026-11-23 16:54   ` Laurent Pinchart
  2026-11-23 12:02 ` [PATCH 3/4] media: ccs: Update PLL and blanking limits when pixel_array crop changes David Heidelberg via B4 Relay
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: David Heidelberg via B4 Relay @ 2026-11-23 12:02 UTC (permalink / raw)
  To: Sakari Ailus, Mauro Carvalho Chehab, Hans Verkuil,
	Laurent Pinchart
  Cc: linux-media, David Heidelberg

From: David Heidelberg <david@ixit.cz>

The cleanup loop in ccs_cleanup() calls v4l2_subdev_cleanup() on the
hardcoded element ssds[2] instead of ssds[i]. On two-subdev sensors
(without a scaler) ssds[2] is uninitialized, and on three-subdev sensors
ssds[0] and ssds[1] are never cleaned up while ssds[2] is cleaned up
three times.

Use the loop index i.

Fixes: d8bca3ed1d70 ("media: ccs: Use sub-device active state")
Signed-off-by: David Heidelberg <david@ixit.cz>
---
 drivers/media/i2c/ccs/ccs-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index 284cfbd89349c..df636b8df0b51 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -3002,17 +3002,17 @@ static int ccs_registered(struct v4l2_subdev *subdev)
 }
 
 static void ccs_cleanup(struct ccs_sensor *sensor)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
 	unsigned int i;
 
 	for (i = 0; i < sensor->ssds_used; i++) {
-		v4l2_subdev_cleanup(&sensor->ssds[2].sd);
+		v4l2_subdev_cleanup(&sensor->ssds[i].sd);
 		media_entity_cleanup(&sensor->ssds[i].sd.entity);
 	}
 
 	device_remove_file(&client->dev, &dev_attr_nvm);
 	device_remove_file(&client->dev, &dev_attr_ident);
 
 	ccs_free_controls(sensor);
 }

-- 
2.55.0



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

* [PATCH 3/4] media: ccs: Update PLL and blanking limits when pixel_array crop changes
  2026-11-23 12:02 [PATCH 0/4] Various CCS fixes David Heidelberg via B4 Relay
  2026-11-23 12:02 ` [PATCH 1/4] media: ccs: Use dev_dbg() instead of dev_err() in ccs_enum_mbus_code() David Heidelberg via B4 Relay
  2026-11-23 12:02 ` [PATCH 2/4] media: ccs: Fix sub-device index in ccs_cleanup() David Heidelberg via B4 Relay
@ 2026-11-23 12:02 ` David Heidelberg via B4 Relay
  2026-11-23 12:02 ` [PATCH 4/4] media: ccs: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flip controls David Heidelberg via B4 Relay
  2026-11-23 16:55 ` [PATCH 0/4] Various CCS fixes Laurent Pinchart
  4 siblings, 0 replies; 8+ messages in thread
From: David Heidelberg via B4 Relay @ 2026-11-23 12:02 UTC (permalink / raw)
  To: Sakari Ailus, Mauro Carvalho Chehab, Hans Verkuil,
	Laurent Pinchart
  Cc: linux-media, David Heidelberg

From: David Heidelberg <david@ixit.cz>

ccs_update_blanking() and __ccs_update_exposure_limits() compute the
VBLANK, HBLANK, and EXPOSURE control ranges relative to the pixel_array
source crop rectangle (pa_src). While ccs_set_compose() calls
ccs_pll_blanking_update() for active selections, ccs_set_crop() never
does, leaving blanking and exposure ranges stale after changing the
analog crop rectangle.

Call ccs_pll_blanking_update() at the end of ccs_set_crop() when
updating the active crop on the pixel_array sub-device.

Fixes: ccfc97bdb5ae ("[media] smiapp: Add driver")
Signed-off-by: David Heidelberg <david@ixit.cz>
---
 drivers/media/i2c/ccs/ccs-core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index df636b8df0b51..85748c6110ecc 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -2573,16 +2573,20 @@ static int ccs_set_crop(struct v4l2_subdev *subdev,
 	sel->r.left = min_t(int, sel->r.left, src_size.width - sel->r.width);
 	sel->r.top = min_t(int, sel->r.top, src_size.height - sel->r.height);
 
 	*crop = sel->r;
 
 	if (ssd != sensor->pixel_array && sel->pad == CCS_PAD_SINK)
 		ccs_propagate(subdev, sd_state, V4L2_SEL_TGT_CROP);
 
+	if (ssd == sensor->pixel_array &&
+	    sel->which == V4L2_SUBDEV_FORMAT_ACTIVE)
+		return ccs_pll_blanking_update(sensor);
+
 	return 0;
 }
 
 static void ccs_get_native_size(struct ccs_subdev *ssd, struct v4l2_rect *r)
 {
 	r->top = 0;
 	r->left = 0;
 	r->width = CCS_LIM(ssd->sensor, X_ADDR_MAX) + 1;

-- 
2.55.0



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

* [PATCH 4/4] media: ccs: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flip controls
  2026-11-23 12:02 [PATCH 0/4] Various CCS fixes David Heidelberg via B4 Relay
                   ` (2 preceding siblings ...)
  2026-11-23 12:02 ` [PATCH 3/4] media: ccs: Update PLL and blanking limits when pixel_array crop changes David Heidelberg via B4 Relay
@ 2026-11-23 12:02 ` David Heidelberg via B4 Relay
  2026-11-23 16:55 ` [PATCH 0/4] Various CCS fixes Laurent Pinchart
  4 siblings, 0 replies; 8+ messages in thread
From: David Heidelberg via B4 Relay @ 2026-11-23 12:02 UTC (permalink / raw)
  To: Sakari Ailus, Mauro Carvalho Chehab, Hans Verkuil,
	Laurent Pinchart
  Cc: linux-media, David Heidelberg

From: David Heidelberg <david@ixit.cz>

Changing V4L2_CID_HFLIP or V4L2_CID_VFLIP calls ccs_update_mbus_formats(),
which XORs the default pixel order and changes the Bayer media bus format
code exposed on the sub-device pads.

Per the V4L2 specification, controls that modify the pixel order / layout
must advertise V4L2_CTRL_FLAG_MODIFY_LAYOUT so userspace (such as
libcamera) knows that flips alter the Bayer pattern order.

Fixes: ccfc97bdb5ae ("[media] smiapp: Add driver")
Signed-off-by: David Heidelberg <david@ixit.cz>
---
 drivers/media/i2c/ccs/ccs-core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
index 85748c6110ecc..756b5ee11f52e 100644
--- a/drivers/media/i2c/ccs/ccs-core.c
+++ b/drivers/media/i2c/ccs/ccs-core.c
@@ -1047,19 +1047,23 @@ static int ccs_init_controls(struct ccs_sensor *sensor)
 	/* Exposure limits will be updated soon, use just something here. */
 	sensor->exposure = v4l2_ctrl_new_std(
 		&sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops,
 		V4L2_CID_EXPOSURE, 0, 0, 1, 0);
 
 	sensor->hflip = v4l2_ctrl_new_std(
 		&sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops,
 		V4L2_CID_HFLIP, 0, 1, 1, 0);
+	if (sensor->hflip)
+		sensor->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
 	sensor->vflip = v4l2_ctrl_new_std(
 		&sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops,
 		V4L2_CID_VFLIP, 0, 1, 1, 0);
+	if (sensor->vflip)
+		sensor->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
 
 	sensor->vblank = v4l2_ctrl_new_std(
 		&sensor->pixel_array->ctrl_handler, &ccs_ctrl_ops,
 		V4L2_CID_VBLANK, 0, 1, 1, 0);
 
 	if (sensor->vblank)
 		sensor->vblank->flags |= V4L2_CTRL_FLAG_UPDATE;
 

-- 
2.55.0



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

* Re: [PATCH 1/4] media: ccs: Use dev_dbg() instead of dev_err() in ccs_enum_mbus_code()
  2026-11-23 12:02 ` [PATCH 1/4] media: ccs: Use dev_dbg() instead of dev_err() in ccs_enum_mbus_code() David Heidelberg via B4 Relay
@ 2026-11-23 16:53   ` Laurent Pinchart
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2026-11-23 16:53 UTC (permalink / raw)
  To: david; +Cc: Sakari Ailus, Mauro Carvalho Chehab, Hans Verkuil, linux-media

On Mon, Nov 23, 2026 at 01:02:39PM +0100, David Heidelberg via B4 Relay wrote:
> From: David Heidelberg <david@ixit.cz>
> 
> Commit 63bd19442f08 accidentally converted two dev_dbg() calls in
> ccs_enum_mbus_code() to dev_err(), flooding the kernel log with error
> messages whenever userspace enumerates media bus codes.
> 
> Restore them to dev_dbg().
> 
> Fixes: 63bd19442f08 ("media: ccs: Use %u for printing unsigned values, remove extra debug print")

According to the git history those have been there since the first
version of the driver (named smiapp back then).

The change is good, the commit message needs an update.

> Signed-off-by: David Heidelberg <david@ixit.cz>
> ---
>  drivers/media/i2c/ccs/ccs-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
> index c3592317ee575..284cfbd89349c 100644
> --- a/drivers/media/i2c/ccs/ccs-core.c
> +++ b/drivers/media/i2c/ccs/ccs-core.c
> @@ -2104,17 +2104,17 @@ static int ccs_enum_mbus_code(struct v4l2_subdev *subdev,
>  			      struct v4l2_subdev_state *sd_state,
>  			      struct v4l2_subdev_mbus_code_enum *code)
>  {
>  	struct i2c_client *client = v4l2_get_subdevdata(subdev);
>  	struct ccs_sensor *sensor = to_ccs_sensor(subdev);
>  	unsigned int i;
>  	int idx = -1;
>  
> -	dev_err(&client->dev, "subdev %s, pad %u, index %u\n",
> +	dev_dbg(&client->dev, "subdev %s, pad %u, index %u\n",
>  		subdev->name, code->pad, code->index);
>  
>  	if (subdev != &sensor->src->sd || code->pad != CCS_PAD_SRC) {
>  		if (code->index)
>  			return -EINVAL;
>  
>  		code->code = sensor->internal_csi_format->code;
>  
> @@ -2122,17 +2122,17 @@ static int ccs_enum_mbus_code(struct v4l2_subdev *subdev,
>  	}
>  
>  	for (i = 0; i < ARRAY_SIZE(ccs_csi_data_formats); i++) {
>  		if (sensor->mbus_frame_fmts & BIT_U64(i))
>  			idx++;
>  
>  		if (idx == code->index) {
>  			code->code = ccs_csi_data_formats[i].code;
> -			dev_err(&client->dev, "found index %u, i %u, code %x\n",
> +			dev_dbg(&client->dev, "found index %u, i %u, code %x\n",
>  				code->index, i, code->code);
>  			return 0;
>  		}
>  	}
>  
>  	return -EINVAL;
>  }
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 2/4] media: ccs: Fix sub-device index in ccs_cleanup()
  2026-11-23 12:02 ` [PATCH 2/4] media: ccs: Fix sub-device index in ccs_cleanup() David Heidelberg via B4 Relay
@ 2026-11-23 16:54   ` Laurent Pinchart
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2026-11-23 16:54 UTC (permalink / raw)
  To: david; +Cc: Sakari Ailus, Mauro Carvalho Chehab, Hans Verkuil, linux-media

On Mon, Nov 23, 2026 at 01:02:40PM +0100, David Heidelberg via B4 Relay wrote:
> From: David Heidelberg <david@ixit.cz>
> 
> The cleanup loop in ccs_cleanup() calls v4l2_subdev_cleanup() on the
> hardcoded element ssds[2] instead of ssds[i]. On two-subdev sensors
> (without a scaler) ssds[2] is uninitialized, and on three-subdev sensors
> ssds[0] and ssds[1] are never cleaned up while ssds[2] is cleaned up
> three times.
> 
> Use the loop index i.
> 
> Fixes: d8bca3ed1d70 ("media: ccs: Use sub-device active state")
> Signed-off-by: David Heidelberg <david@ixit.cz>

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

> ---
>  drivers/media/i2c/ccs/ccs-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
> index 284cfbd89349c..df636b8df0b51 100644
> --- a/drivers/media/i2c/ccs/ccs-core.c
> +++ b/drivers/media/i2c/ccs/ccs-core.c
> @@ -3002,17 +3002,17 @@ static int ccs_registered(struct v4l2_subdev *subdev)
>  }
>  
>  static void ccs_cleanup(struct ccs_sensor *sensor)
>  {
>  	struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
>  	unsigned int i;
>  
>  	for (i = 0; i < sensor->ssds_used; i++) {
> -		v4l2_subdev_cleanup(&sensor->ssds[2].sd);
> +		v4l2_subdev_cleanup(&sensor->ssds[i].sd);
>  		media_entity_cleanup(&sensor->ssds[i].sd.entity);
>  	}
>  
>  	device_remove_file(&client->dev, &dev_attr_nvm);
>  	device_remove_file(&client->dev, &dev_attr_ident);
>  
>  	ccs_free_controls(sensor);
>  }

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 0/4] Various CCS fixes
  2026-11-23 12:02 [PATCH 0/4] Various CCS fixes David Heidelberg via B4 Relay
                   ` (3 preceding siblings ...)
  2026-11-23 12:02 ` [PATCH 4/4] media: ccs: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flip controls David Heidelberg via B4 Relay
@ 2026-11-23 16:55 ` Laurent Pinchart
  4 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2026-11-23 16:55 UTC (permalink / raw)
  To: david; +Cc: Sakari Ailus, Mauro Carvalho Chehab, Hans Verkuil, linux-media

On Mon, Nov 23, 2026 at 01:02:38PM +0100, David Heidelberg via B4 Relay wrote:
> First two seems to be no-brainers. Next two seems to be correct too.

What exactly do you mean by "seems to be correct" ? Are you sending
LLM-generated patches that you're not even sure about ? That's a
complete no-go.

> Signed-off-by: David Heidelberg <david@ixit.cz>
> ---
> David Heidelberg (4):
>       media: ccs: Use dev_dbg() instead of dev_err() in ccs_enum_mbus_code()
>       media: ccs: Fix sub-device index in ccs_cleanup()
>       media: ccs: Update PLL and blanking limits when pixel_array crop changes
>       media: ccs: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flip controls
> 
>  drivers/media/i2c/ccs/ccs-core.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> ---
> base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726
> change-id: 20261123-ccs-clanked-fixes-609bb0754028

-- 
Regards,

Laurent Pinchart

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

end of thread, other threads:[~2026-11-23 16:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 12:02 [PATCH 0/4] Various CCS fixes David Heidelberg via B4 Relay
2026-11-23 12:02 ` [PATCH 1/4] media: ccs: Use dev_dbg() instead of dev_err() in ccs_enum_mbus_code() David Heidelberg via B4 Relay
2026-11-23 16:53   ` Laurent Pinchart
2026-11-23 12:02 ` [PATCH 2/4] media: ccs: Fix sub-device index in ccs_cleanup() David Heidelberg via B4 Relay
2026-11-23 16:54   ` Laurent Pinchart
2026-11-23 12:02 ` [PATCH 3/4] media: ccs: Update PLL and blanking limits when pixel_array crop changes David Heidelberg via B4 Relay
2026-11-23 12:02 ` [PATCH 4/4] media: ccs: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flip controls David Heidelberg via B4 Relay
2026-11-23 16:55 ` [PATCH 0/4] Various CCS fixes Laurent Pinchart

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