All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Chanwoo Choi <cw00.choi@samsung.com>,
	jic23@kernel.org, ch.naveen@samsung.com, kgene.kim@samsung.com,
	kyungmin.park@samsung.com, t.figa@samsung.com,
	linux-iio@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: adc: exynos_adc: Add support for S3C24xx ADC
Date: Tue, 22 Jul 2014 12:44:28 +0200	[thread overview]
Message-ID: <175757227.TPQdXAQiJt@diego> (raw)
In-Reply-To: <5200888.DXoC06U953@wuerfel>

Am Dienstag, 22. Juli 2014, 10:39:38 schrieb Arnd Bergmann:
> On Tuesday 22 July 2014 11:11:14 Chanwoo Choi wrote:
> > This patch add support for s3c2410/s3c2416/s3c2440/s3c2443 ADC. The
> > s3c24xx
> > is alomost same as ADCv1. But, There are a little difference as following:
> > - ADCMUX register address to select channel
> > - ADCDAT mask (10bit or 12bit ADC resolution according to SoC version)
> 
> Very good, thanks for doing this patch!
> 
> (adding Heiko to Cc, he's probably interested in seeing this as well.

indeed. Thanks for implementing this.

While trying to build a test setup for this, I noticed two points:

(1) I'm not sure what the second register (a "phy enable register" according
to the binding) is supposed to be.
According to binding and adc code it is mandatory, but I didn't find any
lone adc register in the s3c2416 manual.


(2) You might need something along the lines of:

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 11b048a..088c99a 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -129,7 +129,7 @@ config AT91_ADC
 
 config EXYNOS_ADC
        tristate "Exynos ADC driver support"
-       depends on ARCH_EXYNOS || (OF && COMPILE_TEST)
+       depends on ARCH_EXYNOS || ARCH_S3C24XX || ARCH_S3C64XX || (OF && COMPILE_TEST)
        help
          Core support for the ADC block found in the Samsung EXYNOS series
          of SoCs for drivers such as the touchscreen and hwmon to use to share


Thanks
Heiko

> 
> One comment:
> > @@ -101,12 +107,14 @@ struct exynos_adc {
> > 
> >  	struct completion	completion;
> >  	
> >  	u32			value;
> > 
> > +	u32			value2;
> > 
> >  	unsigned int            version;
> >  
> >  };
> > 
> > ...
> > @@ -365,7 +448,7 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
> > 
> >  		ret = -ETIMEDOUT;
> >  	
> >  	} else {
> >  	
> >  		*val = info->value;
> > 
> > -		*val2 = 0;
> > +		*val2 = info->value2;
> > 
> >  		ret = IIO_VAL_INT;
> >  	
> >  	}
> > 
> > @@ -377,9 +460,11 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
> > 
> >  static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
> >  {
> >  
> >  	struct exynos_adc *info = (struct exynos_adc *)dev_id;
> > 
> > +	u32 mask = info->data->mask;
> > 
> >  	/* Read value */
> > 
> > -	info->value = readl(ADC_V1_DATX(info->regs)) & ADC_DATX_MASK;
> > +	info->value = readl(ADC_V1_DATX(info->regs)) & mask;
> > +	info->value2 = readl(ADC_V1_DATY(info->regs)) & mask;
> > 
> >  	/* clear irq */
> >  	if (info->data->clear_irq)
> 
> If I understand it right, this would only be necessary if we want
> to do the touchscreen driver as a separate iio client using the
> in-kernel interfaces. As Jonathan Cameron commented, we probably
> don't want to do that though. Even if we do, it should be a separate
> patch and not mixed in with the s3c24xx support.
> 
> Aside from this:
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> 
> 	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] iio: adc: exynos_adc: Add support for S3C24xx ADC
Date: Tue, 22 Jul 2014 12:44:28 +0200	[thread overview]
Message-ID: <175757227.TPQdXAQiJt@diego> (raw)
In-Reply-To: <5200888.DXoC06U953@wuerfel>

Am Dienstag, 22. Juli 2014, 10:39:38 schrieb Arnd Bergmann:
> On Tuesday 22 July 2014 11:11:14 Chanwoo Choi wrote:
> > This patch add support for s3c2410/s3c2416/s3c2440/s3c2443 ADC. The
> > s3c24xx
> > is alomost same as ADCv1. But, There are a little difference as following:
> > - ADCMUX register address to select channel
> > - ADCDAT mask (10bit or 12bit ADC resolution according to SoC version)
> 
> Very good, thanks for doing this patch!
> 
> (adding Heiko to Cc, he's probably interested in seeing this as well.

indeed. Thanks for implementing this.

While trying to build a test setup for this, I noticed two points:

(1) I'm not sure what the second register (a "phy enable register" according
to the binding) is supposed to be.
According to binding and adc code it is mandatory, but I didn't find any
lone adc register in the s3c2416 manual.


