linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/4] Update am437x and am335x dts to probe with ti-sysc
Date: Mon, 1 Oct 2018 09:32:53 -0700	[thread overview]
Message-ID: <20181001163253.GW5662@atomide.com> (raw)
In-Reply-To: <305bf1c3-915d-dac1-95e4-4d32621247e1@ti.com>

* Keerthy <j-keerthy@ti.com> [180927 05:00]:
> Also tested on beaglebone black DS0 works fine. Although there seems to
> be an additional warning which was not seen before:
> 
> "l4-wkup-clkctrl:0008:0: failed to disable"
> 
> log: https://pastebin.ubuntu.com/p/Ns2WRdVkXS/

Can you test the following patch applied on top of the
omap-for-v4.20/dt-ti-sysc-tmp-testing-v2 testing branch?

Based on Grygorii's i2c-omap comments, I think we should also
do the following in the ti-sysc driver becasuse the pm_runtime
use count can be whatever.

Regards,

Tony

8< ----------------------
>From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Mon, 1 Oct 2018 09:11:57 -0700
Subject: [PATCH] bus: ti-sysc: Just use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS

As Grygorii Strashko pointed out, the runtime PM use count of the
children can be whatever at suspend and we should not use it. So
let's just suspend ti-sysc at noirq level and get rid of some code.

Let's also remove the PM_SLEEP ifdef and use __maybe_unused as the
PM code already deals with the ifdefs.

Suggested-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/bus/ti-sysc.c | 113 ++----------------------------------------
 1 file changed, 4 insertions(+), 109 deletions(-)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -87,7 +87,6 @@ struct sysc {
 	u32 revision;
 	bool enabled;
 	bool needs_resume;
-	unsigned int noirq_suspend:1;
 	bool child_needs_resume;
 	struct delayed_work idle_work;
 };
@@ -702,75 +701,7 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
 	return error;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int sysc_suspend(struct device *dev)
-{
-	struct sysc *ddata;
-	int error;
-
-	ddata = dev_get_drvdata(dev);
-
-	if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE)
-		return 0;
-
-	if (!ddata->enabled || ddata->noirq_suspend)
-		return 0;
-
-	dev_dbg(ddata->dev, "%s %s\n", __func__,
-		ddata->name ? ddata->name : "");
-
-	error = pm_runtime_put_sync_suspend(dev);
-	if (error == -EBUSY) {
-		dev_dbg(ddata->dev, "%s busy, tagging for noirq suspend %s\n",
-			__func__, ddata->name ? ddata->name : "");
-
-		ddata->noirq_suspend = true;
-
-		return 0;
-	} else if (error < 0) {
-		dev_warn(ddata->dev, "%s cannot suspend %i %s\n",
-			 __func__, error,
-			 ddata->name ? ddata->name : "");
-
-		return 0;
-	}
-
-	ddata->needs_resume = true;
-
-	return 0;
-}
-
-static int sysc_resume(struct device *dev)
-{
-	struct sysc *ddata;
-	int error;
-
-	ddata = dev_get_drvdata(dev);
-
-	if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE)
-		return 0;
-
-	if (!ddata->needs_resume || ddata->noirq_suspend)
-		return 0;
-
-	dev_dbg(ddata->dev, "%s %s\n", __func__,
-		ddata->name ? ddata->name : "");
-
-	error = pm_runtime_get_sync(dev);
-	if (error < 0) {
-		dev_err(ddata->dev, "%s  error %i %s\n",
-			__func__, error,
-			ddata->name ? ddata->name : "");
-
-		return error;
-	}
-
-	ddata->needs_resume = false;
-
-	return 0;
-}
-
-static int sysc_noirq_suspend(struct device *dev)
+static int __maybe_unused sysc_noirq_suspend(struct device *dev)
 {
 	struct sysc *ddata;
 	int error;
@@ -780,26 +711,10 @@ static int sysc_noirq_suspend(struct device *dev)
 	if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE)
 		return 0;
 
