History log of /drivers/platform/x86/thinkpad_acpi.c
Revision Date Author Comments
23b0531641c72c6a2f410af1c593293fa353884b 10-Mar-2012 Manoj Iyer <manoj.iyer@canonical.com> thinkpad-acpi: recognize Lenovo as version string in newer V-series BIOS

The newer V series bios reports product version as 'Lenovo'
instead of 'ThinkPad'. Recoginze this new string so that
the module can load.

Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Tested-by: James Ferguson <james.ferguson@canonical.com>
Tested-by: Dennis Chua <dennis.chua@canonical.com>
Tested-by: Ike Pan <ike.pan@canonical.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
90ab5ee94171b3e28de6bb42ee30b527014e0be7 13-Jan-2012 Rusty Russell <rusty@rustcorp.com.au> module_param: make bool parameters really bool (drivers & misc)

module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option. For this version
it'll simply give a warning, but it'll break next kernel version.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
d161a13f974c72fd7ff0069d39a3ae57cb5694ff 24-Jul-2011 Al Viro <viro@zeniv.linux.org.uk> switch procfs to umode_t use

both proc_dir_entry ->mode and populating functions

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8a32c441c1609f80e55df75422324a1151208f40 21-Nov-2011 Tejun Heo <tj@kernel.org> freezer: implement and use kthread_freezable_should_stop()

Writeback and thinkpad_acpi have been using thaw_process() to prevent
deadlock between the freezer and kthread_stop(); unfortunately, this
is inherently racy - nothing prevents freezing from happening between
thaw_process() and kthread_stop().

This patch implements kthread_freezable_should_stop() which enters
refrigerator if necessary but is guaranteed to return if
kthread_stop() is invoked. Both thaw_process() users are converted to
use the new function.

Note that this deadlock condition exists for many of freezable
kthreads. They need to be converted to use the new should_stop or
freezable workqueue.

Tested with synthetic test case.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Oleg Nesterov <oleg@redhat.com>
1f01358cec0e4ea40cda00cee7c6a209bc82cc8d 06-Oct-2011 Paul Bolle <pebolle@tiscali.nl> thinkpad_acpi: Fix printk typo 'bluestooth'

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
33009557bd9397c446a59e4cc91059a8e84c046b 24-May-2011 Andy Lutomirski <luto@MIT.EDU> Add KEY_MICMUTE and enable it on Lenovo X220

I suspect that this works on T410.

Signed-off-by: Andy Lutomirski <luto@mit.edu>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
a50245af782ea85b1d5ad23e1015e0ac52996b27 05-Jun-2011 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: handle HKEY 0x4010, 0x4011 events

Handle events 0x4010 and 0x4011 so that we do not pester users about them.

These events report when the thinkpad is docked/undocked to a native
hotplug dock (i.e. one that does not need ACPI handling, nor is represented
in the ACPI device tree). Such docks are based on USB 2.0/3.0, and also
work as port replicators.

We really want a proper dock class to report these, or at least new input
EV_SW events. Since it is not clear which one to use yet, keep reporting
them as vendor-specific ThinkPad events.

WARNING: As defined by the thinkpad-acpi sysfs ABI rules of engagement, the
vendor-specific events will be REMOVED as soon as generic events are made
available (duplicate events are a big problem), with an appropriate update
to the thinkpad-acpi sysfs/event ABI versioning. Userspace is already
prepared to provide easy backwards compatibility for such changes when
convenient to the distro (see acpi-fakekey).

* Event 0x4010: docking to hotplug dock/port replicator
* Event 0x4011: undocking from hotplug dock/port replicator

Typical usecase would be to trigger display reconfiguration.

Reports mention T410, T510, and series 3 docks/port replicators. Special
thanks to Robert de Rooy for his extensive report and analysis of the
situation.

http://www.thinkwiki.org/wiki/ThinkPad_Port_Replicator_Series_3
http://www.thinkwiki.org/wiki/ThinkPad_Mini_Dock_Series_3
http://www.thinkwiki.org/wiki/ThinkPad_Mini_Dock_Plus_Series_3
http://www.thinkwiki.org/wiki/ThinkPad_Mini_Dock_Plus_Series_3_for_Mobile_Workstations
http://lenovoblogs.com/insidethebox/?p=290

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Reported-by: Claudius Hubig <claudiushubig@chubig.net>
Reported-by: Doctor Bill <docbill@gmail.com>
Reported-by: Korte Noack <gbk.noack@gmx.de>
Reported-by: Robert de Rooy <robert.de.rooy@gmail.com>
Reported-by: Sebastian Will <swill@csail.mit.edu>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2d43f671c8fb0fd72e896a8b31e15b98916f707d 05-Jun-2011 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: handle some new HKEY 0x60xx events

Handle some user interface events from the newer Lenovo models. We are likely
to do something smart with these events in the future, for now, hide the ones
we are already certain about from the user and userspace both.

* Events 0x6000 and 0x6005 are key-related. 0x6005 is not properly identified
yet. Ignore these events, and do not report them.

* Event 0x6040 has not been properly identified yet, and we don't know if it
is important (looks like it isn't, but still...). Keep reporting it.

* Change the message the driver outputs on unknown 0x6xxx events, as all
recent events are not related to thermal alarms. Degrade log level from
ALERT to WARNING.

Thanks to all users who reported these events or asked about them in a number
of mailing lists. Your help is highly appreciated, even if I did took a lot of
time to act on them. For that I apologise.

I will list those that identified the reasons for the events as "reported-by",
and I apologise in advance if I leave anyone out: it was not done on purpose, I
made the mistake of not properly tagging all event report emails separately,
and might have missed some.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Reported-by: Markus Malkusch <markus@malkusch.de>
Reported-by: Peter Giles <g1l3sp@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
0978e012cfbaca8bd312933e98cdea2d11778e11 04-Apr-2011 Joe Perches <joe@perches.com> thinkpad_acpi: Convert printks to pr_<level>

Add pr_fmt.
Removed local TPACPI_<level> #defines, convert to pr_<level>.
Neaten dbg_<foo> macros.
Added a few missing newlines to logging messages.
Added static inline str_supported for !CONFIG_THINKPAD_ACPI_DEBUG vdbg_printk
defect reported by Sedat Dilek <sedat.dilek@googlemail.com>.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
112a6ee053f9e9f014ab64f2549d3a25551aa349 04-Apr-2011 Joe Perches <joe@perches.com> thinkpad_acpi: Correct !CONFIG_THINKPAD_ACPI_VIDEO warning

Move TPACPI_HANDLE declaration into #ifdef block
and neaten it a bit.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
9fbdaeb4f4dd14a0caa9fc35c496d5440c251a3a 09-May-2011 Manoj Iyer <manoj.iyer@canonical.com> thinkpad-acpi: module autoloading for newer Lenovo ThinkPads.

The newer Lenovo ThinkPads have HKEY HID of LEN0068 instead
of IBM0068. Added new HID so that thinkpad_acpi module will
auto load on these newer Lenovo ThinkPads.

Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
Signed-off-by: Manoj Iyer <manoj.iyer@canonical.com>
Signed-off-by: Andy Lutomirski <luto@mit.edu>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
b569ab3911aca64841bd819720d2b241aa09d713 01-Apr-2011 Keith Packard <keithp@keithp.com> thinkpad-acpi fails to load with newer Thinkpad X201s BIOS

The new BIOS has a slightly different EC version string.

From a1541710300b083a1a9acff2890d721d15ede62b Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Sun, 13 Mar 2011 23:46:22 -0700
Subject: [PATCH] thinkpad-acpi: Some BIOS versions don't end in WW, remove check

My X201s BIOS version string is 6QET46V1 (1.16 ). The
EC version string is 6QHT28WW-1.09. The driver was requiring that both
of these have 'WW' in positions 6 and 7. I don't know what the
significance of having 'V1' there instead is, but removing the test
makes the driver load on my machine.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
c8440336fe376036e473554c30f7266987961734 17-Mar-2011 Lucas De Marchi <lucas.de.marchi@gmail.com> platform-drivers: x86: fix common misspellings

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
bb7ca747f8d6243b3943c5b133048652020f4a50 23-Mar-2011 Matthew Garrett <mjg@redhat.com> backlight: add backlight type

There may be multiple ways of controlling the backlight on a given
machine. Allow drivers to expose the type of interface they are
providing, making it possible for userspace to make appropriate policy
decisions.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
5ffba7e696510c90e8327a2041764b2a60e56c6e 14-Jan-2011 Seth Forshee <seth.forshee@canonical.com> thinkpad_acpi: Always report scancodes for hotkeys

Some thinkpad hotkeys report key codes like KEY_FN_F8 when something
like KEY_VOLUMEDOWN is desired. Always provide the scan codes in
addition to the key codes to assist with debugging these issues. Also
send the scan code before the key code to match what other drivers do,
as some userspace utilities expect this ordering.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
213658516fd5e125eb7a97995f6cae8996f8015b 24-Dec-2010 Jesper Juhl <jj@chaosbits.net> ACPI Thinkpad: We must always call va_end() after va_start() but do not do so in thinkpad_acpi.c::acpi_evalf()

Hi,

In drivers/platform/x86/thinkpad_acpi.c::acpi_evalf() we don't always call
va_end() after va_start(). This patch corrects that.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
3098064d3b4a9bf9d2855b2a89599ad77695e324 15-Nov-2010 Joe Perches <joe@perches.com> drivers/platform/x86: Remove unnecessary semicolons

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
d41014b92d60a6b375aad9b6ebc52201ee58df70 26-Oct-2010 Julia Lawall <julia@diku.dk> drivers/platform/x86/thinkpad_acpi.c: delete double assignment

Delete successive assignments to the same location.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression i;
@@

*i = ...;
i = ...;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
acc2472ed33fc5e72482cc3b3b846077d97c2f8b 16-Nov-2010 Lionel Debroux <lionel_debroux@yahoo.fr> backlight: constify backlight_ops

backlight_device_register has been expecting a const "ops" argument, and using
it as such, since 9905a43b2d563e6f89e4c63c4278ada03f2ebb14. Let's make the
remaining backlight_ops instances const.

Inspired by hunks of the grsecurity patch, updated for newer kernels.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
b595076a180a56d1bb170e6eceda6eb9d76f4cd3 01-Nov-2010 Uwe Kleine-König <u.kleine-koenig@pengutronix.de> tree-wide: fix comment/printk typos

"gadget", "through", "command", "maintain", "maintain", "controller", "address",
"between", "initiali[zs]e", "instead", "function", "select", "already",
"equal", "access", "management", "hierarchy", "registration", "interest",
"relative", "memory", "offset", "already",

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
fc6e756894b703952fd277a1f98a5d93e7ba847a 18-Sep-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: avoid keymap pitfall

Change the code so that it will use the correct size for keymap entries.
Do it in a way that makes it harder to screw it up in the future.

Reported-by: Jaime Velasco Juan <jsagarribay@gmail.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2b75426282a8eb29d0a004ef0d289b0491c719be 10-Aug-2010 Jens Taprogge <jens.taprogge@taprogge.org> thinkpad-acpi: Add KEY_CAMERA (Fn-F6) for Lenovo keyboards

On the T410s and most likely other current models, Fn-F6 is labeled as
Camera/Headphone key. Report key presses as KEY_CAMERA.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Acked-by: Jerone Young <jerone.young@canonical.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
d1e14dca6a18aa40394316c872993ae3bc7e311a 10-Aug-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: add support for model-specific keymaps

Use the quirks engine to select model-specific keymaps, which makes
it much easier to extend should we need it.

Keycodes are based on the tables at
http://www.thinkwiki.org/wiki/Default_meanings_of_special_keys.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
34a656d22f5539f613b93e7a1d14b4bd53592505 10-Aug-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: lock down size of hotkey keymap

Use a safer coding style for the hotkey keymap. This does not fix any
problems, as the current code is correct. But it might help avoid
mistakes in the future.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
217f09631a420295a9688e18aa4dbad1b385e56c 10-Aug-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: untangle ACPI/vendor backlight selection

acpi_video_backlight_support() already tells us if ACPI is handling
backlight control through the generic ACPI handle. It is better to just
trust it.

While at it, adjust down a printk priority, and test earlier for
brightness_enable=0.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
122f26726b5e16174bf8a707df14be1d93c49d62 10-Aug-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: find ACPI video device by synthetic HID

The Linux ACPI core locates the ACPI video devices for us and marks them
with ACPI_VIDEO_HID. Use that information to locate the video device
instead of a half-baked hunt for _BCL.

This uncouples the detection of the number of backlight brightness
levels on ThinkPads from the ACPI paths in vid_handle.

With this change, the driver should be able to always detect whether the
ThinkPad uses a 8-level or 16-level brightness scale even on newer
models for which the vid_handle paths have not been updated yet.

It will skip deactivated devices in the ACPI device tree, which is a
change in behaviour.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
a420e46412ad9d33c7174cd4311b91728122e2c4 16-Jul-2010 Thomas Renninger <trenn@suse.de> X86 platform drivers: Remove EC dump from thinkpad_acpi

There is a general interface for that now (provided by
other patches in this patch series):
/sys/kernel/debug/ec/*/io

Signed-off-by: Thomas Renninger <trenn@suse.de>

CC: Alexey Starikovskiy <astarikovskiy@suse.de>
CC: Len Brown <lenb@kernel.org>
CC: linux-kernel@vger.kernel.org
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
CC: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
CC: ibm-acpi-devel@lists.sourceforge.net
Signed-off-by: Matthew Garrett <mjg@redhat.com>
7d9745cf239ca98cf1f694bff4765a276b05ee68 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: document backlight level writeback at driver init

Document this, it is no fun to try to second guess why this sort of
stuff is in place years after it was added...

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
ef07a5abadfcb2470fc9cbfbee0cb41076b4ba9b 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: clean up ACPI handles handling

1. Remove <handle>_path, as its only user was already removed in
a previous commit

2. Move all handle initialization, as well as <handle>_parent and
<handle>_paths to __init.* sections. This reduces the driver's
runtime footprint nicely.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
2cbb5c8f5533facb606adc5986ce40da2e987d6d 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: don't depend on led_path for led firmware type (v2)

Don't depend on the contents of led_path to know which LED interface
the firmware wants.

This removes the only user of *_path for the thinkpad-acpi ACPI
handlers, which will simplify future code.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
72f19921217c2267adc65cbe69c63da970578a14 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: explain errors from acpi_install_notify_handler

Log more human-friendly errors instead of numeric values when
setup_acpi_notify() fails to install a notification handler.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
263f4a30e4f1dc5385650738c1dcf3728036ecc4 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: acpi_evalf fixes

Use acpi_format_exception() in acpi_evalf() instead of logging numeric
errors.

Also, when ACPICA returns an error, we should not be touching the return
object, as it is invalid. In debug mode, acpi_evalf() callers would
printk the returned crap (but fortunately, not use it).

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
437e470c4ca818c97426afa3a67fbd7e34cffe00 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: detect EC node using its HID (v2)

Use the EC HID (PNP0C09) to locate its main node, instead of a static
list.

Suggested-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Matthew Garrett <mjg@redhat.com>
38e11cdec90f1dd7355db4aed8a1857258e99485 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: disclose usertask for ALSA callbacks

Disclose the user task doing ALSA access when requested by
the debug bitmask.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
289990228155cbc58a35c1b266af00f387caa595 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix brightness hotkey poll handling

Handle multiple brightness hotkey presses between two polling cycles.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
77775838bb76173d7a1ed28f75dfe388962aceca 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: let other subdrivers know backlight level range

Extract the backlight level range size detection from the brightness
subdriver, and allow the other subdrivers access to that information.

This also allows us to relocate some code to a more convenient place.
The moved code was largerly unmodified, except for the return type of
tpacpi_check_std_acpi_brightness_support(), which now is correctly
marked as returning "unsigned int", and and two cosmetic fixes to make
checkpatch.pl happy.

Fixes for the NVRAM polling mode for the brightness hotkeys will need
this.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
7a43f788988ac47b21ce258197c5014b5249c9f5 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: move greeting messages out of the first subdriver (v2)

Move the driver initial greetings out of the first subdriver, as we do a
lot of other initialization before that point, and the initial greetings
should go as soon as the driver decides that it should load.

These greetings are not cosmetic, they make my life easier when users
report bugs.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
5d756db99a7382d5cd173e912d527e9ee73d0596 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix volume/mute hotkey poll handling

The hotkey polling code is supposed to generate hotkey messages as
close to the way the IBM event-based volume hotkey firmware does as
possible, i.e:

* Pressing MUTE issues a mute hotkey event, even if already mute;

* Pressing Volume up/down issues a volume up/down hotkey event,
even if already at maximum or minumum volume;

* The act of unmuting issues a volume up/down event, depending on
which hotkey was used to unmute.

Fix the code to do just that (mute handling was incorrect), and handle
multiple hotkey presses between two polling cycles.

The new code uses the volume_toggle bit in NVRAM only to detect
repeated presses of the mute key and multiple presses of the volume
keys trying to go past the end of the volume scale. This will work
around a bug in recent Lenovo firmware (e.g. T400), which causes the
firmware to not update the volume_toggle bit in certain situations.

Reported-by: Yang Zhe <yangzhe1990@gmail.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
a318930d06a7a93bd50000c7112f995b459adda7 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: X100e quick fixes

The X100e needs some quick fixes to work semi-right with this driver.
There are much better ways to do this, but we can start with a quick
update and do it properly later.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
e28393c0c4416dffb46ca481e670f10c6a35baca 17-May-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: constrain IBM-era support to IBM boxes

Lenovo is playing around with its ACPI BIOS, and will end up reusing
method names. Their memory is not nearly as long as thinkpad-acpi's...

Secure most of the old IBM codepaths against running in a non-IBM box.
This would happen on the Lenovo X100e in video_init(), for example. We
would misdetect it as an ancient model 570 firmware.

Also, refuse to load the driver if we cannot identify the vendor. No
ACPI ThinkPad in existence lacks this information, AFAIK.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
a19a6ee6cad2b20292a774c2f56ba8039b0fac9c 17-Feb-2010 Matthew Garrett <mjg@redhat.com> backlight: Allow properties to be passed at registration

Values such as max_brightness should be set before backlights are
registered, but the current API doesn't allow that. Add a parameter to
backlight_device_register and update drivers to ensure that they
set this correctly.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
88cc83772a3c7756b9f2b4ba835545ad90a08409 27-Feb-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix ALSA callback return status

Clemens Ladisch reports that thinkpad-acpi improperly implements the
ALSA API, and always returns 0 for success for the "put" callbacks
while the API requires it to return "1" when the control value has
been changed in the hardware/firmware.

Rework the volume subdriver to be able to properly implement the ALSA
API. Based on a patch by Clemens Ladisch <clemens@ladisch.de>.

This fix is also needed on 2.6.33.

Reported-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
b525c06cdbd8a3963f0173ccd23f9147d4c384b5 26-Feb-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: lock down video output state access

Given the right combination of ThinkPad and X.org, just reading the
video output control state is enough to hard-crash X.org.

Until the day I somehow find out a model or BIOS cut date to not
provide this feature to ThinkPads that can do video switching through
X RandR, change permissions so that only processes with CAP_SYS_ADMIN
can access any sort of video output control state.

This bug could be considered a local DoS I suppose, as it allows any
non-privledged local user to cause some versions of X.org to
hard-crash some ThinkPads.

Reported-by: Jidanni <jidanni@jidanni.org>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
08fedfc903c78e380b0baa7b57c52d367794d0a5 26-Feb-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix bluetooth/wwan resume

Studying the DSDTs of various thinkpads, it looks like bit 3 of the
argument to SBDC and SWAN is not "set radio to last state on resume".
Rather, it seems to be "if this bit is set, enable radio on resume,
otherwise disable it on resume".

So, the proper way to prepare the radios for S3 suspend is: disable
radio and clear bit 3 on the SBDC/SWAN call to to resume with radio
disabled, and enable radio and set bit 3 on the SBDC/SWAN call to
resume with the radio enabled.

Also, for persistent devices, the rfkill core does not restore state,
so we really need to get the firmware to do the right thing.

We don't sync the radio state on suspend, instead we trust the BIOS to
not do anything weird if we never touched the radio state since boot.
Time will tell if that's a wise way of doing things...

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
7f0cf712a74fcc3ad21f0bde95bd32c2f2cc3888 26-Feb-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: make driver events work in NVRAM poll mode

Thadeu Lima de Souza Cascardo reports this:

Brightness notification does not work until the user writes to
hotkey_mask attribute. That's because the polling thread will only run
if hotkey_user_mask is set and someone is reading the input device or
if hotkey_driver_mask is set. In this second case, this condition is
not tested after the mask is changed, because the brightness and
volume drivers are started after the hotkey drivers.

Fix tpacpi_hotkey_driver_mask_set() to call hotkey_poll_setup(), so
that the poller kthread will be started when needed.

Reported-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Tested-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: stable@kernel.org
b589ea4c44170d3f7a845684e2d1b3b9571663af 26-Feb-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix poll thread auto-start

The driver was not starting the NVRAM polling thread if the input
device was bound immediately after registration.

This fixes:
http://bugzilla.kernel.org/show_bug.cgi?id=15118

Reported-by: Florian Zumbiehl <florz@florz.de>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
7d1894d8d1c411d2dad95abfe0f65bacf68c4afa 26-Feb-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: R52 brightness_mode has been confirmed

We can stop pestering users for confirmation of the brightness_mode
default for firmware TP-76.

While at it, add a few missing comments in that quirk table.

Reported-by: Whoopie <whoopie79@gmx.net>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
bf8b29c8f7f8269e99eca8b19048ed5b34b51810 26-Feb-2010 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: document HKEY event 3006

Event 0x3006 is used to help power management of the ODD in the
UltraBay. The EC generates this event when the ODD eject button is
pressed (even if the bay is powered down).

Normally, Linux doesn't need this as we keep the SATA link powered
up (which wastes power). The EC powers up the bay by itself when the
ODD eject button is pressed, and the SATA PHY reports the hotplug.

However, we could also power that SATA link down (and for that matter,
also power down the Ultrabay) if the ODD is left idle for a while with
no disk inside, and use event 0x3006 to know when we need that SATA link
powered back up.

For now, just stop asking for more information when event 0x3006 is
seen, there is no point in pestering users about it anymore.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
f04d5e012d73ea441bd39804ace39fd6d1ce5611 02-Feb-2010 Roel Kluin <roel.kluin@gmail.com> thinkpad-acpi: wrong thermal attribute_group removed in thermal_exit()

sysfs_remove_group() removed the wrong attribute_group for
thermal_read_mode TPEC_8, ACPI_TMP07 and ACPI_UPDT

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
9ddc5b6f18fbac07d2746566b73b89e89fdd4e6a 20-Jan-2010 Uwe Kleine-König <u.kleine-koenig@pengutronix.de> tree-wide: fix typos "ammount" -> "amount"

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
ff850c339a1a6a7724537160c73cdc09a483fc5d 27-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: make volume subdriver optional

Allow the user to choose through Kconfig if the Console Audio Control
interface (aka "volume subdriver") should be available or not.

This not only saves some memory, but also allows the thinkpad-acpi
driver to be built-in even if ALSA is modular when the console audio
control interface is not wanted.

This change fixes a build problem that is causing some annoyances, in
a way that doesn't disable the entire driver on kernels without ALSA
support.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Amerigo Wang <amwang@redhat.com>
Cc: Helight Xu <helight.xu@gmail.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
74c75c1848b618f6717c1be887ad539ffac2e96d 27-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: don't fail to load the entire module due to ALSA problems

If we cannot create the ALSA mixer, it is a good reason to fail to
load the volume subdriver, and not to fail to load the entire module.

While at it, add more debugging messages, as the error paths are being
used a lot more than I'd expect, and it is failing to set up the ALSA
mixer on a number of ThinkPads.

Reported-by: Peter Jordan <usernetwork@gmx.info>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
ead510cebcdf41c92fce2a909f342255b028a33d 27-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: don't take the first ALSA slot by default

We don't want to be the first soundcard. We don't want to shift other
soundcards out of the way either, even if they load much later.

Ask ALSA to (by default) load us in one of the last three slots. This
can be overriden at will using the "index" parameter.

Reported-by: Whoopie <whoopie79@gmx.net>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
6baddba4a40b4f4e37db051e84ac5e7cc454a19c 20-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> backlight/thinkpad-acpi: issue backlight class events

Take advantage of the new events capabilities of the backlight class to
notify userspace of backlight changes.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
5d2eb14d36723eba0b31ae208bc346835751e944 16-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: bump version to 0.24

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
887965e6576a78f71b9b98dec43fd1c73becd2e8 16-Dec-2009 Alexey Dobriyan <adobriyan@gmail.com> thinkpad-acpi: convert to seq_file

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
0d204c34e85d1d63e5fdd3e3192747daf0ee7ec1 16-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: basic ALSA mixer support (v2)

Add the basic ALSA mixer functionality. The mixer is event-driven,
and will work fine on IBM ThinkPads. I expect Lenovo ThinkPads will
cause some trouble with the event interface.

Heavily based on work by Lorne Applebaum <lorne.applebaum@gmail.com>
and ideas from Matthew Garrett <mjg@redhat.com>.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Lorne Applebaum <lorne.applebaum@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Len Brown <len.brown@intel.com>
c7ac6291ea7ebc568a1fce16fed87d102898f264 16-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: disable volume control

Disable volume control by default. It can be enabled at module load
time by a module parameter (volume_control=1).

The audio control mixer that thinkpad-acpi interacts with is fully
functional without any drivers, and operated by hotkeys.

The idea behind the console audio control is that the human operator
is the only one that can interact with it. The ThinkVantage suite in
Windows does not allow any software-based overrides, and only does OSD
(on-screen-display) functions.

The Linux driver will, with the addition of the ALSA interface, try to
follow and enforce the ThinkVantage UI design:

The user is supposed to use the keyboard hotkeys to interact with the
console audio control. The kernel and the desktop environment is
supposed to cooperate to provide proper user feedback through
on-screen-display functions.

Distros are urged to not to enable volume control by default.
Enabling this must be a local admin's decision. This is the reason
why there is no Kconfig option.

Keep in mind that all ThinkPads have a normal, main mixer (AC97 or
HDA) for regular software-based audio control. We are not talking
about that mixer here.

Advanced users are, of course, free to enable volume control and do as
they please.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Lorne Applebaum <lorne.applebaum@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Len Brown <len.brown@intel.com>
a112ceee673629afc204bf6b4a4828a6143a083f 16-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: support MUTE-only ThinkPads

Lenovo removed the extra mixer since the T61 and thereabouts.
Newer Lenovo models only have the mute gate function, and leave
the volume control to the HDA mixer.

Until a way to automatically query the firmware about its audio
control capabilities is discovered (there might not be any), use a
white/black list.

We will likely need to ask T60 (old and new model) and Z60/Z61 users
whether they have volume control to populate the black/white list.
Meanwhile, provide a volume_capabilities parameter that can be used to
override the defaults.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Lorne Applebaum <lorne.applebaum@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Len Brown <len.brown@intel.com>
329e4e18dfdc552f36b0642a3de5ebfa96063666 16-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: volume subdriver rewrite

I don't trust the coupled EC writes and SMI calls the current volume
control code does very much, although it is exactly what the IBM DSDTs
seem to do (they never do more than a single step though).

Change the driver to stop issuing SMIs, and just drive the EC directly
to the desired level (DSDTs seem to confirm this will work even on
very old models like the 570 and 600e/x).

We checkpoint directly to NVRAM (this can be turned off) at
suspend/shutdown/driver unload, which from what I can see in tbp,
should also work on every ThinkPad.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Lorne Applebaum <lorne.applebaum@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Len Brown <len.brown@intel.com>
5451a923bbdcff6ae665947e120af7238b21a9d2 16-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: log initial state of rfkill switches

We already log the initial state of the hardware rfkill switch (WLSW),
might as well log the state of the softswitches as well.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Josip Rodin <joy+kernel@entuzijast.net>
Signed-off-by: Len Brown <len.brown@intel.com>
d89a727aff649f6768f7a34ee57f031ebf8bab4c 16-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: sync input device EV_SW initial state

Before we register the input device, sync the input layer EV_SW state
through a call to input_report_switch(), to avoid issuing a gratuitous
event for the initial state of these switches.

This fixes some annoyances caused by the interaction with rfkill and
EV_SW SW_RFKILL_ALL events.

Reported-by: Kevin Locke <kevin@kevinlocke.name>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Len Brown <len.brown@intel.com>
e7d2860b690d4f3bed6824757c540579638e3d1e 15-Dec-2009 André Goddard Rosa <andre.goddard@gmail.com> tree-wide: convert open calls to remove spaces to skip_spaces() lib function

Makes use of skip_spaces() defined in lib/string.c for removing leading
spaces from strings all over the tree.

It decreases lib.a code size by 47 bytes and reuses the function tree-wide:
text data bss dec hex filename
64688 584 592 65864 10148 (TOTALS-BEFORE)
64641 584 592 65817 10119 (TOTALS-AFTER)

Also, while at it, if we see (*str && isspace(*str)), we can be sure to
remove the first condition (*str) as the second one (isspace(*str)) also
evaluates to 0 whenever *str == 0, making it redundant. In other words,
"a char equals zero is never a space".

Julia Lawall tried the semantic patch (http://coccinelle.lip6.fr) below,
and found occurrences of this pattern on 3 more files:
drivers/leds/led-class.c
drivers/leds/ledtrig-timer.c
drivers/video/output.c

@@
expression str;
@@

( // ignore skip_spaces cases
while (*str && isspace(*str)) { \(str++;\|++str;\) }
|
- *str &&
isspace(*str)
)

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Cc: Julia Lawall <julia@diku.dk>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Neil Brown <neilb@suse.de>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: David Howells <dhowells@redhat.com>
Cc: <linux-ext4@vger.kernel.org>
Cc: Samuel Ortiz <samuel@sortiz.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
792979c8032b8f5adb77ea986db7082fff04c8e7 09-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: use input_set_capability

Use input_set_capability() instead of set_bit.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Len Brown <len.brown@intel.com>
9ebd9e833648745fa5ac6998b9e0153ccd3ba839 09-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: log temperatures on termal alarm (v2)

Log temperatures on any of the EC thermal alarms. It could be
useful to help tracking down what is happening...

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
b09c72259e88cec3d602aef987a3209297f3a9c2 09-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: expose module parameters

Export the normal (non-command) module paramenters as mode 0444, so
that they will show up in sysfs.

These parameters must not be changed at runtime as a rule, with very
few exceptions.

Reported-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
d112ef95d4ec1ee7fe7123e3f21e4aac0d57570c 09-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: adopt input device

Properly init the parent field of the input device. Thanks to Alan
Jenkins, who noted this problem in a different driver.

Reported-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
6b30eb7d211840ba1a03f855d9e7b80a921368f2 09-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: silence bogus complain during rmmod

Fix this bogus warning during module shutdown, when
backlight event reporting is enabled:

"thinkpad_acpi: required events 0x00018000 not enabled!"

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
347a26860e2293b1347996876d3550499c7bb31f 09-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: issue backlight class events

Take advantage of the new events capabilities of the backlight class to
notify userspace of backlight changes.

This depends on "backlight: Allow drivers to update the core, and
generate events on changes", by Matthew Garrett.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
90765c6aee568137521ba19347c744b5abde8161 09-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix some version quirks

Update some of the BIOS/EC version quirks.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
208b996b6c460285650d39b2330f8ef82c007d10 09-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: preserve rfkill state across suspend/resume

Since the rfkill rework in 2.6.31, the driver is always resuming with
the radios disabled.

Change thinkpad-acpi to ask the firmware to resume with the radios in
the last state. This fixes the Bluetooth and WWAN rfkill switches.

Note that it means we respect the firmware's oddities. Should the
user toggle the hardware rfkill switch on and off, it might cause the
radios to resume enabled.

UWB is an unknown quantity since it has nowhere the same level of
firmware support (no control over state storage in NVRAM, for
example), and might need further fixing. Testers welcome.

This change fixes a regression from 2.6.30.

Reported-by: Jerone Young <jerone.young@canonical.com>
Reported-by: Ian Molton <ian.molton@collabora.co.uk>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Tested-by: Ian Molton <ian.molton@collabora.co.uk>
Cc: stable@kernel.org
Signed-off-by: Len Brown <len.brown@intel.com>
a9f8eacca4e9e8693de9b896c1fa7aadaa9402e8 09-Dec-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix default brightness_mode for R50e/R51

According to a report, the R50e wants EC-based brightness control,
even if it uses an Intel GPU. The current driver default was reported
to not work at all.

This bug can be worked around by the "brightness_mode=3" module
parameter.

Change the default of the R50e and R51 2xxx models (which use the same
EC firmware, 1V) to TPACPI_BRGHT_Q_EC, but keep TPACPI_BRGHT_Q_ASK set
for now, as I'd like to get more reports.

This fixes a regression caused by commit
59fe4fe34d7afdf63208124f313be9056feaa2f4,
"thinkpad-acpi: fix incorrect use of TPACPI_BRGHT_MODE_ECNVRAM"

Kernel 2.6.31 also needs this fix.

Reported-by: Ferenc Wagner <wferi@niif.hu>
Tested-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
Signed-off-by: Len Brown <len.brown@intel.com>
af901ca181d92aac3a7dc265144a9081a86d8f39 14-Nov-2009 André Goddard Rosa <andre.goddard@gmail.com> tree-wide: fix assorted typos all over the place

That is "success", "unknown", "through", "performance", "[re|un]mapping"
, "access", "default", "reasonable", "[con]currently", "temperature"
, "channel", "[un]used", "application", "example","hierarchy", "therefore"
, "[over|under]flow", "contiguous", "threshold", "enough" and others.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
275014ae46871ce0ab08550fc4040f12b685813a 17-Nov-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix detection of old ThinkPads

There is a problem in the quirk tables used by tpacpi_is_fw_known() and
tpacpi_check_outdated_fw(), which causes outdated BIOSes that are lacking
the EC firmware ID DMI field to never match.

This breaks module loading on, e.g. a T23 with outdated BIOS, and the
module will refuse to load unless the "force_load=1" parameter is given.

Fix the quirk tables so that they can also match the outdated BIOSes,
which in turn will both fix the module loading, and also warn the user
that he is using outdated firmware and should upgrade.

This fixes a serious regression, introduced by commit
e675abafcc0df38125e6e94a9ba91c92fe774f52, "thinkpad-acpi: be more strict
when detecting a ThinkPad".

http://bugzilla.kernel.org/show_bug.cgi?id=14597

Reported-by: Paul Kimoto <kimoto@lightlink.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Tested-by: Paul Kimoto <kimoto@lightlink.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
80a8d1228e90349b4514e8c925c061fa5cbcea75 20-Nov-2009 Roel Kluin <roel.kluin@gmail.com> thinkpad-acpi: fix sign of ERESTARTSYS return

The returned error should be negative

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: <stable@kernel.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2263576cfc6e8f6ab038126c3254404b9fcb1c33 13-Nov-2009 Lin Ming <ming.m.lin@intel.com> ACPICA: Add post-order callback to acpi_walk_namespace

The existing interface only has a pre-order callback. This change
adds an additional parameter for a post-order callback which will
be more useful for bus scans. ACPICA BZ 779.

Also update the external calls to acpi_walk_namespace.

http://www.acpica.org/bugzilla/show_bug.cgi?id=779

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
b684a3637e0887683a0a3d6fd471fc41d7c1606a 27-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix CONFIG_THINKPAD_ACPI_HOTKEY_POLL build problem

Fix this problem when CONFIG_THINKPAD_ACPI_HOTKEY_POLL is undefined:

CHECK drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/thinkpad_acpi.c:1968:21: error: not an lvalue
CC [M] drivers/platform/x86/thinkpad_acpi.o
drivers/platform/x86/thinkpad_acpi.c: In function 'tpacpi_hotkey_driver_mask_set':
drivers/platform/x86/thinkpad_acpi.c:1968: error: lvalue required as left operand of assignment

Reported-by: Noah Dain <noahdain@gmail.com>
Reported-by: Audrius Kazukauskas <audrius@neutrino.lt>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
67bcae6ee8e111f3343bc89345883024ba230a3b 20-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: name event constants

Reduce the number of magic numbers in the driver... note that they
were all explained and documented already.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
8b468c0c85f41c4c55227c17271b4187d8911fb0 20-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: add internal hotkey event API

Add an internal API to the driver, to allow subdrivers to request and
receive HKEY 0x1000 events. This API will be used by the backlight
(brightness up/down) and upcoming ALSA mixer (volume up/down/mute)
subdrivers.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
0d922e3b84dc4923fc67901580a3c166006fba7a 20-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: hotkey event driver update

Update the HKEY event driver to:

1. Handle better the second-gen firmware, which has no HKEY mask
support but does report FN+F3, FN+F4 and FN+F12 without the need
for NVRAM polling.

a) always make the mask-related attributes available in sysfs;
b) use DMI quirks to detect the second-gen firmware;
c) properly report that FN+F3, FN+F4 and FN+F12 are enabled,
and available even on mask-less second-gen firmware;

2. Decouple the issuing of hotkey events towards userspace from
their reception from the firmware. ALSA mixer and brightness
event reporting support will need this feature.

3. Clean up the mess in the hotkey driver a great deal. It is
still very convoluted, and wants a full refactoring into a
proper event API interface, but that is not going to happen
today.

4. Fully reset firmware interface on resume (restore hotkey
mask and status).

5. Stop losing polled events for no good reason when changing the
mask and poll frequencies. We will still lose them when the
hotkey_source_mask is changed, as well as any that happened
between driver suspend and driver resume.

The hotkey subdriver now has the notion of user-space-visible hotkey
event mask, as well as of the set of "hotkey" events the driver needs
(because brightness/volume change reports are not just keypress
reports in most ThinkPad models).

With this rewrite, the ABI level is bumped to 0x020500 should
userspace need to know it is dealing with the updated hotkey
subdriver.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
176dd98523fee4836210bc0834c8e3e6a93247bf 20-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: drop HKEY event 0x5010

HKEY event 0x5010 is useless to us: old ThinkPads don't issue it. Newer
ThinkPads won't issue it anymore. And all ThinkPads issue 0x1010 and
0x1011 events.

Just silently drop it instead of sending it to userspace.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
4be73005e4dcf111fa88f7265ed147e2de38b075 20-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: remove uneeded tp_features.hotkey tests in hotkey_exit

hotkey_exit() is only called if hotkey_init() finished sucessfully, or
by direct calls inside hotkey_init(). The tp_features.hotkey test is
always true, and just adds to the confusion, remove it. Also, avoid
calling hotkey_mask_set() when it won't do anything useful.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
435c47e20bc212d0fa6652ac93fae8eaee7b9b34 20-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: don't leave ERR_PTR() pointers around

backlight_device_register returns ERR_PTR() in case of problems, and
the current code would leave that ERR_PTR in ibm_backlight_device.

The current code paths won't touch it in that situation, but that could
change. Make sure to set ibm_backlight_device to NULL in the error
path.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
5f0dadb4bd259c3b832e19702f552947244edfb9 14-Sep-2009 Corentin Chary <corentincj@iksaif.net> thinkpad_acpi: fix rfkill memory leak on unload

rfkill_unregister() should always be followed by rfkill_destroy()

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
de4c8cc7bddd9c43dc1b85517ab445ffa8163058 12-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: report brightness events when required

Report KEY_BRIGHTNESSUP and KEY_BRIGHTNESSDOWN input events when the
ThinkPad is in "passive brightness control" mode (because either we or
ACPI video touched _BCL), and ACPI video is not processing these
events by itself.

This happens only on Lenovo ThinkPads with ACPI video support, when
operating with the ACPI video driver in acpi_backlight=vendor mode.

Issuing these events is the right thing to do, and will work around
bugzilla #13368, if userspace is properly configured and actively
handles these events.

For other ThinkPads, and when ACPI video is handling brightness
changes, thinkpad-acpi will continue NOT sending KEY_BRIGHTNESS*
events by default.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
230d8cf25ac32c7d2fdb4dda861ec5d954000ffb 12-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: don't poll by default any of the reserved hotkeys

Init hotkey_source_mask late, so that we can make use of
hotkey_reserved_mask to avoid polling any of the reserved
hotkeys by default.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
20c9aa46f644b3ddb161a819d1b0c2b07097c4ee 12-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: Fix procfs hotkey reset command

echo "reset" > /proc/acpi/ibm/hotkey should do something non-useless,
so instead of setting it to Fn+F2, Fn+F3, Fn+F5, set it to
hotkey_recommended_mask.

It is not like it will survive for much longer, anyway.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
06777be6d8688ba93103fffbbe9e64a5e6fab3c8 12-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: deprecate hotkey_bios_mask

Some analysis of the ACPI DSDTs shows that the HKEY pre-enabled mask
is always 0x80c (FN+F3,FN+F4 and FN+F12), which are the hotkeys that
the second gen of HKEY firmware supported (the first gen didn't report
any hotkeys, the second reported these tree hotkeys but had no mask
support, and the third added mask support).

So, this is probably some sort of backwards compatibility with older
versions of the IBM ThinkVantage suite. We have no use for that, and
I know of exactly ZERO users of that attribute, anyway. Start the
process of getting rid of it.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
db25f16d1dcce8de12f2f5daf884cda02196b28c 12-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: hotkey poll fixes

Fix some locking, avoid exiting the kthread before kthread_stop() is
called on it, and clean up the hotkey poll routines a little bit.

Also, restore bits in the firmware mask after hotkey_source_mask is
changed. Without this, we leave events disabled...

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
e675abafcc0df38125e6e94a9ba91c92fe774f52 12-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: be more strict when detecting a ThinkPad

Use stricter checks to decide that we're running on a supported ThinkPad.
This should remove some possible false positives, although nobody ever
bothered to report any.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
600a99fa3b4ce4a54375fb089e5ce0f3a1c9a7e1 12-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: firmware version checks

Use the quirk infrastructure to warn of outdated firmware and also of
firmware versions that are known to cause problems.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
6da25bf51689a5cc60370d30275dbb9e6852e0cb 12-Sep-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: don't ask about brightness_mode for fw. 1V and 1R

X40 (firmware 1V) and T41 (firmware 1R) have been confirmed to work
well with the new defaults, so we can stop pestering people to confirm
that fact.

For now, whitelist just these two firmware types. It is best to have
at least one more firmware type confirmed for Radeon 9xxx and Intel
GMA-2 ThinkPads before removing the confirmation requests entirely.

Reported-by: Robert de Rooy <robert.de.rooy@gmail.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
Signed-off-by: Len Brown <len.brown@intel.com>
59fe4fe34d7afdf63208124f313be9056feaa2f4 01-Aug-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix incorrect use of TPACPI_BRGHT_MODE_ECNVRAM

HBRV-based default selection of backlight control strategy didn't work
well, at least the X41 defines it but doesn't use it and I don't think
it will stop there.

Switch to a white/blacklist. All models that have HBRV defined have
been included in the list, and initially all ATI GPUs will get
ECNVRAM, and the Intel GPUs will get UCMS_STEP.

Symptoms of incorrect backlight mode selection are:

1. Non-working backlight control through sysfs;

2. Backlight gets reset to the lowest level at every shutdown, reboot
and when thinkpad-acpi gets unloaded;

This fixes a regression in 2.6.30, bugzilla #13826

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Reported-by: Tobias Diedrich <ranma+kernel@tdiedrich.de>
Cc: stable@kernel.org
Signed-off-by: Len Brown <len.brown@intel.com>
5b05d4696d38c3172e79e855cc1e2ed044589508 01-Aug-2009 Michael Buesch <mb@bu3sch.de> thinkpad-acpi: restrict procfs count value to sane upper limit

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
1f6fc2de9525e34ee93bd392fa046369a8cfbf1e 01-Aug-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: remove dock and bay subdrivers

The standard ACPI dock driver can handle the hotplug bays and docks of
the ThinkPads just fine (including batteries) as of 2.6.27, and the
code in thinkpad-acpi for the dock and bay subdrivers is currently
broken anyway...

Userspace needs some love to support the two-stage ejection nicely,
but it is simple enough to do through udev rules (you don't even need
HAL) so this wouldn't justify fixing the dock and bay subdrivers,
either.

That leaves warm-swap bays (_EJ3) support for thinkpad-acpi, as well
as support for the weird dock of the model 570, but since such support
has never left the "experimental" stage, it is also not a strong
enough reason to find a way to fix this code.

Users of ThinkPads with warm-swap bays are urged to request that _EJ3
support be added to the regular ACPI dock driver, if such feature is
indeed useful for them.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
06d5caf47ef4fbd9efdceae33293c42778cb7b0c 16-Jun-2009 Alan Jenkins <alan-jenkins@tuffmail.co.uk> rfkill: don't restore software blocked state on persistent devices

The setting of the "persistent" flag is also made more explicit using
a new rfkill_init_sw_state() function, instead of special-casing
rfkill_set_sw_state() when it is called before registration.

Suspend is a bit of a corner case so we try to get away without adding
another hack to rfkill-input - it's going to be removed soon.
If the state does change over suspend, users will simply have to prod
rfkill-input twice in order to toggle the state.

Userspace policy agents will be able to implement a more consistent user
experience. For example, they can avoid the above problem if they
toggle devices individually. Then there would be no "global state"
to get out of sync.

Currently there are only two rfkill drivers with persistent soft-blocked
state. thinkpad-acpi already checks the software state on resume.
eeepc-laptop will require modification.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
CC: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d73772474f6ebbacbe820c31c0fa1cffa7160246 18-Jun-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: support the second fan on the X61

Support reading the tachometer of the auxiliary fan of a X60/X61.

It was found out by sheer luck, that bit 0 of EC register 0x31
(formely HBRV) selects which fan is active for tachometer readings
through EC 0x84/0x085: 0 for fan1, 1 for fan2.

Many thanks to Christoph Kl??nter, to Whoopie, and to weasel, who
helped confirm that behaviour.

Fan control through EC HFSP applies to both fans equally, regardless
of the state of bit 0 of EC 0x31. That matches the way the DSDT uses
HFSP.

In order to better support the secondary fan, export a second
tachometer over hwmon, and add defensive measures to make sure we are
reading the correct tachometer.

Support for the second fan is whitelist-based, as I have not found
anything obvious to look for in the DSDT to detect the presence of
the second fan.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
d7880f10c5d42ba182a97c1fd41d41d0b8837097 18-Jun-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: forbid the use of HBRV on Lenovo ThinkPads

Forcing thinkpad-acpi to do EC-based brightness control (HBRV) on a
X61 has very... interesting effects, instead of doing nothing (since
it doesn't have EC-based backlight control), it causes "weirdness" in
the fan tachometer readings, for example.

This means the EC register that used to be HBRV has been reused by
Lenovo for something else, but they didn't remove it from the DSDT.

Make sure the documentation reflects this data, and forbid the user
from forcing the driver to access HBRV on Lenovo ThinkPads.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
8bf3d4c535c2b9689c2979b281c24e9f59c2f4ad 30-May-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: silence bogus warning when ACPI video is disabled

Make use of acpi_video_backlight_support() also in hotkey_init, to make
sure this doesn't happen:

thinkpad_acpi: This ThinkPad has standard ACPI backlight brightness
control, supported by the ACPI video driver
thinkpad_acpi: Disabling thinkpad-acpi brightness events by default...
thinkpad_acpi: Standard ACPI backlight interface not available,
thinkpad_acpi native brightness control enabled
thinkpad_acpi: detected a 16-level brightness capable ThinkPad

Note that this is purely cosmetic, there is absolutely _no_ change in
behaviour. Those events are sometimes enabled at runtime by userspace, but
the driver never enables them by itself unless someone messed with the
default keymaps.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Reported-by: Jochen Schulz <jrschulz@well-adjusted.de>
Signed-off-by: Len Brown <len.brown@intel.com>
f21179a47ff8d1046a61c1cf5920244997a4a7bb 30-May-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: enhance led support

Add support for extra LEDs on recent ThinkPads, and avoid registering
with the led class the LEDs which are not available for a given
ThinkPad model.

All non-restricted LEDs are always available through the procfs
interface, as the firmware doesn't care if an attempt is made to
access an invalid LED.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
60201732f03c1231742e5872abe55a3bf59849a5 30-May-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix BEEP ACPI handler warnings

Some ThinkPads want two arguments for BEEP, while others want just
one, causing ACPICA to log warnings like this:

ACPI Warning (nseval-0177): Excess arguments - method [BEEP] needs 1,
found 2 [20080926]

Deal with it.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
7d95a3d564901e88ed42810f054e579874151999 30-May-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: add quirklist engine

Add a quirklist engine suitable for matching ThinkPad firmware,
and change the code to use it.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
050df107c408a3df048524b3783a5fc6d4dccfdb 30-May-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: store fw version with strict checking

Extend the thinkpad model and firmware identification data with the
release serial number for the BIOS and firmware (when available), as
that is easier to parse and compare than the version strings.

We're going to greatly extend the use of the ThinkPad DMI data through
quirk lists, so it is best to be quite strict and make sure what we
get from DMI is exactly what we expect, otherwise quirk matching may
result in quite insane things.

IBM (and Lenovo, at least for the ThinkPad line) uses this schema for
firmware versioning and model:

Firmware model: Two digits, [0-9A-Z]

Firmware version: AABBCCDD, where
AA = firmware model, see above
BB = "ET" for BIOS, "HT" for EC
CC = release version, two digits, [0-9A-Z],
"00" < "09" < "0A" < "10" < "A0" < "ZZ"
DD = "WW"

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
b3fa1329eaf2a7b97124dacf5b663fd51346ac19 08-Jun-2009 Alan Jenkins <alan-jenkins@tuffmail.co.uk> rfkill: remove set_global_sw_state

rfkill_set_global_sw_state() (previously rfkill_set_default()) will no
longer be exported by the rewritten rfkill core.

Instead, platform drivers which can provide persistent soft-rfkill state
across power-down/reboot should indicate their initial state by calling
rfkill_set_sw_state() before registration. Otherwise, they will be
initialized to a default value during registration by a set_block call.

We remove existing calls to rfkill_set_sw_state() which happen before
registration, since these had no effect in the old model. If these
drivers do have persistent state, the calls can be put back (subject
to testing :-). This affects hp-wmi and acer-wmi.

Drivers with persistent state will affect the global state only if
rfkill-input is enabled. This is required, otherwise booting with
wireless soft-blocked and pressing the wireless-toggle key once would
have no apparent effect. This special case will be removed in future
along with rfkill-input, in favour of a more flexible userspace daemon
(see Documentation/feature-removal-schedule.txt).

Now rfkill_global_states[n].def is only used to preserve global states
over EPO, it is renamed to ".sav".

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
19d337dff95cbf76edd3ad95c0cee2732c3e1ec5 02-Jun-2009 Johannes Berg <johannes@sipsolutions.net> rfkill: rewrite

This patch completely rewrites the rfkill core to address
the following deficiencies:

* all rfkill drivers need to implement polling where necessary
rather than having one central implementation

* updating the rfkill state cannot be done from arbitrary
contexts, forcing drivers to use schedule_work and requiring
lots of code

* rfkill drivers need to keep track of soft/hard blocked
internally -- the core should do this

* the rfkill API has many unexpected quirks, for example being
asymmetric wrt. alloc/free and register/unregister

* rfkill can call back into a driver from within a function the
driver called -- this is prone to deadlocks and generally
should be avoided

* rfkill-input pointlessly is a separate module

* drivers need to #ifdef rfkill functions (unless they want to
depend on or select RFKILL) -- rfkill should provide inlines
that do nothing if it isn't compiled in

* the rfkill structure is not opaque -- drivers need to initialise
it correctly (lots of sanity checking code required) -- instead
force drivers to pass the right variables to rfkill_alloc()

* the documentation is hard to read because it always assumes the
reader is completely clueless and contains way TOO MANY CAPS

* the rfkill code needlessly uses a lot of locks and atomic
operations in locked sections

* fix LED trigger to actually change the LED when the radio state
changes -- this wasn't done before

Tested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> [thinkpad]
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b57f7e7b836d271902b8b7b1ec8cf9312dc5d228 14-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: bump up version to 0.23

Plenty of high-profile changes, so it deserves a new version number.

Features added since 0.22:
* Restrict unsafe LEDs
* New race-less brightness control strategy for IBM ThinkPads
* Disclose TGID of driver access from userspace (debug)
* Warn when deprecated functions are used

Other changes:
* Better debug messages in some subdrivers
* Removed "hotkey disable" support, since it breaks the driver
* Dropped "ibm-acpi" alias

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
922fe097b1e8f2f2f23dbed61cfe6e0316fecff1 14-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: simplify module autoloading

Simplify the module autoloading a great deal, by keying to the HID for
the HKEY interface.

Only _really_ ancient IBM ThinkPad models like the 240, 240x and 570
lack the HKEY interface, and they're getting their own trimmed-down
driver one of these days.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
f68f53a217b827580647d23fdc34eecdcb3739c6 14-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix use of MODULE_AUTHOR

Fix the module to use one instance of MODULE_AUTHOR per author.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
75bd3bf2ade9d548be0d2bde60b5ee0fdce0b127 14-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: fix LED blinking through timer trigger

The set_blink hook code in the LED subdriver would never manage to get
a LED to blink, and instead it would just turn it on. The consequence
of this is that the "timer" trigger would not cause the LED to blink
if given default parameters.

This problem exists since 2.6.26-rc1.

To fix it, switch the deferred LED work handling to use the
thinkpad-acpi-specific LED status (off/on/blink) directly.

This also makes the code easier to read, and to extend later.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: stable@kernel.org
Signed-off-by: Len Brown <len.brown@intel.com>
406e988bef742aa74cdc1f5fafc812ecebf7c02b 14-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: silence hotkey enable warning for module parameter

Avoid the WARN() when the procfs handler for hotkey enable is used by
a module parameter. Instead, urge the user to stop doing that.

Reported-by: Niel Lambrechts <niel.lambrechts@gmail.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
0e501834f8c2ba7de2a56e332d346dcf4ac0b593 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: rework brightness support

Refactor and redesign the brightness control backend...

In order to fix bugzilla #11750...

Add a new brightness control mode: support direct NVRAM checkpointing
of the backlight level (i.e. store directly to NVRAM without the need
for UCMS calls), and use that together with the EC-based control.
Disallow UCMS+EC, thus avoiding races with the SMM firmware.

Switch the models that define HBRV (EC Brightness Value) in the DSDT
to the new mode. These are: T40-T43, R50-R52, R50e, R51e, X31-X41.

Change the default for all other IBM ThinkPads to UCMS-only. The
Lenovo models already default to UCMS-only.

Reported-by: Alexey Fisher <bug-track@fisher-privat.net>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
74a60c0f828016456fc635feae388ffd12bb3bb9 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: enhanced debugging messages for the fan subdriver

Enhance debugging messages for the fan subdriver.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
56e2c200945dafafb86169762eb1e88aed0ce69e 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: enhanced debugging messages for the hotkey subdriver

Enhance debugging messages for the hotkey subdriver.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
bee4cd9b9eaa8c72832e1ee7f4940604e94beb27 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: enhanced debugging messages for rfkill subdrivers

Enhance debugging messages for all rfkill subdrivers in thinkpad-acpi.

Also, log a warning if the deprecated sysfs attributes are in use.
These attributes are going to be removed sometime in 2010.

There is an user-visible side-effect: we now coalesce attempts to
enable/disable bluetooth or WWAN in the procfs interface, instead of
hammering the firmware with multiple requests.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
a4d5effcc73749ee3ebbf578d162905e6fa4e07d 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: restrict access to some firmware LEDs

Some of the ThinkPad LEDs indicate critical conditions that can cause
data loss or cause hardware damage when ignored (e.g. force-ejecting
a powered up bay; ignoring a failing battery, or empty battery; force-
undocking with the dock buses still active, etc).

On almost all ThinkPads, LED access is write-only, and the firmware
usually does fire-and-forget signaling on them, so you effectively
lose whatever message the firmware was trying to convey to the user
when you override the LED state, without any chance to restore it.

Restrict access to all LEDs that can convey important alarms, or that
could mislead the user into incorrectly operating the hardware. This
will make the Lenovo engineers less unhappy about the whole issue.

Allow users that really want it to still control all LEDs, it is the
unaware user that we have to worry about.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
2586d5663d0a17d69383acf6110f16a979a07c4e 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: remove HKEY disable functionality

The HKEY disable functionality basically cripples the entire event
model of the ThinkPad firmware and of the thinkpad-acpi driver.
Remove this functionality from the driver. HKEY must be enabled at
all times while thinkpad-acpi is loaded, and disabled otherwise.

For sysfs, according to the sysfs ABI and the thinkpad-acpi sysfs
rules of engagement, we will just remove the attributes. This will be
done in two stages: disable their function now, after two kernel
releases, remove the attributes.

For procfs, we call WARN(). If nothing triggers it, I will simply
remove the enable/disable commands entirely in the future along with
the sysfs attributes.

I don't expect much, if any fallout from this. There really isn't any
reason to mess with hotkey_enable or with the enable/disable commands
to /proc/acpi/ibm/hotkey, and this has been true for years...

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
73a94d86a8625371f76de0ee12dc5bacd3ed42c0 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: add new debug helpers and warn of deprecated atts

Add a debug helper that discloses the TGID of the userspace task
attempting to access the driver. This is highly useful when dealing
with bug reports, since often the user has no idea that some userspace
application is accessing thinkpad-acpi...

Also add a helper to log warnings about sysfs attributes that are
deprecated.

Use the new helpers to issue deprecation warnings for bluetooth_enable
and wwan_enabled, that have been deprecated for a while, now.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
7ff8d62f7f055aaffbeb493863136c1b876bbe2e 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: add missing log levels

Add missing log levels in a standalone commit, to avoid dependencies in
future unrelated changes, just because they wanted to use one of the
missing log levels.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
3dcc2c3b00cad01a0e3667607f8644e891e4dc8b 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: cleanup debug helpers

Fix the vdbg_printk macro definition to be sane when
CONFIG_THINKPAD_ACPI_DEBUG is undefined, and move the mess into a file
section of its own.

This doesn't change anything in the current code, but future code will
need the proper behaviour.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
257bc1cb3e29c8da62b9c9e0a4505011776c7040 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: drop ibm-acpi alias

The driver was renamed two years ago, on 2.6.21. Drop the old
compatibility alias, we have given everybody quite enough time
to update their configs to the new name.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
1c762ca438447fa3525d84f4a0784a2021a66200 04-Apr-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> thinkpad-acpi: update copyright notices

It is that time of the year again...

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
99b76233803beab302123d243eea9e41149804f3 25-Mar-2009 Alexey Dobriyan <adobriyan@gmail.com> proc 2/2: remove struct proc_dir_entry::owner

Setting ->owner as done currently (pde->owner = THIS_MODULE) is racy
as correctly noted at bug #12454. Someone can lookup entry with NULL
->owner, thus not pinning enything, and release it later resulting
in module refcount underflow.

We can keep ->owner and supply it at registration time like ->proc_fops
and ->data.

But this leaves ->owner as easy-manipulative field (just one C assignment)
and somebody will forget to unpin previous/pin current module when
switching ->owner. ->proc_fops is declared as "const" which should give
some thoughts.

->read_proc/->write_proc were just fixed to not require ->owner for
protection.

rmmod'ed directories will be empty and return "." and ".." -- no harm.
And directories with tricky enough readdir and lookup shouldn't be modular.
We definitely don't want such modular code.

Removing ->owner will also make PDE smaller.

So, let's nuke it.

Kudos to Jeff Layton for reminding about this, let's say, oversight.

http://bugzilla.kernel.org/show_bug.cgi?id=12454

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
877d03105d04b2c13e241130277fa69c8d2564f0 26-Jan-2009 Nick Andrew <nick@nick-andrew.net> trivial: Fix misspelling of firmware

Fix misspelling of firmware.

Signed-off-by: Nick Andrew <nick@nick-andrew.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
b36a50f92d1c4300a88f606b4d2bbdc4f442a2d7 14-Mar-2009 Mathieu Chouquet-Stringer <mchouque@free.fr> thinkpad-acpi: fix module autoloading for older models

Looking at the source, there seems to be a missing * to match my DMI
string. I mean for newer IBM and Lenovo's laptops you match either one
of the following:
MODULE_ALIAS("dmi:bvnIBM:*:svnIBM:*:pvrThinkPad*:rvnIBM:*");
MODULE_ALIAS("dmi:bvnLENOVO:*:svnLENOVO:*:pvrThinkPad*:rvnLENOVO:*");

While for older Thinkpads, you do this (for instance):
IBM_BIOS_MODULE_ALIAS("1[0,3,6,8,A-G,I,K,M-P,S,T]");

with IBM_BIOS_MODULE_ALIAS being MODULE_ALIAS("dmi:bvnIBM:bvr" __type "ET??WW")

Note there's no * terminating the string. As result, udev doesn't load
anything because modprobe cannot find anything matching this (my
machine actually):

udevtest: run: '/sbin/modprobe dmi:bvnIBM:bvr1IET71WW(2.10):bd06/16/2006:svnIBM:pn236621U:pvrNotAv

Signed-off-by: Mathieu Chouquet-Stringer <mchouque@free.fr>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
aa2fbcec07b0d594808bc3058692395d24eba66e 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: bump up version to 0.22

It is about time to bump up the version.

Features added since 0.21: fan suspend/resume support, preserve radio
state across power off (for some radio types), built-in UWB radio
rfkill support and thermal alarm events support.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
54926ce8d2db7ebcbc4b80aae2cec571cd793e46 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: handle HKEY event 6030

HKEY event 0x6030 is a helper for Lenovo's Advanced Thermal Management
Windows driver, which is, of course, completely undocumented.

Silence any warnings about it being an unknown alarm, and report it
unmodified for userspace.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
1c2ece758a36b48133717e4db060fbe8fa52c5cd 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: clean-up fan subdriver quirk

Better document the Unitialized HFSP quirk, and modularize it a bit.
This makes the code flow easier to read and reduces LOC.

Apply the Unitialized HFSP closer to the source (i.e. inside the
get_fan_status()), this fixes a harmless buglet where at driver init
with the quirk active, the user could set the hwmon pwm1 attribute and
switch out of pwm1_mode=2 to pwm1_mode=0 without changing pwm1_mode
directly.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Tino Keitel <tino.keitel@tikei.de>
Signed-off-by: Len Brown <len.brown@intel.com>
cb4293589855714b6d5079336019bf2af5fc41f8 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: start the event hunt season

Ask users to tell us about any unhandled events they find.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
106b4e6657e10831f35c32afa26d9c11e6312783 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: handle HKEY thermal and battery alarms

Handle some HKEY events that are actually firmware alarms. For
now, we do the simple thing: log specific messages to the log and let
the thinkpad-specific event pass to userspace.

In the future, these events will be migrated to generic notifications
and subsystems.

These alarms are NOT available on all ThinkPads. E.g. the T43 only
issues 0x6011 and 0x6012.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
3827e7a3fd03718d4d204c66d9e3ab9b125ae552 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: clean up hotkey_notify()

Clean up the hotkey_notify() handler, which handles the HKEY notifications
from the ACPI firmware. It was getting too long and deep.

No functional changes.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
7646ea88af80a92f2775e17d4283830d7f09ea2d 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: use killable instead of interruptible mutexes

Unfortunately, POSIX in all of its braindamage, do not state that userspace has
to deal with EINTR in read/write and friends... so, lesser code just doesn't.

Switch from *_interruptible to *_killable on the sysfs- and procfs-related
mutexes. This closes this possible can of worms.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
0045c0aa7d5e787f78938e6a10927b8a516f0b83 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: add UWB radio support

Add rfkill support for USB UWB radio devices on very recent ThinkPad
laptop models.

The new subdriver is moslty a trimmed down copy of the wwan subdriver.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
90d9d3c79c44bcf95bc487e9bbceaff2de370310 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: preserve radio state across shutdown

Store in firmware NVRAM the radio state on machine shutdown for WWAN and
bluetooth. Also, try to set the initial boot state of these radios as the
rfkill default state for their respective classes.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
153f82207c51193e4d6a7e6f0e3f9442eabeba1c 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: resume with radios disabled

Instruct the firmware to not enable the radios when resuming. This
is safer, and the rfkill core will take care to manually enable any
radios that need to be enabled.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
a73f30916ee524437253739eacc682f6fb0f3ea8 11-Jan-2009 Henrique de Moraes Holschuh <hmh@hmh.eng.br> ACPI: thinkpad-acpi: debug facility to emulate the rf switches

This code is required to keep the thinkpad-acpi maintainer sane, and
it is disabled by default.

Add a debug facility to simulate an rfkill hardware rocker switch, a
bluetooth rfkill soft-switch, a WWAN rfkill soft-switch on thinkpads.

The simulated switches obviously do not kill any radios in hardware or
firmware (unlike the real one). They also don't issue deprecated proc
events.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
e0b36fc5efd610a208b6b80e821a49302ca424ab 11-Jan-2009 Kay Sievers <kay.sievers@vrfy.org> ACPI: thinkpad-acpi: struct device - replace bus_id with dev_name(), dev_set_name()

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
41b16dce390510f550a4d2b12b98e0258bbed6e2 01-Dec-2008 Len Brown <len.brown@intel.com> create drivers/platform/x86/ from drivers/misc/

Move x86 platform specific drivers from drivers/misc/
to a new home under drivers/platform/x86/.

The community has been maintaining x86 vendor-specific
platform specific drivers under /drivers/misc/ for a few years.
The oldest ones started life under drivers/acpi.
They moved out of drivers/acpi/ because they don't actually
implement the ACPI specification, but either simply
use ACPI, or implement vendor-specific ACPI extensions.

In the future we anticipate...
drivers/misc/ will go away.
other architectures will create drivers/platform/<arch>

Signed-off-by: Len Brown <len.brown@intel.com>