From: Tomasz Figa <tomasz.figa@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>, Chanwoo Choi <cw00.choi@samsung.com>
Cc: Chanwoo Choi <cwchoi00@gmail.com>,
jic23@kernel.org, naveen krishna <ch.naveen@samsung.com>,
Kukjin Kim <kgene.kim@samsung.com>,
Rob Herring <robh+dt@kernel.org>,
pawel.moll@arm.com, Mark Rutland <mark.rutland@arm.com>,
ijc+devicetree@hellion.org.uk, Kumar Gala <galak@codeaurora.org>,
rdunlap@infradead.org, Kyungmin Park <kyungmin.park@samsung.com>,
Tomasz Figa <t.figa@samsung.com>,
linux-iio@vger.kernel.org,
linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
devicetree <devicetree@vger.kernel.org>,
linux-doc@vger.kernel.org
Subject: Re: [PATCHv6 3/4] iio: devicetree: Add DT binding documentation for Exynos3250 ADC
Date: Mon, 21 Jul 2014 12:38:55 +0200 [thread overview]
Message-ID: <53CCEDBF.7010300@gmail.com> (raw)
In-Reply-To: <7477106.gq1AqisQx4@wuerfel>
On 21.07.2014 10:00, Arnd Bergmann wrote:
> On Monday 21 July 2014 10:52:28 Chanwoo Choi wrote:
>>> Yes, your current version is certainly better than this, but another way
>>> to address Tomasz' comment would be to change the binding to list the "sclk"
>>> as optional for any device and make the code silently ignore missing sclk
>>> entries, like:
>>>
>>>
>>> info->sclk = devm_clk_get(&pdev->dev, "sclk");
>>> if (IS_ERR(info->sclk)) {
>>> switch (PTR_ERR(info->sclk)) {
>>> case -EPROBE_DEFER:
>>> /* silently return error so we can retry */
>>> return -EPROBE_DEFER:
>>> case -ENOENT:
>>> /* silently ignore missing optional clk */
>>> info->sclk = NULL;
>>> break;
>>> default:
>>> /* any other error: clk is defined by doesn't work */
>>> dev_err(&pdev->dev, "failed getting sclk clock, err = %ld\n",
>>> PTR_ERR(info->sclk));
>>> return PTR_ERR(info->sclk));
>>> }
>>> }
>>
>> I tested this patch suggested by you.
>> But, devm_clk_get returns always '-ENOENT' on follwong two cases:
>>
>> Case 1.
>> ADC dt node in exynos3250.dtsi don't include 'sclk' clock as following:
>>
>> adc: adc@126C0000 {
>> compatible = "samsung,exynos3250-adc";
>> reg = <0x126C0000 0x100>, <0x10020718 0x4>;
>> interrupts = <0 137 0>;
>> clock-names = "adc";
>> clocks = <&cmu CLK_TSADC>;
>> #io-channel-cells = <1>;
>> io-channel-ranges;
>> };
>>
>> Case 2.
>> ADC dt node in exynos3250.dtsi don't include 'sclk' clock
>> but, exynos3250 clock controller don't support CLK_SCLK_TSADC clock as following:
>>
>> adc: adc@126C0000 {
>> compatible = "samsung,exynos3250-adc";
>> reg = <0x126C0000 0x100>, <0x10020718 0x4>;
>> interrupts = <0 137 0>;
>> clock-names = "adc", "sclk";
>> clocks = <&cmu CLK_TSADC>, <&cmu CLK_SCLK_TSADC>;
>> #io-channel-cells = <1>;
>> io-channel-ranges;
>> };
>
> But neither of those cases is actually a correct DT representation for
> exynos3250: The first case describes an ADC that doesn't need a second
> clock, so if the hardware actually needs it to function, it is clearly
> unsufficiently described. The second case is even worse because it refers
> to a clock that isn't there. Actually that should probably return a different
> error code, but that's a different matter.
>
>> So, I think exynos-adc needs to use 'needs_sclk' field suggested by Tomasz Figa.
>
> I don't mind you adding a field to the data, especially since you already
> need to have separate structures to encode the different number of channels.
> However, I don't see it as necessary either. What you do here is just
> checking the DT representation for correctness and consistency. It's not
> harmful but we don't normally do that because passing incorrect DT blobs
> can cause an infinite number of other problems that we don't check for.
I believe we should be enforcing as much correctness on DT data as
possible without too much burden in the code. Otherwise how we are
supposed to know if an error is caused by wrong/missing data in DT, bug
in the driver or who knows else?
In this case making this clock required depending on compatible string
doesn't seem too bothersome to me.
Best regards,
Tomasz
next prev parent reply other threads:[~2014-07-21 10:38 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-18 5:59 [PATCHv6 0/4] iio: adc: exynos_adc: Support Exynos3250 ADC and code clean Chanwoo Choi
[not found] ` <1405663186-26464-1-git-send-email-cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-07-18 5:59 ` [PATCHv6 1/4] iio: adc: exynos_adc: Add exynos_adc_data structure to improve readability Chanwoo Choi
2014-07-18 9:42 ` Arnd Bergmann
2014-07-18 10:11 ` Naveen Krishna Ch
[not found] ` <CAHfPSqBDOEH5HurG=rECV=d+MM_YjTEpsiwuTgtNgFgCQ0P2bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-18 11:16 ` Arnd Bergmann
2014-07-18 5:59 ` [PATCHv6 2/4] iio: adc: exynos_adc: Control special clock of ADC to support Exynos3250 ADC Chanwoo Choi
2014-07-18 9:47 ` Arnd Bergmann
2014-07-18 10:00 ` Chanwoo Choi
2014-07-18 11:14 ` Arnd Bergmann
2014-07-18 15:15 ` Chanwoo Choi
2014-07-18 15:23 ` Arnd Bergmann
2014-07-18 16:11 ` Chanwoo Choi
2014-07-18 16:31 ` Arnd Bergmann
2014-07-18 16:48 ` Chanwoo Choi
2014-07-18 5:59 ` [PATCHv6 3/4] iio: devicetree: Add DT binding documentation for " Chanwoo Choi
2014-07-18 9:50 ` Arnd Bergmann
2014-07-18 16:23 ` Chanwoo Choi
2014-07-18 16:33 ` Arnd Bergmann
2014-07-18 17:02 ` Chanwoo Choi
[not found] ` <CAGTfZH3mnPJ72wi7aFYoChe_OeuRVsUVo3KGRRLTV5scwPbO4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-18 18:48 ` Arnd Bergmann
2014-07-21 1:52 ` Chanwoo Choi
2014-07-21 8:00 ` Arnd Bergmann
2014-07-21 10:38 ` Tomasz Figa [this message]
2014-07-21 10:47 ` Arnd Bergmann
2014-07-18 5:59 ` [PATCHv6 4/4] ARM: dts: Fix wrong compatible string " Chanwoo Choi
2014-07-18 9:38 ` [PATCHv6 0/4] iio: adc: exynos_adc: Support Exynos3250 ADC and code clean Arnd Bergmann
2014-07-18 10:13 ` Naveen Krishna Ch
[not found] ` <CAHfPSqBiDZXxSVaK3PHrGhDQxi4TU=szKA06Odm9yeB8a5rDFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-18 10:16 ` Naveen Krishna Ch
2014-07-18 19:27 ` [PATCH 1/2] iio: exynos-adc: add support for s3c64xx adc Arnd Bergmann
2014-07-18 19:29 ` [PATCH 2/2] iio: exynos-adc: add experimental touchscreen support Arnd Bergmann
2014-07-20 13:49 ` Jonathan Cameron
2014-07-20 13:51 ` Jonathan Cameron
2014-07-20 20:28 ` Dmitry Torokhov
2014-07-21 10:23 ` Arnd Bergmann
2014-07-21 10:26 ` Arnd Bergmann
2014-07-21 14:44 ` Dmitry Torokhov
2014-07-21 15:11 ` Arnd Bergmann
2014-07-21 16:19 ` Dmitry Torokhov
2014-07-20 21:37 ` Hartmut Knaack
2014-07-21 10:06 ` Arnd Bergmann
2014-07-20 21:37 ` [PATCH 1/2] iio: exynos-adc: add support for s3c64xx adc Hartmut Knaack
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=53CCEDBF.7010300@gmail.com \
--to=tomasz.figa@gmail.com \
--cc=arnd@arndb.de \
--cc=ch.naveen@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=cwchoi00@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jic23@kernel.org \
--cc=kgene.kim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=rdunlap@infradead.org \
--cc=robh+dt@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).