From patchwork Mon Apr 10 11:38:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 9672461 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD52B60231 for ; Mon, 10 Apr 2017 11:39:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C51D625D9E for ; Mon, 10 Apr 2017 11:39:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9F34281F9; Mon, 10 Apr 2017 11:39:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7414D25D9E for ; Mon, 10 Apr 2017 11:39:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753205AbdDJLix (ORCPT ); Mon, 10 Apr 2017 07:38:53 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:33812 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753168AbdDJLiv (ORCPT ); Mon, 10 Apr 2017 07:38:51 -0400 Received: by mail-lf0-f67.google.com with SMTP id x72so3702021lfb.1; Mon, 10 Apr 2017 04:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=/9hS3zMUZNjWtZXcAt7lbmaIxbythDzn7s/iMKoQWxg=; b=UEnicHf7hUfIor76quMKZwt+X6+5zNNFqEl6MXqsk//S+LwMb5txtqKv6LZ355x6LG YENxsjFBc348hqSjVViLauYHr/ioTrVsONpWOf68PsZUuvE/IqywxizGTsHMiwUEnhwY EXOOmAx79d4xpQpsTBc08ekyj/a8ccn+7s11abwEaHwEw2ovT61wu55gFqEwkZx33Ats lmirGUwm3JyPAY3Ajyft3K71TMdXD474unhzZoI074IJB+4RaF8x8yX+egAYIc+5bwRW AoUnwZ9K1LMunpALI2/fmaXpFX/4LXG077Q8R5lbONTztSTu69sRDcFC6wD0De1FKOIB EV7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=/9hS3zMUZNjWtZXcAt7lbmaIxbythDzn7s/iMKoQWxg=; b=UBld3cblK+uwi613gjulhLY4Cv1pPk88/sYD08l3j+cbKOWMXPkAlLeTq4EJkWn8+1 592gykzhGCJasMvQa93rTxiExXasbrFMfTHwvtF8Ag7498UvfBGrDouPAzAQy3SvSVLx GtE25vtM4U59mZVKdnvdAsfU0X2c4D3IWuGL6I7YhBb5HhAuNAe1syWArqbpbrO+sk3k lES5dvLzRRN+IVAEWGLCSWNaslW30IFFpcSeWB/Z6svNpm57E7krUlQINk/lhbu5FYfH 9H0T/WsN+hNolarB+IcVJkwBTfjve5m5dYMnROk93WK7zsL9FWxzjEC40uO84dPyWdmU nBTA== X-Gm-Message-State: AFeK/H3eL6WoPHE29gjUynV7b/r8Apz4x/dnoQQAF1r7JbuThDsCI9SVGK7pbaYSaxsnZg== X-Received: by 10.46.77.149 with SMTP id c21mr15107231ljd.80.1491824330174; Mon, 10 Apr 2017 04:38:50 -0700 (PDT) Received: from xi.terra (c-42c8e255.07-184-6d6c6d4.cust.bredbandsbolaget.se. [85.226.200.66]) by smtp.gmail.com with ESMTPSA id h1sm2828207lfk.33.2017.04.10.04.38.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Apr 2017 04:38:49 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1cxXee-0004XN-52; Mon, 10 Apr 2017 13:38:44 +0200 From: Johan Hovold To: "Rafael J. Wysocki" Cc: Len Brown , Pavel Machek , Alan Stern , Kevin Hilman , Tony Lindgren , Ulf Hansson , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/2] PM / Runtime: document autosuspend-helper side effects Date: Mon, 10 Apr 2017 13:38:25 +0200 Message-Id: <20170410113825.17399-2-johan@kernel.org> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170410113825.17399-1-johan@kernel.org> References: <20170410113825.17399-1-johan@kernel.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Document the fact that the autosuspend delay and enable helpers may change the power.usage_count and resume or suspend a device depending on the values of power.autosuspend_delay and power.use_autosuspend. Note that this means that a driver must disable autosuspend before disabling runtime pm on probe errors and on driver unbind if the device is to be suspended upon return (as a negative delay may otherwise keep the device resumed). Signed-off-by: Johan Hovold Acked-by: Tony Lindgren --- Documentation/power/runtime_pm.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 56a13b865927..ee69d7532172 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt @@ -478,15 +478,23 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: - set the power.last_busy field to the current time void pm_runtime_use_autosuspend(struct device *dev); - - set the power.use_autosuspend flag, enabling autosuspend delays + - set the power.use_autosuspend flag, enabling autosuspend delays; call + pm_runtime_get_sync if the flag was previously cleared and + power.autosuspend_delay is negative void pm_runtime_dont_use_autosuspend(struct device *dev); - - clear the power.use_autosuspend flag, disabling autosuspend delays + - clear the power.use_autosuspend flag, disabling autosuspend delays; + decrement the device's usage counter if the flag was previously set and + power.autosuspend_delay is negative; call pm_runtime_idle void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); - set the power.autosuspend_delay value to 'delay' (expressed in milliseconds); if 'delay' is negative then runtime suspends are - prevented + prevented; if power.use_autosuspend is set, pm_runtime_get_sync may be + called or the device's usage counter may be decremented and + pm_runtime_idle called depending on if power.autosuspend_delay is + changed to or from a negative value; if power.use_autosuspend is clear, + pm_runtime_idle is called unsigned long pm_runtime_autosuspend_expiration(struct device *dev); - calculate the time when the current autosuspend delay period will expire,