All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Cvek <petrcvekcz@gmail.com>
To: Ezequiel Garcia <ezequiel@collabora.com>,
	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>,
	Janusz Krzysztofik <jmkrzyszt@gmail.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH 1/6] media: mach-pxa: Register the camera sensor fixed-rate clock
Date: Tue, 5 Jan 2021 17:41:30 +0100	[thread overview]
Message-ID: <d07ac542-8b1c-779f-0b69-683c0d0ae2d1@gmail.com> (raw)
In-Reply-To: <20210104165739.116404-2-ezequiel@collabora.com>


Dne 04. 01. 21 v 17:57 Ezequiel Garcia napsal(a):
> The pxa-camera capture driver currently registers a v4l2-clk
> clock, named "mclk", to represent the mt9m111 sensor clock.
> 
> Register a proper fixed-rate clock using the generic clock framework,
> which will allow to remove the v4l2-clk clock in the pxa-camera
> driver in a follow-up commit.
> 

BTW the mclk output to a sensor is actually a variable rate, divided from lcdclk (which can be changed too). PXA camera driver  is using variable pcdev->mclk_divisor to generate the mclk from lcdclk. 

The rate change is done in pxa_camera_activate():

https://elixir.bootlin.com/linux/v5.11-rc2/source/drivers/media/platform/pxa_camera.c#L1136

	__raw_writel(pcdev->mclk_divisor | cicr4, pcdev->base + CICR4);

Would it be possible to register a correct clock type with possibility to change the divisor by the standard way?

Petr


> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Robert Jarzmik <robert.jarzmik@free.fr>
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  arch/arm/mach-pxa/devices.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
> index 524d6093e0c7..09b8495f3fd9 100644
> --- a/arch/arm/mach-pxa/devices.c
> +++ b/arch/arm/mach-pxa/devices.c
> @@ -4,6 +4,7 @@
>  #include <linux/init.h>
>  #include <linux/platform_device.h>
>  #include <linux/clkdev.h>
> +#include <linux/clk-provider.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/dmaengine.h>
>  #include <linux/spi/pxa2xx_spi.h>
> @@ -634,6 +635,13 @@ static struct platform_device pxa27x_device_camera = {
>  
>  void __init pxa_set_camera_info(struct pxacamera_platform_data *info)
>  {
> +	struct clk *mclk;
> +
> +	/* Register a fixed-rate clock for camera sensors. */
> +	mclk = clk_register_fixed_rate(NULL, "pxa_camera_clk", NULL, 0,
> +					     info->mclk_10khz * 10000);
> +	if (!IS_ERR(mclk))
> +		clkdev_create(mclk, "mclk", NULL);
>  	pxa_register_device(&pxa27x_device_camera, info);
>  }
>  
> 

  reply	other threads:[~2021-01-05 16:38 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 [this message]
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 ` [PATCH 3/6] media: ov9640: Use the generic clock framework Ezequiel Garcia
2021-01-05 16:18   ` 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=d07ac542-8b1c-779f-0b69-683c0d0ae2d1@gmail.com \
    --to=petrcvekcz@gmail.com \
    --cc=arnd@arndb.de \
    --cc=ezequiel@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jmkrzyszt@gmail.com \
    --cc=kernel@collabora.com \
    --cc=linux-media@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.