Skip to content

Commit 5c7e02a

Browse files
jwrdegoedeJiri Kosina
authored andcommitted
HID: i2c-hid: Put ACPI enumerated devices in D3 on shutdown
The i2c-hid driver would quietly fail to probe the i2c-hid sensor-hub with an ACPI device-id of SMO91D0 every other boot. Specifically, the i2c_smbus_read_byte() "Make sure there is something at this address" check would fail every other boot. It seems that the BIOS does not properly reset/power-cycle the device leaving it in a confused state where it refuses to respond to i2c-xfers. On boots where probing the device failed, the driver-core puts the device in D3 after the probe-failure, which causes the probe to succeed the next boot. Putting the device in D3 from the shutdown-handler fixes the sensors not working every other boot. This has been tested on both a Lenovo Miix 2-10 and a Dell Venue 8 Pro 5830 both of which use an i2c-hid sensor-hub with an ACPI id of SMO91D0. Note that it is safe to call acpi_device_set_power() with a NULL pointer as first argument, so on none ACPI enumerated devices this change is a no-op. Cc: Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 1811977 commit 5c7e02a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/hid/i2c-hid/i2c-hid-core.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,11 @@ static void i2c_hid_acpi_enable_wakeup(struct device *dev)
943943
}
944944
}
945945

946+
static void i2c_hid_acpi_shutdown(struct device *dev)
947+
{
948+
acpi_device_set_power(ACPI_COMPANION(dev), ACPI_STATE_D3_COLD);
949+
}
950+
946951
static const struct acpi_device_id i2c_hid_acpi_match[] = {
947952
{"ACPI0C50", 0 },
948953
{"PNP0C50", 0 },
@@ -959,6 +964,8 @@ static inline int i2c_hid_acpi_pdata(struct i2c_client *client,
959964
static inline void i2c_hid_acpi_fix_up_power(struct device *dev) {}
960965

961966
static inline void i2c_hid_acpi_enable_wakeup(struct device *dev) {}
967+
968+
static inline void i2c_hid_acpi_shutdown(struct device *dev) {}
962969
#endif
963970

964971
#ifdef CONFIG_OF
@@ -1175,6 +1182,8 @@ static void i2c_hid_shutdown(struct i2c_client *client)
11751182

11761183
i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
11771184
free_irq(client->irq, ihid);
1185+
1186+
i2c_hid_acpi_shutdown(&client->dev);
11781187
}
11791188

11801189
#ifdef CONFIG_PM_SLEEP

0 commit comments

Comments
 (0)