public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ov8856: Add V4L2 device tree properties support
@ 2026-03-08  4:55 Alexander Koskovich
  2026-03-08  4:56 ` [PATCH 1/2] media: dt-bindings: ovti,ov8856: Allow props from video-interface-devices Alexander Koskovich
  2026-03-08  4:56 ` [PATCH 2/2] media: i2c: ov8856: parse and register V4L2 device tree properties Alexander Koskovich
  0 siblings, 2 replies; 6+ messages in thread
From: Alexander Koskovich @ 2026-03-08  4:55 UTC (permalink / raw)
  To: Sakari Ailus, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-media, devicetree, linux-kernel, Alexander Koskovich

Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
---
Alexander Koskovich (2):
      media: dt-bindings: ovti,ov8856: Allow props from video-interface-devices
      media: i2c: ov8856: parse and register V4L2 device tree properties

 .../devicetree/bindings/media/i2c/ovti,ov8856.yaml     |  5 ++++-
 drivers/media/i2c/ov8856.c                             | 18 +++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)
---
base-commit: 11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260307-ov8856-v4l2-props-def87d7854b1

Best regards,
-- 
Alexander Koskovich <akoskovich@pm.me>



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

* [PATCH 1/2] media: dt-bindings: ovti,ov8856: Allow props from video-interface-devices
  2026-03-08  4:55 [PATCH 0/2] ov8856: Add V4L2 device tree properties support Alexander Koskovich
@ 2026-03-08  4:56 ` Alexander Koskovich
  2026-03-09  7:48   ` Krzysztof Kozlowski
  2026-03-09  9:13   ` Sakari Ailus
  2026-03-08  4:56 ` [PATCH 2/2] media: i2c: ov8856: parse and register V4L2 device tree properties Alexander Koskovich
  1 sibling, 2 replies; 6+ messages in thread
From: Alexander Koskovich @ 2026-03-08  4:56 UTC (permalink / raw)
  To: Sakari Ailus, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-media, devicetree, linux-kernel, Alexander Koskovich

There is no reason to restrict the allowed rotation degrees to 0 and 180,
as the sensor can be mounted with any rotation.

Also, as all the properties described by video-interface-devices.yaml are
allowed for the image sensor, make them accepted by changing
additionalProperties: false" to "unevaluatedProperties: false" at the
schema top-level.

Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
---
 Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml
index fa71f24823f2..73a9d3288897 100644
--- a/Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml
@@ -18,6 +18,9 @@ description: |-
   through I2C and two-wire SCCB. The sensor output is available via CSI-2
   serial data output (up to 4-lane).
 
+allOf:
+  - $ref: /schemas/media/video-interface-devices.yaml#
+
 properties:
   compatible:
     const: ovti,ov8856
@@ -94,7 +97,7 @@ required:
   - reset-gpios
   - port
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |

-- 
2.53.0



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

