History

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

Pull x86 platform driver fixes from Ilpo Järvinen: "Fixes and New HW Supoort - amd/pmc: Use 8042 quirk for Stellaris Slim Gen6 AMD - dell: Set USTT mode according to BIOS after reboot - dell-lis3lv02d: Add Latitude E6530 - lg-laptop: Fix setting the fan mode" * tag 'platform-drivers-x86-v6.17-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86: lg-laptop: Fix WMAB call in fan_mode_store() platform/x86: dell-lis3lv02d: Add Latitude E6530 platform/x86/dell: Set USTT mode according to BIOS after reboot platform/x86/amd/pmc: Add Stellaris Slim Gen6 AMD to spurious 8042 quirks list

Linus Torvalds committed 1 year ago

Commit bb971422 parents df28370 3ed17345 files · +33 −22Browse files

Unified · Split

5 files
  1. Documentation/admin-guide/laptops/lg-laptop.rst +2 −2
  2. drivers/platform/x86/amd/pmc/pmc-quirks.c +7 −0
  3. drivers/platform/x86/dell/dell-lis3lv02d.c +1 −0
  4. drivers/platform/x86/dell/dell-pc.c +9 −0
  5. drivers/platform/x86/lg-laptop.c +14 −20
Documentation/admin-guide/laptops/lg-laptop.rst+2−2
@@ -48,8 +48,8 @@ This value is reset to 100 when the kernel boots. · 47 unmodified lines
4848 Fan mode
4949 --------
5050
51−Writing 1/0 to /sys/devices/platform/lg-laptop/fan_mode disables/enables
52−the fan silent mode.
51+Writing 0/1/2 to /sys/devices/platform/lg-laptop/fan_mode sets fan mode to
52+Optimal/Silent/Performance respectively.
5353
5454
5555 USB charge
drivers/platform/x86/amd/pmc/pmc-quirks.c+7−0
@@ -256,6 +256,13 @@ static const struct dmi_system_id fwbug_list[] = { · 255 unmodified lines
256256 DMI_MATCH(DMI_PRODUCT_NAME, "Lafite Pro V 14M"),
257257 }
258258 },
259+ {
260+ .ident = "TUXEDO Stellaris Slim 15 AMD Gen6",
261+ .driver_data = &quirk_spurious_8042,
262+ .matches = {
263+ DMI_MATCH(DMI_BOARD_NAME, "GMxHGxx"),
264+ }
265+ },
259266 {
260267 .ident = "TUXEDO InfinityBook Pro 14/15 AMD Gen10",
261268 .driver_data = &quirk_spurious_8042,
drivers/platform/x86/dell/dell-lis3lv02d.c+1−0
@@ -48,6 +48,7 @@ static const struct dmi_system_id lis3lv02d_devices[] __initconst = { · 47 unmodified lines
4848 DELL_LIS3LV02D_DMI_ENTRY("Latitude 5500", 0x29),
4949 DELL_LIS3LV02D_DMI_ENTRY("Latitude E6330", 0x29),
5050 DELL_LIS3LV02D_DMI_ENTRY("Latitude E6430", 0x29),
51+ DELL_LIS3LV02D_DMI_ENTRY("Latitude E6530", 0x29),
5152 DELL_LIS3LV02D_DMI_ENTRY("Precision 3540", 0x29),
5253 DELL_LIS3LV02D_DMI_ENTRY("Precision 3551", 0x29),
5354 DELL_LIS3LV02D_DMI_ENTRY("Precision M6800", 0x29),
drivers/platform/x86/dell/dell-pc.c+9−0
@@ -228,6 +228,8 @@ static int thermal_platform_profile_get(struct device *dev, · 227 unmodified lines
228228
229229 static int thermal_platform_profile_probe(void *drvdata, unsigned long *choices)
230230 {
231+ int current_mode;
232+
231233 if (supported_modes & DELL_QUIET)
232234 __set_bit(PLATFORM_PROFILE_QUIET, choices);
233235 if (supported_modes & DELL_COOL_BOTTOM)
@@ -237,6 +239,13 @@ static int thermal_platform_profile_probe(void *drvdata, unsigned long *choices) · 3 unmodified lines
237239 if (supported_modes & DELL_PERFORMANCE)
238240 __set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
239241
242+ /* Make sure that ACPI is in sync with the profile set by USTT */
243+ current_mode = thermal_get_mode();
244+ if (current_mode < 0)
245+ return current_mode;
246+
247+ thermal_set_mode(current_mode);
248+
240249 return 0;
241250 }
242251
drivers/platform/x86/lg-laptop.c+14−20
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
99
1010 #include <linux/acpi.h>
11+#include <linux/bitfield.h>
1112 #include <linux/bits.h>
1213 #include <linux/device.h>
1314 #include <linux/dev_printk.h>
@@ -75,6 +76,9 @@ MODULE_PARM_DESC(fw_debug, "Enable printing of firmware debug messages"); · 61 unmodified lines
7576 #define WMBB_USB_CHARGE 0x10B
7677 #define WMBB_BATT_LIMIT 0x10C
7778
79+#define FAN_MODE_LOWER GENMASK(1, 0)
80+#define FAN_MODE_UPPER GENMASK(5, 4)
81+
7882 #define PLATFORM_NAME "lg-laptop"
7983
8084 MODULE_ALIAS("wmi:" WMI_EVENT_GUID0);
@@ -274,29 +278,19 @@ static ssize_t fan_mode_store(struct device *dev, · 193 unmodified lines
274278 struct device_attribute *attr,
275279 const char *buffer, size_t count)
276280 {
277− bool value;
281+ unsigned long value;
278282 union acpi_object *r;
279− u32 m;
280283 int ret;
281284
282− ret = kstrtobool(buffer, &value);
285+ ret = kstrtoul(buffer, 10, &value);
283286 if (ret)
284287 return ret;
288+ if (value >= 3)
289+ return -EINVAL;
285290
286− r = lg_wmab(dev, WM_FAN_MODE, WM_GET, 0);
287− if (!r)
288− return -EIO;
289−
290− if (r->type != ACPI_TYPE_INTEGER) {
291− kfree(r);
292− return -EIO;
293− }
294−
295− m = r->integer.value;
296− kfree(r);
297− r = lg_wmab(dev, WM_FAN_MODE, WM_SET, (m & 0xffffff0f) | (value << 4));
298− kfree(r);
299− r = lg_wmab(dev, WM_FAN_MODE, WM_SET, (m & 0xfffffff0) | value);
291+ r = lg_wmab(dev, WM_FAN_MODE, WM_SET,
292+ FIELD_PREP(FAN_MODE_LOWER, value) |
293+ FIELD_PREP(FAN_MODE_UPPER, value));
300294 kfree(r);
301295
302296 return count;
@@ -305,7 +299,7 @@ static ssize_t fan_mode_store(struct device *dev, · 2 unmodified lines
305299 static ssize_t fan_mode_show(struct device *dev,
306300 struct device_attribute *attr, char *buffer)
307301 {
308− unsigned int status;
302+ unsigned int mode;
309303 union acpi_object *r;
310304
311305 r = lg_wmab(dev, WM_FAN_MODE, WM_GET, 0);
@@ -317,10 +311,10 @@ static ssize_t fan_mode_show(struct device *dev, · 5 unmodified lines
317311 return -EIO;
318312 }
319313
320− status = r->integer.value & 0x01;
314+ mode = FIELD_GET(FAN_MODE_LOWER, r->integer.value);
321315 kfree(r);
322316
323− return sysfs_emit(buffer, "%d\n", status);
317+ return sysfs_emit(buffer, "%d\n", mode);
324318 }
325319
326320 static ssize_t usb_charge_store(struct device *dev,