1
0
Fork 0
Commit Graph

160 Commits (4dc1360203c442826ed6306d7f73b10eb7cec9ee)

Author SHA1 Message Date
Azael Avalos 3b8760009d toshiba_acpi: Remove no longer needed hci_{read, write}2 functions
This patch removes the hci_{read, write}2 functions from the driver,
and the toshiba_hotkey_event_type_get function was adapted to use the
tci_raw function.

The hci_write2 function was only used by the bluetooth rfkill code,
but since its removal, it was causing build warnings, and the
hci_read2 function was only used by the toshiba_hotkey_event_type_get
function.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-05-11 10:38:19 -07:00
Azael Avalos 2b74103547 toshiba_acpi: Remove bluetooth rfkill code
This patch removes all bluetooth rfkill related code residing in
the toshiba_acpi driver.

Separate patches will add (and adapt) the code to toshiba_bluetooth
(where it belongs).

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-05-06 15:12:38 -07:00
Hans de Goede 358d6a2c3e toshiba_acpi: Do not register vendor backlight when acpi_video bl is available
commit a39f46df33 ("toshiba_acpi: Fix regression caused by backlight extra
check code") causes the backlight to no longer work on the Toshiba Z30,
reverting that commit fixes this but restores the original issue fixed
by that commit.

Looking at the toshiba_acpi backlight code for a fix for this I noticed that
the toshiba code is the only code under platform/x86 which unconditionally
registers a vendor acpi backlight interface, without checking for acpi_video
backlight support first.

This commit adds the necessary checks bringing toshiba_acpi in line with the
other drivers, and fixing the Z30 regression without needing to revert the
commit causing it.

Chances are that there will be some Toshiba models which have a non working
acpi-video implementation while the toshiba vendor backlight interface does
work, this commit adds an empty dmi_id table where such systems can be added,
this is identical to how other drivers handle such systems.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1206036
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=86521
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-and-tested-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-04-24 11:08:53 -07:00
Azael Avalos bb26f1893a toshiba_acpi: Fix pr_* messages from USB Sleep Functions
This patch fixes the messages displayed by the USB Sleep Functions,
they were printing wrong messages not associated to the feature
currently queried.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-04-07 20:47:31 -07:00
Azael Avalos c8c918425a toshiba_acpi: Update and fix USB Sleep and Charge modes
This patch fixes the USB Sleep and Charge mode on certain models
where the value returned by the BIOS is different, and thus, making
this feature not to work for those models.

Also, the "Typical" charging mode was added as a supported mode.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-04-07 20:47:31 -07:00
Azael Avalos fb42d1f491 toshiba_acpi: Fix the enabling of the Special Functions
Some Toshiba laptops with the "Special Functions" feature enabled
fail to properly enable such feature unless a specific value is
used to enable the hotkey events.

This patch adds a new function called "*_enable_special_functions",
that simply makes a call to the HCI_HOTKEY_EVENT call, but this time
we are using a different parameter to make the "Special Functions"
mode work as expected.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-03-25 10:58:24 -07:00
Azael Avalos a2b3471b5b toshiba_acpi: Use the Hotkey Event Type function for keymap choosing
With the previous patch adding support to "Hotkey Event Type", we can
now use the type to distinguish which keymap to use.

This patch changes the toshiba_acpi_setup_keyboard function to make
use of the hotkey event type to choose the correct keymap without the
need to use the DMI matching list.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-03-25 10:58:24 -07:00
Azael Avalos 56e6b35339 toshiba_acpi: Add Hotkey Event Type function and definitions
This patch adds support to query the "Hotkey Event Type" the system
supports.

There are two main event types (so far), 0x10 and 0x11, with the
first being all those laptops that have the old keyboard layout, and
the latter all those new laptops with the new keyboard layout.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-03-25 10:58:24 -07:00
Azael Avalos bab09e23ac toshiba_acpi: Update events in toshiba_acpi_notify
This patch adds a few more events sent to TOSXXXX devices, some of
them are already identified, while some others simply print a message
informing the type of event received.

Also, a netlink event is generated so that userspace apps, daemons,
etc. act accordingly to these events.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-03-14 12:06:33 -07:00
Darren Hart c57c0fa4bc toshiba_acpi: Cleanup GPL header
Remove the Free Software Foundation street address paragraph and
reference COPYING.

Remove an empty TODO block.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 21:26:18 -08:00
Darren Hart e0769fe6f2 toshiba_acpi: Cleanup comment blocks and capitalization
Ensure multiline comments start with /* and */ each on its own line.
Capitalize the first word of comments.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 21:17:19 -08:00
Azael Avalos 0c3c0f10d4 toshiba_acpi: Make use of DEVICE_ATTR_{RO, RW} macros
This patch makes use of the DEVICE_ATTR_{RO, RW} macros to simplify
sysfs attributes declarations.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 21:17:19 -08:00
Azael Avalos 9d30984819 toshiba_acpi: Drop the toshiba_ prefix from sysfs function names
This patch removes the toshiba_ prefix from all the sysfs function
names and adapted the code according to coding style.

Also a few functions were renamed to match the sysfs entry, as this
patch is a preparation for the next patch to switch to
DEVICE_ATTR_{RO, RW, WO} macros.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 21:17:18 -08:00
Azael Avalos 9bd1213b12 toshiba_acpi: Move sysfs function and struct declarations further down
Commit 93f8c16d63 ("toshiba_acpi: Support new keyboard backlight
type") moved all the sysfs structs and function declarations further
up in order to make use of sysfs_update_group, however,
commit 805469053b ("toshiba_acpi: Add keyboard backlight mode
change event") made use of that function unnecesary.

This patch moves all the sysfs structs and function declarations
further down, making the file shorther in lines and more readable.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 21:16:27 -08:00
Azael Avalos b516399272 toshiba_acpi: Clean file according to coding style
This patch simply cleans the the driver out of 2 errors and 17
warnings according to "checkpatch -f", no functionality was changed,
simply a cleanup.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 21:03:07 -08:00
Azael Avalos 7216d7021d toshiba_acpi: Bump version number to 0.21
Several new features were added on previous patches, so lets bump up
the driver version.

And also, update the copyright year.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 20:40:48 -08:00
Azael Avalos 17fe4b3d31 toshiba_acpi: Add support to enable/disable USB 3
Toshiba laptops that come with USB 3 ports have a feature that lets
them disable USB 3 functionality and act as a regular USB 2 port, and
thus, saving power.

This patch adds support to that feature, by creating a sysfs entry
named "usb_three", acceptig only two parameters, 0 to disable the
USB 3 (acting as a USB 2) and 1 to enable it, however, a reboot is
needed everytime this is toggled.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 20:40:48 -08:00
Azael Avalos 35d53ceaf7 toshiba_acpi: Add support for Panel Power ON
Toshiba laptops come with a feature called "Panel Open - Power ON",
which makes the laptop turn on whenever the LID is opened.

This patch adds support for such feature, by creating a sysfs entry
named "panel_power_on", accepting only two values, 0 to disable and
1 to enable such feature, however, a reboot is needed on every mode
change.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 20:40:48 -08:00
Azael Avalos bae84195b4 toshiba_acpi: Add support for Keyboard functions mode
Recent Toshiba laptops that come with the new keyboard layout have
the Special Functions (hotkeys) enabled by default, which, in order to
access the F{1-12} keys, you need to press the FN-F{1-12} key to
access such key.

This patch adds support to toggle the Keyboard Functions operation
mode by creating the sysfs entry "kbd_functions_keys", accepting only
two parameters, 0 to set the "Normal Operation" mode and 1 to set the
"Special Functions" mode, however, everytime the mode is toggled, a
restart is needed.

In the "Normal Operation" mode, the F{1-12} keys are as usual and
the hotkeys are accessed via FN-F{1-12}.

In the "Special Functions" mode, the F{1-12} keys trigger the hotkey
and the F{1-12} keys are accessed via FN-F{1-12}.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 20:40:48 -08:00
Azael Avalos 94477d4cfe toshiba_acpi: Add fan entry to sysfs
This patch adds a fan entry to sysfs, enabling the user to get and
set the fan status.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 20:40:48 -08:00
Azael Avalos c6c68ff812 toshiba_acpi: Add version entry to sysfs
This patch adds a new entry to the sysfs, showing the version of the
driver.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-11 20:40:48 -08:00
Azael Avalos 98fc4ec64a toshiba_acpi: Make toshiba_eco_mode_available more robust
Some Toshiba laptops do not come with the ECO led installed, however,
the driver is registering support for it when it should not.

This patch makes the toshiba_eco_mode_available function more robust
in detecting ECO led capabilities, not registering the led on laptops
that do not support it and registering the led when it really does.

The ECO led function now returns 0x8e00 (Not Installed) by querying
with in[3] = 0, whenever theres no physical LED installed, and
returning 0x8300 (Input Data Error) when it is, however, there are
some BIOSes that have stub function calls not returning anything and
and the LED device was being registered too, hence the change of the
default return value from 1 to 0.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>

Minor comment update, fixed a whitespace error, s/truly/actual/.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-02-09 20:21:02 -08:00
Azael Avalos fa465739d4 toshiba_acpi: Add a check for TOS_NOT_SUPPORTED in the sci_open function
This was "toshiba_acpi: Change sci_open function return value"

Some Toshiba laptops have "poorly implemented" SCI calls on their
BIOSes and are not checking for sci_{open, close} calls, therefore,
the sci_open function is failing and making some of the supported
features unavailable (kbd backlight, touchpad, illumination, etc.).

This patch checks whether we receive TOS_NOT_SUPPORTED and returns
1, making the supported features work on such laptops.

In the case that some laptops really do not support the SCI, all the
SCI dependent functions check for TOS_NOT_SUPPORTED, and thus, not
registering support for the queried feature.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-01-28 21:55:01 -08:00
Azael Avalos 172ce0a9f6 toshiba_acpi: Add support for USB Sleep and Music
Newer Toshiba laptops now come with a feature called USB Sleep and
Music, where the laptop speakers remain powered and the line-in jack
is used to connect an external device to use the laptop speakers when
the computer is asleep or turned off.

This patchs adds support to such feature, by creating a sysfs entry
named "usb_sleep_music", accepting only two values, 0 to disable and
1 to enable.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-01-23 09:08:26 -08:00
Azael Avalos bb3fe01ff6 toshiba_acpi: Add support for USB Rapid Charge
Newer Toshiba laptops equipped with USB 3.0 ports now have the
functionality of rapid charging devices connected to their USB hubs.

This patch adds support to use such feature by creating a sysfs entry
named "usb_rapid_charge", accepting only two values, 0 to disable and
1 to enable, however, the machine needs a restart everytime the
function is toggled.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-01-23 09:08:25 -08:00
Azael Avalos 182bcaa5c9 toshiba_acpi: Add support for USB Sleep functions under battery
Toshiba laptops supporting USB Sleep and Charge also come with a
feature called "USB functions under battery", which what it does when
enabled, is allows the USB Sleep functions when the computer is under
battery power.

This patch adds support to that function, creating a sysfs entry
named "sleep_functions_on_battery", accepting values from 0-100,
where zero disables the function and 1-100 sets the battery level at
which point the USB Sleep functions will be disabled, and printing
the current state of the functon and also the battery level currently
set.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-01-23 09:08:25 -08:00
Azael Avalos e26ffe5124 toshiba_acpi: Add support for USB Sleep and Charge function
Newer Toshiba models now come with a feature called Sleep and Charge,
where the computer USB ports remain powered when the computer is
asleep or turned off.

This patch adds support to such feature, creating a sysfs entry
called "usb_sleep_charge" to set the desired charging mode or to
disable it.

The sysfs entry accepts three parameters, 0, 1 and 2, beign disabled,
alternate and auto respectively.

The auto mode stands for USB conformant devices (which most are), and
the alternate mode stands for those non USB conformant devices that
require more power.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2015-01-23 09:08:19 -08:00
Azael Avalos 805469053b toshiba_acpi: Add keyboard backlight mode change event
A previous patch added support to handle more events.

This patch adds support to update the sysfs group whenever we receive
a 0x92 event, which indicates a change in the keyboard backlight mode,
removing the update group code from toshiba_kbd_bl_mode_store, as it is
no longer needed there.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-12-03 10:10:18 -08:00
Azael Avalos 71454d78d3 toshiba_acpi: Change notify funtion to handle more events
Currently the function toshiba_acpi_notify only takes care of hotkeys,
however, the TOSXXXX devices receive more events that can be useful.

This patch changes the function to be able to handle more events,
and in the process, move all hotkey related code residing in it to
a new function called toshiba_acpi_process_hotkeys.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-12-03 10:10:17 -08:00
Azael Avalos 1f28f2908e toshiba_acpi: Move hotkey enabling code to its own function
The hotkey enabling code is being used by *_setup_keyboard and also by
*_resume.

This patch creates a new function called toshiba_acpi_enable_hotkeys to
be used by these two functions to avoid duplicating code.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-12-03 10:10:17 -08:00
Ondrej Zary 63a9e016e8 toshiba-acpi: Add missing ID (TOS6207)
toshiba-acpi was always missing TOS6207 ID so it did not load automatically
on some laptops (such as Portege R100). But it worked fine if loaded manually.
Commit 135740de77 ("toshiba_acpi: Convert to use acpi_driver") broke that
and the driver does not work even when loaded manually since then.

Add TOS6207 ID to fix it.

Tested on Toshiba Portege R100.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-12-03 10:10:15 -08:00
Markus Elfring 0098181016 platform: x86: Deletion of checks before backlight_device_unregister()
The backlight_device_unregister() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
For msi-wmi.c:
Acked-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-12-03 10:10:14 -08:00
Azael Avalos a39f46df33 toshiba_acpi: Fix regression caused by backlight extra check code
Bug 86521 uncovered that some TOS6208 devices also return
non zero values on a write call to the backlight method,
thus getting caught and bailed out by the extra check code.

This patch changes the set_lcd_brightness function to its
"original" state by just adapting it to the new function
format.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-12-03 10:10:14 -08:00
Giedrius Statkevičius 98280374ff drivers: platform: change 0x20 to I8042_STR_AUXDATA in i8042 filters
Instead of using a magic constant 0x20 in some drivers to get data only
from the KBC port we should use the constant defined in i8042.h with
the same value. Also, this makes these drivers uniform with what
constant the only other filter function uses in
drivers/input/misc/ideapad_slidebar.c.

Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-11-19 09:07:07 -08:00
Aaron Lu b1bde689dd toshiba_acpi: Add Toshiba TECRA A50-A to the alt keymap dmi list
As bug #72551, the Toshiba TECRA A50-A series models also come with the
new keymap layout as found out by Azael Avalos, so add it to the dmi
table.

Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=76971
Reported-and-tested-by: Blindekinder <rafael.raccuia@blindekinder.com>
Cc: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-10-27 21:45:11 -07:00
Azael Avalos eabde0fa96 toshiba_acpi: Adapt kbd_bl_timeout_store to the new kbd type
With the introduction of the new keyboard backlight
implementation, the *_timeout_store function is
broken, as it only supports the first kbd_type.

This patch adapts such function for the new kbd_type,
as well as converts from using sscanf to kstrtoint.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-10-06 17:44:42 -07:00
Azael Avalos 893f3f62dc toshiba_acpi: Change HCI/SCI functions return code type
Currently the HCI/SCI read/write functions are returning
the status of the ACPI call and also assigning the
returned value of the HCI/SCI function, however, only
the HCI/SCI status is being checked.

This patch changes such functions, returning the value
of the HCI/SCI function instead of the ACPI call status,
eliminating one parameter, and returning something
useful that indeed is being checked.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-09-30 13:51:08 -07:00
Azael Avalos 1864bbc207 toshiba_acpi: Unify return codes prefix from HCI/SCI to TOS
The return codes are split in between HCI/SCI prefixes,
but they are shared (used) by both interfaces, mixing
hci_read/write calls with SCI_* return codes, and
sci_read/write calls with HCI_* ones.

This patch changes the prefix of the return codes
definitions, dropping the HCI/SCI naming and instead
replacing it with TOS (for TOShiba).

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-09-30 13:51:07 -07:00
Azael Avalos 258c590326 toshiba_acpi: Rename hci_raw to tci_raw
The function name hci_raw was used before to reflect
a raw (read/write) call to Toshiba's Hardware
Configuration Interface (HCI), however, since the
introduction of the System Configuration Interface
(SCI), that "name" no longer applies.

This patch changes the name of that function to
tci_raw (for Toshiba Configuration Interface), and
change the comments about it.

Also, the HCI_WORDS definition was changed to TCI_RAW,
to better reflect that we're no longer using pure HCI
calls, but a combination of HCI and SCI, which form
part of the Toshiba Configuration Interface.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-09-30 13:51:07 -07:00
Azael Avalos 93f8c16d63 toshiba_acpi: Support new keyboard backlight type
Newer Toshiba models now come with a new (and different) keyboard
backlight implementation with three modes of operation: TIMER,
ON and OFF, and the LED is now controlled internally by the firmware.

This patch adds support for that type of backlight, changing the
existing code to accomodate the new implementation.

The timeout value range is now 1-60 seconds, and the accepted
modes are now: 1 (FN-Z), 2 (AUTO or TIMER), 8 (ON) and 10 (OFF),
this adds two new entries kbd_type and available_kbd_modes,
the first shows the keyboard type and the latter shows the
supported modes depending on the keyboard type.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-09-17 13:55:52 -07:00
Azael Avalos c8a41669a7 toshiba_acpi: Change touchpad store to check for invalid values
The function toshiba_touchpad_store is not checking
for invalid values and simply returns silently.

This patch checks for invalid values and returns accordingly.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-09-17 13:55:52 -07:00
Azael Avalos 12962878fb toshiba_acpi: Fix illumination not available on certain models
Some Toshiba models with illumination support set a different
value on the returned codes, thus not allowing the illumination
LED to be registered, where it should be.

This patch removes a check from toshiba_illumination_available
function to allow such models to register the illumination LED.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-09-17 13:55:51 -07:00
Azael Avalos 408a5d136b toshiba_acpi: Additional hotkey scancodes
Appart from reporting hotkeys, the INFO method is used
as a system wide event notifier for hardware or
software changes.

This patch adds additional "events" to the keymap list,
ignored by now, until we find them a good use.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-09-17 13:55:51 -07:00
Dan Carpenter aeaac098bd toshiba_acpi: fix and cleanup toshiba_kbd_bl_mode_store()
The current code just returns -EINVAL because mode can't be equal to
both 1 and 2.

Also this function is messy so I have cleaned it up:
1) Remove initializers like "int time = -1".  Initializing variables to
   garbage values turns off GCC's uninitialized variable warnings so it
   can lead to bugs.
2) Use kstrtoint() instead of sscanf().
3) Use SCI_KBD_MODE_FNZ and SCI_KBD_MODE_AUTO instead of magic numbers 1
   and 2.
