Skip to content

Commit 8c34f11

Browse files
committed
Merge branches 'acpi-scan', 'acpi-bus', 'acpi-pm' and 'acpi-resource'
Merge ACPI device enumeration and bus type changes, ACPI power management changes and ACPI IRQ override handling quirks for 6.9-rc1: - Rearrange Device Check and Bus Check notification handling in the ACPI device hotplug code to make it get the "enabled" _STA bit into account (Rafael Wysocki). - Modify acpi_processor_add() to skip processors with the "enabled" _STA bit clear, as per the specification (Rafael Wysocki). - Stop failing Device Check notification handling without a valid reason (Rafael Wysocki). - Defer enumeration of devices that depend on a device with an ACPI device ID equalt to INTC10CF to address probe ordering issues on some platforms (Wentong Wu). - Constify acpi_bus_type (Ricardo Marliere). - Make the ACPI-specific suspend-to-idle code take the Low-Power S0 Idle MSFT UUID into account on non-AMD systems (Rafael Wysocki). - Add ACPI IRQ override quirks for some new platforms (Sergey Kalinichev, Maxim Kudinov, Alexey Froloff, Sviatoslav Harasymchuk, Nicolas Haye). * acpi-scan: ACPI: scan: Consolidate Device Check and Bus Check notification handling ACPI: scan: Rework Device Check and Bus Check notification handling ACPI: scan: Make acpi_processor_add() check the device enabled bit ACPI: scan: Relocate acpi_bus_trim_one() ACPI: scan: Fix device check notification handling ACPI: scan: Defer enumeration of devices with a _DEP pointing to IVSC device * acpi-bus: ACPI: bus: make acpi_bus_type const * acpi-pm: ACPI: PM: s2idle: Enable Low-Power S0 Idle MSFT UUID for non-AMD systems * acpi-resource: ACPI: resource: Use IRQ override on Maibenben X565 ACPI: resource: Add MAIBENBEN X577 to irq1_edge_low_force_override ACPI: resource: Do IRQ override on Lunnen Ground laptops ACPI: resource: Add IRQ override quirk for ASUS ExpertBook B2502FBA ACPI: resource: Skip IRQ override on ASUS ExpertBook B1502CVA
5 parents 2f4a4d6 + 4f4a335 + 592190b + 0732372 + 00efe7f commit 8c34f11

File tree

7 files changed

+168
-91
lines changed

7 files changed

+168
-91
lines changed

drivers/acpi/acpi_processor.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ static int acpi_processor_add(struct acpi_device *device,
381381
struct device *dev;
382382
int result = 0;
383383

384+
if (!acpi_device_is_enabled(device))
385+
return -ENODEV;
386+
384387
pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
385388
if (!pr)
386389
return -ENOMEM;

drivers/acpi/bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ static void acpi_device_remove(struct device *dev)
10971097
put_device(dev);
10981098
}
10991099

