Skip to content

Commit 9a19979

Browse files
committed
Merge tag 'acpi-7.0-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more ACPI support updates from Rafael J. Wysocki: "These are mostly fixes and cleanups on top of the ACPI support updates merged recently, including two new quirks, an ACPI CPPC library fix, and fixes and cleanups of a few core ACPI device drivers: - Add an unused power resource handling quirk for THUNDEROBOT ZERO (Zhai Can) - Fix remaining for_each_possible_cpu() in the ACPI CPPC library to use online CPUs (Sean V Kelley) - Drop redundant checks from the ACPI notify handler and the driver remove callback in the ACPI battery driver (Rafael Wysocki) - Move the creation of the wakeup source during the ACPI button driver probe to an earlier point to avoid missing a wakeup event due to a race and clean up system wakeup handling and remove callback in that driver (Rafael Wysocki) - Drop unnecessary driver_data pointer clearing from the ACPI EC and SMBUS HC drivers and make the ACPI backlight (video) driver clear the device's driver_data pointer on remove (Rafael Wysocki) - Force enabling of PWM2 on the Yogabook YB1-X90 tablets (Yauhen Kharuzhy)" * tag 'acpi-7.0-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: PM: Add unused power resource quirk for THUNDEROBOT ZERO ACPI: driver: Drop driver_data pointer clearing from two drivers ACPI: video: Clear driver_data pointer on remove ACPI: button: Tweak acpi_button_remove() ACPI: button: Tweak system wakeup handling ACPI: battery: Drop redundant checks from acpi_battery_remove() ACPI: CPPC: Fix remaining for_each_possible_cpu() to use online CPUs ACPI: x86: Force enabling of PWM2 on the Yogabook YB1-X90 ACPI: button: Call device_init_wakeup() earlier during probe ACPI: battery: Drop redundant check from acpi_battery_notify()
2 parents c3c1e98 + b89d8be commit 9a19979

8 files changed

Lines changed: 41 additions & 22 deletions

File tree

drivers/acpi/acpi_video.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,6 +2116,7 @@ static void acpi_video_bus_remove(struct platform_device *pdev)
21162116

21172117
kfree(video->attached_array);
21182118
kfree(video);
2119+
device->driver_data = NULL;
21192120
}
21202121

21212122
static int __init is_i740(struct pci_dev *dev)

drivers/acpi/battery.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,9 +1066,6 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
10661066
struct acpi_device *device = battery->device;
10671067
struct power_supply *old;
10681068

1069-
if (!battery)
1070-
return;
1071-
10721069
guard(mutex)(&battery->update_lock);
10731070

10741071
old = battery->bat;
@@ -1274,13 +1271,9 @@ static int acpi_battery_probe(struct platform_device *pdev)
12741271