4) Don't check for "mode == -1" because that can't happen.
5) Preserve the error code from toshiba_kbd_illum_status_set().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-09-03 10:45:12 -07:00
Benjamin Tissoires e7fdb762b9 platform/x86: toshiba: re-enable acpi hotkeys after suspend to disk
On the Toshiba Tecra Z40, after a suspend-to-disk, some FN hotkeys
driven by toshiba_acpi are not functional.

Calling the ACPI object ENAB on resume makes them back alive.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
2014-09-02 15:45:36 -07:00
Matthew Garrett 8039aabb6c Revert "platform/x86/toshiba-apci.c possible bad if test?"
This reverts commit bdc3ae7221.

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-08-20 08:18:18 -07:00
Azael Avalos e6efad7f29 toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list
The Toshiba Qosmio X75-A series models also come with
the new keymap layout.

This patch adds this model to the alt_keymap_dmi list,
along with an extra key found on these models.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-08-16 01:23:55 -07:00
Azael Avalos f6aac65229 toshiba_acpi: Add extra check to backlight code
Some Toshiba models (most notably Qosmios) come with an
incomplete backlight method where the AML code doesn't
check for write or read commands and always returns
HCI_SUCCESS and the actual brightness (and in some
cases the max brightness), thus allowing the backlight
interface to be registered without write support.

