All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] hwmon: Add a driver for the ADT7475
Date: Sat, 20 Dec 2008 08:16:46 +0000	[thread overview]
Message-ID: <494CA9EE.2000000@redhat.com> (raw)
In-Reply-To: <20080610194818.GA21150@cosmic.amd.com>



Matt Roberds wrote:
> On Fri, 19 Dec 2008, Hans de Goede wrote:
>> * converted to the new i2c driver style
> 
> I suspect this is what is causing the failure to compile on my old
> kernel (2.6.18), and right now I don't have time to try it against a
> newer kernel.
> 

Yes, you need atleast a 2.6.27 kernel for the new style.

> I did take a quick look through the patch and I do have a question about
> find_nearest().  Sometimes it returns an array index (if the query is
> less than the lowest data value in the array, or if the query is in the
> middle of the data values in the array), and sometimes it returns a data
> value (if the query is higher than the highest data value in the array).
> Looking at what happens next after find_nearest() is called, I think it
> should always return an array index.
> 
> In other words, in find_nearest(), this:
> 
> if (val > array[size - 1])
>   return array[size - 1];
> 
> should be this:
> 
> if (val > array[size - 1])
>   return size - 1;
> 

Correct, good catch!

> Also, when find_nearest() is used against autorange_table, the low 4
> bits of the return value are used.  Since autorange_table has 16
> entries, this is probably OK.  But when find_nearest is used against
> pwmfreq_table, only the low 2 bits of the return value are used.
> pwmfreq_table has 8 entries; should the low 3 bits of the return value
> be used instead?
> 
> In other words, in set_pwmfreq(), should this:
> 
> data->range[sattr->index] &= ~3;
> data->range[sattr->index] |= out & 0x03;
> 
> be something like this:
> 
> data->range[sattr->index] &= ~0x07;
> data->range[sattr->index] |= out & 0x07;
> 
> Maybe this is just how the hardware works, but I figured I would mention
> it.

Hmm, another good catch, lemme check the datasheet ... You are right there are 
3 frequency bits (the 3 least significant bits) in the range register so the 
mask should be 7 not 3. New version coming up!

Regards,

Hans

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

  parent reply	other threads:[~2008-12-20  8:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-10 19:48 [lm-sensors] [PATCH] hwmon: Add a driver for the ADT7475 thermal Jordan Crouse
2008-06-13  7:10 ` [lm-sensors] [PATCH] hwmon: Add a driver for the ADT7475 Matt Roberds
2008-08-07 20:56 ` Hans de Goede
2008-09-05 20:54 ` [lm-sensors] [PATCH] hwmon: Add a driver for the ADT7475 thermal Jordan Crouse
2008-09-06 10:00 ` [lm-sensors] [PATCH] hwmon: Add a driver for the ADT7475 Hans de Goede
2008-12-19 21:31 ` [lm-sensors] [PATCH] hwmon: Add a driver for the ADT7475 thermal Hans de Goede
2008-12-19 21:32 ` Hans de Goede
2008-12-19 23:46 ` [lm-sensors] [PATCH] hwmon: Add a driver for the ADT7475 Matt Roberds
2008-12-20  8:16 ` Hans de Goede [this message]
2008-12-20  8:22 ` [lm-sensors] [PATCH] hwmon: Add a driver for the ADT7475 thermal Hans de Goede
2008-12-22 23:23 ` [lm-sensors] [PATCH] hwmon: Add a driver for the ADT7475 Jordan Crouse
2008-12-23 18:38 ` Matt Roberds
2009-01-04 17:57 ` Daimonos Tereutes
2009-01-07 21:52 ` Jean Delvare
2009-01-08  7:56 ` Hans de Goede

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=494CA9EE.2000000@redhat.com \
    --to=hdegoede@redhat.com \
    --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.