Commit f3d3eab6 authored by Hans de Goede's avatar Hans de Goede Committed by Jiri Kosina

HID: i2c: Call acpi_device_fix_up_power for ACPI-enumerated devices

For ACPI devices which do not have a _PSC method, the ACPI subsys cannot
query their initial state at boot, so these devices are assumed to have
been put in D0 by the BIOS, but for touchscreens that is not always true.

This commit adds a call to acpi_device_fix_up_power to explicitly put
devices without a _PSC method into D0 state (for devices with a _PSC
method it is a nop). Note we only need to do this on probe, after a
resume the ACPI subsys knows the device is in D3 and will properly
put it in D0.

This fixes the SIS0817 i2c-hid touchscreen on a Peaq C1010 2-in-1
device failing to probe with a "hid_descr_cmd failed" error.
Acked-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 76dd1fbe
...@@ -897,6 +897,15 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client, ...@@ -897,6 +897,15 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
return 0; return 0;
} }
static void i2c_hid_acpi_fix_up_power(struct device *dev)
{
acpi_handle handle = ACPI_HANDLE(dev);
struct acpi_device *adev;
if (handle && acpi_bus_get_device(handle, &adev) == 0)
acpi_device_fix_up_power(adev);
}
static const struct acpi_device_id i2c_hid_acpi_match[] = { static const struct acpi_device_id i2c_hid_acpi_match[] = {
{"ACPI0C50", 0 }, {"ACPI0C50", 0 },
{"PNP0C50", 0 }, {"PNP0C50", 0 },
...@@ -909,6 +918,8 @@ static inline int i2c_hid_acpi_pdata(struct i2c_client *client, ...@@ -909,6 +918,8 @@ static inline int i2c_hid_acpi_pdata(struct i2c_client *client,
{ {
return -ENODEV; return -ENODEV;
} }
static inline void i2c_hid_acpi_fix_up_power(struct device *dev) {}
#endif #endif
#ifdef CONFIG_OF #ifdef CONFIG_OF
...@@ -1030,6 +1041,8 @@ static int i2c_hid_probe(struct i2c_client *client, ...@@ -1030,6 +1041,8 @@ static int i2c_hid_probe(struct i2c_client *client,
if (ret < 0) if (ret < 0)
goto err_regulator; goto err_regulator;
i2c_hid_acpi_fix_up_power(&client->dev);
pm_runtime_get_noresume(&client->dev); pm_runtime_get_noresume(&client->dev);
pm_runtime_set_active(&client->dev); pm_runtime_set_active(&client->dev);
pm_runtime_enable(&client->dev); pm_runtime_enable(&client->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment