Skip to content

Commit b3e2964

Browse files
author
Jiri Kosina
committed
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
2 parents 8f4ef88 + 498d0dd commit b3e2964

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

drivers/hid/hid-logitech-dj.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,13 @@ static void logi_dj_ll_stop(struct hid_device *hid)
14971497
dbg_hid("%s\n", __func__);
14981498
}
14991499

1500+
static bool logi_dj_ll_may_wakeup(struct hid_device *hid)
1501+
{
1502+
struct dj_device *djdev = hid->driver_data;
1503+
struct dj_receiver_dev *djrcv_dev = djdev->dj_receiver_dev;
1504+
1505+
return hid_hw_may_wakeup(djrcv_dev->hidpp);
1506+
}
15001507

15011508
static struct hid_ll_driver logi_dj_ll_driver = {
15021509
.parse = logi_dj_ll_parse,
@@ -1505,6 +1512,7 @@ static struct hid_ll_driver logi_dj_ll_driver = {
15051512
.open = logi_dj_ll_open,
15061513
.close = logi_dj_ll_close,
15071514
.raw_request = logi_dj_ll_raw_request,
1515+
.may_wakeup = logi_dj_ll_may_wakeup,
15081516
};
15091517

15101518
static int logi_dj_dj_event(struct hid_device *hdev,

drivers/hid/hid-multitouch.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,8 @@ static int mt_suspend(struct hid_device *hdev, pm_message_t state)
17681768
struct mt_device *td = hid_get_drvdata(hdev);
17691769

17701770
/* High latency is desirable for power savings during S3/S0ix */
1771-
if (td->mtclass.quirks & MT_QUIRK_DISABLE_WAKEUP)
1771+
if ((td->mtclass.quirks & MT_QUIRK_DISABLE_WAKEUP) ||
1772+
!hid_hw_may_wakeup(hdev))
17721773
mt_set_modes(hdev, HID_LATENCY_HIGH, false, false);
17731774
else
17741775
mt_set_modes(hdev, HID_LATENCY_HIGH, true, true);

drivers/hid/usbhid/hid-core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,13 @@ static int usbhid_idle(struct hid_device *hid, int report, int idle,
13041304
return hid_set_idle(dev, ifnum, report, idle);
13051305
}
13061306

1307+
static bool usbhid_may_wakeup(struct hid_device *hid)
1308+
{
1309+
struct usb_device *dev = hid_to_usb_dev(hid);
1310+
1311+
return device_may_wakeup(&dev->dev);
1312+
}
1313+
13071314
struct hid_ll_driver usb_hid_driver = {
13081315
.parse = usbhid_parse,
13091316
.start = usbhid_start,
@@ -1316,6 +1323,7 @@ struct hid_ll_driver usb_hid_driver = {
13161323
.raw_request = usbhid_raw_request,
13171324
.output_report = usbhid_output_report,
13181325
.idle = usbhid_idle,
1326+
.may_wakeup = usbhid_may_wakeup,
13191327
};
13201328
EXPORT_SYMBOL_GPL(usb_hid_driver);
13211329

include/linux/hid.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ struct hid_driver {
801801
* @raw_request: send raw report request to device (e.g. feature report)
802802
* @output_report: send output report to device
803803
* @idle: send idle request to device
804+
* @may_wakeup: return if device may act as a wakeup source during system-suspend
804805
*/
805806
struct hid_ll_driver {
806807
int (*start)(struct hid_device *hdev);
@@ -825,6 +826,7 @@ struct hid_ll_driver {
825826
int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len);
826827

827828
int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
829+
bool (*may_wakeup)(struct hid_device *hdev);
828830
};
829831

830832
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,
11501152
return 0;
11511153
}
11521154

1155+
/**
1156+
* hid_may_wakeup - return if the hid device may act as a wakeup source during system-suspend
1157+
*
1158+
* @hdev: hid device
1159+
*/
1160+
static inline bool hid_hw_may_wakeup(struct hid_device *hdev)
1161+
{
1162+
if (hdev->ll_driver->may_wakeup)
1163+
return hdev->ll_driver->may_wakeup(hdev);
1164+
1165+
if (hdev->dev.parent)
1166+
return device_may_wakeup(hdev->dev.parent);
1167+
1168+
return false;
1169+
}
1170+
11531171
/**
11541172
* hid_hw_wait - wait for buffered io to complete
11551173
*

0 commit comments

Comments
 (0)