From: Borislav Petkov <petkovbb@googlemail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Feuerer <peter@piie.net>, Len Brown <len.brown@intel.com>,
Matthew Garrett <mjg59@srcf.ucam.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Request driver inclusion - acer aspire one fan control
Date: Thu, 4 Jun 2009 12:38:42 +0200 [thread overview]
Message-ID: <9ea470500906040338w1dfc191dhb53477b6327c714d@mail.gmail.com> (raw)
In-Reply-To: <20090604010250.a168f07f.akpm@linux-foundation.org>
Hi,
On Thu, Jun 4, 2009 at 10:02 AM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Wed, 3 Jun 2009 23:24:01 +0200 Peter Feuerer <peter@piie.net> wrote:
>
>> Acerhdf is a driver for Acer Aspire One netbooks. It allows to access
>> the temperature sensor and to control the fan.
>>
>> Signed-off-by: Peter Feuerer <peter@piie.net>
>> Reviewed-by: Borislav Petkov <petkovbb@gmail.com>
>> Tested-by: Borislav Petkov <petkovbb@gmail.com>
>>
>>
>> ...
>>
>> +/*
>> + * if you want the module to be started in kernel mode,
>> + * define the following:
>> + */
>> +#undef START_IN_KERNEL_MODE
>
> What does this mean?
when you boot the machine, the BIOS controlls the fan and it, noisy as
it is, gets turned on at temperatures around 35-40°C. However, you can
push that triggering point a bit higher when the machine is idle so that
you don't get annoyed by the noisy fan. Actually, this is what this
driver does.
The current design is that the driver gets loaded but still doesn't
control the fan, as a precaution measure - we trust the BIOS (We didn't
want to kill any user's machine through overheating.) If you turn on the
START_IN_KERNEL_MODE, you circumvent that and the driver takes over the
fan upon module load (I guess this is what you meant). Alternatively,
you can do that over sysfs.
> afacit this functionality is already there at runtime via the
> module/boot parameter, so we don't need the compile-time knob?
>
>> +#define VERSION "0.5.5"
>
> That must be a record version number for an initial submission :)
:)
>> +/*
>> + * According to the Atom N270 datasheet,
>> + * (http://download.intel.com/design/processor/datashts/320032.pdf) the
>> + * CPU's optimal operating limits denoted in junction temperature as
>> + * measured by the on-die thermal monitor are within 0 <= Tj <= 90. So,
>> + * assume 89__C is critical temperature.
>> + */
>> +#define ACERHDF_TEMP_CRIT 89
>> +#define ACERHDF_FAN_AUTO 1
>> +#define ACERHDF_FAN_OFF 0
>> +
>> +/*
>> + * No matter what value the user puts into the fanon variable, turn on the fan
>> + * at 80 degree Celsius to prevent hardware damage
>> + */
>> +#define ACERHDF_MAX_FANON 80
>> +
>> +/*
>> + * Maximal interval between to temperature checks is 20 seconds, as the die
>> + * can get hot really fast under heavy load
>> + */
>> +#define ACERHDF_MAX_INTERVAL 20
>> +
>> +#define ACERHDF_ERROR -0xffff
>
> Gad. I had to write a C program to check that. 0xffff0001. I wonder
> if the compiler treats this as a signed or unsigned thing.
it should be signed int.
> Can this be simplified?
This was supposed to be a random invalid value, I guess something like
#define ACERHDF_ERROR ~0
@Peter: Also, acerhdf_set_cur_state() needs a fix around
+ if (state == 0) {
+ /* turn fan off only if below fanoff temperature */
+ if ((cur_state == ACERHDF_FAN_AUTO) &&
+ (acerhdf_get_temp() < fanoff))
since acerhdf_get_temp() returns the temp _or_ and error. The cleaner
thing should be if acerhdf_get_temp() returned the temp over a pointer
arg just like the thermal callbacks do (e.g. acerhdf_get_ec_temp()) and
you check the return value first and then interpret the temperature as
valid.
>> +
>> +
>> +#ifdef START_IN_KERNEL_MODE
>> +static int kernelmode = 1;
>> +#else
>> +static int kernelmode;
>> +#endif
>> +
>> +static unsigned int interval = 10;
>> +static unsigned int fanon = 63;
>> +static unsigned int fanoff = 58;
>> +static unsigned int verbose;
>> +static unsigned int fanstate = ACERHDF_FAN_AUTO;
>> +static int disable_kernelmode;
>> +static int bios_version = -1;
>> +static char force_bios[16];
>> +static unsigned int prev_interval;
>> +struct thermal_zone_device *acerhdf_thz_dev;
>> +struct thermal_cooling_device *acerhdf_cool_dev;
>> +struct platform_device *acerhdf_device;
>> +
>> +module_param(kernelmode, uint, 0);
>> +MODULE_PARM_DESC(kernelmode, "Kernel mode on / off");
>
> What's kernel mode? This should be explained in the code somewhere so
> I'm the last to ask.
see above.
>>
>> ...
>>
>> +MODULE_LICENSE("GPL");
>> +MODULE_AUTHOR("Peter Feuerer");
>> +MODULE_DESCRIPTION("Aspire One temperature and fan driver");
>> +MODULE_ALIAS("dmi:*:*Acer*:*:");
>> +MODULE_ALIAS("dmi:*:*Gateway*:*:");
>> +MODULE_ALIAS("dmi:*:*Packard Bell*:*:");
>
> It's a nice-looking driver.
hope this is not irony :).
--
Regards/Gruss,
Boris
next prev parent reply other threads:[~2009-06-04 10:38 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-03 9:10 Peter Feuerer
2009-06-03 12:14 ` Borislav Petkov
2009-06-03 21:24 ` Peter Feuerer
2009-06-04 8:02 ` Andrew Morton
2009-06-04 10:38 ` Borislav Petkov [this message]
2009-06-04 19:11 ` Peter Feuerer
2009-06-07 12:03 ` Andreas Mohr
2009-06-12 14:37 ` [PATCH/RFC] Acer Aspire One fan control resume fix, improvements Andreas Mohr
2009-06-12 15:37 ` Borislav Petkov
2009-06-15 17:15 ` Peter Feuerer
2009-06-16 6:01 ` Borislav Petkov
2009-06-16 11:47 ` Ed Tomlinson
2009-06-16 20:57 ` Andreas Mohr
2009-06-16 22:14 ` [PATCH] Request driver inclusion - acer aspire one fan control Peter Feuerer
2009-06-16 22:34 ` Randy Dunlap
2009-06-17 12:20 ` Andreas Mohr
2009-06-18 7:10 ` Peter Feuerer
2009-06-18 10:29 ` Borislav Petkov
2009-06-18 10:55 ` Peter Feuerer
2009-06-18 11:42 ` Borislav Petkov
2009-06-18 11:49 ` Peter Feuerer
2009-06-18 12:45 ` Borislav Petkov
2009-06-18 13:25 ` Andreas Mohr
2009-06-19 17:01 ` [PATCH v0.5.10] " Peter Feuerer
2009-06-18 13:31 ` [PATCH] " Peter Feuerer
2009-06-18 13:54 ` Andreas Mohr
2009-06-18 14:05 ` Peter Feuerer
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=9ea470500906040338w1dfc191dhb53477b6327c714d@mail.gmail.com \
--to=petkovbb@googlemail.com \
--cc=akpm@linux-foundation.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=peter@piie.net \
/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
all inboxes | Powered by JetHome®