From patchwork Tue Dec 19 21:22:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 122408 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4696966qgn; Tue, 19 Dec 2017 13:22:59 -0800 (PST) X-Received: by 10.46.64.76 with SMTP id n73mr3142164lja.33.1513718579180; Tue, 19 Dec 2017 13:22:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513718579; cv=none; d=google.com; s=arc-20160816; b=gC8C4Pjte/qcM+TXE/Qz4Q0bAfazu5yiF8iS7LbXCw2W9v1nbA1Dn+KNXV6kVD8ptD gE5+MdhqHTa+dGHUKKgsv5qW68QP1GgmzS7BsIpc0Vx/e7hqH2fm7O5HBH7q/px/3VGI kDPb0Y0rhf0N+raHUYR0kWDI8Kl8//mi+JgMHBNmrd6TzKcO4epZrZyKFlumm/Lf0M6y iJvTbFBkCCNH7yd2+Ew3g2zdjL26KdTIVSuYP0MLMJwZYfdOH2DMiCGA7iATq56lmX9j +CzRkID4JJyYNxtxTHXdUpArCxMB69bWE1rjfpS5yfaZwMFr9BnQopVvc45KNmtTR5za XKlA== 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=MBdQLx9+ubkVCVMjLHMxqfsimMMdg0nAUUENKeXiQtM=; b=aYAQgYXwd+JXm3SofTMdso7+Ngnvb7wvuumFN/cUCd08X8MdwlM6BfPuKAc/9syD1O mARtwf6+UCA+sYjYmMKVMie20zJoD5bbMtaf6L8Fi4zpHj1YLsUkSnNsc4PknDVNIyx8 uTT0PAYPgDgl9k61UMlc/JLgJsVD8QOjgj2RagSYsaYWQgk+Al6xXYzeThFuOlTx4wR6 jzuvx8Z4UbL4fM7/VJJU6gGDqXEAkq+FZwgEGUX8ytKLG76LhdUar7mBG4vh1YFh205q cvqm14b1XSqV4HX5QZz1AG8APiSkk51PoQEsObsVr+p4Se6WR0ivbpju1d2EX4vQojYl JQpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bLhCbJDV; 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 t22sor3010657lje.97.2017.12.19.13.22.59 for (Google Transport Security); Tue, 19 Dec 2017 13:22:59 -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=bLhCbJDV; 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=MBdQLx9+ubkVCVMjLHMxqfsimMMdg0nAUUENKeXiQtM=; b=bLhCbJDVpmtMHPJLWOWVMJdzSl6SjJo10ONv9OskTu74nxNmuqEkOR51+R7ZWU0pRC V07KpeGMHRr09TlGVv6l87Sy9cljLhv04RuougrZYLp1V/h3DIFWgOwxmilLAsKk6pd5 AZDiU0NeE0gEf8W6hPPUiPiLFmyFhcrWylBOQ= 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=MBdQLx9+ubkVCVMjLHMxqfsimMMdg0nAUUENKeXiQtM=; b=FWXmIa8OhcNwEVblHWn9QHwIXBWL85zNE7LO9c9I1xppGBh/e2H/B2emhZlRTDbkSV uH7Ga6oRrX2Q+DhHnHaPgShJVI2LK2ahV/uiWLeVBJyOKWsGVBVco8sMMxh5nQAoHOZf AOSQjsz4sQ8joxigDUz2elG3Jc5mfjDNk65fh2PQdcHJhVTb1jHmpmNPY4x6ChZ9ckC3 sTVyfntwhW9T+8bLHOsWyAZdvYfXn3X7BbuM6r2RYv033xbzjzjmEKROQCunEdnyhMEQ 3yyDPItossyg15wybxayksPnYUBPilbivZwRhgqZJB+O5bkxLPRU4paY93f7kaqMaXp2 B6pQ== X-Gm-Message-State: AKGB3mJK9VNlHBu3y6Ia2K3WsAwjj/12FvryX17Nd9fsmpQgZJYk/Bso EU3WYdQHTtnyHMLGWKHz8jqyHXsNUCplbQ== X-Google-Smtp-Source: ACJfBovBsovZnJOIlCvA8/hkGAkE58NlRQElM36NiVqqhawbJ6ulcYLKHkDrSNCRSF0HkdraB51CHg== X-Received: by 10.46.55.20 with SMTP id e20mr3153875lja.118.1513718578825; Tue, 19 Dec 2017 13:22:58 -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 13sm3173068ljv.37.2017.12.19.13.22.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Dec 2017 13:22:58 -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 1/3] phy: core: Move runtime PM reference counting to the parent device Date: Tue, 19 Dec 2017 22:22:29 +0100 Message-Id: <1513718551-28624-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513718551-28624-1-git-send-email-ulf.hansson@linaro.org> References: <1513718551-28624-1-git-send-email-ulf.hansson@linaro.org> The runtime PM deployment in the phy core is a bit unnecessary complicated and the main reason is because it operates on the phy device, which is created by the phy core and assigned as a child device of the phy provider device. Let's simplify the code, by replacing the existing calls to phy_pm_runtime_get_sync() and phy_pm_runtime_put(), with regular calls to pm_runtime_get_sync() and pm_runtime_put(). While doing that, let's also change to give the phy provider device as the parameter to the runtime PM calls. This together with adding error paths, that allows the phy provider device to be runtime PM disabled, enables further clean up the code. More precisely, we can simply avoid to enable runtime PM for the phy device altogether, so let's do that as well. More importantly, this change also fixes an issue for system suspend. Especially in those cases when the phy provider device gets put into a low power state via calling the pm_runtime_force_suspend() helper, as is the case for a Renesas SoC, which has the phy provider device attached to the generic PM domain. The problem in this case, is that pm_runtime_force_suspend() expects the child device of the provider device to be runtime suspended, else this will trigger a WARN splat (correctly) when runtime PM gets re-enabled at system resume. In the current case, even if phy_power_off() triggers a pm_runtime_put() during system suspend the phy device (child) doesn't get runtime suspended, because that is prevented in the system suspend phases. However, by avoiding to enable runtime PM, this problem goes away. Signed-off-by: Ulf Hansson --- drivers/phy/phy-core.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) -- 2.7.4 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index b4964b0..9fa3f13 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -222,10 +222,10 @@ int phy_init(struct phy *phy) if (!phy) return 0; - ret = phy_pm_runtime_get_sync(phy); - if (ret < 0 && ret != -ENOTSUPP) + ret = pm_runtime_get_sync(phy->dev.parent); + if (ret < 0 && ret != -EACCES) return ret; - ret = 0; /* Override possible ret == -ENOTSUPP */ + ret = 0; mutex_lock(&phy->mutex); if (phy->init_count == 0 && phy->ops->init) { @@ -239,7 +239,7 @@ int phy_init(struct phy *phy) out: mutex_unlock(&phy->mutex); - phy_pm_runtime_put(phy); + pm_runtime_put(phy->dev.parent); return ret; } EXPORT_SYMBOL_GPL(phy_init); @@ -251,10 +251,10 @@ int phy_exit(struct phy *phy) if (!phy) return 0; - ret = phy_pm_runtime_get_sync(phy); - if (ret < 0 && ret != -ENOTSUPP) + ret = pm_runtime_get_sync(phy->dev.parent); + if (ret < 0 && ret != -EACCES) return ret; - ret = 0; /* Override possible ret == -ENOTSUPP */ + ret = 0; mutex_lock(&phy->mutex); if (phy->init_count == 1 && phy->ops->exit) { @@ -268,7 +268,7 @@ int phy_exit(struct phy *phy) out: mutex_unlock(&phy->mutex); - phy_pm_runtime_put(phy); + pm_runtime_put(phy->dev.parent); return ret; } EXPORT_SYMBOL_GPL(phy_exit); @@ -286,11 +286,10 @@ int phy_power_on(struct phy *phy) goto out; } - ret = phy_pm_runtime_get_sync(phy); - if (ret < 0 && ret != -ENOTSUPP) + ret = pm_runtime_get_sync(phy->dev.parent); + if (ret < 0 && ret != -EACCES) goto err_pm_sync; - - ret = 0; /* Override possible ret == -ENOTSUPP */ + ret = 0; mutex_lock(&phy->mutex); if (phy->power_count == 0 && phy->ops->power_on) { @@ -306,7 +305,7 @@ int phy_power_on(struct phy *phy) err_pwr_on: mutex_unlock(&phy->mutex); - phy_pm_runtime_put_sync(phy); + pm_runtime_put(phy->dev.parent); err_pm_sync: if (phy->pwr) regulator_disable(phy->pwr); @@ -333,7 +332,7 @@ int phy_power_off(struct phy *phy) } --phy->power_count; mutex_unlock(&phy->mutex); - phy_pm_runtime_put(phy); + pm_runtime_put(phy->dev.parent); if (phy->pwr) regulator_disable(phy->pwr); @@ -774,11 +773,6 @@ 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); - } - return phy; put_dev: @@ -831,7 +825,6 @@ EXPORT_SYMBOL_GPL(devm_phy_create); */ void phy_destroy(struct phy *phy) { - pm_runtime_disable(&phy->dev); device_unregister(&phy->dev); } EXPORT_SYMBOL_GPL(phy_destroy); From patchwork Tue Dec 19 21:22:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 122409 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4696994qgn; Tue, 19 Dec 2017 13:23:00 -0800 (PST) X-Received: by 10.46.59.10 with SMTP id i10mr3190852lja.60.1513718580624; Tue, 19 Dec 2017 13:23:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513718580; cv=none; d=google.com; s=arc-20160816; b=Mhm/vUGcKmRa15LRgXWwMQBupsQ4vwsqL5uMVcHxKRf445YOhTkVIncnH6WsNnuCGm 2EUzf3RzXbGHV67ywSNMMG4ROReew6ELHzEx5xgIuyQhwZCjCwhcW5rm1OiSlI5WP6AN tLSZl2gaiyHXZnjTQdZ5lXOrrdbjbz0aUYHQZ8q9v9g23kEJloPQKs1w3tYS6q3hED+F IRzBDkzS+tWdXiPxpTNdVh1SUa8ueCN5k9xo1cTkjk1Hg/ualmafLacGL5ljB2xVpcC9 wLbzIwbq17H+ZZ5AOLMhCBNbCXl+VQTZ7YIA0w//a/BoKTNogPrf00lh/3+0tqJ/SI6m wezw== 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=5l1EnkxdLbjvMPQesLQimh5VWyAFwilkS96XcUdE4QY=; b=r6ZUyM4MZfyytp8us/KTcclfuFp7bkR0CeDSNasdM1i6AT1j2Kh6JBxeMEP4CUfVvr ZVYwIxobzvaWNu0LlqMff6mwnSJJQfKvzSMyBxJWUlRkbMcO2CuW9/Ugl8BavU9/raZZ acQ2BM/B2Dbfau7hdiyaJx8W2dEjD1SxWztEuLnQCYgqqzRgeUYY90HdpdyeYMc5NkpW qBLybXEoW/Ybw/ePdayLONCeU3f21jvcXzuoQbcQQiF+9pN0FC+p+R9AjDRA5/O7DkvE P/0jlo3ychvUFbcMcQILjNivzqrGZpSlQjofYNzMmHdjrpj0Gd9dlrZ0J0XZF8BlYw29 vRbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AOMwsTYL; 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 74sor3067173ljc.85.2017.12.19.13.23.00 for (Google Transport Security); Tue, 19 Dec 2017 13:23:00 -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=AOMwsTYL; 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=5l1EnkxdLbjvMPQesLQimh5VWyAFwilkS96XcUdE4QY=; b=AOMwsTYLbYnPj5ZDceYNB9qrY8fjKKSd+4ANnjwo+6SzotHxXN+rfH/KOGkVYxjkFr VhAwhMiN+q7wF/GVlF3vUuQdXFVqHlArHXpvsIsxcUanrkfuv051+HnG/7lD2iFG7mT1 HH++jFZ162OB+We262nUn9THCGxmCbcs2PKXs= 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=5l1EnkxdLbjvMPQesLQimh5VWyAFwilkS96XcUdE4QY=; b=hOo5ISM5atruBwKShhp1kVft/ctCdkSeH5IvQ2G6pdGd3W2NqRuJG5eYBjHZXTKKST yYEZaT1b+vvF1ZDTF8B2359+b+27h1xWqSMNfYw95kk+G9EV43n5vACjEE5hCn55EDds K30bFAjZ8MaP15VtYYusy0+qJa7MxwrxAnEUB8ITn7RFd1qfi7O8711IhY4BVk7Fje7u HeNITa3SJk9Opi7QFDCDPFZxHXb2Xoui5lCCKgWSavOBgYnHRGbYj40U8DMErbgq/2J1 l11JN82xsHqzdmoqes58suegBUpI4N6nUd8qGESsfAWaAruCNnVghXHb8sLTbPIVrg6W su2A== X-Gm-Message-State: AKGB3mKB74I5Hg8ThvjbWczaN/MnQpRMmt1wrMgkzRTA00dwNMTVj09e ph0Maz1JGn+V/f9kKllJygjMsTaw X-Google-Smtp-Source: ACJfBosmoBVFTfnOIvAfspIcEim5ihtPTA3E5BpbGxS3gbjN+HFTh8sxyY6Cj/AvAgDWFIZZaxptgg== X-Received: by 10.46.86.131 with SMTP id k3mr3252693lje.61.1513718580274; Tue, 19 Dec 2017 13:23:00 -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 13sm3173068ljv.37.2017.12.19.13.22.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Dec 2017 13:22:59 -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 2/3] phy: core: Drop unused runtime PM APIs Date: Tue, 19 Dec 2017 22:22:30 +0100 Message-Id: <1513718551-28624-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513718551-28624-1-git-send-email-ulf.hansson@linaro.org> References: <1513718551-28624-1-git-send-email-ulf.hansson@linaro.org> The phy core already deploys runtime PM management, so there seems to be no reason for having a separate option of controlling runtime PM for phys via the phy runtime PM APIs. Moreover, since previous changes moved the runtime PM reference counting onto the parent provider device, which also avoid to enabled runtime PM for the phy child device, the APIs becomes NOOP. Therefore, let's remove them altogether. Signed-off-by: Ulf Hansson --- drivers/phy/phy-core.c | 66 ------------------------------------------------- include/linux/phy/phy.h | 45 --------------------------------- 2 files changed, 111 deletions(-) -- 2.7.4 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 9fa3f13..60818e1 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -149,72 +149,6 @@ 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 (!pm_runtime_enabled(&phy->dev)) - return -ENOTSUPP; - - ret = pm_runtime_get(&phy->dev); - if (ret < 0 && ret != -EINPROGRESS) - pm_runtime_put_noidle(&phy->dev); - - return ret; -} -EXPORT_SYMBOL_GPL(phy_pm_runtime_get); - -int phy_pm_runtime_get_sync(struct phy *phy) -{ - int ret; - - if (!pm_runtime_enabled(&phy->dev)) - return -ENOTSUPP; - - ret = pm_runtime_get_sync(&phy->dev); - if (ret < 0) - pm_runtime_put_sync(&phy->dev); - - return ret; -} -EXPORT_SYMBOL_GPL(phy_pm_runtime_get_sync); - -int phy_pm_runtime_put(struct phy *phy) -{ - if (!pm_runtime_enabled(&phy->dev)) - return -ENOTSUPP; - - return pm_runtime_put(&phy->dev); -} -EXPORT_SYMBOL_GPL(phy_pm_runtime_put); - -int phy_pm_runtime_put_sync(struct phy *phy) -{ - if (!pm_runtime_enabled(&phy->dev)) - return -ENOTSUPP; - - return pm_runtime_put_sync(&phy->dev); -} -EXPORT_SYMBOL_GPL(phy_pm_runtime_put_sync); - -void phy_pm_runtime_allow(struct phy *phy) -{ - if (!pm_runtime_enabled(&phy->dev)) - return; - - pm_runtime_allow(&phy->dev); -} -EXPORT_SYMBOL_GPL(phy_pm_runtime_allow); - -void phy_pm_runtime_forbid(struct phy *phy) -{ - if (!pm_runtime_enabled(&phy->dev)) - return; - - pm_runtime_forbid(&phy->dev); -} -EXPORT_SYMBOL_GPL(phy_pm_runtime_forbid); - int phy_init(struct phy *phy) { int ret; diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 4f8423a..29871aaa 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -17,7 +17,6 @@ #include #include #include -#include #include struct phy; @@ -133,12 +132,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); @@ -187,44 +180,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 Tue Dec 19 21:22:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 122410 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4697021qgn; Tue, 19 Dec 2017 13:23:02 -0800 (PST) X-Received: by 10.25.222.18 with SMTP id v18mr3080923lfg.143.1513718582087; Tue, 19 Dec 2017 13:23:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513718582; cv=none; d=google.com; s=arc-20160816; b=L1w1VuvjwpkqYxj1WdaVgu6bvOnYfGxY0d2ons1JQ2C3ZnIeTmLgxlX/y9ePt8CgCK GzN1ztZ6ht9iVfMUKa8XXLJppAgx56u07xdEA5pRIuobn5osSLqw0srW35Zg9jwPxLme MkNObOvNNZzarYquvNJDYhNg/q7gINUgSs10DOytnhRRemu2Hk7gzpU64I32VTNjQJCV I3JonqhzpEWpBZwTl5StSk5o2qvzV1Qv1veM79erAb5CKph1xtAUe/nGDrsK6JCNP06f CB+r5/eRPa73M9RUQJ5kfDNBiWFk6cBlpkbKCoFGLZ3wxOZ3SU9gSD2cKjC0jXMR3cOc rZOg== 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=B2dtHgFNzb2UrZK6K3gClLvywVXm3hxHvwuv6UELdgA=; b=syqoxgQDB4HNnLKNx60YWTAfzvzpZOulKBIeSTrjc6l/7o7rENrjFyEsCbhfk9QOQF zIK8NIfwgoNIC2CGcNPDvEXRtq3WJumO2ebfe2KZcCRts/DY30QrOtRAh4yHg8pxg1le WDzSXZYgyRJBmpp6TbfdAYqtIzqzi0XawVy/8/U48TUYuEPJouQqZEHc2sVRTHtrOFVw Xu16l8JYYvopmyigKWIjWv3ShiQqRycBH1+xIIsJQ13uhhXOqdgaKwBZQuT94wzGDXBI HBv6LxJ8jZrSTOJu01BKORKzCLgSDWU9XbTlP0o3yij2SV8kF5YP2Rn1ksPatwgPfr47 c4VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XpytnqB6; 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 x11sor2986082lje.83.2017.12.19.13.23.01 for (Google Transport Security); Tue, 19 Dec 2017 13:23:02 -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=XpytnqB6; 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=B2dtHgFNzb2UrZK6K3gClLvywVXm3hxHvwuv6UELdgA=; b=XpytnqB6chVXDYrdzok1RBtsXPQJV2imh79s98X/6tKleicsH4bSESMY2pFnYuRiCI TvAGyku8mfcmikQAn0nG10u/fwDjbWIskNIbHlUiVY5yZvbcJ5CFjk7CZ8dILyfFNZs2 NGAITXPcFW/oODlgdafhdqI1gS3AXvzbo1tIc= 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=B2dtHgFNzb2UrZK6K3gClLvywVXm3hxHvwuv6UELdgA=; b=Cz75+cUutITK9crkNiilLGmMTIKUtOLe3KLOrwZDOGc9aTsxIW1nZNjY2VJzVRdWIn y4BueUrRa//nZNaaHhQlEflptFRWAtgMzWTKnq8213MJ64E9DagkSWR7+W8H2MUOUCY1 tLXsdlawzpvIYQvRGoVsVSmQRVaqiRYMZWYyAGU7ojQII1WTJcI7puPPZ9S1RHomjpyh k/fJ+70dP9ZlgO0qr6Zcj7aNjZF4LalbjZiClMc+Ojmj7ozPiwbT4AIiGyTMd5M/R0Uy uiOfTzsmqO5+gF55O7mwasLmf/8E4VJ2AekDpEAfX+Egjl6PQK96wtn3wV6PdBP8SuDw drvw== X-Gm-Message-State: AKGB3mIv08RKeUW7jBYLaDC2eVOCkRiNg0HUgxN3eyIgcRZr0x9bzm/Z Z4p/+qFgza3AHNKsUVqsDsOKbYEG X-Google-Smtp-Source: ACJfBouADR+64U/jT8dQLPxOlgLf3lUrLpkKg5hcDPdTx01brwXO0GVxzQLTA5KigM/jTWrjDSUVJQ== X-Received: by 10.46.83.29 with SMTP id h29mr2989757ljb.144.1513718581723; Tue, 19 Dec 2017 13:23:01 -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 13sm3173068ljv.37.2017.12.19.13.23.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Dec 2017 13:23:00 -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 3/3] phy: core: Update the runtime PM section in the docs to reflect changes Date: Tue, 19 Dec 2017 22:22:31 +0100 Message-Id: <1513718551-28624-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513718551-28624-1-git-send-email-ulf.hansson@linaro.org> References: <1513718551-28624-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 | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) -- 2.7.4 diff --git a/Documentation/phy.txt b/Documentation/phy.txt index 457c3e0..6d9e3d3 100644 --- a/Documentation/phy.txt +++ b/Documentation/phy.txt @@ -160,19 +160,21 @@ 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. PHY Mappings ============