[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <172B0853-86A2-4253-B56D-8F7E716E5E0E@tecnorama.it>
Date: Mon, 15 May 2017 09:07:10 +0200
From: Moreno Bartalucci <moreno.bartalucci@...norama.it>
To: Bin Liu <b-liu@...com>
Cc: Tony Lindgren <tony@...mide.com>, Lars Melin <larsm17@...il.com>,
"linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Alessio Igor Bogani <abogani@...nel.org>
Subject: Re: [PATCH] usb-musb: keep VBUS on when device is disconnected
> Il giorno 12 mag 2017, alle ore 17:21, Bin Liu <b-liu@...com> ha scritto:
>
> […]
>
> Moreno, would you mind to test the patch below with your modem?
>
> […]
>>
>>> 8< --------------------
>>> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
>>> index 9c7ee26ef388..465281244596 100644
>>> --- a/drivers/usb/musb/musb_dsps.c
>>> +++ b/drivers/usb/musb/musb_dsps.c
>>> @@ -245,9 +245,14 @@ static int dsps_check_status(struct musb *musb, void *unused)
>>> dsps_mod_timer_optional(glue);
>>> break;
>>> case OTG_STATE_A_WAIT_BCON:
>>> + /* keep VBUS on for host-only mode */
>>> + if (musb->port_mode == MUSB_PORT_MODE_HOST) {
>>> + dsps_mod_timer_optional(glue);
>>> + break;
>>> + }
>>> musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
>>> skip_session = 1;
>>> - /* fall */
>>> + /* fall through */
>>>
>>> case OTG_STATE_A_IDLE:
>>> case OTG_STATE_B_IDLE:
Hello Bin,
I tested the above patch with my device and it seems to work correctly with the current mainline kernel.
I tested it with my “production” kernel as well (4.9.20) but, for it to work, I had to change it slightly.
This is what I tested for kernel 4.9.20:
--- a/drivers/usb/musb/musb_dsps.c 2017-05-15 08:40:23.000000000 +0200
+++ b/drivers/usb/musb/musb_dsps.c 2017-05-15 08:49:17.000000000 +0200
@@ -213,6 +213,12 @@ static int dsps_check_status(struct musb
msecs_to_jiffies(wrp->poll_timeout));
break;
case OTG_STATE_A_WAIT_BCON:
+ /* keep VBUS on for host-only mode */
+ if (musb->port_mode == MUSB_PORT_MODE_HOST) {
+ mod_timer(&glue->timer, jiffies +
+ msecs_to_jiffies(wrp->poll_timeout));
+ break;
+ }
musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
skip_session = 1;
/* fall */
In this form, it appears to work properly for 4.9.20 too.
Best regards,
Moreno
Powered by blists - more mailing lists