Commit graph

73 commits

Author SHA1 Message Date
Maciej S. Szmigiero
fffcad87d4 hp-wmi: Remove GPS rfkill support via pre-2009 interface
GPS rfkill support via pre-2009 WMI interface uses hp_wmi_get_sw_state()
and hp_wmi_get_hw_state() to query its current hard and soft block state,
respectively.

In hp_wmi_get_sw_state() a mask is calculated which bit should be checked
in an int value returned by firmware to get current block state: 0x200 <<
(r * 8) which with r being 3 for GPS results in overflow and mask of zero.
The same goes for hp_wmi_get_hw_state().

This effectively means that GPS rfkill on this WMI interface is considered
always both hard and soft blocked.

Unfortunately, later when rfkill subsystem calls hp_wmi_set_block() to sync
this block to hardware firmware at least on my old nc6400 gets confused and
sets both hard and soft blocks on WiFi and BT.

This happens for example on hp-wmi module load.

Since due to overflow described above it is dubious that this ever worked
correctly and HP laptops with modems having GPS support seem to all have
been released well past year 2009 let's just remove GPS rfkill support via
pre-2009 WMI interface.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-23 10:05:51 -07:00
Maciej S. Szmigiero
c7805e5459 hp-wmi: fix unregister order in hp_wmi_rfkill_setup() once again
rfkill registration order in hp_wmi_rfkill_setup() is:
1) WiFi,
2) BT,
3) WWAN,
5) GPS.

Unregistration when cleaning up on error return should happen in reverse
order.

This means that: If BT rfkill fails to be allocated we possibly need to
first unregister WiFi rfkill before destroying it.

The same goes with (WWAN, BT) and (GPS, WWAN) pairs.

Also, if WWAN rfkill fails to register we need to (possibly) unregister BT
not the GPS one.  And if GPS rfkill fails to register we need to unregister
WWAN not the BT one.

We never need to unregister GPS rfkill here since if GPS rfkill
registration succeeds this function returns without error so no cleanup is
necessary.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-23 10:05:51 -07:00
Kyle Evans
8a1513b493 hp-wmi: limit hotkey enable
Do not write initialize magic on systems that do not have
feature query 0xb. Fixes Bug #82451.

Redefine FEATURE_QUERY to align with 0xb and FEATURE2 with 0xd
for code clearity.

Add a new test function, hp_wmi_bios_2008_later() & simplify
hp_wmi_bios_2009_later(), which fixes a bug in cases where
an improper value is returned. Probably also fixes Bug #69131.

Add missing __init tag.

Signed-off-by: Kyle Evans <kvans32@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-09-17 18:14:11 -07:00
Stefan Brüns
e92865edeb Input: use more descriptive KEY_ROTATE_DISPLAY instead of KEY_DIRECTION
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-03-06 17:18:16 -08:00
Wolfram Sang
3493f4144b platform: x86: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:21:27 +02:00
Mathias Krause
702ef54255 hp-wmi: Add missing __init annotations to initialization code
These functions are only called from other initialization routines, so
can be marked __init, too.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-08-16 01:23:53 -07:00
Kyle Evans
f82bdd0d77 hp-wmi: Enable hotkeys on some systems
This is a third attempt to enable these buttons. The new variable being
commit 997daa1bd9 (i.e. hp-wmi: detect
"2009 BIOS or later"). Older systems that do not have the 2009 BIOS query
method respond with a dummy value, in this case 4. Using that, we can
target a fairly narrow group of systems. i.e. old enough to not have
HPWMI_FEATURE_QUERY 0xd, but new enough to have HPWMI_BIOS_QUERY 0x9.
This group may be further limited if some systems respond with something
other than 4 to non-existant feature queries.

Signed-off-by: Kyle Evans <kvans32@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-06-10 19:11:11 -04:00
Alex Hung
997daa1bd9 hp-wmi: detect "2009 BIOS or later" flag by WMI 0x0d for wireless cmd
Some HP BIOS has dummy WMI 0x05 cmd and it causes wireless set cmd to fail.
This patch fixes the problem by detecting "2009 BIOS or later" flag which
determines whether WMI 0x1b is supported and is used to replace WMI 0x05.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-11-20 18:51:03 -05:00
Kirill Tkhai
5b5c2b3c9b hp_wmi: Fix unregister order in hp_wmi_rfkill_setup()
Register order is:
			wifi
			bluetooth
			wwan
			gps

So unregister order must be:
			gps
			wwan
			bluetiith
			wifi

But currently gps and wwan are swapped. Fix that.
Also fix goto links.

Signed-off-by: Kirill Tkhai <tkhai@yandex.ru>
CC: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-09-05 08:51:59 -04:00
Matthew Garrett
41c8bd1c75 Revert "hp-wmi: Enable hotkeys on some systems"
This reverts commit b253c9d1d8. It's still
causing problems on some systems.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-08-18 13:23:31 -04:00
Alex Hung
8667ca9518 hp-wmi: add supports for POST code error
HP laptops include a POST code error query 0x2A that reports
which point BIOS fails to boot at. The error code is kept in CMOS
until it is cleared.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-07-10 15:42:48 -04:00
Matthew Garrett
b253c9d1d8 hp-wmi: Enable hotkeys on some systems
Kyle Evans discovered that he needed to set some bits in an EC register in
order to receive hotkey events. Doing so blindly broke some otherwise
working HP laptops. It turns out that there's a WMI call that accesses
the same register, so let's try calling that instead.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Cc: Kyle Evans <kvans32@gmail.com>
2013-07-08 11:44:40 -04:00
lan,Tianyu
af1d486c18 x86 / platform / hp_wmi: Fix bluetooth_rfkill misuse in hp_wmi_rfkill_setup()
HP wmi platform driver fails to initialize GPS and causes poweroff
failure in HP Elitebook 6930p.

Call Trace:
 [<ffffffffa088d25a>] hp_wmi_bios_setup+0x25a/0x3a0 [hp_wmi]
 [<ffffffff8135978c>] platform_drv_probe+0x3c/0x70
 [<ffffffff81356d6a>] ? driver_sysfs_add+0x7a/0xb0
 [<ffffffff81357407>] driver_probe_device+0x87/0x3a0
 [<ffffffff813577f3>] __driver_attach+0x93/0xa0
 [<ffffffff81357760>] ? __device_attach+0x40/0x40
 [<ffffffff81355403>] bus_for_each_dev+0x63/0xa0
 [<ffffffff81356e8e>] driver_attach+0x1e/0x20
 [<ffffffff81356a28>] bus_add_driver+0x1f8/0x2b0
 [<ffffffff81357e81>] driver_register+0x71/0x150
 [<ffffffff813594e6>] platform_driver_register+0x46/0x50
 [<ffffffff813595ab>] platform_driver_probe+0x1b/0xa0
 [<ffffffffa088d55e>] hp_wmi_init+0x1be/0x1fb [hp_wmi]
 [<ffffffffa088d3a0>] ? hp_wmi_bios_setup+0x3a0/0x3a0 [hp_wmi]
 [<ffffffff8100210a>] do_one_initcall+0x10a/0x160
 [<ffffffff810bdac6>] load_module+0x1b46/0x2640
 [<ffffffff8128da20>] ? ddebug_proc_write+0xf0/0xf0
 [<ffffffff810be662>] sys_init_module+0xa2/0xf0
 [<ffffffff814d975d>] system_call_fastpath+0x1a/0x1f
Code: 48 ff ff ff 80 7b 24 00 74 d2 41 83 e5 01 45 38 ec 74 c9 48 8d bb a0 03 00 00 e8 ed fb aa e0 5b 41 5c 41 5d 44 89 f0 41 5e 5d c3 <0f> 0b 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66
RIP  [<ffffffffa05c57af>] rfkill_set_hw_state+0x9f/0xb0 [rfkill]
 RSP <ffff880071523b60>

Check code and find this error is caused by misusing variable bluetooth_rfkill
where gps_rfkill should be.

Reported-and-tested-by: Iru Cai <mytbk920423@gmail.com>
References: https://bugzilla.kernel.org/show_bug.cgi?id=58401
Cc: All <stable@vger.kernel.org>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-06-01 23:51:48 +02:00
Alex Hung
d9e290a0ff hp-wmi: add more definitions for new event_id's
New HP laptops start generating new events, and hp-wmi prints unknown
event_ids for them. This patch also removes these messages

Signed-off-by: Alex Hung <alex.hung@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-05-08 19:59:44 -04:00
Matthew Garrett
c857b7f45b Revert "hp-wmi: Add support for SMBus hotkeys"
This reverts commit fabf85e3ca which breaks
hotkey support on some other HP laptops. We'll try doing this differently
in 3.10.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-04-18 14:53:10 -07:00
Dmitry Torokhov
c165b80cfe hp-wmi: fix handling of platform device
The driver will not quite work if someone unbinds the platform device
from the platform driver via sysfs (moreover it will bomb is the driver
built into the kernel as hp_wmi_bios_remove is marked as __exit and will
not be present in the kernel).

To fix it let's use platform_driver_probe() instead of
platform_driver_register(), which disables binding/unbinding via sysfs.
This also allows us to mark hp_wmi_bios_setup as __init and discard it
once module is initialized.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-02-27 08:30:43 -05:00
Kyle Evans
fabf85e3ca hp-wmi: Add support for SMBus hotkeys
Several models of HP laptops using the same DSDT have hotkey buttons
that do not work until the EC is configured to enable them.

Signed-off-by: Kyle Evans <kvans32@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-02-27 08:30:42 -05:00
Trepák Vilmos
4fca7ce39f Platform: hp-wmi: add rfkill support for integrated GPS
Add rfkill support for the GPS radio found in HP laptops (HP Elitebook 2170p and the like)
using the Ericsson F5321/H5321 Mobile Broadband Module.

Signed-off-by: Viliam Trepák <trepo@netcomga.sk>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-02-24 14:49:56 -08:00
Greg Kroah-Hartman
b859f15921 Drivers: platform: x86: remove __dev* attributes.
CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Joey Lee <jlee@novell.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Peter Feuerer <peter@piie.net>
Cc: Corentin Chary <corentin.chary@gmail.com>
Cc: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
Cc: Robert Gerlach <khnz@gmx.de>
Cc: Ike Panhc <ike.pan@canonical.com>
Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-03 15:57:03 -08:00
Dan Carpenter
dd258c00b9 hp-wmi: check for allocation failures
rfkill_alloc() returns NULL on failure.  Check for it, to make the
static checkers happy.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2012-05-31 14:29:33 -04:00
Eric Dumazet
0401846c33 hp-wmi: fix use after free
[  191.310008] WARNING: kmemcheck: Caught 32-bit read from freed memory (f0d25f14)
[  191.310011] c056d2f088000000105fd2f00000000050415353040000000000000000000000
[  191.310020]  i i i i f f f f f f f f f f f f f f f f f f f f f f f f f f f f
[  191.310027]                                          ^
[  191.310029]
[  191.310032] Pid: 737, comm: modprobe Not tainted 3.0.0-rc5+ #268 Hewlett-Packard HP Compaq 6005 Pro SFF PC/3047h
[  191.310036] EIP: 0060:[<f80b3104>] EFLAGS: 00010286 CPU: 0
[  191.310039] EIP is at hp_wmi_perform_query+0x104/0x150 [hp_wmi]
[  191.310041] EAX: f0d25601 EBX: f0d25f00 ECX: 000121cf EDX: 000121ce
[  191.310043] ESI: f0d25f10 EDI: f0f97ea8 EBP: f0f97ec4 ESP: c173f34c
[  191.310045]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[  191.310046] CR0: 8005003b CR2: f540c000 CR3: 30f30000 CR4: 000006d0
[  191.310048] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[  191.310050] DR6: ffff4ff0 DR7: 00000400
[  191.310051]  [<f80b317b>] hp_wmi_dock_state+0x2b/0x40 [hp_wmi]
[  191.310054]  [<f80b6093>] hp_wmi_init+0x93/0x1a8 [hp_wmi]
[  191.310057]  [<c10011f0>] do_one_initcall+0x30/0x170
[  191.310061]  [<c107ab9f>] sys_init_module+0xef/0x1a60
[  191.310064]  [<c149f998>] sysenter_do_call+0x12/0x28
[  191.310067]  [<ffffffff>] 0xffffffff

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-07-11 09:52:35 -04:00
Joe Perches
b5a4223c1c hp-wmi: Convert printks to pr_<level>
Added pr_fmt and converted printks to pr_<level>.
Removed now unused PREFIX and UNIMPL #defines.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-05-27 12:35:48 -04:00
Anssi Hannula
c0b9c64944 hp-wmi: add rfkill support for wireless query 0x1b
Some recent HP laptops use a new wireless query command type 0x1b.

