Commit graph

633 commits

Author SHA1 Message Date
Thomas Renninger
a420e46412 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>
2010-08-03 09:49:06 -04:00
Axel Lin
9fab10cdf5 panasonic-laptop: fix acpi_pcc_write_sset return value
In current implementation, acpi_pcc_write_sset return 1
if write is successful, 0 if write is failed.
But all the callers consider acpi_pcc_write_sset return 0
if write is successful and return negtive if write is failed.

This patch changes the implementation of acpi_pcc_write_sset to
return 0 if write is successful, -EIO if write is failed.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:05 -04:00
Axel Lin
bfa47960f9 eeepc-laptop: fix hotplug_disabled module_param permissions
The hotplug_disabled module parameter is determinated at the module load
time.  Change the value after the module is loaded does not make sense and
has no effect at all, thus set the permissions to 0444 instead of 0644.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:05 -04:00
Axel Lin
c26d85cb90 asus-laptop: fix wapf, wlan_status and bluetooth_status module_param permissions
The wapf module parameters defines the behavior of the Fn+Fx wlan key.
The wlan_status and bluetooth_status module parameters are for setting the
wlan/bluetooth status on boot.

All above module parameters are determinated only at the module load time.
 Change the value after the module is loaded does not make sense and has
no effect at all, thus set the permissions to 0444 instead of 0644.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:05 -04:00
Axel Lin
ff2367d1d5 acer-wmi: remove non-used acer_quirks struct definition
Remove non-used acer_quirks struct definition.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:04 -04:00
Axel Lin
7677fbdff1 acer-wmi: fix memory leaks in wmab_execute error path
When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER, the caller
must kfree the returned buffer if AE_OK is returned.

Call Trace:
wmab_execute
  -> wmi_evaluate_method
    -> acpi_evaluate_object

Thus if callers of wmab_execute() pass ACPI_ALLOCATE_BUFFER, the return
buffer must be kfreed if wmab_execute return AE_OK.

