From patchwork Tue Jan 12 19:49:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 12014781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D50DC433E9 for ; Tue, 12 Jan 2021 19:52:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A2A4206C3 for ; Tue, 12 Jan 2021 19:52:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436763AbhALTwZ (ORCPT ); Tue, 12 Jan 2021 14:52:25 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:44248 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406358AbhALTwZ (ORCPT ); Tue, 12 Jan 2021 14:52:25 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 5CA821F45505 From: Ezequiel Garcia To: linux-media@vger.kernel.org, Hans Verkuil Cc: kernel@collabora.com, Arnd Bergmann , Petr Cvek , Janusz Krzysztofik , Sakari Ailus , Daniel Mack , Haojian Zhuang , Ezequiel Garcia Subject: [PATCH v2 3/6] media: ov9640: Use the generic clock framework Date: Tue, 12 Jan 2021 16:49:16 -0300 Message-Id: <20210112194919.50176-4-ezequiel@collabora.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210112194919.50176-1-ezequiel@collabora.com> References: <20210112194919.50176-1-ezequiel@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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. Signed-off-by: Ezequiel Garcia Acked-by: Petr Cvek --- drivers/media/i2c/ov9640.c | 15 ++++++--------- drivers/media/i2c/ov9640.h | 2 +- 2 files changed, 7 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 */ +#include #include #include #include @@ -26,7 +27,6 @@ #include #include -#include #include #include #include @@ -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..c105594b2472 100644 --- a/drivers/media/i2c/ov9640.h +++ b/drivers/media/i2c/ov9640.h @@ -196,7 +196,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;