All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Figa <tomasz.figa@gmail.com>
To: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	Mike Turquette <mturquette@linaro.org>,
	Tomasz Figa <t.figa@samsung.com>,
	"a.hajda@samsung.com" <a.hajda@samsung.com>,
	"kyungmin.park@samsung.com" <kyungmin.park@samsung.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	"galak@codeaurora.org" <galak@codeaurora.org>,
	"kgene.kim@samsung.com" <kgene.kim@samsung.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Subject: Re: [PATCH v4 03/10] Documentation: devicetree: Update Samsung FIMC DT binding
Date: Sat, 22 Feb 2014 23:26:35 +0100	[thread overview]
Message-ID: <5309241B.5000702@gmail.com> (raw)
In-Reply-To: <53091E72.3090107@gmail.com>

[Ccing Mike]

On 22.02.2014 23:02, Sylwester Nawrocki wrote:
> On 02/21/2014 04:50 PM, Mark Rutland wrote:
>> On Thu, Feb 20, 2014 at 07:40:30PM +0000, Sylwester Nawrocki wrote:
>>> +- #clock-cells: from the common clock bindings
>>> (../clock/clock-bindings.txt),
>>> +  must be 1. A clock provider is associated with the 'camera' node
>>> and it should
>>> +  be referenced by external sensors that use clocks provided by the
>>> SoC on
>>> +  CAM_*_CLKOUT pins. The clock specifier cell stores an index of a
>>> clock.
>>> +  The indices are 0, 1 for CAM_A_CLKOUT, CAM_B_CLKOUT clocks
>>> respectively.
>>> +
>>> +- clock-output-names: from the common clock bindings, should contain
>>> names of
>>> +  clocks registered by the camera subsystem corresponding to
>>> CAM_A_CLKOUT,
>>> +  CAM_B_CLKOUT output clocks, in this order. Parent clock of these
>>> clocks are
>>> +  specified be first two entries of the clock-names property.
>>
>> Do you need this?
>
> All right, that might have been a bad idea, it mixes names of clocks
> registered
> by the main clock controller with names of clock input lines at the device.
> It's a mistake I have been usually sensitive to and now made it myself. :/
>
> My intention was to maintain the clock tree, since the camera block doesn't
> generate the clock itself, it merely passes through the clocks from the
> SoC main
> clock controller (CMU). So clk parents need to be properly set and since
> there
> is no clock-output-names property at the CMU DT node,
> of_clk_get_parent_name()
> cannot be used.
>
> So presumably the DT binding would be only specifying that the sclk_cam0,
> sclk_cam1 clock input entries are associated with output clocks named as
> in clock-output-names property.
>
> And the driver could either:
>   1) hard code those (well defined) CMU clock (clk parent) names,

I don't think this would be a good idea, as those CMU clock names may 
vary between SoCs.

>   2) clk_get() its input clock, retrieve name with __clk_get_name() and
> pass
>     it as parent name to clk_register() - it sounds a bit hacky though.

This looks fine, at least until proper interface is added to CCF. Exynos 
audio subsystem clock driver does exactly the same.

However, the right thing would be to make it possible to use pointers to 
struct clk instead of strings to list parent(s). This could be done by 
adding .parents field (struct clk **) to clk_init_data struct and make 
clk_register() use it if available.

>
> The output clock names could be also well defined by the binding per the
> IP's
> compatible. Nevertheless using clock-output-names seems cleaner to me than
> defining character strings in the driver.
>
> What do you think ?

<RANT>

Personally, I don't like clock-output-names at all. The idea of having a 
global namespace for all clock providers looks flawed to me. This 
property only tries to work around the not-quite-right design by giving 
device tree the right to force CCF to use particular internal clock 
identifiers and avoid collisions if two providers happen to have the 
same internal clock names.

I believe there should be completely no need for clock-output-names, 
(other than a textual label for debugging purposes, analogically to 
regulator-name). If one clock provider needs a clock from another, then 
you should list it using clock bindings in node of the former, not rely 
on some static name assignments.

Then, after eliminating the need to use static names anymore, the 
namespace could be split into per-provider namespaces and we would have 
no collision issue anymore.

