busy_loop() returns negative error code, thus change err variable
from u32 to int to properly propagate correct error code.
Also remove unneeded initialization for err and i variables.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Including linux/dmi.h once in drivers/platform/x86/acer-wmi.c is enough.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Reviewed-by: Lee, Chun-Yi <jlee@novell.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (59 commits)
ACPI / PM: Fix build problems for !CONFIG_ACPI related to NVS rework
ACPI: fix resource check message
ACPI / Battery: Update information on info notification and resume
ACPI: Drop device flag wake_capable
ACPI: Always check if _PRW is present before trying to evaluate it
ACPI / PM: Check status of power resources under mutexes
ACPI / PM: Rename acpi_power_off_device()
ACPI / PM: Drop acpi_power_nocheck
ACPI / PM: Drop acpi_bus_get_power()
Platform / x86: Make fujitsu_laptop use acpi_bus_update_power()
ACPI / Fan: Rework the handling of power resources
ACPI / PM: Register power resource devices as soon as they are needed
ACPI / PM: Register acpi_power_driver early
ACPI / PM: Add function for updating device power state consistently
ACPI / PM: Add function for device power state initialization
ACPI / PM: Introduce __acpi_bus_get_power()
ACPI / PM: Introduce function for refcounting device power resources
ACPI / PM: Add functions for manipulating lists of power resources
ACPI / PM: Prevent acpi_power_get_inferred_state() from making changes
ACPICA: Update version to 20101209
...
Use the new function acpi_bus_update_power(), which is safer than
acpi_bus_get_power(), for getting device power state in
acpi_fujitsu_add() and acpi_fujitsu_hotkey_add().
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-and-Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Add new mappings for assist, VAIO, zoom and eject buttons present on
refurbished P, Z and EC models.
Reported-by: Gyorgy Jeney <nog.lkml@gmail.com>
Reported-by: Stephan Mueller <smueller@chronox.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Currently the x86 platform devices are not consistent about selecting
or depending on the LEDs Kconfig variables, and this inconsistency
leads to Kconfig getting upset and refusing to offer LEDs (even on
non-x86 platforms):
drivers/platform/x86/Kconfig:422:error: recursive dependency detected!
drivers/platform/x86/Kconfig:422: symbol EEEPC_WMI depends on ACPI_WMI
drivers/platform/x86/Kconfig:438: symbol ACPI_WMI is selected by ACER_WMI
drivers/platform/x86/Kconfig:18: symbol ACER_WMI depends on LEDS_CLASS
drivers/leds/Kconfig:10: symbol LEDS_CLASS is selected by EEEPC_WMI
Fix this by always selecting rather than depending on the symbols as
slightly more drivers use this approach already and it seems more
user friendly.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Fix sparse warning for non-ANSI function declaration:
drivers/platform/x86/sony-laptop.c:1134:35: warning: non-ANSI function declaration of function 'sony_nc_rfkill_update'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Fix sparse warning for non-ANSI function declaration:
drivers/platform/x86/intel_ips.c:1477:25: warning: non-ANSI function declaration of function 'ips_link_to_i915_driver'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Add the KHLB2 model identifier to the list of supported models
Signed-off-by: Albert Astals Cid <aacid@kde.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Enabled Acer Launch Manager mode to disable the EC raw behavior for
communication devices when WMID3 method available. And, we also add a
ec_raw_mode kernel module option for enable The EC raw behavior mode
when anyone what reset it back.
When Acer Launch Manager mode enabled, EC will stop to touch any
communication devices' RF state or power state that causes conflict
with rfkill_input or any userland daemon to charge the rfkill rules.
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Acked-by: Jiri Benc <jbenc@suse.cz>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Latest kernel has many changes in IRQ subsystem and its interfaces, like adding
"irq_eoi" for struct irq_chip, this patch will make it support both the new
and old interface.
Cc: Alek Du <alek.du@intel.com>
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Hi,
In drivers/platform/x86/thinkpad_acpi.c::acpi_evalf() we don't always call
va_end() after va_start(). This patch corrects that.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Initial wlan/bluetooth/wwan rfkill software block state when acer-wmi driver
probe. Acer notebook can save the devices state and this patch can use it to
initial the devices' rfkill state.
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Check the Acer OEM-specific Type AA to detect the WiFi/Bluetooth/3G
devices available or not, and set the devices capability flag.
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Thomas Renninger <trenn@suse.de>
Acked-by: Jiri Benc <jbenc@suse.cz>
Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Add 3G rfkill sysfs file for provide userland to control 3G device
on/off by using WMI method.
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Acked-by: Jiri Benc <jbenc@suse.cz>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Carlos Corbaho <carlos@strangeworlds.co.uk>
Cc: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
With 'make oldnoconfig' I see these warnings in linux-next (next-20101208):
drivers/platform/x86/Kconfig:422:error: recursive dependency detected!
drivers/platform/x86/Kconfig:422: symbol EEEPC_WMI depends on ACPI_WMI
drivers/platform/x86/Kconfig:438: symbol ACPI_WMI is selected by ACER_WMI
drivers/platform/x86/Kconfig:18: symbol ACER_WMI depends on LEDS_CLASS
drivers/leds/Kconfig:10: symbol LEDS_CLASS is selected by EEEPC_WMI
This patch replaces all "select on ACPI_WMI" by "depends on ACPI_WMI".
Quote from David Woodhouse:
"A better policy is: "NEVER USE SELECT"."
Reported-and-tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Passing ideapad_priv as argument and try not to using too much global variable.
This is part 2 for rfkill.
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Passing ideapad_priv as argument and try not to using too much global variable.
This is part 1 for platform driver and input device.
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
1. Add markups on init and exit functions
2. Unify the comments in the same style
3. Return result when module initial
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Hotkey enabled by this patch:
Fn+F3: Video mode switch
Fn+F5: software rfkill for wifi
For some ideapad when push Fn+F3, hardware generates Super-P keys, those key
will not be enabled by this patch.
Thanks for Dave Hansen report the problem. If CONFIG_INPUT_SPARSEKMAP is not
set, when building, you will have error message:
ERROR: "sparse_keymap_setup" [drivers/platform/x86/ideapad-laptop.ko] undefined!
ERROR: "sparse_keymap_free" [drivers/platform/x86/ideapad-laptop.ko] undefined!
ERROR: "sparse_keymap_report_event" [drivers/platform/x86/ideapad-laptop.ko] undefined!
To select INPUT_SPARSEKMAP solve this issue.
Ref: http://lkml.org/lkml/2010/12/2/340
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The entry was at /sys/devices/LNXSYSTM:00/../VPC2004:00/camera_power
move to /sys/devices/platform/ideapad/camera_power
Add document about usage of ideapad node in sysfs.
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Create /sys/devices/platform/ideapad for nodes of ideapad landing.
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Annotate pnp_ids as '__used' to fix following warning:
CC drivers/platform/x86/fujitsu-laptop.o
drivers/platform/x86/fujitsu-laptop.c:1243: warning: ‘pnp_ids’ defined but not used
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The break resets the retval to 0 but we want to return an error code.
This was introduced in c64eefd48c "WMI: embed struct device directly
into wmi_block"
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
If legacy device (SB.ATKD - ASUS010) used by eeepc-laptop
is enabled, don't allow eeepc-wmi to load because:
- eeepc-laptop may be loaded, and can conflict with
eeepc-wmi (they both try to register eeepc::touchpad
led for example).
- the WMI interface is inteded to be used when the OS is
not detected as Win 7. And when this is the case, the
ASUS010 device is disabled.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Allow te get the current led state in a more accurate way.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Since eeepc-wmi has currently no official maintainer, I claim
maintainership of this driver, and add it to the acpi4asus project.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
eeepc-wmi/ - debugfs root directory
dev_id - current dev_id
ctrl_param - current ctrl_param
devs - call DEVS(dev_id, ctrl_param) and print result
dsts - call DSTS(dev_id) and print result
DEVS and DSTS are the main functions used in eeepc-wmi, this
will allow to test new features without patching the drivers.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
wimax support is missing because I don't have any DSDT
with WMI and wimax support.
Most of the code comes from eeepc-laptop.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The old code was using platform_driver.probe to initialize
eeepc_wmi context. That's a mistake because if probe fail,
eeepc_platform_register() won't tell anyone, and chaos will happen.
Wrap add and remove code inside eeepc_wmi_add() / eeepc_wmi_remove(),
and try to use the static platform_device only in eeepc_wmi_init()
and eeepc_wmi_exit()
The code is now very similar to eeepc-laptop, except eeepc_laptop_add
and eeepc_laptop_remove are called from acpi_driver, not module
init/exit functions, but WMI doesn't provide such functionalities (yet ?).
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Add missing input_sync call in cmpc_keys_handler function.
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
We don't need to call bios/acpi (cmpc_set_rfkill_wlan) if the blocked
state is already set to the same value (little optimization). This can
happen for example if we initialize the module with same initial
hardware state (rfkill core always call cmpc_rfkill_block on
initialization here).
Also GWRI method only accepts 0 or 1 for setting rfkill block, as can be
seen on AML code from acpidump->DSDT from a classmate sample I have, so
should be fine setting state only to 0 or 1 directly.
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
WMI data blocks can contain WMI events with the same GUID but with
different notifiy_ids, for example volume up/down hotkeys.
This patch enables a single event handler to be registered and
unregistered against all events with same GUID but different
notify_ids. Since an event handler is passed the notify_id of
an event it can can differentiate between the different events.
The patch also ensures we only register and unregister a device per
unique GUID.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
This driver implements ioctl and interfaces with intel scu ipc driver. It
is used to access pmic/msic registers from user space and firmware update
utility.
Signed-off-by: Sreedhara DS <sreedhara.ds@intel.com>
[Extensive clean up and debug]
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
* 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86, earlyprintk: Move mrst early console to platform/ and fix a typo
x86, apbt: Setup affinity for apb timers acting as per-cpu timer
ce4100: Add errata fixes for UART on CE4100
x86: platform: Move iris to x86/platform where it belongs
x86, mrst: Check platform_device_register() return code
x86/platform: Add Eurobraille/Iris power off support
x86, mrst: Add explanation for using 1960 as the year offset for vrtc
x86, mrst: Fix dependencies of "select INTEL_SCU_IPC"
x86, mrst: The shutdown for MRST requires the SCU IPC mechanism
x86: Ce4100: Add reboot_fixup() for CE4100
ce4100: Add PCI register emulation for CE4100
x86: Add CE4100 platform support
x86: mrst: Set vRTC's IRQ to level trigger type
x86: mrst: Add audio driver bindings
rtc: Add drivers/rtc/rtc-mrst.c
x86: mrst: Add vrtc driver which serves as a wall clock device
x86: mrst: Add Moorestown specific reboot/shutdown support
x86: mrst: Parse SFI timer table for all timer configs
x86/mrst: Add SFI platform device parsing code
The IPS driver is designed to be able to run detached from i915 and
just not enable GPU turbo in that case, in order to avoid module
dependencies between the two drivers. This means that we don't know
what the load order between the two is going to be, and we had
previously only supported IPS after (optionally) i915, but not i915
after IPS. If the wrong order was chosen, you'd get no GPU turbo, and
something like half the possible graphics performance.
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Conflicts:
MAINTAINERS
arch/arm/mach-omap2/pm24xx.c
drivers/scsi/bfa/bfa_fcpim.c
Needed to update to apply fixes for which the old branch was too
outdated.
While looking for the duplicates in /sys/class/wmi/, I couldn't find
them. The code that looks for duplicates uses strncmp in a binary GUID,
which may contain zero bytes. The right function is memcmp, which is
also used in another section of wmi code.
It was finding 49142400-C6A3-40FA-BADB-8A2652834100 as a duplicate of
39142400-C6A3-40FA-BADB-8A2652834100. Since the first byte is the fourth
printed, they were found as equal by strncmp.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: stable@kernel.org
I didn't know the difference between the two when I wrote this code in
commit c30116c6f0.
Signed-off-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Add new MUTE key seen on Medion Akoya AIO PC P4010D using MSI motherboard
(Product Name: MS-7621)
Reported-and-tested-by: Mark Huijgen <mark.sf.net@huijgen.tk>
Signed-off-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Asus UL30A has a 3G chip, but the radio is disabled by default.
The DSDT also reference a WIMAX device, which is not present on this model.
This patch adds two new files: wwan and wimax to control WWAN and
WIMAX devices. It does not use rfkill, because like WLED and BLED,
we don't know yet that the two ACPI functions will always control the
radio, they may control only the leds on some hardware.
We may add rfkill switchs later.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
This fixes the following:
CC [M] drivers/platform/x86/eeepc-wmi.o
drivers/platform/x86/eeepc-wmi.c:322: warning: initialization from incompatible pointer type
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Some of the IBM servers that are supported by ibm_rtl
can run in both Legacy mode (BIOS) and in UEFI mode.
When running in UEFI mode, it is possible that the
EBDA table exists but cannot be mapped and reports
errors. We need to make sure that by default we don't
try to probe the machines if they are running in UEFI
mode.
Signed-off-by: Vernon Mauery <vernux@us.ibm.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Allow all IBM machines to pass the DMI check so that we
don't have to add them one by one to the driver. Any IBM
machine that has the _RTL_ table in the EBDA will work.
Signed-off-by: Vernon Mauery <vernux@us.ibm.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Delete successive assignments to the same location.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression i;
@@
*i = ...;
i = ...;
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
A lone FN key press on a Toshiba Portégé R700 without another key in
conjunction results in an ACPI event and a spurious error message on
the console.
Add a key entry to map this event to a KEY_FN keypress. This prevents
the console message.
Signed-off-by: Jon Dowland <jmtd@debian.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Fix printk format warning:
drivers/platform/x86/ibm_rtl.c:305:warning: format '%#llx' expects type 'long long unsigned int', but argument 2 has type 'phys_addr_t'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Keith Mannthey <kmannth@us.ibm.com>
Cc: Vernon Mauery <vernux@us.ibm.com>
Cc: platform-driver-x86@vger.kernel.org
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
backlight_device_register has been expecting a const "ops" argument, and using
it as such, since 9905a43b2d. Let's make the
remaining backlight_ops instances const.
Inspired by hunks of the grsecurity patch, updated for newer kernels.
Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
SFI provides a series of tables. These describe the platform devices present
including SPI and I²C devices, as well as various sensors, keypads and other
glue as well as interfaces provided via the SCU IPC mechanism (intel_scu_ipc.c)
This patch is a merge of the core elements and relevant fixes from the
Intel development code by Feng, Alek, myself into a single coherent patch
for upstream submission.
It provides the needed infrastructure to register I2C, SPI and platform devices
described by the tables, as well as handlers for some of the hardware already
supported in kernel. The 0.8 firmware also provides GPIO tables.
Devices are created at boot time or if they are SCU dependant at the point an
SCU is discovered. The existing Linux device mechanisms will then handle the
device binding. At an abstract level this is an SFI to Linux device translator.
Device/platform specific setup/glue is in this file. This is done so that the
drivers for the generic I²C and SPI bus devices remain cross platform as they
should.
(Updated from RFC version to correct the emc1403 name used by the firmware
and a wrongly used #define)
Signed-off-by: Alek Du <alek.du@linux.intel.com>
LKML-Reference: <20101109112158.20013.6158.stgit@localhost.localdomain>
[Clean ups, removal of 0.7 support]
Signed-off-by: Feng Tang <feng.tang@linux.intel.com>
[Clean ups]
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86: (44 commits)
eeepc-wmi: Add cpufv sysfs interface
eeepc-wmi: add additional hotkeys
panasonic-laptop: Simplify calls to acpi_pcc_retrieve_biosdata
panasonic-laptop: Handle errors properly if they happen
intel_pmic_gpio: fix off-by-one value range checking
IBM Real-Time "SMI Free" mode driver -v7
Add OLPC XO-1 rfkill driver
Move hdaps driver to platform/x86
ideapad-laptop: Fix Makefile
intel_pmic_gpio: swap the bits and mask args for intel_scu_ipc_update_register
ideapad: Add param: no_bt_rfkill
ideapad: Change the driver name to ideapad-laptop
ideapad: rewrite the sw rfkill set
ideapad: rewrite the hw rfkill notify
ideapad: use EC command to control camera
ideapad: use return value of _CFG to tell if device exist or not
ideapad: make sure we bind on the correct device
ideapad: check VPC bit before sync rfkill hw status
ideapad: add ACPI helpers
dell-laptop: Add debugfs support
...
* 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
vfs: make no_llseek the default
vfs: don't use BKL in default_llseek
llseek: automatically add .llseek fop
libfs: use generic_file_llseek for simple_attr
mac80211: disallow seeks in minstrel debug code
lirc: make chardev nonseekable
viotape: use noop_llseek
raw: use explicit llseek file operations
ibmasmfs: use generic_file_llseek
spufs: use llseek in all file operations
arm/omap: use generic_file_llseek in iommu_debug
lkdtm: use generic_file_llseek in debugfs
net/wireless: use generic_file_llseek in debugfs
drm: use noop_llseek
eeepc-laptop provides a sysfs interface to read and control what it
calls cpufv. When WMI is enabled, the ACPI interface changes slightly
and becames a write-only control with 3 valid values.
Expose cpufv again to allow for user space utils that can extended battery
life noticably and come a little closer to parity with eeepc-laptop.
Write-only is OK for most user space apps because read status was
mostly used to prevent unneeded mode changes. Since this same check
to ignore changes to same mode also exists in the DSDT then it was
wasted ACPI call.
acpi_osi="!Windows 2009" can be used for get back eeepc-laptop's
read support of cpufv for debugging things such as behaviour
during resume.
This patch was tested with EEE PC 1005PE by monitoring powertop output while
writing values of "0", "1", and "2" and by reviewing the decompiled DSDT of
an 1201NL and comparing it to 1005PE's DSDT.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Added 4 hotkeys using same keymap values as eeepc-latop.
These are mousepad toggle, resolution change, screen off,
and task manager. These were tested on 1005PE and are the
Fn-F3, F4, F7, and F9, respectively.
Also, added a new hot key for power toggles (Fn-Space on 1005PE)
and is meant to drive cpufv interface from userspace.
Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Function acpi_pcc_retrieve_biosdata is always called with parameters
(pcc, pcc->sinf), so we can drop the second parameter. It was
dangerous to pass the sinf array separately anyway, as its length is
checked as pcc->num_sifr, which pretty much assumed it was pcc->sinf
(or at least had the same size.)
This change makes the code slightly more compact and thus marginally
faster.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
acpi_pcc_retrieve_biosdata() returns success instead of error if
HKEY.SINF is invalid. Fix this.
Furthermore, if acpi_pcc_retrieve_biosdata() returns an error
during device addition, initialization is properly reverted but value
0 is returned, which means success. This would cause a crash when
later using or removing the device, so fix this too.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Harald Welte <laforge@gnumonks.org>
Cc: Bruno Premont <bonbons@linux-vserver.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
In pmic_irq_type(), we use gpio as array index for trigger,
thus the valid value range for gpio should be 0 .. NUM_GPIO - 1.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
After a period of RFC for this driver, I think it is ready
for inclusion in the platform-driver-x86 tree, hopefully to
be staged in the next merge window into Linus's tree.
--Vernon
------------------------------------------------------------
IBM Real-Time "SMI Free" mode driver
This driver supports the Real-Time Linux (RTL) BIOS feature.
The RTL feature allows non-fatal System Management Interrupts
(SMIs) to be disabled on supported IBM platforms and is
intended to be coupled with a user-space daemon to monitor
the hardware in a way that can be prioritized and scheduled
to better suit the requirements for the system.
The Device is presented as a special "_RTL_" table to the OS
in the Extended BIOS Data Area. There is a simple protocol
for entering and exiting the mode at runtime. This driver
creates a simple sysfs interface to allow a simple entry and
exit from RTL mode in the UFI/BIOS.
Since the driver is specific to IBM SystemX hardware (x86-
based servers) it only builds on x86 builds. To reduce the
risk of loading on the wrong hardware, the module uses DMI
information and checks a list of servers that are known to
work.
Signed-off-by: Vernon Mauery <vernux@us.ibm.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Add a software rfkill switch for the WLAN interface in the OLPC XO-1
laptop. It uses the OLPC embedded controller to cut/restore power to
the Marvell WLAN chip on the motherboard.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The hdaps driver isn't a hardware monitoring driver, so it shouldn't
live under driver/hwmon. drivers/platform/x86 seems much more
appropriate, as the driver is only useful on x86 laptops.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Frank Seidel <frank@f-seidel.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The intel_scu_ipc_update_register 2nd paramter should the bits and 3rd
paramter should be the mask.
This typo was introduced during IPC function changing...
Reported-by: Ryan Zhou <ryan.zhou@intel.com>
Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Add new module parameter that force module not to register bluetooth rfkill.
There is report that saying using this bluetooth rfkill to enable/disable
bluetooth will let bluetooth device initial failed when enable on Lenovo
ideapad S12. Fortunately there is another rfkill registered by bluetooth
driver for S12 and user can shutdown the bluetooth by either bluetooth driver
or HW RF switch.
For dual OS user, it may have some trouble that using Linux after turning off
bluetooth with another OS if we do not register bluetooth rfkill at all. So
we will force bluetooth enable when no_bt_rfkill=1.
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Tested-by: Mario 'BitKoenig' Holbe <Mario.Holbe@TU-Ilmenau.DE>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Since the platform drivers doing more for laptops than just using specific
ACPI device. It will be good to change the name from *_acpi to *-laptop.
Reference: http://lkml.org/lkml/2010/8/14/154
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Acked-by: Len Brown <len.brown@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
1. Read hw rfkill status by ec command
2. Not to touch sw status of each rfkill when hw rfkill notify
3. Initial rfkill status when module loaded
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
There are several bits of the return value of _CFG shows if RF/Camera devices
exist or not.
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
By reading from method _CFG to make sure we bind on the correct VPC2004 device.
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
There are two methods under VPC2004 which is used to access VDAT/VCMD of EC
register. Add helpers for read and write these two registers.
And add read_method_int for reading the return value from ACPI methods which
requires no parameter.
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Export the status of RF killswitch through debugfs.
The killswitch status is obtained by the SMI to BIOS. Exporting this status
through debugfs can help identify the issue with the misbehaving firmware.
Signed-off-by: Keng-Yu Lin <keng-yu.lin@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Instead of creating wmi_blocks and then register corresponding devices
on a separate pass do it all in one shot, since lifetime rules for both
objects are the same. This also takes care of leaking devices when
device_create fails for one of them.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Instead of adding modalias attribute manually set it up as class's
device attribute so driver core will create and remove it for us.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Do not abuse wmi_block structure to hold the head of list
of blocks, use separate list_head for that.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
There is no reason why we allocate memory and copy data into an
intermediate buffer, it is not like we are working with data coming
from userspace.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
If we _WDG returned object that is not buffer we were forgetting
to free memory allocated for that object.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Driver initialization was forgetting to remove EC address space handler
in cases when parse_wdg() method failed.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Instead of registering (and removing) every attribute individually
switch to using sysfs attribute group. This makes sure that we
properly unwind and do not try to remove non-existent attributes which
may not be safe to do in the future.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
We need to include the SFI headers. This is fine as the SCU is only
relevant to x86 platforms with SFI.
Fixes the -next warning report.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
In 2.6.35 the hex_to_bin() was introduced.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Fix kconfig recursive dependency error in ACPI_TOSHIBA:
it uses both select and depends on for BACKLIGHT_CLASS_DEVICE.
drivers/video/backlight/Kconfig:117:error: recursive dependency detected!
drivers/video/backlight/Kconfig:117: symbol BACKLIGHT_CLASS_DEVICE is selected by ACPI_TOSHIBA
drivers/platform/x86/Kconfig:490: symbol ACPI_TOSHIBA depends on LEDS_CLASS
drivers/leds/Kconfig:12: symbol LEDS_CLASS is selected by BACKLIGHT_ADP8860
drivers/video/backlight/Kconfig:285: symbol BACKLIGHT_ADP8860 depends on BACKLIGHT_CLASS_DEVICE
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The driver uses sparse keymap library and does not use this field
anymore.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The GPS rfkill crappy code. The ops_data argument wasn't
set, and was totally misused. The fix have been tested
on an Asus R2H.
Cc: stable@kernel.org
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Makes asus-laptop and eeepc-laptop _init/_exit functions
looks exactly the same as they do the same thing.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Instead of implementing its own version of keymap hanlding switch over
to using sparse keymap library.
Also, install notify handler only after we allocated input device,
otherwise we may risk getting event too early and crash. Similarly,
notify handler should be removed before we unregister input device.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
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>
Instead of implementing its own version of keymap hanlding switch over to
using sparse keymap library.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
nstead of implementing its own version of keymap hanlding switch over to
using sparse keymap library.
Cc: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Instead of implementing its own version of keymap hanlding switch over to
using sparse keymap library.
Acked-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
All file_operations should get a .llseek operation so we can make
nonseekable_open the default for future file operations without a
.llseek pointer.
The three cases that we can automatically detect are no_llseek, seq_lseek
and default_llseek. For cases where we can we can automatically prove that
the file offset is always ignored, we use noop_llseek, which maintains
the current behavior of not returning an error from a seek.
New drivers should normally not use noop_llseek but instead use no_llseek
and call nonseekable_open at open time. Existing drivers can be converted
to do the same when the maintainer knows for certain that no user code
relies on calling seek on the device file.
The generated code is often incorrectly indented and right now contains
comments that clarify for each added line why a specific variant was
chosen. In the version that gets submitted upstream, the comments will
be gone and I will manually fix the indentation, because there does not
seem to be a way to do that using coccinelle.
Some amount of new code is currently sitting in linux-next that should get
the same modifications, which I will do at the end of the merge window.
Many thanks to Julia Lawall for helping me learn to write a semantic
patch that does all this.
===== begin semantic patch =====
// This adds an llseek= method to all file operations,
// as a preparation for making no_llseek the default.
//
// The rules are
// - use no_llseek explicitly if we do nonseekable_open
// - use seq_lseek for sequential files
// - use default_llseek if we know we access f_pos
// - use noop_llseek if we know we don't access f_pos,
// but we still want to allow users to call lseek
//
@ open1 exists @
identifier nested_open;
@@
nested_open(...)
{
<+...
nonseekable_open(...)
...+>
}
@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f)
{
<+...
(
nonseekable_open(...)
|
nested_open(...)
)
...+>
}
@ read disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}
@ read_no_fpos disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
... when != off
}
@ write @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}
@ write_no_fpos @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
... when != off
}
@ fops0 @
identifier fops;
@@
struct file_operations fops = {
...
};
@ has_llseek depends on fops0 @
identifier fops0.fops;
identifier llseek_f;
@@
struct file_operations fops = {
...
.llseek = llseek_f,
...
};
@ has_read depends on fops0 @
identifier fops0.fops;
identifier read_f;
@@
struct file_operations fops = {
...
.read = read_f,
...
};
@ has_write depends on fops0 @
identifier fops0.fops;
identifier write_f;
@@
struct file_operations fops = {
...
.write = write_f,
...
};
@ has_open depends on fops0 @
identifier fops0.fops;
identifier open_f;
@@
struct file_operations fops = {
...
.open = open_f,
...
};
// use no_llseek if we call nonseekable_open
////////////////////////////////////////////
@ nonseekable1 depends on !has_llseek && has_open @
identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
struct file_operations fops = {
... .open = nso, ...
+.llseek = no_llseek, /* nonseekable */
};
@ nonseekable2 depends on !has_llseek @
identifier fops0.fops;
identifier open.open_f;
@@
struct file_operations fops = {
... .open = open_f, ...
+.llseek = no_llseek, /* open uses nonseekable */
};
// use seq_lseek for sequential files
/////////////////////////////////////
@ seq depends on !has_llseek @
identifier fops0.fops;
identifier sr ~= "seq_read";
@@
struct file_operations fops = {
... .read = sr, ...
+.llseek = seq_lseek, /* we have seq_read */
};
// use default_llseek if there is a readdir
///////////////////////////////////////////
@ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier readdir_e;
@@
// any other fop is used that changes pos
struct file_operations fops = {
... .readdir = readdir_e, ...
+.llseek = default_llseek, /* readdir is present */
};
// use default_llseek if at least one of read/write touches f_pos
/////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
struct file_operations fops = {
... .read = read_f, ...
+.llseek = default_llseek, /* read accesses f_pos */
};
@ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
struct file_operations fops = {
... .write = write_f, ...
+ .llseek = default_llseek, /* write accesses f_pos */
};
// Use noop_llseek if neither read nor write accesses f_pos
///////////////////////////////////////////////////////////
@ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
struct file_operations fops = {
...
.write = write_f,
.read = read_f,
...
+.llseek = noop_llseek, /* read and write both use no f_pos */
};
@ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
struct file_operations fops = {
... .write = write_f, ...
+.llseek = noop_llseek, /* write uses no f_pos */
};
@ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
struct file_operations fops = {
... .read = read_f, ...
+.llseek = noop_llseek, /* read uses no f_pos */
};
@ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Julia Lawall <julia@diku.dk>
Cc: Christoph Hellwig <hch@infradead.org>
The undocumented interface we're using for reading CPU power seems to be
overreporting power. Until we figure out how to correct it, disable CPU
turbo and power reporting to be safe. This will keep the CPU within default
limits and still allow us to increase GPU frequency as needed.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The BIOS may hand us a lower CPU power limit than the default for a
given SKU. We should use it in case the platform isn't designed to
dissapate the full TDP of a given part.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Both when polling the current turbo status (in poll_turbo_status mode)
and when handling thermal events (in ips_irq_handler) the current status
of GPU turbo is updated to match the hardware status. However if during
driver initialisation we were unable aquire linkage to the i915 driver
enabling GPU turbo will lead to an oops on the first attempt to determine
GPU busy status.
Ensure that we do not enable GPU turbo unless we have driver linkage.
BugLink: http://bugs.launchpad.net/bugs/632430
Cc: stable@kernel.org
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Print some interesting values when MCP limits
are exceeded.
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
They're optional. If not present or sane, we should use the CPU
defaults.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
If the CPU doesn't support turbo, don't try to enable/disable it.
http://bugzilla.kernel.org/show_bug.cgi?id=18742
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The patch is to create ips_adjust thread before ips_monitor begins
to run because the latter will kthread_stop() or wake up the former
via ips->adjust pointer. Without this change, it is possible that
ips->adjust is NULL when kthread_stop() or wake_up_process() is
called in ips_monitor().
Signed-off-by: minskey guo <chaohong.guo@intel.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
In ips_get_i915_syms(), the symbol i915_gpu_busy() is not released
when error occurs.
Signed-off-by: minskey guo <chaohong.guo@intel.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The variable old_cpu_power is used to save the value of THM_CEC
register. In get_cpu_power(), it will be divided by 65535.
Signed-off-by: minskey guo <chaohong.guo@intel.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The mask of sequence number in THM_ITV register is 16bit width instead
of 8bit.
Signed-off-by: minskey guo <chaohong.guo@intel.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Change the code so that it will use the correct size for keymap entries.
Do it in a way that makes it harder to screw it up in the future.
Reported-by: Jaime Velasco Juan <jsagarribay@gmail.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
We should pass the data to the data register.
Signed-off-by: Jianwei Yang <jianwei.yang@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
It looks like there is an off-by-one error in one of your changes to
drivers/staging/rar_register/rar_register.c:
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
Don't ask how ACPI_TOSHIBA got enabled on in desktop system's .config -
I don't know. But it has silently been there until I tried 2.6.36-rc2,
where it broke the build because I don't have LED support turned on.
Attached patch fixes things up.
(I had to change BACKLIGHT_CLASS_DEVICE to "depends" because otherwise
I get unsightly core dumps out of scripts/kconfig/conf).
jon
--
toshiba: make sure we pull in LED support
The Toshiba extras driver uses the LED module, so make sure we have it
configure in.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Like others in the Mini series, the Dell Mini 1012 does not support
the smbios hook required by dell-laptop.
Signed-off-by: Victor van den Elzen <victor.vde@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
On the T410s and most likely other current models, Fn-F6 is labeled as
Camera/Headphone key. Report key presses as KEY_CAMERA.
Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Acked-by: Jerone Young <jerone.young@canonical.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Use the quirks engine to select model-specific keymaps, which makes
it much easier to extend should we need it.
Keycodes are based on the tables at
http://www.thinkwiki.org/wiki/Default_meanings_of_special_keys.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Use a safer coding style for the hotkey keymap. This does not fix any
problems, as the current code is correct. But it might help avoid
mistakes in the future.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
acpi_video_backlight_support() already tells us if ACPI is handling
backlight control through the generic ACPI handle. It is better to just
trust it.
While at it, adjust down a printk priority, and test earlier for
brightness_enable=0.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The Linux ACPI core locates the ACPI video devices for us and marks them
with ACPI_VIDEO_HID. Use that information to locate the video device
instead of a half-baked hunt for _BCL.
This uncouples the detection of the number of backlight brightness
levels on ThinkPads from the ACPI paths in vid_handle.
With this change, the driver should be able to always detect whether the
ThinkPad uses a 8-level or 16-level brightness scale even on newer
models for which the vid_handle paths have not been updated yet.
It will skip deactivated devices in the ACPI device tree, which is a
change in behaviour.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
There is a potential NULL dereference of "limits." We can just return
NULL earlier to avoid it. The caller already handles NULL returns.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The assignment of ret to -EIO appears to only make sense if the branch that
it is aligned with is executed, so move it into that branch.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable braces4@
position p1,p2;
statement S1,S2;
@@
(
if (...) { ... }
|
if (...) S1@p1 S2@p2
)
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
if (p1[0].column == p2[0].column):
cocci.print_main("branch",p1)
cocci.print_secs("after",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
IRQ and resource[] may not have correct values until
after PCI hotplug setup occurs at pci_enable_device() time.
The semantic match that finds this problem is as follows:
// <smpl>
@@
identifier x;
identifier request ~= "pci_request.*|pci_resource.*";
@@
(
* x->irq
|
* x->resource
|
* request(x, ...)
)
...
*pci_enable_device(x)
// </smpl>
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
We don't need a dev_warn when we exceed a thermal or power limit as
we'll handle it appropriately by clamping down on the CPU, GPU or both
as needed.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Size for PMIC read/write command is byte, while it is DWORD for other
IPC commands.
Signed-off-by: Hong Liu <hong.liu@intel.com>
Signed-off-by: ALan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Data is 2-byte per entry for PMIC read-modify-update command.
Signed-off-by: Hong Liu <hong.liu@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Don't pass more bytes in the command length field than we filled.
Signed-off-by: Andy Ross <andy.ross@windriver.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
some messages take 4 bytes, but only fill 3 bytes....
this patch makes sure that whatever we send to the SCU is zeroed first
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The stack buffer for IPC messages was 16 bytes, limiting messages to a
size of 4 (each message is 32 bit).
However, the touch screen driver is trying to send messages of size 5....
(AC: Set to 20 bytes having checked the max size allowed)
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
This provides an architecture level board identify function to replace the
cpuid direct usage
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
The firmware of production devices does not support this interface so this
is dead code.
Signed-off-by: Sreedhara DS <sreedhara.ds@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Changes to work on bothMmoorestown and Medfield
New pci id added for Medfield
Return type of ipc_data_readl chnaged from u8 to u32
Signed-off-by: Sreedhara DS <sreedhara.ds@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Intel SCU message formats depend upon the processor type. Replace the
module option with automatic detection of the processor type.
Signed-off-by: Sreedhara DS <sreedhara.ds@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
My .config contains ACER_WMI=m. On SPARC. That does not make sense.
Restrict the x86 platform driver menu to x86.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Make dell_laptop_i8042_filter() static as it's used only in dell-laptop.c
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
This patch includes below fixes:
1. return -ENOMEM instead of 0 if input_allocate_device fail.
2. fix wrong goto if sparse_keymap_setup fail.
3. fix wrong goto if input_register_device fail.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
backlight is needlessly defined global.
This patch makes the symbol static.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Add support for Toshiba Illumination. This is a set of LEDs installed on
some Toshiba laptops. It is controlled through ACPI, the commands has been
found through reverse engineering. It has been tested on a Toshiba Qosmio
G50-122.
Signed-off-by: Pierre Ducroquet <pinaraf@pinaraf.info>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Moorestown has PMIC chip which contains GPIO blocks. The PMIC chip is
connected to Langwell by SPI interface. So this GPIO driver will be regarded
as SPI GPIO expander though the actual GPIO access is through IPC and SRAM.
The SPI master contoller will probe this device driver by parsing SPIB table.
Cleaned up for new IPC, GPE removed and some printk and other tidying by
Alan Cox. Fixes for points noted by Matthew Garrett
Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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
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
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
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
-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>
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>