All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
To: linux-tegra@vger.kernel.org
Cc: David Riley <davidriley@chromium.org>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Russell King <linux@arm.linux.org.uk>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Alexandre Courbot <gnurou@gmail.com>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Paul Walmsley <paul@pwsan.com>,
	Mikko Perttunen <mperttunen@nvidia.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v6 10/12] soc/tegra: pmc: move to using a restart handler
Date: Wed, 18 Mar 2015 10:52:25 +0100	[thread overview]
Message-ID: <1426672363-30667-11-git-send-email-tomeu.vizoso@collabora.com> (raw)
In-Reply-To: <1426672363-30667-1-git-send-email-tomeu.vizoso@collabora.com>

From: David Riley <davidriley@chromium.org>

The pmc driver was previously exporting tegra_pmc_restart, which was
assigned to machine_desc.init_machine, taking precedence over the
restart handlers registered through register_restart_handler().

Signed-off-by: David Riley <davidriley@chromium.org>
[tomeu.vizoso@collabora.com: Rebased]
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
---
 arch/arm/mach-tegra/tegra.c |  1 -
 drivers/soc/tegra/pmc.c     | 31 +++++++++++++++++++++----------
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 914341b..4805ef6 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -164,6 +164,5 @@ DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
 	.init_irq	= tegra_dt_init_irq,
 	.init_machine	= tegra_dt_init,
 	.init_late	= tegra_dt_init_late,
-	.restart	= tegra_pmc_restart,
 	.dt_compat	= tegra_dt_board_compat,
 MACHINE_END
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index c956395..0285b74 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -377,26 +377,23 @@ int tegra_pmc_cpu_remove_clamping(int cpuid)
 }
 #endif /* CONFIG_SMP */
 
-/**
- * tegra_pmc_restart() - reboot the system
- * @mode: which mode to reboot in
- * @cmd: reboot command
- */
-void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
+static int tegra_pmc_restart_notify(struct notifier_block *this,
+				    unsigned long mode, void *cmd)
 {
 	u32 value;
+	const char *cmd_str = (const char *) cmd;
 
 	value = tegra_pmc_readl(PMC_SCRATCH0);
 	value &= ~PMC_SCRATCH0_MODE_MASK;
 
-	if (cmd) {
-		if (strcmp(cmd, "recovery") == 0)
+	if (cmd_str) {
+		if (strcmp(cmd_str, "recovery") == 0)
 			value |= PMC_SCRATCH0_MODE_RECOVERY;
 
-		if (strcmp(cmd, "bootloader") == 0)
+		if (strcmp(cmd_str, "bootloader") == 0)
 			value |= PMC_SCRATCH0_MODE_BOOTLOADER;
 
-		if (strcmp(cmd, "forced-recovery") == 0)
+		if (strcmp(cmd_str, "forced-recovery") == 0)
 			value |= PMC_SCRATCH0_MODE_RCM;
 	}
 
@@ -405,8 +402,15 @@ void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
 	value = tegra_pmc_readl(0);
 	value |= 0x10;
 	tegra_pmc_writel(value, 0);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block tegra_pmc_restart_handler = {
+	.notifier_call = tegra_pmc_restart_notify,
+	.priority = 128,
+};
+
 static int powergate_show(struct seq_file *s, void *data)
 {
 	unsigned int i;
@@ -837,6 +841,13 @@ static int tegra_pmc_probe(struct platform_device *pdev)
 			return err;
 	}
 
+	err = register_restart_handler(&tegra_pmc_restart_handler);
+	if (err) {
+		dev_err(&pdev->dev, "unable to register restart handler, %d\n",
+			err);
+		return err;
+	}
+
 	return 0;
 }
 
-- 
2.1.0

WARNING: multiple messages have this Message-ID (diff)
From: tomeu.vizoso@collabora.com (Tomeu Vizoso)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 10/12] soc/tegra: pmc: move to using a restart handler
Date: Wed, 18 Mar 2015 10:52:25 +0100	[thread overview]
Message-ID: <1426672363-30667-11-git-send-email-tomeu.vizoso@collabora.com> (raw)
In-Reply-To: <1426672363-30667-1-git-send-email-tomeu.vizoso@collabora.com>

From: David Riley <davidriley@chromium.org>

The pmc driver was previously exporting tegra_pmc_restart, which was
assigned to machine_desc.init_machine, taking precedence over the
restart handlers registered through register_restart_handler().

Signed-off-by: David Riley <davidriley@chromium.org>
[tomeu.vizoso at collabora.com: Rebased]
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
---
 arch/arm/mach-tegra/tegra.c |  1 -
 drivers/soc/tegra/pmc.c     | 31 +++++++++++++++++++++----------
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 914341b..4805ef6 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -164,6 +164,5 @@ DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
 	.init_irq	= tegra_dt_init_irq,
 	.init_machine	= tegra_dt_init,
 	.init_late	= tegra_dt_init_late,
-	.restart	= tegra_pmc_restart,
 	.dt_compat	= tegra_dt_board_compat,
 MACHINE_END
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index c956395..0285b74 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -377,26 +377,23 @@ int tegra_pmc_cpu_remove_clamping(int cpuid)
 }
 #endif /* CONFIG_SMP */
 
