mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Samuel Ortiz <sameo@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH] mfd/mc13783: near complete rewrite
Date: Tue, 24 Nov 2009 22:44:52 +0100	[thread overview]
Message-ID: <20091124214452.GC21466@pengutronix.de> (raw)
In-Reply-To: <20091106002847.GC22366@sortiz.org>

Hi Samuel,

On Fri, Nov 06, 2009 at 01:28:50AM +0100, Samuel Ortiz wrote:
> On Fri, Nov 06, 2009 at 12:56:08AM +0100, Uwe Kleine-König wrote:
> > This fixes several things while still providing the old API:
> > 
> >  - simplify and fix locking
> >  - better error handling
> >  - don't ack all irqs making it impossible to detect a reset of the
> >    rtc
> >  - use a timeout variant to wait for completion of ADC conversion
> >  - provide platform-data to regulator subdevice (This allows making
> >    struct mc13783 opaque for other drivers after the regulator driver is
> >    updated to use its platform_data.)
> >  - expose all interrupts
> >  - use threaded irq
> Thanks Uwe, patch applied to my for-next branch.

I now worked on the touch interface for the mc13783 and found some
non-critical but non-nice things in the mc13783_adc_do_conversion
function.

If it looks OK for you, can you please squash the patch below into the
original commit?  I think the changes are not worth to be mentioned in
the commit log.

Intensions are:
 - Request and ack irq before provoking the next to behave if there was
   already an ADCDONE irq pending.

 - restore TSMOD only after conversions are read out

 - assert return value is 0 or -E...

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13783-core.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/mc13783-core.c b/drivers/mfd/mc13783-core.c
index 99267ed..dc1add0 100644
--- a/drivers/mfd/mc13783-core.c
+++ b/drivers/mfd/mc13783-core.c
@@ -483,12 +483,13 @@ int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
 		return -EINVAL;
 	}
 
-	mc13783_reg_write(mc13783, MC13783_REG_ADC_0, adc0);
-	mc13783_reg_write(mc13783, MC13783_REG_ADC_1, adc1);
-
 	dev_dbg(&mc13783->spidev->dev, "%s: request irq\n", __func__);
 	mc13783_irq_request(mc13783, MC13783_IRQ_ADCDONE,
 			mc13783_handler_adcdone, __func__, &adcdone_data);
+	mc13783_ackirq(mc13783, MC13783_IRQ_ADCDONE);
+
+	mc13783_reg_write(mc13783, MC13783_REG_ADC_0, adc0);
+	mc13783_reg_write(mc13783, MC13783_REG_ADC_1, adc1);
 
 	mc13783_unlock(mc13783);
 
@@ -501,15 +502,18 @@ int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
 
 	mc13783_irq_free(mc13783, MC13783_IRQ_ADCDONE, &adcdone_data);
 
+	if (ret > 0)
+		for (i = 0; i < 4; ++i) {
+			ret = mc13783_reg_read(mc13783,
+					MC13783_REG_ADC_2, &sample[i]);
+			if (ret)
+				break;
+		}
+
 	if (mode == MC13783_ADC_MODE_TS)
 		/* restore TSMOD */
 		mc13783_reg_write(mc13783, MC13783_REG_ADC_0, old_adc0);
 
-	if (ret > 0)
-		for (i = 0; i < 4; ++i)
-			mc13783_reg_read(mc13783,
-					MC13783_REG_ADC_2, &sample[i]);
-
 	mc13783->flags &= ~MC13783_ADC_WORKING;
 out:
 	mc13783_unlock(mc13783);
-- 
1.6.5.2


-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

  parent reply	other threads:[~2009-11-24 21:44 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-23 20:38 Uwe Kleine-König
2009-10-24  8:35 ` [PATCH] [RTC] Add Freescale MC13783 RTC driver Uwe Kleine-König
2009-11-01 20:34   ` Uwe Kleine-König
2009-11-04 18:12     ` Valentin Longchamp
2009-11-05 15:06       ` Valentin Longchamp
2009-11-10  8:32         ` [PATCH RESENT] " Uwe Kleine-König
2009-11-10  9:30           ` Alessandro Zummo
2009-11-10 11:10             ` Uwe Kleine-König
2009-11-22 21:49               ` Uwe Kleine-König
2009-11-03 19:20   ` [PATCH] " Uwe Kleine-König
2009-11-01 21:06 ` [PATCH] mfd/mc13783: near complete rewrite Uwe Kleine-König
2009-11-02 11:51 ` Mark Brown
2009-11-02 13:58   ` Uwe Kleine-König
2009-11-02 14:09     ` Mark Brown
2009-11-02 14:32       ` Uwe Kleine-König
2009-11-02 15:12         ` Mark Brown
2009-11-02 20:56   ` [PATCH] mfd/mc13783: change type of irq handlers to irq_handler_t Uwe Kleine-König
2009-11-03 19:31     ` [PATCH] mfd/mc13783: near complete rewrite Uwe Kleine-König
2009-11-04 18:35       ` Samuel Ortiz
2009-11-04 22:28         ` Uwe Kleine-König
2009-11-05 22:31           ` Samuel Ortiz
2009-11-05 23:53             ` Uwe Kleine-König
2009-11-05 23:56               ` Uwe Kleine-König
2009-11-06  0:28                 ` Samuel Ortiz
2009-11-10  8:18                   ` [PATCH 1/2] regulator/mc13783: rename source file to match other drivers Uwe Kleine-König
2009-11-10  8:18                     ` [PATCH 2/2] regulator/mc13783: various cleanups Uwe Kleine-König
2009-11-10 13:08                       ` Mark Brown
2009-11-11 14:11                       ` Liam Girdwood
2009-11-11 14:16                         ` Uwe Kleine-König
2009-11-11 14:30                           ` Liam Girdwood
2009-11-10 11:44                     ` [PATCH 1/2] regulator/mc13783: rename source file to match other drivers Mark Brown
2009-11-11 14:09                     ` Liam Girdwood
2009-11-24 21:44                   ` Uwe Kleine-König [this message]
2009-11-24 23:26                     ` [PATCH] mfd/mc13783: near complete rewrite Samuel Ortiz
2009-12-02 18:54                       ` Uwe Kleine-König

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=20091124214452.GC21466@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sameo@linux.intel.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

all inboxes | Powered by JetHome®