Commit ef6672ea authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

[media] V4L2: mt9m111: switch to asynchronous subdevice probing

Convert the mt9m111 driver to asynchronous subdevice probing. Synchronous
probing is also still possible.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 3d238885
...@@ -946,6 +946,10 @@ static int mt9m111_probe(struct i2c_client *client, ...@@ -946,6 +946,10 @@ static int mt9m111_probe(struct i2c_client *client,
if (!mt9m111) if (!mt9m111)
return -ENOMEM; return -ENOMEM;
mt9m111->clk = v4l2_clk_get(&client->dev, "mclk");
if (IS_ERR(mt9m111->clk))
return -EPROBE_DEFER;
/* Default HIGHPOWER context */ /* Default HIGHPOWER context */
mt9m111->ctx = &context_b; mt9m111->ctx = &context_b;
...@@ -963,8 +967,10 @@ static int mt9m111_probe(struct i2c_client *client, ...@@ -963,8 +967,10 @@ static int mt9m111_probe(struct i2c_client *client,
&mt9m111_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, 1, 0, &mt9m111_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, 1, 0,
V4L2_EXPOSURE_AUTO); V4L2_EXPOSURE_AUTO);
mt9m111->subdev.ctrl_handler = &mt9m111->hdl; mt9m111->subdev.ctrl_handler = &mt9m111->hdl;
if (mt9m111->hdl.error) if (mt9m111->hdl.error) {
return mt9m111->hdl.error; ret = mt9m111->hdl.error;
goto out_clkput;
}
/* Second stage probe - when a capture adapter is there */ /* Second stage probe - when a capture adapter is there */
mt9m111->rect.left = MT9M111_MIN_DARK_COLS; mt9m111->rect.left = MT9M111_MIN_DARK_COLS;
...@@ -975,18 +981,25 @@ static int mt9m111_probe(struct i2c_client *client, ...@@ -975,18 +981,25 @@ static int mt9m111_probe(struct i2c_client *client,
mt9m111->lastpage = -1; mt9m111->lastpage = -1;
mutex_init(&mt9m111->power_lock); mutex_init(&mt9m111->power_lock);
mt9m111->clk = v4l2_clk_get(&client->dev, "mclk"); ret = soc_camera_power_init(&client->dev, ssdd);
if (IS_ERR(mt9m111->clk)) { if (ret < 0)
ret = PTR_ERR(mt9m111->clk); goto out_hdlfree;
goto eclkget;
}
ret = mt9m111_video_probe(client); ret = mt9m111_video_probe(client);
if (ret) { if (ret < 0)
v4l2_clk_put(mt9m111->clk); goto out_hdlfree;
eclkget:
v4l2_ctrl_handler_free(&mt9m111->hdl); mt9m111->subdev.dev = &client->dev;
} ret = v4l2_async_register_subdev(&mt9m111->subdev);
if (ret < 0)
goto out_hdlfree;
return 0;
out_hdlfree:
v4l2_ctrl_handler_free(&mt9m111->hdl);
out_clkput:
v4l2_clk_put(mt9m111->clk);
return ret; return ret;
} }
...@@ -995,6 +1008,7 @@ static int mt9m111_remove(struct i2c_client *client) ...@@ -995,6 +1008,7 @@ static int mt9m111_remove(struct i2c_client *client)
{ {
struct mt9m111 *mt9m111 = to_mt9m111(client); struct mt9m111 *mt9m111 = to_mt9m111(client);
v4l2_async_unregister_subdev(&mt9m111->subdev);
v4l2_clk_put(mt9m111->clk); v4l2_clk_put(mt9m111->clk);
v4l2_device_unregister_subdev(&mt9m111->subdev); v4l2_device_unregister_subdev(&mt9m111->subdev);
v4l2_ctrl_handler_free(&mt9m111->hdl); v4l2_ctrl_handler_free(&mt9m111->hdl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment