From patchwork Wed Sep 24 13:47:09 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: 37832 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5ECA0204FF for ; Wed, 24 Sep 2014 13:54:37 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id y10sf3669707wgg.2 for ; Wed, 24 Sep 2014 06:54:36 -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=x9xarrkzP2XCX8xtwCP7eCD4HHKCY++GvgQA2lDCuLM=; b=PYytAOp1NEPFu5AzcoWfMD702WgC8p0ljGjfyA1rhar1JWQpQ28fnx3gFVM8L2ubhZ YiQtg4mqYz2rmbGVrnhaD6p5l7e+Zo5RbgPbS3RxhzZ1daha3g7KxOex5AZrtdtJxuJU E/uYqogfQey2mC+YozcspHrScxc3fMIPopT3JJfykjtMVM8mCSw7AaF+uwWrsIvvZCiJ sP7u/ZeWRcfu3crIt9VZUnpIurFuZdYIYKdWHrAmVLEaHvFGZVLFwADQGqjH5A+JGVC9 wcDGUuHa2NapdvZCOULPNxJayrCPGzCclMjiMIJ2xZc0rt1vspNjWYHBt6F+Y771FQgH VdOQ== X-Gm-Message-State: ALoCoQmKlY7CnJdlZtVSnLujAt7bcilDKN3rplg5hNTn+toGBRH60DBNTyGZ5KVk/MUGC8yzMfdD X-Received: by 10.112.166.40 with SMTP id zd8mr405527lbb.17.1411566876267; Wed, 24 Sep 2014 06:54:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.170 with SMTP id l10ls147840lah.18.gmail; Wed, 24 Sep 2014 06:54:36 -0700 (PDT) X-Received: by 10.152.170.167 with SMTP id an7mr3419946lac.94.1411566876055; Wed, 24 Sep 2014 06:54:36 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx.google.com with ESMTPS id 2si22901390lay.98.2014.09.24.06.54.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 06:54:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id gb8so1147886lab.16 for ; Wed, 24 Sep 2014 06:54:35 -0700 (PDT) X-Received: by 10.112.130.226 with SMTP id oh2mr3134715lbb.100.1411566875718; Wed, 24 Sep 2014 06:54:35 -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 of9csp585965lbb; Wed, 24 Sep 2014 06:54:34 -0700 (PDT) X-Received: by 10.66.141.77 with SMTP id rm13mr9172084pab.91.1411566873907; Wed, 24 Sep 2014 06:54:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qg8si8090394pdb.238.2014.09.24.06.54.32 for ; Wed, 24 Sep 2014 06:54:33 -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 S1754216AbaIXNya (ORCPT + 27 others); Wed, 24 Sep 2014 09:54:30 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:50995 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753528AbaIXNrk (ORCPT ); Wed, 24 Sep 2014 09:47:40 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s8ODldsm031901; Wed, 24 Sep 2014 08:47:39 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8ODldZn004952; Wed, 24 Sep 2014 08:47:39 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Wed, 24 Sep 2014 08:47:39 -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 s8ODlKDU015622; Wed, 24 Sep 2014 08:47:38 -0500 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 11/22] usb: phy: twl4030-usb: Simplify phy init to use runtime PM Date: Wed, 24 Sep 2014 19:17:09 +0530 Message-ID: <1411566440-19169-12-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.215.43 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 We can now let the interrupt and delayed work do all that's needed with runtime PM. Signed-off-by: Tony Lindgren Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/phy-twl4030-usb.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index bc28ecc..a292db0 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c @@ -471,16 +471,8 @@ static int twl4030_phy_power_on(struct phy *phy) twl4030_usb_set_mode(twl, twl->usb_mode); if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_i2c_access(twl, 0); + schedule_delayed_work(&twl->id_workaround_work, 0); - /* - * XXX When VBUS gets driven after musb goes to A mode, - * ID_PRES related interrupts no longer arrive, why? - * Register itself is updated fine though, so we must poll. - */ - if (twl->linkstat == OMAP_MUSB_ID_GROUND) { - cancel_delayed_work(&twl->id_workaround_work); - schedule_delayed_work(&twl->id_workaround_work, HZ); - } return 0; } @@ -612,16 +604,9 @@ static void twl4030_id_workaround_work(struct work_struct *work) static int twl4030_phy_init(struct phy *phy) { struct twl4030_usb *twl = phy_get_drvdata(phy); - enum omap_musb_vbus_id_status status; pm_runtime_get_sync(twl->dev); - status = twl4030_usb_linkstat(twl); - twl->linkstat = status; - - if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) - omap_musb_mailbox(twl->linkstat); - - sysfs_notify(&twl->dev->kobj, NULL, "vbus"); + schedule_delayed_work(&twl->id_workaround_work, 0); pm_runtime_mark_last_busy(twl->dev); pm_runtime_put_autosuspend(twl->dev); @@ -698,6 +683,7 @@ static int twl4030_usb_probe(struct platform_device *pdev) twl->dev = &pdev->dev; twl->irq = platform_get_irq(pdev, 0); twl->vbus_supplied = false; + twl->linkstat = -EINVAL; twl->asleep = 1; twl->linkstat = OMAP_MUSB_UNKNOWN;