Of course it's probably to late already for such changes, as there are 
already systems relying on clock-output-names (i.e. without inter-IP 
clock dependencies listed using clock bindings) and we would have to 
keep backwards compatibility anyway...

</RANT>

Best regards,
Tomasz

WARNING: multiple messages have this Message-ID (diff)
From: Tomasz Figa <tomasz.figa@gmail.com>
To: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"galak@codeaurora.org" <galak@codeaurora.org>,
	"kyungmin.park@samsung.com" <kyungmin.park@samsung.com>,
	"kgene.kim@samsung.com" <kgene.kim@samsung.com>,
	"a.hajda@samsung.com" <a.hajda@samsung.com>,
	Mike Turquette <mturquette@linaro.org>,
	Tomasz Figa <t.figa@samsung.com>
Subject: Re: [PATCH v4 03/10] Documentation: devicetree: Update Samsung FIMC DT binding
Date: Sat, 22 Feb 2014 23:26:35 +0100	[thread overview]
Message-ID: <5309241B.5000702@gmail.com> (raw)
In-Reply-To: <53091E72.3090107@gmail.com>

[Ccing Mike]

On 22.02.2014 23:02, Sylwester Nawrocki wrote:
> On 02/21/2014 04:50 PM, Mark Rutland wrote:
>> On Thu, Feb 20, 2014 at 07:40:30PM +0000, Sylwester Nawrocki wrote:
>>> +- #clock-cells: from the common clock bindings
>>> (../clock/clock-bindings.txt),
>>> +  must be 1. A clock provider is associated with the 'camera' node
>>> and it should
>>> +  be referenced by external sensors that use clocks provided by the
>>> SoC on
>>> +  CAM_*_CLKOUT pins. The clock specifier cell stores an index of a
>>> clock.
>>> +  The indices are 0, 1 for CAM_A_CLKOUT, CAM_B_CLKOUT clocks
>>> respectively.
>>> +
>>> +- clock-output-names: from the common clock bindings, should contain
>>> names of
>>> +  clocks registered by the camera subsystem corresponding to
>>> CAM_A_CLKOUT,
>>> +  CAM_B_CLKOUT output clocks, in this order. Parent clock of these
>>> clocks are
>>> +  specified be first two entries of the clock-names property.
>>
>> Do you need this?
>
> All right, that might have been a bad idea, it mixes names of clocks
> registered
> by the main clock controller with names of clock input lines at the device.
> It's a mistake I have been usually sensitive to and now made it myself. :/
>
> My intention was to maintain the clock tree, since the camera block doesn't
> generate the clock itself, it merely passes through the clocks from the
> SoC main
> clock controller (CMU). So clk parents need to be properly set and since
> there
> is no clock-output-names property at the CMU DT node,
> of_clk_get_parent_name()
> cannot be used.
>
> So presumably the DT binding would be only specifying that the sclk_cam0,
> sclk_cam1 clock input entries are associated with output clocks named as
> in clock-output-names property.
>
> And the driver could either:
>   1) hard code those (well defined) CMU clock (clk parent) names,

I don't think this would be a good idea, as those CMU clock names may 
vary between SoCs.

>   2) clk_get() its input clock, retrieve name with __clk_get_name() and
> pass
>     it as parent name to clk_register() - it sounds a bit hacky though.

This looks fine, at least until proper interface is added to CCF. Exynos 
audio subsystem clock driver does exactly the same.

However, the right thing would be to make it possible to use pointers to 
struct clk instead of strings to list parent(s). This could be done by 
adding .parents field (struct clk **) to clk_init_data struct and make 
clk_register() use it if available.

>
> The output clock names could be also well defined by the binding per the
> IP's
> compatible. Nevertheless using clock-output-names seems cleaner to me than
> defining character strings in the driver.
>
> What do you think ?

<RANT>

Personally, I don't like clock-output-names at all. The idea of having a 
global namespace for all clock providers looks flawed to me. This 
property only tries to work around the not-quite-right design by giving 
device tree the right to force CCF to use particular internal clock 
identifiers and avoid collisions if two providers happen to have the 
same internal clock names.

I believe there should be completely no need for clock-output-names, 
(other than a textual label for debugging purposes, analogically to 
regulator-name). If one clock provider needs a clock from another, then 
you should list it using clock bindings in node of the former, not rely 
on some static name assignments.

