提交 6a580c4f 编写于 作者: L Laurent Pinchart 提交者: Zheng Zengkai

media: i2c: ov5647: Parse and register properties

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

Parse device properties and register controls for them using the V4L2
fwnode properties helpers.
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 28ca8892
...@@ -1501,6 +1501,7 @@ static int ov5647_probe(struct i2c_client *client) ...@@ -1501,6 +1501,7 @@ static int ov5647_probe(struct i2c_client *client)
struct device_node *np = client->dev.of_node; struct device_node *np = client->dev.of_node;
u32 xclk_freq; u32 xclk_freq;
int hblank, exposure_max, exposure_def; int hblank, exposure_max, exposure_def;
struct v4l2_fwnode_device_properties props;
sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
if (!sensor) if (!sensor)
...@@ -1534,7 +1535,7 @@ static int ov5647_probe(struct i2c_client *client) ...@@ -1534,7 +1535,7 @@ static int ov5647_probe(struct i2c_client *client)
mutex_init(&sensor->lock); mutex_init(&sensor->lock);
/* Initialise controls. */ /* Initialise controls. */
v4l2_ctrl_handler_init(&sensor->ctrls, 7); v4l2_ctrl_handler_init(&sensor->ctrls, 9);
v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops, v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
V4L2_CID_AUTOGAIN, V4L2_CID_AUTOGAIN,
0, /* min */ 0, /* min */
...@@ -1598,6 +1599,16 @@ static int ov5647_probe(struct i2c_client *client) ...@@ -1598,6 +1599,16 @@ static int ov5647_probe(struct i2c_client *client)
__func__, ret); __func__, ret);
goto error; goto error;
} }
ret = v4l2_fwnode_device_parse(&client->dev, &props);
if (ret)
goto error;
ret = v4l2_ctrl_new_fwnode_properties(&sensor->ctrls, &ov5647_ctrl_ops,
&props);
if (ret)
goto error;
sensor->sd.ctrl_handler = &sensor->ctrls; sensor->sd.ctrl_handler = &sensor->ctrls;
/* Write out the register set over I2C on stream-on. */ /* Write out the register set over I2C on stream-on. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册