Back merge pdx86 fixes into pdx86/for-next for further WMI work depending on some of the fixes. platform-drivers-x86 for v6.7-3 Highlights: - asus-wmi: Solve i8042 filter resource handling, input, and suspend issues - wmi: Skip zero instance WMI blocks to avoid issues with some laptops - mlxbf-bootctl: Differentiate dev/production keys - platform/surface: Correct serdev related return value to avoid leaking errno into userspace - Error checking fixes The following is an automated shortlog grouped by driver: asus-wmi: - Change q500a_i8042_filter() into a generic i8042-filter - disable USB0 hub on ROG Ally before suspend - Filter Volume key presses if also reported via atkbd - Move i8042 filter install to shared asus-wmi code mellanox: - Add null pointer checks for devm_kasprintf() - Check devm_hwmon_device_register_with_groups() return value mlxbf-bootctl: - correctly identify secure boot with development keys surface: aggregator: - fix recv_buf() return value
Unified · Split
| @@ -11025,7 +11025,6 @@ F: drivers/net/wireless/intel/iwlwifi/ · 11024 unmodified lines | ||
| 11025 | 11025 | |
| 11026 | 11026 | INTEL WMI SLIM BOOTLOADER (SBL) FIRMWARE UPDATE DRIVER |
| 11027 | 11027 | M: Jithu Joseph <jithu.joseph@intel.com> |
| 11028 | −R: Maurice Ma <maurice.ma@intel.com> | |
| 11029 | 11028 | S: Maintained |
| 11030 | 11029 | W: https://slimbootloader.github.io/security/firmware-update.html |
| 11031 | 11030 | F: drivers/platform/x86/intel/wmi/sbl-fw-update.c |
| @@ -13779,7 +13778,6 @@ F: drivers/net/ethernet/mellanox/mlxfw/ · 2747 unmodified lines | ||
| 13779 | 13778 | MELLANOX HARDWARE PLATFORM SUPPORT |
| 13780 | 13779 | M: Hans de Goede <hdegoede@redhat.com> |
| 13781 | 13780 | M: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> |
| 13782 | −M: Mark Gross <markgross@kernel.org> | |
| 13783 | 13781 | M: Vadim Pasternak <vadimp@nvidia.com> |
| 13784 | 13782 | L: platform-driver-x86@vger.kernel.org |
| 13785 | 13783 | S: Supported |
| @@ -14388,7 +14386,6 @@ F: drivers/platform/surface/surface_gpe.c · 602 unmodified lines | ||
| 14388 | 14386 | MICROSOFT SURFACE HARDWARE PLATFORM SUPPORT |
| 14389 | 14387 | M: Hans de Goede <hdegoede@redhat.com> |
| 14390 | 14388 | M: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> |
| 14391 | −M: Mark Gross <markgross@kernel.org> | |
| 14392 | 14389 | M: Maximilian Luz <luzmaximilian@gmail.com> |
| 14393 | 14390 | L: platform-driver-x86@vger.kernel.org |
| 14394 | 14391 | S: Maintained |
| @@ -23654,7 +23651,6 @@ F: drivers/platform/x86/x86-android-tablets/ · 9259 unmodified lines | ||
| 23654 | 23651 | X86 PLATFORM DRIVERS |
| 23655 | 23652 | M: Hans de Goede <hdegoede@redhat.com> |
| 23656 | 23653 | M: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> |
| 23657 | −M: Mark Gross <markgross@kernel.org> | |
| 23658 | 23654 | L: platform-driver-x86@vger.kernel.org |
| 23659 | 23655 | S: Maintained |
| 23660 | 23656 | Q: https://patchwork.kernel.org/project/platform-driver-x86/list/ |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | #define MLXBF_BOOTCTL_SB_SECURE_MASK 0x03 |
| 22 | 22 | #define MLXBF_BOOTCTL_SB_TEST_MASK 0x0c |
| 23 | +#define MLXBF_BOOTCTL_SB_DEV_MASK BIT(4) | |
| 23 | 24 | |
| 24 | 25 | #define MLXBF_SB_KEY_NUM 4 |
| 25 | 26 | |
| @@ -40,11 +41,18 @@ static struct mlxbf_bootctl_name boot_names[] = { · 14 unmodified lines | ||
| 40 | 41 | { MLXBF_BOOTCTL_NONE, "none" }, |
| 41 | 42 | }; |
| 42 | 43 | |
| 44 | +enum { | |
| 45 | + MLXBF_BOOTCTL_SB_LIFECYCLE_PRODUCTION = 0, | |
| 46 | + MLXBF_BOOTCTL_SB_LIFECYCLE_GA_SECURE = 1, | |
| 47 | + MLXBF_BOOTCTL_SB_LIFECYCLE_GA_NON_SECURE = 2, | |
| 48 | + MLXBF_BOOTCTL_SB_LIFECYCLE_RMA = 3 | |
| 49 | +}; | |
| 50 | + | |
| 43 | 51 | static const char * const mlxbf_bootctl_lifecycle_states[] = { |
| 44 | − [0] = "Production", | |
| 45 | − [1] = "GA Secured", | |
| 46 | − [2] = "GA Non-Secured", | |
| 47 | − [3] = "RMA", | |
| 52 | + [MLXBF_BOOTCTL_SB_LIFECYCLE_PRODUCTION] = "Production", | |
| 53 | + [MLXBF_BOOTCTL_SB_LIFECYCLE_GA_SECURE] = "GA Secured", | |
| 54 | + [MLXBF_BOOTCTL_SB_LIFECYCLE_GA_NON_SECURE] = "GA Non-Secured", | |
| 55 | + [MLXBF_BOOTCTL_SB_LIFECYCLE_RMA] = "RMA", | |
| 48 | 56 | }; |
| 49 | 57 | |
| 50 | 58 | /* Log header format. */ |
| @@ -247,25 +255,30 @@ static ssize_t second_reset_action_store(struct device *dev, · 196 unmodified lines | ||
| 247 | 255 | static ssize_t lifecycle_state_show(struct device *dev, |
| 248 | 256 | struct device_attribute *attr, char *buf) |
| 249 | 257 | { |
| 258 | + int status_bits; | |
| 259 | + int use_dev_key; | |
| 260 | + int test_state; | |
| 250 | 261 | int lc_state; |
| 251 | 262 | |
| 252 | − lc_state = mlxbf_bootctl_smc(MLXBF_BOOTCTL_GET_TBB_FUSE_STATUS, | |
| 253 | − MLXBF_BOOTCTL_FUSE_STATUS_LIFECYCLE); | |
| 254 | − if (lc_state < 0) | |
| 255 | − return lc_state; | |
| 263 | + status_bits = mlxbf_bootctl_smc(MLXBF_BOOTCTL_GET_TBB_FUSE_STATUS, | |
| 264 | + MLXBF_BOOTCTL_FUSE_STATUS_LIFECYCLE); | |
| 265 | + if (status_bits < 0) | |
| 266 | + return status_bits; | |
| 256 | 267 | |
| 257 | − lc_state &= | |
| 258 | − MLXBF_BOOTCTL_SB_TEST_MASK | MLXBF_BOOTCTL_SB_SECURE_MASK; | |
| 268 | + use_dev_key = status_bits & MLXBF_BOOTCTL_SB_DEV_MASK; | |
| 269 | + test_state = status_bits & MLXBF_BOOTCTL_SB_TEST_MASK; | |
| 270 | + lc_state = status_bits & MLXBF_BOOTCTL_SB_SECURE_MASK; | |
| 259 | 271 | |
| 260 | 272 | /* |
| 261 | 273 | * If the test bits are set, we specify that the current state may be |
| 262 | 274 | * due to using the test bits. |
| 263 | 275 | */ |
| 264 | − if (lc_state & MLXBF_BOOTCTL_SB_TEST_MASK) { | |
| 265 | − lc_state &= MLXBF_BOOTCTL_SB_SECURE_MASK; | |
| 266 | − | |
| 276 | + if (test_state) { | |
| 267 | 277 | return sprintf(buf, "%s(test)\n", |
| 268 | 278 | mlxbf_bootctl_lifecycle_states[lc_state]); |
| 279 | + } else if (use_dev_key && | |
| 280 | + (lc_state == MLXBF_BOOTCTL_SB_LIFECYCLE_GA_SECURE)) { | |
| 281 | + return sprintf(buf, "Secured (development)\n"); | |
| 269 | 282 | } |
| 270 | 283 | |
| 271 | 284 | return sprintf(buf, "%s\n", mlxbf_bootctl_lifecycle_states[lc_state]); |
| @@ -1771,6 +1771,8 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, int blk_num) · 1770 unmodified lines | ||
| 1771 | 1771 | attr->dev_attr.show = mlxbf_pmc_event_list_show; |
| 1772 | 1772 | attr->nr = blk_num; |
| 1773 | 1773 | attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, "event_list"); |
| 1774 | + if (!attr->dev_attr.attr.name) | |
| 1775 | + return -ENOMEM; | |
| 1774 | 1776 | pmc->block[blk_num].block_attr[i] = &attr->dev_attr.attr; |
| 1775 | 1777 | attr = NULL; |
| 1776 | 1778 | |
| @@ -1784,6 +1786,8 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, int blk_num) · 7 unmodified lines | ||
| 1784 | 1786 | attr->nr = blk_num; |
| 1785 | 1787 | attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, |
| 1786 | 1788 | "enable"); |
| 1789 | + if (!attr->dev_attr.attr.name) | |
| 1790 | + return -ENOMEM; | |
| 1787 | 1791 | pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr; |
| 1788 | 1792 | attr = NULL; |
| 1789 | 1793 | } |
| @@ -1810,6 +1814,8 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, int blk_num) · 20 unmodified lines | ||
| 1810 | 1814 | attr->nr = blk_num; |
| 1811 | 1815 | attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, |
| 1812 | 1816 | "counter%d", j); |
| 1817 | + if (!attr->dev_attr.attr.name) | |
| 1818 | + return -ENOMEM; | |
| 1813 | 1819 | pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr; |
| 1814 | 1820 | attr = NULL; |
| 1815 | 1821 | |
| @@ -1821,6 +1827,8 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, int blk_num) · 5 unmodified lines | ||
| 1821 | 1827 | attr->nr = blk_num; |
| 1822 | 1828 | attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, |
| 1823 | 1829 | "event%d", j); |
| 1830 | + if (!attr->dev_attr.attr.name) | |
| 1831 | + return -ENOMEM; | |
| 1824 | 1832 | pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr; |
| 1825 | 1833 | attr = NULL; |
| 1826 | 1834 | } |
| @@ -1853,6 +1861,8 @@ static int mlxbf_pmc_init_perftype_reg(struct device *dev, int blk_num) · 26 unmodified lines | ||
| 1853 | 1861 | attr->nr = blk_num; |
| 1854 | 1862 | attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, |
| 1855 | 1863 | events[j].evt_name); |
| 1864 | + if (!attr->dev_attr.attr.name) | |
| 1865 | + return -ENOMEM; | |
| 1856 | 1866 | pmc->block[blk_num].block_attr[i] = &attr->dev_attr.attr; |
| 1857 | 1867 | attr = NULL; |
| 1858 | 1868 | i++; |
| @@ -1882,6 +1892,8 @@ static int mlxbf_pmc_create_groups(struct device *dev, int blk_num) · 23 unmodified lines | ||
| 1882 | 1892 | pmc->block[blk_num].block_attr_grp.attrs = pmc->block[blk_num].block_attr; |
| 1883 | 1893 | pmc->block[blk_num].block_attr_grp.name = devm_kasprintf( |
| 1884 | 1894 | dev, GFP_KERNEL, pmc->block_name[blk_num]); |
| 1895 | + if (!pmc->block[blk_num].block_attr_grp.name) | |
| 1896 | + return -ENOMEM; | |
| 1885 | 1897 | pmc->groups[pmc->group_num] = &pmc->block[blk_num].block_attr_grp; |
| 1886 | 1898 | pmc->group_num++; |
| 1887 | 1899 | |
| @@ -2063,6 +2075,8 @@ static int mlxbf_pmc_probe(struct platform_device *pdev) · 175 unmodified lines | ||
| 2063 | 2075 | |
| 2064 | 2076 | pmc->hwmon_dev = devm_hwmon_device_register_with_groups( |
| 2065 | 2077 | dev, "bfperf", pmc, pmc->groups); |
| 2078 | + if (IS_ERR(pmc->hwmon_dev)) | |
| 2079 | + return PTR_ERR(pmc->hwmon_dev); | |
| 2066 | 2080 | platform_set_drvdata(pdev, pmc); |
| 2067 | 2081 | |
| 2068 | 2082 | return 0; |
| @@ -231,9 +231,12 @@ static int ssam_receive_buf(struct serdev_device *dev, const unsigned char *buf, · 230 unmodified lines | ||
| 231 | 231 | size_t n) |
| 232 | 232 | { |
| 233 | 233 | struct ssam_controller *ctrl; |
| 234 | + int ret; | |
| 234 | 235 | |
| 235 | 236 | ctrl = serdev_device_get_drvdata(dev); |
| 236 | − return ssam_controller_receive_buf(ctrl, buf, n); | |
| 237 | + ret = ssam_controller_receive_buf(ctrl, buf, n); | |
| 238 | + | |
| 239 | + return ret < 0 ? 0 : ret; | |
| 237 | 240 | } |
| 238 | 241 | |
| 239 | 242 | static void ssam_write_wakeup(struct serdev_device *dev) |
| @@ -265,6 +265,7 @@ config ASUS_WMI · 264 unmodified lines | ||
| 265 | 265 | depends on RFKILL || RFKILL = n |
| 266 | 266 | depends on HOTPLUG_PCI |
| 267 | 267 | depends on ACPI_VIDEO || ACPI_VIDEO = n |
| 268 | + depends on SERIO_I8042 || SERIO_I8042 = n | |
| 268 | 269 | select INPUT_SPARSEKMAP |
| 269 | 270 | select LEDS_CLASS |
| 270 | 271 | select NEW_LEDS |
| @@ -281,7 +282,6 @@ config ASUS_WMI · 10 unmodified lines | ||
| 281 | 282 | config ASUS_NB_WMI |
| 282 | 283 | tristate "Asus Notebook WMI Driver" |
| 283 | 284 | depends on ASUS_WMI |
| 284 | − depends on SERIO_I8042 || SERIO_I8042 = n | |
| 285 | 285 | help |
| 286 | 286 | This is a driver for newer Asus notebooks. It adds extra features |
| 287 | 287 | like wireless radio and bluetooth control, leds, hotkeys, backlight... |
| @@ -964,33 +964,6 @@ static const struct pci_device_id pmc_pci_ids[] = { · 963 unmodified lines | ||
| 964 | 964 | { } |
| 965 | 965 | }; |
| 966 | 966 | |
| 967 | −static int amd_pmc_get_dram_size(struct amd_pmc_dev *dev) | |
| 968 | −{ | |
| 969 | − int ret; | |
| 970 | − | |
| 971 | − switch (dev->cpu_id) { | |
| 972 | − case AMD_CPU_ID_YC: | |
| 973 | − if (!(dev->major > 90 || (dev->major == 90 && dev->minor > 39))) { | |
| 974 | − ret = -EINVAL; | |
| 975 | − goto err_dram_size; | |
| 976 | − } | |
| 977 | − break; | |
| 978 | − default: | |
| 979 | − ret = -EINVAL; | |
| 980 | − goto err_dram_size; | |
| 981 | − } | |
| 982 | − | |
| 983 | − ret = amd_pmc_send_cmd(dev, S2D_DRAM_SIZE, &dev->dram_size, dev->s2d_msg_id, true); | |
| 984 | − if (ret || !dev->dram_size) | |
| 985 | − goto err_dram_size; | |
| 986 | − | |
| 987 | − return 0; | |
| 988 | − | |
| 989 | −err_dram_size: | |
| 990 | − dev_err(dev->dev, "DRAM size command not supported for this platform\n"); | |
| 991 | − return ret; | |
| 992 | −} | |
| 993 | − | |
| 994 | 967 | static int amd_pmc_s2d_init(struct amd_pmc_dev *dev) |
| 995 | 968 | { |
| 996 | 969 | u32 phys_addr_low, phys_addr_hi; |
| @@ -1009,8 +982,8 @@ static int amd_pmc_s2d_init(struct amd_pmc_dev *dev) · 12 unmodified lines | ||
| 1009 | 982 | return -EIO; |
| 1010 | 983 | |
| 1011 | 984 | /* Get DRAM size */ |
| 1012 | − ret = amd_pmc_get_dram_size(dev); | |
| 1013 | − if (ret) | |
| 985 | + ret = amd_pmc_send_cmd(dev, S2D_DRAM_SIZE, &dev->dram_size, dev->s2d_msg_id, true); | |
| 986 | + if (ret || !dev->dram_size) | |
| 1014 | 987 | dev->dram_size = S2D_TELEMETRY_DRAMBYTES_MAX; |
| 1015 | 988 | |
| 1016 | 989 | /* Get STB DRAM address */ |
| @@ -48,25 +48,43 @@ module_param(tablet_mode_sw, uint, 0444); · 47 unmodified lines | ||
| 48 | 48 | MODULE_PARM_DESC(tablet_mode_sw, "Tablet mode detect: -1:auto 0:disable 1:kbd-dock 2:lid-flip 3:lid-flip-rog"); |
| 49 | 49 | |
| 50 | 50 | static struct quirk_entry *quirks; |
| 51 | +static bool atkbd_reports_vol_keys; | |
| 51 | 52 | |
| 52 | −static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str, | |
| 53 | − struct serio *port) | |
| 53 | +static bool asus_i8042_filter(unsigned char data, unsigned char str, struct serio *port) | |
| 54 | 54 | { |
| 55 | − static bool extended; | |
| 56 | − bool ret = false; | |
| 55 | + static bool extended_e0; | |
| 56 | + static bool extended_e1; | |
| 57 | 57 | |
| 58 | 58 | if (str & I8042_STR_AUXDATA) |
| 59 | 59 | return false; |
| 60 | 60 | |
| 61 | − if (unlikely(data == 0xe1)) { | |
| 62 | − extended = true; | |
| 63 | − ret = true; | |
| 64 | − } else if (unlikely(extended)) { | |
| 65 | − extended = false; | |
| 66 | − ret = true; | |
| 61 | + if (quirks->filter_i8042_e1_extended_codes) { | |
| 62 | + if (data == 0xe1) { | |
| 63 | + extended_e1 = true; | |
| 64 | + return true; | |
| 65 | + } | |
| 66 | + | |
| 67 | + if (extended_e1) { | |
| 68 | + extended_e1 = false; | |
| 69 | + return true; | |
| 70 | + } | |
| 67 | 71 | } |
| 68 | 72 | |
| 69 | − return ret; | |
| 73 | + if (data == 0xe0) { | |
| 74 | + extended_e0 = true; | |
| 75 | + } else if (extended_e0) { | |
| 76 | + extended_e0 = false; | |
| 77 | + | |
| 78 | + switch (data & 0x7f) { | |
| 79 | + case 0x20: /* e0 20 / e0 a0, Volume Mute press / release */ | |
| 80 | + case 0x2e: /* e0 2e / e0 ae, Volume Down press / release */ | |
| 81 | + case 0x30: /* e0 30 / e0 b0, Volume Up press / release */ | |
| 82 | + atkbd_reports_vol_keys = true; | |
| 83 | + break; | |
| 84 | + } | |
| 85 | + } | |
| 86 | + | |
| 87 | + return false; | |
| 70 | 88 | } |
| 71 | 89 | |
| 72 | 90 | static struct quirk_entry quirk_asus_unknown = { |
| @@ -75,7 +93,7 @@ static struct quirk_entry quirk_asus_unknown = { · 2 unmodified lines | ||
| 75 | 93 | }; |
| 76 | 94 | |
| 77 | 95 | static struct quirk_entry quirk_asus_q500a = { |
| 78 | − .i8042_filter = asus_q500a_i8042_filter, | |
| 96 | + .filter_i8042_e1_extended_codes = true, | |
| 79 | 97 | .wmi_backlight_set_devstate = true, |
| 80 | 98 | }; |
| 81 | 99 | |
| @@ -503,8 +521,6 @@ static const struct dmi_system_id asus_quirks[] = { · 421 unmodified lines | ||
| 503 | 521 | |
| 504 | 522 | static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver) |
| 505 | 523 | { |
| 506 | − int ret; | |
| 507 | − | |
| 508 | 524 | quirks = &quirk_asus_unknown; |
| 509 | 525 | dmi_check_system(asus_quirks); |
| 510 | 526 | |
| @@ -519,15 +535,6 @@ static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver) · 8 unmodified lines | ||
| 519 | 535 | |
| 520 | 536 | if (tablet_mode_sw != -1) |
| 521 | 537 | quirks->tablet_switch_mode = tablet_mode_sw; |
| 522 | − | |
| 523 | − if (quirks->i8042_filter) { | |
| 524 | − ret = i8042_install_filter(quirks->i8042_filter); | |
| 525 | − if (ret) { | |
| 526 | − pr_warn("Unable to install key filter\n"); | |
| 527 | − return; | |
| 528 | − } | |
| 529 | − pr_info("Using i8042 filter function for receiving events\n"); | |
| 530 | − } | |
| 531 | 538 | } |
| 532 | 539 | |
| 533 | 540 | static const struct key_entry asus_nb_wmi_keymap[] = { |
| @@ -617,6 +624,13 @@ static void asus_nb_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code, · 83 unmodified lines | ||
| 617 | 624 | if (acpi_video_handles_brightness_key_presses()) |
| 618 | 625 | *code = ASUS_WMI_KEY_IGNORE; |
| 619 | 626 | |
| 627 | + break; | |
| 628 | + case 0x30: /* Volume Up */ | |
| 629 | + case 0x31: /* Volume Down */ | |
| 630 | + case 0x32: /* Volume Mute */ | |
| 631 | + if (atkbd_reports_vol_keys) | |
| 632 | + *code = ASUS_WMI_KEY_IGNORE; | |
| 633 | + | |
| 620 | 634 | break; |
| 621 | 635 | } |
| 622 | 636 | } |
| @@ -630,6 +644,7 @@ static struct asus_wmi_driver asus_nb_wmi_driver = { · 7 unmodified lines | ||
| 630 | 644 | .input_phys = ASUS_NB_WMI_FILE "/input0", |
| 631 | 645 | .detect_quirks = asus_nb_wmi_quirks, |
| 632 | 646 | .key_filter = asus_nb_wmi_key_filter, |
| 647 | + .i8042_filter = asus_i8042_filter, | |
| 633 | 648 | }; |
| 634 | 649 | |
| 635 | 650 | |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | ||
| 16 | 16 | #include <linux/acpi.h> |
| 17 | 17 | #include <linux/backlight.h> |
| 18 | 18 | #include <linux/debugfs.h> |
| 19 | +#include <linux/delay.h> | |
| 19 | 20 | #include <linux/dmi.h> |
| 20 | 21 | #include <linux/fb.h> |
| 21 | 22 | #include <linux/hwmon.h> |
| @@ -132,6 +133,11 @@ module_param(fnlock_default, bool, 0444); · 110 unmodified lines | ||
| 132 | 133 | #define ASUS_SCREENPAD_BRIGHT_MAX 255 |
| 133 | 134 | #define ASUS_SCREENPAD_BRIGHT_DEFAULT 60 |
| 134 | 135 | |
| 136 | +/* Controls the power state of the USB0 hub on ROG Ally which input is on */ | |
| 137 | +#define ASUS_USB0_PWR_EC0_CSEE "\\_SB.PCI0.SBRG.EC0.CSEE" | |
| 138 | +/* 300ms so far seems to produce a reliable result on AC and battery */ | |
| 139 | +#define ASUS_USB0_PWR_EC0_CSEE_WAIT 300 | |
| 140 | + | |
| 135 | 141 | static const char * const ashs_ids[] = { "ATK4001", "ATK4002", NULL }; |
| 136 | 142 | |
| 137 | 143 | static int throttle_thermal_policy_write(struct asus_wmi *); |
| @@ -300,6 +306,9 @@ struct asus_wmi { · 162 unmodified lines | ||
| 300 | 306 | |
| 301 | 307 | bool fnlock_locked; |
| 302 | 308 | |
| 309 | + /* The ROG Ally device requires the MCU USB device be disconnected before suspend */ | |
| 310 | + bool ally_mcu_usb_switch; | |
| 311 | + | |
| 303 | 312 | struct asus_wmi_debug debug; |
| 304 | 313 | |
| 305 | 314 | struct asus_wmi_driver *driver; |
| @@ -4488,6 +4497,8 @@ static int asus_wmi_add(struct platform_device *pdev) · 4182 unmodified lines | ||
| 4488 | 4497 | asus->nv_temp_tgt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_NV_THERM_TARGET); |
| 4489 | 4498 | asus->panel_overdrive_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD); |
| 4490 | 4499 | asus->mini_led_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE); |
| 4500 | + asus->ally_mcu_usb_switch = acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE) | |
| 4501 | + && dmi_match(DMI_BOARD_NAME, "RC71L"); | |
| 4491 | 4502 | |
| 4492 | 4503 | err = fan_boost_mode_check_present(asus); |
| 4493 | 4504 | if (err) |
| @@ -4567,6 +4578,12 @@ static int asus_wmi_add(struct platform_device *pdev) · 73 unmodified lines | ||
| 4567 | 4578 | goto fail_wmi_handler; |
| 4568 | 4579 | } |
| 4569 | 4580 | |
| 4581 | + if (asus->driver->i8042_filter) { | |
| 4582 | + err = i8042_install_filter(asus->driver->i8042_filter); | |
| 4583 | + if (err) | |
| 4584 | + pr_warn("Unable to install key filter - %d\n", err); | |
| 4585 | + } | |
| 4586 | + | |
| 4570 | 4587 | asus_wmi_battery_init(asus); |
| 4571 | 4588 | |
| 4572 | 4589 | asus_wmi_debugfs_init(asus); |
| @@ -4603,6 +4620,8 @@ static void asus_wmi_remove(struct platform_device *device) · 30 unmodified lines | ||
| 4603 | 4620 | struct asus_wmi *asus; |
| 4604 | 4621 | |
| 4605 | 4622 | asus = platform_get_drvdata(device); |
| 4623 | + if (asus->driver->i8042_filter) | |
| 4624 | + i8042_remove_filter(asus->driver->i8042_filter); | |
| 4606 | 4625 | wmi_remove_notify_handler(asus->driver->event_guid); |
| 4607 | 4626 | asus_wmi_backlight_exit(asus); |
| 4608 | 4627 | asus_screenpad_exit(asus); |
| @@ -4653,6 +4672,43 @@ static int asus_hotk_resume(struct device *device) · 44 unmodified lines | ||
| 4653 | 4672 | asus_wmi_fnlock_update(asus); |
| 4654 | 4673 | |
| 4655 | 4674 | asus_wmi_tablet_mode_get_state(asus); |
| 4675 | + | |
| 4676 | + return 0; | |
| 4677 | +} | |
| 4678 | + | |
| 4679 | +static int asus_hotk_resume_early(struct device *device) | |
| 4680 | +{ | |
| 4681 | + struct asus_wmi *asus = dev_get_drvdata(device); | |
| 4682 | + | |
| 4683 | + if (asus->ally_mcu_usb_switch) { | |
| 4684 | + if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB8))) | |
| 4685 | + dev_err(device, "ROG Ally MCU failed to connect USB dev\n"); | |
| 4686 | + else | |
| 4687 | + msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); | |
| 4688 | + } | |
| 4689 | + return 0; | |
| 4690 | +} | |
| 4691 | + | |
| 4692 | +static int asus_hotk_prepare(struct device *device) | |
| 4693 | +{ | |
| 4694 | + struct asus_wmi *asus = dev_get_drvdata(device); | |
| 4695 | + int result, err; | |
| 4696 | + | |
| 4697 | + if (asus->ally_mcu_usb_switch) { | |
| 4698 | + /* When powersave is enabled it causes many issues with resume of USB hub */ | |
| 4699 | + result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_MCU_POWERSAVE); | |
| 4700 | + if (result == 1) { | |
| 4701 | + dev_warn(device, "MCU powersave enabled, disabling to prevent resume issues"); | |
| 4702 | + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_MCU_POWERSAVE, 0, &result); | |
| 4703 | + if (err || result != 1) | |
| 4704 | + dev_err(device, "Failed to set MCU powersave mode: %d\n", err); | |
| 4705 | + } | |
| 4706 | + /* sleep required to ensure USB0 is disabled before sleep continues */ | |
| 4707 | + if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB7))) | |
| 4708 | + dev_err(device, "ROG Ally MCU failed to disconnect USB dev\n"); | |
| 4709 | + else | |
| 4710 | + msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT); | |
| 4711 | + } | |
| 4656 | 4712 | return 0; |
| 4657 | 4713 | } |
| 4658 | 4714 | |
| @@ -4700,6 +4756,8 @@ static const struct dev_pm_ops asus_pm_ops = { · 41 unmodified lines | ||
| 4700 | 4756 | .thaw = asus_hotk_thaw, |
| 4701 | 4757 | .restore = asus_hotk_restore, |
| 4702 | 4758 | .resume = asus_hotk_resume, |
| 4759 | + .resume_early = asus_hotk_resume_early, | |
| 4760 | + .prepare = asus_hotk_prepare, | |
| 4703 | 4761 | }; |
| 4704 | 4762 | |
| 4705 | 4763 | /* Registration ***************************************************************/ |
| @@ -39,6 +39,7 @@ struct quirk_entry { · 38 unmodified lines | ||
| 39 | 39 | bool wmi_backlight_set_devstate; |
| 40 | 40 | bool wmi_force_als_set; |
| 41 | 41 | bool wmi_ignore_fan; |
| 42 | + bool filter_i8042_e1_extended_codes; | |
| 42 | 43 | enum asus_wmi_tablet_switch_mode tablet_switch_mode; |
| 43 | 44 | int wapf; |
| 44 | 45 | /* |
| @@ -49,9 +50,6 @@ struct quirk_entry { · 4 unmodified lines | ||
| 49 | 50 | */ |
| 50 | 51 | int no_display_toggle; |
| 51 | 52 | u32 xusb2pr; |
| 52 | − | |
| 53 | − bool (*i8042_filter)(unsigned char data, unsigned char str, | |
| 54 | − struct serio *serio); | |
| 55 | 53 | }; |
| 56 | 54 | |
| 57 | 55 | struct asus_wmi_driver { |
| @@ -73,6 +71,9 @@ struct asus_wmi_driver { · 15 unmodified lines | ||
| 73 | 71 | * Return ASUS_WMI_KEY_IGNORE in code if event should be ignored. */ |
| 74 | 72 | void (*key_filter) (struct asus_wmi_driver *driver, int *code, |
| 75 | 73 | unsigned int *value, bool *autorelease); |
| 74 | + /* Optional standard i8042 filter */ | |
| 75 | + bool (*i8042_filter)(unsigned char data, unsigned char str, | |
| 76 | + struct serio *serio); | |
| 76 | 77 | |
| 77 | 78 | int (*probe) (struct platform_device *device); |
| 78 | 79 | void (*detect_quirks) (struct asus_wmi_driver *driver); |
| @@ -588,17 +588,14 @@ static void release_attributes_data(void) · 587 unmodified lines | ||
| 588 | 588 | static int hp_add_other_attributes(int attr_type) |
| 589 | 589 | { |
| 590 | 590 | struct kobject *attr_name_kobj; |
| 591 | − union acpi_object *obj = NULL; | |
| 592 | 591 | int ret; |
| 593 | 592 | char *attr_name; |
| 594 | 593 | |
| 595 | − mutex_lock(&bioscfg_drv.mutex); | |
| 596 | − | |
| 597 | 594 | attr_name_kobj = kzalloc(sizeof(*attr_name_kobj), GFP_KERNEL); |
| 598 | − if (!attr_name_kobj) { | |
| 599 | − ret = -ENOMEM; | |
| 600 | − goto err_other_attr_init; | |
| 601 | − } | |
| 595 | + if (!attr_name_kobj) | |
| 596 | + return -ENOMEM; | |
| 597 | + | |
| 598 | + mutex_lock(&bioscfg_drv.mutex); | |
| 602 | 599 | |
| 603 | 600 | /* Check if attribute type is supported */ |
| 604 | 601 | switch (attr_type) { |
| @@ -615,14 +612,14 @@ static int hp_add_other_attributes(int attr_type) · 10 unmodified lines | ||
| 615 | 612 | default: |
| 616 | 613 | pr_err("Error: Unknown attr_type: %d\n", attr_type); |
| 617 | 614 | ret = -EINVAL; |
| 618 | − goto err_other_attr_init; | |
| 615 | + kfree(attr_name_kobj); | |
| 616 | + goto unlock_drv_mutex; | |
| 619 | 617 | } |
| 620 | 618 | |
| 621 | 619 | ret = kobject_init_and_add(attr_name_kobj, &attr_name_ktype, |
| 622 | 620 | NULL, "%s", attr_name); |
| 623 | 621 | if (ret) { |
| 624 | 622 | pr_err("Error encountered [%d]\n", ret); |
| 625 | − kobject_put(attr_name_kobj); | |
| 626 | 623 | goto err_other_attr_init; |
| 627 | 624 | } |
| 628 | 625 | |
| @@ -630,27 +627,26 @@ static int hp_add_other_attributes(int attr_type) · 1 unmodified line | ||
| 630 | 627 | switch (attr_type) { |
| 631 | 628 | case HPWMI_SECURE_PLATFORM_TYPE: |
| 632 | 629 | ret = hp_populate_secure_platform_data(attr_name_kobj); |
| 633 | − if (ret) | |
| 634 | − goto err_other_attr_init; | |
| 635 | 630 | break; |
| 636 | 631 | |
| 637 | 632 | case HPWMI_SURE_START_TYPE: |
| 638 | 633 | ret = hp_populate_sure_start_data(attr_name_kobj); |
| 639 | − if (ret) | |
| 640 | − goto err_other_attr_init; | |
| 641 | 634 | break; |
| 642 | 635 | |
| 643 | 636 | default: |
| 644 | 637 | ret = -EINVAL; |
| 645 | − goto err_other_attr_init; | |
| 646 | 638 | } |
| 647 | 639 | |
| 640 | + if (ret) | |
| 641 | + goto err_other_attr_init; | |
| 642 | + | |
| 648 | 643 | mutex_unlock(&bioscfg_drv.mutex); |
| 649 | 644 | return 0; |
| 650 | 645 | |
| 651 | 646 | err_other_attr_init: |
| 647 | + kobject_put(attr_name_kobj); | |
| 648 | +unlock_drv_mutex: | |
| 652 | 649 | mutex_unlock(&bioscfg_drv.mutex); |
| 653 | − kfree(obj); | |
| 654 | 650 | return ret; |
| 655 | 651 | } |
| 656 | 652 | |
| @@ -1425,18 +1425,17 @@ static int ideapad_kbd_bl_init(struct ideapad_private *priv) · 1424 unmodified lines | ||
| 1425 | 1425 | if (WARN_ON(priv->kbd_bl.initialized)) |
| 1426 | 1426 | return -EEXIST; |
| 1427 | 1427 | |
| 1428 | − brightness = ideapad_kbd_bl_brightness_get(priv); | |
| 1429 | − if (brightness < 0) | |
| 1430 | − return brightness; | |
| 1431 | − | |
| 1432 | − priv->kbd_bl.last_brightness = brightness; | |
| 1433 | − | |
| 1434 | 1428 | if (ideapad_kbd_bl_check_tristate(priv->kbd_bl.type)) { |
| 1435 | 1429 | priv->kbd_bl.led.max_brightness = 2; |
| 1436 | 1430 | } else { |
| 1437 | 1431 | priv->kbd_bl.led.max_brightness = 1; |
| 1438 | 1432 | } |
| 1439 | 1433 | |
| 1434 | + brightness = ideapad_kbd_bl_brightness_get(priv); | |
| 1435 | + if (brightness < 0) | |
| 1436 | + return brightness; | |
| 1437 | + | |
| 1438 | + priv->kbd_bl.last_brightness = brightness; | |
| 1440 | 1439 | priv->kbd_bl.led.name = "platform::" LED_FUNCTION_KBD_BACKLIGHT; |
| 1441 | 1440 | priv->kbd_bl.led.brightness_get = ideapad_kbd_bl_led_cdev_brightness_get; |
| 1442 | 1441 | priv->kbd_bl.led.brightness_set_blocking = ideapad_kbd_bl_led_cdev_brightness_set; |
| @@ -102,7 +102,7 @@ static const struct telemetry_core_ops telm_defpltops = { · 101 unmodified lines | ||
| 102 | 102 | /** |
| 103 | 103 | * telemetry_update_events() - Update telemetry Configuration |
| 104 | 104 | * @pss_evtconfig: PSS related config. No change if num_evts = 0. |
| 105 | − * @pss_evtconfig: IOSS related config. No change if num_evts = 0. | |
| 105 | + * @ioss_evtconfig: IOSS related config. No change if num_evts = 0. | |
| 106 | 106 | * |
| 107 | 107 | * This API updates the IOSS & PSS Telemetry configuration. Old config |
| 108 | 108 | * is overwritten. Call telemetry_reset_events when logging is over |
| @@ -176,7 +176,7 @@ EXPORT_SYMBOL_GPL(telemetry_reset_events); · 67 unmodified lines | ||
| 176 | 176 | /** |
| 177 | 177 | * telemetry_get_eventconfig() - Returns the pss and ioss events enabled |
| 178 | 178 | * @pss_evtconfig: Pointer to PSS related configuration. |
| 179 | − * @pss_evtconfig: Pointer to IOSS related configuration. | |
| 179 | + * @ioss_evtconfig: Pointer to IOSS related configuration. | |
| 180 | 180 | * @pss_len: Number of u32 elements allocated for pss_evtconfig array |
| 181 | 181 | * @ioss_len: Number of u32 elements allocated for ioss_evtconfig array |
| 182 | 182 | * |
| @@ -1346,6 +1346,11 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) · 1345 unmodified lines | ||
| 1346 | 1346 | if (debug_dump_wdg) |
| 1347 | 1347 | wmi_dump_wdg(&gblock[i]); |
| 1348 | 1348 | |
| 1349 | + if (!gblock[i].instance_count) { | |
| 1350 | + dev_info(wmi_bus_dev, FW_INFO "%pUL has zero instances\n", &gblock[i].guid); | |
| 1351 | + continue; | |
| 1352 | + } | |
| 1353 | + | |
| 1349 | 1354 | if (guid_already_parsed_for_legacy(device, &gblock[i].guid)) |
| 1350 | 1355 | continue; |
| 1351 | 1356 | |
| @@ -114,6 +114,9 @@ · 113 unmodified lines | ||
| 114 | 114 | /* Charging mode - 1=Barrel, 2=USB */ |
| 115 | 115 | #define ASUS_WMI_DEVID_CHARGE_MODE 0x0012006C |
| 116 | 116 | |
| 117 | +/* MCU powersave mode */ | |
| 118 | +#define ASUS_WMI_DEVID_MCU_POWERSAVE 0x001200E2 | |
| 119 | + | |
| 117 | 120 | /* epu is connected? 1 == true */ |
| 118 | 121 | #define ASUS_WMI_DEVID_EGPU_CONNECTED 0x00090018 |
| 119 | 122 | /* egpu on/off */ |