Then, after eliminating the need to use static names anymore, the 
namespace could be split into per-provider namespaces and we would have 
no collision issue anymore.

Of course it's probably to late already for such changes, as there are 
already systems relying on clock-output-names (i.e. without inter-IP 
clock dependencies listed using clock bindings) and we would have to 
keep backwards compatibility anyway...

</RANT>

Best regards,
Tomasz

WARNING: multiple messages have this Message-ID (diff)
From: tomasz.figa@gmail.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 03/10] Documentation: devicetree: Update Samsung FIMC DT binding
Date: Sat, 22 Feb 2014 23:26:35 +0100	[thread overview]
Message-ID: <5309241B.5000702@gmail.com> (raw)
In-Reply-To: <53091E72.3090107@gmail.com>

[Ccing Mike]

On 22.02.2014 23:02, Sylwester Nawrocki wrote:
> On 02/21/2014 04:50 PM, Mark Rutland wrote:
>> On Thu, Feb 20, 2014 at 07:40:30PM +0000, Sylwester Nawrocki wrote:
>>> +- #clock-cells: from the common clock bindings
>>> (../clock/clock-bindings.txt),
>>> +  must be 1. A clock provider is associated with the 'camera' node
>>> and it should
>>> +  be referenced by external sensors that use clocks provided by the
>>> SoC on
>>> +  CAM_*_CLKOUT pins. The clock specifier cell stores an index of a
>>> clock.
>>> +  The indices are 0, 1 for CAM_A_CLKOUT, CAM_B_CLKOUT clocks
>>> respectively.
>>> +
>>> +- clock-output-names: from the common clock bindings, should contain
>>> names of
>>> +  clocks registered by the camera subsystem corresponding to
>>> CAM_A_CLKOUT,
>>> +  CAM_B_CLKOUT output clocks, in this order. Parent clock of these
>>> clocks are
>>> +  specified be first two entries of the clock-names property.
>>
>> Do you need this?
>
> All right, that might have been a bad idea, it mixes names of clocks
> registered
> by the main clock controller with names of clock input lines at the device.
> It's a mistake I have been usually sensitive to and now made it myself. :/
>
> My intention was to maintain the clock tree, since the camera block doesn't
> generate the clock itself, it merely passes through the clocks from the
> SoC main
> clock controller (CMU). So clk parents need to be properly set and since
> there
> is no clock-output-names property at the CMU DT node,
> of_clk_get_parent_name()
> cannot be used.
>
> So presumably the DT binding would be only specifying that the sclk_cam0,
> sclk_cam1 clock input entries are associated with output clocks named as
> in clock-output-names property.
>
> And the driver could either:
>   1) hard code those (well defined) CMU clock (clk parent) names,

I don't think this would be a good idea, as those CMU clock names may 
vary between SoCs.

>   2) clk_get() its input clock, retrieve name with __clk_get_name() and
> pass
>     it as parent name to clk_register() - it sounds a bit hacky though.

This looks fine, at least until proper interface is added to CCF. Exynos 
audio subsystem clock driver does exactly the same.

However, the right thing would be to make it possible to use pointers to 
struct clk instead of strings to list parent(s). This could be done by 
adding .parents field (struct clk **) to clk_init_data struct and make 
clk_register() use it if available.

>
> The output clock names could be also well defined by the binding per the
> IP's
> compatible. Nevertheless using clock-output-names seems cleaner to me than
> defining character strings in the driver.
>
> What do you think ?

<RANT>

Personally, I don't like clock-output-names at all. The idea of having a 
global namespace for all clock providers looks flawed to me. This 
property only tries to work around the not-quite-right design by giving 
device tree the right to force CCF to use particular internal clock 
identifiers and avoid collisions if two providers happen to have the 
same internal clock names.

I believe there should be completely no need for clock-output-names, 
(other than a textual label for debugging purposes, analogically to 
regulator-name). If one clock provider needs a clock from another, then 
you should list it using clock bindings in node of the former, not rely 
on some static name assignments.

Then, after eliminating the need to use static names anymore, the 
namespace could be split into per-provider namespaces and we would have 
no collision issue anymore.

