From: Ezequiel Garcia <ezequiel@collabora.com>
To: linux-media@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>
Cc: kernel@collabora.com, Arnd Bergmann <arnd@arndb.de>,
Robert Jarzmik <robert.jarzmik@free.fr>,
Petr Cvek <petrcvekcz@gmail.com>,
Janusz Krzysztofik <jmkrzyszt@gmail.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Ezequiel Garcia <ezequiel@collabora.com>
Subject: [PATCH 3/6] media: ov9640: Use the generic clock framework
Date: Mon, 4 Jan 2021 13:57:36 -0300 [thread overview]
Message-ID: <20210104165739.116404-4-ezequiel@collabora.com> (raw)
In-Reply-To: <20210104165739.116404-1-ezequiel@collabora.com>
Commit 63839882c597 ("media: mach-pxa: palmz72/pcm990: remove soc_camera dependencies")
removed the last in-tree user of this sensor. New users
will be required to use the generic clock framework,
so it's possible to convert the driver to use it.
Convert the driver to use the CCF, and drop the legacy
v4l2-clk API.
Cc: Petr Cvek <petrcvekcz@gmail.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
drivers/media/i2c/ov9640.c | 15 ++++++---------
drivers/media/i2c/ov9640.h | 4 +++-
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/media/i2c/ov9640.c b/drivers/media/i2c/ov9640.c
index e2a25240fc85..d36b04c49628 100644
--- a/drivers/media/i2c/ov9640.c
+++ b/drivers/media/i2c/ov9640.c
@@ -17,6 +17,7 @@
* Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
*/
+#include <linux/clk.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/i2c.h>
@@ -26,7 +27,6 @@
#include <linux/videodev2.h>
#include <media/v4l2-async.h>
-#include <media/v4l2-clk.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
@@ -333,13 +333,13 @@ static int ov9640_s_power(struct v4l2_subdev *sd, int on)
if (on) {
gpiod_set_value(priv->gpio_power, 1);
usleep_range(1000, 2000);
- ret = v4l2_clk_enable(priv->clk);
+ ret = clk_prepare_enable(priv->clk);
usleep_range(1000, 2000);
gpiod_set_value(priv->gpio_reset, 0);
} else {
gpiod_set_value(priv->gpio_reset, 1);
usleep_range(1000, 2000);
- v4l2_clk_disable(priv->clk);
+ clk_disable_unprepare(priv->clk);
usleep_range(1000, 2000);
gpiod_set_value(priv->gpio_power, 0);
}
@@ -719,7 +719,7 @@ static int ov9640_probe(struct i2c_client *client,
priv->subdev.ctrl_handler = &priv->hdl;
- priv->clk = v4l2_clk_get(&client->dev, "mclk");
+ priv->clk = devm_clk_get(&client->dev, "mclk");
if (IS_ERR(priv->clk)) {
ret = PTR_ERR(priv->clk);
goto ectrlinit;
@@ -727,17 +727,15 @@ static int ov9640_probe(struct i2c_client *client,
ret = ov9640_video_probe(client);
if (ret)
- goto eprobe;
+ goto ectrlinit;
priv->subdev.dev = &client->dev;
ret = v4l2_async_register_subdev(&priv->subdev);
if (ret)
- goto eprobe;
+ goto ectrlinit;
return 0;
-eprobe:
- v4l2_clk_put(priv->clk);
ectrlinit:
v4l2_ctrl_handler_free(&priv->hdl);
@@ -749,7 +747,6 @@ static int ov9640_remove(struct i2c_client *client)
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct ov9640_priv *priv = to_ov9640_sensor(sd);
- v4l2_clk_put(priv->clk);
v4l2_async_unregister_subdev(&priv->subdev);
v4l2_ctrl_handler_free(&priv->hdl);
diff --git a/drivers/media/i2c/ov9640.h b/drivers/media/i2c/ov9640.h
index a8ed6992c1a8..a1f9150b2050 100644
--- a/drivers/media/i2c/ov9640.h
+++ b/drivers/media/i2c/ov9640.h
@@ -180,6 +180,8 @@ enum {
};
#define H_SXGA 960
+struct clk;
+
/* Misc. structures */
struct ov9640_reg_alt {
u8 com7;
@@ -196,7 +198,7 @@ struct ov9640_reg {
struct ov9640_priv {
struct v4l2_subdev subdev;
struct v4l2_ctrl_handler hdl;
- struct v4l2_clk *clk;
+ struct clk *clk;
struct gpio_desc *gpio_power;
struct gpio_desc *gpio_reset;
--
2.29.2
next prev parent reply other threads:[~2021-01-04 16:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 16:57 [PATCH 0/6] Remove last users of v4l2-clk and remove v4l2-clk Ezequiel Garcia
2021-01-04 16:57 ` [PATCH 1/6] media: mach-pxa: Register the camera sensor fixed-rate clock Ezequiel Garcia
2021-01-05 16:41 ` Petr Cvek
2021-01-06 15:53 ` Ezequiel Garcia
2021-01-08 11:02 ` Petr Cvek
2021-01-08 12:51 ` Ezequiel Garcia
2021-01-08 12:59 ` Arnd Bergmann
2021-01-04 16:57 ` [PATCH 2/6] media: pxa_camera: Drop the v4l2-clk clock register Ezequiel Garcia
2021-01-04 16:57 ` Ezequiel Garcia [this message]
2021-01-05 16:18 ` [PATCH 3/6] media: ov9640: Use the generic clock framework Petr Cvek
2021-01-06 14:18 ` Ezequiel Garcia
2021-01-04 16:57 ` [PATCH 4/6] media: mt9m111: " Ezequiel Garcia
2021-01-04 16:57 ` [PATCH 5/6] media: ov6650: " Ezequiel Garcia
2021-01-08 11:42 ` Janusz Krzysztofik
2021-01-04 16:57 ` [PATCH 6/6] media: Remove the legacy v4l2-clk API Ezequiel Garcia
2021-01-04 20:51 ` [PATCH 0/6] Remove last users of v4l2-clk and remove v4l2-clk Ezequiel Garcia
2021-01-05 16:08 ` Petr Cvek
2021-01-06 14:24 ` Ezequiel Garcia
2021-01-08 11:04 ` Petr Cvek
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=20210104165739.116404-4-ezequiel@collabora.com \
--to=ezequiel@collabora.com \
--cc=arnd@arndb.de \
--cc=hverkuil@xs4all.nl \
--cc=jmkrzyszt@gmail.com \
--cc=kernel@collabora.com \
--cc=linux-media@vger.kernel.org \
--cc=petrcvekcz@gmail.com \
--cc=robert.jarzmik@free.fr \
--cc=sakari.ailus@linux.intel.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