msm: board-9615: Return result from vbus power routine
USB OTG driver maintains the state of VBUS using vbus_is_online flag
for pdata based vbus power routine. Hence remove the used vbus_is_online
flag here and return the result of VBUS power sequence to update the
vbus_is_online flag in OTG driver.
Change-Id: I8bea42d5ebc27fab6fc2ae8a0b9fb58bdbaf854a
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-9615.c b/arch/arm/mach-msm/board-9615.c
index e1ff3dd..700d165 100644
--- a/arch/arm/mach-msm/board-9615.c
+++ b/arch/arm/mach-msm/board-9615.c
@@ -245,10 +245,9 @@
#define USB_5V_EN 3
#define PM_USB_5V_EN PM8018_GPIO_PM_TO_SYS(USB_5V_EN)
-static void msm_hsusb_vbus_power(bool on)
+static int msm_hsusb_vbus_power(bool on)
{
- int rc;
- static bool vbus_is_on;
+ int rc = 0;
struct pm_gpio usb_vbus = {
.direction = PM_GPIO_DIR_OUT,
.pull = PM_GPIO_PULL_NO,
@@ -260,21 +259,18 @@
.inv_int_pol = 0,
};
- if (vbus_is_on == on)
- return;
-
if (on) {
rc = pm8xxx_gpio_config(PM_USB_5V_EN, &usb_vbus);
if (rc) {
pr_err("failed to config usb_5v_en gpio\n");
- return;
+ return rc;
}
rc = gpio_request(PM_USB_5V_EN,
"usb_5v_en");
if (rc < 0) {
pr_err("failed to request usb_5v_en gpio\n");
- return;
+ return rc;
}
rc = gpio_direction_output(PM_USB_5V_EN, 1);
@@ -284,13 +280,12 @@
goto free_usb_5v_en;
}
- vbus_is_on = true;
- return;
+ return rc;
}
gpio_set_value(PM_USB_5V_EN, 0);
free_usb_5v_en:
gpio_free(PM_USB_5V_EN);
- vbus_is_on = false;
+ return rc;
}
static int shelby_phy_init_seq[] = {
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index e03944d..664cc8f 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -149,7 +149,8 @@
* for msm_otg driver.
* @phy_init_seq: PHY configuration sequence. val, reg pairs
* terminated by -1.
- * @vbus_power: VBUS power on/off routine.
+ * @vbus_power: VBUS power on/off routine.It should return result
+ * as success(zero value) or failure(non-zero value).
* @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
* @mode: Supported mode (OTG/peripheral/host).
* @otg_control: OTG switch controlled by user/Id pin
@@ -166,7 +167,7 @@
*/
struct msm_otg_platform_data {
int *phy_init_seq;
- void (*vbus_power)(bool on);
+ int (*vbus_power)(bool on);
unsigned power_budget;
enum usb_mode_type mode;
enum otg_control_type otg_control;