-/**
- * tegra_pmc_restart() - reboot the system
- * @mode: which mode to reboot in
- * @cmd: reboot command
- */
-void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
+static int tegra_pmc_restart_notify(struct notifier_block *this,
+				    unsigned long mode, void *cmd)
 {
 	u32 value;
+	const char *cmd_str = (const char *) cmd;
 
 	value = tegra_pmc_readl(PMC_SCRATCH0);
 	value &= ~PMC_SCRATCH0_MODE_MASK;
 
-	if (cmd) {
-		if (strcmp(cmd, "recovery") == 0)
+	if (cmd_str) {
+		if (strcmp(cmd_str, "recovery") == 0)
 			value |= PMC_SCRATCH0_MODE_RECOVERY;
 
-		if (strcmp(cmd, "bootloader") == 0)
+		if (strcmp(cmd_str, "bootloader") == 0)
 			value |= PMC_SCRATCH0_MODE_BOOTLOADER;
 
-		if (strcmp(cmd, "forced-recovery") == 0)
+		if (strcmp(cmd_str, "forced-recovery") == 0)
 			value |= PMC_SCRATCH0_MODE_RCM;
 	}
 
@@ -405,8 +402,15 @@ void tegra_pmc_restart(enum reboot_mode mode, const char *cmd)
 	value = tegra_pmc_readl(0);
 	value |= 0x10;
 	tegra_pmc_writel(value, 0);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block tegra_pmc_restart_handler = {
+	.notifier_call = tegra_pmc_restart_notify,
+	.priority = 128,
+};
+
 static int powergate_show(struct seq_file *s, void *data)
 {
 	unsigned int i;
@@ -837,6 +841,13 @@ static int tegra_pmc_probe(struct platform_device *pdev)
 			return err;
 	}
 
+	err = register_restart_handler(&tegra_pmc_restart_handler);
+	if (err) {
+		dev_err(&pdev->dev, "unable to register restart handler, %d\n",
+			err);
+		return err;
+	}
+
 	return 0;
 }
 
-- 
2.1.0

  parent reply	other threads:[~2015-03-18  9:52 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  9:52 [PATCH v6 00/12] Improvements to Tegra-based Chromebook support Tomeu Vizoso
2015-03-18  9:52 ` Tomeu Vizoso
2015-03-18  9:52 ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 01/12] ARM: tegra: Change model of sound card in Nyan Big Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 02/12] ARM: tegra: Move out nyan-generic parts out from the nyan-big DT Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 03/12] drm/panel: add support for Samsung LTN140AT29 panel Tomeu Vizoso
2015-03-24 10:27   ` Thierry Reding
2015-03-18  9:52 ` [PATCH v6 04/12] ARM: tegra: Add DTS for the nyan-blaze board Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 05/12] ARM: tegra: Add node for trackpad in Nyan boards Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 06/12] ARM: tegra: Use pwrseq-simple for the wifi in Nyan Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` Tomeu Vizoso [this message]
2015-03-18  9:52   ` [PATCH v6 10/12] soc/tegra: pmc: move to using a restart handler Tomeu Vizoso
2015-03-24 10:26   ` Thierry Reding
2015-03-24 10:26     ` Thierry Reding
2015-03-18  9:52 ` [PATCH v6 11/12] ARM: tegra: Add gpio-restart node Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 12/12] ARM: tegra: The WiFi card is kept powered during suspend Tomeu Vizoso
2015-03-18  9:52   ` Tomeu Vizoso
2015-03-18  9:52 ` [PATCH v6 13/13] HACK: Hide RPMB partitions Tomeu Vizoso
     [not found]   ` <1426672363-30667-14-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-03-18  9:55     ` Tomeu Vizoso
2015-03-18  9:55       ` Tomeu Vizoso
     [not found] ` <1426672363-30667-1-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-03-18  9:52   ` [PATCH v6 07/12] ARM: tegra: Use the generated pinmux data Tomeu Vizoso
2015-03-18  9:52     ` Tomeu Vizoso
2015-03-18  9:52     ` Tomeu Vizoso
2015-03-18  9:52   ` [PATCH v6 08/12] ARM: tegra: Set spi-max-frequency property to flash node Tomeu Vizoso
2015-03-18  9:52     ` Tomeu Vizoso
2015-03-18  9:52     ` Tomeu Vizoso
2015-03-18  9:52   ` [PATCH v6 09/12] drm/tegra: Reset the SOR on probe Tomeu Vizoso
2015-03-18  9:52     ` Tomeu Vizoso
     [not found]     ` <1426672363-30667-10-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-03-24 10:24       ` Thierry Reding
2015-03-24 10:24         ` Thierry Reding
     [not found]         ` <20150324102447.GA18115-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-03-25  8:59           ` [PATCH] drm/tegra: Reset the SOR during initialization Tomeu Vizoso
2015-03-25  8:59             ` Tomeu Vizoso
     [not found]             ` <1427273979-394-1-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-03-26  9:24               ` Dmitry Osipenko
2015-03-26  9:24                 ` Dmitry Osipenko
2015-03-24 10:28   ` [PATCH v6 00/12] Improvements to Tegra-based Chromebook support Thierry Reding
2015-03-24 10:28     ` Thierry Reding
2015-03-24 10:28     ` Thierry Reding

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=1426672363-30667-11-git-send-email-tomeu.vizoso@collabora.com \
    --to=tomeu.vizoso@collabora.com \
    --cc=davidriley@chromium.org \
    --cc=gnurou@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mperttunen@nvidia.com \
    --cc=paul@pwsan.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=swarren@wwwdotorg.org \
    --cc=thierry.reding@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.