ODROID-C2: Add to turn on/off OTG vbus.

Change-Id: I58d1d257970680aa28163f5c0cc6ad705d7a201b
This commit is contained in:
Chris
2021-02-23 17:44:45 +09:00
parent 267189cffc
commit 18d416162e

28
drivers/amlogic/usb/dwc_otg/310/dwc_otg_attr.c Normal file → Executable file
View File

@@ -801,6 +801,32 @@ static ssize_t buspower_store(struct device *_dev,
DEVICE_ATTR(buspower, 0644, buspower_show, buspower_store);
/**
* Set the VBus Power
*/
static ssize_t vbus_store(struct device *_dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct platform_device *pdev = to_platform_device(_dev);
dwc_otg_device_t *otg_dev = g_dwc_otg_device[pdev->id];
uint32_t on = simple_strtoul(buf, NULL, 16);
if (dwc_otg_is_host_mode(otg_dev->core_if)) {
dwc_otg_set_vbus_power(otg_dev->core_if, on);
DWC_PRINTF("Set VBus Power : %d \n", on);
}
else {
DWC_PRINTF("Not in host mode. Nothing to do.");
}
return count;
}
DEVICE_ATTR(vbus, S_IWUSR, 0, vbus_store);
/**
* @todo Need to do more for suspend?
*/
@@ -1371,6 +1397,7 @@ void dwc_otg_attr_create(struct platform_device *pdev)
error = device_create_file(&pdev->dev, &dev_attr_hnp);
error = device_create_file(&pdev->dev, &dev_attr_srp);
error = device_create_file(&pdev->dev, &dev_attr_buspower);
error = device_create_file(&pdev->dev, &dev_attr_vbus);
error = device_create_file(&pdev->dev, &dev_attr_bussuspend);
error = device_create_file(&pdev->dev, &dev_attr_mode_ch_tim_en);
error = device_create_file(&pdev->dev, &dev_attr_fr_interval);
@@ -1425,6 +1452,7 @@ void dwc_otg_attr_remove(struct platform_device *pdev)
device_remove_file(&pdev->dev, &dev_attr_hnp);
device_remove_file(&pdev->dev, &dev_attr_srp);
device_remove_file(&pdev->dev, &dev_attr_buspower);
device_remove_file(&pdev->dev, &dev_attr_vbus);
device_remove_file(&pdev->dev, &dev_attr_bussuspend);
device_remove_file(&pdev->dev, &dev_attr_mode_ch_tim_en);
device_remove_file(&pdev->dev, &dev_attr_fr_interval);