1100-
struct bus_type acpi_bus_type = {
1100+
const struct bus_type acpi_bus_type = {
11011101
.name = "acpi",
11021102
.match = acpi_bus_match,
11031103
.probe = acpi_device_probe,

drivers/acpi/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ int acpi_device_setup_files(struct acpi_device *dev);
121121
void acpi_device_remove_files(struct acpi_device *dev);
122122
void acpi_device_add_finalize(struct acpi_device *device);
123123
void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
124+
bool acpi_device_is_enabled(const struct acpi_device *adev);
124125
bool acpi_device_is_present(const struct acpi_device *adev);
125126
bool acpi_device_is_battery(struct acpi_device *adev);
126127
bool acpi_device_is_first_physical_node(struct acpi_device *adev,

drivers/acpi/resource.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,13 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = {
468468
DMI_MATCH(DMI_BOARD_NAME, "B1502CGA"),
469469
},
470470
},
471+
{
472+
/* Asus ExpertBook B1502CVA */
473+
.matches = {
474+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
475+
DMI_MATCH(DMI_BOARD_NAME, "B1502CVA"),
476+
},
477+
},
471478
{
472479
/* Asus ExpertBook B2402CBA */
473480
.matches = {
@@ -489,6 +496,13 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = {
489496
DMI_MATCH(DMI_BOARD_NAME, "B2502CBA"),
490497
},
491498
},
499+
{
500+
/* Asus ExpertBook B2502FBA */
501+
.matches = {
502+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
503+
DMI_MATCH(DMI_BOARD_NAME, "B2502FBA"),
504+
},
505+
},
492506
{
493507
/* Asus Vivobook E1504GA */
494508
.matches = {
@@ -588,6 +602,34 @@ static const struct dmi_system_id irq1_edge_low_force_override[] = {
588602
DMI_MATCH(DMI_BOARD_NAME, "GM5RGEE0016COM"),
589603
},
590604
},
605+
{
606+
/* Lunnen Ground 15 / AMD Ryzen 5 5500U */
607+
.matches = {
608+
DMI_MATCH(DMI_SYS_VENDOR, "Lunnen"),
609+
DMI_MATCH(DMI_BOARD_NAME, "LLL5DAW"),
610+
},
611+
},
612+
{
613+
/* Lunnen Ground 16 / AMD Ryzen 7 5800U */
614+
.matches = {
615+
DMI_MATCH(DMI_SYS_VENDOR, "Lunnen"),
616+
DMI_MATCH(DMI_BOARD_NAME, "LL6FA"),
617+
},
618+
},
619+
{
620+
/* MAIBENBEN X577 */
621+
.matches = {
622+
DMI_MATCH(DMI_SYS_VENDOR, "MAIBENBEN"),
623+
DMI_MATCH(DMI_BOARD_NAME, "X577"),
624+
},
625+
},
626+
{
627+
/* Maibenben X565 */
628+
.matches = {
629+
DMI_MATCH(DMI_SYS_VENDOR, "MAIBENBEN"),
630+
DMI_MATCH(DMI_BOARD_NAME, "X565"),
631+
},
632+
},
591633
{ }
592634
};
593635

drivers/acpi/scan.c

Lines changed: 93 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,53 @@ static int acpi_scan_try_to_offline(struct acpi_device *device)
244244
return 0;
245245
}
246246

247+
static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check)
248+
{
249+
struct acpi_scan_handler *handler = adev->handler;
250+
251+
acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, check);
252+
253+
if (check) {
254+
acpi_bus_get_status(adev);
255+
/*
256+
* Skip devices that are still there and take the enabled
257+
* flag into account.
258+
*/
259+
if (acpi_device_is_enabled(adev))
260+
return 0;
261+
262+
/* Skip device that have not been enumerated. */
263+
if (!acpi_device_enumerated(adev)) {
264+
dev_dbg(&adev->dev, "Still not enumerated\n");
265+
return 0;
266+
}
267+
}
268+
269+
adev->flags.match_driver = false;
270+
if (handler) {
271+
if (handler->detach)
272+
handler->detach(adev);
273+
274+
adev->handler = NULL;
275+
} else {
276+
device_release_driver(&adev->dev);
277+
}
278+
/*
279+
* Most likely, the device is going away, so put it into D3cold before
280+
* that.
281+
*/
282+
acpi_device_set_power(adev, ACPI_STATE_D3_COLD);
283+
adev->flags.initialized = false;
284+
acpi_device_clear_enumerated(adev);
285+
286+
return 0;
287+
}
288+
289+
static void acpi_scan_check_subtree(struct acpi_device *adev)
290+
{
291+
acpi_scan_check_and_detach(adev, (void *)true);
292+
}
293+
247294
static int acpi_scan_hot_remove(struct acpi_device *device)
248295
{
249296
acpi_handle handle = device->handle;
@@ -289,75 +336,62 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
289336
return 0;
290337
}
291338

292-
static int acpi_scan_device_not_enumerated(struct acpi_device *adev)
339+
static int acpi_scan_rescan_bus(struct acpi_device *adev)
293340
{
294-
if (!acpi_device_enumerated(adev)) {
295-
dev_warn(&adev->dev, "Still not enumerated\n");
296-
return -EALREADY;
297-
}
298-
acpi_bus_trim(adev);
299-
return 0;
341+
struct acpi_scan_handler *handler = adev->handler;
342+
int ret;
343+
344+
if (handler && handler->hotplug.scan_dependent)
345+
ret = handler->hotplug.scan_dependent(adev);
346+
else
347+
ret = acpi_bus_scan(adev->handle);
348+
349+
if (ret)
350+
dev_info(&adev->dev, "Namespace scan failure\n");
351+
352+
return ret;
300353
}
301354