This patch changes the set_lcd_brightness function,
checking the returned values for values greater than
zero to avoid registering a broken backlight interface.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-08-16 01:23:54 -07:00
Nick bdc3ae7221 platform/x86/toshiba-apci.c possible bad if test?
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-08-16 01:23:49 -07:00
Takashi Iwai fe808bfb59 toshiba_acpi: Add alternative keymap support for Satellite M840
Toshiba Satellite M840 laptop has a complete different keymap although
it's bound with the same ACPI ID "TOS1900".  This patch provides an
alternative keymap specific to this machine by identifying via DMI
matching.  The keymap table doesn't fill all entries that were used
before since some keys aren't found on this machine at all.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69761
Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=812209
Reported-and-tested-by: Federico Vecchiarelli <fedev@gmx.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-06-09 17:39:58 -04:00
Matthew Garrett ea6b31f494 toshiba_acpi: Fix whitespace
Tidy up whitespace introduced by the previous patchset

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-04-06 12:58:14 -04:00
Azael Avalos 548c43065f toshiba_acpi: Update version and copyright info
Given that some new features were added to the
driver, bump its version to 0.20 and add myself
to the copyright list for these new features
that were added.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-04-06 12:58:14 -04:00
Azael Avalos 5a2813e97a toshiba_acpi: Add accelerometer support
Recent Toshiba laptops now come equiped with a built in
accelerometer (TOS620A) device, but such device does not
expose the axes information, however, HCI calls 0x006d
and 0x00a6 can be used to query such info.

