Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'platform-drivers-x86-v6.11-7' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver fixes from Ilpo Järvinen:

- asus-wmi: Disable OOBE that interferes with backlight control

- panasonic-laptop: Two fixes to SINF array handling

* tag 'platform-drivers-x86-v6.11-7' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
platform/x86: asus-wmi: Disable OOBE experience on Zenbook S 16
platform/x86: panasonic-laptop: Allocate 1 entry extra in the sinf array
platform/x86: panasonic-laptop: Fix SINF array out of bounds accesses

+58 -11
+10
drivers/platform/x86/asus-wmi.c
··· 1793 1793 goto error; 1794 1794 } 1795 1795 1796 + if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_OOBE)) { 1797 + /* 1798 + * Disable OOBE state, so that e.g. the keyboard backlight 1799 + * works. 1800 + */ 1801 + rv = asus_wmi_set_devstate(ASUS_WMI_DEVID_OOBE, 1, NULL); 1802 + if (rv) 1803 + goto error; 1804 + } 1805 + 1796 1806 error: 1797 1807 if (rv) 1798 1808 asus_wmi_led_exit(asus);
+47 -11
drivers/platform/x86/panasonic-laptop.c
··· 337 337 } 338 338 339 339 if (pcc->num_sifr < hkey->package.count) { 340 - pr_err("SQTY reports bad SINF length\n"); 340 + pr_err("SQTY reports bad SINF length SQTY: %lu SINF-pkg-count: %u\n", 341 + pcc->num_sifr, hkey->package.count); 341 342 status = AE_ERROR; 342 343 goto end; 343 344 } ··· 774 773 static DEVICE_ATTR_RW(current_brightness); 775 774 static DEVICE_ATTR_RW(cdpower); 776 775 776 + static umode_t pcc_sysfs_is_visible(struct kobject *kobj, struct attribute *attr, int idx) 777 + { 778 + struct device *dev = kobj_to_dev(kobj); 779 + struct acpi_device *acpi = to_acpi_device(dev); 780 + struct pcc_acpi *pcc = acpi_driver_data(acpi); 781 + 782 + if (attr == &dev_attr_mute.attr) 783 + return (pcc->num_sifr > SINF_MUTE) ? attr->mode : 0; 784 + 785 + if (attr == &dev_attr_eco_mode.attr) 786 + return (pcc->num_sifr > SINF_ECO_MODE) ? attr->mode : 0; 787 + 788 + if (attr == &dev_attr_current_brightness.attr) 789 + return (pcc->num_sifr > SINF_CUR_BRIGHT) ? attr->mode : 0; 790 + 791 + return attr->mode; 792 + } 793 + 777 794 static struct attribute *pcc_sysfs_entries[] = { 778 795 &dev_attr_numbatt.attr, 779 796 &dev_attr_lcdtype.attr, ··· 806 787 }; 807 788 808 789 static const struct attribute_group pcc_attr_group = { 809 - .name = NULL, /* put in device directory */ 810 - .attrs = pcc_sysfs_entries, 790 + .name = NULL, /* put in device directory */ 791 + .attrs = pcc_sysfs_entries, 792 + .is_visible = pcc_sysfs_is_visible, 811 793 }; 812 794 813 795 ··· 961 941 if (!pcc) 962 942 return -EINVAL; 963 943 964 - acpi_pcc_write_sset(pcc, SINF_MUTE, pcc->mute); 965 - acpi_pcc_write_sset(pcc, SINF_ECO_MODE, pcc->eco_mode); 944 + if (pcc->num_sifr > SINF_MUTE) 945 + acpi_pcc_write_sset(pcc, SINF_MUTE, pcc->mute); 946 + if (pcc->num_sifr > SINF_ECO_MODE) 947 + acpi_pcc_write_sset(pcc, SINF_ECO_MODE, pcc->eco_mode); 966 948 acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_key); 967 949 acpi_pcc_write_sset(pcc, SINF_AC_CUR_BRIGHT, pcc->ac_brightness); 968 950 acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, pcc->dc_brightness); 969 - acpi_pcc_write_sset(pcc, SINF_CUR_BRIGHT, pcc->current_brightness); 951 + if (pcc->num_sifr > SINF_CUR_BRIGHT) 952 + acpi_pcc_write_sset(pcc, SINF_CUR_BRIGHT, pcc->current_brightness); 970 953 971 954 return 0; 972 955 } ··· 986 963 987 964 num_sifr = acpi_pcc_get_sqty(device); 988 965 989 - if (num_sifr < 0 || num_sifr > 255) { 990 - pr_err("num_sifr out of range"); 966 + /* 967 + * pcc->sinf is expected to at least have the AC+DC brightness entries. 968 + * Accesses to higher SINF entries are checked against num_sifr. 969 + */ 970 + if (num_sifr <= SINF_DC_CUR_BRIGHT || num_sifr > 255) { 971 + pr_err("num_sifr %d out of range %d - 255\n", num_sifr, SINF_DC_CUR_BRIGHT + 1); 991 972 return -ENODEV; 992 973 } 974 + 975 + /* 976 + * Some DSDT-s have an off-by-one bug where the SINF package count is 977 + * one higher than the SQTY reported value, allocate 1 entry extra. 978 + */ 979 + num_sifr++; 993 980 994 981 pcc = kzalloc(sizeof(struct pcc_acpi), GFP_KERNEL); 995 982 if (!pcc) { ··· 1053 1020 acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0); 1054 1021 pcc->sticky_key = 0; 1055 1022 1056 - pcc->eco_mode = pcc->sinf[SINF_ECO_MODE]; 1057 - pcc->mute = pcc->sinf[SINF_MUTE]; 1058 1023 pcc->ac_brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; 1059 1024 pcc->dc_brightness = pcc->sinf[SINF_DC_CUR_BRIGHT]; 1060 - pcc->current_brightness = pcc->sinf[SINF_CUR_BRIGHT]; 1025 + if (pcc->num_sifr > SINF_MUTE) 1026 + pcc->mute = pcc->sinf[SINF_MUTE]; 1027 + if (pcc->num_sifr > SINF_ECO_MODE) 1028 + pcc->eco_mode = pcc->sinf[SINF_ECO_MODE]; 1029 + if (pcc->num_sifr > SINF_CUR_BRIGHT) 1030 + pcc->current_brightness = pcc->sinf[SINF_CUR_BRIGHT]; 1061 1031 1062 1032 /* add sysfs attributes */ 1063 1033 result = sysfs_create_group(&device->dev.kobj, &pcc_attr_group);
+1
include/linux/platform_data/x86/asus-wmi.h
··· 62 62 #define ASUS_WMI_DEVID_KBD_BACKLIGHT 0x00050021 63 63 #define ASUS_WMI_DEVID_LIGHT_SENSOR 0x00050022 /* ?? */ 64 64 #define ASUS_WMI_DEVID_LIGHTBAR 0x00050025 65 + #define ASUS_WMI_DEVID_OOBE 0x0005002F 65 66 /* This can only be used to disable the screen, not re-enable */ 66 67 #define ASUS_WMI_DEVID_SCREENPAD_POWER 0x00050031 67 68 /* Writing a brightness re-enables the screen if disabled */