Commit b3e29642 authored by Jiri Kosina's avatar Jiri Kosina

Merge branch 'for-5.14/multitouch' into for-linus

- patch series that ensures that hid-multitouch driver disables touch and
  button-press reporting on hid-mt devices during suspend when the device is
  not configured as a wakeup-source, from Hans de Goede
parents 8f4ef88e 498d0ddc
...@@ -1497,6 +1497,13 @@ static void logi_dj_ll_stop(struct hid_device *hid) ...@@ -1497,6 +1497,13 @@ static void logi_dj_ll_stop(struct hid_device *hid)
dbg_hid("%s\n", __func__); dbg_hid("%s\n", __func__);
} }
static bool logi_dj_ll_may_wakeup(struct hid_device *hid)
{
struct dj_device *djdev = hid->driver_data;
struct dj_receiver_dev *djrcv_dev = djdev->dj_receiver_dev;
return hid_hw_may_wakeup(djrcv_dev->hidpp);
}
static struct hid_ll_driver logi_dj_ll_driver = { static struct hid_ll_driver logi_dj_ll_driver = {
.parse = logi_dj_ll_parse, .parse = logi_dj_ll_parse,
...@@ -1505,6 +1512,7 @@ static struct hid_ll_driver logi_dj_ll_driver = { ...@@ -1505,6 +1512,7 @@ static struct hid_ll_driver logi_dj_ll_driver = {
.open = logi_dj_ll_open, .open = logi_dj_ll_open,
.close = logi_dj_ll_close, .close = logi_dj_ll_close,
.raw_request = logi_dj_ll_raw_request, .raw_request = logi_dj_ll_raw_request,
.may_wakeup = logi_dj_ll_may_wakeup,
}; };
static int logi_dj_dj_event(struct hid_device *hdev, static int logi_dj_dj_event(struct hid_device *hdev,
......
...@@ -1768,7 +1768,8 @@ static int mt_suspend(struct hid_device *hdev, pm_message_t state) ...@@ -1768,7 +1768,8 @@ static int mt_suspend(struct hid_device *hdev, pm_message_t state)
struct mt_device *td = hid_get_drvdata(hdev); struct mt_device *td = hid_get_drvdata(hdev);
/* High latency is desirable for power savings during S3/S0ix */ /* High latency is desirable for power savings during S3/S0ix */
if (td->mtclass.quirks & MT_QUIRK_DISABLE_WAKEUP) if ((td->mtclass.quirks & MT_QUIRK_DISABLE_WAKEUP) ||
!hid_hw_may_wakeup(hdev))
mt_set_modes(hdev, HID_LATENCY_HIGH, false, false); mt_set_modes(hdev, HID_LATENCY_HIGH, false, false);
else else
mt_set_modes(hdev, HID_LATENCY_HIGH, true, true); mt_set_modes(hdev, HID_LATENCY_HIGH, true, true);
......
...@@ -1304,6 +1304,13 @@ static int usbhid_idle(struct hid_device *hid, int report, int idle, ...@@ -1304,6 +1304,13 @@ static int usbhid_idle(struct hid_device *hid, int report, int idle,
return hid_set_idle(dev, ifnum, report, idle); return hid_set_idle(dev, ifnum, report, idle);
} }
static bool usbhid_may_wakeup(struct hid_device *hid)
{
struct usb_device *dev = hid_to_usb_dev(hid);
return device_may_wakeup(&dev->dev);
}
struct hid_ll_driver usb_hid_driver = { struct hid_ll_driver usb_hid_driver = {
.parse = usbhid_parse, .parse = usbhid_parse,
.start = usbhid_start, .start = usbhid_start,
...@@ -1316,6 +1323,7 @@ struct hid_ll_driver usb_hid_driver = { ...@@ -1316,6 +1323,7 @@ struct hid_ll_driver usb_hid_driver = {
.raw_request = usbhid_raw_request, .raw_request = usbhid_raw_request,
.output_report = usbhid_output_report, .output_report = usbhid_output_report,
.idle = usbhid_idle, .idle = usbhid_idle,
.may_wakeup = usbhid_may_wakeup,
}; };
EXPORT_SYMBOL_GPL(usb_hid_driver); EXPORT_SYMBOL_GPL(usb_hid_driver);
......
...@@ -801,6 +801,7 @@ struct hid_driver { ...@@ -801,6 +801,7 @@ struct hid_driver {
* @raw_request: send raw report request to device (e.g. feature report) * @raw_request: send raw report request to device (e.g. feature report)
* @output_report: send output report to device * @output_report: send output report to device
* @idle: send idle request to device * @idle: send idle request to device
* @may_wakeup: return if device may act as a wakeup source during system-suspend
*/ */
struct hid_ll_driver { struct hid_ll_driver {
int (*start)(struct hid_device *hdev); int (*start)(struct hid_device *hdev);
...@@ -825,6 +826,7 @@ struct hid_ll_driver { ...@@ -825,6 +826,7 @@ struct hid_ll_driver {
int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len); int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len);
int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype); int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
bool (*may_wakeup)(struct hid_device *hdev);
}; };
extern struct hid_ll_driver i2c_hid_ll_driver; extern struct hid_ll_driver i2c_hid_ll_driver;
...@@ -1150,6 +1152,22 @@ static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle, ...@@ -1150,6 +1152,22 @@ static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle,
return 0; return 0;
} }
/**
* hid_may_wakeup - return if the hid device may act as a wakeup source during system-suspend
*
* @hdev: hid device
*/
static inline bool hid_hw_may_wakeup(struct hid_device *hdev)
{
if (hdev->ll_driver->may_wakeup)
return hdev->ll_driver->may_wakeup(hdev);
if (hdev->dev.parent)
return device_may_wakeup(hdev->dev.parent);
return false;
}
/** /**
* hid_hw_wait - wait for buffered io to complete * hid_hw_wait - wait for buffered io to complete
* *
......
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