]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
7 years agowatchdog: iTCO_wdt: Add PMC specific noreboot update api
Kuppuswamy Sathyanarayanan [Sun, 9 Apr 2017 22:00:19 +0000 (15:00 -0700)]
watchdog: iTCO_wdt: Add PMC specific noreboot update api

In some SoCs, setting noreboot bit needs modification to
PMC GC registers. But not all PMC drivers allow other drivers
to memory map their GC region. This could create mem request
conflict in watchdog driver. So this patch adds facility to allow
PMC drivers to pass noreboot update function to watchdog
drivers via platform data.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7 years agowatchdog: iTCO_wdt: cleanup set/unset no_reboot_bit functions
Kuppuswamy Sathyanarayanan [Sun, 9 Apr 2017 22:00:18 +0000 (15:00 -0700)]
watchdog: iTCO_wdt: cleanup set/unset no_reboot_bit functions

iTCO_wdt no_reboot_bit set/unset functions has lot of common code between
them. So merging these two functions into a single update function would
remove these unnecessary code duplications. This patch fixes this issue
by creating a no_reboot_bit update function to handle both set/unset
functions.

Also checking for iTCO version every time you make no_reboot_bit set/unset
call is inefficient and makes the code look complex. This can be improved
by performing this check once during device probe and selecting the
appropriate no_reboot_bit update function. This patch fixes this issue
by splitting the update function into multiple helper functions.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7 years agoplatform/x86: intel_pmc_ipc: Add pmc gcr read/write/update api's
Kuppuswamy Sathyanarayanan [Sun, 9 Apr 2017 22:00:17 +0000 (15:00 -0700)]
platform/x86: intel_pmc_ipc: Add pmc gcr read/write/update api's

This patch adds API's to read/write/update PMC GC registers.
PMC dependent devices like iTCO_wdt, Telemetry has requirement
to acces GCR registers. These API's can be used for this
purpose.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7 years agoplatform/x86: intel_pmc_ipc: fix gcr offset
Kuppuswamy Sathyanarayanan [Sun, 9 Apr 2017 22:00:16 +0000 (15:00 -0700)]
platform/x86: intel_pmc_ipc: fix gcr offset

According to Broxton APL spec, PMC MIMO resources for Global Control
Registers(GCR) are located at 4K(0x1000) offset from IPC base address.
In this driver, PLAT_RESOURCE_GCR_OFFSET macro defines the offset of GCR
region base address from IPC base address and its current value of
0x1008 is incorrect because it points to location for PMC_CFG register
and not the GCR base address itself.

GCR Base = IPC1 Base + 0x1000.

This patch fixes this offset issue.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7 years agoplatform/x86: dell-laptop: Add keyboard backlight timeout AC settings
Pali Rohár [Sun, 23 Apr 2017 19:40:47 +0000 (21:40 +0200)]
platform/x86: dell-laptop: Add keyboard backlight timeout AC settings

When changing keyboard backlight state on new Dell laptops, firmware
expects a new timeout AC value filled in Set New State SMBIOS call.

Without it any change of keyboard backlight state on new Dell laptops
fails. And user can see following error message in dmesg:

  dell_laptop: Setting old previous keyboard state failed
  leds dell::kbd_backlight: Setting an LED's brightness failed (-6)

This patch adds support for retrieving current timeout AC values and also
updating them. Current timeout value in sysfs is displayed based on current
AC status, like current display brightness value.

Detection if Dell laptop supports or not new timeout AC settings is done by
checking existence of Keyboard Backlight with AC SMBIOS token (0x0451).

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Mario Limonciello <mario.limonciello@dell.com>
Tested-by: Arcadiy Ivanov <arcadiy@ivanov.biz>
[andy: fixed merge conflict with defined constants]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7 years agoplatform/x86: dell-laptop: Handle return error form dell_get_intensity.
Arvind Yadav [Thu, 9 Mar 2017 05:49:56 +0000 (11:19 +0530)]
platform/x86: dell-laptop: Handle return error form dell_get_intensity.

Here, This patch is to handle a return error from dell_get_intensity.
This change is done using Coccinelle.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7 years agoplatform/x86: hp-wireless: reuse module_acpi_driver
Andy Shevchenko [Wed, 19 Apr 2017 19:27:31 +0000 (22:27 +0300)]
platform/x86: hp-wireless: reuse module_acpi_driver

There is a macro to register and unregister modules in simple cases,
Let's use it and clean up the driver.

Cc: Alex Hung <alex.hung@canonical.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: intel-vbtn: add volume up and down
Maarten Maathuis [Mon, 24 Apr 2017 21:35:21 +0000 (23:35 +0200)]
platform/x86: intel-vbtn: add volume up and down

