From patchwork Mon Sep 8 10:10:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiran Kumar Raparthy X-Patchwork-Id: 36954 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EFFE02054D for ; Mon, 8 Sep 2014 10:11:25 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id ft15sf15035718pdb.7 for ; Mon, 08 Sep 2014 03:11:25 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=FDjKz3IcBAPHlbFlL3YYurHbfJECE1raBirWe3NDL9Q=; b=ZAqvpQvvHGNk25I9AMFoiUi/IgO0dAPGNeIVzfHWL02kgeDzQvUyIITfpkX6TYhjBR LypDRN9sgyuYl/ospjnv9dzeFO1CJCoWL7+g44DeRDB7WqOLJRmlinIADpxntsXE/d0c FFjpLnzu7o5YYLh2sXeC5VdN5zfk+Jq74XSwSEfUT2KntmMl2VFWOxViHrO3v5t8P+c0 fa3IwUXU1pOVZTX7nmtm2Fu7ic92vnstQItMWlb9bWkrEUM3UCLd/WW5TH290Md39EVh WFfLiLyMEYaYTztHbbeVf9Cj8UxcIccHAguDE4m0jM7hLaMSNdrGkaIJ56pSabtqKON7 Ekhw== X-Gm-Message-State: ALoCoQkc4hBsKcL7RTKrR1R9n5PNah1AmtPjKiDuV3yD55ScSRt9Rndrp5UACuHwSMTmK3g5oF/K X-Received: by 10.66.218.33 with SMTP id pd1mr15290494pac.8.1410171085223; Mon, 08 Sep 2014 03:11:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.230 with SMTP id j93ls1586054qgd.40.gmail; Mon, 08 Sep 2014 03:11:25 -0700 (PDT) X-Received: by 10.220.184.70 with SMTP id cj6mr24614706vcb.5.1410171085121; Mon, 08 Sep 2014 03:11:25 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id fa8si4348705vdc.20.2014.09.08.03.11.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Sep 2014 03:11:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so14645313vcb.25 for ; Mon, 08 Sep 2014 03:11:25 -0700 (PDT) X-Received: by 10.52.136.196 with SMTP id qc4mr20636487vdb.22.1410171085027; Mon, 08 Sep 2014 03:11:25 -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.45.67 with SMTP id uj3csp109318vcb; Mon, 8 Sep 2014 03:11:24 -0700 (PDT) X-Received: by 10.66.155.2 with SMTP id vs2mr44890328pab.60.1410171084147; Mon, 08 Sep 2014 03:11:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oa9si16810790pbb.137.2014.09.08.03.11.23 for ; Mon, 08 Sep 2014 03:11:24 -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 S1753315AbaIHKLW (ORCPT + 26 others); Mon, 8 Sep 2014 06:11:22 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:41044 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753219AbaIHKLU (ORCPT ); Mon, 8 Sep 2014 06:11:20 -0400 Received: by mail-pa0-f47.google.com with SMTP id ey11so4426392pad.20 for ; Mon, 08 Sep 2014 03:11:20 -0700 (PDT) X-Received: by 10.69.26.74 with SMTP id iw10mr18417749pbd.137.1410171080070; Mon, 08 Sep 2014 03:11:20 -0700 (PDT) Received: from c-krapar-linux.qualcomm.com ([202.46.23.54]) by mx.google.com with ESMTPSA id ke2sm8436813pbc.90.2014.09.08.03.11.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 08 Sep 2014 03:11:19 -0700 (PDT) From: Kiran Kumar Raparthy To: linux-kernel@vger.kernel.org Cc: Todd Poynor , Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Android Kernel Team , John Stultz , Sumit Semwal , Kiran Raparthy Subject: [RFC v3 2/2] usb: phy: Temporarily hold timed wakeup source on charger and disconnect events Date: Mon, 8 Sep 2014 15:40:49 +0530 Message-Id: <1410171049-14239-1-git-send-email-kiran.kumar@linaro.org> X-Mailer: git-send-email 1.8.2.1 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: kiran.kumar@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.180 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: Todd Poynor usb: phy: Temporarily hold timed wakeup source on charger and disconnect events It temporarily holds a timed wakeup source on USB disconnect events, to allow the rest of the system time to react to the USB disconnection (dropping host sessions, updating charger status, etc.) prior to re-allowing suspend Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: Android Kernel Team Cc: John Stultz Cc: Sumit Semwal Signed-off-by: Todd Poynor [kiran: Added context to commit message and addressed community feedback] Signed-off-by: Kiran Raparthy --- v3: * Modified the commit log. * Remove indirect function usb_temporary_hold_wsource and call __pm_wakeup_even directly. v2: * Implement usb_temporary_hold_wsource function in phy. v1: * Removed the refactoring logic from this integrated into main driver code. RFC: * Integrated the refactoring logic and logic to hold wakeupsource temporarily. drivers/usb/phy/otg-wakeupsource.c | 3 ++- include/linux/usb/phy.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/otg-wakeupsource.c b/drivers/usb/phy/otg-wakeupsource.c index d9a1720..7bc9657 100644 --- a/drivers/usb/phy/otg-wakeupsource.c +++ b/drivers/usb/phy/otg-wakeupsource.c @@ -47,7 +47,8 @@ static void otgws_handle_event(struct usb_phy *otgws_xceiv, unsigned long event) case USB_EVENT_NONE: case USB_EVENT_ID: case USB_EVENT_CHARGER: - __pm_relax(&otgws_xceiv->wsource); + __pm_wakeup_event(&otgws_xceiv->wsource, + msecs_to_jiffies(TEMPORARY_HOLD_TIME)); break; default: diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index c71cf15..f8f9f1f 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -12,6 +12,8 @@ #include #include +#define TEMPORARY_HOLD_TIME 2000 + enum usb_phy_interface { USBPHY_INTERFACE_MODE_UNKNOWN, USBPHY_INTERFACE_MODE_UTMI,