All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ken Milmore <ken@kenm.demon.co.uk>
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] Andigilog asc7621 driver: Temperature scaling
Date: Sun, 07 Mar 2010 02:13:07 +0000	[thread overview]
Message-ID: <4B930BB3.6030201@kenm.demon.co.uk> (raw)

Hi George et al,

Its great to see the aSC7621 driver being resurrected, but I notice in 
the patches flying about recently (see LKML 22 Feb 2010 in particular) 
that the voltage calculation is a bit off, as I already pointed out in a 
previous review.  To get the correct results, it is much easier to use 
the 3/4 scale values given in the data sheet, and also be careful to do 
the multiplication before the division to avoid loss of precision (Hint: 
The BSD version of the driver does it correctly!).

See below:


static int asc7621_in_scaling[] = {
     2500, 2250, 3300, 5000, 12000
};


For the 10-bit voltage registers, do something like this:

long regval      (data->reg[param->msb[0]] << 8) |
     (data->reg[param->lsb[0]]);
regval = (regval >> 6) * asc7621_in_scaling[index] / (192 << 2);


And for the 8-bit registers:

long regval = data->reg[param->msb[0]];
regval = regval * asc7621_in_scaling[index] / 192;


I've not yet checked the code thoroughly to look for any of the other 
fixes which were put in during our previous discussions, but I suspect 
that some of the other minor fixes which were discussed on the mailing 
list may have been left out.

This was a very ambitious driver in that it included all the fancy 
thermal management features of the aSC7621, and a complete review and 
testing of everything in the driver was a lot more than I had the 
stomach for.  I'm glad to see others have now picked it up though!

Best wishes,

Ken.


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

             reply	other threads:[~2010-03-07  2:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-07  2:13 Ken Milmore [this message]
2010-03-07  7:53 ` [lm-sensors] Andigilog asc7621 driver: Temperature scaling Jean Delvare
2010-03-07 10:20 ` Ken Milmore
2010-03-07 10:44 ` Jean Delvare
2010-03-07 11:30 ` Ken Milmore
2010-03-07 12:10 ` Jean Delvare
2010-03-07 14:57 ` Ken Milmore
2010-03-17  7:39 ` Jean Delvare
2010-04-28 12:32 ` Jean Delvare

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=4B930BB3.6030201@kenm.demon.co.uk \
    --to=ken@kenm.demon.co.uk \
    --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.