From patchwork Wed Dec 20 14:09:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 122468 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5625345qgn; Wed, 20 Dec 2017 06:09:29 -0800 (PST) X-Received: by 10.25.59.216 with SMTP id d85mr4074343lfl.36.1513778969842; Wed, 20 Dec 2017 06:09:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513778969; cv=none; d=google.com; s=arc-20160816; b=vhuSQb5kOXLJW9Xnibp15N863nvu9PT1Nexweufnfj2PV8UfsYazPx/IZtvzAfee3q mG3+vz4JJ/Zis+qAgU4vYmtzXM7m0KeFh56I74wo04lwNz8C19wjtdWjvJjMnrtsAP4g Yz7dhRVNT5QXXUwZY4KFeVKJs2PFxwWbu5mx58VRvHL+UlwleU80xK7hMS37OChhw3Mi g8B7VhUxagAnmRRMaVgkAJ3bgyFLAd0paYaHtpv3/oVjbcucAfkh8E8B9kXnZt6M46S0 NCaQ6Ptk6AgAS+Hyzj6K5d3IQ1OgDdC1ymFBXTFCWEMKvkvbhjUrsORk6Es80CBgXrFC kB+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=G5GSKAuWEjD6UWbPCHeqDqG8NLTEBWOe9Bvlb2CO3yU=; b=Tr4dJY1+wOELrTsOvVYyu5F8DciVO6OVjTWZlJ/CswM3JDiFbmvY0F0gsXUJZfTiZ8 JX9cSl/3Fowu9VzJbUgjlpoVU0LGLy4ExHb7Z2I2qaVsBFHRDc/fVesKXK4wpvKgrbi0 mNFxUAWvuiOZjadcNrUsMJkyBOYE8irOu1Sml4a3tkgBDvKpdP2AOR5lfw2XpB8BPjA+ EVbPLQjCQhC/UVhhzXp0HMHQZEIGOv8utq1g5RGJitNRTsjDTNWhiGzNvKX6w4nNk/uz hyx9KoQKxvpoKv2uwsDYAkVBO4ZhFqHNnQYkcqL80UT2DYAkvZsaaSWfamCI6wWifAEa pqfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gMvQZr2w; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id r75sor23190lff.5.2017.12.20.06.09.29 for (Google Transport Security); Wed, 20 Dec 2017 06:09:29 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gMvQZr2w; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G5GSKAuWEjD6UWbPCHeqDqG8NLTEBWOe9Bvlb2CO3yU=; b=gMvQZr2wNAalS4XTBKWMZLSSuXYZ5elA0ARsIns1xQl7FNzDpQCb3fs7sgz6I5p+c6 nvFTarMmBnQWYXxJ6UpVn0ssecx7HwLNxZIcDzIx7DDMd0LCqVxfXNfM55DCAd8k+mJ8 ECNZTWHrH0RBA0KADiS305XfQdQYfclZKKkQU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=G5GSKAuWEjD6UWbPCHeqDqG8NLTEBWOe9Bvlb2CO3yU=; b=KF9drturFqAVOm32pXLGTw5TfjQED3WTHA+kBTy/8R15bdsi33XBlUsm4gn3oxQL2z tbI4GbsBAbHXHCiNFJ+jRlERKQZ/APPYNpVdYopN8xcKnkethGlpJXNgGQBXnBiSbMuX 2OC8DpEL89ZwXWcHD9yPSk+DQZPf3Hm2gvagVSjy/7pfm0zuwhN015s92RMLdvyW3QVX MFlvxmDHZr/i3l7q9pXFiq2Y0T33+aehmLbH2WjVrZOOsc4otUoR8RNb6j3ZB4u8qLvE RLqSmLvlv9Ai2BhFKMHRTfROmK8SlMHt6/qKrpl6fBo6m17AsggBJBp6jf9q/IEOqbbX 3rDw== X-Gm-Message-State: AKGB3mK4EO95JcpOqvlw/NlYQ5JMJwzSItm3t7iiaONg4rUi65IvrEw6 xkuSoZ5G1mwccKb/JlB2dapp6k/b X-Google-Smtp-Source: ACJfBos4srABYkNjHpFj382Nm77W4HN3N4BEYzLXhTPObpSKh63ZiCooJB+uh37HBEO9EnNBLmeMjA== X-Received: by 10.25.25.79 with SMTP id 76mr4210927lfz.93.1513778969434; Wed, 20 Dec 2017 06:09:29 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-67.NA.cust.bahnhof.se. [158.174.22.67]) by smtp.gmail.com with ESMTPSA id f10sm3869505lff.56.2017.12.20.06.09.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Dec 2017 06:09:28 -0800 (PST) From: Ulf Hansson To: Kishon Vijay Abraham I , linux-kernel@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-pm@vger.kernel.org, Yoshihiro Shimoda , Geert Uytterhoeven , linux-renesas-soc@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 1/3] phy: core: Move runtime PM reference counting to the parent device Date: Wed, 20 Dec 2017 15:09:18 +0100 Message-Id: <1513778960-10073-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513778960-10073-1-git-send-email-ulf.hansson@linaro.org> References: <1513778960-10073-1-git-send-email-ulf.hansson@linaro.org> The runtime PM deployment in the phy core is deployed using the phy core device, which is created by the phy core and assigned as a child device of the phy provider device. The behaviour around the runtime PM deployment cause some issues during system suspend, in cases when the phy provider device is put into a low power state via a call to the pm_runtime_force_suspend() helper, as is the case for a Renesas SoC, which has its phy provider device attached to the generic PM domain. In more detail, the problem in this case is that pm_runtime_force_suspend() expects the child device of the provider device, which is the phy core device, to be runtime suspended, else a WARN splat will be printed (correctly) when runtime PM gets re-enabled at system resume. In the current scenario, even if a call to phy_power_off() triggers it to invoke pm_runtime_put() during system suspend, the phy core device doesn't get runtime suspended, because this is prevented in the system suspend phases by the PM core. To solve this problem, let's move the runtime PM deployment from the phy core device to the phy provider device, as this provides the similar behaviour. Changing this makes it redundant to enable runtime PM for the phy core device, so let's avoid doing that. Signed-off-by: Ulf Hansson --- drivers/phy/phy-core.c | 33 +++++++++++++++------------------ include/linux/phy/phy.h | 1 + 2 files changed, 16 insertions(+), 18 deletions(-) -- 2.7.4 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index b4964b0..09588ec 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -153,12 +153,12 @@ int phy_pm_runtime_get(struct phy *phy) { int ret; - if (!pm_runtime_enabled(&phy->dev)) + if (!phy->use_runtime_pm) return -ENOTSUPP; - ret = pm_runtime_get(&phy->dev); + ret = pm_runtime_get(phy->dev.parent); if (ret < 0 && ret != -EINPROGRESS) - pm_runtime_put_noidle(&phy->dev); + pm_runtime_put_noidle(phy->dev.parent); return ret; } @@ -168,12 +168,12 @@ int phy_pm_runtime_get_sync(struct phy *phy) { int ret; - if (!pm_runtime_enabled(&phy->dev)) + if (!phy->use_runtime_pm) return -ENOTSUPP; - ret = pm_runtime_get_sync(&phy->dev); + ret = pm_runtime_get_sync(phy->dev.parent); if (ret < 0) - pm_runtime_put_sync(&phy->dev); + pm_runtime_put_sync(phy->dev.parent); return ret; } @@ -181,37 +181,37 @@ EXPORT_SYMBOL_GPL(phy_pm_runtime_get_sync); int phy_pm_runtime_put(struct phy *phy) { - if (!pm_runtime_enabled(&phy->dev)) + if (!phy->use_runtime_pm) return -ENOTSUPP; - return pm_runtime_put(&phy->dev); + return pm_runtime_put(phy->dev.parent); } EXPORT_SYMBOL_GPL(phy_pm_runtime_put); int phy_pm_runtime_put_sync(struct phy *phy) { - if (!pm_runtime_enabled(&phy->dev)) + if (!phy->use_runtime_pm) return -ENOTSUPP; - return pm_runtime_put_sync(&phy->dev); + return pm_runtime_put_sync(phy->dev.parent); } EXPORT_SYMBOL_GPL(phy_pm_runtime_put_sync); void phy_pm_runtime_allow(struct phy *phy) { - if (!pm_runtime_enabled(&phy->dev)) + if (!phy->use_runtime_pm) return; - pm_runtime_allow(&phy->dev); + pm_runtime_allow(phy->dev.parent); } EXPORT_SYMBOL_GPL(phy_pm_runtime_allow); void phy_pm_runtime_forbid(struct phy *phy) { - if (!pm_runtime_enabled(&phy->dev)) + if (!phy->use_runtime_pm) return; - pm_runtime_forbid(&phy->dev); + pm_runtime_forbid(phy->dev.parent); } EXPORT_SYMBOL_GPL(phy_pm_runtime_forbid); @@ -774,10 +774,7 @@ struct phy *phy_create(struct device *dev, struct device_node *node, if (ret) goto put_dev; - if (pm_runtime_enabled(dev)) { - pm_runtime_enable(&phy->dev); - pm_runtime_no_callbacks(&phy->dev); - } + phy->use_runtime_pm = pm_runtime_enabled(dev); return phy; diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 4f8423a..b4298a1 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -83,6 +83,7 @@ struct phy { int power_count; struct phy_attrs attrs; struct regulator *pwr; + bool use_runtime_pm; }; /** From patchwork Wed Dec 20 14:09:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 122469 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5625381qgn; Wed, 20 Dec 2017 06:09:31 -0800 (PST) X-Received: by 10.46.2.87 with SMTP id 84mr4780302ljc.0.1513778971407; Wed, 20 Dec 2017 06:09:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513778971; cv=none; d=google.com; s=arc-20160816; b=LOKah0Nqt4FmvCbSlPBRgrL3msPLJrxNg3sc4Gl/cEsQPgPcA1goXAOfxah9hEs9Gz r+85oh1t3CpCpyvLQ5d39E9GIq4AMceiCQb/PjXY6jObuGml8rHtY7e4PVHxeFycE1pF GcDgox6Ra9Vlp5fQ+BhMnYBIPaRWssou1b0NxaKjGbJRHCWgMS0/EgqV3pGiJTVuErGS EYv2wL6iUypQlDvEJp2UJA6571erOCn4OY41bWxjpiCGfwlEaXI6Vg2yX+vstxO0ydtm eHPE1f+OF4vcWAsMQWi5mJfNqucG99rfMm+WzcNwD4kF/2PJqfnSLiA0RfAzmlYKCTS/ HgSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=+TtaXOcfRw6Y8LWNnibJ7kn4m7ks4WivbXXT89YJPN8=; b=rB8OAEaz/NizJ4hWmRxfNV/NWuYCb+DXCYPgrmmx9AZARgJTvlaXOeF/dX6TuJdxxV 1u4i8rWbDFPm9o2sFAVHoZETFH00MlrAZKUW+iuF4BSC7/H3Duj63JC9/LKrD/fjKqCk TfXIfKwx+xMnWnYGvtyCCRx7od3iAbOKFIx0SIaa3XE3GWJ5+NnZd9GZDoZg7hmA/Szz uAv1gcaOihc0AEHRIG/7eymwajuj8VXhNu+f3ozaZxnrt4sZirLtmamM7p1PQn47BnAh N2IcVfoMbeF+V2ynov0pop5Xp4v/5K9395rsI8h02DXNcb7NVjc8DPM++2SOj8d0Z4JC j1Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F+j8Zk8Z; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id v14sor2919467lfi.108.2017.12.20.06.09.31 for (Google Transport Security); Wed, 20 Dec 2017 06:09:31 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F+j8Zk8Z; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+TtaXOcfRw6Y8LWNnibJ7kn4m7ks4WivbXXT89YJPN8=; b=F+j8Zk8ZMOOhQdHxcH+LURSoVc8I7+adMJKIOAyMQAHrxcaGCJnFlm3z8WtMgWRvyd /co0XPrTPKNY2JMJSvJO4AT5IBrB3EjI65lSI0O6dM0lB1H8K/T2VjvGNVDfMMqUIyEn +OgvpiidO2eCBLCQbBnvP8bzjHn1zTmanWKhc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+TtaXOcfRw6Y8LWNnibJ7kn4m7ks4WivbXXT89YJPN8=; b=R9xuODTozJTBxnOXWEEH+nkh9UCTh15pMEI6A+OyU2FUuxBpAWXt7GSqMcEHCXx9jp +BWtaC4a5npYuQsSgwm90TtxHD9AA1s7ncjM3ig/59YvNpn0aewUrEcabc4J4oCyL/6D tRZwGRzS5o1YxH5XYFwvm3nGPkIsalwaGabd5H2MDAqn55B2t0dW0BDvNW81R/rj7JVH HVBOmrKeCNcgSoH5irdrLqyJJPTg7xxbVSwzJGEkEne5Jo9aptZQZr3HIQMx3KwIEho+ IFDe6JlKA6EEngtYZsy4jByj3wAejhRG1dSf5UG4dPeGUT2od859nkKEwRaafUAMyNnX bfgQ== X-Gm-Message-State: AKGB3mI41Dlzne/420T6VgiKah2SxZzpBLnXFcjZ0CrBXHFbJdCRdQ54 0i6gyjfGHki9C7AMk0c6FQHtxrlG X-Google-Smtp-Source: ACJfBotDctwvFMgO8ejewSZ2ZzxVL4uONt/4RQ14TJHn/6uvCAHHCY2QaeRDeMquB7Cynx8DrMb4Gg== X-Received: by 10.25.216.12 with SMTP id p12mr3429945lfg.21.1513778971040; Wed, 20 Dec 2017 06:09:31 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-67.NA.cust.bahnhof.se. [158.174.22.67]) by smtp.gmail.com with ESMTPSA id f10sm3869505lff.56.2017.12.20.06.09.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Dec 2017 06:09:30 -0800 (PST) From: Ulf Hansson To: Kishon Vijay Abraham I , linux-kernel@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-pm@vger.kernel.org, Yoshihiro Shimoda , Geert Uytterhoeven , linux-renesas-soc@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 2/3] phy: core: Drop unused runtime PM APIs Date: Wed, 20 Dec 2017 15:09:19 +0100 Message-Id: <1513778960-10073-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513778960-10073-1-git-send-email-ulf.hansson@linaro.org> References: <1513778960-10073-1-git-send-email-ulf.hansson@linaro.org> The phy core already deploys runtime PM support, so there seems to be no obvious reason for having dedicated APIs to control runtime PM for phys. Therefore, let's remove the APIs altogether and instead convert internal needed functions to be static. Signed-off-by: Ulf Hansson --- drivers/phy/phy-core.c | 50 +++---------------------------------------------- include/linux/phy/phy.h | 45 -------------------------------------------- 2 files changed, 3 insertions(+), 92 deletions(-) -- 2.7.4 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 09588ec..1621625 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -149,22 +149,7 @@ static struct phy_provider *of_phy_provider_lookup(struct device_node *node) return ERR_PTR(-EPROBE_DEFER); } -int phy_pm_runtime_get(struct phy *phy) -{ - int ret; - - if (!phy->use_runtime_pm) - return -ENOTSUPP; - - ret = pm_runtime_get(phy->dev.parent); - if (ret < 0 && ret != -EINPROGRESS) - pm_runtime_put_noidle(phy->dev.parent); - - return ret; -} -EXPORT_SYMBOL_GPL(phy_pm_runtime_get); - -int phy_pm_runtime_get_sync(struct phy *phy) +static int phy_pm_runtime_get_sync(struct phy *phy) { int ret; @@ -177,43 +162,14 @@ int phy_pm_runtime_get_sync(struct phy *phy) return ret; } -EXPORT_SYMBOL_GPL(phy_pm_runtime_get_sync); -int phy_pm_runtime_put(struct phy *phy) +static int phy_pm_runtime_put(struct phy *phy) { if (!phy->use_runtime_pm) return -ENOTSUPP; return pm_runtime_put(phy->dev.parent); } -EXPORT_SYMBOL_GPL(phy_pm_runtime_put); - -int phy_pm_runtime_put_sync(struct phy *phy) -{ - if (!phy->use_runtime_pm) - return -ENOTSUPP; - - return pm_runtime_put_sync(phy->dev.parent); -} -EXPORT_SYMBOL_GPL(phy_pm_runtime_put_sync); - -void phy_pm_runtime_allow(struct phy *phy) -{ - if (!phy->use_runtime_pm) - return; - - pm_runtime_allow(phy->dev.parent); -} -EXPORT_SYMBOL_GPL(phy_pm_runtime_allow); - -void phy_pm_runtime_forbid(struct phy *phy) -{ - if (!phy->use_runtime_pm) - return; - - pm_runtime_forbid(phy->dev.parent); -} -EXPORT_SYMBOL_GPL(phy_pm_runtime_forbid); int phy_init(struct phy *phy) { @@ -306,7 +262,7 @@ int phy_power_on(struct phy *phy) err_pwr_on: mutex_unlock(&phy->mutex); - phy_pm_runtime_put_sync(phy); + phy_pm_runtime_put(phy); err_pm_sync: if (phy->pwr) regulator_disable(phy->pwr); diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index b4298a1..050b620 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -17,7 +17,6 @@ #include #include #include -#include #include struct phy; @@ -134,12 +133,6 @@ static inline void *phy_get_drvdata(struct phy *phy) } #if IS_ENABLED(CONFIG_GENERIC_PHY) -int phy_pm_runtime_get(struct phy *phy); -int phy_pm_runtime_get_sync(struct phy *phy); -int phy_pm_runtime_put(struct phy *phy); -int phy_pm_runtime_put_sync(struct phy *phy); -void phy_pm_runtime_allow(struct phy *phy); -void phy_pm_runtime_forbid(struct phy *phy); int phy_init(struct phy *phy); int phy_exit(struct phy *phy); int phy_power_on(struct phy *phy); @@ -188,44 +181,6 @@ void devm_of_phy_provider_unregister(struct device *dev, int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id); void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id); #else -static inline int phy_pm_runtime_get(struct phy *phy) -{ - if (!phy) - return 0; - return -ENOSYS; -} - -static inline int phy_pm_runtime_get_sync(struct phy *phy) -{ - if (!phy) - return 0; - return -ENOSYS; -} - -static inline int phy_pm_runtime_put(struct phy *phy) -{ - if (!phy) - return 0; - return -ENOSYS; -} - -static inline int phy_pm_runtime_put_sync(struct phy *phy) -{ - if (!phy) - return 0; - return -ENOSYS; -} - -static inline void phy_pm_runtime_allow(struct phy *phy) -{ - return; -} - -static inline void phy_pm_runtime_forbid(struct phy *phy) -{ - return; -} - static inline int phy_init(struct phy *phy) { if (!phy) From patchwork Wed Dec 20 14:09:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 122470 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5625440qgn; Wed, 20 Dec 2017 06:09:33 -0800 (PST) X-Received: by 10.25.158.147 with SMTP id h141mr4503161lfe.86.1513778973559; Wed, 20 Dec 2017 06:09:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513778973; cv=none; d=google.com; s=arc-20160816; b=V8w4LLsOWwlwk/Mn4rnq05JIXOhOCA/1sDG9vfmIKOrUt4DSnU0PsM81F2d/OCa4Wm YD4uISvzVdvCJOgQ1mXENWx0O5Htk/Y/l3rpuQO5ftw3josWadNB+bt/4BzRrNMmb/+/ 0omnjglqPJ16yzz+4aAT1uokHWIr/x+RdfeCYatkHANkXoYh5K53lLe4F1XciVPt3F0J nNlnWsYEEpJpHpP7jJjMBu8INMnICu9/NfTmsxuUm8ybESNbBQyXDllqrlYJL35c5V3W qUMbr8WlAcwcGy1jNB8eegTvnR8x1tgtgu6N7QOGZ7qp16FbbJqSMN9uWjSkngHQMHaO bQGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=rhfot0y2jEM/Q2tkrcTWz+TZcEboy+VQZExz0P6Etlg=; b=As4JCM5K9Fm7IJ95D5n39rddFHqJNXzBOhVHqG0xO0Ief43vwnK/7sfqe4JCFSTNZa opOoGO51/bXyt9V71eHIqQZ8TlOI5JNxtGZwrgwdpL70EkaJrh81kLSa85od65T5YVNQ /9MC/DxCAVc2s6PB4wIevvCZuPJJhZ4gEZp1ZUdxiq/kNtAqo/6BwhHhvA+lOSxnKqaL c1fF7VCI1iwYYy313k6GPMyFjJnEjAe0+e50jGafhDaozP3wRdqudCZDKzkYRv2cCOpT BmtW1i3GtU7KbPqswMjt9bJ6ERZ4wh7BS1POZzmyWVTlfej275HwLRXrqsgqPt9kZvy8 TzAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Scvd4qot; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 11sor3064160lje.110.2017.12.20.06.09.32 for (Google Transport Security); Wed, 20 Dec 2017 06:09:33 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Scvd4qot; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rhfot0y2jEM/Q2tkrcTWz+TZcEboy+VQZExz0P6Etlg=; b=Scvd4qotbUOs7pVoqZyFjzz5Uo4gZViBA+/3+iBXgtQXoGIKbloDnt1eqbbLB+0fNY FSeXQ87YmNSYAuzRxNIgs6lZpPmI3fu+yzGFP5PW98ib7NLZlN/wptoTqIwG1pOhJ+5O CxWOToB/BcimmS5nJwZD5rRRU7VtsDzsax+Eg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rhfot0y2jEM/Q2tkrcTWz+TZcEboy+VQZExz0P6Etlg=; b=M4OCycpAWhYiW+R/XGxAQTgs0F37NgpAq1Fek8GADbyBgUlIEJYuZnakGKJBIIY8AM n3TQOJz48SZ8PUlIHmbhmnke0/qm6gFTBZXJnm2j1Zjq9omQnNGv0txvYMGVUgu4N8hI TPzRzr/L7wu/4n8+bj+JHIfzjALw17jaMZFTJbRr4zoo/eRbKKihDMjHMiEE2SHgrLBT Z0eK0lZY9trGuOwfgeTpYE/wFE0Eni40kz6EmFhvSn4ZoD4TuMEvzz2E25FcMX2uSSSx Zxe1U/kUVQaZwXUZkm2yPorpRLSQkZ8lThSOvqiySmel5lT8bkLCOGoBO4q1Y9X+4jQY 6bLA== X-Gm-Message-State: AKGB3mLCro68S05IWcYMScnwDiYzeyKln4sdCPFsZPjM7HsROHthmREb 0wMRill3z6VWAa5AUXpPUAazRGmG52yjdg== X-Google-Smtp-Source: ACJfBosoh6AZRH0i/pKK26p/xeUuFL+MX47Ur7Nd2jouBGcf742yz8GdCbzP6CSmPCqJy+lO2bTmkQ== X-Received: by 10.46.117.23 with SMTP id q23mr4651338ljc.85.1513778972679; Wed, 20 Dec 2017 06:09:32 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-67.NA.cust.bahnhof.se. [158.174.22.67]) by smtp.gmail.com with ESMTPSA id f10sm3869505lff.56.2017.12.20.06.09.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Dec 2017 06:09:31 -0800 (PST) From: Ulf Hansson To: Kishon Vijay Abraham I , linux-kernel@vger.kernel.org Cc: "Rafael J . Wysocki" , linux-pm@vger.kernel.org, Yoshihiro Shimoda , Geert Uytterhoeven , linux-renesas-soc@vger.kernel.org, Ulf Hansson , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH v2 3/3] phy: core: Update the runtime PM section in the docs to reflect changes Date: Wed, 20 Dec 2017 15:09:20 +0100 Message-Id: <1513778960-10073-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513778960-10073-1-git-send-email-ulf.hansson@linaro.org> References: <1513778960-10073-1-git-send-email-ulf.hansson@linaro.org> Let's update and clarify he phy documentation, to reflect the latest changes around the runtime PM deployment in the phy core. Cc: Jonathan Corbet Cc: linux-doc@vger.kernel.org Signed-off-by: Ulf Hansson --- Documentation/phy.txt | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) -- 2.7.4 diff --git a/Documentation/phy.txt b/Documentation/phy.txt index 457c3e0..1c2c761 100644 --- a/Documentation/phy.txt +++ b/Documentation/phy.txt @@ -160,19 +160,22 @@ associated with this PHY. PM Runtime ========== -This subsystem is pm runtime enabled. So while creating the PHY, -pm_runtime_enable of the phy device created by this subsystem is called and -while destroying the PHY, pm_runtime_disable is called. Note that the phy -device created by this subsystem will be a child of the device that calls -phy_create (PHY provider device). - -So pm_runtime_get_sync of the phy_device created by this subsystem will invoke -pm_runtime_get_sync of PHY provider device because of parent-child relationship. -It should also be noted that phy_power_on and phy_power_off performs -phy_pm_runtime_get_sync and phy_pm_runtime_put respectively. -There are exported APIs like phy_pm_runtime_get, phy_pm_runtime_get_sync, -phy_pm_runtime_put, phy_pm_runtime_put_sync, phy_pm_runtime_allow and -phy_pm_runtime_forbid for performing PM operations. +This subsystem deploys runtime PM support. More precisely, calls to +pm_runtime_get_sync() and to pm_runtime_put() surrounds calls to the phy +provider callbacks, ->init|exit(), in phy_init|exit(). At phy_power_on(), the +runtime PM usage count is raised again, via pm_runtime_get_sync(). The usage +count remain raised, until the internal phy power on count reaches zero in +phy_power_off(), at which point pm_runtime_put() is called to restore the +runtime PM usage count. In this way, the device is guranteed to stay runtime +resumed as long as the phy is powered on. + +In regards to the runtime PM deployment in the phy core, it should also be +noted that it's deployed for the phy provider device, which is the parent of +the phy child device. In other words, the phy device created by the phy core +remains runtime PM disabled. Of course, whether runtime PM is really used or +not, depends on whether the phy provider driver has enabled runtime PM for its +provider device. More exactly, pm_runtime_enable() needs to be called prior +calling phy_create() or devm_phy_create(). PHY Mappings ============