From patchwork Thu Jul 17 08:00:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: prakash.burla@smartplayin.com X-Patchwork-Id: 4573301 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D9DED9F1D6 for ; Thu, 17 Jul 2014 08:09:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 081A220148 for ; Thu, 17 Jul 2014 08:09:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 11DA020120 for ; Thu, 17 Jul 2014 08:09:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755506AbaGQIHo (ORCPT ); Thu, 17 Jul 2014 04:07:44 -0400 Received: from smtp110.iad3a.emailsrvr.com ([173.203.187.110]:54038 "EHLO smtp110.iad3a.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755397AbaGQIGg convert rfc822-to-8bit (ORCPT ); Thu, 17 Jul 2014 04:06:36 -0400 X-Greylist: delayed 378 seconds by postgrey-1.27 at vger.kernel.org; Thu, 17 Jul 2014 04:06:36 EDT Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp30.relay.iad3a.emailsrvr.com (SMTP Server) with ESMTP id 77C0C380E1B; Thu, 17 Jul 2014 04:00:16 -0400 (EDT) X-Virus-Scanned: OK Received: from app30.wa-webapps.iad3a (relay.iad3a.rsapps.net [172.27.255.110]) by smtp30.relay.iad3a.emailsrvr.com (SMTP Server) with ESMTP id 4BEA7380E13; Thu, 17 Jul 2014 04:00:16 -0400 (EDT) Received: from smartplayin.com (localhost.localdomain [127.0.0.1]) by app30.wa-webapps.iad3a (Postfix) with ESMTP id 37FB18005B; Thu, 17 Jul 2014 04:00:16 -0400 (EDT) Received: by apps.rackspace.com (Authenticated sender: prakash.burla@smartplayin.com, from: prakash.burla@smartplayin.com) with HTTP; Thu, 17 Jul 2014 04:00:16 -0400 (EDT) Date: Thu, 17 Jul 2014 04:00:16 -0400 (EDT) Subject: RE: Fwd: [PATCH v1 3/3] usb: phy: msm: Do not do runtime pm if the phy is not idle From: prakash.burla@smartplayin.com To: srinivas.kandagatla@linaro.org Cc: linux-usb@vger.kernel.org, "Felipe Balbi" , regkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org MIME-Version: 1.0 Importance: Normal X-Priority: 3 (Normal) X-Type: plain In-Reply-To: References: <1404149311-11831-1-git-send-email-srinivas.kandagatla@linaro.org> <1404149397-11970-1-git-send-email-srinivas.kandagatla@linaro.org> Message-ID: <1405584016.22754439@apps.rackspace.com> X-Mailer: webmail7.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP tested-by: Prakash Burla This driver tested on AP806X with USB MSM-PHY Driver. -------------------------------------------------------------------- From: Srinivas Kandagatla Date: Mon, Jun 30, 2014 at 10:59 PM Subject: [PATCH v1 3/3] usb: phy: msm: Do not do runtime pm if the phy is not idle To: linux-usb@vger.kernel.org, Felipe Balbi Cc: gregkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla 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 --- drivers/usb/phy/phy-msm-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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");