This patch adds support to read the axes values by
exposing them through the _position_ sysfs file.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-04-06 12:58:14 -04:00
Azael Avalos def6c4e25d toshiba_acpi: Add ECO mode led support
Newer Toshiba laptops now come with a feature called
ECO Mode, where the system is put in low power consupmtion
state and a green (world shaped with leaves) icon illuminates
indicating that the system is in such power state.

This patch adds support to turn on/off the ECO led by
creating and registering the toshiba::eco_mode led.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-04-06 12:58:14 -04:00
Azael Avalos 9d8658acd6 toshiba_acpi: Add touchpad enable/disable support-
Toshiba laptops have two ways of letting userspace
know the touchpad has changed state, one with a
button on top of the touchpad that simply emmits
scancodes whenever enabled/disabled, and another one
by pressing Fn-F9 (touchpad toggle) hotkey.

This patch adds support to enable/disable the touchpad
by exposing the _touchpad_ file in sysfs that simply
makes a call to a SCI register, imitating what
Toshiba provided software does on Windows.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-04-06 12:58:14 -04:00
Azael Avalos 360f0f39d0 toshiba_acpi: Add keyboard backlight support
Toshiba laptops equiped with an illuminated keyboard
can operate in two different modes: Auto and FN-Z.

The Auto mode turns on the led on keystrokes and
automatically turns it off after some (configurable)
time the last key was pressed.

