From: Hartmut Knaack <knaack.h-Mmb7MZpHnFY@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
ch.naveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
pawel.moll-5wv7dgnIgG8@public.gmane.org,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
heiko.stuebner-K3U4GQvHnyU@public.gmane.org,
Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
Subject: Re: [PATCH 1/2] iio: exynos-adc: add support for s3c64xx adc
Date: Sun, 20 Jul 2014 23:37:07 +0200 [thread overview]
Message-ID: <53CC3683.9090101@gmx.de> (raw)
In-Reply-To: <5186890.aLtladpMgD@wuerfel>
Arnd Bergmann schrieb:
> The ADC in s3c64xx is almost the same as exynosv1, but
> has a different 'select' method. Adding this here will be
> helpful to move over the existing s3c64xx platform from the
> legacy plat-samsung/adc driver to the new exynos-adc.
>
> Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> ---
There are some style issues, see the comments inline.
> [In reply to Exynos3250 ADC support, adding Heiko and Ben]
>
> I spent way too much time this week trying to clean up the
> old plat-samsung/adc.c driver as preparation for s3c64xx multiplatform
> support. Eventually I figured out that all that code is much simpler
> done using the new driver. This adds support for s3c64xx in
> samsung-adc.c, similar code changes can be done to support the
> various s3c24xx variants as well.
>
> This first patch should be fairly straightforward but is not tested
> yet. The second patch is more tricky.
>
> Both are based on the exynos3250 patches sent by Chanwoo Choi.
>
> diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
> index 26232f98d8c5..f84e9250429b 100644
> --- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
> +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
> @@ -11,11 +11,21 @@ New driver handles the following
>
> Required properties:
> - compatible: Must be "samsung,exynos-adc-v1"
> - for exynos4412/5250 controllers.
> + for exynos4412/5250 and s5pv210 controllers.
> Must be "samsung,exynos-adc-v2" for
> future controllers.
> Must be "samsung,exynos3250-adc-v2" for
> controllers compatible with ADC of Exynos3250.
> + Must be "samsung,s3c2410-adc" for
> + the ADC in s3c2410 and compatibles
> + Must be "samsung,s3c2416-adc" for
> + the ADC in s3c2416 and compatibles
> + Must be "samsung,s3c2440-adc" for
> + the ADC in s3c2440 and compatibles
> + Must be "samsung,s3c2440-adc" for
> + the ADC in s3c2440 and compatibles
> + Must be "samsung,s3c2443-adc" for
> + the ADC in s3c2443 and compatibles
> - reg: Contains ADC register address range (base address and
> length) and the address of the phy enable register.
> - interrupts: Contains the interrupt information for the timer. The
> diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
> index b63e88247eb2..5f95638513d2 100644
> --- a/drivers/iio/adc/exynos_adc.c
> +++ b/drivers/iio/adc/exynos_adc.c
> @@ -39,12 +39,16 @@
> #include <linux/iio/machine.h>
> #include <linux/iio/driver.h>
>
> -/* EXYNOS4412/5250 ADC_V1 registers definitions */
> +/* S3C/EXYNOS4412/5250 ADC_V1 registers definitions */
> #define ADC_V1_CON(x) ((x) + 0x00)
> +#define ADC_V1_TSC(x) ((x) + 0x04)
> #define ADC_V1_DLY(x) ((x) + 0x08)
> #define ADC_V1_DATX(x) ((x) + 0x0C)
> +#define ADC_V1_DATY(x) ((x) + 0x10)
> +#define ADC_V1_UPDN(x) ((x) + 0x14)
> #define ADC_V1_INTCLR(x) ((x) + 0x18)
> #define ADC_V1_MUX(x) ((x) + 0x1c)
> +#define ADC_V1_CLRINTPNDNUP(x) ((x) + 0x20)
>
> /* Future ADC_V2 registers definitions */
> #define ADC_V2_CON1(x) ((x) + 0x00)
> @@ -60,6 +64,30 @@
> #define ADC_V1_CON_PRSCLV(x) (((x) & 0xFF) << 6)
> #define ADC_V1_CON_STANDBY (1u << 2)
>
Leave a whitespace around operators below.
> +#define ADC_S3C2410_CON_SELMUX(x) (((x)&0x7)<<3)
> +
> +/* ADCTSC Register Bits */
> +#define ADC_S3C2443_TSC_UD_SEN (1<<8)
> +#define ADC_S3C2410_TSC_YM_SEN (1<<7)
> +#define ADC_S3C2410_TSC_YP_SEN (1<<6)
> +#define ADC_S3C2410_TSC_XM_SEN (1<<5)
> +#define ADC_S3C2410_TSC_XP_SEN (1<<4)
> +#define ADC_S3C2410_TSC_PULL_UP_DISABLE (1<<3)
> +#define ADC_S3C2410_TSC_AUTO_PST (1<<2)
> +#define ADC_S3C2410_TSC_XY_PST(x) (((x)&0x3)<<0)
> +
> +#define ADC_TSC_WAIT4INT (ADC_S3C2410_TSC_YM_SEN | \
> + ADC_S3C2410_TSC_YP_SEN | \
> + ADC_S3C2410_TSC_XP_SEN | \
> + ADC_S3C2410_TSC_XY_PST(3))
> +
> +#define ADC_TSC_AUTOPST (ADC_S3C2410_TSC_YM_SEN | \
> + ADC_S3C2410_TSC_YP_SEN | \
> + ADC_S3C2410_TSC_XP_SEN | \
> + ADC_S3C2410_TSC_AUTO_PST | \
> + ADC_S3C2410_TSC_XY_PST(0))
> +
> +
> /* Bit definitions for ADC_V2 */
> #define ADC_V2_CON1_SOFT_RESET (1u << 2)
>
> @@ -195,6 +223,26 @@ static void exynos_adc_v1_clear_irq(struct exynos_adc *info)
> writel(1, ADC_V1_INTCLR(info->regs));
> }
>
> +static void exynos_adc_s3c64xx_start_conv(struct exynos_adc *info,
> + unsigned long addr)
This indention could be a bit better.
> +{
> + u32 con1;
> +
> + con1 = readl(ADC_V1_CON(info->regs));
> + con1 &= ~ADC_S3C2410_CON_SELMUX(7);
> + con1 |= ADC_S3C2410_CON_SELMUX(addr);
> + writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs));
> +}
> +
> +static struct exynos_adc_data const exynos_adc_s3c64xx_data = {
> + .num_channels = MAX_ADC_V1_CHANNELS,
> +
> + .init_hw = exynos_adc_v1_init_hw,
> + .exit_hw = exynos_adc_v1_exit_hw,
> + .clear_irq = exynos_adc_v1_clear_irq,
> + .start_conv = exynos_adc_s3c64xx_start_conv,
> +};
> +
> static void exynos_adc_v1_start_conv(struct exynos_adc *info,
> unsigned long addr)
> {
> @@ -280,6 +328,9 @@ static struct exynos_adc_data const exynos3250_adc_v2_data = {
>
> static const struct of_device_id exynos_adc_match[] = {
> {
> + .compatible = "samsung,s3c64100-adc",
> + .data = &exynos_adc_s3c64xx_data,
> + }, {
> .compatible = "samsung,exynos-adc-v1",
> .data = (void *)&exynos_adc_v1_data,
> }, {
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2014-07-20 21:37 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
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 ` Hartmut Knaack [this message]
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=53CC3683.9090101@gmx.de \
--to=knaack.h-mmb7mzphnfy@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=ch.naveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=heiko.stuebner-K3U4GQvHnyU@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
/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).