Skip to content

Commit f64e427

Browse files
jwrdegoederafaeljw
authored andcommitted
ACPI: Fix selecting wrong ACPI fwnode for the iGPU on some Dell laptops
The Dell Latitude E6430 both with and without the optional NVidia dGPU has a bug in its ACPI tables which is causing Linux to assign the wrong ACPI fwnode / companion to the pci_device for the i915 iGPU. Specifically under the PCI root bridge there are these 2 ACPI Device()s : Scope (_SB.PCI0) { Device (GFX0) { Name (_ADR, 0x00020000) // _ADR: Address } ... Device (VID) { Name (_ADR, 0x00020000) // _ADR: Address ... Method (_DOS, 1, NotSerialized) // _DOS: Disable Output Switching { VDP8 = Arg0 VDP1 (One, VDP8) } Method (_DOD, 0, NotSerialized) // _DOD: Display Output Devices { ... } ... } } The non-functional GFX0 ACPI device is a problem, because this gets returned as ACPI companion-device by acpi_find_child_device() for the iGPU. This is a long standing problem and the i915 driver does use the ACPI companion for some things, but works fine without it. However since commit 63f534b ("ACPI: PCI: Rework acpi_get_pci_dev()") acpi_get_pci_dev() relies on the physical-node pointer in the acpi_device and that is set on the wrong acpi_device because of the wrong acpi_find_child_device() return. This breaks the ACPI video code, leading to non working backlight control in some cases. Add a type.backlight flag, mark ACPI video bus devices with this and make find_child_checks() return a higher score for children with this flag set, so that it picks the right companion-device. Fixes: 63f534b ("ACPI: PCI: Rework acpi_get_pci_dev()") Co-developed-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Cc: 6.1+ <[email protected]> # 6.1+ Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent b7bfaa7 commit f64e427

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

drivers/acpi/glue.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ static struct acpi_bus_type *acpi_get_bus_type(struct device *dev)
7575
}
7676

7777
#define FIND_CHILD_MIN_SCORE 1
78-
#define FIND_CHILD_MAX_SCORE 2
78+
#define FIND_CHILD_MID_SCORE 2
79+
#define FIND_CHILD_MAX_SCORE 3
7980

8081
static int match_any(struct acpi_device *adev, void *not_used)
8182
{
@@ -96,8 +97,17 @@ static int find_child_checks(struct acpi_device *adev, bool check_children)
9697
return -ENODEV;
9798

9899
status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
99-
if (status == AE_NOT_FOUND)
100+
if (status == AE_NOT_FOUND) {
101+
/*
102+
* Special case: backlight device objects without _STA are
103+
* preferred to other objects with the same _ADR value, because
104+
* it is more likely that they are actually useful.
105+
*/
106+
if (adev->pnp.type.backlight)
107+
return FIND_CHILD_MID_SCORE;
108+
100109
return FIND_CHILD_MIN_SCORE;
110+
}
101111

102112
if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
103113
return -ENODEV;

drivers/acpi/scan.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,9 +1370,12 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp,
13701370
* Some devices don't reliably have _HIDs & _CIDs, so add
13711371
* synthetic HIDs to make sure drivers can find them.
13721372
*/
1373-
if (acpi_is_video_device(handle))
1373+
if (acpi_is_video_device(handle)) {
13741374
acpi_add_id(pnp, ACPI_VIDEO_HID);
1375-
else if (acpi_bay_match(handle))
1375+
pnp->type.backlight = 1;
1376+
break;
1377+
}
1378+
if (acpi_bay_match(handle))
13761379
acpi_add_id(pnp, ACPI_BAY_HID);
13771380
else if (acpi_dock_match(handle))
13781381
acpi_add_id(pnp, ACPI_DOCK_HID);

include/acpi/acpi_bus.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ struct acpi_pnp_type {
230230
u32 hardware_id:1;
231231
u32 bus_address:1;
232232
u32 platform_id:1;
233-
u32 reserved:29;
233+
u32 backlight:1;
234+
u32 reserved:28;
234235
};
235236

236237
struct acpi_device_pnp {

0 commit comments

Comments
 (0)