The FN-Z mode is used to toggle the keyboard led on/off
by userspace.

This patch adds support to set the desired KBD mode and
timeout via sysfs, creates and registers toshiba::kbd_backlight
led device whenever the mode is set to FN-Z.

The acceptable values for mode are: 1 (Auto) and 2 (Fn-Z)
The time values range are: 1-60 seconds

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-04-06 12:58:13 -04:00
Azael Avalos fdb79081fe toshiba_acpi: Adapt Illumination code to use SCI
Change the toshiba_illumination_* code to use the
newly introduced SCI functions, making the code
more robust in detecting Illumination capabilities
properly, since it was only opening the SCI and
the return value was never checked for errors or
actual Illumination support.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-04-06 12:58:13 -04:00
Azael Avalos 84a6273f04 toshiba_acpi: Add System Configuration Interface
SCI stands for System Configuration Interface,
which aim is to conceal differences in hardware
between different models.

This patch introduces four new calls: sci_open,
sci_close, sci_read and sci_write, along with
its definitions and return codes which will be
used by later patches.

More information about the SCI can be found at
Jonathan Buzzard's website [1].

[1] http://www.buzzard.me.uk/toshiba/docs.html

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-04-06 12:58:13 -04:00
Linus Torvalds b7a8399edf Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86
Pull x86 platform drivers update from Matthew Garrett:
 "Nothing amazingly special here.  Some cleanups, a new driver to
  support a single button on some new HPs, a tiny amount of hardware
  enablement"

* 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86:
  ipc: add intel-mid's pci id macros
  hp-wireless: new driver for hp wireless button for Windows 8
  toshiba_acpi: Support RFKILL hotkey scancode
  hp_accel: Add a new PnP ID HPQ6007 for new HP laptops
  sony-laptop: remove unnecessary assigment of len
  fujitsu-laptop: fix error return code
  dell-laptop: Only install the i8042 filter when rfkill is active
  X86 platform: New BayTrail IOSF-SB MBI driver
  drivers: platform: Include appropriate header file in mxm-wmi.c
  drivers: platform: Mark functions as static in hp_accel.c
  dell-laptop: rkill whitelist Precision models
  ipc: simplify platform data approach
  asus-wmi: Convert to use devm_hwmon_device_register_with_groups
  compal-laptop: Use devm_hwmon_device_register_with_groups
  compal-laptop: Replace SENSOR_DEVICE_ATTR with DEVICE_ATTR
  eeepc-laptop: Convert to use devm_hwmon_device_register_with_groups
  compal-laptop: Use devm_kzalloc to allocate local data structure
  dell-laptop: fix to return error code in dell_send_intensity()
2014-01-29 18:54:05 -08:00
Unai Uribarri fec278a1dd toshiba_acpi: Support RFKILL hotkey scancode
This scancode is used in new 2013 models like Satellite P75-A7200.

