Skip to content

Commit

Permalink
media: i2c: ov5647: Parse and register properties
Browse files Browse the repository at this point in the history
Parse device properties and register controls for them using the V4L2
fwnode properties helpers.

Signed-off-by: Laurent Pinchart <[email protected]>
  • Loading branch information
pinchartl authored and popcornmix committed Nov 1, 2024
1 parent cfa946b commit ef3ca26
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/media/i2c/ov5647.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,10 +1297,11 @@ static const struct v4l2_ctrl_ops ov5647_ctrl_ops = {
.s_ctrl = ov5647_s_ctrl,
};

static int ov5647_init_controls(struct ov5647 *sensor)
static int ov5647_init_controls(struct ov5647 *sensor, struct device *dev)
{
struct i2c_client *client = v4l2_get_subdevdata(&sensor->sd);
int hblank, exposure_max, exposure_def;
struct v4l2_fwnode_device_properties props;

v4l2_ctrl_handler_init(&sensor->ctrls, 9);

Expand Down Expand Up @@ -1351,6 +1352,11 @@ static int ov5647_init_controls(struct ov5647 *sensor)
ARRAY_SIZE(ov5647_test_pattern_menu) - 1,
0, 0, ov5647_test_pattern_menu);

v4l2_fwnode_device_parse(dev, &props);

v4l2_ctrl_new_fwnode_properties(&sensor->ctrls, &ov5647_ctrl_ops,
&props);

if (sensor->ctrls.error)
goto handler_free;

Expand Down Expand Up @@ -1434,7 +1440,7 @@ static int ov5647_probe(struct i2c_client *client)

sensor->mode = OV5647_DEFAULT_MODE;

ret = ov5647_init_controls(sensor);
ret = ov5647_init_controls(sensor, dev);
if (ret)
goto mutex_destroy;

Expand Down

0 comments on commit ef3ca26

Please sign in to comment.