Of course it's probably to late already for such changes, as there are 
already systems relying on clock-output-names (i.e. without inter-IP 
clock dependencies listed using clock bindings) and we would have to 
keep backwards compatibility anyway...

</RANT>

Best regards,
Tomasz

  reply	other threads:[~2014-02-22 22:26 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 19:40 [PATCH v4 00/10] Add device tree support for Exynos4 SoC camera subsystem Sylwester Nawrocki
2014-02-20 19:40 ` Sylwester Nawrocki
2014-02-20 19:40 ` Sylwester Nawrocki
2014-02-20 19:40   ` Sylwester Nawrocki
2014-02-20 19:40 ` [PATCH v4 01/10] Documentation: dt: Add DT binding documentation for S5K6A3 image sensor Sylwester Nawrocki
2014-02-20 19:40   ` Sylwester Nawrocki
2014-02-20 19:40 ` [PATCH v4 02/10] Documentation: dt: Add DT binding documentation for S5C73M3 camera Sylwester Nawrocki
2014-02-20 19:40   ` Sylwester Nawrocki
2014-02-21 15:42   ` Mark Rutland
2014-02-21 15:42     ` Mark Rutland
2014-02-21 17:52     ` Sylwester Nawrocki
2014-02-21 17:52       ` Sylwester Nawrocki
2014-02-20 19:40 ` [PATCH v4 03/10] Documentation: devicetree: Update Samsung FIMC DT binding Sylwester Nawrocki
2014-02-20 19:40   ` Sylwester Nawrocki
2014-02-21 15:50   ` Mark Rutland
2014-02-21 15:50     ` Mark Rutland
2014-02-22 22:02     ` Sylwester Nawrocki
2014-02-22 22:02       ` Sylwester Nawrocki
2014-02-22 22:26       ` Tomasz Figa [this message]
2014-02-22 22:26         ` Tomasz Figa
2014-02-22 22:26         ` Tomasz Figa
2014-02-22 22:52         ` Sylwester Nawrocki
2014-02-22 22:52           ` Sylwester Nawrocki
     [not found] ` <1392925237-31394-1-git-send-email-s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-02-20 19:40   ` [PATCH v4 04/10] V4L: Add driver for s5k6a3 image sensor Sylwester Nawrocki
2014-02-20 19:40     ` Sylwester Nawrocki
2014-02-20 19:40     ` Sylwester Nawrocki
2014-02-20 19:40 ` [PATCH v4 05/10] V4L: s5c73m3: Add device tree support Sylwester Nawrocki
2014-02-20 19:40   ` Sylwester Nawrocki
2014-02-20 19:40 ` [PATCH v4 06/10] exynos4-is: Use external s5k6a3 sensor driver Sylwester Nawrocki
2014-02-20 19:40   ` Sylwester Nawrocki
2014-02-20 19:40 ` [PATCH v4 07/10] exynos4-is: Add clock provider for the SCLK_CAM clock outputs Sylwester Nawrocki
2014-02-20 19:40   ` Sylwester Nawrocki
2014-02-21 16:05   ` Mark Rutland
2014-02-21 16:05     ` Mark Rutland
     [not found]     ` <20140221160504.GG20449-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2014-02-22 22:18       ` Sylwester Nawrocki
2014-02-22 22:18         ` Sylwester Nawrocki
2014-02-22 22:18         ` Sylwester Nawrocki
2014-02-20 19:40 ` [PATCH v4 08/10] exynos4-is: Add support for asynchronous subdevices registration Sylwester Nawrocki
2014-02-20 19:40   ` Sylwester Nawrocki
2014-02-20 19:40 ` [PATCH v4 09/10] ARM: dts: Add rear camera nodes for Exynos4412 TRATS2 board Sylwester Nawrocki
2014-02-20 19:40   ` Sylwester Nawrocki
2014-02-20 19:40 ` [PATCH v4 10/10] ARM: dts: exynos4: Update clk provider part of the camera subsystem Sylwester Nawrocki
2014-02-20 19:40   ` Sylwester Nawrocki

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=5309241B.5000702@gmail.com \
    --to=tomasz.figa@gmail.com \
    --cc=a.hajda@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=kgene.kim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sylvester.nawrocki@gmail.com \
    --cc=t.figa@samsung.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.