Signed-off-by: Unai Uribarri <unaiur@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2014-01-21 08:44:18 -05:00
Rafael J. Wysocki 98feb7cc61 Merge branch 'acpi-cleanup'
* acpi-cleanup: (22 commits)
  ACPI / tables: Return proper error codes from acpi_table_parse() and fix comment.
  ACPI / tables: Check if id is NULL in acpi_table_parse()
  ACPI / proc: Include appropriate header file in proc.c
  ACPI / EC: Remove unused functions and add prototype declaration in internal.h
  ACPI / dock: Include appropriate header file in dock.c
  ACPI / PCI: Include appropriate header file in pci_link.c
  ACPI / PCI: Include appropriate header file in pci_slot.c
  ACPI / EC: Mark the function acpi_ec_add_debugfs() as static in ec_sys.c
  ACPI / NVS: Include appropriate header file in nvs.c
  ACPI / OSL: Mark the function acpi_table_checksum() as static
  ACPI / processor: initialize a variable to silence compiler warning
  ACPI / processor: use ACPI_COMPANION() to get ACPI device
  ACPI: correct minor typos
  ACPI / sleep: Drop redundant acpi_disabled check
  ACPI / dock: Drop redundant acpi_disabled check
  ACPI / table: Replace '1' with specific error return values
  ACPI: remove trailing whitespace
  ACPI / IBFT: Fix incorrect <acpi/acpi.h> inclusion in iSCSI boot firmware module
  ACPI / i915: Fix incorrect <acpi/acpi.h> inclusions via <linux/acpi_io.h>
  SFI / ACPI: Fix warnings reported during builds with W=1
  ...

Conflicts:
	drivers/acpi/nvs.c
	drivers/hwmon/asus_atk0110.c
2014-01-12 23:44:09 +01:00
Lv Zheng 8b48463f89 ACPI: Clean up inclusions of ACPI header files
Replace direct inclusions of <acpi/acpi.h>, <acpi/acpi_bus.h> and
<acpi/acpi_drivers.h>, which are incorrect, with <linux/acpi.h>
inclusions and remove some inclusions of those files that aren't
necessary.

First of all, <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h>
should not be included directly from any files that are built for
CONFIG_ACPI unset, because that generally leads to build warnings about
undefined symbols in !CONFIG_ACPI builds.  For CONFIG_ACPI set,
<linux/acpi.h> includes those files and for CONFIG_ACPI unset it
provides stub ACPI symbols to be used in that case.

Second, there are ordering dependencies between those files that always
have to be met.  Namely, it is required that <acpi/acpi_bus.h> be included
prior to <acpi/acpi_drivers.h> so that the acpi_pci_root declarations the
latter depends on are always there.  And <acpi/acpi.h> which provides
basic ACPICA type declarations should always be included prior to any other
ACPI headers in CONFIG_ACPI builds.  That also is taken care of including
<linux/acpi.h> as appropriate.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci stuff)
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (Xen stuff)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-12-07 01:03:14 +01:00
Joe Perches b222cca600 platform:x86: Remove OOM message after input_allocate_device
Emitting an OOM message isn't necessary after input_allocate_device
as there's a generic OOM and a dump_stack already done.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
2013-11-20 18:51:03 -05:00
Zhang Rui 74facaf75d toshiba_acpi: convert acpi_evaluate_object() to acpi_evaluate_integer()
acpi_evaluate_integer() is an ACPI API introduced to evaluate an
ACPI control method that is known to have an integer return value.
This API can simplify the code because the calling function does not need to
use the specified acpi_buffer structure required by acpi_evaluate_object();

Convert acpi_evaluate_object() to acpi_evaluate_integer()
in drivers/platform/x86/toshiba_acpi.c in this patch.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
CC: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-09-24 01:37:57 +02:00
Zhang Rui e2e196069f toshiba_acpi: convert acpi_get_handle() to acpi_has_method()
acpi_has_method() is a new ACPI API introduced to check
the existence of an ACPI control method.

It can be used to replace acpi_get_handle() in the case that
1. the calling function doesn't need the ACPI handle of the control method.
and
2. the calling function doesn't care the reason why the method is unavailable.

Convert acpi_get_handle() to acpi_has_method()
in drivers/platform/x86/toshiba_acpi.c in this patch.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
CC: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-09-24 01:37:56 +02:00
Zhang Rui 619400dae9 toshiba_acpi: convert acpi_evaluate_object() to acpi_execute_simple_method()
acpi_execute_simple_method() is a new ACPI API introduced to invoke
an ACPI control method that has single integer parameter and no return value.

Convert acpi_evaluate_object() to acpi_execute_simple_method()
in drivers/platform/x86/toshiba_acpi.c

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
CC: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-09-24 01:37:54 +02:00
Al Viro d9dda78bad procfs: new helper - PDE_DATA(inode)
The only part of proc_dir_entry the code outside of fs/proc
really cares about is PDE(inode)->data.  Provide a helper
for that; static inline for now, eventually will be moved
to fs/proc, along with the knowledge of struct proc_dir_entry
layout.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-04-09 14:13:32 -04:00
Linus Torvalds d895cb1af1 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile (part one) from Al Viro:
 "Assorted stuff - cleaning namei.c up a bit, fixing ->d_name/->d_parent
  locking violations, etc.

  The most visible changes here are death of FS_REVAL_DOT (replaced with
  "has ->d_weak_revalidate()") and a new helper getting from struct file
  to inode.  Some bits of preparation to xattr method interface changes.

  Misc patches by various people sent this cycle *and* ocfs2 fixes from
  several cycles ago that should've been upstream right then.

  PS: the next vfs pile will be xattr stuff."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
  saner proc_get_inode() calling conventions
  proc: avoid extra pde_put() in proc_fill_super()
  fs: change return values from -EACCES to -EPERM
  fs/exec.c: make bprm_mm_init() static
  ocfs2/dlm: use GFP_ATOMIC inside a spin_lock
  ocfs2: fix possible use-after-free with AIO
  ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path
  get_empty_filp()/alloc_file() leave both ->f_pos and ->f_version zero
  target: writev() on single-element vector is pointless
  export kernel_write(), convert open-coded instances
  fs: encode_fh: return FILEID_INVALID if invalid fid_type
  kill f_vfsmnt
  vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op
  nfsd: handle vfs_getattr errors in acl protocol
  switch vfs_getattr() to struct path
  default SET_PERSONALITY() in linux/elf.h
  ceph: prepopulate inodes only when request is aborted
  d_hash_and_lookup(): export, switch open-coded instances
  9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate()
  9p: split dropping the acls from v9fs_set_create_acl()
  ...
