From: Hugues FRUCHET <hugues.fruchet@st.com>
To: Hans Verkuil <hverkuil@xs4all.nl>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Cc: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>,
Songjun Wu <songjun.wu@microchip.com>,
Sakari Ailus <sakari.ailus@iki.fi>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCHv6 12/14] ov2640: use standard clk and enable it.
Date: Wed, 29 Mar 2017 13:42:36 +0000 [thread overview]
Message-ID: <3537d572-8954-3e7e-663d-e5d1bc836505@st.com> (raw)
In-Reply-To: <20170328082347.11159-13-hverkuil@xs4all.nl>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>
Tested successfully on STM324x9I-EVAL evaluation board embedding
an OV2640 camera sensor.
BR,
Hugues.
On 03/28/2017 10:23 AM, Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> 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>
> ---
> drivers/media/i2c/ov2640.c | 31 ++++++++++++++-----------------
> 1 file changed, 14 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
> index 83f88efbce69..0445963c5fae 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;
> }
>
>
next prev parent reply other threads:[~2017-03-29 13:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-28 8:23 [PATCHv6 00/14] atmel-isi/ov7670/ov2640: convert to standalone drivers Hans Verkuil
2017-03-28 8:23 ` [PATCHv6 01/14] ov7670: document device tree bindings Hans Verkuil
2017-03-28 8:23 ` [PATCHv6 03/14] ov7670: fix g/s_parm Hans Verkuil
2017-03-28 8:23 ` [PATCHv6 04/14] ov7670: get xclk Hans Verkuil
2017-03-28 8:23 ` [PATCHv6 05/14] ov7670: add devicetree support Hans Verkuil
2017-03-28 8:23 ` [PATCHv6 07/14] atmel-isi: remove dependency of the soc-camera framework Hans Verkuil
2017-03-28 8:23 ` [PATCHv6 11/14] ov2640: convert from soc-camera to a standard subdev sensor driver Hans Verkuil
2017-03-29 13:42 ` Hugues FRUCHET
2017-03-29 13:44 ` Hans Verkuil
[not found] ` <5623f5dd-88b3-10e6-5703-9400a893a530-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-03-29 13:50 ` Hugues FRUCHET
2017-03-28 8:23 ` [PATCHv6 12/14] ov2640: use standard clk and enable it Hans Verkuil
2017-03-29 13:42 ` Hugues FRUCHET [this message]
2017-03-28 8:23 ` [PATCHv6 13/14] ov2640: add MC support Hans Verkuil
[not found] ` <20170328082347.11159-1-hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-03-28 8:23 ` [PATCHv6 02/14] ov7670: call v4l2_async_register_subdev Hans Verkuil
2017-03-28 8:23 ` [PATCHv6 06/14] atmel-isi: update device tree bindings documentation Hans Verkuil
[not found] ` <20170328082347.11159-7-hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-04-03 14:28 ` Rob Herring
2017-03-28 8:23 ` [PATCHv6 08/14] atmel-isi: move out of soc_camera to atmel Hans Verkuil
2017-03-28 8:23 ` [PATCHv6 09/14] ov2640: fix colorspace handling Hans Verkuil
2017-03-28 8:23 ` [PATCHv6 10/14] ov2640: update bindings Hans Verkuil
2017-03-28 8:23 ` [PATCHv6 14/14] em28xx: drop last soc_camera link Hans Verkuil
2017-04-04 14:00 ` [PATCHv6 00/14] atmel-isi/ov7670/ov2640: convert to standalone drivers Nicolas Ferre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3537d572-8954-3e7e-663d-e5d1bc836505@st.com \
--to=hugues.fruchet@st.com \
--cc=devicetree@vger.kernel.org \
--cc=guennadi.liakhovetski@intel.com \
--cc=hans.verkuil@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@iki.fi \
--cc=songjun.wu@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox