All of lore.kernel.org
 help / color / mirror / Atom feed
From: Domenico Andreoli <domenico.andreoli@linux.com>
To: linux-arch@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-mips@lvger.kernel.org,
	Russell King <linux@arm.linux.org.uk>,
	Arnd Bergmann <arnd@arndb.de>, Olof Johansson <olof@lixom.net>,
	Ralf Baechle <ralf@linux-mips.org>,
	Domenico Andreoli <domenico.andreoli@linux.com>
Subject: [PATCH 09/11] ARM: tps65910: use the common machine reset handling
Date: Thu, 31 Oct 2013 07:27:17 +0100	[thread overview]
Message-ID: <20131031063000.608298078@linux.com> (raw)
In-Reply-To: 20131031062708.520968323@linux.com

[-- Attachment #1: tps65910-machine-reset.patch --]
[-- Type: text/plain, Size: 2241 bytes --]

From: Domenico Andreoli <domenico.andreoli@linux.com>

Proof of concept: tps65910 as provider of reset hooks.

Cc: Russell King <linux@arm.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Olof Johansson <olof@lixom.net>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>
---
 drivers/mfd/Kconfig    |    1 +
 drivers/mfd/tps65910.c |   16 ++++++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

Index: b/drivers/mfd/Kconfig
===================================================================
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -769,6 +769,7 @@ config TPS65010
 	tristate "TI TPS6501x Power Management chips"
 	depends on I2C && GPIOLIB
 	default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK
+	select MACHINE_RESET
 	help
 	  If you say yes here you get support for the TPS6501x series of
 	  Power Management chips.  These include voltage regulators,
Index: b/drivers/mfd/tps65910.c
===================================================================
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -26,6 +26,7 @@
 #include <linux/regmap.h>
 #include <linux/mfd/tps65910.h>
 #include <linux/of_device.h>
+#include <linux/machine_reset.h>
 
 static struct resource rtc_resources[] = {
 	{
@@ -438,12 +439,9 @@ struct tps65910_board *tps65910_parse_dt
 }
 #endif
 
-static struct i2c_client *tps65910_i2c_client;
-static void tps65910_power_off(void)
+static void tps65910_power_off(void *dev)
 {
-	struct tps65910 *tps65910;
-
-	tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev);
+	struct tps65910 *tps65910 = dev_get_drvdata(dev);
 
 	if (tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL,
 			DEVCTRL_PWR_OFF_MASK) < 0)
@@ -501,9 +499,11 @@ static int tps65910_i2c_probe(struct i2c
 	tps65910_ck32k_init(tps65910, pmic_plat_data);
 	tps65910_sleepinit(tps65910, pmic_plat_data);
 
-	if (pmic_plat_data->pm_off && !pm_power_off) {
-		tps65910_i2c_client = i2c;
-		pm_power_off = tps65910_power_off;
+	if (pmic_plat_data->pm_off) {
+		struct reset_hook hook;
+		reset_hook_init(&hook);
+		hook.power_off = tps65910_power_off;
+		set_machine_reset(RESET_POWER_OFF, &hook, &i2c->dev);
 	}
 
 	ret = mfd_add_devices(tps65910->dev, -1,

WARNING: multiple messages have this Message-ID (diff)
From: domenico.andreoli@linux.com (Domenico Andreoli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/11] ARM: tps65910: use the common machine reset handling
Date: Thu, 31 Oct 2013 07:27:17 +0100	[thread overview]
Message-ID: <20131031063000.608298078@linux.com> (raw)
In-Reply-To: 20131031062708.520968323@linux.com

An embedded and charset-unspecified text was scrubbed...
Name: tps65910-machine-reset.patch
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131031/4c73965d/attachment.ksh>

  parent reply	other threads:[~2013-10-31  6:30 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31  6:27 [PATCH 00/11] RFC: Common machine reset handling Domenico Andreoli
2013-10-31  6:27 ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 01/11] machine-reset: platform generic handling Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 02/11] ARM: use the common machine reset handling Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 03/11] ARM64: " Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 04/11] MIPS: " Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-11-01  5:11   ` Vineet Gupta
2013-11-01  5:11     ` Vineet Gupta
2013-11-01  5:26     ` Domenico Andreoli
2013-11-01  5:26       ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 05/11] ARM: vexpress: consolidate machine reset func Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 06/11] ARM: vexpress: use the common machine reset handling Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 07/11] ARM: bcm2835: " Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 08/11] ARM: u300: " Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-10-31 14:40   ` Linus Walleij
2013-10-31 14:40     ` Linus Walleij
2013-10-31 15:19     ` Domenico Andreoli
2013-10-31 15:19       ` Domenico Andreoli
2013-10-31  6:27 ` Domenico Andreoli [this message]
2013-10-31  6:27   ` [PATCH 09/11] ARM: tps65910: " Domenico Andreoli
2013-10-31  6:27 ` [PATCH 10/11] max8907: " Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 11/11] ARM: sp805: " Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-10-31 10:21 ` [PATCH 00/11] RFC: Common " Russell King - ARM Linux
2013-10-31 10:21   ` Russell King - ARM Linux
2013-10-31 21:49 ` Stephen Warren
2013-10-31 21:49   ` Stephen Warren
2013-11-01  5:16   ` Domenico Andreoli
2013-11-01  5:16     ` Domenico Andreoli
2013-11-01 15:58     ` Stephen Warren
2013-11-01 15:58       ` Stephen Warren
2013-11-01 16:12       ` Russell King - ARM Linux
2013-11-01 16:12         ` Russell King - ARM Linux

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=20131031063000.608298078@linux.com \
    --to=domenico.andreoli@linux.com \
    --cc=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mips@lvger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=olof@lixom.net \
    --cc=ralf@linux-mips.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 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.