From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Jonathan Cameron <kernel@jic23.retrosnub.co.uk>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
Hans de Goede <hdegoede@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [lm-sensors] [PATCH 1/3] hwmon: Driver for SMM665 Six-Channel Active DC Output Controller/Monitor
Date: Fri, 18 Jun 2010 14:54:08 -0700 [thread overview]
Message-ID: <1276898048.2631.544.camel@groeck-laptop> (raw)
In-Reply-To: <4C1BE722.3000006@jic23.retrosnub.co.uk>
On Fri, 2010-06-18 at 17:37 -0400, Jonathan Cameron wrote:
> On 06/18/10 21:56, Guenter Roeck wrote:
> > [...]
> >>> + /*
> >>> + * 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
> To my mind this looks like a case for adding another 'mangling' flag
> to the core, but I guess that might require bus driver implementation
> which would obviously be a pain. Perhaps the approach you have taken
> is the best plan. My issue with it at the moment is that you are
> detecting any error rather than specifically an unexpected NACK.
Yes, but looking through bus implementations, I don't think there is a
consistent way to detect the exact error reason. How about if I weed out
-EOPNOTSUPP, -ETIMEDOUT, and -EINVAL ?
Guenter
next prev parent reply other threads:[~2010-06-18 21:55 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
2010-06-18 21:37 ` [lm-sensors] " Jonathan Cameron
2010-06-18 21:54 ` Guenter Roeck [this message]
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=1276898048.2631.544.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=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®