From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mfd: fixed mixed up ADC single channel readout
Date: Thu, 24 Nov 2011 15:40:22 +0100 [thread overview]
Message-ID: <20111124144022.GA19986@pengutronix.de> (raw)
In-Reply-To: <1322132295-7511-1-git-send-email-robin@protonic.nl>
On Thu, Nov 24, 2011 at 11:58:15AM +0100, Robin van der Gracht wrote:
> In single channel mode, when reading the ADC result, the index value
> is still set to the channel selected for this reading.
> This mixes up the order of the values returned. This causes problems when
> the converted results are made available in pairs (i.e. battery current reading)
> To straighten this up, the index value needs to be reset, so that the
> converted values are read at the assigned channel.
>
> Signed-off-by: Robin van der Gracht <robin@protonic.nl>
> ---
> drivers/mfd/mc13xxx-core.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
> index e6bb4b3..3582f15 100644
> --- a/drivers/mfd/mc13xxx-core.c
> +++ b/drivers/mfd/mc13xxx-core.c
> @@ -650,6 +650,10 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode,
>
> mc13xxx_lock(mc13xxx);
>
> + mc13xxx_reg_read(mc13xxx, MC13XXX_ADC1, &adc1);
> + adc1 &= ~(0x7 << MC13XXX_ADC1_CHAN0_SHIFT);
> + mc13xxx_reg_write(mc13xxx, MC13XXX_ADC1, adc1);
> +
I didn't completely understood what is exact the problem, but I wonder
if you don't also need 0x7 << MC13XXX_ADC1_CHAN1_SHIFT.
Best regards
Uwe
> mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_ADCDONE, &adcdone_data);
>
> if (ret > 0)
> --
> 1.7.4.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
prev parent reply other threads:[~2011-11-24 14:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-24 10:58 [PATCH] mfd: fixed mixed up ADC single channel readout Robin van der Gracht
2011-11-24 14:40 ` Uwe Kleine-König [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=20111124144022.GA19986@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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).