* [PATCH 2/2] media: i2c: ov8856: parse and register V4L2 device tree properties
  2026-03-08  4:55 [PATCH 0/2] ov8856: Add V4L2 device tree properties support Alexander Koskovich
  2026-03-08  4:56 ` [PATCH 1/2] media: dt-bindings: ovti,ov8856: Allow props from video-interface-devices Alexander Koskovich
@ 2026-03-08  4:56 ` Alexander Koskovich
  2026-03-09  9:38   ` Jacopo Mondi
  1 sibling, 1 reply; 6+ messages in thread
From: Alexander Koskovich @ 2026-03-08  4:56 UTC (permalink / raw)
  To: Sakari Ailus, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-media, devicetree, linux-kernel, Alexander Koskovich

Parse V4L2 device tree properties and register controls for them.

Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
---
 drivers/media/i2c/ov8856.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c
index e2998cfa0d18..bd39d213e0be 100644
--- a/drivers/media/i2c/ov8856.c
+++ b/drivers/media/i2c/ov8856.c
@@ -1887,12 +1887,14 @@ static const struct v4l2_ctrl_ops ov8856_ctrl_ops = {
 
 static int ov8856_init_controls(struct ov8856 *ov8856)
 {
+	struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd);
+	struct v4l2_fwnode_device_properties props;
 	struct v4l2_ctrl_handler *ctrl_hdlr;
 	s64 exposure_max, h_blank;
 	int ret;
 
 	ctrl_hdlr = &ov8856->ctrl_handler;
-	ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8);
+	ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10);
 	if (ret)
 		return ret;
 
@@ -1954,9 +1956,23 @@ static int ov8856_init_controls(struct ov8856 *ov8856)
 	if (ctrl_hdlr->error)
 		return ctrl_hdlr->error;
 
+	ret = v4l2_fwnode_device_parse(&client->dev, &props);
+	if (ret)
+		goto error;
+
+	ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov8856_ctrl_ops,
+					      &props);
+	if (ret)
+		goto error;
+
 	ov8856->sd.ctrl_handler = ctrl_hdlr;
 
 	return 0;
+
+error:
+	v4l2_ctrl_handler_free(ctrl_hdlr);
+
+	return ret;
 }
 
 static void ov8856_update_pad_format(struct ov8856 *ov8856,

-- 
2.53.0



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

* Re: [PATCH 1/2] media: dt-bindings: ovti,ov8856: Allow props from video-interface-devices
  2026-03-08  4:56 ` [PATCH 1/2] media: dt-bindings: ovti,ov8856: Allow props from video-interface-devices Alexander Koskovich
@ 2026-03-09  7:48   ` Krzysztof Kozlowski
  2026-03-09  9:13   ` Sakari Ailus
  1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-09  7:48 UTC (permalink / raw)
  To: Alexander Koskovich
  Cc: Sakari Ailus, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-media, devicetree,
	linux-kernel

On Sun, Mar 08, 2026 at 04:56:04AM +0000, Alexander Koskovich wrote:
> There is no reason to restrict the allowed rotation degrees to 0 and 180,
> as the sensor can be mounted with any rotation.
> 
> Also, as all the properties described by video-interface-devices.yaml are
> allowed for the image sensor, make them accepted by changing
> additionalProperties: false" to "unevaluatedProperties: false" at the
> schema top-level.

And flash-leds, leds and lens-focus depend on the board design and not
on this sensor pins?

Best regards,
Krzysztof


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

* Re: [PATCH 1/2] media: dt-bindings: ovti,ov8856: Allow props from video-interface-devices
  2026-03-08  4:56 ` [PATCH 1/2] media: dt-bindings: ovti,ov8856: Allow props from video-interface-devices Alexander Koskovich
  2026-03-09  7:48   ` Krzysztof Kozlowski
@ 2026-03-09  9:13   ` Sakari Ailus
  1 sibling, 0 replies; 6+ messages in thread
From: Sakari Ailus @ 2026-03-09  9:13 UTC (permalink / raw)
  To: Alexander Koskovich
  Cc: Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-media, devicetree, linux-kernel,
	laurent.pinchart

Hi Alexander,

Thanks for the patch.

On Sun, Mar 08, 2026 at 04:56:04AM +0000, Alexander Koskovich wrote:
> There is no reason to restrict the allowed rotation degrees to 0 and 180,
> as the sensor can be mounted with any rotation.
> 
> Also, as all the properties described by video-interface-devices.yaml are
> allowed for the image sensor, make them accepted by changing
> additionalProperties: false" to "unevaluatedProperties: false" at the
> schema top-level.

As the relevant properties depend on the device type, I believe we should
continue to document what is relevant for a given device.

Some of the properties such as the ones that get used in the 2nd patch
could well be put into another file so we could avoid documenting each
supported property separately for e.g. raw camera sensors.

Also cc Laurent.

> 
> Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
> ---
>  Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml
> index fa71f24823f2..73a9d3288897 100644
> --- a/Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml
> +++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov8856.yaml
> @@ -18,6 +18,9 @@ description: |-
>    through I2C and two-wire SCCB. The sensor output is available via CSI-2
>    serial data output (up to 4-lane).
>  
> +allOf:
> +  - $ref: /schemas/media/video-interface-devices.yaml#
> +
>  properties:
>    compatible:
>      const: ovti,ov8856
> @@ -94,7 +97,7 @@ required:
>    - reset-gpios
>    - port
>  
> -additionalProperties: false
> +unevaluatedProperties: false
>  
>  examples:
>    - |
> 

-- 
Regards,

Sakari Ailus

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

* Re: [PATCH 2/2] media: i2c: ov8856: parse and register V4L2 device tree properties
  2026-03-08  4:56 ` [PATCH 2/2] media: i2c: ov8856: parse and register V4L2 device tree properties Alexander Koskovich
