All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Arun Kumar K <arunkk.samsung@gmail.com>
Cc: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>,
	LMML <linux-media@vger.kernel.org>,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	devicetree@vger.kernel.org,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Sachin Kamat <sachin.kamat@linaro.org>,
	shaik.ameer@samsung.com, kilyeon.im@samsung.com
Subject: Re: [RFC v3 01/13] [media] exynos5-is: Adding media device driver for exynos5
Date: Mon, 05 Aug 2013 12:47:14 +0200	[thread overview]
Message-ID: <51FF82B2.5070907@samsung.com> (raw)
In-Reply-To: <CALt3h7_qHb4UqsnVo+KPtHFdL42AShkKo5-V3qPaPrMUOANpGg@mail.gmail.com>

Hi Arun,

On 08/05/2013 12:06 PM, Arun Kumar K wrote:
> Hi Sylwester,
> 
> Thank you for the review.
> Will address all your review comments.
> Some responses below:

Thanks, it took me a while to review this nearly 10k of code.
But fortunately I could spent some more time at the computer
this weekend ;)

> [snip]
>>> +
>>> +static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
>>> +{
>>> +       struct device_node *of_node = fmd->pdev->dev.of_node;
>>> +       int ret;
>>> +
>>> +       /*
>>> +        * Runtime resume one of the FIMC entities to make sure
>>> +        * the sclk_cam clocks are not globally disabled.
>>
>>
>> It's a bit mysterious to me, is this requirement still valid on Exynos5 ?
>> I glanced over the Exynos5250 datasheet and there seem to be no sclk_cam?
>> clocks dependency on any of GScaler clocks. Maybe you don't need a clock
>> provider in this driver, perhaps sensor drivers could use sclk_cam clocks
>> directly, assigned through dts ?
> 
> Yes these clocks can be directly exposed via dt.
> I will drop clock provider from this driver.

That's great, this patch set won't depend then on the proper clock
deregistration support in the common clock framework.

>>> +/*
>>> + * The peripheral sensor clock management.
>>> + */
>>> +static void fimc_md_put_clocks(struct fimc_md *fmd)
>>> +{
>>> +       int i = FIMC_MAX_CAMCLKS;
>>> +
>>> +       while (--i>= 0) {
>>> +               if (IS_ERR(fmd->camclk[i].clock))
>>> +                       continue;
>>> +               clk_put(fmd->camclk[i].clock);
>>> +               fmd->camclk[i].clock = ERR_PTR(-EINVAL);
>>> +       }
>>
>>
>> Please double check if you need this sclk_cam clocks handling. We could
>> simply add a requirement that this driver supports only sensor subdevs
>> through the v4l2-async API and which controls their clock themselves.
>>
> 
> sclk_cam* handling can be removed and be done from respective
> sensors. But I think the sclk_bayer handling needs to be retained in the
> media driver.

Yes, that was my understanding as well.

>>> +}
>>> +
>>> +static int fimc_md_get_clocks(struct fimc_md *fmd)
>>> +{
>>> +       struct device *dev = NULL;
>>> +       char clk_name[32];
>>> +       struct clk *clock;
>>> +       int i, ret = 0;
>>> +
>>> +       for (i = 0; i<  FIMC_MAX_CAMCLKS; i++)
>>> +               fmd->camclk[i].clock = ERR_PTR(-EINVAL);
>>> +
>>> +       if (fmd->pdev->dev.of_node)
>>> +               dev =&fmd->pdev->dev;
>>> +
>>> +       for (i = 0; i<  SCLK_BAYER; i++) {
>>> +               snprintf(clk_name, sizeof(clk_name), "sclk_cam%u", i);
>>> +               clock = clk_get(dev, clk_name);
>>> +
>>> +               if (IS_ERR(clock)) {
>>> +                       dev_err(&fmd->pdev->dev, "Failed to get clock:
>>> %s\n",
>>> +                                                               clk_name);
>>> +                       ret = PTR_ERR(clock);
>>> +                       break;
>>> +               }
>>> +               fmd->camclk[i].clock = clock;
>>> +       }
>>> +       if (ret)
>>> +               fimc_md_put_clocks(fmd);
>>> +
>>> +       /* Prepare bayer clk */
>>> +       clock = clk_get(dev, "sclk_bayer");
>>> +
>>> +       if (IS_ERR(clock)) {
>>> +               dev_err(&fmd->pdev->dev, "Failed to get clock: %s\n",
>>> +                                                       clk_name);
>>
>>
>> Wrong error message.
>>
>>> +               ret = PTR_ERR(clock);
>>> +               goto err_exit;
>>> +       }
>>> +       ret = clk_prepare(clock);
>>> +       if (ret<  0) {
>>> +               clk_put(clock);
>>> +               fmd->camclk[SCLK_BAYER].clock = ERR_PTR(-EINVAL);
>>> +               goto err_exit;
>>> +       }
>>> +       fmd->camclk[SCLK_BAYER].clock = clock;
>>
>>
>> Could you explain a bit how is this SCLK_BAYER clock used ? Is it routed
>> to external image sensor, or is it used only inside an SoC ?
>>
> 
> It is not defined properly in the manual, but I suppose its the bus clock
> for the bayer rgb data bus. So for proper sensor functionality, we need this
> sclk_bayer in addition to the external sensor clks (sclk_cam*). Isn't
> exynos5 media driver is the best place to handle such clocks?

I see, I think it's the right place. I was just curious what this clock
was exactly. It an SoC requires it internally then it is correct to handle
it as you do now. And if it happens that it controls the CAM_BAY_MCLK
output clock of the camera bay, then it could be exposed as the master
clock for the device attached to that physical camera port. In that case
the SCLK_CAM bayer clock could be gated conditionally in the media device
driver, depending on the data bus interface used by a remote image data
source device. But that's mostly speculations. I'm fine with associating
this clock with the media device, especially as far as the DT binding is
concerned.

--
Thanks,
Sylwester

  reply	other threads:[~2013-08-05 10:47 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02 15:02 [RFC v3 00/13] Exynos5 IS driver Arun Kumar K
2013-08-02 15:02 ` [RFC v3 01/13] [media] exynos5-is: Adding media device driver for exynos5 Arun Kumar K
2013-08-03 21:41   ` Sylwester Nawrocki
2013-08-05 10:06     ` Arun Kumar K
2013-08-05 10:47       ` Sylwester Nawrocki [this message]
2013-08-05  5:21   ` Sachin Kamat
2013-08-05 10:07     ` Arun Kumar K
2013-08-02 15:02 ` [RFC v3 02/13] [media] exynos5-fimc-is: Add Exynos5 FIMC-IS device tree bindings documentation Arun Kumar K
2013-08-03 21:41   ` Sylwester Nawrocki
2013-08-05 16:53     ` Stephen Warren
2013-08-05 22:37       ` Sylwester Nawrocki
2013-08-08 20:34         ` Stephen Warren
2013-08-13 21:14           ` Sylwester Nawrocki
2013-08-02 15:02 ` [RFC v3 03/13] [media] exynos5-fimc-is: Add driver core files Arun Kumar K
2013-08-03 21:42   ` Sylwester Nawrocki
2013-08-05 14:22     ` Arun Kumar K
2013-08-02 15:02 ` [RFC v3 04/13] [media] exynos5-fimc-is: Add common driver header files Arun Kumar K
2013-08-03 21:43   ` Sylwester Nawrocki
2013-08-06  4:47     ` Arun Kumar K
2013-08-02 15:02 ` [RFC v3 05/13] [media] exynos5-fimc-is: Add register definition and context header Arun Kumar K
2013-08-03 21:45   ` Sylwester Nawrocki
2013-08-02 15:02 ` [RFC v3 06/13] [media] exynos5-fimc-is: Add isp subdev Arun Kumar K
2013-08-03 21:48   ` Sylwester Nawrocki
2013-08-02 15:02 ` [RFC v3 07/13] [media] exynos5-fimc-is: Add scaler subdev Arun Kumar K
2013-08-03 21:46   ` Sylwester Nawrocki
2013-08-02 15:02 ` [RFC v3 08/13] [media] exynos5-fimc-is: Add sensor interface Arun Kumar K
2013-08-03 21:48   ` Sylwester Nawrocki
2013-08-02 15:02 ` [RFC v3 09/13] [media] exynos5-fimc-is: Add the hardware pipeline control Arun Kumar K
2013-08-04 15:00   ` Sylwester Nawrocki
2013-08-06 13:49     ` Arun Kumar K
2013-08-07  5:52     ` Sachin Kamat
2013-08-02 15:02 ` [RFC v3 10/13] [media] exynos5-fimc-is: Add the hardware interface module Arun Kumar K
2013-08-04 15:03   ` Sylwester Nawrocki
2013-08-07  5:16     ` Arun Kumar K
2013-08-02 15:02 ` [RFC v3 11/13] [media] exynos5-is: Add Kconfig and Makefile Arun Kumar K
2013-08-03 22:05   ` Sylwester Nawrocki
2013-08-02 15:02 ` [RFC v3 12/13] V4L: s5k6a3: Change sensor min/max resolutions Arun Kumar K
2013-08-03 21:51   ` Sylwester Nawrocki
2013-08-02 15:02 ` [RFC v3 13/13] V4L: Add driver for s5k4e5 image sensor Arun Kumar K
2013-08-03 21:49   ` Sylwester Nawrocki
2013-08-03 21:40 ` [RFC v3 00/13] Exynos5 IS driver Sylwester Nawrocki
2013-08-05  5:10   ` Arun Kumar K

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=51FF82B2.5070907@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=a.hajda@samsung.com \
    --cc=arunkk.samsung@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil@xs4all.nl \
    --cc=kilyeon.im@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=sachin.kamat@linaro.org \
    --cc=shaik.ameer@samsung.com \
    --cc=sylvester.nawrocki@gmail.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.