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 10/11] max8907: use the common machine reset handling
Date: Thu, 31 Oct 2013 07:27:18 +0100	[thread overview]
Message-ID: <20131031063000.859976312@linux.com> (raw)
In-Reply-To: 20131031062708.520968323@linux.com

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

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

Proof of concept: max8907 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/max8907.c |   13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

Index: b/drivers/mfd/Kconfig
===================================================================
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -339,6 +339,7 @@ config MFD_MAX8907
 	tristate "Maxim Semiconductor MAX8907 PMIC Support"
 	select MFD_CORE
 	depends on I2C=y
+	select MACHINE_RESET
 	select REGMAP_I2C
 	select REGMAP_IRQ
 	help
Index: b/drivers/mfd/max8907.c
===================================================================
--- a/drivers/mfd/max8907.c
+++ b/drivers/mfd/max8907.c
@@ -20,6 +20,7 @@
 #include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
+#include <linux/machine_reset.h>
 
 static struct mfd_cell max8907_cells[] = {
 	{ .name = "max8907-regulator", },
@@ -176,9 +177,9 @@ static const struct regmap_irq_chip max8
 	.num_irqs = ARRAY_SIZE(max8907_rtc_irqs),
 };
 
-static struct max8907 *max8907_pm_off;
-static void max8907_power_off(void)
+static void max8907_power_off(void *dev)
 {
+	struct max8907 *max8907_pm_off = dev;
 	regmap_update_bits(max8907_pm_off->regmap_gen, MAX8907_REG_RESET_CNFG,
 			MAX8907_MASK_POWER_OFF, MAX8907_MASK_POWER_OFF);
 }
@@ -266,9 +267,11 @@ static int max8907_i2c_probe(struct i2c_
 		goto err_add_devices;
 	}
 
-	if (pm_off && !pm_power_off) {
-		max8907_pm_off = max8907;
-		pm_power_off = max8907_power_off;
+	if (pm_off) {
+		struct reset_hook hook;
+		reset_hook_init(&hook);
+		hook.power_off = max8907_power_off;
+		set_machine_reset(RESET_POWER_OFF, &hook, max8907);
 	}
 
 	return 0;

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

An embedded and charset-unspecified text was scrubbed...
Name: max8907-machine-reset.patch
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131031/381822e0/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 ` [PATCH 09/11] ARM: tps65910: " Domenico Andreoli
2013-10-31  6:27   ` Domenico Andreoli
2013-10-31  6:27 ` Domenico Andreoli [this message]
2013-10-31  6:27   ` [PATCH 10/11] max8907: " 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.859976312@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.