From: David Brownell <david-b@pacbell.net>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH RESEND] hwmon: lm70: TI TMP121 support.
Date: Fri, 24 Oct 2008 09:21:51 +0000 [thread overview]
Message-ID: <200810240221.51305.david-b@pacbell.net> (raw)
In-Reply-To: <20081022080423.GB11169@roarinelk.homelinux.net>
On Friday 24 October 2008, Kaiwan N Billimoria wrote:
> On Thu, 2008-10-23 at 11:37 -0700, David Brownell wrote:
> > Right, but afaik the lm70 code was only
> > tested with drivers/spi/spi_lm70llp.c and
> > that has a byte order handling bug.
> >
> > Kaiwan Billimoria is the only person I
> > know who could test fixes to the LM70
> > and LM70LLP support ... Kaiwan, could
> > you give that a try?
> >
> > - Dave
> >
> Sure Dave.
> Pl point me to the latest patch(es) and help in clarifying what
> exactly the bug is; been a while... :-)
>
> And of course, if you already have a fix i'll test it on the lm70llp
> board.
I suspect the following should do the job ... it has
the parport based adapter leave the data in MSB-first
byte order, with the lm70 driver converting to CPU
byte order. (In a way that will match the TMP121/123
support.)
- Dave
---
drivers/hwmon/lm70.c | 4 +++-
drivers/spi/spi_lm70llp.c | 19 +++----------------
2 files changed, 6 insertions(+), 17 deletions(-)
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -67,7 +67,7 @@ static ssize_t lm70_sense_temp(struct de
}
dev_dbg(dev, "rxbuf[1] : 0x%x rxbuf[0] : 0x%x\n", rxbuf[1], rxbuf[0]);
- raw = (rxbuf[1] << 8) + rxbuf[0];
+ raw = (rxbuf[0] << 8) + rxbuf[1];
dev_dbg(dev, "raw=0x%x\n", raw);
/*
@@ -109,6 +109,8 @@ static int __devinit lm70_probe(struct s
if ((spi->mode & (SPI_CPOL|SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
return -EINVAL;
+ /* NOTE: we assume 8-bit words, and convert to 16 bits manually */
+
p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL);
if (!p_lm70)
return -ENOMEM;
--- a/drivers/spi/spi_lm70llp.c
+++ b/drivers/spi/spi_lm70llp.c
@@ -173,6 +173,8 @@ static void lm70_chipselect(struct spi_d
{
struct spi_lm70llp *pp = spidev_to_pp(spi);
+ /* REVISIT initialize the clock polarity ... */
+
if (value)
assertCS(pp);
else
@@ -184,22 +186,7 @@ static void lm70_chipselect(struct spi_d
*/
static u32 lm70_txrx(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits)
{
- static u32 sio=0;
- static int first_time=1;
-
- /* First time: perform SPI bitbang and return the LSB of
- * the result of the SPI call.
- */
- if (first_time) {
- sio = bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits);
- first_time=0;
- return (sio & 0x00ff);
- }
- /* Return the MSB of the result of the SPI call */
- else {
- first_time=1;
- return (sio >> 8);
- }
+ return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits);
}
static void spi_lm70llp_attach(struct parport *p)
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2008-10-24 9:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-22 8:04 [lm-sensors] [PATCH RESEND] hwmon: lm70: TI TMP121 support Manuel Lauss
2008-10-23 12:57 ` Jean Delvare
2008-10-23 13:13 ` Manuel Lauss
2008-10-23 13:20 ` Jean Delvare
2008-10-23 13:30 ` Manuel Lauss
2008-10-23 14:00 ` Manuel Lauss
2008-10-23 16:53 ` David Brownell
2008-10-23 17:09 ` Jean Delvare
2008-10-23 17:46 ` David Brownell
2008-10-23 17:53 ` Jean Delvare
2008-10-23 18:37 ` David Brownell
2008-10-24 8:26 ` Kaiwan N Billimoria
2008-10-24 9:21 ` David Brownell [this message]
2008-10-24 14:04 ` Kaiwan N Billimoria
2008-10-28 8:04 ` Kaiwan N Billimoria
2008-10-28 10:43 ` David Brownell
2008-10-30 6:44 ` Kaiwan N Billimoria
2008-10-30 6:49 ` David Brownell
2008-11-11 6:59 ` Kaiwan N Billimoria
2008-11-12 7:49 ` Kaiwan N Billimoria
2008-11-12 20:39 ` Jean Delvare
2008-11-12 22:06 ` Manuel Lauss
2008-11-13 10:05 ` Jean Delvare
2008-11-13 11:54 ` Manuel Lauss
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=200810240221.51305.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=lm-sensors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.