From patchwork Thu Nov 7 09:40:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 3151881 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CA0BFBEEB2 for ; Thu, 7 Nov 2013 09:40:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9949620586 for ; Thu, 7 Nov 2013 09:40:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 548E0204D1 for ; Thu, 7 Nov 2013 09:40:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753399Ab3KGJkJ (ORCPT ); Thu, 7 Nov 2013 04:40:09 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:42977 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753027Ab3KGJkG (ORCPT ); Thu, 7 Nov 2013 04:40:06 -0500 Received: by mail-wi0-f169.google.com with SMTP id cb5so246649wib.2 for ; Thu, 07 Nov 2013 01:40:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iOZzVRVhFdWdIiXXDiQk7Z2wXbnHAmhD6wTBgzvFEyE=; b=C0b5OEi6Ge9HtGvQ/G7BmOquOv0H+bkhhfc53awUfeLgukuPK7I9tI3RVNGZ96j2HN 4uX4SqSYptRtvBYUWwCbbsBIHqGM2mZiZ7H1G47pi+z+MDgg6wTvHk10HUaBDLToVHNP qEJmjaNHnda01GaQGySu/c+k7dPLA99kMNvkGtXqu5EGHUrlpNLlj1WiB+yoYYGAM+id wBtUFEePVVOr1xbzK7XW8zjTGz6tMa4fDIRia/7BKoiJdAxDNfF2mP9penUZFJx2E8Xq lCieqLKstv4s26+Bc/gbX9nvqY1x/KCPJc7Qwr83pxkxIaIWvg2z4Z8ghCVKQnacBtIn byrw== X-Gm-Message-State: ALoCoQklpfOcJxiFsoms5oU+Ifaz/bGy0v+pxPrt2t/30LmckGBIngHe801BNrvKXCwjnqUEKoHS X-Received: by 10.180.13.142 with SMTP id h14mr1858534wic.3.1383817204778; Thu, 07 Nov 2013 01:40:04 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id fu1sm33664373wib.8.2013.11.07.01.40.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 01:40:04 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: Ulf Hansson , Tomi Valkeinen , Kevin Hilman , Alan Stern Subject: [PATCH] PM / Runtime: Update documentation around probe|remove|suspend Date: Thu, 7 Nov 2013 10:40:00 +0100 Message-Id: <1383817200-3004-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PM core and driver core has changed some behavior regarding use of runtime PM. Update the documentation accordingly. Cc: Tomi Valkeinen Cc: Kevin Hilman Cc: Alan Stern Signed-off-by: Ulf Hansson --- Documentation/power/runtime_pm.txt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 0f54333..0f62cc7 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt @@ -547,13 +547,11 @@ helper functions described in Section 4. In that case, pm_runtime_resume() should be used. Of course, for this purpose the device's runtime PM has to be enabled earlier by calling pm_runtime_enable(). -If the device bus type's or driver's ->probe() callback runs -pm_runtime_suspend() or pm_runtime_idle() or their asynchronous counterparts, -they will fail returning -EAGAIN, because the device's usage counter is -incremented by the driver core before executing ->probe(). Still, it may be -desirable to suspend the device as soon as ->probe() has finished, so the driver -core uses pm_runtime_put_sync() to invoke the subsystem-level idle callback for -the device at that time. +It may be desirable to suspend the device once ->probe() has finished. +Therefore the driver core uses the asyncronous pm_request_idle() to submit a +request to execute the subsystem-level idle callback for the device at that +time. A driver which make use of the runtime autosuspend feature, may want to +update the last busy mark before it finalilizes it's ->probe(). Moreover, the driver core prevents runtime PM callbacks from racing with the bus notifier callback in __device_release_driver(), which is necessary, because the @@ -632,7 +630,10 @@ The PM core always increments the runtime usage counter before calling the Hence disabling runtime PM temporarily like this will not cause any runtime suspend attempts to be permanently lost. If the usage count goes to zero following the return of the ->resume() callback, the ->runtime_idle() callback -will be invoked as usual. +will be invoked as usual. Do note that PM core use the asyncronous +pm_runtime_put() when decrementing the usage counter, which means it don't wait +for the device to become inactive before it moves on and handles the next +device from the list. On some systems, however, system sleep is not entered through a global firmware or hardware operation. Instead, all hardware components are put into low-power @@ -656,7 +657,7 @@ out the following operations: __pm_runtime_disable() with 'false' as the second argument for every device right before executing the subsystem-level .suspend_late() callback for it. - * During system resume it calls pm_runtime_enable() and pm_runtime_put_sync() + * During system resume it calls pm_runtime_enable() and pm_runtime_put() for every device right after executing the subsystem-level .resume_early() callback and right after executing the subsystem-level .resume() callback for it, respectively.