diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2016-11-24 05:41:42 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-04-10 13:42:28 -0300 |
commit | 46796cfcd346a70af679d1e7126db6774d440c6f (patch) | |
tree | a035b1e98d7c0c44c85f8a16b2553cc977d81940 /drivers | |
parent | 34aa88790bad73ab9e41218a3874b794912f3a3d (diff) |
[media] ov2640: use standard clk and enable it
Convert v4l2_clk to normal clk and enable the clock.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/i2c/ov2640.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c index 24ac97e720f9..dcc1c68e8bb3 100644 --- a/drivers/media/i2c/ov2640.c +++ b/drivers/media/i2c/ov2640.c @@ -16,6 +16,7 @@ #include <linux/init.h> #include <linux/module.h> #include <linux/i2c.h> +#include <linux/clk.h> #include <linux/slab.h> #include <linux/delay.h> #include <linux/gpio.h> @@ -24,7 +25,6 @@ #include <linux/v4l2-mediabus.h> #include <linux/videodev2.h> -#include <media/v4l2-clk.h> #include <media/v4l2-device.h> #include <media/v4l2-subdev.h> #include <media/v4l2-ctrls.h> @@ -284,7 +284,7 @@ struct ov2640_priv { struct v4l2_subdev subdev; struct v4l2_ctrl_handler hdl; u32 cfmt_code; - struct v4l2_clk *clk; + struct clk *clk; const struct ov2640_win_size *win; struct gpio_desc *resetb_gpio; @@ -1051,14 +1051,11 @@ static int ov2640_probe(struct i2c_client *client, return -ENOMEM; } - priv->clk = v4l2_clk_get(&client->dev, "xvclk"); - if (IS_ERR(priv->clk)) - return -EPROBE_DEFER; - - if (!client->dev.of_node) { - dev_err(&client->dev, "Missing platform_data for driver\n"); - ret = -EINVAL; - goto err_clk; + if (client->dev.of_node) { + priv->clk = devm_clk_get(&client->dev, "xvclk"); + if (IS_ERR(priv->clk)) + return -EPROBE_DEFER; + clk_prepare_enable(priv->clk); } ret = ov2640_probe_dt(client, priv); @@ -1074,25 +1071,25 @@ static int ov2640_probe(struct i2c_client *client, priv->subdev.ctrl_handler = &priv->hdl; if (priv->hdl.error) { ret = priv->hdl.error; - goto err_clk; + goto err_hdl; } ret = ov2640_video_probe(client); if (ret < 0) - goto err_videoprobe; + goto err_hdl; ret = v4l2_async_register_subdev(&priv->subdev); if (ret < 0) - goto err_videoprobe; + goto err_hdl; dev_info(&adapter->dev, "OV2640 Probed\n"); return 0; -err_videoprobe: +err_hdl: v4l2_ctrl_handler_free(&priv->hdl); err_clk: - v4l2_clk_put(priv->clk); + clk_disable_unprepare(priv->clk); return ret; } @@ -1101,9 +1098,9 @@ static int ov2640_remove(struct i2c_client *client) struct ov2640_priv *priv = to_ov2640(client); v4l2_async_unregister_subdev(&priv->subdev); - v4l2_clk_put(priv->clk); - v4l2_device_unregister_subdev(&priv->subdev); v4l2_ctrl_handler_free(&priv->hdl); + v4l2_device_unregister_subdev(&priv->subdev); + clk_disable_unprepare(priv->clk); return 0; } |