Add support for it. Tested on HP Mini 5102.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-03-28 06:07:19 -04:00
Anssi Hannula
7cd635da42 hp-wmi: make rfkill initialization failure non-fatal
hp_wmi_rfkill_setup cleans up after itself now, so failing completely is
no longer necessary.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-03-28 06:07:19 -04:00
Anssi Hannula
6d97db590c hp-wmi: clear rfkill device pointers when appropriate
NULLify rfkill pointers during initialization. This prevents dereference
of invalid pointer in case the driver is rebound and some rfkill device
isn't detected anymore. Clear them also in hp_wmi_rfkill_setup failure
path so that an rfkill initialization failure doesn't need to be fatal
for the whole driver.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-03-28 06:07:18 -04:00
Anssi Hannula
eceb7bdf64 hp-wmi: split rfkill initialization out of hp_wmi_bios_setup
Split initialization of rfkill devices from hp_wmi_bios_setup() to
hp_wmi_rfkill_setup(). This makes the code somewhat cleaner, especially
with the future command 0x1b rfkill support.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-03-28 06:07:18 -04:00
Anssi Hannula
c3021ea1be hp-wmi: allow setting input and output buffer sizes separately
Split buffersize parameter of hp_wmi_perform_query to insize and
outsize. Existing callers are changed to use the same value for insize
and outsize to avoid any regressions, with the exception of
hp_wmi_set_block where the output buffer is unused and therefore outsize
is set to 0 (this change is not seen by BIOS code).

The maximum input buffer size is kept at 4 bytes as per struct
bios_args. Some commands exist that take longer buffers, but they
haven't been implemented. The data portion of bios_args can be trivially
made dynamically allocated later when such larger buffers become needed.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-03-28 06:07:18 -04:00
Anssi Hannula
25bb067a08 hp-wmi: remove a variable that is never read
Remove the status variable from hp_wmi_perform_query which holds the
return value from wmi_evaluate_method(). It is never checked as the
function bails out if the output buffer hasn't been allocated which
indicates the call failed.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-03-28 06:07:18 -04:00
Anssi Hannula
9af0e0fb70 hp-wmi: check query return value in hp_wmi_perform_query
Check BIOS provided return value code in hp_wmi_perform_query and print
a warning on error. Printing is suppressed for HPWMI_RET_UNKNOWN_CMDTYPE
which is returned when the command type is unsupported.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-03-28 06:07:17 -04:00
Zeng Zhaoming
53c96dfdd0 ACPI, hp-wmi: Fix memory leak in acpi query
Free acpi return memory after query.

Signed-off-by: Zeng Zhaoming <zengzm.kernel@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-11-24 12:07:10 -05:00
Dmitry Torokhov
4d291ed721 Input: hp-wmi - switch to using sparse keymap library
Instead of implementing its own version of keymap hanlding switch over
to using sparse keymap library.

Also make sure that we install notify handler only after we allocated
input device and that we remove notify handler before unregistering
input device.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-10-21 09:36:43 -04:00
Matthew Garrett
a8ec105c07 hp-wmi: Fix query interface
The machines I have appear to provide their return value in the arguments
structure, not the output structure. Rework the driver to use that again
in order to get rfkill working again.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-23 16:27:08 -04:00
Thomas Renninger
7a0691c16f hp-wmi: acpi_drivers.h is already included through acpi.h two lines below
Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: linux-acpi@vger.kernel.or
CC: platform-driver-x86@vger.kernel.org
CC: mjg@redhat.com
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:12 -04:00
Thomas Renninger
c4775062d5 hp-wmi: Fix mixing up of and/or directive
This should have been an "and". Additionally checking for !obj
is even better.

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: linux-acpi@vger.kernel.or
CC: platform-driver-x86@vger.kernel.org
CC: mjg@redhat.com
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:12 -04:00
Axel Lin
bc28596a8f hp-wmi: add return value checking for input_allocate_device()
Add error checking and return -ENOMEM if input_allocate_device() fail.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:02 -04:00
Thomas Renninger
b096667bc3 hp-wmi: return -ENODEV if BIOS does not export any supported hp wmi guid
Signed-off-by: Thomas Renninger <trenn@suse.de>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:54 -04:00
Axel Lin
97ba0af097 acer-wmi/hp-wmi: use platform_device_unregister instead of platform_device_del in module_exit
platform_device_unregister will also call platform_device_put() to drop reference count.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:49 -04:00
Axel Lin
dfec5c48cd hp-wmi: add error handling for hp_wmi_init
Current implementation in hp_wmi_init does not check any error and always
return success.
This patch properly handles recource reclaim and return err in error path.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:47 -04:00
Thomas Renninger
6d96e00cef X86 platform: hp-wmi Better match the HP WMI query interface
- Improve error handling, by explictly return zero for success, error otherwise
- WMI query command can have arbitrary input sized params
- WMI query command can have specific output sized params (0, 4, 128,..) byte

