Commit Graph

117 Commits (ecf2a80a97b3d38ae008fa8a3cb98cd540ac1eae)

Author SHA1 Message Date
Henrique de Moraes Holschuh ecf2a80a97 ACPI: thinkpad-acpi: add a fan-control feature master toggle
Len Brown considers that an active by default fan control interface in
laptops may be too close to giving users enough rope.  There is a good
chance he is quite correct on this, especially if someone decides to use
that interface in applets and users are not aware of its risks.

This patch adds a master switch to thinkpad-acpi that enables or disables
the entire fan-control feature as a module parameter: "fan_control".  It
defaults to disabled.  Set it to non-zero to enable fan control.

Also, the patch removes the expermiental status from fan control, since it
is stable enough to not be called experimental, and the master switch makes
it safe enough to do so.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-28 21:41:14 -04:00
Henrique de Moraes Holschuh 7d5a015eec ACPI: thinkpad-acpi: update brightness sysfs interface support
Update the brightness sysfs interface (done through the backlight class) to
be in line with the rest of the thinkpad-acpi driver.

This renames the incorrect, un-obvious, and clash-prone name of "ibm" for
the backlight device to a much more fitting and descriptive
"thinkpad_screen".  This is something I wanted to do for quite a while...

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-25 02:00:27 -04:00
Henrique de Moraes Holschuh b616004c70 ACPI: thinkpad-acpi: add sysfs support to the cmos command subdriver
Add sysfs attributes to send ThinkPad CMOS commands.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-25 02:00:27 -04:00
Henrique de Moraes Holschuh eaa7571b2d ACPI: thinkpad-acpi: add a safety net for TPEC fan control mode
The Linux ThinkPad community is not positive that all ThinkPads that do
HFSP EC fan control do implement full-speed and auto modes, some of the
earlier ones supporting HFSP might not.

If the EC ignores the AUTO or FULL-SPEED bits, it will pay attention to the
lower three bits that set the fan level.  And as thinkpad-acpi was leaving
these set to zero, it would stop(!) the fan, which is Not A Good Thing.

So, as a safety net, we now make sure to also set the fan level part of the
HFSP register to speed 7 for full-speed, and a minimum of speed 4 for auto
mode.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-25 02:00:27 -04:00
Henrique de Moraes Holschuh fe98a52ce7 ACPI: thinkpad-acpi: add sysfs support to fan subdriver
Export sysfs attributes to monitor and control the internal thinkpad fan
(some thinkpads have more than one fan, but thinkpad-acpi doesn't support
the second fan yet).  The sysfs interface follows the hwmon design guide
for fan devices.

Also, fix some stray "thermal" files in the fan procfs description that
have been there forever, and officially support "full-speed" as the name
for the PWM-disabled state of the fan controller to keep it in line with
the hwmon interface.  It is much better a name for that mode than the
unobvious "disengaged" anyway.  Change the procfs interface to also accept
full-speed as a fan level, but still report it as disengaged for backwards
compatibility.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-25 02:00:27 -04:00
Henrique de Moraes Holschuh 2c37aa4e22 ACPI: thinkpad-acpi: add sysfs support to the thermal subdriver
Export thinkpad thermal sensors to sysfs, following the hwmon
specification for thermal monitoring sensors.

ThinkPad thermal monitoring is done by the EC.  Sensors can show up or
disappear at runtime when they are inside hotswappable hardware, such as
batteries.  Sensors that are not available return -ENXIO when accessed.