302355
static int acpi_scan_device_check(struct acpi_device *adev)
303356
{
304-
int error;
357+
struct acpi_device *parent;
305358

306-
acpi_bus_get_status(adev);
307-
if (acpi_device_is_present(adev)) {
308-
/*
309-
* This function is only called for device objects for which
310-
* matching scan handlers exist. The only situation in which
311-
* the scan handler is not attached to this device object yet
312-
* is when the device has just appeared (either it wasn't
313-
* present at all before or it was removed and then added
314-
* again).
315-
*/
316-
if (adev->handler) {
317-
dev_warn(&adev->dev, "Already enumerated\n");
318-
return -EALREADY;
319-
}
320-
error = acpi_bus_scan(adev->handle);
321-
if (error) {
322-
dev_warn(&adev->dev, "Namespace scan failure\n");
323-
return error;
324-
}
325-
if (!adev->handler) {
326-
dev_warn(&adev->dev, "Enumeration failure\n");
327-
error = -ENODEV;
328-
}
329-
} else {
330-
error = acpi_scan_device_not_enumerated(adev);
331-
}
332-
return error;
333-
}
359+
acpi_scan_check_subtree(adev);
334360

335-
static int acpi_scan_bus_check(struct acpi_device *adev, void *not_used)
336-
{
337-
struct acpi_scan_handler *handler = adev->handler;
338-
int error;
361+
if (!acpi_device_is_present(adev))
362+
return 0;
339363

340-
acpi_bus_get_status(adev);
341-
if (!acpi_device_is_present(adev)) {
342-
acpi_scan_device_not_enumerated(adev);
364+
/*
365+
* This function is only called for device objects for which matching
366+
* scan handlers exist. The only situation in which the scan handler
367+
* is not attached to this device object yet is when the device has
368+
* just appeared (either it wasn't present at all before or it was
369+
* removed and then added again).
370+
*/
371+
if (adev->handler) {
372+
dev_dbg(&adev->dev, "Already enumerated\n");
343373
return 0;
344374
}
345-
if (handler && handler->hotplug.scan_dependent)
346-
return handler->hotplug.scan_dependent(adev);
347375

348-
error = acpi_bus_scan(adev->handle);
349-
if (error) {
350-
dev_warn(&adev->dev, "Namespace scan failure\n");
351-
return error;
352-
}
353-
return acpi_dev_for_each_child(adev, acpi_scan_bus_check, NULL);
376+
parent = acpi_dev_parent(adev);
377+
if (!parent)
378+
parent = adev;
379+
380+
return acpi_scan_rescan_bus(parent);
381+
}
382+
383+
static int acpi_scan_bus_check(struct acpi_device *adev)
384+
{
385+
acpi_scan_check_subtree(adev);
386+
387+
return acpi_scan_rescan_bus(adev);
354388
}
355389

356390
static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type)
357391
{
358392
switch (type) {
359393
case ACPI_NOTIFY_BUS_CHECK:
360-
return acpi_scan_bus_check(adev, NULL);
394+
return acpi_scan_bus_check(adev);
361395
case ACPI_NOTIFY_DEVICE_CHECK:
362396
return acpi_scan_device_check(adev);
363397
case ACPI_NOTIFY_EJECT_REQUEST:
@@ -798,6 +832,7 @@ static const char * const acpi_honor_dep_ids[] = {
798832
"INTC1059", /* IVSC (TGL) driver must be loaded to allow i2c access to camera sensors */
799833
"INTC1095", /* IVSC (ADL) driver must be loaded to allow i2c access to camera sensors */
800834
"INTC100A", /* IVSC (RPL) driver must be loaded to allow i2c access to camera sensors */
835+
"INTC10CF", /* IVSC (MTL) driver must be loaded to allow i2c access to camera sensors */
801836
NULL
802837
};
803838

@@ -1922,6 +1957,11 @@ bool acpi_device_is_present(const struct acpi_device *adev)
19221957
return adev->status.present || adev->status.functional;
19231958
}
19241959

1960+
bool acpi_device_is_enabled(const struct acpi_device *adev)
1961+
{
1962+
return adev->status.present && adev->status.enabled;
1963+
}
1964+
19251965
static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler,
19261966
const char *idstr,
19271967
const struct acpi_device_id **matchid)
@@ -2550,32 +2590,6 @@ int acpi_bus_scan(acpi_handle handle)
25502590
}
25512591
EXPORT_SYMBOL(acpi_bus_scan);
25522592

