media: i2c: ov13858: Parse and register properties
Parse device properties and register controls for them using the newly introduced helpers. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
eba08021e1
commit
74c3ddd988
|
@ -7,6 +7,7 @@
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <media/v4l2-ctrls.h>
|
#include <media/v4l2-ctrls.h>
|
||||||
#include <media/v4l2-device.h>
|
#include <media/v4l2-device.h>
|
||||||
|
#include <media/v4l2-fwnode.h>
|
||||||
|
|
||||||
#define OV13858_REG_VALUE_08BIT 1
|
#define OV13858_REG_VALUE_08BIT 1
|
||||||
#define OV13858_REG_VALUE_16BIT 2
|
#define OV13858_REG_VALUE_16BIT 2
|
||||||
|
@ -1589,6 +1590,7 @@ static const struct v4l2_subdev_internal_ops ov13858_internal_ops = {
|
||||||
static int ov13858_init_controls(struct ov13858 *ov13858)
|
static int ov13858_init_controls(struct ov13858 *ov13858)
|
||||||
{
|
{
|
||||||
struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
|
struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
|
||||||
|
struct v4l2_fwnode_device_properties props;
|
||||||
struct v4l2_ctrl_handler *ctrl_hdlr;
|
struct v4l2_ctrl_handler *ctrl_hdlr;
|
||||||
s64 exposure_max;
|
s64 exposure_max;
|
||||||
s64 vblank_def;
|
s64 vblank_def;
|
||||||
|
@ -1600,7 +1602,7 @@ static int ov13858_init_controls(struct ov13858 *ov13858)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ctrl_hdlr = &ov13858->ctrl_handler;
|
ctrl_hdlr = &ov13858->ctrl_handler;
|
||||||
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8);
|
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -1666,6 +1668,15 @@ static int ov13858_init_controls(struct ov13858 *ov13858)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = v4l2_fwnode_device_parse(&client->dev, &props);
|
||||||
|
if (ret)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov13858_ctrl_ops,
|
||||||
|
&props);
|
||||||
|
if (ret)
|
||||||
|
goto error;
|
||||||
|
|
||||||
ov13858->sd.ctrl_handler = ctrl_hdlr;
|
ov13858->sd.ctrl_handler = ctrl_hdlr;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue