From: Guenter Roeck <linux@roeck-us.net>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] hwmon: Driver for Maxim MAX31790
Date: Mon, 03 Aug 2015 18:36:38 +0000 [thread overview]
Message-ID: <55BFB4B6.5060203@roeck-us.net> (raw)
In-Reply-To: <1438195783-26978-1-git-send-email-corone.il.han@gmail.com>
On 08/03/2015 10:49 AM, Il Han wrote:
> Hi,
>
> Thank you for your review.
> I am modifying the driver on your advice.
> I am going to commit it soon again.
> I also added the comments below.
>
Please don't top-post.
Comments inline.
Thanks,
Guenter
[ ... ]
> Given that the sr range is 3 bit, an array would be simpler.
>
> static const u8 sr[8] = { 1, 2, 4, 8, 16, 32, 32, 32 };
>
> u8 get_speed_range(u8 fan_dynamics)
> {
> return sr[MAX31790_FAN_DYNAMICS_SR(fan_dynamics)];
> }
>
>
> OK.
>
>
> It might be useful to report the configured speed range
> as fanX_div, and make it configurable.
>
>
> But it's not a divisor.
> So I added fanX_period so that it is configurable, instead of the fanX_div.
>
... which is not a standard attribute and thus not acceptable. Maybe we need
to determine how to map the value from one to another in a meaningful way.
> You use direct values for everything but the pulse count. Might as well just use '2'
> for that as well. It is quite useless, though, since
> (2 * (data->tach[attr->index] >> 5))
> is identical to
> (data->tach[attr->index] >> 4)
> which you might as well use directly.
>
>
> But, isn't there a case that the number of tachometer pulse per revolution is not 2?
>
See Documentation/hwmon/sysfs-interface.
>
> Valid range for pwmX is 0..255. Please report this range and adjust
> reported / configured values accordingly.
>
>
> In this chip, the range for PWM is 0..511. (9 bits of the PWMOUT Target Duty Cycle register.)
>
Again, see Documentation/hwmon/sysfs-interface. You have to stick with the ABI
and adjust internally. Make the sysfs attribute 0..255 and write, for example,
(written value * 2) into the chip.
> +
> +static const struct i2c_device_id max31790_id[] = {
> + { "max31790", max31790 },
>
>
> You don't use the 'max31790' in the probe function (nor would there be
> a reason to do so).
>
>
> I'm sorry. I don't understand what you've said.
> I refered to source code of many other drivers to understand it.
> But I didn't catch that.
> Could you let me know what you mean?
>
Drivers which don't support more than one chip just have something like
static const struct i2c_device_id max31790_id[] = {
{ "max31790", 0 },
{ }
};
> Doesn't it register the device with the name, client->name?
>
Sure, but that doesn't mean you need the enum (which you don't use anyway).
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2015-08-03 18:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-29 18:49 [lm-sensors] [PATCH] hwmon: Driver for Maxim MAX31790 Il Han
2015-07-30 2:41 ` Guenter Roeck
2015-08-03 18:36 ` Guenter Roeck [this message]
2015-08-04 7:07 ` Il Han
2015-08-06 3:48 ` Guenter Roeck
2015-08-10 15:48 ` Il Han
2015-08-17 11:31 ` Il Han
2015-08-18 3:22 ` Guenter Roeck
2015-08-23 14:01 ` Il Han
2015-08-23 15:02 ` Guenter Roeck
2015-08-25 5:52 ` Il Han
2015-08-25 14:52 ` Guenter Roeck
2015-08-26 3:49 ` Il Han
2015-08-26 4:15 ` Guenter Roeck
2015-08-26 4:27 ` Il Han
2015-08-30 11:44 ` Il Han
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=55BFB4B6.5060203@roeck-us.net \
--to=linux@roeck-us.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.