Skip to content

Commit 59825bc

Browse files
committed
Merge tag 'platform-drivers-x86-v7.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from - Add ACPI_HANDLE()/ACPI_COMPANION() NULL checks (many drivers) to handle match overrides gracefully - asus-armoury: - Fix mini-LED mode get/set - Add support for FA401EA, FX607VU, G614FR, and GU605CP - bitland-mifs-wmi: - Add CONFIG_LEDS_CLASS dependency - hp-wmi: - Add thermal support for Omen 16-c0xxx (board 8902) - intel/vsec: - Fix enable_cnt imbalance due to PCIe error recovery - surface/aggregator_registry: - Remove battery & AC nodes on Surface Laptop 7 to avoid duplicated devices - uniwill-laptop: - Handle uninitialized and invalid charging threshold values - Accept charging threshold of 0 through power supply sysfs ABI and clamp it to 1 - Make 'force' parameter to work also when device descriptor is found - Do not enable charging limit despite the 'force' parameter to avoid permanent damage to battery * tag 'platform-drivers-x86-v7.1-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (35 commits) platform/x86: bitland-mifs-wmi: add CONFIG_LEDS_CLASS dependency platform/x86: wireless-hotkey: Check ACPI_COMPANION() against NULL platform/x86: toshiba_haps: Check ACPI_COMPANION() against NULL platform/x86: toshiba_bluetooth: Check ACPI_COMPANION() against NULL platform/x86: toshiba_acpi: Check ACPI_COMPANION() against NULL platform/x86: system76: Check ACPI_COMPANION() against NULL platform/x86: sony-laptop: Check ACPI_COMPANION() against NULL platform/x86: panasonic-laptop: Check ACPI_COMPANION() against NULL platform/x86: lg-laptop: Check ACPI_COMPANION() against NULL platform/x86: intel/smartconnect: Check ACPI_HANDLE() against NULL platform/x86: intel/rst: Check ACPI_COMPANION() against NULL platform/x86: fujitsu-tablet: Check ACPI_COMPANION() against NULL platform/x86: fujitsu: Check ACPI_COMPANION() against NULL platform/x86: eeepc-laptop: Check ACPI_COMPANION() against NULL platform/x86: dell/dell-rbtn: Check ACPI_COMPANION() against NULL platform/x86: asus-laptop: Check ACPI_COMPANION() against NULL platform/x86: acer-wireless: Check ACPI_COMPANION() against NULL platform/x86: asus-armoury: add support for GU605CP platform/x86: asus-armoury: add support for FA401EA platform/x86: asus-armoury: add support for G614FR ...
2 parents cca9543 + 654ddf8 commit 59825bc

30 files changed

Lines changed: 338 additions & 63 deletions

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ Support for changing the platform performance mode is currently not implemented.
4343
Battery Charging Control
4444
------------------------
4545

46+
.. warning:: Some devices do not properly implement the charging threshold interface. Forcing
47+
the driver to enable access to said interface on such devices might damage the
48+
battery [1]_. Because of this the driver will not enable said feature even when
49+
using the ``force`` module parameter.
50+
4651
The ``uniwill-laptop`` driver supports controlling the battery charge limit. This happens over
4752
the standard ``charge_control_end_threshold`` power supply sysfs attribute. All values
4853
between 1 and 100 percent are supported.
@@ -70,3 +75,8 @@ The ``uniwill-laptop`` driver allows to set the configurable TGP for devices wit
7075
allow it.
7176

7277
See Documentation/ABI/testing/sysfs-driver-uniwill-laptop for details.
78+
79+
References
80+
==========
81+
82+
.. [1] https://www.reddit.com/r/XMG_gg/comments/ld9yyf/battery_limit_hidden_function_discovered_on/

