- 20 Apr, 2017 3 commits
-
-
Darren Hart (VMware) authored
Several functions perform the same WMI read int with different query arguments. Refactor this into a single hp_wmi_read_int function. Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org> Tested-by:
Carlo Caione <carlo@endlessm.com> Reviewed-by:
Andy Shevchenko <andy.shevchenko@gmail.com>
-
Darren Hart (VMware) authored
Use enums consistently throughout the hp-wmi driver for groups of related constants. Use hex and align the assignment within groups. Move the *QUERY constants into an enum, create a new enum defining the READ, WRITE, and ODM constants and use them instead of 0 and 1 at the call sites. Set the command directly instead of using the ternary operator since both 1 and 3 as previously documented would result in the command being set to 0x2. Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org> Tested-by:
Carlo Caione <carlo@endlessm.com> Reviewed-by:
Andy Shevchenko <andy.shevchenko@gmail.com>
-
Darren Hart (VMware) authored
Declare like types on one line. Order declarations in decreasing length where possible. Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org> Tested-by:
Carlo Caione <carlo@endlessm.com> Reviewed-by:
Andy Shevchenko <andy.shevchenko@gmail.com>
-
- 19 Apr, 2017 7 commits
-
-
Carlo Caione authored
All the helper functions (i.e. hp_wmi_dock_state, hp_wmi_tablet_state, ...) using hp_wmi_perform_query to perform an HP WMI query shadow the returned value in case of error. We return -EINVAL only when the HP WMI query returns a positive value (the specific error code) to not mix this up with the actual value returned by the helper function. Suggested-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by:
Carlo Caione <carlo@endlessm.com> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
As LED class devices registered by fujitsu-laptop no longer depend on the platform device, two function calls inside acpi_fujitsu_laptop_add() can be rearranged in order to simplify error handling. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
If acpi_fujitsu_laptop_leds_register() returns an error, the latter will become the return value of acpi_fujitsu_laptop_add(), which in turn will be reported by driver core. Simplify code by replacing pr_err() calls with return statements. Return 0 instead of result when no errors occur in order to make the code easier to read. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
Use devm_led_classdev_register() for registering LED class devices in order to simplify cleanup and remove LED-related fields with the "_registered" suffix from struct fujitsu_laptop. This also fixes a cleanup bug: with non-managed LED class devices, if e.g. two supported LEDs are detected, the first one gets registered successfully but the second one does not, acpi_fujitsu_laptop_add() will return an error, but the successfully registered LED will never get unregistered. Change the parent device for LED class devices to the FUJ02E3 ACPI device due to this being the logically correct relationship as LED class devices do not depend on any facility provided by the platform device registered by fujitsu-laptop, which was their parent until now. Each managed LED class device is automatically unregistered when the last reference to its parent device is dropped. Taking the parent change described above into account, LED class devices registered by fujitsu-laptop will be unregistered after acpi_fujitsu_laptop_remove() is called. During unregistration, LED brightness is reset to LED_OFF by LED core, so do not set the acpi_handle field of struct fujitsu_laptop to NULL inside acpi_fujitsu_laptop_remove() to prevent call_fext_func() from generating errors upon module removal. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
Move around LED definitions and callbacks to eliminate the need for forward declarations and ensure code is organized LED-wise, not action-wise. Reorder assignments inside designated initializers so that they are in the same order as struct led_classdev fields in include/linux/leds.h. Adjust whitespace to make checkpatch happy. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
Move a long section of code responsible for registering LEDs out of acpi_fujitsu_laptop_add() to improve readability and ensure proper cleanup of platform device and kfifo e.g. when two supported LEDs are detected, the first one gets registered successfully but the second one does not. This makes the result variable in acpi_fujitsu_laptop_add() redundant, so remove it. Adjust whitespace to make checkpatch happy. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
Follow common subsystem practice of selecting LEDS_CLASS instead of riddling module code with #ifdefs. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
- 18 Apr, 2017 1 commit
-
-
Rafael J. Wysocki authored
The intel-hid driver is missing a PM ->thaw callback allowing the device to go back to the operational state after creating a hibernation image or when there is an image restoration error during resume. The lack of the ->thaw callback basically means that all events signaled by the device are discarded after a hibernation image has been created which may be problematic, for example, if the image cannot be saved (eg. due to an I/O issue with storage). Signed-off-by:
Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
- 17 Apr, 2017 2 commits
-
-
Hans de Goede authored
The INT33FE ACPI device has a CRS table with I2cSerialBusV2 resources for 3 devices: Maxim MAX17047 Fuel Gauge Controller, FUSB302 USB Type-C Controller and PI3USB30532 USB switch. This commit adds a driver for this ACPI device which instantiates i2c-clients for these, so that the standard i2c drivers for these chips can bind to the them. Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Reviewed-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Darren Hart (VMware) authored
Merge branch 'i2c/for-INT33FE' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git to prepare for an incoming INT33FE driver. Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
- 16 Apr, 2017 3 commits
-
-
Hans de Goede authored
By default the i2c-core will try to get an irq with index 0 on ACPI / of instantiated devices. This is troublesome on some ACPI systems where the irq info at index 0 in the CRS table may contain nonsense and/or point to an irqchip for which there is no Linux driver. If this happens then before this commit the driver's probe method would never get called because i2c_device_probe will try to get an irq by calling acpi_dev_gpio_irq_get which will always return -EPROBE in this case, as it waits for a matching irqchip driver to load. Thus causing the driver to not get a chance to bind. This commit adds a new disable_i2c_core_irq_mapping flag to struct i2c_driver which a driver can set to tell the core to skip irq mapping. Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Reviewed-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Hans de Goede authored
By default the i2c subsys creates an i2c-client for the first I2cSerialBus resource of an acpi_device, but some acpi_devices have multiple I2cSerialBus resources and we may want to instantiate i2c-clients for the others. This commit adds a new i2c_acpi_new_device function which can be used to create an i2c-client for any I2cSerialBus resource of an acpi_device. Note that the other resources may even be on a different i2c bus, so just retrieving the client address is not enough. Here is an example DSDT excerpt from such a device: Device (WIDR) { Name (_HID, "INT33FE" /* XPOWER Battery Device */) Name (_CID, "INT33FE" /* XPOWER Battery Device */) Name (_DDN, "WC PMIC Battery Device") <snip> Name (RBUF, ResourceTemplate () { I2cSerialBusV2 (0x005E, ControllerInitiated, 0x000186A0, AddressingMode7Bit, "\\_SB.PCI0.I2C7", 0x00, ResourceConsumer, , Exclusive, ) I2cSerialBusV2 (0x0036, ControllerInitiated, 0x000186A0, AddressingMode7Bit, "\\_SB.PCI0.I2C1", 0x00, ResourceConsumer, , Exclusive, ) I2cSerialBusV2 (0x0022, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C1", 0x00, ResourceConsumer, , Exclusive, ) I2cSerialBusV2 (0x0054, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.PCI0.I2C1", 0x00, ResourceConsumer, , Exclusive, ) GpioInt (Level, ActiveLow, Exclusive, PullNone, 0x0000, "\\_SB.PCI0.I2C7.PMI5", 0x00, ResourceConsumer, , ) { // Pin list 0x0012 } GpioInt (Edge, ActiveLow, ExclusiveAndWake, PullNone, 0x0000, "\\_SB.GPO1", 0x00, ResourceConsumer, , ) { // Pin list 0x0005 } GpioInt (Level, ActiveLow, Exclusive, PullNone, 0x0000, "\\_SB.PCI0.I2C7.PMI5", 0x00, ResourceConsumer, , ) { // Pin list 0x0013 } }) Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { Return (RBUF) /* \_SB_.PCI0.I2C7.WIDR.RBUF */ } <snip> } Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Reviewed-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Hans de Goede authored
Modify struct i2c_acpi_lookup and i2c_acpi_fill_info() to allow using them to get the info from a certain index in the ACPI-resource list rather then taking the first I2cSerialBus resource. Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Reviewed-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- 14 Apr, 2017 2 commits
-
-
Carlo Caione authored
The current driver code is not checking for the error values returned by 'hp_wmi_dock_state()' and 'hp_wmi_tablet_state()' before passing the returned values down to 'input_report_switch()'. This error code is being translated to '1' in the input subsystem, reporting the wrong status. The biggest problem caused by this issue is that several laptops are wrongly reported by the driver as docked, preventing them to be put to sleep using the LID (and in most cases they are not even dockable). With this patch we create the report switches only if we are able to read the dock and tablet mode status correctly from ACPI. Signed-off-by:
Carlo Caione <carlo@endlessm.com> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Carlo Caione authored
hp_wmi_tablet_state() fails to return the correct error code when hp_wmi_perform_query() returns the HP WMI query specific error code that is a positive value. Signed-off-by:
Carlo Caione <carlo@endlessm.com> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
- 13 Apr, 2017 22 commits
-
-
Alex Hung authored
The airplane mode button on Xiaomi's new laptops are the same as HP laptops. This is tested on Xiaomi Notebook Air 13. Signed-off-by:
Alex Hung <alex.hung@canonical.com> [dvhart: Dropped module init/exit info messages] Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Hans de Goede authored
Add touchscreen info for the Trekstor Surftab Wintron 7.0 ST70416-6 tablet. Signed-off-by:
Hans de Goede <hdegoede@redhat.com> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
The dev field of struct fujitsu_bl is assigned in acpi_fujitsu_bl_add(), but never used afterwards. brightness_changed is set in get_lcd_level() and then its value is only printed in a debug message, so it does not influence execution flow. Remove both fields as they are redundant. Update the aforementioned debug message. Adjust whitespace to make checkpatch happy. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
The comment for the get_brightness backlight device callback in include/linux/backlight.h states that it should "return the current backlight brightness (accounting for power, fb_blank etc.)". fujitsu-laptop violates that premise by simply returning the value to which ACPI function GBLL evaluates to. Make sure 0 is returned when backlight power is turned off. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
Any set_lcd_level() call can fail for one of two reasons: either requested brightness is outside the allowed range or the ACPI method used for setting brightness level is not available. For bl_update_status(), the first case is handled by backlight core, which means bl_update_status() will not even be called if requested brightness is outside the allowed range. The second case will be logged anyway by set_lcd_level() itself, so there is no point in generating another message in bl_update_status(). Remove the superfluous debug message along with a local variable that is now redundant. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
Not all Fujitsu laptops support controlling backlight power through the FUJ02E3 ACPI device. Remove the debug message informing about a failed attempt to set backlight power as it may be confusing and the return value of call_fext_func() is logged anyway. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
Due to the way the disable_brightness_adjust module parameter is currently handled in acpi_fujitsu_bl_add(), it can only be set to either 0 or 1, which effectively makes it a boolean. Emphasize that by changing module parameter type to bool. Do not announce parameter value in a debug message as it can be dynamically changed via sysfs and its current value can also be read from there. Clean up module parameter description. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
The value of each module parameter can be changed on the fly via sysfs. However, the current way of handling use_alt_lcd_levels prevents the user from dynamically switching from a value of 0 or 1 back to autodetection as the latter is only performed upon ACPI device instantiation. Fix this by moving autodetection (in a simplified form) to set_lcd_level() and changing module parameter type to int. Do not announce autodetection results in a debug message as current value of use_alt_lcd_levels can simply be read from sysfs. Clarify module parameter description. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
When using brightness keys and backlight device's sysfs interface alternately, an incorrect input event might be generated for a brightness key press. Consider the following sequence of events: 1. Set backlight brightness to 6 using brightness keys. 2. Write 4 to /sys/class/backlight/fujitsu-laptop/brightness. 3. Press the "brightness up" key. The input event generated in this scenario would be KEY_BRIGHTNESSDOWN, because before step 3 brightness_level would still be at 6. As the new brightness level is established using GBLL, it would evaluate to 5 (SBLL/SBL2 sets it to 4 in step 2 and pressing the "brightness up" key increases it by 1). This in turn would cause acpi_fujitsu_bl_notify() to observe a 6 -> 5 change, i.e. a decrease in brightness, while screen brightness would in fact be increased. Fix this by updating brightness_level in set_lcd_level. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
acpi_execute_simple_method() takes a method parameter which tells it to look for the given method underneath the given handle, so calling acpi_get_handle() beforehand is redundant. Replace the call to acpi_get_handle() with a call to acpi_execute_simple_method(), thus eliminating the need for a local variable storing the handle. Update debug message to reflect this change. Also do not assign a default value to status as it has no influence on execution flow. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
Depending on the value of the use_alt_lcd_levels module parameter, one of two functions is used for setting LCD brightness level. These functions are almost identical and only differ in the name of the ACPI method they call. Instead of checking the value of use_alt_lcd_levels at each call site, move that check to set_lcd_level() and get rid of set_lcd_level_alt(). Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
Use a managed backlight device to get rid of acpi_fujitsu_bl_remove(). Change the parent of the backlight device from NULL to the FUJ02B1 ACPI device as the latter is required for the backlight device to work. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
The backlight part of fujitsu-laptop is only used by laptops which are incapable of using the standard ACPI video interface for handling brightness changes. Conversely, on laptops which are capable of using the latter, no vendor-specific ACPI calls should be made unless explicitly requested by the user. Bail out immediately from acpi_fujitsu_bl_add() unless using the vendor-specific interface was either explicitly requested by the user or automatically selected by the kernel. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Michał Kępień authored
Update debug message logged when the acpi_evaluate_integer() call inside call_fext_func() fails so that it covers a broader set of possible errors. Signed-off-by:
Michał Kępień <kernel@kempniu.pl> Reviewed-by:
Jonathan Woithe <jwoithe@just42.net> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-
Andy Shevchenko authored
A new call to SCU intel_scu_ipc_raw_command() writes SPTR and DPTR registers before sending a command. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
Andy Shevchenko authored
For better maintainability and readability introduce a macro for device ID table. No functional change intended. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
Andy Shevchenko authored
The driver is bound to the devices based on their PCI IDs. There is no need to do an additional check. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
Andy Shevchenko authored
Device pointer is used as a flag that everything is prepared. Nevertheless the assignment happened quite before and there is a window when a caller can get weird results or even crashes since not all fields are initialized yet. Rearrange initialization sequence in ->probe() to prepare everything before use. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
Andy Shevchenko authored
Fail ->probe() if there is no platform data supplied. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
Dmitry Torokhov authored
There is no point in registering I2C bus notifier if DMI data does not match. Signed-off-by:
Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by:
Hans de Goede <hdegoede@redhat.com> [andy: updated due to previous patch changed] Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
Dmitry Torokhov authored
I2C bus has both i2c clients and adapter devices, so we must be careful in notifier code and verify that we are actually dealing with an i2c client before using it as such. Fixes: cef9dd85 ("platform/x86: add support for devices with Silead...") Signed-off-by:
Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by:
Hans de Goede <hdegoede@redhat.com> [andy: simplified silead_ts_dmi_add_props() change] Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
Santeri Toivonen authored
Asus laptop X302UA starts up with Wi-Fi disabled, without a way to enable it. Set wapf=4 to fix the problem. Signed-off-by:
Santeri Toivonen <santeri.toivonen@vatsul.com> Signed-off-by:
Darren Hart (VMware) <dvhart@infradead.org>
-