diff options
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/s6sy761.c | 2 | ||||
-rw-r--r-- | drivers/input/touchscreen/stmfts.c | 4 | ||||
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 24 |
3 files changed, 20 insertions, 10 deletions
diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c index 675efa93d444..b63d7fdf0cd2 100644 --- a/drivers/input/touchscreen/s6sy761.c +++ b/drivers/input/touchscreen/s6sy761.c @@ -2,7 +2,7 @@ // Samsung S6SY761 Touchscreen device driver // // Copyright (c) 2017 Samsung Electronics Co., Ltd. -// Copyright (c) 2017 Andi Shyti <andi.shyti@samsung.com> +// Copyright (c) 2017 Andi Shyti <andi@etezian.org> #include <asm/unaligned.h> #include <linux/delay.h> diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c index efdb1a75a163..704e99046916 100644 --- a/drivers/input/touchscreen/stmfts.c +++ b/drivers/input/touchscreen/stmfts.c @@ -2,7 +2,7 @@ // STMicroelectronics FTS Touchscreen device driver // // Copyright (c) 2017 Samsung Electronics Co., Ltd. -// Copyright (c) 2017 Andi Shyti <andi.shyti@samsung.com> +// Copyright (c) 2017 Andi Shyti <andi@etezian.org> #include <linux/delay.h> #include <linux/i2c.h> @@ -730,6 +730,7 @@ static int stmfts_probe(struct i2c_client *client, return err; pm_runtime_enable(&client->dev); + device_enable_async_suspend(&client->dev); return 0; } @@ -805,6 +806,7 @@ static struct i2c_driver stmfts_driver = { .name = STMFTS_DEV_NAME, .of_match_table = of_match_ptr(stmfts_of_match), .pm = &stmfts_pm_ops, + .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .probe = stmfts_probe, .remove = stmfts_remove, diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index aa77d243b786..c6cf90868503 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -54,6 +54,7 @@ #include <linux/usb.h> #include <linux/usb/input.h> #include <linux/hid.h> +#include <linux/mutex.h> static bool swap_xy; module_param(swap_xy, bool, 0644); @@ -107,6 +108,8 @@ struct usbtouch_usb { struct usb_interface *interface; struct input_dev *input; struct usbtouch_device_info *type; + struct mutex pm_mutex; /* serialize access to open/suspend */ + bool is_open; char name[128]; char phys[64]; void *priv; @@ -1450,6 +1453,7 @@ static int usbtouch_open(struct input_dev *input) if (r < 0) goto out; + mutex_lock(&usbtouch->pm_mutex); if (!usbtouch->type->irq_always) { if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) { r = -EIO; @@ -1458,7 +1462,9 @@ static int usbtouch_open(struct input_dev *input) } usbtouch->interface->needs_remote_wakeup = 1; + usbtouch->is_open = true; out_put: + mutex_unlock(&usbtouch->pm_mutex); usb_autopm_put_interface(usbtouch->interface); out: return r; @@ -1469,8 +1475,12 @@ static void usbtouch_close(struct input_dev *input) struct usbtouch_usb *usbtouch = input_get_drvdata(input); int r; + mutex_lock(&usbtouch->pm_mutex); if (!usbtouch->type->irq_always) usb_kill_urb(usbtouch->irq); + usbtouch->is_open = false; + mutex_unlock(&usbtouch->pm_mutex); + r = usb_autopm_get_interface(usbtouch->interface); usbtouch->interface->needs_remote_wakeup = 0; if (!r) @@ -1490,13 +1500,12 @@ static int usbtouch_suspend static int usbtouch_resume(struct usb_interface *intf) { struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); - struct input_dev *input = usbtouch->input; int result = 0; - mutex_lock(&input->mutex); - if (input->users || usbtouch->type->irq_always) + mutex_lock(&usbtouch->pm_mutex); + if (usbtouch->is_open || usbtouch->type->irq_always) result = usb_submit_urb(usbtouch->irq, GFP_NOIO); - mutex_unlock(&input->mutex); + mutex_unlock(&usbtouch->pm_mutex); return result; } @@ -1504,7 +1513,6 @@ static int usbtouch_resume(struct usb_interface *intf) static int usbtouch_reset_resume(struct usb_interface *intf) { struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); - struct input_dev *input = usbtouch->input; int err = 0; /* reinit the device */ @@ -1519,10 +1527,10 @@ static int usbtouch_reset_resume(struct usb_interface *intf) } /* restart IO if needed */ - mutex_lock(&input->mutex); - if (input->users) + mutex_lock(&usbtouch->pm_mutex); + if (usbtouch->is_open) err = usb_submit_urb(usbtouch->irq, GFP_NOIO); - mutex_unlock(&input->mutex); + mutex_unlock(&usbtouch->pm_mutex); return err; } |