diff mbox

[6/7] usb: musb: omap2430: turn off vbus on cable disconnect

Message ID 1362877681-8102-7-git-send-email-notasas@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Grazvydas Ignotas March 10, 2013, 1:08 a.m. UTC
On USB_EVENT_ID event the musb glue enables VBUS by calling
omap2430_musb_set_vbus(musb, 1) that sets the session bit, but on
USB_EVENT_NONE reverse action is never made, and that breaks PM.

Disable VBUS unconditionally on USB_EVENT_NONE to be sure musb
session is ended on cable unplug so that PM works.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
 drivers/usb/musb/omap2430.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Kishon Vijay Abraham I March 12, 2013, 1:37 p.m. UTC | #1
Hi,

On Sunday 10 March 2013 06:38 AM, Grazvydas Ignotas wrote:
> On USB_EVENT_ID event the musb glue enables VBUS by calling
> omap2430_musb_set_vbus(musb, 1) that sets the session bit, but on
> USB_EVENT_NONE reverse action is never made, and that breaks PM.
>
> Disable VBUS unconditionally on USB_EVENT_NONE to be sure musb
> session is ended on cable unplug so that PM works.
>
> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
> ---
>   drivers/usb/musb/omap2430.c |    1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index 2a39c11..d430677 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -296,6 +296,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>   			pm_runtime_put_autosuspend(dev);
>   		}
>
> +		omap2430_musb_set_vbus(musb, 0);
>   		if (data->interface_type == MUSB_INTERFACE_UTMI) {
>   			if (musb->xceiv->otg->set_vbus)
>   				otg_set_vbus(musb->xceiv->otg, 0);
Shouldn't this otg_set_vbus be done inside omap2430_musb_set_vbus? Any 
idea why they were doing this only for UTMI?

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Grazvydas Ignotas March 12, 2013, 3:03 p.m. UTC | #2
On Tue, Mar 12, 2013 at 3:37 PM, kishon <kishon@ti.com> wrote:
> Hi,
>
>
> On Sunday 10 March 2013 06:38 AM, Grazvydas Ignotas wrote:
>>
>> On USB_EVENT_ID event the musb glue enables VBUS by calling
>> omap2430_musb_set_vbus(musb, 1) that sets the session bit, but on
>> USB_EVENT_NONE reverse action is never made, and that breaks PM.
>>
>> Disable VBUS unconditionally on USB_EVENT_NONE to be sure musb
>> session is ended on cable unplug so that PM works.
>>
>> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
>> ---
>>   drivers/usb/musb/omap2430.c |    1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
>> index 2a39c11..d430677 100644
>> --- a/drivers/usb/musb/omap2430.c
>> +++ b/drivers/usb/musb/omap2430.c
>> @@ -296,6 +296,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue
>> *glue)
>>                         pm_runtime_put_autosuspend(dev);
>>                 }
>>
>> +               omap2430_musb_set_vbus(musb, 0);
>>                 if (data->interface_type == MUSB_INTERFACE_UTMI) {
>>                         if (musb->xceiv->otg->set_vbus)
>>                                 otg_set_vbus(musb->xceiv->otg, 0);
>
> Shouldn't this otg_set_vbus be done inside omap2430_musb_set_vbus? Any idea
> why they were doing this only for UTMI?

I would think so too, there is otg_set_vbus() in
omap2430_musb_set_vbus() for enable but not for disable.
I don't know history of this code and didn't want to break existing
functionality.

>
> Thanks
> Kishon
diff mbox

Patch

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 2a39c11..d430677 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -296,6 +296,7 @@  static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 			pm_runtime_put_autosuspend(dev);
 		}
 
+		omap2430_musb_set_vbus(musb, 0);
 		if (data->interface_type == MUSB_INTERFACE_UTMI) {
 			if (musb->xceiv->otg->set_vbus)
 				otg_set_vbus(musb->xceiv->otg, 0);