[akpm@linux-foundation.org: avoid multiple return points, remove unneeded cast, remove unneeded initialisation of `status']
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:04 -04:00
Axel Lin
669048639c acer-wmi: fix memory leaks in WMID_set_capabilities and get_wmid_devices
When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER, the caller
must kfree the returned buffer if AE_OK is returned.

The callers of wmi_query_block() pass ACPI_ALLOCATE_BUFFER, and thus must
check its return value before accessing or kfree() on the buffer.

This patch adds a missing kfree(out.pointer) before exit
WMID_set_capabilities() and get_wmid_devices().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
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:03 -04:00
Axel Lin
f8ef3aecab toshiba_acpi: rename add_device() and remove_device() to create_toshiba_proc_entries() and remove_toshiba_proc_entries()
To improve readability rename add_device() to
create_toshiba_proc_entries() and rename remove_device() to
remove_toshiba_proc_entries().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Márton Németh <nm127@freemail.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:03 -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
Axel Lin
1bd1ca1f4c toshiba_acpi: make remove_device() and add_device() void
remove_device() and add_device() are not related to ACPI APIs, it does not
make sense to return acpi_status for both functions.

Current implementation of add_device() always AE_OK, thus the return value
checking for add_device() always return false for ACPI_FAILURE(status).
This patch makes add_device() to be void and remove the unnecessary return
value checking.

remove_proc_entry() won't fail, thus change remove_device() to be void.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Márton Németh <nm127@freemail.hu>
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
Axel Lin
a0dba697ee acerhdf: fix resource reclaim in error path
Fix resource reclaim in below cases:

1. acerhdf_register_platform() does not properly handle
   platform_device_alloc() failure and platform_device_add() failure This
   patch adds error handing for acerhdf_register_platform().

2. acerhdf_register_platform() return err with acerhdf_dev == NULL.
   as a result, acerhdf_unregister_platform() does not do resource reclaim
   in acerhdf_init() error path.  This patch adds error handing for
   acerhdf_register_platform(), thus correct the error handing path in
   acerhdf_init().  goto out_err instead of err_unreg if
   acerhdf_register_platform() fail.

3. platform_device_del() should only used in error handling.  Current
   implementation missed a platform_device_put() in acerhdf_exit.  This
   patch fixes it by using platform_device_unregister() instead of
   platform_device_del() in acerhdf_unregister_platform.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Peter Feuerer <peter@piie.net>
Cc: Matthew Garrett <mjg@redhat.com>
Acked-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:01 -04:00
Axel Lin
6a984a0648 asus-laptop: return proper error for store_ledd if write_acpi_int fail
In current implementation, store_ledd() does not return error if
write_acpi_int fail.  This patch fixes it by return -ENODEV if
write_acpi_int fail.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:01 -04:00
Axel Lin
9fb866f317 asus-laptop: fix incorrect return value for write_acpi_int_ret if handle is NULL
According to the comments of write_acpi_int_ret(), write_acpi_int_ret()
should return 0 if write is successful, -1 else.  Thus if handle is NULL,
the write does not happen, it should return -1.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:01 -04:00
Axel Lin
e38f052ba5 msi-laptop: make struct rfkill_ops const
rfkill uses a const struct rfkill_ops pointer.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Lennart Poettering <mzxreary@0pointer.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:00 -04:00
Axel Lin
67af711168 fujitsu-laptop: make needlessly global symbols static
The following symbols are needlessly defined global:

logolamp_led
kblamps_led

This patch makes the symbols static.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:00 -04:00
Axel Lin
df92754ddd classmate-laptop: make needlessly global symbols static
cmpc_accel_sensitivity_attr is needlessly defined global.
This patch makes the symbol static.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Cc: Daniel Oliveira Nascimento <don@syst.com.br>
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:48:59 -04:00
Axel Lin
fedae5ad61 acerhdf: make needlessly global symbols static
The following symbols are needlessly defined global:

thz_dev
cl_dev
acerhdf_dev
acerhdf_dev_ops
acerhdf_cooling_ops

This patch makes the symbols static.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Borislav Petkov <bp@alien8.de>
Acked-by: Peter Feuerer <peter@piie.net>
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:48:59 -04:00
Axel Lin
3bf460f7b2 asus_acpi: fix coding style to improve readability
In the case of no match ( hotk->model == END_MODEL ), the only posible
case to return 0 is to have a Samsung P30 detected.  This patch improves
readability by moving related code after if/else clause to be inside if
clause.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Karol Kozimor <sziwan@users.sourceforge.net>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:58 -04:00
Axel Lin
d47bb5b227 asus_acpi: fix a memory leak in asus_hotk_get_info()
In the case of no match ( hotk->model == END_MODEL ), model sholud be
kfreed before return AE_OK.

This patch includes below fixes:

1. adds a missing kfree(model) before return AE_OK.

2. asus_hotk_get_info should return int, thus return 0 instead of AE_OK.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Karol Kozimor <sziwan@users.sourceforge.net>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:58 -04:00
Axel Lin
80183a4b63 compal-laptop/fujitsu-laptop/msi-laptop: make dmi_check_cb to return 1 instead of 0
dmi_check_system() walks the table running matching functions until
someone returns non zero or we hit the end.

This patch makes dmi_check_cb to return 1 so dmi_check_system() return
immediately when a match is found.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
Cc: Matthew Garrett <mjg@redhat.com>a
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:57 -04:00
Roald Frederickx
9be0fcb5ed compal-laptop: add JHL90, battery & hwmon interface
The driver now supports the Compal JHL90 (which I use) and it has some
added features.  The biggest novelties are a battery interface
(power_supply) and a temperature and fan control interface (hmwon).  It
also adds a power-off feature to the backlight subsystem and it exports a
few files that can enable/disable wake_on_XXX events.

Much of the original code of the old features is still there, but I've
changed some names to keep the naming more coherent with the added
functionalities.  (Sorry for the huge patch)

Some technical stuff about the new driver:

First of all, I'm not sure if the extra features also work on the other
Compal boards.  Currently they only get enabled if the DMI data indicates
you are on a JHL90 board.

Secondly, I've noticed a quirk in my fan controller.  I have to re-send
the wanted pwm-level to the controller every so often.  If I don't do
this, the fanspeed will slowly rise until after a couple of minutes it's
at full speed.  (Note that every normal userland application will probably
update the pwm-level every so often anyway, based on temperature readings,
so this might not be an issue in practice) If this turns out to be a
problem with all the controllers, maybe we should implement a kernel timer
and have the driver re-send the pwm level every XX seconds to make this
transparent to userspace?  (However, I couldn't immediately find a way to
do this cleanly.)

Additional information can be found in the source comments.

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: add missing semicolon]
Signed-off-by: Roald Frederickx <roald.frederickx@gmail.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:57 -04:00
Randy Dunlap
c28341455c compal-laptop: uses hwmon interfaces, depends on HWMON
compal-laptop uses hwmon interfaces, so it should depend on HWMON.

compal-laptop.c:(.devinit.text+0x4071f): undefined reference to `hwmon_device_register'
compal-laptop.c:(.devexit.text+0x6ec0): undefined reference to `hwmon_device_unregister'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Roald Frederickx <roald.frederickx@gmail.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:57 -04:00
Axel Lin
8e4e2efdfa fujitsu-laptop: remove unnecessary input_free_device calls
input_free_device() should only be used if input_register_device() was not
called yet or if it failed.  This patch removes unnecessary
input_free_device calls.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Matthew Garrett <mjg@redhat.com>a
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:56 -04:00
Peter Feuerer
24964639e1 acerhdf: add AO531 and many BIOS versions for 1410, 1810xx and packard bell netbooks
Signed-off-by: Peter Feuerer <peter@piie.net>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Len Brown <lenb@kernel.org>
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:48:56 -04:00
Rahul Chaturvedi
5cf4c07a28 acerhdf: driver didn't verify the pointers in which it got product information
Driver didn't verify the pointers in which it got product information back
from DMI; on QEMU one of the pointers came back null, which made the
driver crash and subsequently caused a kernel panic.

Signed-off-by: Rahul Chaturvedi <rkc@chromium.org>
Signed-off-by: Peter Feuerer <peter@piie.net>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Len Brown <lenb@kernel.org>
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:48:55 -04:00
Peter Feuerer
210183d4af acerhdf: remove "chk_off" as it was only needed for T31 netbooks
Remove "chk_off" as it was only needed for T31 netbooks.  But those
netbooks can also be handled just with "cmd_off" register (0x9e) for
reading the state back.

Signed-off-by: Peter Feuerer <peter@piie.net>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Len Brown <lenb@kernel.org>
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:48:55 -04:00
Peter Feuerer
887b7ca9c5 acerhdf: add new BIOS versions
Add new BIOS versions for Acer 1410 and 1810xx and Packard Bell netbooks.

Fixed registers of Acer AOA150 BIOS version v0.3114: Old registers caused
Fan to spin up at every temperature check.

Signed-off-by: Peter Feuerer <peter@piie.net>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Len Brown <lenb@kernel.org>
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
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
Matthew Garrett
ae42f23447 toshiba-acpi: Add an extra couple of keys
Thomas Bächler reports that his machine generates two keycodes for zooming
in and out. Add these to the default keymap.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Thomas Bächler <thomas@archlinux.org>
2010-08-03 09:48:53 -04:00
Axel Lin
08db2b3141 sony-laptop: use platform_device_unregister in sony_pf_remove
platform_device_unregister calls platform_device_del and platform_device_put,
thus this change is logically equivalent to original code.

I made this change because the documents in platform.c shows that:
platform_device_del and platform_device_put must _only_ be externally called
in error cases.  All other usage is a bug.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:53 -04:00
Axel Lin
32ab72e7ca dell-wmi: fix a memory leak
If dell_new_hk_type is true, dell_legacy_wmi_keymap will point to a memory
allocated in setup_new_hk_map().
In this case, the memory is not freed in current implementation.
This patch fixes the leak by kfree(dell_wmi_keymap) if dell_new_hk_type is true.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:53 -04:00
Axel Lin
d53bf0f324 acer-wmi: make dmi_matched to return 1 instead of 0
dmi_check_system() walks the table running matching functions until someone
returns non zero or we hit the end.

This patch makes dmi_matched to return 1 so dmi_check_system() return
immediately when a match is found.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:52 -04:00
Axel Lin
370525df9d acer-wmi: set permissions on interface file to S_IRUGO
The interface file is not writable, thus set permissions to S_IRUGO.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:52 -04:00
Axel Lin
d8eca1105f asus-laptop: fix a memory leak in asus_laptop_get_info error path
The callers of write_acpi_int_ret() pass ACPI_ALLOCATE_BUFFER,
the caller must kfree the returned buffer if AE_OK is returned.

This patch adds a missing kfree(buffer.pointer) before return -ENOMEM
if kstrdup fail.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:51 -04:00
Axel Lin
1492616a43 wmi: fix a memory leak in wmi_notify_debug
When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER,
the caller must kfree the returned buffer if AE_OK is returned.

The callers of wmi_get_event_data() pass ACPI_ALLOCATE_BUFFER,
and thus must check its return value before accessing
or kfree() on the buffer.

This patch adds return value checking for wmi_get_event_data()
and adds a missing kfree(obj) in the end of wmi_notify_debug

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:51 -04:00
Islam Amer
d5164dbf1f dell-wmi: Add support for eject key on Dell Studio 1555
Fixes pressing the eject key on Dell Studio 1555 does not work and produces
message :

dell-wmi: Unknown key 0 pressed

Signed-off-by: Islam Amer <pharon@gmail.com>
2010-08-03 09:48:50 -04:00
Alan Cox
c715a38bb7 rar: Move the RAR driver into the right place as its now clean
We exit staging rar! rar! rar!...

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-08-03 09:48:50 -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
a5167c5b3a wmi: fix memory leak in parse_wdg
This patch properly kfree out.pointer and gblock 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:49 -04:00
Rezwanul Kabir
410d44c74c dell-laptop: Add another Dell laptop family to the DMI whitelist
This is to support Precision M4500 and others.

Signed-off-by: Rezwanul Kabir <Rezwanul_Kabir@dell.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:49 -04:00
Axel Lin
1c79632bd0 acer-wmi: fix resource reclaim in acer_wmi_init error path
This patch fixes the resource reclaim in acer_wmi_init error path.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:48 -04:00
Jiri Slaby
e9ec7f3539 X86: intel_ips, check for kzalloc properly
Stanse found that there are two NULL checks missing in ips_monitor. So
check their value too and bail out appropriately if the allocation
failed.

While at it, add one more kfree to the fail path. It is not necessary
now, but may be needed in the future when a new allocation is added.
And for completeness.

Also remove unneeded initialization of the variables. They are all set
right after their declaration.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-08-03 09:48:48 -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
Thadeu Lima de Souza Cascardo
b95d13eaf3 classmate-laptop: should check for NULL as retval for rfkill_alloc
rfkill_alloc returns NULL when it fails if RFKILL is enabled. When RFKILL is
disabled, its return value of ERR_PTR(-ENODEV) is OK to use as all rfkill
functions will work with it, as they are simply empty stubs.

Reported-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: platform-driver-x86@vger.kernel.org
Cc: mjg@redhat.com
Cc: don@syst.com.br
Cc: rpurdie@rpsys.net
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:46 -04:00
Jesse Barnes
0385e5210c IPS driver: add GPU busy and turbo checking
Be sure to enable GPU turbo by default at load time and check GPU busy
and MCP exceeded status correctly.  Also fix up CPU power comparison and
work around buggy MCH temp reporting.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:46 -04:00
Jesse Barnes
aa7ffc01d2 x86 platform driver: intelligent power sharing driver
Intel Core i3/5 platforms with integrated graphics support both CPU and
GPU turbo mode.  CPU turbo mode is opportunistic: the CPU will use any
available power to increase core frequencies if thermal headroom is
available.  The GPU side is more manual however; the graphics driver
must monitor GPU power and temperature and coordinate with a core
thermal driver to take advantage of available thermal and power headroom
in the package.

The intelligent power sharing (IPS) driver is intended to coordinate
this activity by monitoring MCP (multi-chip package) temperature and
power, allowing the CPU and/or GPU to increase their power consumption,
and thus performance, when possible.  The goal is to maximize
performance within a given platform's TDP (thermal design point).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:45 -04:00
Randy Dunlap
81f61484f1 platform/x86: msi-laptop depends on SERIO_I8042
msi-laptop uses i8042_*() interfaces, so it should depend on
SERIO_I8042.  E.g., when SERIO_I8042=m and MSI_LAPTOP=y:

msi-laptop.c:(.text+0x18a7fe): undefined reference to `i8042_install_filter'
msi-laptop.c:(.init.text+0xd69d): undefined reference to `i8042_remove_filter'
msi-laptop.c:(.exit.text+0x19c3): undefined reference to `i8042_remove_filter'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Lennart Poettering <mzxreary@0pointer.de>
2010-08-03 09:48:44 -04:00
Thadeu Lima de Souza Cascardo
f35843ed8d classmate-laptop: depends on RFKILL or RFKILL=n
Randy Dunlap has reported that building classmate-laptop fails when
CONFIG_RFKILL=m and CONFIG_ACPI_CMPC=y. He suggested depending on
RFKILL, but, then, it will not be possible to select classmate-laptop
when RFKILL is off. There's no known problem with building and using
classmate-laptop with RFKILL off. So depend on RFKILL or RFKILL=n.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: platform-driver-x86@vger.kernel.org
Cc: Daniel Oliveira Nascimento <don@syst.com.br>
2010-08-03 09:48:44 -04:00
Julia Lawall
0fc8f274ae drivers/platform/x86: Eliminate a NULL pointer dereference
Give different error messages if device_enum is NULL or if its type field
has the wrong value.

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

// <smpl>
@r exists@
expression E,E1;
identifier f;
statement S1,S2,S3;
@@

if ((E == NULL && ...) || ...)
{
  ... when != if (...) S1 else S2
      when != E = E1
* E->f
  ... when any
  return ...;
}
else S3
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:44 -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
Axel Lin
4b30fbca4f intel_menlow: fix memory leaks in error path
This patch includes below fixes in error path:
1. fix a memory leak if device_create_file failed in
intel_menlow_add_one_attribute
2. properly free added attributes before return error in
intel_menlow_register_sensor error handler
3. properly call acpi_bus_unregister_driver before return error in
intel_menlow_module_init

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:48:40 -04:00
Sreedhara DS
b4fd4f890b intel_scu_ipc: Oops/crash fixes
- fix reversing of command/sub arguments
- fix a crash if the i2c interface is called before the device is found

Signed-off-by: Sreedhara DS <sreedhara.ds@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-07-19 13:17:37 -07:00
Alan Cox
2e8949f09e intel_scu_ipc: Length fix
Commands with data must set the length in the message.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-06-01 08:40:47 -07:00
Lee, Chun-Yi
785cfc0324 Move N014, N051 and CR620 dmi information to load scm dmi table
Found the N014, N051 and CR620 are must the same with N034 there are
load scm serial model. So, this patch move N014, N051 and CR620 dmi
information to right dmi table: msi_load_scm_models_dmi_table[]

Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
2010-05-20 10:16:13 -04:00
Daniel Mack
b7670ed650 drivers/platform/x86/eeepc-wmi.c: fix build warning
drivers/platform/x86/eeepc-wmi.c: In function ‘eeepc_wmi_notify’:
drivers/platform/x86/eeepc-wmi.c:209: warning: ‘new’ may be used uninitialized in this function
drivers/platform/x86/eeepc-wmi.c:209: note: ‘new’ was declared here

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Yong Wang <yong.y.wang@intel.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Tejun Heo <tj@kernel.org>
Cc: platform-driver-x86@vger.kernel.org
Acked-By: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-05-20 09:46:24 -04:00
Thomas Renninger
a929aae0e0 X86 platfrom wmi: Add debug facility to dump WMI data in a readable way
Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: platform-driver-x86@vger.kernel.org
CC: mjg59@srcf.ucam.org
CC: corentin.chary@gmail.com
Signed-off-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-05-20 09:46:21 -04:00
Thomas Renninger
7715348cbe X86 platform wmi: Also log GUID string when an event happens and debug is set
Output in log with debug=1:
ACPI: WMI: DEBUG Event INTEGER_TYPE - 65535
ACPI: WMI: DEBUG Event GUID: CC1A61AC-4256-41A3-B9E0-05A445ADE2F5

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: platform-driver-x86@vger.kernel.org
CC: mjg59@srcf.ucam.org
CC: corentin.chary@gmail.com
Signed-off-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-05-20 09:46:18 -04:00
Thomas Renninger
fc3155b2c6 X86 platform wmi: Introduce debug param to log all WMI events
To give people easily an idea what could be WMI driven on their system.
Introduces:
wmi.debug=[01]

Tested on an acer:
ACPI: WMI: DEBUG Event INTEGER_TYPE - 65535

Situation where a driver registers for specific event and debug
handler gets overridden and set again if the registering driver gets
unloaded again is untested, but should work.

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: platform-driver-x86@vger.kernel.org
CC: mjg59@srcf.ucam.org
CC: corentin.chary@gmail.com
Signed-off-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-05-20 09:46:15 -04:00
Lee, Chun-Yi
7ab52521f2 Clean up all objects used by scm model when driver initial fail or exit
Clean up i8042 filter, rfkill and cancel delayed work when msi-laptop driver initial fail or exit on MSI scm model.

Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
2010-05-20 09:46:12 -04:00
Greg Kroah-Hartman
1ac34072bd msi-laptop: fix up some coding style issues found by checkpatch
Cc: Lee, Chun-Yi <jlee@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20 09:46:09 -04:00
Lee, Chun-Yi
339e75329a msi-laptop: Add i8042 filter to sync sw state with BIOS when function key pressed
There have some MSI netbook change devices state by EC when user press
wlan/bluetooth/wwan function keys. So, add a i8042 filter to sync sw
state with BIOS when function keys pressed.

Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20 09:45:56 -04:00
Lee, Chun-Yi
3bb970214f msi-laptop: Set rfkill init state when msi-laptop intiial
Setup Wlan/Bluetooth/3G rfkill initial state to sync with the hardware
state from EC 0x2e address.

Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20 09:30:20 -04:00
Lee, Chun-Yi
1f27e17bfa msi-laptop: Add MSI CR620 notebook dmi information to scm models table
Add new MSI notebook CR620 dmi information to scm models table.

Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20 09:30:20 -04:00
Lee, Chun-Yi
d0a4aa2b26 msi-laptop: Add N014 N051 dmi information to scm models table
Add new MSI netbook N014 and N051 dmi information to scm models table.

Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20 09:30:20 -04:00
Julia Lawall
2c6719a3ef drivers/platform/x86: Use kmemdup
Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
2010-05-20 09:26:13 -04:00
Julia Lawall
6c75dd0f96 drivers/platform/x86: Use kzalloc
Use kzalloc rather than the combination of kmalloc and memset.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,size,flags;
statement S;
@@

-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
 if (x == NULL) S
-memset(x, 0, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
2010-05-20 09:26:13 -04:00
Matthew Garrett
420f5f0c5a Merge branch 'for-upstream/platform-x86_tpacpi' of git://repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6 into x86-platform 2010-05-20 09:24:29 -04:00
Matthew Garrett
6c62673cf5 drivers/platform/x86: Clarify the MRST IPC driver description slightly
Make it clear that this driver is only needed for embedded hardware,
not PCs.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-05-17 12:08:33 -04:00
Randy Dunlap
89a7644be2 eeepc-wmi: depends on BACKLIGHT_CLASS_DEVICE
eeepc-wmi uses backlight*() interfaces so it should depend on
BACKLIGHT_CLASS_DEVICE.

eeepc-wmi.c:(.text+0x2d7f54): undefined reference to `backlight_force_update'
eeepc-wmi.c:(.text+0x2d8012): undefined reference to `backlight_device_register'
eeepc-wmi.c:(.devinit.text+0x1c31c): undefined reference to `backlight_device_unregister'
eeepc-wmi.c:(.devexit.text+0x2f8b): undefined reference to `backlight_device_unregister'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: stable@kernel.org
2010-05-17 12:08:23 -04:00
Sreedhara DS
9a58a33339 IPC driver for Intel Mobile Internet Device (MID) platforms
The IPC (inter processor communications) is used to provide the
communications between kernel and system control units on some embedded
Intel x86 platforms.

(Various bits of clean up and restructuring by Alan Cox)

Signed-off-by: Sreedhara DS <sreedhara.ds@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
2010-05-17 12:06:07 -04:00
Thadeu Lima de Souza Cascardo
d5c051f108 classmate-laptop: Add RFKILL support.
The RFKILL device shares the same ACPI device used for backlight. So, it
required a new struct sharing both a backlight_device and a rfkill
device.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
2010-05-17 12:06:01 -04:00
Henrique de Moraes Holschuh
7d9745cf23 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>
2010-05-16 19:45:57 -03:00
Henrique de Moraes Holschuh
ef07a5abad 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>
2010-05-16 19:45:54 -03:00
Henrique de Moraes Holschuh
2cbb5c8f55 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>
2010-05-16 19:45:50 -03:00
Henrique de Moraes Holschuh
72f1992121 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>
2010-05-16 19:45:48 -03:00
Henrique de Moraes Holschuh
263f4a30e4 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>
2010-05-16 19:45:45 -03:00
Henrique de Moraes Holschuh
437e470c4c 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>
2010-05-16 19:45:43 -03:00
Henrique de Moraes Holschuh
38e11cdec9 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>
2010-05-16 19:45:40 -03:00
Henrique de Moraes Holschuh
2899902281 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>
2010-05-16 19:45:36 -03:00
Henrique de Moraes Holschuh
77775838bb 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>
2010-05-16 19:45:33 -03:00
Henrique de Moraes Holschuh
7a43f78898 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>
2010-05-16 19:45:31 -03:00
Henrique de Moraes Holschuh
5d756db99a 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>
2010-05-16 19:45:28 -03:00
Henrique de Moraes Holschuh
a318930d06 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>
2010-05-16 19:45:26 -03:00
Henrique de Moraes Holschuh
e28393c0c4 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>
2010-05-16 19:45:23 -03:00
Corentin Chary
c9db3efee1 eeepc-laptop: add missing sparse_keymap_free
Also remove legacy keymap which was not used since
we use sparse_keymap.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
2010-04-23 15:23:21 -04:00
Ingo Molnar
fb48aef7c3 eeepc-wmi: Build fix
-tip testing found:

eeepc-wmi.c:(.text+0x36673c): undefined reference to `sparse_keymap_report_event'
drivers/built-in.o: In function `eeepc_wmi_init':
eeepc-wmi.c:(.init.text+0x19cd0): undefined reference to `sparse_keymap_setup'
eeepc-wmi.c:(.init.text+0x19cf0): undefined reference to `sparse_keymap_free'
eeepc-wmi.c:(.init.text+0x19d0b): undefined reference to `sparse_keymap_free'
drivers/built-in.o: In function `eeepc_wmi_exit':
eeepc-wmi.c:(.exit.text+0x2e87): undefined reference to `sparse_keymap_free'

To fix this select INPUT_SPARSEKMAP, like the ASUS driver does.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-04-12 13:21:35 -04:00
Dan Carpenter
668f4a0321 asus: don't modify bluetooth/wlan on boot
We were storing -1 as an unsigned int and as a result the effect of
passing -1 was the same as using 1.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Corentin Chary <corentincj@iksaif.net>
2010-04-12 13:10:55 -04:00
Yong Wang
a0624a90a2 dell-wmi: Fix memory leak
The output of wmi_get_event_data shall be freed before return.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Yong Wang <yong.y.wang@linux.intel.com>
2010-04-12 13:10:19 -04:00
Yong Wang
3d7b165539 eeepc-wmi: add backlight support
Add backlight support for WMI based Eee PC laptops.

Signed-off-by: Yong Wang <yong.y.wang@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Reviewed-by: Corentin Chary <corentincj@iksaif.net>
2010-04-12 13:02:52 -04:00
Yong Wang
45f2c6937e eeepc-wmi: use a platform device as parent device of all sub-devices
Add a platform device and use it as the parent device of all sub-devices.

Signed-off-by: Yong Wang <yong.y.wang@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Reviewed-by: Corentin Chary <corentincj@iksaif.net>
2010-04-12 13:02:43 -04:00
Yong Wang
8124888940 eeepc-wmi: add an eeepc_wmi context structure
Add an eeepc_wmi context structure to manage all the sub-devices
that will be implemented later on. Put input device into it first.

Signed-off-by: Yong Wang <yong.y.wang@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Reviewed-by: Corentin Chary <corentincj@iksaif.net>
2010-04-12 13:02:21 -04:00
Wolfram Sang
12765517d9 device_attributes: add sysfs_attr_init() for dynamic attributes
Made necessary by 6992f53349 ("sysfs: Use
one lockdep class per sysfs attribute").

Prevents further "key xxx not in .data" bug-reports.  Although some
attributes could probably be converted to static ones, this is left for
people having hardware to test.

Found by this semantic patch:

@ init @
type T;
identifier A;
@@

        T {
                ...
                struct device_attribute A;
                ...
        };

@ main extends init @
expression E;
statement S;
identifier err;
T *name;
@@

        ... when != sysfs_attr_init(&name->A.attr);
(
+       sysfs_attr_init(&name->A.attr);
        if (device_create_file(E, &name->A))
                S
|
+       sysfs_attr_init(&name->A.attr);
        err = device_create_file(E, &name->A);
)

While reviewing, I put the initialization to apropriate places.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Greg KH <gregkh@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Mike Isely <isely@pobox.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Sujith Thomas <sujith.thomas@intel.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-04-07 08:38:03 -07:00
Tejun Heo
a32f392663 eeepc-wmi: include slab.h
eeepc-wmi uses kfree() but doesn't include slab.h.  Include it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Yong Wang <yong.y.wang@intel.com>
2010-04-05 11:37:59 +09:00
Tejun Heo
336f5899d2 Merge branch 'master' into export-slabh 2010-04-05 11:37:28 +09:00