HID: mcp2221: Set ACPI companion
authorHamish Martin <hamish.martin@alliedtelesis.co.nz>
Wed, 25 Oct 2023 03:55:12 +0000 (16:55 +1300)
committerJiri Kosina <jkosina@suse.cz>
Tue, 21 Nov 2023 08:30:22 +0000 (09:30 +0100)
In scenarios where an I2C device tree is defined in ACPI and exists off
the MCP2221 I2C bus, the devices could not be instantiated.
Mark the USB port that the MCP2221 is connected to as its ACPI companion
so that the USB device can be bound to the ACPI tree when enumerated.
With this change the downstream I2C tree devices can be instantiated on
ACPI systems.

Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-mcp2221.c

index 72883e0ce75758c948683b0cee7377ecfd5c19fa..90e23bba213062403c83d4ff5f331ba7ac78de29 100644 (file)
@@ -1154,6 +1154,7 @@ static int mcp2221_probe(struct hid_device *hdev,
        mcp->adapter.algo = &mcp_i2c_algo;
        mcp->adapter.retries = 1;
        mcp->adapter.dev.parent = &hdev->dev;
+       ACPI_COMPANION_SET(&mcp->adapter.dev, ACPI_COMPANION(hdev->dev.parent));
        snprintf(mcp->adapter.name, sizeof(mcp->adapter.name),
                        "MCP2221 usb-i2c bridge");