summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/dln2.c
diff options
context:
space:
mode:
authorOctavian Purdila <octavian.purdila@intel.com>2015-01-19 06:51:36 -0500
committerLee Jones <lee.jones@linaro.org>2015-01-22 10:56:01 -0500
commit3daa122d6b710762aff5fa6aae534ed7cc45c2d6 (patch)
tree603f21f381dd8f8a10379ff4e8a5e31e6c3d2059 /drivers/mfd/dln2.c
parentee231aeed9dc43f3755a3d654fb3bafcb11d4e88 (diff)
mfd: dln2: Add suspend/resume functionality
Without suspend/resume functionality in the USB driver the USB core will disconnect and reconnect the DLN2 port and because the GPIO framework does not yet support removal of an in-use controller a suspend/resume operation will result in a crash. This patch provides suspend and resume functions for the DLN2 driver so that the above scenario is avoided, if the host controller does not drop VBUS during suspend, since in this case the device state is preserved. We chose not implemented reset_resume so that if the host controller does drop VBUS the resume path will go through above the disconnect/reconnect process since it is probably better to fix the GPIO framework disconnect issue then to save and restore the device state for every driver. Signed-off-by: Octavian Purdila <octavian.purdila@intel.com> Reviewed-by: Johan Hovold <johan@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/dln2.c')
-rw-r--r--drivers/mfd/dln2.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
index 8311820cde45..1be9bd1c046d 100644
--- a/drivers/mfd/dln2.c
+++ b/drivers/mfd/dln2.c
@@ -791,6 +791,24 @@ out_free:
791 return ret; 791 return ret;
792} 792}
793 793
794static int dln2_suspend(struct usb_interface *iface, pm_message_t message)
795{
796 struct dln2_dev *dln2 = usb_get_intfdata(iface);
797
798 dln2_stop(dln2);
799
800 return 0;
801}
802
803static int dln2_resume(struct usb_interface *iface)
804{
805 struct dln2_dev *dln2 = usb_get_intfdata(iface);
806
807 dln2->disconnect = false;
808
809 return dln2_start_rx_urbs(dln2, GFP_NOIO);
810}
811
794static const struct usb_device_id dln2_table[] = { 812static const struct usb_device_id dln2_table[] = {
795 { USB_DEVICE(0xa257, 0x2013) }, 813 { USB_DEVICE(0xa257, 0x2013) },
796 { } 814 { }
@@ -803,6 +821,8 @@ static struct usb_driver dln2_driver = {
803 .probe = dln2_probe, 821 .probe = dln2_probe,
804 .disconnect = dln2_disconnect, 822 .disconnect = dln2_disconnect,
805 .id_table = dln2_table, 823 .id_table = dln2_table,
824 .suspend = dln2_suspend,
825 .resume = dln2_resume,
806}; 826};
807 827
808module_usb_driver(dln2_driver); 828module_usb_driver(dln2_driver);