diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-07-30 03:35:18 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-08-18 08:23:16 -0400 |
commit | ef6672ea35b5bb64ab42e18c1a1ffc717c31588a (patch) | |
tree | 27e733533d668190c29dd16ac6e44edaa30cdfde /drivers/media/i2c | |
parent | 3d238885dbfd5359cd0c12fad858e8638f17bfc6 (diff) |
[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: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/soc_camera/mt9m111.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c index de3605df47c5..6f4056668bbc 100644 --- a/drivers/media/i2c/soc_camera/mt9m111.c +++ b/drivers/media/i2c/soc_camera/mt9m111.c | |||
@@ -946,6 +946,10 @@ static int mt9m111_probe(struct i2c_client *client, | |||
946 | if (!mt9m111) | 946 | if (!mt9m111) |
947 | return -ENOMEM; | 947 | return -ENOMEM; |
948 | 948 | ||
949 | mt9m111->clk = v4l2_clk_get(&client->dev, "mclk"); | ||
950 | if (IS_ERR(mt9m111->clk)) | ||
951 | return -EPROBE_DEFER; | ||
952 | |||
949 | /* Default HIGHPOWER context */ | 953 | /* Default HIGHPOWER context */ |
950 | mt9m111->ctx = &context_b; | 954 | mt9m111->ctx = &context_b; |
951 | 955 | ||
@@ -963,8 +967,10 @@ static int mt9m111_probe(struct i2c_client *client, | |||
963 | &mt9m111_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, 1, 0, | 967 | &mt9m111_ctrl_ops, V4L2_CID_EXPOSURE_AUTO, 1, 0, |
964 | V4L2_EXPOSURE_AUTO); | 968 | V4L2_EXPOSURE_AUTO); |
965 | mt9m111->subdev.ctrl_handler = &mt9m111->hdl; | 969 | mt9m111->subdev.ctrl_handler = &mt9m111->hdl; |
966 | if (mt9m111->hdl.error) | 970 | if (mt9m111->hdl.error) { |
967 | return mt9m111->hdl.error; | 971 | ret = mt9m111->hdl.error; |
972 | goto out_clkput; | ||
973 | } | ||
968 | 974 | ||
969 | /* Second stage probe - when a capture adapter is there */ | 975 | /* Second stage probe - when a capture adapter is there */ |
970 | mt9m111->rect.left = MT9M111_MIN_DARK_COLS; | 976 | mt9m111->rect.left = MT9M111_MIN_DARK_COLS; |
@@ -975,18 +981,25 @@ static int mt9m111_probe(struct i2c_client *client, | |||
975 | mt9m111->lastpage = -1; | 981 | mt9m111->lastpage = -1; |
976 | mutex_init(&mt9m111->power_lock); | 982 | mutex_init(&mt9m111->power_lock); |
977 | 983 | ||
978 | mt9m111->clk = v4l2_clk_get(&client->dev, "mclk"); | 984 | ret = soc_camera_power_init(&client->dev, ssdd); |
979 | if (IS_ERR(mt9m111->clk)) { | 985 | if (ret < 0) |
980 | ret = PTR_ERR(mt9m111->clk); | 986 | goto out_hdlfree; |
981 | goto eclkget; | ||
982 | } | ||
983 | 987 | ||
984 | ret = mt9m111_video_probe(client); | 988 | ret = mt9m111_video_probe(client); |
985 | if (ret) { | 989 | if (ret < 0) |
986 | v4l2_clk_put(mt9m111->clk); | 990 | goto out_hdlfree; |
987 | eclkget: | 991 | |
988 | v4l2_ctrl_handler_free(&mt9m111->hdl); | 992 | mt9m111->subdev.dev = &client->dev; |
989 | } | 993 | ret = v4l2_async_register_subdev(&mt9m111->subdev); |
994 | if (ret < 0) | ||
995 | goto out_hdlfree; | ||
996 | |||
997 | return 0; | ||
998 | |||
999 | out_hdlfree: | ||
1000 | v4l2_ctrl_handler_free(&mt9m111->hdl); | ||
1001 | out_clkput: | ||
1002 | v4l2_clk_put(mt9m111->clk); | ||
990 | 1003 | ||
991 | return ret; | 1004 | return ret; |
992 | } | 1005 | } |
@@ -995,6 +1008,7 @@ static int mt9m111_remove(struct i2c_client *client) | |||
995 | { | 1008 | { |
996 | struct mt9m111 *mt9m111 = to_mt9m111(client); | 1009 | struct mt9m111 *mt9m111 = to_mt9m111(client); |
997 | 1010 | ||
1011 | v4l2_async_unregister_subdev(&mt9m111->subdev); | ||
998 | v4l2_clk_put(mt9m111->clk); | 1012 | v4l2_clk_put(mt9m111->clk); |
999 | v4l2_device_unregister_subdev(&mt9m111->subdev); | 1013 | v4l2_device_unregister_subdev(&mt9m111->subdev); |
1000 | v4l2_ctrl_handler_free(&mt9m111->hdl); | 1014 | v4l2_ctrl_handler_free(&mt9m111->hdl); |