From patchwork Wed Sep 24 13:47:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 37818 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9DB06204FF for ; Wed, 24 Sep 2014 13:48:40 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id b57sf3963071eek.2 for ; Wed, 24 Sep 2014 06:48:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=ca/IweHgcb+tSWffv/yawAvQye5MFmWcFJHTYvqXMto=; b=lQAunbDIUtYtI+V2lYPKkt0R3UQUWY5RjJ3gqkSy7+i2qRdHdXcZ9kVabEscZGjPz1 DmapRLnrB5gXlCC4PPGJVnaU2BvceerMTC0WkSdwojXwBHWFCT5I0/FBLVIn/XtyTJjy gVsHEVQbcNdx+A15SbUVfwJtModX91J7rkLVKPMRmnoD/ksjYZy8I0QLyved/1LHqn4k lS058uXcts7gmuYAAuk9wrk9JAJa5DKe7LtLNfqwHcWkFdTsaTVDVSwMj74XqtDmXR1G EiTf6i8vK6lzxN78PXDgYjnJ9rVov0oPjuj+siyhK1O43Hj92JZLFj9rhRbUWC/+6+Bg EBAw== X-Gm-Message-State: ALoCoQko6Kx8BG5tpsmYnfstUBwvYpsYVhlB1ovcY5OCEA/IKj6WFp6LhwuKZ4XzX8dHHNmJIbkY X-Received: by 10.112.167.138 with SMTP id zo10mr1027629lbb.3.1411566519799; Wed, 24 Sep 2014 06:48:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.5 with SMTP id m5ls162190laj.81.gmail; Wed, 24 Sep 2014 06:48:39 -0700 (PDT) X-Received: by 10.152.206.101 with SMTP id ln5mr6710965lac.46.1411566519696; Wed, 24 Sep 2014 06:48:39 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mx.google.com with ESMTPS id p5si22880572laf.101.2014.09.24.06.48.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 06:48:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z12so10572334lbi.22 for ; Wed, 24 Sep 2014 06:48:39 -0700 (PDT) X-Received: by 10.152.246.6 with SMTP id xs6mr6681790lac.56.1411566519625; Wed, 24 Sep 2014 06:48:39 -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.112.130.169 with SMTP id of9csp585153lbb; Wed, 24 Sep 2014 06:48:38 -0700 (PDT) X-Received: by 10.70.91.176 with SMTP id cf16mr11367034pdb.137.1411566515195; Wed, 24 Sep 2014 06:48:35 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id id8si26374912pad.155.2014.09.24.06.48.34 for ; Wed, 24 Sep 2014 06:48:35 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-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 S1753629AbaIXNrp (ORCPT + 27 others); Wed, 24 Sep 2014 09:47:45 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:38815 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753589AbaIXNrn (ORCPT ); Wed, 24 Sep 2014 09:47:43 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s8ODlhiX016231; Wed, 24 Sep 2014 08:47:43 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8ODlhA2009496; Wed, 24 Sep 2014 08:47:43 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Wed, 24 Sep 2014 08:47:42 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8ODlKDW015622; Wed, 24 Sep 2014 08:47:41 -0500 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 13/22] usb: phy: twl4030-usb: Remove asleep and rely on runtime PM Date: Wed, 24 Sep 2014 19:17:11 +0530 Message-ID: <1411566440-19169-14-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1411566440-19169-1-git-send-email-kishon@ti.com> References: <1411566440-19169-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: kishon@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 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: , From: Tony Lindgren There's no longer need for tracking the phy state in the driver with asleep, we can now rely on runtime PM. Signed-off-by: Tony Lindgren Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/phy-twl4030-usb.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index 519cc90..24ff3c6 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c @@ -163,7 +163,6 @@ struct twl4030_usb { int irq; enum omap_musb_vbus_id_status linkstat; bool vbus_supplied; - u8 asleep; struct delayed_work id_workaround_work; }; @@ -388,14 +387,13 @@ static int twl4030_usb_runtime_suspend(struct device *dev) struct twl4030_usb *twl = dev_get_drvdata(dev); dev_dbg(twl->dev, "%s\n", __func__); - if (twl->asleep) + if (pm_runtime_suspended(dev)) return 0; __twl4030_phy_power(twl, 0); regulator_disable(twl->usb1v5); regulator_disable(twl->usb1v8); regulator_disable(twl->usb3v1); - twl->asleep = 1; return 0; } @@ -406,7 +404,7 @@ static int twl4030_usb_runtime_resume(struct device *dev) int res; dev_dbg(twl->dev, "%s\n", __func__); - if (!twl->asleep) + if (pm_runtime_active(dev)) return 0; res = regulator_enable(twl->usb3v1); @@ -435,7 +433,6 @@ static int twl4030_usb_runtime_resume(struct device *dev) twl4030_usb_read(twl, PHY_CLK_CTRL) | (PHY_CLK_CTRL_CLOCKGATING_EN | PHY_CLK_CTRL_CLK32K_EN)); - twl->asleep = 0; return 0; } @@ -560,10 +557,10 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) */ if ((status == OMAP_MUSB_VBUS_VALID) || (status == OMAP_MUSB_ID_GROUND)) { - if (twl->asleep) + if (pm_runtime_suspended(twl->dev)) pm_runtime_get_sync(twl->dev); } else { - if (!twl->asleep) { + if (pm_runtime_active(twl->dev)) { pm_runtime_mark_last_busy(twl->dev); pm_runtime_put_autosuspend(twl->dev); } @@ -572,7 +569,7 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) } /* don't schedule during sleep - irq works right then */ - if (status == OMAP_MUSB_ID_GROUND && !twl->asleep) { + if (status == OMAP_MUSB_ID_GROUND && pm_runtime_active(twl->dev)) { cancel_delayed_work(&twl->id_workaround_work); schedule_delayed_work(&twl->id_workaround_work, HZ); } @@ -674,7 +671,6 @@ static int twl4030_usb_probe(struct platform_device *pdev) twl->irq = platform_get_irq(pdev, 0); twl->vbus_supplied = false; twl->linkstat = -EINVAL; - twl->asleep = 1; twl->linkstat = OMAP_MUSB_UNKNOWN; twl->phy.dev = twl->dev;