This patch makes the needlessly global fan_mutex static.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
Add support to sysfs to the wan and bluetooth subdrivers.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>