@ 2026-03-09  9:38   ` Jacopo Mondi
  0 siblings, 0 replies; 6+ messages in thread
From: Jacopo Mondi @ 2026-03-09  9:38 UTC (permalink / raw)
  To: Alexander Koskovich
  Cc: Sakari Ailus, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-media, devicetree,
	linux-kernel

Hi Alexander

On Sun, Mar 08, 2026 at 04:56:07AM +0000, Alexander Koskovich wrote:
> Parse V4L2 device tree properties and register controls for them.
>
> Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
> ---
>  drivers/media/i2c/ov8856.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c
> index e2998cfa0d18..bd39d213e0be 100644
> --- a/drivers/media/i2c/ov8856.c
> +++ b/drivers/media/i2c/ov8856.c
> @@ -1887,12 +1887,14 @@ static const struct v4l2_ctrl_ops ov8856_ctrl_ops = {
>
>  static int ov8856_init_controls(struct ov8856 *ov8856)
>  {
> +	struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd);
> +	struct v4l2_fwnode_device_properties props;
>  	struct v4l2_ctrl_handler *ctrl_hdlr;
>  	s64 exposure_max, h_blank;
>  	int ret;
>
>  	ctrl_hdlr = &ov8856->ctrl_handler;
> -	ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8);
> +	ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10);
>  	if (ret)
>  		return ret;
>
> @@ -1954,9 +1956,23 @@ static int ov8856_init_controls(struct ov8856 *ov8856)
>  	if (ctrl_hdlr->error)
>  		return ctrl_hdlr->error;
>
> +	ret = v4l2_fwnode_device_parse(&client->dev, &props);
> +	if (ret)
> +		goto error;
> +
> +	ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov8856_ctrl_ops,
> +					      &props);
> +	if (ret)
> +		goto error;
> +
>  	ov8856->sd.ctrl_handler = ctrl_hdlr;
>
>  	return 0;
> +
> +error:
> +	v4l2_ctrl_handler_free(ctrl_hdlr);

The control handler is released by the caller of
ov8856_init_controls() in case of errors.

You should just return ret here.

Thanks
  j

> +
> +	return ret;
>  }
>
>  static void ov8856_update_pad_format(struct ov8856 *ov8856,
>
> --
> 2.53.0
>
>
>

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

end of thread, other threads:[~2026-03-09  9:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-08  4:55 [PATCH 0/2] ov8856: Add V4L2 device tree properties support Alexander Koskovich
2026-03-08  4:56 ` [PATCH 1/2] media: dt-bindings: ovti,ov8856: Allow props from video-interface-devices Alexander Koskovich
2026-03-09  7:48   ` Krzysztof Kozlowski
2026-03-09  9:13   ` Sakari Ailus
2026-03-08  4:56 ` [PATCH 2/2] media: i2c: ov8856: parse and register V4L2 device tree properties Alexander Koskovich
2026-03-09  9:38   ` Jacopo Mondi

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