Up to 16 thermal sensors are supported on new firmware (but nobody has
reported a ThinkPad with more than 12 sensors so far), and 8 sensors are
supported on older firmware.  Thermal sensor mapping is model-specific.
Precision varies, it is 1 degree Celcius on new ThinkPads, but higher on
some older models.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-25 02:00:27 -04:00
Henrique de Moraes Holschuh 40ca9fdf8a ACPI: thinkpad-acpi: protect fan and hotkey data structures
Add proper mutex locking to some data structures access subject to races
due to concurrent access of driver functions on the hotkey and fan
subdrivers.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-25 02:00:27 -04:00
Henrique de Moraes Holschuh 7252374a39 ACPI: thinkpad-acpi: add infrastructure for the sysfs device attributes
Add infrastructure to deal with sysfs attributes and grouping, and helpers
for common sysfs parsing.  Switch driver attributes to use them.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-25 02:00:27 -04:00
Henrique de Moraes Holschuh 176750d688 ACPI: thinkpad-acpi: driver sysfs conversion
Add the sysfs attributes for the platform driver.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-25 02:00:27 -04:00
Henrique de Moraes Holschuh 54ae15014c ACPI: thinkpad-acpi: register with the device model
Register thinkpad-acpi platform driver and platform device for the device
model.  Also register the platform device with the hwmon class.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-25 02:00:27 -04:00
Henrique de Moraes Holschuh 99fba3f817 ACPI: thinkpad-acpi: improve fan watchdog messages
Improve some of the fan watchdog error messages to be a little more
helpful.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh 04cc862c18 ACPI: thinkpad-acpi: cleanup thermal subdriver for sysfs conversion
Clean-up the thermal subdriver for sysfs conversion.  Make thermal_get_*
reentrancy-safe while at it, and add the missing thermal_read_mode variable
to the header file.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh c9bea99c1a ACPI: thinkpad-acpi: clean up CMOS commands subdriver
Some ThinkPad CMOS commands subdriver cleanups, and also rename/promote
cmos_eval to a ACPI helper function, as it is used by many other
subdrivers.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh 83f3472464 ACPI: thinkpad-acpi: cleanup video subdriver
Cleanup video subdriver for sysfs conversion, and properly check
result status of acpi_evalf.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh d6fdd1e91a ACPI: thinkpad-acpi: cleanup bluetooth and wan for sysfs conversion
Prepare bluetooth and wan driver code to be more easily hooked into sysfs
helpers, by separating the procfs logic from the device attribute handling.

These changes also remove the entries from procfs on notebooks without the
bluetooth/wan hardware installed.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh b86c4722de ACPI: thinkpad-acpi: clean up hotkey subdriver
Cleanup hotkey subdriver code.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh d01320e606 ACPI: thinkpad-acpi: mark acpi helper functions __must_check
Mark acpi_evalf and friends __must_check.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh 8d376cd654 ACPI: thinkpad-acpi: prepare for device model conversion
Prepare the thinkpad-acpi driver for the conversion to the device
model, by renaming variables and doing other glue work that shall
make the later patches much cleaner.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh d8fd94d9f0 ACPI: thinkpad-acpi: use bitfields for module flags
Use a bitfield to hold boolean module-wide flags, to conserve some memory.
It is easy and it is clean, so we do it just for the heck of it even if it
saves very little space.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh 9264117792 ACPI: thinkpad-acpi: use bitfields to hold subdriver flags
Save some memory by using bitfields to hold boolean flags for the
subdrivers.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh 0dcef77c5b ACPI: thinkpad-acpi: improve thinkpad detection
Improve the detection of ThinkPads, so as to reduce the chances of false
positives.

Since this could potentially add false negatives on the very old models,
add a module parameter to force the detection of a thinkpad.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:34 -04:00
Henrique de Moraes Holschuh a5763f2223 ACPI: thinkpad-acpi: uncouple subdriver init from ibms struct
Move the .init method from ibms struct to another struct, and use a list
head to control which subdrivers have been activated.

This allows us to have the subdriver init methods marked __init, saving
quite a lot of .text size, and even a bit of .data size as some data can
now be made __initdata.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:33 -04:00
Henrique de Moraes Holschuh fe08bc4b4f ACPI: thinkpad-acpi: add subdriver debug statements
Add debug messages to the subdriver initialization and exit code.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:33 -04:00
Henrique de Moraes Holschuh 5fba344cfd ACPI: thinkpad-acpi: clean up probing and move init to subdrivers
Move most of the probing code to its own function, and most of the
subdriver-specific init code into subdriver init functions.

This allows us to not define pci_handle unless the dock subdriver is
enabled, as well.

This patch causes a minor userland interface change: if a subdriver doesn't
detect a capability, /proc entries for it are not created anymore (as
opposed to a /proc entry that just returned "unsupported").

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:33 -04:00
Henrique de Moraes Holschuh 132ce09123 ACPI: thinkpad-acpi: add debug mode
Add a debug mode parameter and verbose debug mode Kconfig option.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:33 -04:00
Henrique de Moraes Holschuh f51d1a3984 ACPI: thinkpad-acpi: update fan firmware documentation
Update some stuff in the in-code text describing the ThinkPad fan
firmware.  This patch has no code changes.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:33 -04:00
Henrique de Moraes Holschuh efa27145df ACPI: thinkpad-acpi: rename thinkpad constants
Rename all IBMACPI_ constants, now that we are not called ibm-acpi anymore.
Driver-specific constants are now prefixed TPACPI_, ThinkPad firmware
specific ones are now prefixed TP_CMOS_, TP_ACPI_, or TP_EC_.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:33 -04:00
Henrique de Moraes Holschuh 1def7115f0 ACPI: thinkpad-acpi: rename module glue
Rename module init and exit functions, now that we are not called ibm-acpi
anymore.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:33 -04:00
Henrique de Moraes Holschuh 142cfc90f0 ACPI: thinkpad-acpi: rename one stray use of ibm-acpi in a comment
Rename a stray use of ibm-acpi on a comment, no functional changes.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:33 -04:00
Henrique de Moraes Holschuh 6700121b53 ACPI: thinkpad-acpi: rename register_ibmacpi_subdriver
Rename register_ibmacpi_subdriver to register_tpacpi_subdriver, as
we are not called ibmacpi anymore.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-04-21 23:30:32 -04:00
Henrique de Moraes Holschuh 643f12dbb6 ACPI: thinkpad-acpi: cleanup after rename
Cleanup documentation, driver strings and other misc stuff, now that the
driver is named "thinkpad-acpi".

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-30 15:35:42 -04:00
Henrique de Moraes Holschuh d903ac5455 ACPI: thinkpad-acpi: add compatibility MODULE_ALIAS entry
Add a ibm_acpi module alias for userpace, so that modprobe ibm_acpi will
still load the correct driver.  This alias can be removed in the future,
probably two years from now if nothing warrants removing it sooner.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-30 15:35:42 -04:00
Henrique de Moraes Holschuh 85998248b2 ACPI: thinkpad-acpi: cleanup Kconfig for thinkpad-acpi
Since ibm-acpi was renamed to thinkpad-acpi, rename and update its Kconfig
entries and Kconfig-related symbols accordingly.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-30 15:35:42 -04:00
Henrique de Moraes Holschuh f21f85de4b ACPI: ibm-acpi: rename driver to thinkpad-acpi
Rename the ibm-acpi driver to thinkpad-acpi.  ThinkPads are not even made
by IBM anymore, so it is high time to rename the driver...

The name thinkpad-acpi was used sometime ago by a thinkpad-specific hotkey
driver by Erik Rigtorp, around the 2.6.8-2.6.10 time frame.  The driver
apparently never got merged into mainline (it did make some trips through
-mm).  ibm-acpi was merged soon after, making its debut in 2.6.10.

The reuse of the thinkpad-acpi name shouldn't be a problem as far as user
confusion goes, as Erik's thinkpad-acpi apparently didn't get widespread
use in the Linux ThinkPad community and most hits for thinkpad-acpi in
google point to ibm-acpi anyway.

Erik, if you read this, please consider the reuse of the thinkpad-acpi name
as a compliment to your effort to make ThinkPads more useful to all of us.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-30 15:35:41 -04:00
Henrique de Moraes Holschuh 3ede41c718 ACPI: ibm-acpi: move driver to drivers/misc hierarchy
ibm-acpi is not an ACPICA driver, so move it to drivers/misc as per Len
Brown's request.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-25 23:37:55 -04:00
Adrian Bunk f110ef58e6 asus-laptop: make code static
This patch makes some needlessly global code static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 21:06:40 -05:00
Andrew Morton 8607c673bd sony-laptop: fix uninitialised variable
drivers/misc/sony-laptop.c: In function 'sony_acpi_add':
drivers/misc/sony-laptop.c:456: warning: 'result' may be used uninitialized in this function

The compiler seems to actually be telling the truth this time.

Cc: Mattia Dongili <malattia@linux.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-07 03:05:13 -05:00
Richard Purdie 599a52d126 backlight: Separate backlight properties from backlight ops pointers
Per device data such as brightness belongs to the indivdual device
and should therefore be separate from the the backlight operation
function pointers. This patch splits the two types of data and
allows simplifcation of some code.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
2007-02-20 09:26:53 +00:00
Richard Purdie 321709c599 backlight: Clean up pmac_backlight handling
Move the setting/unsetting of pmac_backlight into the
backlight core instead of doing it in each driver.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
2007-02-20 09:26:40 +00:00
Richard Purdie 28ee086d5b backlight: Fix external uses of backlight internal semaphore
backlight_device->sem has a very specific use as documented in the
header file. The external users of this are using it for a different
reason, to serialise access to the update_status() method.

backlight users were supposed to implement their own internal
serialisation of update_status() if needed but everyone is doing
things differently and incorrectly. Therefore add a global mutex to
take care of serialisation for everyone, once and for all.

Locking for get_brightness remains optional since most users don't
need it.

Also update the lcd class in a similar way.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
2007-02-20 08:38:45 +00:00
Richard Purdie dfcba20067 backlight: Remove unneeded owner field
Remove uneeded owner field from backlight_properties structure.

Nothing uses it and it is unlikely that it will ever be used. The
backlight class uses other means to ensure that nothing references
unloaded code.

Based on a patch from Dmitry Torokhov <dtor@insightbb.com>

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
2007-02-20 08:37:40 +00:00
Len Brown 8800c0ebf5 Pull remove-hotkey into release branch 2007-02-16 22:11:02 -05:00
Len Brown 9cdd79c9b9 Pull sony into release branch 2007-02-16 22:10:55 -05:00
Len Brown 5ee6edbcde ACPI: hotkey: remove driver, per feature-removal-schedule.txt
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-16 21:45:57 -05:00
Thomas Gleixner 38515e908b [PATCH] Scheduled removal of SA_xxx interrupt flags fixups
The obsolete SA_xxx interrupt flags have been used despite the scheduled
removal.  Fixup the remaining users.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Greg KH <greg@kroah.com>
Cc: Dave Airlie <airlied@linux.ie>
Cc: James Simmons <jsimmons@infradead.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-14 08:09:54 -08:00
Mattia Dongili 156c221b72 sony-laptop: allow complex per-value input/output validation
Replace sony_acpi_value.{min,max} with a callback function that allows
more complex reasoning in accepting input and presenting output.

This allows consistency between the sony-laptop specific 'brightness_default'
and the backlight subsystem 0-based 'brightness'.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-13 03:08:04 -05:00
Mattia Dongili ab5bd20696 sony-laptop: Update docs
Update documentation to be consistent with current implementation
(backlight subsys and platform_device).

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-13 03:07:27 -05:00
Len Brown a02d1c1d2a sony-laptop: Lindent
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-13 03:07:20 -05:00
Mattia Dongili d78865cdb0 sony-laptop: Group functions and structures to better draw subsytems usage
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-13 03:07:13 -05:00
Mattia Dongili 287ddfd522 sony-laptop: Small update to the Kconfig help to make people believe this driver is useful.
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-13 03:07:07 -05:00