public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Jean Delvare <khali@linux-fr.org>
Cc: lm-sensors@lm-sensors.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [lm-sensors] Simple fan question
Date: Fri, 30 Apr 2010 08:56:46 +1000	[thread overview]
Message-ID: <1272581806.24542.185.camel@pasglop> (raw)
In-Reply-To: <20100429105740.6e3b7716@hyperion.delvare>

Hi Jean !

> In your case, the file would have only 3 possible values, with "off"
> mapping to 0, and "slow" and "fast" mapping to arbitrary positive
> values, like 64 and 192 or whatever you think is suitable. I understand
> that in your case, you don't really control the PWM output directly,
> but we do not have any interface for this, and I don't think there
> would be much value in adding one.
> 
> That being said, I am also only mildly convinced that fitting your chip
> in the standard pwm1 interface will be very helpful. I don't really
> expect tools such as the fancontrol script to behave properly when the
> pwm1 file only support a small number of discrete values. So the
> benefit of using the standard file name and semantics seems thin.

Yes, I'm not too sure either.

> > Another comment while at it is when implementing the thermal control for
> > PowerMacs a while back (windfarm etc...) I had to deal with two
> > different type of interfaces to fans. RPM controlled and PWM controlled.
> > 
> > The later basically let me program a percentile value (a percent of the
> > duty cycle).
> 
> This is exactly what pwm[1-*] files are about, except that we used
> range 0-255 instead of 0-100 for historical and practical reasons.

Ok, I missed those in the doco.

> > I looks like the described sysfs interface only does RPM, or at least
> > doesn't provide a way to expose the units used...
> 
> For RPM-controlled, look at the following entry instead:
> 
> fan[1-*]_target
> 		Desired fan speed
> 		Unit: revolution/min (RPM)
> 		RW
> 		Only makes sense if the chip supports closed-loop fan speed
> 		control based on the measured fan speed.
> 
> One significant difference is that, in this case, you always know which
> fan you control, while in the pwm[1-*] case you don't.

Right.

Now, maybe the best option is to have instead:

	fan[1-*]_discrete_value
		Discrete value
                RW

	fan[1-*]_supported values
                List of supported discrete values
                RO

IE. I like the interface to be self-explanatory rather than relying on
the user to know in advance what to write there. In which case I could
either use 0,1,2 as values or even "off, slow, fast".

I can then make a custom fancontrol script (or add a wart to the
existing one) to deal with this HW.

What do you think ?

Another option of course is to do the whole thermal control in a kernel
thread :-) That wouldn't be very hard nor take a lot of code, but I'm
sure I'll encounter resistance trying to merge that :-)

Cheers,
Ben.


  reply	other threads:[~2010-04-30 17:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-29  5:21 Simple fan question Benjamin Herrenschmidt
2010-04-29  8:57 ` [lm-sensors] " Jean Delvare
2010-04-29 22:56   ` Benjamin Herrenschmidt [this message]
2010-05-06 16:40     ` Jean Delvare
2010-05-17  7:46     ` Pavel Machek
2010-05-17  8:14       ` Jean Delvare
2010-05-17  8:30         ` Benjamin Herrenschmidt
     [not found]     ` <AANLkTilRvyWK-SEp2pgVAosaJ8GQUbbXsP4BkZBxGphU@mail.gmail.com>
2010-05-20 11:57       ` 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=1272581806.24542.185.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox