mirror of
https://github.com/torvalds/linux.git
synced 2024-12-14 23:25:54 +00:00
5516745311
ASUS WMI driver got a big refactoring in order to support the TUF Gaming laptops. Besides that, the regression with backlight being permanently off on various EeePC laptops has been fixed. Accelerometer on HP ProBook 450 G0 shows wrong measurements due to X axis being inverted. This has been fixed. Intel PMC core driver has been extended to be ACPI enumerated if the DSDT provides device with _HID "INT33A1". This allows to convert the driver to be pure platform and support new hardware purely based on ACPI DSDT. From now on the Intel Speed Select Technology is supported thru a corresponding driver. This driver provides an access to the features of the ISST, such as Performance Profile, Core Power, Base frequency and Turbo Frequency. Mellanox platform drivers has been refactored and now extended to support more systems, including new coming ones. The OLPC XO-1.75 platform is now supported. CB4063 Beckhoff Automation board is using PMC clocks, provided via pmc_atom driver, for ethernet controllers in a way that they can't be managed by the clock driver. The quirk has been extended to cover this case. Touchscreen on Chuwi Hi10 Plus tablet has been enabled. Meanwhile the information of Chuwi Hi10 Air has been fixed to cover more models based on the same platform. Xiaomi notebooks have WMI interface enabled. Thus, the driver to support it has been provided. It required some extension of the generic WMI library, which allows to propagate opaque context to the ->probe() of the individual drivers. This release includes debugfs clean up from Greg KH for several drivers that drop return code check and make debugfs absence or failure non-fatal. Miscellaneous fixes here and there, mostly for Acer WMI and various Intel drivers. The listed below commits are duplicated due to previously pushed fixes in v5.2 cycle: -1dd93f873d
platform/x86: asus-wmi: Only Tell EC the OS will handle display hotkeys from asus_nb_wmi -89ae3a0736
platform/x86: intel-vbtn: Report switch events when event wakes device -fa882fc80d
platform/x86: mlx-platform: Fix parent device in i2c-mux-reg device registration -0bfcd24b39
platform/mellanox: mlxreg-hotplug: Add devm_free_irq call to remove flow The following is an automated git shortlog grouped by driver: acer-wmi: - Mark expected switch fall-throughs - no need to check return value of debugfs_create functions asus-nb-wmi: - Add microphone mute key code asus-wmi: - Use dev_get_drvdata() - Do not disable keyboard backlight on unloading - Switch fan boost mode - Enhance detection of thermal data - Organize code into sections - Refactor error handling - Support WMI event queue - Refactor WMI event handling - Improve DSTS WMI method ID detection - Increase input buffer size of WMI methods - Fix preserving keyboard backlight intensity on load - Fix hwmon device cleanup - no need to check return value of debugfs_create functions - Only Tell EC the OS will handle display hotkeys from asus_nb_wmi dell-laptop: - no need to check return value of debugfs_create functions hp_accel: - Add support for HP ProBook 450 G0 ideapad-laptop: - no need to check return value of debugfs_create functions intel_int0002_vgpio: - Get rid of custom ICPU() macro intel_menlow: - avoid null pointer deference error intel_pmc: - no need to check return value of debugfs_create functions intel_pmc_core: - Attach using APCI HID "INT33A1" - transform Pkg C-state residency from TSC ticks into microseconds intel_telemetry: - no need to check return value of debugfs_create functions intel-vbtn: - Report switch events when event wakes device ISST: - Restore state on resume - Add Intel Speed Select PUNIT MSR interface - Add Intel Speed Select mailbox interface via MSRs - Add Intel Speed Select mailbox interface via PCI - Add Intel Speed Select mmio interface - Add IOCTL to Translate Linux logical CPU to PUNIT CPU number - Store per CPU information - Add common API to register and handle ioctls - Update ioctl-number.txt for Intel Speed Select interface - A tool to validate Intel Speed Select commands - Add .gitignore file MAINTAINERS: - Update for Intel Speed Select Technology mlx-platform: - Fix error handling in mlxplat_init() - Add more reset cause attributes - Modify DMI matching order - Add regmap structure for the next generation systems - Change API for i2c-mlxcpld driver activation - Move regmap initialization before all drivers activation - Fix parent device in i2c-mux-reg device registration - Add new attribute for mlxreg-io sysfs interfaces pcengines-apuv2: - Make two symbols static - Fix PCENGINES_APU2 Kconfig warning OLPC: - Add a config menu category for XO 1.75 - Require CONFIG_POWER_SUPPLY for XO-1.75 EC - Fix olpc_xo175_ec_cmd() return value - Make olpc_dt_compatible_match() static __init - Add INPUT dependencies - Fix build error without CONFIG_SPI - Add a regulator for the DCON - Add XO-1.75 EC driver - Use BIT() and GENMASK() for event masks - Avoid a warning if the EC didn't register yet - Move EC-specific functionality out from x86 - Remove an unused include - Add OLPC XO-1.75 EC bindings platform/mellanox: - mlxreg-hotplug: Add devm_free_irq call to remove flow pmc_atom: - Add CB4063 Beckhoff Automation board to critclk_systems DMI table - no need to check return value of debugfs_create functions Kconfig: - Remove left-over BACKLIGHT_LCD_SUPPORT samsung-laptop: - no need to check return value of debugfs_create functions touchscreen_dmi: - Update Hi10 Air filter - Add info for the CHUWI Hi10 Plus tablet. wmi: - add Xiaomi WMI key driver - add context argument to the probe function - add context pointer field to struct wmi_device_id - Add function to get _UID of WMI device -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEqaflIX74DDDzMJJtb7wzTHR8rCgFAl0rP88ACgkQb7wzTHR8 rCis8BAAnRgRgi8x1C7xn66gAUHsDXpY0tF9cp/Fw3HyTmFCQkRSmnLkMM2DqGi+ dvB9U1zPcGWwdwryKFsJXioEK3erYpiYyT2VwLtW4S7P5jQ+N9biT4TZ8yFp0MEr MZC50LZDV1JTp1a0GQyrMpfoMBnE7UhR2GL8UbGli/WwXFE5BLkrJ1pdrjhYZOHl rJcgq3HPAhV5qkUkIU7gTC2GGSPydjBqk0OhVIU4dPsYwXIb2gXc0yR0QVwKm5x3 I/NQwBOBMKmdI6uJ8BJyg/p888Strw65YJaTe5wtvG8ljuIbcN/aQ3ZmClNrUnc0 58byqJCpRhg9HN39VpF9rsApEGxKTlitAUAUKy7lgue7/mycHbA1Syzz29AIM+2v ey2/zgFeeWtgh1cuh2cUWlCE6woW7ED4VpDxhkXlX4xGUp+CILEiFqcsULlcc4j5 sgojCLRPs78roYj9Y84CwYbsd7J/Ce4r2evBpKYPqYxDbUiuH2aVQtEdPTKv9/xC yHtBuJJSxY7a+sf4OZONRo13dfvRoZIPjcccR8yTOakS2/1Fqph7MpHyDkwFAfeS M2f+OcJn9IECol1391PTLj9Dx3jApyVk21HJdiIj7sKZgJOSS54AFm0/Ywk0MFpY XScXKulV48SdL4ZKup5aIpDzyP5zuvXszKQboRitep1dHiR9bl0= =DC5j -----END PGP SIGNATURE----- Merge tag 'platform-drivers-x86-v5.3-1' of git://git.infradead.org/linux-platform-drivers-x86 Pull x86 platform driver updates from Andy Shevchenko: "Gathered a bunch of x86 platform driver changes. It's rather big, since includes two big refactors and completely new driver: - ASUS WMI driver got a big refactoring in order to support the TUF Gaming laptops. Besides that, the regression with backlight being permanently off on various EeePC laptops has been fixed. - Accelerometer on HP ProBook 450 G0 shows wrong measurements due to X axis being inverted. This has been fixed. - Intel PMC core driver has been extended to be ACPI enumerated if the DSDT provides device with _HID "INT33A1". This allows to convert the driver to be pure platform and support new hardware purely based on ACPI DSDT. - From now on the Intel Speed Select Technology is supported thru a corresponding driver. This driver provides an access to the features of the ISST, such as Performance Profile, Core Power, Base frequency and Turbo Frequency. - Mellanox platform drivers has been refactored and now extended to support more systems, including new coming ones. - The OLPC XO-1.75 platform is now supported. - CB4063 Beckhoff Automation board is using PMC clocks, provided via pmc_atom driver, for ethernet controllers in a way that they can't be managed by the clock driver. The quirk has been extended to cover this case. - Touchscreen on Chuwi Hi10 Plus tablet has been enabled. Meanwhile the information of Chuwi Hi10 Air has been fixed to cover more models based on the same platform. - Xiaomi notebooks have WMI interface enabled. Thus, the driver to support it has been provided. It required some extension of the generic WMI library, which allows to propagate opaque context to the ->probe() of the individual drivers. This release includes debugfs clean up from Greg KH for several drivers that drop return code check and make debugfs absence or failure non-fatal. Also miscellaneous fixes here and there, mostly for Acer WMI and various Intel drivers" * tag 'platform-drivers-x86-v5.3-1' of git://git.infradead.org/linux-platform-drivers-x86: (74 commits) platform/x86: Fix PCENGINES_APU2 Kconfig warning tools/power/x86/intel-speed-select: Add .gitignore file platform/x86: mlx-platform: Fix error handling in mlxplat_init() platform/x86: intel_pmc_core: Attach using APCI HID "INT33A1" platform/x86: intel_pmc_core: transform Pkg C-state residency from TSC ticks into microseconds platform/x86: asus-wmi: Use dev_get_drvdata() Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces platform/x86: mlx-platform: Add more reset cause attributes platform/x86: mlx-platform: Modify DMI matching order platform/x86: mlx-platform: Add regmap structure for the next generation systems platform/x86: mlx-platform: Change API for i2c-mlxcpld driver activation platform/x86: mlx-platform: Move regmap initialization before all drivers activation MAINTAINERS: Update for Intel Speed Select Technology tools/power/x86: A tool to validate Intel Speed Select commands platform/x86: ISST: Restore state on resume platform/x86: ISST: Add Intel Speed Select PUNIT MSR interface platform/x86: ISST: Add Intel Speed Select mailbox interface via MSRs platform/x86: ISST: Add Intel Speed Select mailbox interface via PCI platform/x86: ISST: Add Intel Speed Select mmio interface platform/x86: ISST: Add IOCTL to Translate Linux logical CPU to PUNIT CPU number ...
207 lines
4.7 KiB
C
207 lines
4.7 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Dell WMI descriptor driver
|
|
*
|
|
* Copyright (C) 2017 Dell Inc. All Rights Reserved.
|
|
*/
|
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
#include <linux/acpi.h>
|
|
#include <linux/list.h>
|
|
#include <linux/module.h>
|
|
#include <linux/wmi.h>
|
|
#include "dell-wmi-descriptor.h"
|
|
|
|
#define DELL_WMI_DESCRIPTOR_GUID "8D9DDCBC-A997-11DA-B012-B622A1EF5492"
|
|
|
|
struct descriptor_priv {
|
|
struct list_head list;
|
|
u32 interface_version;
|
|
u32 size;
|
|
u32 hotfix;
|
|
};
|
|
static int descriptor_valid = -EPROBE_DEFER;
|
|
static LIST_HEAD(wmi_list);
|
|
static DEFINE_MUTEX(list_mutex);
|
|
|
|
int dell_wmi_get_descriptor_valid(void)
|
|
{
|
|
if (!wmi_has_guid(DELL_WMI_DESCRIPTOR_GUID))
|
|
return -ENODEV;
|
|
|
|
return descriptor_valid;
|
|
}
|
|
EXPORT_SYMBOL_GPL(dell_wmi_get_descriptor_valid);
|
|
|
|
bool dell_wmi_get_interface_version(u32 *version)
|
|
{
|
|
struct descriptor_priv *priv;
|
|
bool ret = false;
|
|
|
|
mutex_lock(&list_mutex);
|
|
priv = list_first_entry_or_null(&wmi_list,
|
|
struct descriptor_priv,
|
|
list);
|
|
if (priv) {
|
|
*version = priv->interface_version;
|
|
ret = true;
|
|
}
|
|
mutex_unlock(&list_mutex);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(dell_wmi_get_interface_version);
|
|
|
|
bool dell_wmi_get_size(u32 *size)
|
|
{
|
|
struct descriptor_priv *priv;
|
|
bool ret = false;
|
|
|
|
mutex_lock(&list_mutex);
|
|
priv = list_first_entry_or_null(&wmi_list,
|
|
struct descriptor_priv,
|
|
list);
|
|
if (priv) {
|
|
*size = priv->size;
|
|
ret = true;
|
|
}
|
|
mutex_unlock(&list_mutex);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(dell_wmi_get_size);
|
|
|
|
bool dell_wmi_get_hotfix(u32 *hotfix)
|
|
{
|
|
struct descriptor_priv *priv;
|
|
bool ret = false;
|
|
|
|
mutex_lock(&list_mutex);
|
|
priv = list_first_entry_or_null(&wmi_list,
|
|
struct descriptor_priv,
|
|
list);
|
|
if (priv) {
|
|
*hotfix = priv->hotfix;
|
|
ret = true;
|
|
}
|
|
mutex_unlock(&list_mutex);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(dell_wmi_get_hotfix);
|
|
|
|
/*
|
|
* Descriptor buffer is 128 byte long and contains:
|
|
*
|
|
* Name Offset Length Value
|
|
* Vendor Signature 0 4 "DELL"
|
|
* Object Signature 4 4 " WMI"
|
|
* WMI Interface Version 8 4 <version>
|
|
* WMI buffer length 12 4 <length>
|
|
* WMI hotfix number 16 4 <hotfix>
|
|
*/
|
|
static int dell_wmi_descriptor_probe(struct wmi_device *wdev,
|
|
const void *context)
|
|
{
|
|
union acpi_object *obj = NULL;
|
|
struct descriptor_priv *priv;
|
|
u32 *buffer;
|
|
int ret;
|
|
|
|
obj = wmidev_block_query(wdev, 0);
|
|
if (!obj) {
|
|
dev_err(&wdev->dev, "failed to read Dell WMI descriptor\n");
|
|
ret = -EIO;
|
|
goto out;
|
|
}
|
|
|
|
if (obj->type != ACPI_TYPE_BUFFER) {
|
|
dev_err(&wdev->dev, "Dell descriptor has wrong type\n");
|
|
ret = -EINVAL;
|
|
descriptor_valid = ret;
|
|
goto out;
|
|
}
|
|
|
|
/* Although it's not technically a failure, this would lead to
|
|
* unexpected behavior
|
|
*/
|
|
if (obj->buffer.length != 128) {
|
|
dev_err(&wdev->dev,
|
|
"Dell descriptor buffer has unexpected length (%d)\n",
|
|
obj->buffer.length);
|
|
ret = -EINVAL;
|
|
descriptor_valid = ret;
|
|
goto out;
|
|
}
|
|
|
|
buffer = (u32 *)obj->buffer.pointer;
|
|
|
|
if (strncmp(obj->string.pointer, "DELL WMI", 8) != 0) {
|
|
dev_err(&wdev->dev, "Dell descriptor buffer has invalid signature (%8ph)\n",
|
|
buffer);
|
|
ret = -EINVAL;
|
|
descriptor_valid = ret;
|
|
goto out;
|
|
}
|
|
descriptor_valid = 0;
|
|
|
|
if (buffer[2] != 0 && buffer[2] != 1)
|
|
dev_warn(&wdev->dev, "Dell descriptor buffer has unknown version (%lu)\n",
|
|
(unsigned long) buffer[2]);
|
|
|
|
priv = devm_kzalloc(&wdev->dev, sizeof(struct descriptor_priv),
|
|
GFP_KERNEL);
|
|
|
|
if (!priv) {
|
|
ret = -ENOMEM;
|
|
goto out;
|
|
}
|
|
|
|
priv->interface_version = buffer[2];
|
|
priv->size = buffer[3];
|
|
priv->hotfix = buffer[4];
|
|
ret = 0;
|
|
dev_set_drvdata(&wdev->dev, priv);
|
|
mutex_lock(&list_mutex);
|
|
list_add_tail(&priv->list, &wmi_list);
|
|
mutex_unlock(&list_mutex);
|
|
|
|
dev_dbg(&wdev->dev, "Detected Dell WMI interface version %lu, buffer size %lu, hotfix %lu\n",
|
|
(unsigned long) priv->interface_version,
|
|
(unsigned long) priv->size,
|
|
(unsigned long) priv->hotfix);
|
|
|
|
out:
|
|
kfree(obj);
|
|
return ret;
|
|
}
|
|
|
|
static int dell_wmi_descriptor_remove(struct wmi_device *wdev)
|
|
{
|
|
struct descriptor_priv *priv = dev_get_drvdata(&wdev->dev);
|
|
|
|
mutex_lock(&list_mutex);
|
|
list_del(&priv->list);
|
|
mutex_unlock(&list_mutex);
|
|
return 0;
|
|
}
|
|
|
|
static const struct wmi_device_id dell_wmi_descriptor_id_table[] = {
|
|
{ .guid_string = DELL_WMI_DESCRIPTOR_GUID },
|
|
{ },
|
|
};
|
|
|
|
static struct wmi_driver dell_wmi_descriptor_driver = {
|
|
.driver = {
|
|
.name = "dell-wmi-descriptor",
|
|
},
|
|
.probe = dell_wmi_descriptor_probe,
|
|
.remove = dell_wmi_descriptor_remove,
|
|
.id_table = dell_wmi_descriptor_id_table,
|
|
};
|
|
|
|
module_wmi_driver(dell_wmi_descriptor_driver);
|
|
|
|
MODULE_DEVICE_TABLE(wmi, dell_wmi_descriptor_id_table);
|
|
MODULE_AUTHOR("Mario Limonciello <mario.limonciello@dell.com>");
|
|
MODULE_DESCRIPTION("Dell WMI descriptor driver");
|
|
MODULE_LICENSE("GPL");
|