devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
	kgene.kim@samsung.com, pawel.moll@arm.com,
	ijc+devicetree@hellion.org.uk, linux-iio@vger.kernel.org,
	t.figa@samsung.com, rdunlap@infradead.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	robh+dt@kernel.org, Chanwoo Choi <cw00.choi@samsung.com>,
	kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org,
	galak@codeaurora.org, ch.naveen@samsung.com, jic23@kernel.org
Subject: Re: [PATCHv6 2/4] iio: adc: exynos_adc: Control special clock of ADC to support Exynos3250 ADC
Date: Fri, 18 Jul 2014 11:47:42 +0200	[thread overview]
Message-ID: <6485839.CnzmD0SeQj@wuerfel> (raw)
In-Reply-To: <1405663186-26464-3-git-send-email-cw00.choi@samsung.com>

On Friday 18 July 2014 14:59:44 Chanwoo Choi wrote:
> This patch control special clock for ADC in Exynos series's FSYS block.
> If special clock of ADC is registerd on clock list of common clk framework,
> Exynos ADC drvier have to control this clock.
> 
> Exynos3250/Exynos4/Exynos5 has 'adc' clock as following:
> - 'adc' clock: bus clock for ADC
> 
> Exynos3250 has additional 'sclk_adc' clock as following:
> - 'sclk_adc' clock: special clock for ADC which provide clock to internal ADC
> 
> Exynos 4210/4212/4412 and Exynos5250/5420 has not included 'sclk_adc' clock
> in FSYS_BLK. But, Exynos3250 based on Cortex-A7 has only included 'sclk_adc'
> clock in FSYS_BLK.

Do you know if any of the older ADC blocks have an "sclk" input as well?

Further, why is it called "sclk_adc" rather than just "sclk"?

> @@ -199,13 +262,20 @@ static void exynos_adc_v2_start_conv(struct exynos_adc *info,
>         writel(con1 | ADC_CON_EN_START, ADC_V2_CON1(info->regs));
>  }
>  
> +#define __EXYNOS_ADC_V2_DATA                           \
> +       .num_channels   = MAX_ADC_V2_CHANNELS,          \
> +       .init_hw        = exynos_adc_v2_init_hw,        \
> +       .exit_hw        = exynos_adc_v2_exit_hw,        \
> +       .clear_irq      = exynos_adc_v2_clear_irq,      \
> +       .start_conv     = exynos_adc_v2_start_conv,     \
> +
>  static struct exynos_adc_data const exynos_adc_v2_data = {
> -       .num_channels   = MAX_ADC_V2_CHANNELS,
> +       __EXYNOS_ADC_V2_DATA
> +};
>  
> -       .init_hw        = exynos_adc_v2_init_hw,
> -       .exit_hw        = exynos_adc_v2_exit_hw,
> -       .clear_irq      = exynos_adc_v2_clear_irq,
> -       .start_conv     = exynos_adc_v2_start_conv,
> +static struct exynos_adc_data const exynos3250_adc_v2_data = {
> +       __EXYNOS_ADC_V2_DATA
> +       .needs_sclk = true,
>  };

I think the macro hurts readability. Please just duplicate the definition
here.

>  static const struct of_device_id exynos_adc_match[] = {
> @@ -215,6 +285,9 @@ static const struct of_device_id exynos_adc_match[] = {
>         }, {
>                 .compatible = "samsung,exynos-adc-v2",
>                 .data = (void *)&exynos_adc_v2_data,
> +       }, {
> +               .compatible = "samsung,exynos3250-adc-v2",
> +               .data = (void *)&exynos3250_adc_v2_data,
>         },
>         {},

Remove the '(void *)' cast here and mark the structure as 'const'.
We intentionally use a 'const void *' type here to verify that
the driver doesn't modify the per-device type data at runtime,
which would be bad if you ever have multiple device instances.

	Arnd

  reply	other threads:[~2014-07-18  9:47 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 [this message]
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
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=6485839.CnzmD0SeQj@wuerfel \
    --to=arnd@arndb.de \
    --cc=ch.naveen@samsung.com \
    --cc=cw00.choi@samsung.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).