diff --git a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_attr.c b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_attr.c old mode 100644 new mode 100755 index 5a55cf228fbe..0774876c24bd --- a/drivers/amlogic/usb/dwc_otg/310/dwc_otg_attr.c +++ b/drivers/amlogic/usb/dwc_otg/310/dwc_otg_attr.c @@ -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);