mirror of
https://github.com/torvalds/linux.git
synced 2024-12-07 03:21:32 +00:00
456ed864fd
- Update the ACPICA code in the kernel to the 20221020 upstream version and fix a couple of issues in it: * Make acpi_ex_load_op() match upstream implementation (Rafael Wysocki). * Add support for loong_arch-specific APICs in MADT (Huacai Chen). * Add support for fixed PCIe wake event (Huacai Chen). * Add EBDA pointer sanity checks (Vit Kabele). * Avoid accessing VGA memory when EBDA < 1KiB (Vit Kabele). * Add CCEL table support to both compiler/disassembler (Kuppuswamy Sathyanarayanan). * Add a couple of new UUIDs to the known UUID list (Bob Moore). * Add support for FFH Opregion special context data (Sudeep Holla). * Improve warning message for "invalid ACPI name" (Bob Moore). * Add support for CXL 3.0 structures (CXIMS & RDPAS) in the CEDT table (Alison Schofield). * Prepare IORT support for revision E.e (Robin Murphy). * Finish support for the CDAT table (Bob Moore). * Fix error code path in acpi_ds_call_control_method() (Rafael Wysocki). * Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() (Li Zetao). * Update the version of the ACPICA code in the kernel (Bob Moore). - Use ZERO_PAGE(0) instead of empty_zero_page in the ACPI device enumeration code (Giulio Benetti). - Change the return type of the ACPI driver remove callback to void and update its users accordingly (Dawei Li). - Add general support for FFH address space type and implement the low- level part of it for ARM64 (Sudeep Holla). - Fix stale comments in the ACPI tables parsing code and make it print more messages related to MADT (Hanjun Guo, Huacai Chen). - Replace invocations of generic library functions with more kernel- specific counterparts in the ACPI sysfs interface (Christophe JAILLET, Xu Panda). - Print full name paths of ACPI power resource objects during enumeration (Kane Chen). - Eliminate a compiler warning regarding a missing function prototype in the ACPI power management code (Sudeep Holla). - Fix and clean up the ACPI processor driver (Rafael Wysocki, Li Zhong, Colin Ian King, Sudeep Holla). - Add quirk for the HP Pavilion Gaming 15-cx0041ur to the ACPI EC driver (Mia Kanashi). - Add some mew ACPI backlight handling quirks and update some existing ones (Hans de Goede). - Make the ACPI backlight driver prefer the native backlight control over vendor backlight control when possible (Hans de Goede). - Drop unsetting ACPI APEI driver data on remove (Uwe Kleine-König). - Use xchg_release() instead of cmpxchg() for updating new GHES cache slots (Ard Biesheuvel). - Clean up the ACPI APEI code (Sudeep Holla, Christophe JAILLET, Jay Lu). - Add new I2C device enumeration quirks for Medion Lifetab S10346 and Lenovo Yoga Tab 3 Pro (YT3-X90F) (Hans de Goede). - Make the ACPI battery driver notify user space about adding new battery hooks and removing the existing ones (Armin Wolf). - Modify the pfr_update and pfr_telemetry drivers to use ACPI_FREE() for freeing acpi_object structures to help diagnostics (Wang ShaoBo). - Make the ACPI fan driver use sysfs_emit_at() in its sysfs interface code (ye xingchen). - Fix the _FIF package extraction failure handling in the ACPI fan driver (Hanjun Guo). - Fix the PCC mailbox handling error code path (Huisong Li). - Avoid using PCC Opregions if there is no platform interrupt allocated for this purpose (Huisong Li). - Use sysfs_emit() instead of scnprintf() in the ACPI PAD driver and CPPC library (ye xingchen). - Fix some kernel-doc issues in the ACPI GSI processing code (Xiongfeng Wang). - Fix name memory leak in pnp_alloc_dev() (Yang Yingliang). - Do not disable PNP devices on suspend when they cannot be re-enabled on resume (Hans de Goede). - Clean up the ACPI thermal driver a bit (Rafael Wysocki). -----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmOXV10SHHJqd0Byand5 c29ja2kubmV0AAoJEILEb/54YlRxuOwP/2zew6val2Jf7I/Yxf1iQLlRyGmhFnaH wpltJvBjlHjAUKnPQ/kLYK9fjuUY5HVgjOE03WpwhFUpmhftYTrSkhoVkJ1Mw9Zl RNOAEgCG484ThHiTIVp/dMPxrtfuqpdbamhWX3Q51IfXjGW8Vc/lDxIa3k/JQxyq ko8GFPCoebJrSCfuwaAf2+xSQaf6dq4jpL/rlIk+nYMMB9mQmXhNEhc+l97NaCe8 MyCIGynyNbhGsIlwdHRvTp04EIe8h0Z1+Dyns7g/TrzHj3Aezy7QVZbn8sKdZWa1 W/Ck9QST5tfpDWyr+hUXxUJjEn4Yy+GXjM2xON0EMx5q+JD9XsOpwWOVwTR7CS5s FwEd6I89SC8OZM86AgMtnGxygjpK24R/kGzHjhG15IQCsypc8Rvzoxl0L0YVoon/ UTkE57GzNWVzu0pY/oXJc2aT7lVqFXMFZ6ft/zHnBRnQmrcIi+xgDO5ni5KxctFN TVFwbAMCuwVx6IOcVQCZM2g4aJw426KpUn19fKnXvPwR5UIufBaCzSKWMiYrtdXr O5BM8ElYuyKCWGYEE0GSMjZygyDpyY6ENLH7s7P1IEmFyigBzaaGBbKm108JJq4V eCWJYTAx8pAptsU/vfuMvEQ1ErfhZ3TTokA5Lv0uPf53VcAnWDb7EAbW6ZGMwFSI IaV6cv6ILoqO =GVzp -----END PGP SIGNATURE----- Merge tag 'acpi-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull ACPI and PNP updates from Rafael Wysocki: "These include new code (for instance, support for the FFH address space type and support for new firmware data structures in ACPICA), some new quirks (mostly related to backlight handling and I2C enumeration), a number of fixes and a fair amount of cleanups all over. Specifics: - Update the ACPICA code in the kernel to the 20221020 upstream version and fix a couple of issues in it: - Make acpi_ex_load_op() match upstream implementation (Rafael Wysocki) - Add support for loong_arch-specific APICs in MADT (Huacai Chen) - Add support for fixed PCIe wake event (Huacai Chen) - Add EBDA pointer sanity checks (Vit Kabele) - Avoid accessing VGA memory when EBDA < 1KiB (Vit Kabele) - Add CCEL table support to both compiler/disassembler (Kuppuswamy Sathyanarayanan) - Add a couple of new UUIDs to the known UUID list (Bob Moore) - Add support for FFH Opregion special context data (Sudeep Holla) - Improve warning message for "invalid ACPI name" (Bob Moore) - Add support for CXL 3.0 structures (CXIMS & RDPAS) in the CEDT table (Alison Schofield) - Prepare IORT support for revision E.e (Robin Murphy) - Finish support for the CDAT table (Bob Moore) - Fix error code path in acpi_ds_call_control_method() (Rafael Wysocki) - Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() (Li Zetao) - Update the version of the ACPICA code in the kernel (Bob Moore) - Use ZERO_PAGE(0) instead of empty_zero_page in the ACPI device enumeration code (Giulio Benetti) - Change the return type of the ACPI driver remove callback to void and update its users accordingly (Dawei Li) - Add general support for FFH address space type and implement the low- level part of it for ARM64 (Sudeep Holla) - Fix stale comments in the ACPI tables parsing code and make it print more messages related to MADT (Hanjun Guo, Huacai Chen) - Replace invocations of generic library functions with more kernel- specific counterparts in the ACPI sysfs interface (Christophe JAILLET, Xu Panda) - Print full name paths of ACPI power resource objects during enumeration (Kane Chen) - Eliminate a compiler warning regarding a missing function prototype in the ACPI power management code (Sudeep Holla) - Fix and clean up the ACPI processor driver (Rafael Wysocki, Li Zhong, Colin Ian King, Sudeep Holla) - Add quirk for the HP Pavilion Gaming 15-cx0041ur to the ACPI EC driver (Mia Kanashi) - Add some mew ACPI backlight handling quirks and update some existing ones (Hans de Goede) - Make the ACPI backlight driver prefer the native backlight control over vendor backlight control when possible (Hans de Goede) - Drop unsetting ACPI APEI driver data on remove (Uwe Kleine-König) - Use xchg_release() instead of cmpxchg() for updating new GHES cache slots (Ard Biesheuvel) - Clean up the ACPI APEI code (Sudeep Holla, Christophe JAILLET, Jay Lu) - Add new I2C device enumeration quirks for Medion Lifetab S10346 and Lenovo Yoga Tab 3 Pro (YT3-X90F) (Hans de Goede) - Make the ACPI battery driver notify user space about adding new battery hooks and removing the existing ones (Armin Wolf) - Modify the pfr_update and pfr_telemetry drivers to use ACPI_FREE() for freeing acpi_object structures to help diagnostics (Wang ShaoBo) - Make the ACPI fan driver use sysfs_emit_at() in its sysfs interface code (ye xingchen) - Fix the _FIF package extraction failure handling in the ACPI fan driver (Hanjun Guo) - Fix the PCC mailbox handling error code path (Huisong Li) - Avoid using PCC Opregions if there is no platform interrupt allocated for this purpose (Huisong Li) - Use sysfs_emit() instead of scnprintf() in the ACPI PAD driver and CPPC library (ye xingchen) - Fix some kernel-doc issues in the ACPI GSI processing code (Xiongfeng Wang) - Fix name memory leak in pnp_alloc_dev() (Yang Yingliang) - Do not disable PNP devices on suspend when they cannot be re-enabled on resume (Hans de Goede) - Clean up the ACPI thermal driver a bit (Rafael Wysocki)" * tag 'acpi-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (67 commits) ACPI: x86: Add skip i2c clients quirk for Medion Lifetab S10346 ACPI: APEI: EINJ: Refactor available_error_type_show() ACPI: APEI: EINJ: Fix formatting errors ACPI: processor: perflib: Adjust acpi_processor_notify_smm() return value ACPI: processor: perflib: Rearrange acpi_processor_notify_smm() ACPI: processor: perflib: Rearrange unregistration routine ACPI: processor: perflib: Drop redundant parentheses ACPI: processor: perflib: Adjust white space ACPI: processor: idle: Drop unnecessary statements and parens ACPI: thermal: Adjust critical.flags.valid check ACPI: fan: Convert to use sysfs_emit_at() API ACPICA: Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() ACPI: battery: Call power_supply_changed() when adding hooks ACPI: use sysfs_emit() instead of scnprintf() ACPI: x86: Add skip i2c clients quirk for Lenovo Yoga Tab 3 Pro (YT3-X90F) ACPI: APEI: Remove a useless include PNP: Do not disable devices on suspend when they cannot be re-enabled on resume ACPI: processor: Silence missing prototype warnings ACPI: processor_idle: Silence missing prototype warnings ACPI: PM: Silence missing prototype warning ...
123 lines
2.6 KiB
C
123 lines
2.6 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Airplane mode button for AMD, HP & Xiaomi laptops
|
|
*
|
|
* Copyright (C) 2014-2017 Alex Hung <alex.hung@canonical.com>
|
|
* Copyright (C) 2021 Advanced Micro Devices
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/init.h>
|
|
#include <linux/input.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/acpi.h>
|
|
#include <acpi/acpi_bus.h>
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_AUTHOR("Alex Hung");
|
|
MODULE_ALIAS("acpi*:HPQ6001:*");
|
|
MODULE_ALIAS("acpi*:WSTADEF:*");
|
|
MODULE_ALIAS("acpi*:AMDI0051:*");
|
|
|
|
struct wl_button {
|
|
struct input_dev *input_dev;
|
|
char phys[32];
|
|
};
|
|
|
|
static const struct acpi_device_id wl_ids[] = {
|
|
{"HPQ6001", 0},
|
|
{"WSTADEF", 0},
|
|
{"AMDI0051", 0},
|
|
{"", 0},
|
|
};
|
|
|
|
static int wireless_input_setup(struct acpi_device *device)
|
|
{
|
|
struct wl_button *button = acpi_driver_data(device);
|
|
int err;
|
|
|
|
button->input_dev = input_allocate_device();
|
|
if (!button->input_dev)
|
|
return -ENOMEM;
|
|
|
|
snprintf(button->phys, sizeof(button->phys), "%s/input0", acpi_device_hid(device));
|
|
|
|
button->input_dev->name = "Wireless hotkeys";
|
|
button->input_dev->phys = button->phys;
|
|
button->input_dev->id.bustype = BUS_HOST;
|
|
button->input_dev->evbit[0] = BIT(EV_KEY);
|
|
set_bit(KEY_RFKILL, button->input_dev->keybit);
|
|
|
|
err = input_register_device(button->input_dev);
|
|
if (err)
|
|
goto err_free_dev;
|
|
|
|
return 0;
|
|
|
|
err_free_dev:
|
|
input_free_device(button->input_dev);
|
|
return err;
|
|
}
|
|
|
|
static void wireless_input_destroy(struct acpi_device *device)
|
|
{
|
|
struct wl_button *button = acpi_driver_data(device);
|
|
|
|
input_unregister_device(button->input_dev);
|
|
kfree(button);
|
|
}
|
|
|
|
static void wl_notify(struct acpi_device *acpi_dev, u32 event)
|
|
{
|
|
struct wl_button *button = acpi_driver_data(acpi_dev);
|
|
|
|
if (event != 0x80) {
|
|
pr_info("Received unknown event (0x%x)\n", event);
|
|
return;
|
|
}
|
|
|
|
input_report_key(button->input_dev, KEY_RFKILL, 1);
|
|
input_sync(button->input_dev);
|
|
input_report_key(button->input_dev, KEY_RFKILL, 0);
|
|
input_sync(button->input_dev);
|
|
}
|
|
|
|
static int wl_add(struct acpi_device *device)
|
|
{
|
|
struct wl_button *button;
|
|
int err;
|
|
|
|
button = kzalloc(sizeof(struct wl_button), GFP_KERNEL);
|
|
if (!button)
|
|
return -ENOMEM;
|
|
|
|
device->driver_data = button;
|
|
|
|
err = wireless_input_setup(device);
|
|
if (err) {
|
|
pr_err("Failed to setup wireless hotkeys\n");
|
|
kfree(button);
|
|
}
|
|
|
|
return err;
|
|
}
|
|
|
|
static void wl_remove(struct acpi_device *device)
|
|
{
|
|
wireless_input_destroy(device);
|
|
}
|
|
|
|
static struct acpi_driver wl_driver = {
|
|
.name = "wireless-hotkey",
|
|
.owner = THIS_MODULE,
|
|
.ids = wl_ids,
|
|
.ops = {
|
|
.add = wl_add,
|
|
.remove = wl_remove,
|
|
.notify = wl_notify,
|
|
},
|
|
};
|
|
|
|
module_acpi_driver(wl_driver);
|