-	if (!ddata->enabled || !ddata->noirq_suspend)
-		return 0;
-
-	dev_dbg(ddata->dev, "%s %s\n", __func__,
-		ddata->name ? ddata->name : "");
-
-	error = sysc_runtime_suspend(dev);
-	if (error) {
-		dev_warn(ddata->dev, "%s busy %i %s\n",
-			 __func__, error, ddata->name ? ddata->name : "");
-
-		return 0;
-	}
-
-	ddata->needs_resume = true;
-
-	return 0;
+	return pm_runtime_force_suspend(dev);
 }
 
-static int sysc_noirq_resume(struct device *dev)
+static int __maybe_unused sysc_noirq_resume(struct device *dev)
 {
 	struct sysc *ddata;
 	int error;
@@ -809,30 +724,10 @@ static int sysc_noirq_resume(struct device *dev)
 	if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE)
 		return 0;
 
-	if (!ddata->needs_resume || !ddata->noirq_suspend)
-		return 0;
-
-	dev_dbg(ddata->dev, "%s %s\n", __func__,
-		ddata->name ? ddata->name : "");
-
-	error = sysc_runtime_resume(dev);
-	if (error) {
-		dev_warn(ddata->dev, "%s cannot resume %i %s\n",
-			 __func__, error,
-			 ddata->name ? ddata->name : "");
-
-		return error;
-	}
-
-	/* Maybe also reconsider clearing noirq_suspend at some point */
-	ddata->needs_resume = false;
-
-	return 0;
+	return pm_runtime_force_resume(dev);
 }
-#endif
 
 static const struct dev_pm_ops sysc_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(sysc_suspend, sysc_resume)
 	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(sysc_noirq_suspend, sysc_noirq_resume)
 	SET_RUNTIME_PM_OPS(sysc_runtime_suspend,
 			   sysc_runtime_resume,
-- 
2.19.0

  parent reply	other threads:[~2018-10-01 16:32 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25  0:05 [PATCH 0/4] Update am437x and am335x dts to probe with ti-sysc Tony Lindgren
2018-09-25  0:05 ` [PATCH 1/4] ARM: dts: am437x: Add l4 interconnect hierarchy and ti-sysc data Tony Lindgren
2018-09-25  0:05 ` [PATCH 2/4] ARM: dts: am437x: Move l4 child devices to probe them with ti-sysc Tony Lindgren
2018-12-04 12:23   ` Peter Ujfalusi
2018-12-04 18:11     ` Tony Lindgren
2018-12-04 23:18       ` Tony Lindgren
2018-12-05  6:14         ` Peter Ujfalusi
2018-12-05 19:00           ` Tony Lindgren
2018-12-05 23:02             ` Tony Lindgren
2018-12-07 12:46               ` Peter Ujfalusi
2018-09-25  0:05 ` [PATCH 3/4] ARM: dts: am335x: Add l4 interconnect hierarchy and ti-sysc data Tony Lindgren
2018-09-27 14:56   ` Tony Lindgren
2018-09-25  0:05 ` [PATCH 4/4] ARM: dts: am335x: Move l4 child devices to probe them with ti-sysc Tony Lindgren
2018-11-27 13:03   ` Peter Ujfalusi
2018-11-27 16:16     ` Tony Lindgren
2018-11-28 12:52       ` Peter Ujfalusi
2018-11-29 19:07         ` Tony Lindgren
2018-09-25  5:14 ` [PATCH 0/4] Update am437x and am335x dts to probe " Keerthy
2018-09-25 14:40   ` Tony Lindgren
2018-09-25 17:55     ` Tony Lindgren
2018-09-25 21:16       ` Grygorii Strashko
2018-09-26  4:08       ` Keerthy
2018-09-26 15:59         ` Tony Lindgren
2018-09-26 16:23           ` Tony Lindgren
2018-09-26 21:36             ` Grygorii Strashko
2018-09-26 23:31               ` Tony Lindgren
2018-09-27  4:55                 ` Keerthy
2018-09-27 14:53                   ` Tony Lindgren
2018-09-27 21:43                     ` Tony Lindgren
2018-10-01 16:32                   ` Tony Lindgren [this message]
2018-10-04  4:29                     ` Keerthy
2018-10-04 14:23                       ` Tony Lindgren
2018-09-27 19:11                 ` Grygorii Strashko
2018-09-27 19:38                   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181001163253.GW5662@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).