Tested on HP Elite X2 1012 G1.
Matches event report of Lenovo Helix 2
(https://www.spinics.net/lists/ibm-acpi-devel/msg03982.html).

Signed-off-by: Maarten Maathuis <madman2003@shikahr.net>
[andy: fixed indentation of comments and massaged title of the change]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7 years agoplatform/x86: INT33FE: add i2c dependency
Tobias Regnery [Thu, 20 Apr 2017 12:51:59 +0000 (14:51 +0200)]
platform/x86: INT33FE: add i2c dependency

With CONFIG_I2C=m and CONFIG_INTEL_CHT_INT33FE=y we see the following link
errors:

drivers/built-in.o: In function 'cht_int33fe_remove':
intel_cht_int33fe.c:(.text+0x391f6e): undefined reference to 'i2c_unregister_device'
intel_cht_int33fe.c:(.text+0x391f76): undefined reference to 'i2c_unregister_device'
intel_cht_int33fe.c:(.text+0x391f7d): undefined reference to 'i2c_unregister_device'
drivers/built-in.o: In function 'cht_int33fe_probe':
intel_cht_int33fe.c:(.text+0x392147): undefined reference to 'i2c_acpi_new_device'
intel_cht_int33fe.c:(.text+0x392185): undefined reference to 'i2c_acpi_new_device'
intel_cht_int33fe.c:(.text+0x3921bd): undefined reference to 'i2c_acpi_new_device'
intel_cht_int33fe.c:(.text+0x3921d9): undefined reference to 'i2c_unregister_device'
intel_cht_int33fe.c:(.text+0x3921e8): undefined reference to 'i2c_unregister_device'
drivers/built-in.o: In function 'cht_int33fe_driver_init':
intel_cht_int33fe.c:(.init.text+0x2386d): undefined reference to 'i2c_register_driver'
drivers/built-in.o: In function 'cht_int33fe_driver_exit':
intel_cht_int33fe.c:(.exit.text+0x206e): undefined reference to 'i2c_del_driver'

Fix this by adding a kconfig dependency on the I2C subsystem.

Fixes: 1cd706df8a9c ("platform/x86: Add Intel Cherry Trail ACPI INT33FE device driver")
Signed-off-by: Tobias Regnery <tobias.regnery@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: hp-wmi: Cleanup exit paths
Darren Hart (VMware) [Thu, 20 Apr 2017 01:54:45 +0000 (18:54 -0700)]
platform/x86: hp-wmi: Cleanup exit paths

Several exit paths were more complex than they needed to be. Remove
superfluous conditionals, use labels common cleanup, do not shadow
negative error codes.

Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Tested-by: Carlo Caione <carlo@endlessm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
7 years agoplatform/x86: hp-wmi: Do not shadow errors in sysfs show functions
Darren Hart (VMware) [Thu, 20 Apr 2017 01:11:33 +0000 (18:11 -0700)]
platform/x86: hp-wmi: Do not shadow errors in sysfs show functions

The new hp_wmi_read_int function returns a negative value in case of
error, pass this on directly rather than always replacing it with
-EINVAL.

Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Tested-by: Carlo Caione <carlo@endlessm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
7 years agoplatform/x86: hp-wmi: Use DEVICE_ATTR_(RO|RW) helper macros
Darren Hart (VMware) [Thu, 20 Apr 2017 00:26:38 +0000 (17:26 -0700)]
platform/x86: hp-wmi: Use DEVICE_ATTR_(RO|RW) helper macros

Use the DEVICE_ATTR_(RO|RW) macros, ranaming the show and store
functions accordingly.

Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Tested-by: Carlo Caione <carlo@endlessm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
7 years agoplatform/x86: hp-wmi: Refactor dock and tablet state fetchers
Darren Hart (VMware) [Thu, 20 Apr 2017 00:03:38 +0000 (17:03 -0700)]
platform/x86: hp-wmi: Refactor dock and tablet state fetchers

Both dock and tablet use the HPWMI_HARDWARE_QUERY, but require different
masks. Rather than using two functions with magic masks, define the
masks, and use a common accessor.

Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Tested-by: Carlo Caione <carlo@endlessm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
7 years agoplatform/x86: hp-wmi: Cleanup wireless get_(hw|sw)state functions
Darren Hart (VMware) [Thu, 20 Apr 2017 01:00:01 +0000 (18:00 -0700)]
platform/x86: hp-wmi: Cleanup wireless get_(hw|sw)state functions

Use the new hp_wmi_read_int() function and add a WARN_ONCE() to the TBD
regarding passing the error through. These are used in a null return
function unfortunately.

Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Tested-by: Carlo Caione <carlo@endlessm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
7 years agoplatform/x86: hp-wmi: Refactor redundant HPWMI_READ functions
Darren Hart (VMware) [Wed, 19 Apr 2017 23:26:06 +0000 (16:26 -0700)]
platform/x86: hp-wmi: Refactor redundant HPWMI_READ functions

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>
7 years agoplatform/x86: hp-wmi: Standardize enum usage for constants
Darren Hart (VMware) [Wed, 19 Apr 2017 22:42:01 +0000 (15:42 -0700)]
platform/x86: hp-wmi: Standardize enum usage for constants

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>
7 years agoplatform/x86: hp-wmi: Cleanup local variable declarations
Darren Hart (VMware) [Thu, 13 Apr 2017 18:05:42 +0000 (11:05 -0700)]
platform/x86: hp-wmi: Cleanup local variable declarations

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>
7 years agoplatform/x86: hp-wmi: Do not shadow error values
Carlo Caione [Wed, 19 Apr 2017 20:36:39 +0000 (22:36 +0200)]
platform/x86: hp-wmi: Do not shadow error values

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>
7 years agoplatform/x86: fujitsu-laptop: simplify error handling in acpi_fujitsu_laptop_add()
Michał Kępień [Fri, 7 Apr 2017 13:07:13 +0000 (15:07 +0200)]
platform/x86: fujitsu-laptop: simplify error handling in acpi_fujitsu_laptop_add()

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>
7 years agoplatform/x86: fujitsu-laptop: do not log LED registration failures
Michał Kępień [Fri, 7 Apr 2017 13:07:12 +0000 (15:07 +0200)]
platform/x86: fujitsu-laptop: do not log LED registration failures

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>
7 years agoplatform/x86: fujitsu-laptop: switch to managed LED class devices
Michał Kępień [Fri, 7 Apr 2017 13:07:11 +0000 (15:07 +0200)]
platform/x86: fujitsu-laptop: switch to managed LED class devices

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>
7 years agoplatform/x86: fujitsu-laptop: reorganize LED-related code
Michał Kępień [Fri, 7 Apr 2017 13:07:10 +0000 (15:07 +0200)]
platform/x86: fujitsu-laptop: reorganize LED-related code

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>
7 years agoplatform/x86: fujitsu-laptop: refactor LED registration
Michał Kępień [Fri, 7 Apr 2017 13:07:09 +0000 (15:07 +0200)]
platform/x86: fujitsu-laptop: refactor LED registration

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>
7 years agoplatform/x86: fujitsu-laptop: select LEDS_CLASS
Michał Kępień [Fri, 7 Apr 2017 13:07:08 +0000 (15:07 +0200)]
platform/x86: fujitsu-laptop: select LEDS_CLASS

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>
7 years agoplatform/x86: intel-hid: Add missing ->thaw callback
Rafael J. Wysocki [Tue, 18 Apr 2017 13:49:06 +0000 (15:49 +0200)]
platform/x86: intel-hid: Add missing ->thaw callback

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>
7 years agoplatform/x86: Add Intel Cherry Trail ACPI INT33FE device driver
Hans de Goede [Thu, 6 Apr 2017 07:24:36 +0000 (09:24 +0200)]
platform/x86: Add Intel Cherry Trail ACPI INT33FE device driver

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>
7 years agoMerge branch 'i2c/for-INT33FE'
Darren Hart (VMware) [Mon, 17 Apr 2017 22:30:28 +0000 (15:30 -0700)]
Merge branch 'i2c/for-INT33FE'

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>
7 years agoi2c: core: Allow drivers to disable i2c-core irq mapping
Hans de Goede [Tue, 4 Apr 2017 22:03:34 +0000 (00:03 +0200)]
i2c: core: Allow drivers to disable i2c-core irq mapping

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>
7 years agoi2c: core: Add new i2c_acpi_new_device helper function
Hans de Goede [Tue, 4 Apr 2017 22:03:33 +0000 (00:03 +0200)]
i2c: core: Add new i2c_acpi_new_device helper function

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>
7 years agoi2c: core: Allow getting ACPI info by index
Hans de Goede [Tue, 4 Apr 2017 22:03:32 +0000 (00:03 +0200)]
i2c: core: Allow getting ACPI info by index

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>
7 years agoplatform/x86: hp-wmi: Fix detection for dock and tablet mode
Carlo Caione [Sun, 9 Apr 2017 13:56:08 +0000 (15:56 +0200)]
platform/x86: hp-wmi: Fix detection for dock and tablet mode

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>
7 years agoplatform/x86: hp-wmi: Fix error value for hp_wmi_tablet_state
Carlo Caione [Sun, 9 Apr 2017 13:56:07 +0000 (15:56 +0200)]
platform/x86: hp-wmi: Fix error value for hp_wmi_tablet_state

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>
7 years agoplatform/x86: hp-wireless: add Xiaomi's hardware id to the supported list
Alex Hung [Thu, 6 Apr 2017 16:32:16 +0000 (17:32 +0100)]
platform/x86: hp-wireless: add Xiaomi's hardware id to the supported list

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>
7 years agoplatform/x86: silead_dmi: Add touchscreen info for Surftab Wintron 7.0
Hans de Goede [Sun, 9 Apr 2017 09:07:44 +0000 (11:07 +0200)]
platform/x86: silead_dmi: Add touchscreen info for Surftab Wintron 7.0

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>
7 years agoplatform/x86: fujitsu-laptop: remove redundant fields from struct fujitsu_bl
Michał Kępień [Wed, 5 Apr 2017 06:49:10 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: remove redundant fields from struct fujitsu_bl

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>
7 years agoplatform/x86: fujitsu-laptop: account for backlight power when determining brightness
Michał Kępień [Wed, 5 Apr 2017 06:49:09 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: account for backlight power when determining brightness

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>
7 years agoplatform/x86: fujitsu-laptop: do not log set_lcd_level() failures in bl_update_status()
Michał Kępień [Wed, 5 Apr 2017 06:49:08 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: do not log set_lcd_level() failures in bl_update_status()

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>
7 years agoplatform/x86: fujitsu-laptop: ignore errors when setting backlight power
Michał Kępień [Wed, 5 Apr 2017 06:49:07 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: ignore errors when setting backlight power

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>
7 years agoplatform/x86: fujitsu-laptop: make disable_brightness_adjust a boolean
Michał Kępień [Wed, 5 Apr 2017 06:49:06 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: make disable_brightness_adjust a boolean

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>
7 years agoplatform/x86: fujitsu-laptop: clean up use_alt_lcd_levels handling
Michał Kępień [Wed, 5 Apr 2017 06:49:05 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: clean up use_alt_lcd_levels handling

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>
7 years agoplatform/x86: fujitsu-laptop: sync brightness in set_lcd_level()
Michał Kępień [Wed, 5 Apr 2017 06:49:04 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: sync brightness in set_lcd_level()

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>
7 years agoplatform/x86: fujitsu-laptop: simplify set_lcd_level()
Michał Kępień [Wed, 5 Apr 2017 06:49:03 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: simplify set_lcd_level()

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>
7 years agoplatform/x86: fujitsu-laptop: merge set_lcd_level_alt() into set_lcd_level()
Michał Kępień [Wed, 5 Apr 2017 06:49:02 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: merge set_lcd_level_alt() into set_lcd_level()

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>
7 years agoplatform/x86: fujitsu-laptop: switch to a managed backlight device
Michał Kępień [Wed, 5 Apr 2017 06:49:01 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: switch to a managed backlight device

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>
7 years agoplatform/x86: fujitsu-laptop: only handle backlight when appropriate
Michał Kępień [Wed, 5 Apr 2017 06:49:00 +0000 (08:49 +0200)]
platform/x86: fujitsu-laptop: only handle backlight when appropriate

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>
7 years agoplatform/x86: fujitsu-laptop: update debug message logged by call_fext_func()
Michał Kępień [Thu, 6 Apr 2017 06:46:10 +0000 (08:46 +0200)]
platform/x86: fujitsu-laptop: update debug message logged by call_fext_func()

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>
7 years agoplatform/x86: intel_scu_ipc: Introduce intel_scu_ipc_raw_command()
Andy Shevchenko [Wed, 5 Apr 2017 16:05:28 +0000 (19:05 +0300)]
platform/x86: intel_scu_ipc: Introduce intel_scu_ipc_raw_command()

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>
7 years agoplatform/x86: intel_scu_ipc: Introduce SCU_DEVICE() macro
Andy Shevchenko [Wed, 5 Apr 2017 16:05:27 +0000 (19:05 +0300)]
platform/x86: intel_scu_ipc: Introduce SCU_DEVICE() macro

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>
7 years agoplatform/x86: intel_scu_ipc: Remove redundant subarch check
Andy Shevchenko [Wed, 5 Apr 2017 16:05:26 +0000 (19:05 +0300)]
platform/x86: intel_scu_ipc: Remove redundant subarch check

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>
7 years agoplatform/x86: intel_scu_ipc: Rearrange init sequence
Andy Shevchenko [Wed, 5 Apr 2017 16:05:25 +0000 (19:05 +0300)]
platform/x86: intel_scu_ipc: Rearrange init sequence

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>
7 years agoplatform/x86: intel_scu_ipc: Platform data is mandatory
Andy Shevchenko [Wed, 5 Apr 2017 16:05:24 +0000 (19:05 +0300)]
platform/x86: intel_scu_ipc: Platform data is mandatory

Fail ->probe() if there is no platform data supplied.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7 years agoplatform/x86: silead_dmi - abort early if DMI does not match
Dmitry Torokhov [Tue, 4 Apr 2017 03:25:14 +0000 (20:25 -0700)]
platform/x86: silead_dmi - abort early if DMI does not match

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>
7 years agoplatform/x86: silead_dmi - do not treat all devices as i2c_clients
Dmitry Torokhov [Tue, 4 Apr 2017 03:25:13 +0000 (20:25 -0700)]
platform/x86: silead_dmi - do not treat all devices as i2c_clients

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: cef9dd85acd7 ("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>
7 years agoplatform/x86: asus-nb-wmi: Add wapf4 quirk for the X302UA
Santeri Toivonen [Tue, 4 Apr 2017 18:09:00 +0000 (21:09 +0300)]
platform/x86: asus-nb-wmi: Add wapf4 quirk for the X302UA

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>
7 years agoplatform/x86: fujitsu-laptop: rename call_fext_func() arguments
Michał Kępień [Mon, 3 Apr 2017 09:38:59 +0000 (11:38 +0200)]
platform/x86: fujitsu-laptop: rename call_fext_func() arguments

Rename call_fext_func() arguments so that each argument's name signifies
its role:

  - cmd -> func: sub-function to call (flags, buttons etc.),
  - arg0 -> op: operation to perform (get, set, get capabilities etc.),
  - arg1 -> feature: feature to act on (e.g. which LED), if relevant,
  - arg2 -> state: state to set (e.g. LED on or off), if relevant.

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>
7 years agoplatform/x86: fujitsu-laptop: simplify call_fext_func()
Michał Kępień [Mon, 3 Apr 2017 09:38:58 +0000 (11:38 +0200)]
platform/x86: fujitsu-laptop: simplify call_fext_func()

acpi_evaluate_integer() takes a pathname parameter which contains the
name of the entity to evaluate underneath the given handle, so calling
acpi_get_handle() beforehand is redundant.  Replace the call to
acpi_get_handle() with a call to acpi_evaluate_integer(), thus
eliminating the need for a local variable storing the handle.  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>
7 years agoplatform/x86: fujitsu-laptop: clean up local variables in call_fext_func()
Michał Kępień [Mon, 3 Apr 2017 09:38:57 +0000 (11:38 +0200)]
platform/x86: fujitsu-laptop: clean up local variables in call_fext_func()

Set values of FUNC call parameters in a designated initializer.  Do not
initialize status and handle variables as the values these are
initialized to have no influence on execution flow.  Use an array
variable instead of the address of the first element of that array.

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>
7 years agoplatform/x86: fujitsu-laptop: remove keycode fields from struct fujitsu_bl
Michał Kępień [Mon, 20 Mar 2017 09:32:24 +0000 (10:32 +0100)]
platform/x86: fujitsu-laptop: remove keycode fields from struct fujitsu_bl

Remove the keycode[1-5] fields from struct fujitsu_bl as they are not
needed any more as a result of the sparse keymap migration.

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>
7 years agoplatform/x86: fujitsu-laptop: model-dependent sparse keymap overrides
Michał Kępień [Mon, 20 Mar 2017 09:32:23 +0000 (10:32 +0100)]
platform/x86: fujitsu-laptop: model-dependent sparse keymap overrides

Some laptop models need to have different keycodes assigned to hotkey
scancodes.  Change the sparse keymap upon a DMI match, before the hotkey
input device is setup.

Instead of using three different callbacks in the DMI match table,
simplify code by using the driver_data field of struct dmi_system_id to
supply the requested keymap to a common callback.  Also merge keymaps
for S6410 and S6420 as they are identical.

Rename fujitsu_dmi_table to fujitsu_laptop_dmi_table to emphasize it is
no longer used by the backlight part of fujitsu-laptop.  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>
7 years agoplatform/x86: fujitsu-laptop: use a sparse keymap for hotkey event generation
Michał Kępień [Mon, 20 Mar 2017 09:32:22 +0000 (10:32 +0100)]
platform/x86: fujitsu-laptop: use a sparse keymap for hotkey event generation

Simplify hotkey event generation by using a sparse keymap.  As sparse
keymap operates on scancodes instead of keycodes, adjust variable names
and debug messages accordingly.

This patch only handles the default keymap for clarity.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
[dvhart: correct flag passed to call_fext_func in acpi_fujitsu_laptop_notify]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: fujitsu-laptop: switch to a managed hotkey input device
Michał Kępień [Mon, 20 Mar 2017 09:32:21 +0000 (10:32 +0100)]
platform/x86: fujitsu-laptop: switch to a managed hotkey input device

Use a managed input device for hotkey events in order to simplify two
error paths and one cleanup function while also reducing the number of
local variables required.  Remove double assignment 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>
7 years agoplatform/x86: fujitsu-laptop: refactor hotkey input device setup
Michał Kępień [Mon, 20 Mar 2017 09:32:20 +0000 (10:32 +0100)]
platform/x86: fujitsu-laptop: refactor hotkey input device setup

Simplify error handling in acpi_fujitsu_laptop_add() by moving code
responsible for setting up the input device to a separate function.

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>
7 years agoplatform/x86: fujitsu-laptop: use a sparse keymap for brightness key events
Michał Kępień [Mon, 20 Mar 2017 09:32:19 +0000 (10:32 +0100)]
platform/x86: fujitsu-laptop: use a sparse keymap for brightness key events

Simplify brightness key event generation by using a sparse keymap.

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>
7 years agoplatform/x86: fujitsu-laptop: switch to a managed backlight input device
Michał Kępień [Mon, 20 Mar 2017 09:32:18 +0000 (10:32 +0100)]
platform/x86: fujitsu-laptop: switch to a managed backlight input device

Use a managed input device for brightness events in order to simplify
two error paths and one cleanup function while also reducing the number
of local variables required.  Remove double assignment 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>
7 years agoplatform/x86: fujitsu-laptop: refactor backlight input device setup
Michał Kępień [Mon, 20 Mar 2017 09:32:17 +0000 (10:32 +0100)]
platform/x86: fujitsu-laptop: refactor backlight input device setup

Simplify error handling in acpi_fujitsu_bl_add() by moving code
responsible for setting up the input device to a separate function.

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>
7 years agoMerge branch 'linux-leds/dell-laptop-changes-for-4.12'
Darren Hart [Wed, 29 Mar 2017 19:19:42 +0000 (12:19 -0700)]
Merge branch 'linux-leds/dell-laptop-changes-for-4.12'

Merge branch 'dell-laptop-changes-for-4.12' of
git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git
to avoid linux-next merge conflict with dell-laptop.c.

Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: silead_dmi: Add entry for Insyde 7W tablets
Hans de Goede [Wed, 22 Mar 2017 15:55:54 +0000 (16:55 +0100)]
platform/x86: silead_dmi: Add entry for Insyde 7W tablets

Add an entry providing the necessary info to make the touchscreen work
on various tablets based on the Insyde 7W whitebox tablet.

This has been tested on a DEXP Ursus 7W tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: silead_dmi: Constify properties arrays
Hans de Goede [Wed, 22 Mar 2017 15:55:53 +0000 (16:55 +0100)]
platform/x86: silead_dmi: Constify properties arrays

Now that device_add_properties takes a const property_entry * rather
then a non-const one we can constify the properties arrays.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: dell-*: Call new led hw_changed API on kbd brightness change
Hans de Goede [Thu, 16 Mar 2017 10:55:35 +0000 (11:55 +0100)]
platform/x86: dell-*: Call new led hw_changed API on kbd brightness change

Make dell-wmi notify on hotkey kbd brightness changes, listen for this
in dell-laptop and call led_classdev_notify_brightness_hw_changed.

This will allow userspace to monitor (poll) for brightness changes on
these LEDs caused by the hotkey.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: dell-laptop: Protect kbd_state against races
Hans de Goede [Thu, 16 Mar 2017 10:55:34 +0000 (11:55 +0100)]
platform/x86: dell-laptop: Protect kbd_state against races

The kbd led code has multiple entry points each of which modifies the
kbd_state by reading it, modifying a copy, writing the copy and on
error setting the modified copy writing back the original state.

This is racy, so add a mutex protection the read-modify-write cycle
on each of the entry points.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: dell-laptop: Refactor kbd_led_triggers_store()
Hans de Goede [Thu, 16 Mar 2017 10:55:33 +0000 (11:55 +0100)]
platform/x86: dell-laptop: Refactor kbd_led_triggers_store()

Return -EINVAL immediately on invalid input, rather then doing
the straight path in an if block and returning -EINVAL at the end
of the function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: dell-*: Add a generic dell-laptop notifier chain
Hans de Goede [Thu, 16 Mar 2017 10:55:32 +0000 (11:55 +0100)]
platform/x86: dell-*: Add a generic dell-laptop notifier chain

There are several cases where events handled in one of the dell-* drivers
need to be propagated to another dell-* driver.

This commit adds 3 generic functions:
dell_laptop_register_notifier()
dell_laptop_unregister_notifier()
dell_laptop_call_notifier()

It currently only defines 1 action:
DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED

Which is intended to propagate kbd_backlight_brightness_changed wmi
events from dell-wmi to dell-laptop (which contains the actual kbd
backlight driver).

These functions are put in dell-smbios as both dell-wmi and dell-laptop
use smbios functions and I do not want to put the notifier head in
either driver, as that will make the 2 drivers depend on each other.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: fujitsu-laptop: remove pf_device field from struct fujitsu_bl
Michał Kępień [Tue, 14 Mar 2017 10:26:31 +0000 (11:26 +0100)]
platform/x86: fujitsu-laptop: remove pf_device field from struct fujitsu_bl

Both struct fujitsu_bl and struct fujitsu_laptop have a pf_device field.
Up until now the latter has been redundant, which is logically incorrect
because the primary function of the platform device created by
fujitsu-laptop is to provide laptop-related (not brightness-related)
attributes to userspace.

Remove the pf_device field from struct fujitsu_bl and make all module
code use the pf_device field of struct fujitsu_laptop instead.

Suggested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Woithe <jwoithe@just42.net>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: fujitsu-laptop: only register platform device if FUJ02E3 is present
Michał Kępień [Tue, 14 Mar 2017 10:26:30 +0000 (11:26 +0100)]
platform/x86: fujitsu-laptop: only register platform device if FUJ02E3 is present

The platform device registered by fujitsu-laptop is registered
unconditionally while sysfs attributes attached to it depend on the
FUJ02E3 ACPI device being present.  Fix this by moving platform device
creation and removal to acpi_fujitsu_laptop_add() and
acpi_fujitsu_laptop_remove(), respectively.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Woithe <jwoithe@just42.net>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: fujitsu-laptop: add and remove platform device in separate functions
Michał Kępień [Tue, 14 Mar 2017 10:26:29 +0000 (11:26 +0100)]
platform/x86: fujitsu-laptop: add and remove platform device in separate functions

Platform device handling adds a lot of complexity to fujitsu_init(),
which hinders its readability.  Extract code responsible for adding and
removing the platform device to separate functions.  Adjust whitespace
to make checkpatch happy.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Woithe <jwoithe@just42.net>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: fujitsu-laptop: simplify platform device attribute definitions
Michał Kępień [Tue, 14 Mar 2017 10:26:28 +0000 (11:26 +0100)]
platform/x86: fujitsu-laptop: simplify platform device attribute definitions

Use the DEVICE_ATTR_RO() macro to get rid of ignore_store() and shorten
attribute definitions.  Adjust whitespace to make checkpatch happy.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Woithe <jwoithe@just42.net>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: fujitsu-laptop: remove backlight-related attributes from the platform...
Michał Kępień [Tue, 14 Mar 2017 10:26:27 +0000 (11:26 +0100)]
platform/x86: fujitsu-laptop: remove backlight-related attributes from the platform device

Setting backlight level using a vendor-specific interface should only be
possible when using the latter is either explicitly requested by the
user or automatically selected by the kernel.  fujitsu-laptop violates
that premise by unconditionally attaching three backlight-related
attributes to the platform device it registers.  Remove the offending
attributes from the platform device.  Update module comments to reflect
this change.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Woithe <jwoithe@just42.net>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoplatform/x86: eeepc-laptop: Skip unknown key messages 0x50 0x51
Pau Espin Pedrol [Fri, 10 Feb 2017 17:48:37 +0000 (18:48 +0100)]
platform/x86: eeepc-laptop: Skip unknown key messages 0x50 0x51

Otherwise those are printed several times when (un)plugging the AC
connector.

Signed-off-by: Pau Espin Pedrol <pespin.shar@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
7 years agoLinux 4.11-rc3 v4.11-rc3
Linus Torvalds [Mon, 20 Mar 2017 02:09:39 +0000 (19:09 -0700)]
Linux 4.11-rc3

7 years agomm/swap: don't BUG_ON() due to uninitialized swap slot cache
Linus Torvalds [Mon, 20 Mar 2017 02:00:47 +0000 (19:00 -0700)]
mm/swap: don't BUG_ON() due to uninitialized swap slot cache

This BUG_ON() triggered for me once at shutdown, and I don't see a
reason for the check.  The code correctly checks whether the swap slot
cache is usable or not, so an uninitialized swap slot cache is not
actually problematic afaik.

I've temporarily just switched the BUG_ON() to a WARN_ON_ONCE(), since
I'm not sure why that seemingly pointless check was there.  I suspect
the real fix is to just remove it entirely, but for now we'll warn about
it but not bring the machine down.

Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agoMerge tag 'powerpc-4.11-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
Linus Torvalds [Mon, 20 Mar 2017 01:49:28 +0000 (18:49 -0700)]
Merge tag 'powerpc-4.11-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull more powerpc fixes from Michael Ellerman:
 "A couple of minor powerpc fixes for 4.11:

   - wire up statx() syscall

   - don't print a warning on memory hotplug when HPT resizing isn't
     available

  Thanks to: David Gibson, Chandan Rajendra"

* tag 'powerpc-4.11-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/pseries: Don't give a warning when HPT resizing isn't available
  powerpc: Wire up statx() syscall

7 years agoMerge branch 'parisc-4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Mon, 20 Mar 2017 01:11:13 +0000 (18:11 -0700)]
Merge branch 'parisc-4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc fixes from Helge Deller:

 - Mikulas Patocka added support for R_PARISC_SECREL32 relocations in
   modules with CONFIG_MODVERSIONS.

 - Dave Anglin optimized the cache flushing for vmap ranges.

 - Arvind Yadav provided a fix for a potential NULL pointer dereference
   in the parisc perf code (and some code cleanups).

 - I wired up the new statx system call, fixed some compiler warnings
   with the access_ok() macro and fixed shutdown code to really halt a
   system at shutdown instead of crashing & rebooting.

* 'parisc-4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: Fix system shutdown halt
  parisc: perf: Fix potential NULL pointer dereference
  parisc: Avoid compiler warnings with access_ok()
  parisc: Wire up statx system call
  parisc: Optimize flush_kernel_vmap_range and invalidate_kernel_vmap_range
  parisc: support R_PARISC_SECREL32 relocation in modules

7 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Linus Torvalds [Mon, 20 Mar 2017 01:06:31 +0000 (18:06 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

Pull SCSI target fixes from Nicholas Bellinger:
 "The bulk of the changes are in qla2xxx target driver code to address
  various issues found during Cavium/QLogic's internal testing (stable
  CC's included), along with a few other stability and smaller
  miscellaneous improvements.

  There are also a couple of different patch sets from Mike Christie,
  which have been a result of his work to use target-core ALUA logic
  together with tcm-user backend driver.

  Finally, a patch to address some long standing issues with
  pass-through SCSI export of TYPE_TAPE + TYPE_MEDIUM_CHANGER devices,
  which will make folks using physical (or virtual) magnetic tape happy"

* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (28 commits)
  qla2xxx: Update driver version to 9.00.00.00-k
  qla2xxx: Fix delayed response to command for loop mode/direct connect.
  qla2xxx: Change scsi host lookup method.
  qla2xxx: Add DebugFS node to display Port Database
  qla2xxx: Use IOCB interface to submit non-critical MBX.
  qla2xxx: Add async new target notification
  qla2xxx: Export DIF stats via debugfs
  qla2xxx: Improve T10-DIF/PI handling in driver.
  qla2xxx: Allow relogin to proceed if remote login did not finish
  qla2xxx: Fix sess_lock & hardware_lock lock order problem.
  qla2xxx: Fix inadequate lock protection for ABTS.
  qla2xxx: Fix request queue corruption.
  qla2xxx: Fix memory leak for abts processing
  qla2xxx: Allow vref count to timeout on vport delete.
  tcmu: Convert cmd_time_out into backend device attribute
  tcmu: make cmd timeout configurable
  tcmu: add helper to check if dev was configured
  target: fix race during implicit transition work flushes
  target: allow userspace to set state to transitioning
  target: fix ALUA transition timeout handling
  ...

7 years agoMerge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdim...
Linus Torvalds [Sun, 19 Mar 2017 22:45:02 +0000 (15:45 -0700)]
Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm

Pull device-dax fixes from Dan Williams:
 "The device-dax driver was not being careful to handle falling back to
  smaller fault-granularity sizes.

  The driver already fails fault attempts that are smaller than the
  device's alignment, but it also needs to handle the cases where a
  larger page mapping could be established. For simplicity of the
  immediate fix the implementation just signals VM_FAULT_FALLBACK until
  fault-size == device-alignment.

  One fix is for -stable to address pmd-to-pte fallback from the
  original implementation, another fix is for the new (introduced in
  4.11-rc1) pud-to-pmd regression, and a typo fix comes along for the
  ride.

  These have received a build success notification from the kbuild
  robot"

* 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  device-dax: fix debug output typo
  device-dax: fix pud fault fallback handling
  device-dax: fix pmd/pte fault fallback handling

7 years agoqla2xxx: Update driver version to 9.00.00.00-k
Himanshu Madhani [Wed, 15 Mar 2017 16:48:56 +0000 (09:48 -0700)]
qla2xxx: Update driver version to 9.00.00.00-k

Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Fix delayed response to command for loop mode/direct connect.
Quinn Tran [Wed, 15 Mar 2017 16:48:55 +0000 (09:48 -0700)]
qla2xxx: Fix delayed response to command for loop mode/direct connect.

Current driver wait for FW to be in the ready state before
processing in-coming commands. For Arbitrated Loop or
Point-to- Point (not switch), FW Ready state can take a while.
FW will transition to ready state after all Nports have been
logged in. In the mean time, certain initiators have completed
the login and starts IO. Driver needs to start processing all
queues if FW is already started.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Change scsi host lookup method.
Quinn Tran [Wed, 15 Mar 2017 16:48:54 +0000 (09:48 -0700)]
qla2xxx: Change scsi host lookup method.

For target mode, when new scsi command arrive, driver first performs
a look up of the SCSI Host. The current look up method is based on
the ALPA portion of the NPort ID. For Cisco switch, the ALPA can
not be used as the index. Instead, the new search method is based
on the full value of the Nport_ID via btree lib.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Add DebugFS node to display Port Database
Himanshu Madhani [Wed, 15 Mar 2017 16:48:53 +0000 (09:48 -0700)]
qla2xxx: Add DebugFS node to display Port Database

Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Use IOCB interface to submit non-critical MBX.
Quinn Tran [Wed, 15 Mar 2017 16:48:52 +0000 (09:48 -0700)]
qla2xxx: Use IOCB interface to submit non-critical MBX.

The Mailbox interface is currently over subscribed. We like
to reserve the Mailbox interface for the chip managment and
link initialization. Any non essential Mailbox command will
be routed through the IOCB interface. The IOCB interface is
able to absorb more commands.

Following commands are being routed through IOCB interface

- Get ID List (007Ch)
- Get Port DB (0064h)
- Get Link Priv Stats (006Dh)

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Add async new target notification
Quinn Tran [Wed, 15 Mar 2017 16:48:51 +0000 (09:48 -0700)]
qla2xxx: Add async new target notification

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Export DIF stats via debugfs
Anil Gurumurthy [Wed, 15 Mar 2017 16:48:50 +0000 (09:48 -0700)]
qla2xxx: Export DIF stats via debugfs

Signed-off-by: Anil Gurumurthy <anil.gurumurthy@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Improve T10-DIF/PI handling in driver.
Quinn Tran [Wed, 15 Mar 2017 16:48:49 +0000 (09:48 -0700)]
qla2xxx: Improve T10-DIF/PI handling in driver.

Add routines to support T10 DIF tag.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Anil Gurumurthy <anil.gurumurthy@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Allow relogin to proceed if remote login did not finish
Quinn Tran [Wed, 15 Mar 2017 16:48:48 +0000 (09:48 -0700)]
qla2xxx: Allow relogin to proceed if remote login did not finish

If the remote port have started the login process, then the
PLOGI and PRLI should be back to back. Driver will allow
the remote port to complete the process. For the case where
the remote port decide to back off from sending PRLI, this
local port sets an expiration timer for the PRLI. Once the
expiration time passes, the relogin retry logic is allowed
to go through and perform login with the remote port.

Signed-off-by: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Fix sess_lock & hardware_lock lock order problem.
Quinn Tran [Wed, 15 Mar 2017 16:48:47 +0000 (09:48 -0700)]
qla2xxx: Fix sess_lock & hardware_lock lock order problem.

The main lock that needs to be held for CMD or TMR submission
to upper layer is the sess_lock. The sess_lock is used to
serialize cmd submission and session deletion. The addition
of hardware_lock being held is not necessary. This patch removes
hardware_lock dependency from CMD/TMR submission.

Use hardware_lock only for error response in this case.

Path1
       CPU0                    CPU1
       ----                    ----
  lock(&(&ha->tgt.sess_lock)->rlock);
                               lock(&(&ha->hardware_lock)->rlock);
                               lock(&(&ha->tgt.sess_lock)->rlock);
  lock(&(&ha->hardware_lock)->rlock);

Path2/deadlock
*** DEADLOCK ***
Call Trace:
dump_stack+0x85/0xc2
print_circular_bug+0x1e3/0x250
__lock_acquire+0x1425/0x1620
lock_acquire+0xbf/0x210
_raw_spin_lock_irqsave+0x53/0x70
qlt_sess_work_fn+0x21d/0x480 [qla2xxx]
process_one_work+0x1f4/0x6e0

Cc: <stable@vger.kernel.org>
Cc: Bart Van Assche <Bart.VanAssche@sandisk.com>
Reported-by: Bart Van Assche <Bart.VanAssche@sandisk.com>
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Fix inadequate lock protection for ABTS.
Quinn Tran [Wed, 15 Mar 2017 16:48:46 +0000 (09:48 -0700)]
qla2xxx: Fix inadequate lock protection for ABTS.

Normally, ABTS is sent to Target Core as Task MGMT command.
In the case of error, qla2xxx needs to send response, hardware_lock
is required to prevent request queue corruption.

Cc: <stable@vger.kernel.org>
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Fix request queue corruption.
Quinn Tran [Wed, 15 Mar 2017 16:48:45 +0000 (09:48 -0700)]
qla2xxx: Fix request queue corruption.

When FW notify driver or driver detects low FW resource,
driver tries to send out Busy SCSI Status to tell Initiator
side to back off. During the send process, the lock was not held.

Cc: <stable@vger.kernel.org>
Signed-off-by: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Fix memory leak for abts processing
Quinn Tran [Wed, 15 Mar 2017 16:48:44 +0000 (09:48 -0700)]
qla2xxx: Fix memory leak for abts processing

Cc: <stable@vger.kernel.org>
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agoqla2xxx: Allow vref count to timeout on vport delete.
Joe Carnuccio [Wed, 15 Mar 2017 16:48:43 +0000 (09:48 -0700)]
qla2xxx: Allow vref count to timeout on vport delete.

Cc: <stable@vger.kernel.org>
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agotcmu: Convert cmd_time_out into backend device attribute
Nicholas Bellinger [Sat, 18 Mar 2017 22:04:13 +0000 (15:04 -0700)]
tcmu: Convert cmd_time_out into backend device attribute

Instead of putting cmd_time_out under ../target/core/user_0/foo/control,
which has historically been used by parameters needed for initial
backend device configuration, go ahead and move cmd_time_out into
a backend device attribute.

In order to do this, tcmu_module_init() has been updated to create
a local struct configfs_attribute **tcmu_attrs, that is based upon
the existing passthrough_attrib_attrs along with the new cmd_time_out
attribute.  Once **tcm_attrs has been setup, go ahead and point
it at tcmu_ops->tb_dev_attrib_attrs so it's picked up by target-core.

Also following MNC's previous change, ->cmd_time_out is stored in
milliseconds but exposed via configfs in seconds.  Also, note this
patch restricts the modification of ->cmd_time_out to before +
after the TCMU device has been configured, but not while it has
active fabric exports.

Cc: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
7 years agotcmu: make cmd timeout configurable
Mike Christie [Thu, 9 Mar 2017 08:42:09 +0000 (02:42 -0600)]
tcmu: make cmd timeout configurable

A single daemon could implement multiple types of devices
using multuple types of real devices that may not support
restarting from crashes and/or handling tcmu timeouts. This
makes the cmd timeout configurable, so handlers that do not
support it can turn if off for now.

Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>