summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/hp-wmi.c
AgeCommit message (Collapse)AuthorFilesLines
2020-10-07platform/x86: hp-wmi: add support for thermal policyElia Devito1-0/+23
HP Spectre notebooks (and probably other model as well) support up to 4 thermal policy: - HP Recommended - Performance - Cool - Quiet at least on HP Spectre x360 Convertible 15-df0xxx the firmware sets the thermal policy to default but hardcode the odvp0 variable to 1, this causes thermald to choose the wrong DPTF profile witch result in low performance when notebook is on AC, calling thermal policy write command allow firmware to correctly set the odvp0 variable. Signed-off-by: Elia Devito <eliadevito@gmail.com> Link: https://lore.kernel.org/r/20201004211305.11628-1-eliadevito@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-05-30platform/x86: hp-wmi: Introduce HPWMI_POWER_FW_OR_HW as convenient shortcutAndy Shevchenko1-2/+2
For hardware blocked wireless switch we check two bits. Introduce HPWMI_POWER_FW_OR_HW enum to increase readability and for easier maintenance. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-05-30platform/x86: hp-wmi: Convert simple_strtoul() to kstrtou32()Andy Shevchenko1-2/+8
First of all, unsigned long can overflow u32 value on 64-bit machine. Second, simple_strtoul() doesn't check for overflow in the input. Convert simple_strtoul() to kstrtou32() to eliminate above issues. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-05-30platform/x86: hp-wmi: Refactor postcode_store() to follow standard patternsAndy Shevchenko1-9/+7
Refactor postcode_store() to follow standard patterns of error handling. While at it, switch to use kstrtobool(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-12-20platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytesHans de Goede1-1/+1
At least on the HP Envy x360 15-cp0xxx model the WMI interface for HPWMI_FEATURE2_QUERY requires an outsize of at least 128 bytes, otherwise it fails with an error code 5 (HPWMI_RET_INVALID_PARAMETERS): Dec 06 00:59:38 kernel: hp_wmi: query 0xd returned error 0x5 We do not care about the contents of the buffer, we just want to know if the HPWMI_FEATURE2_QUERY command is supported. This commits bumps the buffer size, fixing the error. Fixes: 8a1513b4932 ("hp-wmi: limit hotkey enable") Cc: stable@vger.kernel.org BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-11-25platform/x86: hp-wmi: Fix ACPI errors caused by passing 0 as input sizeHans de Goede1-2/+2
The AML code implementing the WMI methods creates a variable length field to hold the input data we pass like this: CreateDWordField (Arg1, 0x0C, DSZI) Local5 = DSZI /* \HWMC.DSZI */ CreateField (Arg1, 0x80, (Local5 * 0x08), DAIN) If we pass 0 as bios_args.datasize argument then (Local5 * 0x08) is 0 which results in these errors: [ 71.973305] ACPI BIOS Error (bug): Attempt to CreateField of length zero (20190816/dsopcode-133) [ 71.973332] ACPI Error: Aborting method \HWMC due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529) [ 71.973413] ACPI Error: Aborting method \_SB.WMID.WMAA due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529) And in our HPWMI_WIRELESS2_QUERY calls always failing. for read commands like HPWMI_WIRELESS2_QUERY the DSZI value is not used / checked, except for read commands where extra input is needed to specify exactly what to read. So for HPWMI_WIRELESS2_QUERY we can safely pass the size of the expected output as insize to hp_wmi_perform_query(), as we are already doing for all other HPWMI_READ commands we send. Doing so fixes these errors. Cc: stable@vger.kernel.org BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=197007 BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=201981 BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-11-25platform/x86: hp-wmi: Fix ACPI errors caused by too small bufferHans de Goede1-3/+3
The HP WMI calls may take up to 128 bytes of data as input, and the AML methods implementing the WMI calls, declare a couple of fields for accessing input in different sizes, specifycally the HWMC method contains: CreateField (Arg1, 0x80, 0x0400, D128) Even though we do not use any of the WMI command-types which need a buffer of this size, the APCI interpreter still tries to create it as it is declared in generoc code at the top of the HWMC method which runs before the code looks at which command-type is requested. This results in many of these errors on many different HP laptop models: [ 14.459261] ACPI Error: Field [D128] at 1152 exceeds Buffer [NULL] size 160 (bits) (20170303/dsopcode-236) [ 14.459268] ACPI Error: Method parse/execution failed [\HWMC] (Node ffff8edcc61507f8), AE_AML_BUFFER_LIMIT (20170303/psparse-543) [ 14.459279] ACPI Error: Method parse/execution failed [\_SB.WMID.WMAA] (Node ffff8edcc61523c0), AE_AML_BUFFER_LIMIT (20170303/psparse-543) This commit increases the size of the data element of the bios_args struct to 128 bytes fixing these errors. Cc: stable@vger.kernel.org BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=197007 BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=201981 BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-08-02platform: x86: hp-wmi: convert platform driver to use dev_groupsGreg Kroah-Hartman1-35/+12
Platform drivers now have the option to have the platform core create and remove any needed sysfs attribute files. So take advantage of that and do not register "by hand" a bunch of sysfs files. Cc: Darren Hart <dvhart@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: x86@kernel.org Cc: platform-driver-x86@vger.kernel.org Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20190731124349.4474-8-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner1-14/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-05platform/x86: hp-wmi: Fix tablet mode detection for convertiblesStefan Brüns1-1/+1
Commit f9cf3b2880cc ("platform/x86: hp-wmi: Refactor dock and tablet state fetchers") consolidated the methods for docking and laptop mode detection, but omitted to apply the correct mask for the laptop mode (it always uses the constant for docking). Fixes: f9cf3b2880cc ("platform/x86: hp-wmi: Refactor dock and tablet state fetchers") Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-08-13platform/x86: hp-wmi: Remove unused macro helperPaulo Alcantara1-7/+0
The commit d8193cff3390 ("platform/x86: hp-wmi: Standardize enum usage for constants") introduced a macro that had been never used. Remove it. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com> [andy wrote commit message] Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-08-13platform/x86: hp-wmi: Correctly determine method id in WMI callsPaulo Alcantara1-1/+22
The WMI queries are performed by evaluating the WMPV() method from ACPI DSDT tables, and it takes three arguments: instance index, method id and input data (buffer). Currently the method id is hard-coded to 0x3 in hp_wmi_perform_query() which means that it will perform WMI calls that expect an output data of size 0x80 (128). The output size is usually OK for the WMI queries we perform, however it would be better to pick the correct one before evaluating the WMI method. Which correct method id to choose can be figured out by looking at the following ASL code from WVPI() method: ... Name (PVSZ, Package (0x05) { Zero, 0x04, 0x80, 0x0400, 0x1000 }) Store (Zero, Local0) If (LAnd (LGreaterEqual (Arg1, One), LLessEqual (Arg1, 0x05))) { Store (DerefOf (Index (PVSZ, Subtract (Arg1, One))), Local0) } ... Arg1 is the method id and PVSZ is the package used to index the corresponding output size; 1 -> 0, 2 -> 4, 3 -> 128, 4 -> 1024, 5 -> 4096. This patch maps the output size passed in hp_wmi_perform_query() to the correct method id before evaluating the WMI method. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2017-04-20platform/x86: hp-wmi: Cleanup exit pathsDarren Hart (VMware)1-30/+33
Several exit paths were more complex than they needed to be. Remove superfluous conditionals, use labels common cleanup, do not shadow negative error codes. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Tested-by: Carlo Caione <carlo@endlessm.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2017-04-20platform/x86: hp-wmi: Do not shadow errors in sysfs show functionsDarren Hart (VMware)1-6/+6
The new hp_wmi_read_int function returns a negative value in case of error, pass this on directly rather than always replacing it with -EINVAL. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Tested-by: Carlo Caione <carlo@endlessm.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2017-04-20platform/x86: hp-wmi: Use DEVICE_ATTR_(RO|RW) helper macrosDarren Hart (VMware)1-18/+18
Use the DEVICE_ATTR_(RO|RW) macros, ranaming the show and store functions accordingly. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Tested-by: Carlo Caione <carlo@endlessm.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2017-04-20platform/x86: hp-wmi: Refactor dock and tablet state fetchersDarren Hart (VMware)1-19/+14
Both dock and tablet use the HPWMI_HARDWARE_QUERY, but require different masks. Rather than using two functions with magic masks, define the masks, and use a common accessor. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Tested-by: Carlo Caione <carlo@endlessm.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2017-04-20platform/x86: hp-wmi: Cleanup wireless get_(hw|sw)state functionsDarren Hart (VMware)1-16/+8
Use the new hp_wmi_read_int() function and add a WARN_ONCE() to the TBD regarding passing the error through. These are used in a null return function unfortunately. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Tested-by: Carlo Caione <carlo@endlessm.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2017-04-20platform/x86: hp-wmi: Refactor redundant HPWMI_READ functionsDarren Hart (VMware)1-58/+24
Several functions perform the same WMI read int with different query arguments. Refactor this into a single hp_wmi_read_int function. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Tested-by: Carlo Caione <carlo@endlessm.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2017-04-20platform/x86: hp-wmi: Standardize enum usage for constantsDarren Hart (VMware)1-58/+74
Use enums consistently throughout the hp-wmi driver for groups of related constants. Use hex and align the assignment within groups. Move the *QUERY constants into an enum, create a new enum defining the READ, WRITE, and ODM constants and use them instead of 0 and 1 at the call sites. Set the command directly instead of using the ternary operator since both 1 and 3 as previously documented would result in the command being set to 0x2. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Tested-by: Carlo Caione <carlo@endlessm.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2017-04-20platform/x86: hp-wmi: Cleanup local variable declarationsDarren Hart (VMware)1-16/+13
Declare like types on one line. Order declarations in decreasing length where possible. Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org> Tested-by: Carlo Caione <carlo@endlessm.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2017-04-19platform/x86: hp-wmi: Do not shadow error valuesCarlo Caione1-10/+10
All the helper functions (i.e. hp_wmi_dock_state, hp_wmi_tablet_state, ...) using hp_wmi_perform_query to perform an HP WMI query shadow the returned value in case of error. We return -EINVAL only when the HP WMI query returns a positive value (the specific error code) to not mix this up with the actual value returned by the helper function. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-14platform/x86: hp-wmi: Fix detection for dock and tablet modeCarlo Caione1-13/+27
The current driver code is not checking for the error values returned by 'hp_wmi_dock_state()' and 'hp_wmi_tablet_state()' before passing the returned values down to 'input_report_switch()'. This error code is being translated to '1' in the input subsystem, reporting the wrong status. The biggest problem caused by this issue is that several laptops are wrongly reported by the driver as docked, preventing them to be put to sleep using the LID (and in most cases they are not even dockable). With this patch we create the report switches only if we are able to read the dock and tablet mode status correctly from ACPI. Signed-off-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-04-14platform/x86: hp-wmi: Fix error value for hp_wmi_tablet_stateCarlo Caione1-1/+1
hp_wmi_tablet_state() fails to return the correct error code when hp_wmi_perform_query() returns the HP WMI query specific error code that is a positive value. Signed-off-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
2017-03-14platform/x86: hp-wmi: remove sparse_keymap_free() callsMichał Kępień1-4/+1
As sparse_keymap_setup() now uses a managed memory allocation for the keymap copy it creates, the latter is freed automatically. Remove all calls to sparse_keymap_free(). Signed-off-by: Michał Kępień <kernel@kempniu.pl> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2016-06-28hp-wmi: Fix wifi cannot be hard-unblockedAlex Hung1-1/+6
Several users reported wifi cannot be unblocked as discussed in [1]. This patch removes the use of the 2009 flag by BIOS but uses the actual WMI function calls - it will be skipped if WMI reports unsupported. [1] https://bugzilla.kernel.org/show_bug.cgi?id=69131 Signed-off-by: Alex Hung <alex.hung@canonical.com> Tested-by: Evgenii Shatokhin <eugene.shatokhin@yandex.ru> Cc: stable@vger.kernel.org Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2016-03-23hp-wmi: Remove GPS rfkill support via pre-2009 interfaceMaciej S. Szmigiero1-37/+1
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-23hp-wmi: fix unregister order in hp_wmi_rfkill_setup() once againMaciej S. Szmigiero1-7/+7
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>
2015-09-17hp-wmi: limit hotkey enableKyle Evans1-11/+20
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-03-06Input: use more descriptive KEY_ROTATE_DISPLAY instead of KEY_DIRECTIONStefan Brüns1-1/+1
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>
2014-10-20platform: x86: drop owner assignment from platform_driversWolfram Sang1-1/+0
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-08-16hp-wmi: Add missing __init annotations to initialization codeMathias Krause1-3/+3
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-06-10hp-wmi: Enable hotkeys on some systemsKyle Evans1-0/+18
This is a third attempt to enable these buttons. The new variable being commit 997daa1bd9aca412ab97955a35b26c460c0ec7a4 (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>
2013-11-20hp-wmi: detect "2009 BIOS or later" flag by WMI 0x0d for wireless cmdAlex Hung1-1/+13
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-09-05hp_wmi: Fix unregister order in hp_wmi_rfkill_setup()Kirill Tkhai1-8/+8
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-08-18Revert "hp-wmi: Enable hotkeys on some systems"Matthew Garrett1-16/+0
This reverts commit b253c9d1d858a3f115f791ee4fe2b9399ae7dbbd. It's still causing problems on some systems. Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-07-10hp-wmi: add supports for POST code errorAlex Hung1-0/+47
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-08hp-wmi: Enable hotkeys on some systemsMatthew Garrett1-0/+16
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-06-01x86 / platform / hp_wmi: Fix bluetooth_rfkill misuse in hp_wmi_rfkill_setup()lan,Tianyu1-1/+1
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-05-08hp-wmi: add more definitions for new event_id'sAlex Hung1-0/+24
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-04-18Revert "hp-wmi: Add support for SMBus hotkeys"Matthew Garrett1-4/+0
This reverts commit fabf85e3ca15d5b94058f391dac8df870cdd427a 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-02-27hp-wmi: fix handling of platform deviceDmitry Torokhov1-39/+30
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-27hp-wmi: Add support for SMBus hotkeysKyle Evans1-0/+4
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-24Platform: hp-wmi: add rfkill support for integrated GPSTrepák Vilmos1-1/+43
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-01-03Drivers: platform: x86: remove __dev* attributes.Greg Kroah-Hartman1-4/+4
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>
2012-05-31hp-wmi: check for allocation failuresDan Carpenter1-0/+10
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>
2011-07-11hp-wmi: fix use after freeEric Dumazet1-5/+6
[ 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-05-27hp-wmi: Convert printks to pr_<level>Joe Perches1-26/+17
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-03-28hp-wmi: add rfkill support for wireless query 0x1bAnssi Hannula1-1/+187
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-28hp-wmi: make rfkill initialization failure non-fatalAnssi Hannula1-3/+1
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-28hp-wmi: clear rfkill device pointers when appropriateAnssi Hannula1-0/+8
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>