2553-
static int acpi_bus_trim_one(struct acpi_device *adev, void *not_used)
2554-
{
2555-
struct acpi_scan_handler *handler = adev->handler;
2556-
2557-
acpi_dev_for_each_child_reverse(adev, acpi_bus_trim_one, NULL);
2558-
2559-
adev->flags.match_driver = false;
2560-
if (handler) {
2561-
if (handler->detach)
2562-
handler->detach(adev);
2563-
2564-
adev->handler = NULL;
2565-
} else {
2566-
device_release_driver(&adev->dev);
2567-
}
2568-
/*
2569-
* Most likely, the device is going away, so put it into D3cold before
2570-
* that.
2571-
*/
2572-
acpi_device_set_power(adev, ACPI_STATE_D3_COLD);
2573-
adev->flags.initialized = false;
2574-
acpi_device_clear_enumerated(adev);
2575-
2576-
return 0;
2577-
}
2578-
25792593
/**
25802594
* acpi_bus_trim - Detach scan handlers and drivers from ACPI device objects.
25812595
* @adev: Root of the ACPI namespace scope to walk.
@@ -2584,7 +2598,7 @@ static int acpi_bus_trim_one(struct acpi_device *adev, void *not_used)
25842598
*/
25852599
void acpi_bus_trim(struct acpi_device *adev)
25862600
{
2587-
acpi_bus_trim_one(adev, NULL);
2601+
acpi_scan_check_and_detach(adev, NULL);
25882602
}
25892603
EXPORT_SYMBOL_GPL(acpi_bus_trim);
25902604

drivers/acpi/x86/s2idle.c

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,21 @@ static int lps0_device_attach(struct acpi_device *adev,
488488
rev_id = 1;
489489
lps0_dsm_func_mask = validate_dsm(adev->handle,
490490
ACPI_LPS0_DSM_UUID, rev_id, &lps0_dsm_guid);
491-
lps0_dsm_func_mask_microsoft = -EINVAL;
491+
if (lps0_dsm_func_mask > 0 && lps0_dsm_func_mask_microsoft > 0) {
492+
unsigned int func_mask;
493+
494+
/*
495+
* Avoid evaluating the same _DSM function for two
496+
* different UUIDs and prioritize the MSFT one.
497+
*/
498+
func_mask = lps0_dsm_func_mask & lps0_dsm_func_mask_microsoft;
499+
if (func_mask) {
500+
acpi_handle_info(adev->handle,
501+
"Duplicate LPS0 _DSM functions (mask: 0x%x)\n",
502+
func_mask);
503+
lps0_dsm_func_mask &= ~func_mask;
504+
}
505+
}
492506
}
493507

494508
if (lps0_dsm_func_mask < 0 && lps0_dsm_func_mask_microsoft < 0)
@@ -549,19 +563,22 @@ int acpi_s2idle_prepare_late(void)
549563
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
550564

551565
/* LPS0 entry */
552-
if (lps0_dsm_func_mask > 0)
553-
acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
554-
ACPI_LPS0_ENTRY_AMD :
555-
ACPI_LPS0_ENTRY,
566+
if (lps0_dsm_func_mask > 0 && acpi_s2idle_vendor_amd())
567+
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY_AMD,
556568
lps0_dsm_func_mask, lps0_dsm_guid);
569+
557570
if (lps0_dsm_func_mask_microsoft > 0) {
558-
/* modern standby entry */
571+
/* Modern Standby entry */
559572
acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY,
560573
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
561574
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
562575
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
563576
}
564577

578+
if (lps0_dsm_func_mask > 0 && !acpi_s2idle_vendor_amd())
579+
acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
580+
lps0_dsm_func_mask, lps0_dsm_guid);
581+
565582
list_for_each_entry(handler, &lps0_s2idle_devops_head, list_node) {
566583
if (handler->prepare)
567584
handler->prepare();
@@ -600,14 +617,14 @@ void acpi_s2idle_restore_early(void)
600617
ACPI_LPS0_EXIT_AMD :
601618
ACPI_LPS0_EXIT,
602619
lps0_dsm_func_mask, lps0_dsm_guid);
603-
if (lps0_dsm_func_mask_microsoft > 0)
620+
621+
if (lps0_dsm_func_mask_microsoft > 0) {
604622
acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT,
605623
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
606-
607-
/* Modern standby exit */
608-
if (lps0_dsm_func_mask_microsoft > 0)
624+
/* Modern Standby exit */
609625
acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT,
610626
lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
627+
}
611628

612629
/* Screen on */
613630
if (lps0_dsm_func_mask_microsoft > 0)

include/acpi/acpi_bus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ void acpi_initialize_hp_context(struct acpi_device *adev,
582582
void (*uevent)(struct acpi_device *, u32));
583583

584584
/* acpi_device.dev.bus == &acpi_bus_type */
585-
extern struct bus_type acpi_bus_type;
585+
extern const struct bus_type acpi_bus_type;
586586

587587
int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data);
588588
int acpi_dev_for_each_child(struct acpi_device *adev,

0 commit comments

Comments
 (0)