linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: balbi@ti.com
Cc: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v1 3/3] usb: phy: msm: Do not do runtime pm if the phy is not idle
Date: Mon, 30 Jun 2014 19:06:52 +0100	[thread overview]
Message-ID: <53B1A73C.6080902@linaro.org> (raw)
In-Reply-To: <20140630175603.GO31442@saruman.home>


On 30/06/14 18:56, Felipe Balbi wrote:
> On Mon, Jun 30, 2014 at 06:29:57PM +0100, Srinivas Kandagatla wrote:
>> Use case is when the phy is configured in host mode and a usb device is
>> attached to board before bootup. On bootup, with the existing code and
>> runtime pm enabled, the driver would decrement the pm usage count
>> without checking the current state of the phy. This pm usage count
>> decrement would trigger the runtime pm which than would abort the
>> usb enumeration which was in progress. In my case a usb stick gets
>> detected and then immediatly the driver goes to low power mode which is
>> not correct.
>>
>> log:
>> [    1.631412] msm_hsusb_host 12520000.usb: EHCI Host Controller
>> [    1.636556] msm_hsusb_host 12520000.usb: new USB bus registered, assigned bus number 1
>> [    1.642563] msm_hsusb_host 12520000.usb: irq 220, io mem 0x12520000
>> [    1.658197] msm_hsusb_host 12520000.usb: USB 2.0 started, EHCI 1.00
>> [    1.659473] hub 1-0:1.0: USB hub found
>> [    1.663415] hub 1-0:1.0: 1 port detected
>> ...
>> [    1.973352] usb 1-1: new high-speed USB device number 2 using msm_hsusb_host
>> [    2.107707] usb-storage 1-1:1.0: USB Mass Storage device detected
>> [    2.108993] scsi0 : usb-storage 1-1:1.0
>> [    2.678341] msm_otg 12520000.phy: USB in low power mode
>> [    3.168977] usb 1-1: USB disconnect, device number 2
>>
>> This issue was detected on IFC6410 board.
>>
>> This patch fixes the intial runtime pm trigger by checking the phy
>> state and decrementing the pm use count only when the phy state is IDLE.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> ---
>>   drivers/usb/phy/phy-msm-usb.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
>> index 3bb559d..78cc870 100644
>> --- a/drivers/usb/phy/phy-msm-usb.c
>> +++ b/drivers/usb/phy/phy-msm-usb.c
>> @@ -1229,7 +1229,9 @@ static void msm_otg_sm_work(struct work_struct *w)
>>   			motg->chg_state = USB_CHG_STATE_UNDEFINED;
>>   			motg->chg_type = USB_INVALID_CHARGER;
>>   		}
>> -		pm_runtime_put_sync(otg->phy->dev);
>> +
>> +		if (otg->phy->state == OTG_STATE_B_IDLE)
>> +			pm_runtime_put_sync(otg->phy->dev);
>>   		break;
>>   	case OTG_STATE_B_PERIPHERAL:
>>   		dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n");
>
> does this need to go on this -rc or can it wait until v3.17 merge

Getting it to rc would be nice :-), but I will leave it up to you.

> window? Also, how far back should this be backported ?

This patch is required if runtime pm is activated.

--srini


>

  reply	other threads:[~2014-06-30 18:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 17:00 [RFC PATCH 0/3] ehci_msm fixes for APQ8064 USB host support Srinivas Kandagatla
     [not found] ` <1403110801-3790-1-git-send-email-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-06-18 17:00   ` [RFC PATCH 1/3] usb: Kconfig: make EHCI_MSM selectable for QCOM SOCs Srinivas Kandagatla
2014-06-18 17:01   ` [RFC PATCH 3/3] usb: phy: msm: Do not do runtime pm if the phy is not idle Srinivas Kandagatla
     [not found]     ` <1403110868-3924-1-git-send-email-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-06-27 15:54       ` Felipe Balbi
2014-06-30 10:23         ` Srinivas Kandagatla
     [not found]           ` <53B13AAF.7060909-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-06-30 17:13             ` Felipe Balbi
2014-06-30 17:28   ` [PATCH v1 0/3] ehci_msm fixes for APQ8064 USB host support Srinivas Kandagatla
2014-06-30 17:29     ` [PATCH v1 1/3] usb: Kconfig: make EHCI_MSM selectable for QCOM SOCs Srinivas Kandagatla
     [not found]       ` <1404149374-11887-1-git-send-email-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-06-30 17:55         ` Felipe Balbi
     [not found]           ` <20140630175500.GM31442-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-06-30 18:28             ` Alan Stern
2014-06-30 17:29     ` [PATCH v1 2/3] usb: phy: msm: Make phy_reset clk and reset line optional Srinivas Kandagatla
2014-06-30 17:29     ` [PATCH v1 3/3] usb: phy: msm: Do not do runtime pm if the phy is not idle Srinivas Kandagatla
2014-06-30 17:56       ` Felipe Balbi
2014-06-30 18:06         ` Srinivas Kandagatla [this message]
     [not found]       ` <CA+neC=MbFm4X4ccJdFgV20Lne-61nA6M56_S+-wEi5XR+2f29Q@mail.gmail.com>
     [not found]         ` <CA+neC=MbFm4X4ccJdFgV20Lne-61nA6M56_S+-wEi5XR+2f29Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-17  8:00           ` Fwd: " prakash.burla-edOiRQu9Xnj5XLMNweQjbQ
2014-06-18 17:01 ` [RFC PATCH 2/3] usb: phy: msm: Make phy_reset clk and reset line optional Srinivas Kandagatla
2014-06-26  8:03 ` [RFC PATCH 0/3] ehci_msm fixes for APQ8064 USB host support Srinivas Kandagatla
2014-06-30 17:13 ` Felipe Balbi
2014-06-30 17:15   ` Srinivas Kandagatla
     [not found] ` <CA+neC=N2JAXLEXXvR3cX_Co+Ykno=ibPeAj8Jt03aKWy_yObDw@mail.gmail.com>
2014-07-17  8:11   ` prakash.burla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53B1A73C.6080902@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).