Skip to content

Commit bb97142

Browse files
committed
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
2 parents df28370 + 3ed1734 commit bb97142

5 files changed

Lines changed: 33 additions & 22 deletions

File tree

Documentation/admin-guide/laptops/lg-laptop.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ This value is reset to 100 when the kernel boots.
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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ static const struct dmi_system_id fwbug_list[] = {
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static const struct dmi_system_id lis3lv02d_devices[] __initconst = {
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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ static int thermal_platform_profile_get(struct device *dev,
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)
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

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
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");
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,
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,
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,
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,

0 commit comments

Comments
 (0)