aboutsummaryrefslogtreecommitdiffstats
path: root/drivers (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-07-08platform/x86: intel_pmc_core: Attach using APCI HID "INT33A1"Rajat Jain3-33/+71
Most modern platforms already have the ACPI device "INT33A1" that could be used to attach to the driver. Switch the driver to using that and thus make the intel_pmc_core.c a pure platform_driver. Some of the legacy platforms though, may still not have this ACPI device in their ACPI tables. Thus for such platforms, move the code to manually instantiate a platform_device into a new file of its own. This would instantiate the intel_pmc_core platform device and thus attach to the driver, if the ACPI device for the same ("INT33A1") is not present in a system where it should be. This was discussed here: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1966991.html Signed-off-by: Rajat Jain <rajatja@google.com> [andy: renamed to intel_pmc_core_pltdrv.c to be in align with other drivers] Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-03platform/x86: intel_pmc_core: transform Pkg C-state residency from TSC ticks into microsecondsHarry Pan1-1/+4
Refer to the Intel SDM Vol.4, the package C-state residency counters of modern IA micro-architecture are all ticking in TSC frequency, hence we can apply simple math to transform the ticks into microseconds. i.e., residency (ms) = count / tsc_khz residency (us) = count / tsc_khz * 1000 This also aligns to other sysfs debug entries of residency counter in the same metric in microseconds, benefits reading and scripting. v2: restore the accidentally deleted newline, no function change. v3: apply kernel do_div() macro to calculate division Signed-off-by: Harry Pan <harry.pan@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-03platform/x86: asus-wmi: Use dev_get_drvdata()Fuqian Huang1-2/+1
Using dev_get_drvdata directly. Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-03platform/x86: mlx-platform: Add more reset cause attributesVadim Pasternak1-0/+36
Add more attributes for reset cause indication for the cases when system reset has been caused by watchdog, BIOS reload and COMEX thermal shutdown. Signed-off-by: Vadim Pasternak <vadimp@mellanox.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-03platform/x86: mlx-platform: Modify DMI matching orderVadim Pasternak1-36/+36
Modify DMI matching order: perform matching based on DMI_BOARD_NAME before matching based on DMI_BOARD_VENDOR and DMI_PRODUCT_NAME in order to reduce the number of ‘dmi_table’ entries necessary for new systems support and keep matching order in logical way. For example, the existing check for DMI_PRODUCT_NAME with prefixes “MSN27", “MSN24”, "MSB” matches systems MSN2700-BXXXX, MSN2700-XXXX, MSN2410-BXXXX, MSB7800-XXXX, where ‘XXXX’ specifies some systems hardware flavors. At the same time these systems also matched by DMI_BOARD_NAME “VMOD0001”, because they all have the same platform configuration (LED, interrupt control, mux etcetera). New systems with different platform configuration, but with similar DMI_PRODUCT_NAME MSN2700-2XXXX, MSN2700-2XXXX, MSB7800-2XXXX are about to be added. These system have similar DMI_PRODUCT_NAME, since they have same ports configuration as their predecessors. All new systems will be matched by DMI_BOARD_NAME “VMOD0008”. With the change provided in the patch it is enough just to add “VMOD0008” match following natural after “VMOD0007”, otherwise “VMOD0008” or all “MSN2700-2XXXX”, “MSN2700-2XXXX”, “MSB7800-2XXXX” should be added on top of ‘mlxplat_dmi_table” in order to be matched before “MSN27", “MSN24”, "MSB”. Signed-off-by: Vadim Pasternak <vadimp@mellanox.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-03platform/x86: mlx-platform: Add regmap structure for the next generation systemsVadim Pasternak1-0/+20
Use separated regamp structures for old and next generation systems. Next generation systems don’t require write protection removing. Signed-off-by: Vadim Pasternak <vadimp@mellanox.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-03platform/x86: mlx-platform: Change API for i2c-mlxcpld driver activationVadim Pasternak1-3/+27
Activate 'i2c-mlxcpld' driver with 'platform_device_register_resndata' instead off 'platform_device_register_simple' in order to pass platform specific info. Add platform i2c data for the next generation systems. Signed-off-by: Vadim Pasternak <vadimp@mellanox.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-03platform/x86: mlx-platform: Move regmap initialization before all drivers activationVadim Pasternak1-25/+33
Initialize regmap prior drivers starting to allow passing regmap handle to 'i2c_mlxcpld' driver. Signed-off-by: Vadim Pasternak <vadimp@mellanox.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-02platform/x86: ISST: Restore state on resumeSrinivas Pandruvada5-1/+258
Commands which causes PUNIT writes, store them and restore them on system resume. The driver stores all such requests in a hash table and stores the the latest mailbox request parameters. On resume these commands mail box commands are executed again. There are only 5 such mail box commands which will trigger such processing so a very low overhead in store and execute on resume. Also there is no order requirement for mail box commands for these write/set commands. There is one MSR request for changing turbo ratio limits, this also stored and get restored on resume and cpu online. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-02platform/x86: ISST: Add Intel Speed Select PUNIT MSR interfaceSrinivas Pandruvada1-0/+59
While using new non arhitectural features using PUNIT Mailbox and MMIO read/write interface, still there is need to operate using MSRs to control PUNIT. User space could have used user user-space MSR interface for this, but when user space MSR access is disabled, then it can't. Here only limited number of MSRs are allowed using this new interface. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-02platform/x86: ISST: Add Intel Speed Select mailbox interface via MSRsSrinivas Pandruvada2-0/+181
Add an IOCTL to send mailbox commands to PUNIT using PUNIT MSRs for mailbox. Some CPU models don't have PCI device, so need to use MSRs. A limited set of mailbox commands can be sent to PUNIT. This MMIO interface is used by the intel-speed-select tool under tools/x86/power to enumerate and control Intel Speed Select features. The MBOX commands ids and semantics of the message can be checked from the source code of the tool. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-02platform/x86: ISST: Add Intel Speed Select mailbox interface via PCISrinivas Pandruvada4-0/+288
Add an IOCTL to send mailbox commands to PUNIT using PUNIT PCI device. A limited set of mailbox commands can be sent to PUNIT. This MMIO interface is used by the intel-speed-select tool under tools/x86/power to enumerate and control Intel Speed Select features. The MBOX commands ids and semantics of the message can be checked from the source code of the tool. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-02platform/x86: ISST: Add Intel Speed Select mmio interfaceSrinivas Pandruvada4-0/+140
Added MMIO interface to read/write specific offsets in PUNIT PCI device which export core priortization. This MMIO interface can be used using ioctl interface on /dev/isst_interface using IOCTL ISST_IF_IO_CMD. This MMIO interface is used by the intel-speed-select tool under tools/x86/power to enumerate and set core priority. The MMIO offsets and semantics of the message can be checked from the source code of the tool. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-02platform/x86: ISST: Add IOCTL to Translate Linux logical CPU to PUNIT CPU numberSrinivas Pandruvada1-0/+74
Add processing for IOCTL command ISST_IF_GET_PHY_ID. This converts from the Linux logical CPU to PUNIT CPU numbering scheme. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-02platform/x86: ISST: Store per CPU informationSrinivas Pandruvada2-1/+114
There are two per CPU data needs to be stored and cached to avoid repeated MSR readings for accessing them later: - Physical to logical CPU conversion The PUNIT uses a different CPU numbering scheme which is not APIC id based. So we need to establish relationship between PUNIT CPU number and Linux logical CPU numbering which is based on APIC id. There is an MSR 0x53 (MSR_THREAD_ID), which gets physical CPU number for the local CPU where it is read. Also the CPU mask in some messages will inform which CPUs needs to be online/offline for a TDP level. During TDP switch if user offlined some CPUs, then the physical CPU mask can't be converted as we can't read MSR on an offlined CPU to go to a lower TDP level by onlining more CPUs. So the mapping needs to be established at the boot up time. - Bus number corresponding to a CPU A group of CPUs are in a control of a PUNIT. The PUNIT device is exported as PCI device. To do operation on a PUNIT for a CPU, we need to find out to which PCI device it is related to. This is done by reading MSR 0x128 (MSR_CPU_BUS_NUMBER). So during CPU online stages the above MSRs are read and stored. Later this stored information is used to process IOCTLs request from the user space. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-07-02platform/x86: ISST: Add common API to register and handle ioctlsSrinivas Pandruvada6-0/+269
Encapsulate common functions which all Intel Speed Select Technology interface drivers can use. This creates API to register misc device for user kernel communication and handle all common IOCTLs. As part of the registry it allows a callback which is to handle domain specific ioctl processing. There can be multiple drivers register for services, which can be built as modules. So this driver handle contention during registry and as well as during removal. Once user space opened the misc device, the registered driver will be prevented from removal. Also once misc device is opened by the user space new client driver can't register, till the misc device is closed. There are two types of client drivers, one to handle mail box interface and the other is to allow direct read/write to some specific MMIO space. This common driver implements IOCTL ISST_IF_GET_PLATFORM_INFO. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-29platform/x86: intel_int0002_vgpio: Get rid of custom ICPU() macroAndy Shevchenko1-15/+7
Replace custom grown macro with generic INTEL_CPU_FAM6() one. No functional change intended. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2019-06-29platform/x86: pmc_atom: Add CB4063 Beckhoff Automation board to critclk_systems DMI tableSteffen Dirkwinkel1-0/+8
The CB4063 board uses pmc_plt_clk* clocks for ethernet controllers. This adds it to the critclk_systems DMI table so the clocks are marked as CLK_CRITICAL and not turned off. Fixes: 648e921888ad ("clk: x86: Stop marking clocks as CLK_IS_CRITICAL") Signed-off-by: Steffen Dirkwinkel <s.dirkwinkel@beckhoff.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-29platform/x86: acer-wmi: Mark expected switch fall-throughsGustavo A. R. Silva1-0/+4
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. This patch fixes the following warnings: drivers/platform/x86/acer-wmi.c: In function ‘set_u32’: drivers/platform/x86/acer-wmi.c:1378:33: warning: this statement may fall through [-Wimplicit-fallthrough=] if (cap == ACER_CAP_WIRELESS || ^ drivers/platform/x86/acer-wmi.c:1386:3: note: here case ACER_WMID: ^~~~ drivers/platform/x86/acer-wmi.c:1393:12: warning: this statement may fall through [-Wimplicit-fallthrough=] else if (wmi_has_guid(WMID_GUID2)) ^ drivers/platform/x86/acer-wmi.c:1395:3: note: here default: ^~~~~~~ drivers/platform/x86/acer-wmi.c: In function ‘get_u32’: drivers/platform/x86/acer-wmi.c:1340:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (cap == ACER_CAP_MAILLED) { ^ drivers/platform/x86/acer-wmi.c:1344:2: note: here case ACER_WMID: ^~~~ drivers/platform/x86/acer-wmi.c: In function ‘WMID_get_u32’: drivers/platform/x86/acer-wmi.c:1013:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (quirks->mailled == 1) { ^ drivers/platform/x86/acer-wmi.c:1018:2: note: here default: ^~~~~~~ Warning level 3 was used: -Wimplicit-fallthrough=3 This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-29platform/x86: touchscreen_dmi: Update Hi10 Air filterChristian Oder1-1/+2
Turns out the Hi10 Air is built by multiple companies so using Hampoo as a filter is not enough to cover all variants. This has been verified as working on the Hampoo and Morshow version. Signed-off-by: Christian Oder <me@myself5.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-29platform/x86: wmi: add Xiaomi WMI key driverMattias Jacobsson3-0/+103
Some function keys on the built in keyboard on Xiaomi's notebooks does not produce any key events when pressed in combination with the function key. Some of these keys do report that they are being pressed via WMI events. This driver reports key events for Fn+F7 and double tap on Fn. Other WMI events that are reported by the hardware but not utilized by this driver are Caps Lock(which already work) and Fn lock/unlock. Signed-off-by: Mattias Jacobsson <2pi@mok.nu> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: wmi: add context argument to the probe functionMattias Jacobsson7-7/+10
The struct wmi_device_id has a context pointer field, forward this pointer as an argument to the probe function in struct wmi_driver. Update existing users of the same probe function to accept this new context argument. Signed-off-by: Mattias Jacobsson <2pi@mok.nu> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: wmi: add context pointer field to struct wmi_device_idMattias Jacobsson1-0/+22
When using wmi_install_notify_handler() to initialize a WMI handler a data pointer can be supplied which will be passed on to the notification handler. No similar feature exist when handling WMI events via struct wmi_driver. Add a context field pointer to struct wmi_device_id and add a function find_guid_context() to retrieve that context pointer. Signed-off-by: Mattias Jacobsson <2pi@mok.nu> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Do not disable keyboard backlight on unloadingYurii Pavlovskyi1-0/+4
The keyboard backlight is automatically disabled when the module is unloaded as it is exposed as a ledclass device. Change this behavior to ignore setting brightness when the device is in unloading state. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Switch fan boost modeYurii Pavlovskyi1-8/+143
The WMI exposes a write-only device ID where up to three fan modes can be switched on some laptops (TUF Gaming FX505GM). There is a hotkey combination Fn-F5 that does have a fan icon, which is designed to toggle between fan modes. The DSTS of the device ID returns information about the presence of this capability and the presence of each of the two additional fan modes as a bitmask (0x01 - overboost present, 0x02 - silent present) [1]. Add a SysFS entry that reads the last written value and updates value in WMI on write and a hotkey handler that toggles the modes taking into account their availability according to DSTS. Modes: * 0x00 - normal or balanced, * 0x01 - overboost, increased fan RPM, * 0x02 - silent, decreased fan RPM [1] Link: https://lkml.org/lkml/2019/4/12/110 Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Suggested-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Enhance detection of thermal dataYurii Pavlovskyi1-2/+5
The obviously wrong value 1 for temperature device ID in this driver is returned by at least some devices, including TUF Gaming series laptops, instead of 0 as expected previously. Observable effect is that a temp1_input in hwmon reads temperature near absolute zero. Consider 0.1 K an erroneous value in addition to 0 K. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Organize code into sectionsYurii Pavlovskyi1-42/+47
The driver has grown pretty big and will grow more, which makes it hard to navigate and understand. Add uniform comments to the code and ensure that it is sorted into logical sections. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Refactor error handlingYurii Pavlovskyi1-5/+1
Remove exit label as it is only used once from the point in code where no cleanup is required and return can be called immediately. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-nb-wmi: Add microphone mute key codeYurii Pavlovskyi1-1/+2
The microphone mute key is missing from sparse keymap. It is present on FX505GM and possibly other laptops. Add the missing code. Also, comment on the fan mode switch key, which has the same code as the already used key. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Support WMI event queueYurii Pavlovskyi1-5/+68
Event codes are expected to be retrieved from a queue on at least some models. Specifically, very likely the ACPI WMI devices with _UID ATK are queued whereas those with ASUSWMI are not [1]. The WMI event codes are pushed into a circular buffer queue. After the INIT method is called, ACPI code is allowed to push events into this buffer. The INIT method cannot be reverted. If the module is unloaded and an event (such as hotkey press) gets emitted before inserting it back the events get processed delayed by one or if the queue overflows, additionally delayed by about 3 seconds. It might be considered a minor issue and no normal user would likely observe this (there is little reason unloading the driver), but it does significantly frustrate a developer who is unlucky enough to encounter this. Therefore, the fallback to unqueued behavior occurs whenever something unexpected happens. The fix flushes the old key codes out of the queue on load. After receiving event the queue is read until either ..FFFF or 1 is encountered. Also as noted in [1] it is checked whether notify code is equal to 0xFF before enabling queue processing in WMI notify handler. DSDT examples: FX505GM Device (ATKD) { .. Name (ATKQ, Package (0x10) { 0xFFFFFFFF, .. } Method (IANQ, 1, Serialized) { If ((AQNO >= 0x10)) { Local0 = 0x64 While ((Local0 && (AQNO >= 0x10))) { Local0-- Sleep (0x0A) } ... .. AQTI++ AQTI &= 0x0F ATKQ [AQTI] = Arg0 ... } Method (GANQ, 0, Serialized) { .. If (AQNO) { ... Local0 = DerefOf (ATKQ [AQHI]) AQHI++ AQHI &= 0x0F Return (Local0) } Return (One) } This code is almost identical to K54C, which does return Ones on empty queue. K54C: Method (GANQ, 0, Serialized) { If (AQNO) { ... Return (Local0) } Return (Ones) } [1] Link: https://lkml.org/lkml/2019/4/12/104 Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Suggested-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Refactor WMI event handlingYurii Pavlovskyi1-24/+42
Refactor WMI event handling into separate functions for getting the event code and handling the retrieved event code as a preparation for introduction of WMI event queue support. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Improve DSTS WMI method ID detectionYurii Pavlovskyi2-4/+21
The DSTS method detection mistakenly selects DCTS instead of DSTS if nothing is returned when the method ID is not defined in WMNB. As a result, the control of keyboard backlight is not functional for TUF Gaming series laptops. Implement detection based on _UID of the WMI device instead. There is evidence that DCTS is handled by ACPI WMI devices that have _UID ASUSWMI, whereas none of the devices without ASUSWMI respond to DCTS and DSTS is used instead [1]. DSDT examples: FX505GM (_UID ATK): Method (WMNB, 3, Serialized) { ... If ((Local0 == 0x53545344)) { ... Return (Zero) } ... // No return } K54C (_UID ATK): Method (WMNB, 3, Serialized) { ... If ((Local0 == 0x53545344)) { ... Return (0x02) } ... Return (0xFFFFFFFE) } [1] Link: https://lkml.org/lkml/2019/4/11/322 Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Suggested-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: wmi: Add function to get _UID of WMI deviceYurii Pavlovskyi1-0/+19
Add a new function to acpi.h / wmi.c that returns _UID of the ACPI WMI device. For example, it returns "ATK" for the following declaration in DSDT: Device (ATKD) { Name (_HID, "PNP0C14" /* Windows Management Instrumentation Device */) // _HID: Hardware ID Name (_UID, "ATK") // _UID: Unique ID .. Generally, it is possible that multiple PNP0C14 ACPI devices are present in the system as mentioned in the commit message of commit bff431e49ff5 ("ACPI: WMI: Add ACPI-WMI mapping driver"). Therefore the _UID is returned for a specific ACPI device that declares the given GUID, to which it is also mapped by other methods of wmi module. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Increase input buffer size of WMI methodsYurii Pavlovskyi1-1/+9
The asus-nb-wmi driver is matched by WMI alias but fails to load on TUF Gaming series laptops producing multiple ACPI errors in the kernel log. The input buffer for WMI method invocation size is 2 dwords, whereas 3 are expected by this model. FX505GM: .. Method (WMNB, 3, Serialized) { P8XH (Zero, 0x11) CreateDWordField (Arg2, Zero, IIA0) CreateDWordField (Arg2, 0x04, IIA1) CreateDWordField (Arg2, 0x08, IIA2) Local0 = (Arg1 & 0xFFFFFFFF) ... Compare with older K54C: ... Method (WMNB, 3, NotSerialized) { CreateDWordField (Arg2, 0x00, IIA0) CreateDWordField (Arg2, 0x04, IIA1) Local0 = (Arg1 & 0xFFFFFFFF) ... Increase buffer size to 3 dwords. No negative consequences of this change are expected, as the input buffer size is not verified. The original function is replaced by a wrapper for a new method passing value 0 for the last parameter. The new function will be used to control RGB keyboard backlight. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Reviewed-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Fix preserving keyboard backlight intensity on loadYurii Pavlovskyi1-2/+1
The error code and return value are mixed up. The intensity is always set to 0 on load as kbd_led_read returns either 0 or negative value. To reproduce set backlight to maximum, reload driver and try to increase it using keyboard hotkey, the intensity will drop as a result. Correct the implementation. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Reviewed-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: Fix hwmon device cleanupYurii Pavlovskyi1-3/+4
The driver does not clean up the hwmon device on exit or error. To reproduce the bug, repeat rmmod, insmod to verify that device number /sys/devices/platform/asus-nb-wmi/hwmon/hwmon?? grows every time. Replace call for registering device with devm_* version that unregisters it automatically. Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> Reviewed-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: intel_telemetry: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-62/+16
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Rajneesh Bhardwaj <rajneesh.bhardwaj@linux.intel.com> Cc: "David E. Box" <david.e.box@linux.intel.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: intel_pmc: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-15/+3
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com> Cc: Vishwanath Somayaji <vishwanath.somayaji@intel.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: pmc_atom: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-33/+10
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: samsung-laptop: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-66/+23
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Corentin Chary <corentin.chary@gmail.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: ideapad-laptop: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-29/+7
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Ike Panhc <ike.pan@canonical.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: dell-laptop: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-3/+2
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: "Pali Rohár" <pali.rohar@gmail.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: asus-wmi: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-36/+11
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Corentin Chary <corentin.chary@gmail.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: acpi4asus-user@lists.sourceforge.net Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-17platform/x86: acer-wmi: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-24/+5
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Also, because there is no need to save the file dentry, remove the variable that was saving it and just recursively delete the whole directory. Cc: "Lee, Chun-Yi" <jlee@suse.com> Cc: Darren Hart <dvhart@infradead.org> Cc: Andy Shevchenko <andy@infradead.org> Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-12platform/x86: hp_accel: Add support for HP ProBook 450 G0Colin Sindle1-0/+1
HP ProBook 450 G0 needs a non-standard mapping (x_inverted). Signed-off-by: Colin Sindle <csindle@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-12platform/x86: pcengines-apuv2: Make two symbols staticYueHaibing1-2/+2
Fix sparse warnings: drivers/platform/x86/pcengines-apuv2.c:80:27: warning: symbol 'gpios_led_table' was not declared. Should it be static? drivers/platform/x86/pcengines-apuv2.c:113:27: warning: symbol 'gpios_key_table' was not declared. Should it be static? Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-By: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-12platform/x86: intel_menlow: avoid null pointer deference errorYoung Xiao1-2/+6
Fix a null pointer deference by acpi_driver_data() if device is null (dereference before check). We should only set cdev and check this is OK after we are sure device is not null. Signed-off-by: Young Xiao <92siuyang@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-12platform/x86: Remove left-over BACKLIGHT_LCD_SUPPORTKrzysztof Kozlowski1-2/+0
The CONFIG_BACKLIGHT_LCD_SUPPORT was removed in commit 8c5dc8d9f19c ("video: backlight: Remove useless BACKLIGHT_LCD_SUPPORT kernel symbol"). Options protected by CONFIG_BACKLIGHT_LCD_SUPPORT are now available directly. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-12platform/x86: touchscreen_dmi: Add info for the CHUWI Hi10 Plus tablet.Daniel Smith1-0/+25
Added touch screen info for CHUWI Hi10 Plus tablet. Signed-off-by: Daniel Smith <danct12@disroot.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2019-06-12platform/mellanox: mlxreg-hotplug: Add devm_free_irq call to remove flowVadim Pasternak1-0/+1
Add devm_free_irq() call to mlxreg-hotplug remove() for clean release of devices irq resource. Fix debugobjects warning triggered by rmmod It prevents of use-after-free memory, related to mlxreg_hotplug_work_handler. Issue has been reported as debugobjects warning triggered by 'rmmod mlxtreg-hotplug' flow, while running kernel with CONFIG_DEBUG_OBJECTS* options. [ 2489.623551] ODEBUG: free active (active state 0) object type: work_struct hint: mlxreg_hotplug_work_handler+0x0/0x7f0 [mlxreg_hotplug] [ 2489.637097] WARNING: CPU: 5 PID: 3924 at lib/debugobjects.c:328 debug_print_object+0xfe/0x180 [ 2489.637165] RIP: 0010:debug_print_object+0xfe/0x180 ? [ 2489.637214] Call Trace: [ 2489.637225] __debug_check_no_obj_freed+0x25e/0x320 [ 2489.637231] kfree+0x82/0x110 [ 2489.637238] release_nodes+0x33c/0x4e0 [ 2489.637242] ? devres_remove_group+0x1b0/0x1b0 [ 2489.637247] device_release_driver_internal+0x146/0x270 [ 2489.637251] driver_detach+0x73/0xe0 [ 2489.637254] bus_remove_driver+0xa1/0x170 [ 2489.637261] __x64_sys_delete_module+0x29e/0x320 [ 2489.637265] ? __ia32_sys_delete_module+0x320/0x320 [ 2489.637268] ? blkcg_exit_queue+0x20/0x20 [ 2489.637273] ? task_work_run+0x7d/0x100 [ 2489.637278] ? exit_to_usermode_loop+0x5b/0xf0 [ 2489.637281] do_syscall_64+0x73/0x160 [ 2489.637287] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 2489.637290] RIP: 0033:0x7f95c3596fd7 The difference in release flow with and with no devm_free_irq is listed below: bus: 'platform': remove driver mlxreg-hotplug mlxreg_hotplug_remove(start) -> devm_free_irq (with new code) mlxreg_hotplug_remove (end) release_nodes (start) mlxreg-hotplug: DEVRES REL devm_hwmon_release (8 bytes) device: 'hwmon3': device_unregister PM: Removing info for No Bus:hwmon3 mlxreg-hotplug: DEVRES REL devm_kzalloc_release (88 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (6 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (5 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (5 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (5 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (5 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (5 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (5 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (5 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (5 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (5 bytes) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (5 bytes) mlxreg-hotplug: DEVRES REL devm_irq_release (16 bytes) (no new code) mlxreg-hotplug: DEVRES REL devm_kzalloc_release (1376 bytes) ------------[ cut here ]------------ (no new code): ODEBUG: free active (active state 0) object type: work_struct hint: mlxreg_hotplug_work_handler release_nodes(end) driver: 'mlxreg-hotplug': driver_release Fixes: 1f976f6978bf ("platform/x86: Move Mellanox platform hotplug driver to platform/mellanox") Signed-off-by: Vadim Pasternak <vadimp@mellanox.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>