Message ID | 20240216223237.326523-6-hdegoede@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series | media: ov2680: Add all controls required by libcamera | expand |
Quoting Hans de Goede (2024-02-16 22:32:37) > Add camera orientation and sensor rotation controls using > the v4l2_fwnode_device_parse() and v4l2_ctrl_new_fwnode_properties() > helpers. > > Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > drivers/media/i2c/ov2680.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c > index fef9e11ee141..bcd031882a37 100644 > --- a/drivers/media/i2c/ov2680.c > +++ b/drivers/media/i2c/ov2680.c > @@ -946,6 +946,7 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) > const struct v4l2_ctrl_ops *ops = &ov2680_ctrl_ops; > struct ov2680_ctrls *ctrls = &sensor->ctrls; > struct v4l2_ctrl_handler *hdl = &ctrls->handler; > + struct v4l2_fwnode_device_properties props; > int def, max, ret = 0; > > v4l2_i2c_subdev_init(&sensor->sd, client, &ov2680_subdev_ops); > @@ -1000,6 +1001,14 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) > goto cleanup_entity; > } > > + ret = v4l2_fwnode_device_parse(sensor->dev, &props); > + if (ret) > + goto cleanup_entity; > + > + ret = v4l2_ctrl_new_fwnode_properties(hdl, ops, &props); > + if (ret) > + goto cleanup_entity; > + > ctrls->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT; > ctrls->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT; > ctrls->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; > -- > 2.43.0 >
diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index fef9e11ee141..bcd031882a37 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -946,6 +946,7 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) const struct v4l2_ctrl_ops *ops = &ov2680_ctrl_ops; struct ov2680_ctrls *ctrls = &sensor->ctrls; struct v4l2_ctrl_handler *hdl = &ctrls->handler; + struct v4l2_fwnode_device_properties props; int def, max, ret = 0; v4l2_i2c_subdev_init(&sensor->sd, client, &ov2680_subdev_ops); @@ -1000,6 +1001,14 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) goto cleanup_entity; } + ret = v4l2_fwnode_device_parse(sensor->dev, &props); + if (ret) + goto cleanup_entity; + + ret = v4l2_ctrl_new_fwnode_properties(hdl, ops, &props); + if (ret) + goto cleanup_entity; + ctrls->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT; ctrls->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT; ctrls->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
Add camera orientation and sensor rotation controls using the v4l2_fwnode_device_parse() and v4l2_ctrl_new_fwnode_properties() helpers. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/media/i2c/ov2680.c | 9 +++++++++ 1 file changed, 9 insertions(+)