(2) You might need something along the lines of:

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 11b048a..088c99a 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -129,7 +129,7 @@ config AT91_ADC
 
 config EXYNOS_ADC
        tristate "Exynos ADC driver support"
-       depends on ARCH_EXYNOS || (OF && COMPILE_TEST)
+       depends on ARCH_EXYNOS || ARCH_S3C24XX || ARCH_S3C64XX || (OF && COMPILE_TEST)
        help
          Core support for the ADC block found in the Samsung EXYNOS series
          of SoCs for drivers such as the touchscreen and hwmon to use to share


Thanks
Heiko

> 
> One comment:
> > @@ -101,12 +107,14 @@ struct exynos_adc {
> > 
> >  	struct completion	completion;
> >  	
> >  	u32			value;
> > 
> > +	u32			value2;
> > 
> >  	unsigned int            version;
> >  
> >  };
> > 
> > ...
> > @@ -365,7 +448,7 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
> > 
> >  		ret = -ETIMEDOUT;
> >  	
> >  	} else {
> >  	
> >  		*val = info->value;
> > 
> > -		*val2 = 0;
> > +		*val2 = info->value2;
> > 
> >  		ret = IIO_VAL_INT;
> >  	
> >  	}
> > 
> > @@ -377,9 +460,11 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
> > 
> >  static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
> >  {
> >  
> >  	struct exynos_adc *info = (struct exynos_adc *)dev_id;
> > 
> > +	u32 mask = info->data->mask;
> > 
> >  	/* Read value */
> > 
> > -	info->value = readl(ADC_V1_DATX(info->regs)) & ADC_DATX_MASK;
> > +	info->value = readl(ADC_V1_DATX(info->regs)) & mask;
> > +	info->value2 = readl(ADC_V1_DATY(info->regs)) & mask;
> > 
> >  	/* clear irq */
> >  	if (info->data->clear_irq)
> 
> If I understand it right, this would only be necessary if we want
> to do the touchscreen driver as a separate iio client using the
> in-kernel interfaces. As Jonathan Cameron commented, we probably
> don't want to do that though. Even if we do, it should be a separate
> patch and not mixed in with the s3c24xx support.
> 
> Aside from this:
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> 
> 	Arnd

  reply	other threads:[~2014-07-22 10:44 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-22  2:11 [PATCH 0/2] iio: adc: exynos_adc: Add support for s3c64xx/s3c24xx ADC Chanwoo Choi
2014-07-22  2:11 ` Chanwoo Choi
2014-07-22  2:11 ` Chanwoo Choi
2014-07-22  2:11 ` [PATCH 1/2] iio: adc: exynos_adc: add support for s3c64xx adc Chanwoo Choi
2014-07-22  2:11   ` Chanwoo Choi
2014-07-27 18:49   ` Hartmut Knaack
2014-07-27 18:49     ` Hartmut Knaack
2014-07-28 11:18     ` Chanwoo Choi
2014-07-28 11:18       ` Chanwoo Choi
2014-07-28 11:18       ` Chanwoo Choi
2014-07-22  2:11 ` [PATCH 2/2] iio: adc: exynos_adc: Add support for S3C24xx ADC Chanwoo Choi
2014-07-22  2:11   ` Chanwoo Choi
2014-07-22  8:39   ` Arnd Bergmann
2014-07-22  8:39     ` Arnd Bergmann
2014-07-22 10:44     ` Heiko Stübner [this message]
2014-07-22 10:44       ` Heiko Stübner
2014-07-28 12:08       ` Chanwoo Choi
2014-07-28 12:08         ` Chanwoo Choi
2014-07-28 11:20     ` Chanwoo Choi
2014-07-28 11:20       ` Chanwoo Choi
2014-07-22 12:59   ` Arnd Bergmann
2014-07-22 12:59     ` Arnd Bergmann
2014-07-28 11:18     ` Chanwoo Choi
2014-07-28 11:18       ` Chanwoo Choi
2014-07-28 11:18       ` Chanwoo Choi
2014-07-27 20:35   ` Hartmut Knaack
2014-07-27 20:35     ` Hartmut Knaack
2014-07-27 20:35     ` Hartmut Knaack
2014-07-28 11:03     ` Chanwoo Choi
2014-07-28 11:03       ` Chanwoo Choi
2014-07-28 11:03       ` Chanwoo Choi

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=175757227.TPQdXAQiJt@diego \
    --to=heiko@sntech.de \
    --cc=arnd@arndb.de \
    --cc=ch.naveen@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --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=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.