drivers/platform/surface/surface_aggregator_registry.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,6 @@ static const struct software_node *ssam_node_group_sl6[] = {
295295
/* Devices for Surface Laptop 7. */
296296
static const struct software_node *ssam_node_group_sl7[] = {
297297
&ssam_node_root,
298-
&ssam_node_bat_ac,
299-
&ssam_node_bat_main,
300298
&ssam_node_tmp_perf_profile_with_fan,
301299
&ssam_node_fan_speed,
302300
&ssam_node_hid_sam_keyboard,

drivers/platform/surface/surfacepro3_button.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,15 @@ static bool surface_button_check_MSHW0040(struct device *dev, acpi_handle handle
185185

186186
static int surface_button_probe(struct platform_device *pdev)
187187
{
188-
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
189188
struct surface_button *button;
189+
struct acpi_device *device;
190190
struct input_dev *input;
191-
const char *hid = acpi_device_hid(device);
192191
int error;
193192

193+
device = ACPI_COMPANION(&pdev->dev);
194+
if (!device)
195+
return -ENODEV;
196+
194197
if (strncmp(acpi_device_bid(device), SURFACE_BUTTON_OBJ_NAME,
195198
strlen(SURFACE_BUTTON_OBJ_NAME)))
196199
return -ENODEV;
@@ -210,7 +213,8 @@ static int surface_button_probe(struct platform_device *pdev)
210213
}
211214

212215
strscpy(acpi_device_name(device), SURFACE_BUTTON_DEVICE_NAME);
213-
snprintf(button->phys, sizeof(button->phys), "%s/buttons", hid);
216+
snprintf(button->phys, sizeof(button->phys), "%s/buttons",
217+
acpi_device_hid(device));
214218

215219
input->name = acpi_device_name(device);
216220
input->phys = button->phys;

drivers/platform/x86/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ config BITLAND_MIFS_WMI
118118
depends on ACPI_WMI
119119
depends on HWMON
120120
depends on INPUT
121+
depends on LEDS_CLASS
121122
depends on POWER_SUPPLY
122123
select ACPI_PLATFORM_PROFILE
123124
select INPUT_SPARSEKMAP

drivers/platform/x86/acer-wireless.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ static void acer_wireless_notify(acpi_handle handle, u32 event, void *data)
3737

3838
static int acer_wireless_probe(struct platform_device *pdev)
3939
{
40+
struct acpi_device *adev;
4041
struct input_dev *idev;
4142
int ret;
4243

44+
adev = ACPI_COMPANION(&pdev->dev);
45+
if (!adev)
46+
return -ENODEV;
47+
4348
idev = devm_input_allocate_device(&pdev->dev);
4449
if (!idev)
4550
return -ENOMEM;
@@ -57,8 +62,7 @@ static int acer_wireless_probe(struct platform_device *pdev)
5762
if (ret)
5863
return ret;
5964

60-
return acpi_dev_install_notify_handler(ACPI_COMPANION(&pdev->dev),
61-
ACPI_DEVICE_NOTIFY,
65+
return acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
6266
acer_wireless_notify,
6367
&pdev->dev);
6468
}

drivers/platform/x86/adv_swbutton.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,14 @@ static int adv_swbutton_probe(struct platform_device *device)
4848
{
4949
struct adv_swbutton *button;
5050
struct input_dev *input;
51-
acpi_handle handle = ACPI_HANDLE(&device->dev);
51+
acpi_handle handle;
5252
acpi_status status;
5353
int error;
5454

55+
handle = ACPI_HANDLE(&device->dev);
56+
if (!handle)
57+
return -ENODEV;
58+
5559
button = devm_kzalloc(&device->dev, sizeof(*button), GFP_KERNEL);
5660
if (!button)
5761
return -ENOMEM;

drivers/platform/x86/asus-armoury.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ static ssize_t mini_led_mode_current_value_show(struct kobject *kobj,
370370
if (err)
371371
return err;
372372

373-
mode = FIELD_GET(ASUS_MINI_LED_MODE_MASK, 0);
373+
mode = FIELD_GET(ASUS_MINI_LED_MODE_MASK, mode);
374374

375375
for (i = 0; i < mini_led_mode_map_size; i++)
376376
if (mode == mini_led_mode_map[i])
@@ -386,6 +386,7 @@ static ssize_t mini_led_mode_current_value_store(struct kobject *kobj,
386386
{
387387
u32 *mini_led_mode_map;
388388
size_t mini_led_mode_map_size;
389+
char mapped_value[12];
389390
u32 mode;
390391
int err;
391392

@@ -414,9 +415,16 @@ static ssize_t mini_led_mode_current_value_store(struct kobject *kobj,
414415
return -ENODEV;
415416
}
416417

417-
return armoury_attr_uint_store(kobj, attr, buf, count,
418-
0, mini_led_mode_map[mode],
419-
NULL, asus_armoury.mini_led_dev_id);
418+
/*
419+
* armoury_attr_uint_store() parses and sends the value from the
420+
* passed buffer; hand it the mapped firmware value so the device
421+
* receives the translated mode instead of the raw index.
422+
*/
423+
snprintf(mapped_value, sizeof(mapped_value), "%u", mini_led_mode_map[mode]);
424+
425+
return armoury_attr_uint_store(kobj, attr, mapped_value, count, 0,
426+
mini_led_mode_map[mode], NULL,
427+
asus_armoury.mini_led_dev_id);
420428
}
421429

422430
static ssize_t mini_led_mode_possible_values_show(struct kobject *kobj,

drivers/platform/x86/asus-armoury.h

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,29 @@ struct power_data {
346346
* _def is not required and will be assumed to be default == max if missing.
347347
*/
348348
static const struct dmi_system_id power_limits[] = {
349+
{
350+
.matches = {
351+
DMI_MATCH(DMI_BOARD_NAME, "FA401EA"),
352+
},
353+
.driver_data = &(struct power_data) {
354+
.ac_data = &(struct power_limits) {
355+
.ppt_pl1_spl_min = 15,
356+
.ppt_pl1_spl_max = 95,
357+
.ppt_pl2_sppt_min = 35,
358+
.ppt_pl2_sppt_max = 100,
359+
.ppt_pl3_fppt_min = 35,
360+
.ppt_pl3_fppt_max = 115,
361+
},
362+
.dc_data = &(struct power_limits) {
363+
.ppt_pl1_spl_min = 15,
364+
.ppt_pl1_spl_max = 71,
365+
.ppt_pl2_sppt_min = 35,
366+
.ppt_pl2_sppt_max = 71,
367+
.ppt_pl3_fppt_min = 35,
368+
.ppt_pl3_fppt_max = 71,
369+
},
370+
},
371+
},
349372
{
350373
.matches = {
351374
DMI_MATCH(DMI_BOARD_NAME, "FA401UM"),
@@ -886,6 +909,33 @@ static const struct dmi_system_id power_limits[] = {
886909
.requires_fan_curve = true,
887910
},
888911
},
912+
{
913+
.matches = {
914+
DMI_MATCH(DMI_BOARD_NAME, "FX607VU"),
915+
},
916+
.driver_data = &(struct power_data) {
917+
.ac_data = &(struct power_limits) {
918+
.ppt_pl1_spl_min = 28,
919+
.ppt_pl1_spl_def = 115,
920+
.ppt_pl1_spl_max = 135,
921+
.ppt_pl2_sppt_min = 28,
922+
.ppt_pl2_sppt_max = 135,
923+
.nv_dynamic_boost_min = 5,
924+
.nv_dynamic_boost_max = 25,
925+
.nv_temp_target_min = 75,
926+
.nv_temp_target_max = 87,
927+
},
928+
.dc_data = &(struct power_limits) {
929+
.ppt_pl1_spl_min = 25,
930+
.ppt_pl1_spl_max = 45,
931+
.ppt_pl2_sppt_min = 35,
932+
.ppt_pl2_sppt_max = 60,
933+
.nv_temp_target_min = 75,
934+
.nv_temp_target_max = 87,
935+
},
936+
.requires_fan_curve = true,
937+
},
938+
},
889939
{
890940
.matches = {
891941
DMI_MATCH(DMI_BOARD_NAME, "GA401Q"),
@@ -1253,6 +1303,35 @@ static const struct dmi_system_id power_limits[] = {
12531303
},
12541304
},
12551305
},
1306+
{
1307+
.matches = {
1308+
DMI_MATCH(DMI_BOARD_NAME, "GU605CP"),
1309+
},
1310+
.driver_data = &(struct power_data) {
1311+
.ac_data = &(struct power_limits) {
1312+
.ppt_pl1_spl_min = 45,
1313+
.ppt_pl1_spl_max = 75,
1314+
.ppt_pl2_sppt_min = 56,
1315+
.ppt_pl2_sppt_max = 95,
1316+
.nv_dynamic_boost_min = 5,
1317+
.nv_dynamic_boost_max = 15,
1318+
.nv_temp_target_min = 75,
1319+
.nv_temp_target_max = 87,
1320+
.nv_tgp_min = 55,
1321+
.nv_tgp_def = 75,
1322+
.nv_tgp_max = 95,
1323+
},
1324+
.dc_data = &(struct power_limits) {
1325+
.ppt_pl1_spl_min = 25,
1326+
.ppt_pl1_spl_max = 75,
1327+
.ppt_pl2_sppt_min = 32,
1328+
.ppt_pl2_sppt_max = 95,
1329+
.nv_temp_target_min = 75,
1330+
.nv_temp_target_max = 87,
1331+
},
1332+
.requires_fan_curve = true,
1333+
},
1334+
},
12561335
{
12571336
.matches = {
12581337
DMI_MATCH(DMI_BOARD_NAME, "GU605CR"),
@@ -1759,6 +1838,40 @@ static const struct dmi_system_id power_limits[] = {
17591838
.requires_fan_curve = true,
17601839
},
17611840
},
1841+
{
1842+
.matches = {
1843+
DMI_MATCH(DMI_BOARD_NAME, "G614FR"),
1844+
},
1845+
.driver_data = &(struct power_data) {
1846+
.ac_data = &(struct power_limits) {
1847+
.ppt_pl1_spl_min = 30,
1848+
.ppt_pl1_spl_max = 120,
1849+
.ppt_pl2_sppt_min = 65,
1850+
.ppt_pl2_sppt_def = 140,
1851+
.ppt_pl2_sppt_max = 162,
1852+
.ppt_pl3_fppt_min = 65,
1853+
.ppt_pl3_fppt_def = 140,
1854+
.ppt_pl3_fppt_max = 162,
1855+
.nv_temp_target_min = 75,
1856+
.nv_temp_target_max = 87,
1857+
.nv_dynamic_boost_min = 5,
1858+
.nv_dynamic_boost_max = 25,
1859+
.nv_tgp_min = 65,
1860+
.nv_tgp_max = 115,
1861+
},
1862+
.dc_data = &(struct power_limits) {
1863+
.ppt_pl1_spl_min = 25,
1864+
.ppt_pl1_spl_max = 65,
1865+
.ppt_pl2_sppt_min = 25,
1866+
.ppt_pl2_sppt_max = 65,
1867+
.ppt_pl3_fppt_min = 35,
1868+
.ppt_pl3_fppt_max = 75,
1869+
.nv_temp_target_min = 75,
1870+
.nv_temp_target_max = 87,
1871+
},
1872+
.requires_fan_curve = true,
1873+
},
1874+
},
17621875
{
17631876
.matches = {
17641877
DMI_MATCH(DMI_BOARD_NAME, "G614J"),

drivers/platform/x86/asus-laptop.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1826,10 +1826,14 @@ static bool asus_device_present;
18261826

18271827
static int asus_acpi_probe(struct platform_device *pdev)
18281828
{
1829-
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
1829+
struct acpi_device *device;
18301830
struct asus_laptop *asus;
18311831
int result;
18321832

1833+
device = ACPI_COMPANION(&pdev->dev);
1834+
if (!device)
1835+
return -ENODEV;
1836+
18331837
pr_notice("Asus Laptop Support version %s\n",
18341838
ASUS_LAPTOP_VERSION);
18351839
asus = kzalloc_obj(struct asus_laptop);

drivers/platform/x86/dell/dell-rbtn.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,15 @@ static void rbtn_cleanup(struct device *dev)
396396

397397
static int rbtn_probe(struct platform_device *pdev)
398398
{
399-
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
400399
struct rbtn_data *rbtn_data;
400+
struct acpi_device *device;
401401
enum rbtn_type type;
402402
int ret = 0;
403403

404+
device = ACPI_COMPANION(&pdev->dev);
405+
if (!device)
406+
return -ENODEV;
407+
404408
type = rbtn_check(device);
405409
if (type == RBTN_UNKNOWN) {
406410
dev_info(&pdev->dev, "Unknown device type\n");

0 commit comments

Comments
 (0)