public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] CBUS: A workaround for ADC S/H HW bug: always keep ch 8 selected when S/H is used
@ 2008-06-30 13:28 Mikko Ylinen
  2008-07-03 10:20 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Mikko Ylinen @ 2008-06-30 13:28 UTC (permalink / raw)
  To: linux-omap

Signed-off-by: Mikko Ylinen <mikko.k.ylinen@nokia.com>
---
 drivers/cbus/retu.c |   12 ++++++++++++
 drivers/cbus/retu.h |    1 +
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 715b88d..4849841 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -114,9 +114,21 @@ int retu_read_adc(int channel)
 		return -EINVAL;
 
 	spin_lock_irqsave(&retu_lock, flags);
+
+	if ((channel == 8) && retu_is_vilma) {
+		int scr = retu_read_reg(RETU_REG_ADCSCR);
+		int ch = (retu_read_reg(RETU_REG_ADCR) >> 10) & 0xf;
+		if (((scr & 0xff) != 0) && (ch != 8))
+			retu_write_reg (RETU_REG_ADCSCR, (scr & ~0xff));
+	}
+
 	/* Select the channel and read result */
 	retu_write_reg(RETU_REG_ADCR, channel << 10);
 	res = retu_read_reg(RETU_REG_ADCR) & 0x3ff;
+
+	if (retu_is_vilma)
+		retu_write_reg(RETU_REG_ADCR, (1 << 13));
+
 	/* Unlock retu */
 	spin_unlock_irqrestore(&retu_lock, flags);
 
diff --git a/drivers/cbus/retu.h b/drivers/cbus/retu.h
index 49f23e6..c9e044c 100644
--- a/drivers/cbus/retu.h
+++ b/drivers/cbus/retu.h
@@ -34,6 +34,7 @@
 #define RETU_REG_RTCHMAR	0x05	/* RTC hours and minutes alarm and time set register */
 #define RETU_REG_RTCCALR	0x06	/* RTC calibration register */
 #define RETU_REG_ADCR		0x08	/* ADC result */
+#define RETU_REG_ADCSCR		0x09	/* ADC sample ctrl */
 #define RETU_REG_CC1		0x0d	/* Common control register 1 */
 #define RETU_REG_CC2		0x0e	/* Common control register 2 */
 #define RETU_REG_CTRL_CLR	0x0f	/* Regulator clear register */
-- 
1.5.5.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] CBUS: A workaround for ADC S/H HW bug: always keep ch 8 selected when S/H is used
  2008-06-30 13:28 [PATCH] CBUS: A workaround for ADC S/H HW bug: always keep ch 8 selected when S/H is used Mikko Ylinen
@ 2008-07-03 10:20 ` Tony Lindgren
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2008-07-03 10:20 UTC (permalink / raw)
  To: Mikko Ylinen; +Cc: linux-omap

* Mikko Ylinen <mikko.k.ylinen@nokia.com> [080630 16:34]:

Pushing today.

Tony

> Signed-off-by: Mikko Ylinen <mikko.k.ylinen@nokia.com>
> ---
>  drivers/cbus/retu.c |   12 ++++++++++++
>  drivers/cbus/retu.h |    1 +
>  2 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
> index 715b88d..4849841 100644
> --- a/drivers/cbus/retu.c
> +++ b/drivers/cbus/retu.c
> @@ -114,9 +114,21 @@ int retu_read_adc(int channel)
>  		return -EINVAL;
>  
>  	spin_lock_irqsave(&retu_lock, flags);
> +
> +	if ((channel == 8) && retu_is_vilma) {
> +		int scr = retu_read_reg(RETU_REG_ADCSCR);
> +		int ch = (retu_read_reg(RETU_REG_ADCR) >> 10) & 0xf;
> +		if (((scr & 0xff) != 0) && (ch != 8))
> +			retu_write_reg (RETU_REG_ADCSCR, (scr & ~0xff));
> +	}
> +
>  	/* Select the channel and read result */
>  	retu_write_reg(RETU_REG_ADCR, channel << 10);
>  	res = retu_read_reg(RETU_REG_ADCR) & 0x3ff;
> +
> +	if (retu_is_vilma)
> +		retu_write_reg(RETU_REG_ADCR, (1 << 13));
> +
>  	/* Unlock retu */
>  	spin_unlock_irqrestore(&retu_lock, flags);
>  
> diff --git a/drivers/cbus/retu.h b/drivers/cbus/retu.h
> index 49f23e6..c9e044c 100644
> --- a/drivers/cbus/retu.h
> +++ b/drivers/cbus/retu.h
> @@ -34,6 +34,7 @@
>  #define RETU_REG_RTCHMAR	0x05	/* RTC hours and minutes alarm and time set register */
>  #define RETU_REG_RTCCALR	0x06	/* RTC calibration register */
>  #define RETU_REG_ADCR		0x08	/* ADC result */
> +#define RETU_REG_ADCSCR		0x09	/* ADC sample ctrl */
>  #define RETU_REG_CC1		0x0d	/* Common control register 1 */
>  #define RETU_REG_CC2		0x0e	/* Common control register 2 */
>  #define RETU_REG_CTRL_CLR	0x0f	/* Regulator clear register */
> -- 
> 1.5.5.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-03 12:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-30 13:28 [PATCH] CBUS: A workaround for ADC S/H HW bug: always keep ch 8 selected when S/H is used Mikko Ylinen
2008-07-03 10:20 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox