Commit ccdd85d5 authored by Janusz Krzysztofik's avatar Janusz Krzysztofik Committed by Mauro Carvalho Chehab

media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper

In preparation for adding asynchronous subdevice support to the driver,
don't acquire v4l2_clk from the driver .probe() callback as that may
fail if the clock is provided by a bridge driver which may be not yet
initialized.  Move the v4l2_clk_get() to ov6650_video_probe() helper
which is going to be converted to v4l2_subdev_internal_ops.registered()
callback, executed only when the bridge driver is ready.
Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 933c1320
...@@ -810,9 +810,16 @@ static int ov6650_video_probe(struct i2c_client *client) ...@@ -810,9 +810,16 @@ static int ov6650_video_probe(struct i2c_client *client)
u8 pidh, pidl, midh, midl; u8 pidh, pidl, midh, midl;
int ret; int ret;
priv->clk = v4l2_clk_get(&client->dev, NULL);
if (IS_ERR(priv->clk)) {
ret = PTR_ERR(priv->clk);
dev_err(&client->dev, "v4l2_clk request err: %d\n", ret);
return ret;
}
ret = ov6650_s_power(&priv->subdev, 1); ret = ov6650_s_power(&priv->subdev, 1);
if (ret < 0) if (ret < 0)
return ret; goto eclkput;
msleep(20); msleep(20);
...@@ -849,6 +856,11 @@ static int ov6650_video_probe(struct i2c_client *client) ...@@ -849,6 +856,11 @@ static int ov6650_video_probe(struct i2c_client *client)
done: done:
ov6650_s_power(&priv->subdev, 0); ov6650_s_power(&priv->subdev, 0);
if (!ret)
return 0;
eclkput:
v4l2_clk_put(priv->clk);
return ret; return ret;
} }
...@@ -991,18 +1003,9 @@ static int ov6650_probe(struct i2c_client *client, ...@@ -991,18 +1003,9 @@ static int ov6650_probe(struct i2c_client *client,
priv->code = MEDIA_BUS_FMT_YUYV8_2X8; priv->code = MEDIA_BUS_FMT_YUYV8_2X8;
priv->colorspace = V4L2_COLORSPACE_JPEG; priv->colorspace = V4L2_COLORSPACE_JPEG;
priv->clk = v4l2_clk_get(&client->dev, NULL);
if (IS_ERR(priv->clk)) {
ret = PTR_ERR(priv->clk);
goto eclkget;
}
ret = ov6650_video_probe(client); ret = ov6650_video_probe(client);
if (ret) { if (ret)
v4l2_clk_put(priv->clk);
eclkget:
v4l2_ctrl_handler_free(&priv->hdl); v4l2_ctrl_handler_free(&priv->hdl);
}
return ret; return ret;
} }
......
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