From: Roland Stigge <stigge@antcom.de>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [Patch] hwmon: (max6639) Set Pulse per revolution loop for both channels
Date: Tue, 21 Feb 2012 08:41:21 +0000 [thread overview]
Message-ID: <4F4358B1.2010606@antcom.de> (raw)
In-Reply-To: <CAO7tRnjoSKUKoL4445e+Gud7Dhe=K9K1MYnGNCYcBs-d4X2O6A@mail.gmail.com>
Hi,
On 02/21/2012 12:57 AM, Guenter Roeck wrote:
> Patch #3 under the same headline .. unless I lost count :-(. I actually did
> miss the original patch (thinking it was a reply), and only caught this one
> since I wondered why you acked the other patch twice.
>
> What is wrong with the original calculation ?
The original speed/RPM calculation included data->ppr in a wrong way. I
also needed to re-read the datasheet. See also "Table 7,
RPM-to-Tachometer Count Relationship Examples" and the printed formula
where the actual PPR value is removed from by "selected number of pulses
per revolution / actual fan pulses".
>>> -#define FAN_FROM_REG(val, div, rpm_range) ((val) = 0 ? -1 : \
>>> - (val) = 255 ? 0 : (rpm_ranges[rpm_range] * 30) / ((div + 1) * (val)))
>>> +#define FAN_FROM_REG(val, rpm_range) ((val) = 0 ? -1 : \
>>> + (val) = 255 ? 0 : (rpm_ranges[rpm_range] * 30) / val)
>>> #define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT((val) / 1000, 0, 255)
>>>
>>> /*
>>> @@ -333,7 +333,7 @@ static ssize_t show_fan_input(struct dev
>>> return PTR_ERR(data);
>>>
>>> return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[attr->index],
>>> - data->ppr, data->rpm_range));
>>> + data->rpm_range));
>
> This is a bit problematic. Always was, actually. If val=0 it returns a fan speed of -1,
> which does not make much sense. It should either return 0, or some kind of error.
Agreed!
Roland
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
prev parent reply other threads:[~2012-02-21 8:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-12 3:00 [lm-sensors] [Patch] hwmon: (max6639) Set Pulse per revolution loop for both channels Chris
2012-02-12 9:30 ` Jean Delvare
2012-02-13 5:53 ` Chris
2012-02-13 5:56 ` Chris
2012-02-16 21:18 ` Jean Delvare
2012-02-16 21:29 ` Jean Delvare
2012-02-20 17:39 ` Guenter Roeck
2012-02-20 18:58 ` Roland Stigge
2012-02-20 21:58 ` Chris
2012-02-20 21:59 ` Chris
2012-02-20 22:14 ` Chris
2012-02-20 22:28 ` Guenter Roeck
2012-02-20 22:31 ` Guenter Roeck
2012-02-20 22:44 ` Chris
2012-02-20 22:53 ` Roland Stigge
2012-02-20 22:56 ` Roland Stigge
2012-02-20 23:06 ` Roland Stigge
2012-02-20 23:53 ` Guenter Roeck
2012-02-20 23:57 ` Guenter Roeck
2012-02-20 23:58 ` Guenter Roeck
2012-02-21 8:40 ` Roland Stigge
2012-02-21 8:41 ` Roland Stigge [this message]
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=4F4358B1.2010606@antcom.de \
--to=stigge@antcom.de \
--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.