Loading drivers/usb/dwc3/dwc3-msm.c +34 −1 Original line number Original line Diff line number Diff line /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -235,6 +235,7 @@ struct dwc3_msm { struct pm_qos_request pm_qos_req_dma; struct pm_qos_request pm_qos_req_dma; struct delayed_work perf_vote_work; struct delayed_work perf_vote_work; struct delayed_work sdp_check; struct delayed_work sdp_check; bool usb_compliance_mode; struct mutex suspend_resume_mutex; struct mutex suspend_resume_mutex; }; }; Loading Loading @@ -2659,6 +2660,13 @@ static void check_for_sdp_connection(struct work_struct *w) if (!mdwc->vbus_active) if (!mdwc->vbus_active) return; return; /* USB 3.1 compliance equipment usually repoted as floating * charger as HS dp/dm lines are never connected. Do not * tear down USB stack if compliance parameter is set */ if (mdwc->usb_compliance_mode) return; /* floating D+/D- lines detected */ /* floating D+/D- lines detected */ if (dwc->gadget.state < USB_STATE_DEFAULT && if (dwc->gadget.state < USB_STATE_DEFAULT && dwc3_gadget_get_link_state(dwc) != DWC3_LINK_STATE_CMPLY) { dwc3_gadget_get_link_state(dwc) != DWC3_LINK_STATE_CMPLY) { Loading Loading @@ -2869,6 +2877,30 @@ static ssize_t xhci_link_compliance_store(struct device *dev, static DEVICE_ATTR_RW(xhci_link_compliance); static DEVICE_ATTR_RW(xhci_link_compliance); static ssize_t usb_compliance_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { struct dwc3_msm *mdwc = dev_get_drvdata(dev); return snprintf(buf, PAGE_SIZE, "%c\n", mdwc->usb_compliance_mode ? 'Y' : 'N'); } static ssize_t usb_compliance_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int ret = 0; struct dwc3_msm *mdwc = dev_get_drvdata(dev); ret = strtobool(buf, &mdwc->usb_compliance_mode); if (ret) return ret; return count; } static DEVICE_ATTR_RW(usb_compliance_mode); static int dwc3_msm_probe(struct platform_device *pdev) static int dwc3_msm_probe(struct platform_device *pdev) { { struct device_node *node = pdev->dev.of_node, *dwc3_node; struct device_node *node = pdev->dev.of_node, *dwc3_node; Loading Loading @@ -3220,6 +3252,7 @@ static int dwc3_msm_probe(struct platform_device *pdev) device_create_file(&pdev->dev, &dev_attr_mode); device_create_file(&pdev->dev, &dev_attr_mode); device_create_file(&pdev->dev, &dev_attr_speed); device_create_file(&pdev->dev, &dev_attr_speed); device_create_file(&pdev->dev, &dev_attr_xhci_link_compliance); device_create_file(&pdev->dev, &dev_attr_xhci_link_compliance); device_create_file(&pdev->dev, &dev_attr_usb_compliance_mode); host_mode = usb_get_dr_mode(&mdwc->dwc3->dev) == USB_DR_MODE_HOST; host_mode = usb_get_dr_mode(&mdwc->dwc3->dev) == USB_DR_MODE_HOST; if (host_mode || if (host_mode || Loading Loading
drivers/usb/dwc3/dwc3-msm.c +34 −1 Original line number Original line Diff line number Diff line /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -235,6 +235,7 @@ struct dwc3_msm { struct pm_qos_request pm_qos_req_dma; struct pm_qos_request pm_qos_req_dma; struct delayed_work perf_vote_work; struct delayed_work perf_vote_work; struct delayed_work sdp_check; struct delayed_work sdp_check; bool usb_compliance_mode; struct mutex suspend_resume_mutex; struct mutex suspend_resume_mutex; }; }; Loading Loading @@ -2659,6 +2660,13 @@ static void check_for_sdp_connection(struct work_struct *w) if (!mdwc->vbus_active) if (!mdwc->vbus_active) return; return; /* USB 3.1 compliance equipment usually repoted as floating * charger as HS dp/dm lines are never connected. Do not * tear down USB stack if compliance parameter is set */ if (mdwc->usb_compliance_mode) return; /* floating D+/D- lines detected */ /* floating D+/D- lines detected */ if (dwc->gadget.state < USB_STATE_DEFAULT && if (dwc->gadget.state < USB_STATE_DEFAULT && dwc3_gadget_get_link_state(dwc) != DWC3_LINK_STATE_CMPLY) { dwc3_gadget_get_link_state(dwc) != DWC3_LINK_STATE_CMPLY) { Loading Loading @@ -2869,6 +2877,30 @@ static ssize_t xhci_link_compliance_store(struct device *dev, static DEVICE_ATTR_RW(xhci_link_compliance); static DEVICE_ATTR_RW(xhci_link_compliance); static ssize_t usb_compliance_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { struct dwc3_msm *mdwc = dev_get_drvdata(dev); return snprintf(buf, PAGE_SIZE, "%c\n", mdwc->usb_compliance_mode ? 'Y' : 'N'); } static ssize_t usb_compliance_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int ret = 0; struct dwc3_msm *mdwc = dev_get_drvdata(dev); ret = strtobool(buf, &mdwc->usb_compliance_mode); if (ret) return ret; return count; } static DEVICE_ATTR_RW(usb_compliance_mode); static int dwc3_msm_probe(struct platform_device *pdev) static int dwc3_msm_probe(struct platform_device *pdev) { { struct device_node *node = pdev->dev.of_node, *dwc3_node; struct device_node *node = pdev->dev.of_node, *dwc3_node; Loading Loading @@ -3220,6 +3252,7 @@ static int dwc3_msm_probe(struct platform_device *pdev) device_create_file(&pdev->dev, &dev_attr_mode); device_create_file(&pdev->dev, &dev_attr_mode); device_create_file(&pdev->dev, &dev_attr_speed); device_create_file(&pdev->dev, &dev_attr_speed); device_create_file(&pdev->dev, &dev_attr_xhci_link_compliance); device_create_file(&pdev->dev, &dev_attr_xhci_link_compliance); device_create_file(&pdev->dev, &dev_attr_usb_compliance_mode); host_mode = usb_get_dr_mode(&mdwc->dwc3->dev) == USB_DR_MODE_HOST; host_mode = usb_get_dr_mode(&mdwc->dwc3->dev) == USB_DR_MODE_HOST; if (host_mode || if (host_mode || Loading