I like to go on here, but this is a rather intrusive change that should
be looked at first. I am sure the one or other thing can be done better or
there might be typo/bug somewhere.

This did not get any testing yet, only compile tested.

Next steps could be:
  - Eventually introduce hp_wmi_perform_{read,write}_query macros
  - Introduce new wireless query interface (0x1B)
  - more

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
2010-08-03 09:48:43 -04:00
Thomas Renninger
8dda6b0410 x86 platform drivers: hp-wmi fix buffer size depending on ACPI version
Depending on ACPI version (1.0 -> 32 bit) an integer could be
32 or 64 bit long. _WED internal concatenates two integers and
the return value will be 8 byte (2* 32 bit) or 16 byte (2* 64 bit)
long, depending on the ACPI version.

Also the data send with the WMI event is defined to be splitted into:
  - Event ID -> 4 bytes
  - Event Data -> 4 bytes

This gets messed up with new ACPI versions.
But it's a HP BIOS bug that may get fixed in the future
-> Support both, 16 and 8 byte _WED buffers.

Also the wrong assumption that from the event data sent, only the
first byte is relevant got cleaned up that it fits event_id/event_data
as described above.

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: robert.moore@intel.com
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: platform-driver-x86@vger.kernel.org
CC: linux-acpi@vger.kernel.org
2010-08-03 09:48:43 -04:00
Thomas Renninger
1bbdfd5961 x86 platform drivers: hp-wmi Set placeholder for unimplemented events
Rather than print unknown events when we know what caused them

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
2010-08-03 09:48:42 -04:00
Thomas Renninger
f6b2ff0821 x86 platform drivers: hp-wmi Add media key 0x20e8
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
2010-08-03 09:48:42 -04:00
Thomas Renninger
a2806c6f00 x86 platform drivers: hp-wmi Use consistent prefix string for messages.
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
2010-08-03 09:48:41 -04:00
Thomas Renninger
da9a79ba58 x86 platform drivers: hp-wmi Catch and log unkown event and key codes correctly
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
2010-08-03 09:48:41 -04:00
Thomas Renninger
751ae808f6 x86 platform drivers: hp-wmi Reorder event id processing
Event id 0x4 defines the hotkey event.
No need (or even wrong) to query HPWMI_HOTKEY_QUERY if event id is != 0x4.

Reorder the eventcode conditionals and use switch case instead of if/else.
Use an enum for the event ids cases.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
2010-08-03 09:48:40 -04:00
Tejun Heo
5a0e3ad6af 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>
2010-03-30 22:02:32 +09:00
Dmitry Torokhov
58b939959d Input: scancode in get/set_keycodes should be unsigned
The HID layer has some scan codes of the form 0xffbc0000 for logitech
devices which do not work if scancode is typed as signed int, so we need
to switch to unsigned it instead. While at it keycode being signed does
not make much sense either.

Acked-by: Márton Németh <nm127@freemail.hu>
Acked-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-03-08 23:19:15 -08:00
Uwe Kleine-König
ea79632d90 x86: move hp-wmi's probe function to .devinit.text
A pointer to hp_wmi_bios_setup is passed to the core via
platform_driver_register and so the function must not disappear when the
.init sections are discarded.  Otherwise (if also having HOTPLUG=y)
unbinding and binding a device to the driver via sysfs will result in an
oops as does a device being registered late.

An alternative to this patch is using platform_driver_probe instead of
platform_driver_register plus removing the pointer to the probe function
from the struct platform_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Frans Pop <elendil@planet.nl>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-07 17:04:50 -08:00
Matthew Garrett
caeacf59af hp-wmi: Add support for tablet rotation key
The HP touchsmart tablet has a key for rotating the UI from landscape to
portrait. Add support for it.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-02-25 11:50:54 -05:00
Anisse Astier
c9c041fcb1 hp-wmi: remove double free caused by merge conflict
Commit 3e9b988e4e
"wmi: Free the allocated acpi objects through wmi_get_event_data"
had the same purpose as commit
44ef00e648
"hp-wmi: Fix two memleaks"

This should solve this regression:

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

Signed-off-by: Anisse Astier <anisse@astier.eu>
Reported-by: Sedat Dilek <sedat.dilek@googlemail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2010-01-01 14:04:25 -05:00