12751272
static void acpi_battery_remove(struct platform_device *pdev)
12761273
{
1277-
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
12781274
struct acpi_battery *battery = platform_get_drvdata(pdev);
12791275

1280-
if (!device || !battery)
1281-
return;
1282-
1283-
acpi_dev_remove_notify_handler(device, ACPI_ALL_NOTIFY,
1276+
acpi_dev_remove_notify_handler(battery->device, ACPI_ALL_NOTIFY,
12841277
acpi_battery_notify);
12851278

12861279
device_init_wakeup(&pdev->dev, false);

drivers/acpi/button.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static struct platform_driver acpi_button_driver = {
170170

171171
struct acpi_button {
172172
struct acpi_device *adev;
173-
struct platform_device *pdev;
173+
struct device *dev; /* physical button device */
174174
unsigned int type;
175175
struct input_dev *input;
176176
char phys[32]; /* for input device */
@@ -398,7 +398,7 @@ static int acpi_lid_update_state(struct acpi_button *button,
398398
return state;
399399

400400
if (state && signal_wakeup)
401-
acpi_pm_wakeup_event(&button->pdev->dev);
401+
acpi_pm_wakeup_event(button->dev);
402402

403403
return acpi_lid_notify_state(button, state);
404404
}
@@ -455,7 +455,7 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
455455
return;
456456
}
457457

458-
acpi_pm_wakeup_event(&button->pdev->dev);
458+
acpi_pm_wakeup_event(button->dev);
459459

460460
if (button->suspended || event == ACPI_BUTTON_NOTIFY_WAKE)
461461
return;
@@ -550,7 +550,7 @@ static int acpi_button_probe(struct platform_device *pdev)
550550

551551
platform_set_drvdata(pdev, button);
552552

553-
button->pdev = pdev;
553+
button->dev = &pdev->dev;
554554
button->adev = device;
555555
button->input = input = input_allocate_device();
556556
if (!input) {
@@ -625,6 +625,8 @@ static int acpi_button_probe(struct platform_device *pdev)
625625
goto err_remove_fs;
626626
}
627627

628+
device_init_wakeup(button->dev, true);
629+
628630
switch (device->device_type) {
629631
case ACPI_BUS_TYPE_POWER_BUTTON:
630632
status = acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
@@ -655,11 +657,11 @@ static int acpi_button_probe(struct platform_device *pdev)
655657
lid_device = device;
656658
}
657659

658-
device_init_wakeup(&pdev->dev, true);
659660
pr_info("%s [%s]\n", name, acpi_device_bid(device));
660661
return 0;
661662

662663
err_input_unregister:
664+
device_init_wakeup(button->dev, false);
663665
input_unregister_device(input);
664666
err_remove_fs:
665667
acpi_button_remove_fs(button);
@@ -670,10 +672,10 @@ static int acpi_button_probe(struct platform_device *pdev)
670672

671673
static void acpi_button_remove(struct platform_device *pdev)
672674
{
673-
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
674675
struct acpi_button *button = platform_get_drvdata(pdev);
676+
struct acpi_device *adev = button->adev;
675677

676-
switch (device->device_type) {
678+
switch (adev->device_type) {
677679
case ACPI_BUS_TYPE_POWER_BUTTON:
678680
acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
679681
acpi_button_event);
@@ -683,14 +685,16 @@ static void acpi_button_remove(struct platform_device *pdev)
683685
acpi_button_event);
684686
break;
685687
default:
686-
acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
688+
acpi_remove_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY,
687689
button->type == ACPI_BUTTON_TYPE_LID ?
688690
acpi_lid_notify :
689691
acpi_button_notify);
690692
break;
691693
}
692694
acpi_os_wait_events_complete();
693695

696+
device_init_wakeup(button->dev, false);
697+
694698
acpi_button_remove_fs(button);
695699
input_unregister_device(button->input);
696700
kfree(button);

drivers/acpi/cppc_acpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
362362
end:
363363
if (cmd == CMD_WRITE) {
364364
if (unlikely(ret)) {
365-
for_each_possible_cpu(i) {
365+
for_each_online_cpu(i) {
366366
struct cpc_desc *desc = per_cpu(cpc_desc_ptr, i);
367367

368368
if (!desc)
@@ -524,7 +524,7 @@ int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data)
524524
else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
525525
cpu_data->shared_type = CPUFREQ_SHARED_TYPE_ANY;
526526

527-
for_each_possible_cpu(i) {
527+
for_each_online_cpu(i) {
528528
if (i == cpu)
529529
continue;
530530

drivers/acpi/ec.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,12 +1754,10 @@ static int acpi_ec_probe(struct platform_device *pdev)
17541754

17551755
static void acpi_ec_remove(struct platform_device *pdev)
17561756
{
1757-
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
17581757
struct acpi_ec *ec = platform_get_drvdata(pdev);
17591758

17601759
release_region(ec->data_addr, 1);
17611760
release_region(ec->command_addr, 1);
1762-
device->driver_data = NULL;
17631761
if (ec != boot_ec) {
17641762
ec_remove_handlers(ec);
17651763
acpi_ec_free(ec);

drivers/acpi/power.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,19 @@ static const struct dmi_system_id dmi_leave_unused_power_resources_on[] = {
11131113
DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE Click Mini L9W-B"),
11141114
},
11151115
},
1116+
{
1117+
/*
1118+
* THUNDEROBOT ZERO laptop: Due to its SSDT table bug, power
1119+
* resource 'PXP' will be shut down on initialization, making
1120+
* the NVMe #2 and the NVIDIA dGPU both unavailable (they're
1121+
* both controlled by 'PXP').
1122+
*/
1123+
.matches = {
1124+
DMI_MATCH(DMI_SYS_VENDOR, "THUNDEROBOT"),
1125+
DMI_MATCH(DMI_PRODUCT_NAME, "ZERO"),
1126+
}
1127+
1128+
},
11161129
{}
11171130
};
11181131

drivers/acpi/sbshc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,11 @@ static int acpi_smbus_hc_probe(struct platform_device *pdev)
275275

276276
static void acpi_smbus_hc_remove(struct platform_device *pdev)
277277
{
278-
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
279278
struct acpi_smb_hc *hc = platform_get_drvdata(pdev);
280279

281280
acpi_ec_remove_query_handler(hc->ec, hc->query_bit);
282281
acpi_os_wait_events_complete();
283282
kfree(hc);
284-
device->driver_data = NULL;
285283
}
286284

287285
module_platform_driver(acpi_smb_hc_driver);

drivers/acpi/x86/utils.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ static const struct override_status_id override_status_ids[] = {
8181
DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"),
8282
}),
8383

84+
/*
85+
* Lenovo Yoga Book uses PWM2 for touch keyboard backlight control.
86+
* It needs to be enabled only for the Android device version (YB1-X90*
87+
* aka YETI-11); the Windows version (YB1-X91*) uses ACPI control
88+
* methods.
89+
*/
90+
PRESENT_ENTRY_HID("80862289", "2", INTEL_ATOM_AIRMONT, {
91+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
92+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
93+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
94+
}),
95+
8496
/*
8597
* The INT0002 device is necessary to clear wakeup interrupt sources
8698
* on Cherry Trail devices, without it we get nobody cared IRQ msgs.

0 commit comments

Comments
 (0)