From patchwork Mon Jun 30 17:29:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 32789 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BC50D203F4 for ; Mon, 30 Jun 2014 17:30:05 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id il7sf17652543vcb.4 for ; Mon, 30 Jun 2014 10:30:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=RZU7OfrSQc8ukcZ/72YyN97oVVkTWTWynU3VuziqPIY=; b=m7uzdZWGI/x5F6ASsh+D5ClNBOwoW8+7PybsMLI4WK/XWd+e9mGrQOed6KamO5t9gk i6Ljyy7Id+dj5MmzCPs6ow7fd2uf9xZwuEG0+EXZHhpOFyYXyWI8NfgY+RtKqaB83+9R qShXaKHmtdJ6NqkkTB3e8CUnv1O98l8rJ8dOvdfu7T16tObuQZTVHHjGzVMDl7d7i31P YU0axz5P8Y29bd8GVuXoTajmc+336a0zJoB6JM3tb699dV2wGwH6e5VMH8uI22IKT3wT nY9IvK5NhfvQODj2oY1+Zo30CQM5KwtVkmNnCKaKXbdctnh1HDuU4ng2yRiRfENDpTT/ 8xHA== X-Gm-Message-State: ALoCoQmMzt9UgxlVzj3KSp2usyrR2t8m2Mk/bbiiQ3Wz5CEIyOBgXAYYHyiWKxXzUpPGY/pH55oa X-Received: by 10.236.35.5 with SMTP id t5mr1182563yha.9.1404149405542; Mon, 30 Jun 2014 10:30:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.145 with SMTP id o17ls1568611qga.37.gmail; Mon, 30 Jun 2014 10:30:05 -0700 (PDT) X-Received: by 10.52.103.97 with SMTP id fv1mr3041193vdb.42.1404149405428; Mon, 30 Jun 2014 10:30:05 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id fu13si10331205vdb.105.2014.06.30.10.30.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 10:30:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id hy10so7944002vcb.3 for ; Mon, 30 Jun 2014 10:30:05 -0700 (PDT) X-Received: by 10.220.53.72 with SMTP id l8mr39768234vcg.16.1404149405348; Mon, 30 Jun 2014 10:30:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp156898vcb; Mon, 30 Jun 2014 10:30:04 -0700 (PDT) X-Received: by 10.69.31.193 with SMTP id ko1mr53862933pbd.40.1404149404506; Mon, 30 Jun 2014 10:30:04 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sv10si23856365pab.201.2014.06.30.10.30.03; Mon, 30 Jun 2014 10:30:03 -0700 (PDT) Received-SPF: none (google.com: linux-arm-msm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756160AbaF3RaC (ORCPT + 3 others); Mon, 30 Jun 2014 13:30:02 -0400 Received: from mail-we0-f180.google.com ([74.125.82.180]:47509 "EHLO mail-we0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754910AbaF3RaB (ORCPT ); Mon, 30 Jun 2014 13:30:01 -0400 Received: by mail-we0-f180.google.com with SMTP id x48so8514806wes.11 for ; Mon, 30 Jun 2014 10:29:59 -0700 (PDT) X-Received: by 10.180.91.194 with SMTP id cg2mr31625138wib.12.1404149399894; Mon, 30 Jun 2014 10:29:59 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-2-99-228-46.as13285.net. [2.99.228.46]) by mx.google.com with ESMTPSA id ej2sm42597297wjd.21.2014.06.30.10.29.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Jun 2014 10:29:59 -0700 (PDT) From: Srinivas Kandagatla To: linux-usb@vger.kernel.org, Felipe Balbi Cc: gregkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v1 3/3] usb: phy: msm: Do not do runtime pm if the phy is not idle Date: Mon, 30 Jun 2014 18:29:57 +0100 Message-Id: <1404149397-11970-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1404149311-11831-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1404149311-11831-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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(-) 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");