2013-02-26 20:16:07 -08:00
Al Viro 496ad9aa8e new helper: file_inode(file)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-02-22 23:31:31 -05:00
Rafael J. Wysocki 51fac8388a ACPI: Remove useless type argument of driver .remove() operation
The second argument of ACPI driver .remove() operation is only used
by the ACPI processor driver and the value passed to that driver
through it is always available from the given struct acpi_device
object's removal_type field.  For this reason, the second ACPI driver
.remove() argument is in fact useless, so drop it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
2013-01-26 00:37:24 +01:00
Greg Kroah-Hartman b859f15921 Drivers: platform: x86: remove __dev* attributes.
CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
markings need to be removed.

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

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

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Joey Lee <jlee@novell.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Peter Feuerer <peter@piie.net>
Cc: Corentin Chary <corentin.chary@gmail.com>
Cc: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
Cc: Robert Gerlach <khnz@gmx.de>
Cc: Ike Panhc <ike.pan@canonical.com>
Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-03 15:57:03 -08:00
Rafael J. Wysocki 3567a4e2c5 platform / x86 / PM: Fix unused function warnings for CONFIG_PM_SLEEP
According to compiler warnings, quite some suspend/resume functions
in platform x86 drivers are not used for CONFIG_PM_SLEEP unset, so
add #ifdefs to prevent them from being built in that case.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2012-08-10 14:29:43 +02:00
Rafael J. Wysocki 43d2fd3b9d toshiba_acpi: Use struct dev_pm_ops for power management
Make the toshiba_acpi driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct acpi_device_ops.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2012-07-01 13:31:02 +02:00
Rafael J. Wysocki 17621e11fd ACPI / PM: Drop pm_message_t argument from device suspend callback
None of the drivers implementing the ACPI device suspend callback
uses the pm_message_t argument of it, so this argument may be dropped
entirely from that callback.  This will simplify switching the ACPI
bus type to PM handling based on struct dev_pm_ops.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2012-07-01 13:30:58 +02:00
Matthew Garrett 53039f222c toshiba_acpi: Fix mis-merge
I managed to screw up the various backlight changes and ended up memsetting
the props structure after it had already been populated. This should fix it.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
2012-06-01 11:02:36 -04:00
Akio Idehara 121b7b0d29 toshiba_acpi: Add support for transflective LCD
Some Toshiba laptops have the transflective LCD and toshset
can control its backlight state.  I brought this feature to the
mainline.  To support transflective LCD, it's implemented by
adding an extra level to the backlight and having 0 change to
transflective mode.  It was tested on a Toshiba Portege R500.

Signed-off-by: Akio Idehara <zbe64533@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2012-05-31 14:26:39 -04:00
Seth Forshee 62cce75266 toshiba_acpi: Only register backlight device when interface is read/write
Currently the backlight device is registered unconditionally, but many
(probably most) Toshibas either don't support HCI_LCD_BRIGHTNESS or only
support reading from it. This patch adds a test of HCI_LCD_BRIGHTNESS
during initialization and only registers the backlight device if this
interface supports both reads and writes.

Cc: Akio Idehara <zbe64533@gmail.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2012-05-31 14:26:04 -04:00
Corentin Chary f5f4fd4516 backlight: initialize struct backlight_properties properly
In all these files, the .power field was never correctly initialized.

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Dave Airlie <airlied@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-29 16:22:30 -07:00
Seth Forshee f11f999e98 toshiba_acpi: Refuse to load on machines with buggy INFO implementations
Several Satellite models have a buggy implementation of the INFO method
that causes ACPI exceptions when executed:

 ACPI Error: Result stack is empty! State=ffff88012d70f800 (20110413/dswstate-98)
 ACPI Exception: AE_AML_NO_RETURN_VALUE, Missing or null operand (20110413/dsutils-646)
 ACPI Exception: AE_AML_NO_RETURN_VALUE, While creating Arg 0 (20110413/dsutils-763)
 ACPI Error: Method parse/execution failed [\_SB_.VALZ.GETE] (Node ffff880131175eb0), AE_AML_NO_RETURN_VALUE (20110413/psparse-536)
 ACPI Error: Method parse/execution failed [\_SB_.VALZ.INFO] (Node ffff880131175ed8), AE_AML_NO_RETURN_VALUE (20110413/psparse-536)
 toshiba_acpi: ACPI INFO method execution failed
 toshiba_acpi: Failed to query hotkey event

