lkml.org 
[lkml]   [2022]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 3/4] media: i2c: ov5675: parse and register V4L2 device tree properties
Hi Quentin,

On Mon, May 09, 2022 at 04:32:25PM +0200, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> Parse V4L2 device tree properties and register controls for them.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
> drivers/media/i2c/ov5675.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c
> index cee380196774..5544e1ae444e 100644
> --- a/drivers/media/i2c/ov5675.c
> +++ b/drivers/media/i2c/ov5675.c
> @@ -779,12 +779,14 @@ static const struct v4l2_ctrl_ops ov5675_ctrl_ops = {
>
> static int ov5675_init_controls(struct ov5675 *ov5675)
> {
> + struct i2c_client *client = v4l2_get_subdevdata(&ov5675->sd);
> struct v4l2_ctrl_handler *ctrl_hdlr;
> + struct v4l2_fwnode_device_properties props;

You could move the line up and maintain the (in)famous
reverse-xmas-tree ordering in variable declaration.

Nit apart, looks good
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
j

> s64 exposure_max, h_blank;
> int ret;
>
> ctrl_hdlr = &ov5675->ctrl_handler;
> - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8);
> + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10);
> if (ret)
> return ret;
>
> @@ -838,9 +840,23 @@ static int ov5675_init_controls(struct ov5675 *ov5675)
> 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, &ov5675_ctrl_ops,
> + &props);
> + if (ret)
> + goto error;
> +
> ov5675->sd.ctrl_handler = ctrl_hdlr;
>
> return 0;
> +
> +error:
> + v4l2_ctrl_handler_free(ctrl_hdlr);
> +
> + return ret;
> }
>
> static void ov5675_update_pad_format(const struct ov5675_mode *mode,
> --
> 2.35.3
>

\
 
 \ /
  Last update: 2022-05-10 11:49    [W:0.267 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site