USB: dwc3-msm: Add sysfs entry to manually set speed
In some cases it is useful to manually force the controller to run at certain speeds (USB 2.0 or USB 3.0 speeds). For example, EUD (Emebedded USB Debug) can only work when controller is operating in USB 2.0 speeds. User can force USB 2.0 if EUD is required. Change-Id: Id022f372014a9218537bd1b5477d4555aff4578c Signed-off-by: Vamsi Krishna Samavedam <vskrishn@codeaurora.org>
This commit is contained in:
parent
e8869713e5
commit
4a4acb8a9e
1 changed files with 34 additions and 0 deletions
|
@ -2754,6 +2754,39 @@ static ssize_t mode_store(struct device *dev, struct device_attribute *attr,
|
|||
}
|
||||
|
||||
static DEVICE_ATTR_RW(mode);
|
||||
|
||||
static ssize_t speed_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct dwc3_msm *mdwc = dev_get_drvdata(dev);
|
||||
struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%s",
|
||||
usb_speed_string(dwc->max_hw_supp_speed));
|
||||
}
|
||||
|
||||
static ssize_t speed_store(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct dwc3_msm *mdwc = dev_get_drvdata(dev);
|
||||
struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
|
||||
enum usb_device_speed req_speed = USB_SPEED_UNKNOWN;
|
||||
|
||||
if (sysfs_streq(buf, "high"))
|
||||
req_speed = USB_SPEED_HIGH;
|
||||
else if (sysfs_streq(buf, "super"))
|
||||
req_speed = USB_SPEED_SUPER;
|
||||
|
||||
if (req_speed != USB_SPEED_UNKNOWN &&
|
||||
req_speed != dwc->max_hw_supp_speed) {
|
||||
dwc->maximum_speed = dwc->max_hw_supp_speed = req_speed;
|
||||
schedule_work(&mdwc->restart_usb_work);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
static DEVICE_ATTR_RW(speed);
|
||||
|
||||
static void msm_dwc3_perf_vote_work(struct work_struct *w);
|
||||
|
||||
static int dwc3_msm_probe(struct platform_device *pdev)
|
||||
|
@ -3097,6 +3130,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_speed);
|
||||
|
||||
host_mode = usb_get_dr_mode(&mdwc->dwc3->dev) == USB_DR_MODE_HOST;
|
||||
if (!dwc->is_drd && host_mode) {
|
||||
|
|
Loading…
Add table
Reference in a new issue