All known machines with this implementation also have a WMI interface
with event GUID 59142400-C6A3-40FA-BADB-8A2652834100 which is not seen
on any other models. Refuse to load toshiba_acpi on machines with this
guid.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2012-03-22 09:31:53 -04:00
Azael Avalos af502837a0 toshiba_acpi: Support additional hotkey scancodes
These scancodes are used by many of the models now supported with
the addition of TOS1900 device support.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2012-03-22 09:31:52 -04:00
Seth Forshee 29cd293f9f toshiba_acpi: Support alternate hotkey interfaces
There are two types of problems that prevent hotkeys from working
on many of the machines supported by toshiba_acpi. The first of
these is the lack of a functioning SCI for hotkey events. For these
machines it is possible to filter the Fn keypresses from the
keyboard and generate a notification by executing the ACPI NTFY
method.

The second problem is a lack of support for HCI_SYSTEM_EVENT, which
is used for reading the hotkey scancodes. On these machines the
scancodes can be read by executing the ACPI NTFY method.

This patch fixes both problems by installing an i8042 filter when
the NTFY method is present to generate notifications and by
detecting which of INFO or HCI_SYSTEM_EVENT is supported for
reading scancodes. If neither method of reading scancodes is
supported, the hotkey input device is not registered.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2012-03-22 09:31:51 -04:00
Dan Carpenter 592b746c55 toshiba_acpi: make one-bit bitfields unsigned
This doesn't change how the code works, but it silences a Sparse
complaint:
drivers/platform/x86/toshiba_acpi.c:121:37: error: dubious one-bit signed bitfield

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2012-03-20 12:02:22 -04:00
Seth Forshee 11948b9335 toshiba_acpi: Fix machines that don't support HCI_SYSTEM_EVENT
The Satellite C670-10V generates notifications for hotkeys but does
not support HCI_SYSTEM_EVENT. As a result when a hotkey is pressed
it gets stuck in an infinite loop in toshiba_acpi_notify. To fix
this, detect whether or not HCI_SYSTEM_EVENT is supported up-front
and don't try to read system events if it isn't supported. In
addition, limit the number of retries when reading HCI_SYSTEM_EVENT
fails so that this loop cannot run unbounded.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-12-05 13:07:28 -05:00
Seth Forshee ac2dad886d toshiba_acpi: Initialize brightness in backlight device
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-10-24 16:52:37 +02:00
Seth Forshee 36d03f9355 toshiba_acpi: Don't add devices for unsupported features
Test for features up-front to determine whether or not they are
supported, and avoid creating devices and proc files for
unsupported features.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-10-24 16:52:36 +02:00
Seth Forshee a540d6b5b5 toshiba_acpi: Support SPFC as an HCI method
Some Toshiba models, notably those with the TOS1900 device, use
the SPFC method for HCI calls instead of GHCI. Test for this method
if GHCI isn't found, and if it exists use it for all HCI calls.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-10-24 16:52:36 +02:00
Seth Forshee 6e02cc7eb6 toshiba_acpi: Use handle for HCI calls
Now that we're using an acpi driver we already have a handle to
the namespace of the HCI call, so there's no need to test various
paths to the HCI call or even be aware of the path at all.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-10-24 16:52:36 +02:00
Seth Forshee 32bcd5cba0 toshiba_acpi: Fix up return codes
Many routines are returning success on failure, and those that are
indicating failure frequently return incorrect error codes. Fix
these up throughout the driver.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-10-24 16:52:36 +02:00
Seth Forshee 135740de77 toshiba_acpi: Convert to use acpi_driver
Changes toshiba_acpi to register an acpi driver and eliminates the
platform device it was using. Also eliminates most global
variables, moving them into toshiba_acpi_dev, along with some
other miscellaneous fixes and cleanup.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-10-24 16:52:36 +02:00
Joe Perches 7e33460d8d toshiba: Convert printks to pr_<level>
Add pr_fmt.
Remove local MY_<foo> #defines.
Convert printks to pr_<level>.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2011-05-27 12:35:52 -04:00
Matthew Garrett bb7ca747f8 backlight: add backlight type
There may be multiple ways of controlling the backlight on a given
machine.  Allow drivers to expose the type of interface they are
providing, making it possible for userspace to make appropriate policy
decisions.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-03-22 17:43:59 -07:00
Jiri Kosina 4b7bd36470 Merge branch 'master' into for-next
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.
2010-12-22 18:57:02 +01:00
Jon Dowland a49010f53b toshiba_acpi.c: Add key_entry for a lone FN keypress
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>
2010-11-24 11:59:37 -05:00
Lionel Debroux acc2472ed3 backlight: constify backlight_ops
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>
2010-11-16 14:14:02 +01:00
Dmitry Torokhov 384a7cd9ac toshiba-acpi - switch to using sparse keymap
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>
2010-10-21 09:36:43 -04:00
Pierre Ducroquet 6c3f6e6c57 toshiba-acpi: Add support for Toshiba Illumination.
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>
2010-08-03 09:49:10 -04:00
Axel Lin f8ef3aecab toshiba_acpi: rename add_device() and remove_device() to create_toshiba_proc_entries() and remove_toshiba_proc_entries()
To improve readability rename add_device() to
create_toshiba_proc_entries() and rename remove_device() to
remove_toshiba_proc_entries().

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

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

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

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Márton Németh <nm127@freemail.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
2010-08-03 09:49:02 -04:00
Matthew Garrett ae42f23447 toshiba-acpi: Add an extra couple of keys
Thomas Bächler reports that his machine generates two keycodes for zooming
in and out. Add these to the default keymap.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Thomas Bächler <thomas@archlinux.org>
2010-08-03 09:48:53 -04:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

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

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

The script does the followings.

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

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

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

The conversion was done in the following steps.

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00