mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Jonathan Cameron <kernel@jic23.retrosnub.co.uk>
Cc: Jean Delvare <khali@linux-fr.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] hwmon: Driver for SMM665 Six-Channel Active DC Output Controller/Monitor
Date: Fri, 18 Jun 2010 13:56:53 -0700	[thread overview]
Message-ID: <1276894613.2631.535.camel@groeck-laptop> (raw)
In-Reply-To: <4C1BB2AC.4090308@jic23.retrosnub.co.uk>

[...]
> > +             /*
> > +              * Algorithm for reading ADC, per SMM665 datasheet
> > +              *
> > +              *  {[S][addr][W][Ack]} {[offset][Ack]} {[S][addr][R][Nack]}
> > +              * [wait 70 uS]
> > +              *  {[S][addr][R][Ack]} {[datahi][Ack]} {[datalo][Ack][P]}
> > +              *
> > +              * To implement the first part of this exchange,
> > +              * do a full read transaction and expect a failure/Nack.
> > +              * This sets up the address pointer on the SMM665
> > +              * and starts the ADC conversion.
> > +              * Then do a two-byte read transaction.
> > +              */
> Is there no better way of handling this? There are protocol mangling hacks
> to tell the i2c core to ignore a NAKs under some circumstances.
> 
> > +             rv = i2c_smbus_read_byte_data(client, adc << 3);
> > +             if (rv >= 0) {
> > +                     /* No error, something is wrong. Retry. */
> > +                     rv = -1;
> > +                     continue;
> > +             }

I looked through the core i2c code, but did not find anything I can
use. 

Problem is that per smm665 specification, the first NACK is expected. So
we do not just want to ignore this NACK, we want to actively check if
the command "failed" as expected, and report an error if it did _not_
fail.

Guenter



  parent reply	other threads:[~2010-06-18 20:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-18 16:06 [PATCH 0/3} " Guenter Roeck
2010-06-18 16:06 ` [PATCH 1/3] " Guenter Roeck
2010-06-18 17:53   ` Jonathan Cameron
2010-06-18 18:10     ` [lm-sensors] " Jonathan Cameron
2010-06-18 19:13       ` Guenter Roeck
2010-06-19  8:27         ` Jean Delvare
2010-06-19 10:08           ` Jonathan Cameron
2010-06-18 20:56     ` Guenter Roeck [this message]
2010-06-18 21:37       ` Jonathan Cameron
2010-06-18 21:54         ` Guenter Roeck
2010-06-19  8:23       ` Jean Delvare
2010-06-18 16:06 ` [PATCH 2/3] hwmon: SMM665 driver documentation Guenter Roeck
2010-06-18 16:06 ` [PATCH 3/3] hwmon: Update MAINTAINERS for smm665 driver Guenter Roeck

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=1276894613.2631.535.camel@groeck-laptop \
    --to=guenter.roeck@ericsson.com \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=hdegoede@redhat.com \
    --cc=kernel@jic23.retrosnub.co.uk \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.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

all inboxes | Powered by JetHome®