From: Kate Hsuan Date: Fri, 20 Aug 2021 11:04:58 +0000 (+0300) Subject: platform/x86: intel-wmi-thunderbolt: Move to intel sub-directory X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=95c3e4b4282a4033ff3b0fe64bd4d2a2f3f0d31d;p=linux.git platform/x86: intel-wmi-thunderbolt: Move to intel sub-directory Move Intel WMI Thunderbolt driver to intel sub-directory to improve readability. Signed-off-by: Kate Hsuan Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210820110458.73018-21-andriy.shevchenko@linux.intel.com Signed-off-by: Hans de Goede --- diff --git a/MAINTAINERS b/MAINTAINERS index 3ca5102ed811e..60ee48c71c83e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9597,7 +9597,7 @@ F: drivers/platform/x86/intel/wmi/sbl-fw-update.c INTEL WMI THUNDERBOLT FORCE POWER DRIVER L: Dell.Client.Kernel@dell.com S: Maintained -F: drivers/platform/x86/intel-wmi-thunderbolt.c +F: drivers/platform/x86/intel/wmi/thunderbolt.c INTEL WWAN IOSM DRIVER M: M Chetan Kumar diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index d23053b6e29fa..e21ea3d23e6f2 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -77,18 +77,6 @@ config UV_SYSFS To compile this driver as a module, choose M here: the module will be called uv_sysfs. -config INTEL_WMI_THUNDERBOLT - tristate "Intel WMI thunderbolt force power driver" - depends on ACPI_WMI - help - Say Y here if you want to be able to use the WMI interface on select - systems to force the power control of Intel Thunderbolt controllers. - This is useful for updating the firmware when devices are not plugged - into the controller. - - To compile this driver as a module, choose M here: the module will - be called intel-wmi-thunderbolt. - config MXM_WMI tristate "WMI support for MXM Laptop Graphics" depends on ACPI_WMI diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index 29ab09e0f36bf..69690e26bb6d4 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile @@ -10,7 +10,6 @@ obj-$(CONFIG_WMI_BMOF) += wmi-bmof.o # WMI drivers obj-$(CONFIG_HUAWEI_WMI) += huawei-wmi.o -obj-$(CONFIG_INTEL_WMI_THUNDERBOLT) += intel-wmi-thunderbolt.o obj-$(CONFIG_MXM_WMI) += mxm-wmi.o obj-$(CONFIG_PEAQ_WMI) += peaq-wmi.o obj-$(CONFIG_XIAOMI_WMI) += xiaomi-wmi.o diff --git a/drivers/platform/x86/intel-wmi-thunderbolt.c b/drivers/platform/x86/intel-wmi-thunderbolt.c deleted file mode 100644 index 4ae87060d18b4..0000000000000 --- a/drivers/platform/x86/intel-wmi-thunderbolt.c +++ /dev/null @@ -1,94 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * WMI Thunderbolt driver - * - * Copyright (C) 2017 Dell Inc. All Rights Reserved. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define INTEL_WMI_THUNDERBOLT_GUID "86CCFD48-205E-4A77-9C48-2021CBEDE341" - -static ssize_t force_power_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct acpi_buffer input; - acpi_status status; - u8 mode; - - input.length = sizeof(u8); - input.pointer = &mode; - mode = hex_to_bin(buf[0]); - dev_dbg(dev, "force_power: storing %#x\n", mode); - if (mode == 0 || mode == 1) { - status = wmi_evaluate_method(INTEL_WMI_THUNDERBOLT_GUID, 0, 1, - &input, NULL); - if (ACPI_FAILURE(status)) { - dev_dbg(dev, "force_power: failed to evaluate ACPI method\n"); - return -ENODEV; - } - } else { - dev_dbg(dev, "force_power: unsupported mode\n"); - return -EINVAL; - } - return count; -} - -static DEVICE_ATTR_WO(force_power); - -static struct attribute *tbt_attrs[] = { - &dev_attr_force_power.attr, - NULL -}; - -static const struct attribute_group tbt_attribute_group = { - .attrs = tbt_attrs, -}; - -static int intel_wmi_thunderbolt_probe(struct wmi_device *wdev, - const void *context) -{ - int ret; - - ret = sysfs_create_group(&wdev->dev.kobj, &tbt_attribute_group); - kobject_uevent(&wdev->dev.kobj, KOBJ_CHANGE); - return ret; -} - -static void intel_wmi_thunderbolt_remove(struct wmi_device *wdev) -{ - sysfs_remove_group(&wdev->dev.kobj, &tbt_attribute_group); - kobject_uevent(&wdev->dev.kobj, KOBJ_CHANGE); -} - -static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = { - { .guid_string = INTEL_WMI_THUNDERBOLT_GUID }, - { }, -}; - -static struct wmi_driver intel_wmi_thunderbolt_driver = { - .driver = { - .name = "intel-wmi-thunderbolt", - }, - .probe = intel_wmi_thunderbolt_probe, - .remove = intel_wmi_thunderbolt_remove, - .id_table = intel_wmi_thunderbolt_id_table, -}; - -module_wmi_driver(intel_wmi_thunderbolt_driver); - -MODULE_DEVICE_TABLE(wmi, intel_wmi_thunderbolt_id_table); -MODULE_AUTHOR("Mario Limonciello "); -MODULE_DESCRIPTION("Intel WMI Thunderbolt force power driver"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/platform/x86/intel/wmi/Kconfig b/drivers/platform/x86/intel/wmi/Kconfig index c5753b1e8f432..8e159f712179d 100644 --- a/drivers/platform/x86/intel/wmi/Kconfig +++ b/drivers/platform/x86/intel/wmi/Kconfig @@ -16,3 +16,16 @@ config INTEL_WMI_SBL_FW_UPDATE To compile this driver as a module, choose M here: the module will be called intel-wmi-sbl-fw-update. + +config INTEL_WMI_THUNDERBOLT + tristate "Intel WMI thunderbolt force power driver" + depends on ACPI_WMI + select INTEL_WMI + help + Say Y here if you want to be able to use the WMI interface on select + systems to force the power control of Intel Thunderbolt controllers. + This is useful for updating the firmware when devices are not plugged + into the controller. + + To compile this driver as a module, choose M here: the module will + be called intel-wmi-thunderbolt. diff --git a/drivers/platform/x86/intel/wmi/Makefile b/drivers/platform/x86/intel/wmi/Makefile index bf1f118b68392..c2d56d25dea0b 100644 --- a/drivers/platform/x86/intel/wmi/Makefile +++ b/drivers/platform/x86/intel/wmi/Makefile @@ -5,3 +5,5 @@ intel-wmi-sbl-fw-update-y := sbl-fw-update.o obj-$(CONFIG_INTEL_WMI_SBL_FW_UPDATE) += intel-wmi-sbl-fw-update.o +intel-wmi-thunderbolt-y := thunderbolt.o +obj-$(CONFIG_INTEL_WMI_THUNDERBOLT) += intel-wmi-thunderbolt.o diff --git a/drivers/platform/x86/intel/wmi/thunderbolt.c b/drivers/platform/x86/intel/wmi/thunderbolt.c new file mode 100644 index 0000000000000..4ae87060d18b4 --- /dev/null +++ b/drivers/platform/x86/intel/wmi/thunderbolt.c @@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * WMI Thunderbolt driver + * + * Copyright (C) 2017 Dell Inc. All Rights Reserved. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define INTEL_WMI_THUNDERBOLT_GUID "86CCFD48-205E-4A77-9C48-2021CBEDE341" + +static ssize_t force_power_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct acpi_buffer input; + acpi_status status; + u8 mode; + + input.length = sizeof(u8); + input.pointer = &mode; + mode = hex_to_bin(buf[0]); + dev_dbg(dev, "force_power: storing %#x\n", mode); + if (mode == 0 || mode == 1) { + status = wmi_evaluate_method(INTEL_WMI_THUNDERBOLT_GUID, 0, 1, + &input, NULL); + if (ACPI_FAILURE(status)) { + dev_dbg(dev, "force_power: failed to evaluate ACPI method\n"); + return -ENODEV; + } + } else { + dev_dbg(dev, "force_power: unsupported mode\n"); + return -EINVAL; + } + return count; +} + +static DEVICE_ATTR_WO(force_power); + +static struct attribute *tbt_attrs[] = { + &dev_attr_force_power.attr, + NULL +}; + +static const struct attribute_group tbt_attribute_group = { + .attrs = tbt_attrs, +}; + +static int intel_wmi_thunderbolt_probe(struct wmi_device *wdev, + const void *context) +{ + int ret; + + ret = sysfs_create_group(&wdev->dev.kobj, &tbt_attribute_group); + kobject_uevent(&wdev->dev.kobj, KOBJ_CHANGE); + return ret; +} + +static void intel_wmi_thunderbolt_remove(struct wmi_device *wdev) +{ + sysfs_remove_group(&wdev->dev.kobj, &tbt_attribute_group); + kobject_uevent(&wdev->dev.kobj, KOBJ_CHANGE); +} + +static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = { + { .guid_string = INTEL_WMI_THUNDERBOLT_GUID }, + { }, +}; + +static struct wmi_driver intel_wmi_thunderbolt_driver = { + .driver = { + .name = "intel-wmi-thunderbolt", + }, + .probe = intel_wmi_thunderbolt_probe, + .remove = intel_wmi_thunderbolt_remove, + .id_table = intel_wmi_thunderbolt_id_table, +}; + +module_wmi_driver(intel_wmi_thunderbolt_driver); + +MODULE_DEVICE_TABLE(wmi, intel_wmi_thunderbolt_id_table); +MODULE_AUTHOR("Mario Limonciello "); +MODULE_DESCRIPTION("Intel WMI Thunderbolt force power driver"); +MODULE_LICENSE("GPL v2");