linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: qcom: Hook pm_power_down for shutdown support
@ 2015-07-07  1:09 Stephen Boyd
  2015-07-13 22:59 ` Bjorn Andersson
  2015-07-17  8:00 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Boyd @ 2015-07-07  1:09 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, linux-gpio,
	Bjorn Andersson, Pramod Gurav

Assign pm_power_off() if we have the PS_HOLD functionality so
that we can properly shutdown the SoC. Otherwise, shutdown won't
do anything besides put the CPU into a tight loop. Unfortunately,
we have to use a singleton here because pm_power_off() doesn't
take any arguments. Fortunately there's only one instance of the
pinctrl device on a running system so this isn't a problem.

Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: Pramod Gurav <pramod.gurav@smartplayin.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/pinctrl/qcom/pinctrl-msm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index e457d52302a2..6242af8a42d5 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -28,6 +28,7 @@
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
 #include <linux/reboot.h>
+#include <linux/pm.h>
 
 #include "../core.h"
 #include "../pinconf.h"
@@ -855,6 +856,13 @@ static int msm_ps_hold_restart(struct notifier_block *nb, unsigned long action,
 	return NOTIFY_DONE;
 }
 
+static struct msm_pinctrl *poweroff_pctrl;
+
+static void msm_ps_hold_poweroff(void)
+{
+	msm_ps_hold_restart(&poweroff_pctrl->restart_nb, 0, NULL);
+}
+
 static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl)
 {
 	int i;
@@ -867,6 +875,8 @@ static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl)
 			if (register_restart_handler(&pctrl->restart_nb))
 				dev_err(pctrl->dev,
 					"failed to setup restart handler.\n");
+			poweroff_pctrl = pctrl;
+			pm_power_off = msm_ps_hold_poweroff;
 			break;
 		}
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: qcom: Hook pm_power_down for shutdown support
  2015-07-07  1:09 [PATCH] pinctrl: qcom: Hook pm_power_down for shutdown support Stephen Boyd
@ 2015-07-13 22:59 ` Bjorn Andersson
  2015-07-17  8:00 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2015-07-13 22:59 UTC (permalink / raw)
  To: Stephen Boyd, Linus Walleij
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, linux-gpio,
	Pramod Gurav

On Mon 06 Jul 18:09 PDT 2015, Stephen Boyd wrote:

> Assign pm_power_off() if we have the PS_HOLD functionality so
> that we can properly shutdown the SoC. Otherwise, shutdown won't
> do anything besides put the CPU into a tight loop. Unfortunately,
> we have to use a singleton here because pm_power_off() doesn't
> take any arguments. Fortunately there's only one instance of the
> pinctrl device on a running system so this isn't a problem.
> 
> Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> Cc: Pramod Gurav <pramod.gurav@smartplayin.com>
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>


I do find it odd that there's generic handling for restart but only the
crude way pm_power_off to shut the system down... But this seems to be
the way it should be done...

Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: qcom: Hook pm_power_down for shutdown support
  2015-07-07  1:09 [PATCH] pinctrl: qcom: Hook pm_power_down for shutdown support Stephen Boyd
  2015-07-13 22:59 ` Bjorn Andersson
@ 2015-07-17  8:00 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2015-07-17  8:00 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	Bjorn Andersson, Pramod Gurav

On Tue, Jul 7, 2015 at 3:09 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:

> Assign pm_power_off() if we have the PS_HOLD functionality so
> that we can properly shutdown the SoC. Otherwise, shutdown won't
> do anything besides put the CPU into a tight loop. Unfortunately,
> we have to use a singleton here because pm_power_off() doesn't
> take any arguments. Fortunately there's only one instance of the
> pinctrl device on a running system so this isn't a problem.
>
> Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> Cc: Pramod Gurav <pramod.gurav@smartplayin.com>
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

Patch applied with Björn's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-17  8:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-07  1:09 [PATCH] pinctrl: qcom: Hook pm_power_down for shutdown support Stephen Boyd
2015-07-13 22:59 ` Bjorn Andersson
2015-07-17  8:00 ` Linus Walleij

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).