From patchwork Thu Oct 31 06:27:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Domenico Andreoli X-Patchwork-Id: 3118871 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F3FD3BF924 for ; Thu, 31 Oct 2013 06:33:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7ACAA20414 for ; Thu, 31 Oct 2013 06:33:11 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D38F2040F for ; Thu, 31 Oct 2013 06:33:08 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vbln9-00057N-7k; Thu, 31 Oct 2013 06:31:41 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vblmk-0008Ir-Dn; Thu, 31 Oct 2013 06:31:14 +0000 Received: from mail-ea0-x232.google.com ([2a00:1450:4013:c01::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vblm1-0008C3-5V for linux-arm-kernel@lists.infradead.org; Thu, 31 Oct 2013 06:30:36 +0000 Received: by mail-ea0-f178.google.com with SMTP id a15so1118776eae.23 for ; Wed, 30 Oct 2013 23:30:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:user-agent:date:from:to:cc:subject:references :content-disposition; bh=wCjfxto0FjATPAqiyftD7F2Zv+C8jN3PY+t1qCo6ukw=; b=0HAahki20zYO0Pr+IELzyV/tvp2SZR0tgs7X2PbXJcbm7Ytsq/r96rhXz8ynWO74nM LUDgkimsFgpySFNtaq2D/2dGMj2jd39ahMofhOOne4SMmeQw8U00M3P7JwJZsOr53btG eTxld8vYPJ2o16SyjkAx7sbsjfo1MuT8xt2iBknIBbtwNfhMydB/UAfP2PBaCOBjJQZP OYdIVGkIn0dBozxnTiDBwAGWUsiF0+lCbW50e9RQWHX0g2taFKJoveM8ltrrDN8p04FO i6Ow9q+xRVNGuerQx4IIT1Bpdhl+rbDV3KCzqTs3sqqLrXMJZCV7L3k5Bw0u/YBCNRLa /vpw== X-Received: by 10.14.182.72 with SMTP id n48mr967756eem.113.1383201008713; Wed, 30 Oct 2013 23:30:08 -0700 (PDT) Received: from shock.dandreoli.com (j115181.upc-j.chello.nl. [24.132.115.181]) by mx.google.com with ESMTPSA id i1sm4514857eeg.0.2013.10.30.23.30.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Oct 2013 23:30:07 -0700 (PDT) Received: by shock.dandreoli.com (Postfix, from userid 1000) id 100E13402EA; Thu, 31 Oct 2013 07:30:01 +0100 (CET) Message-Id: <20131031063000.859976312@linux.com> User-Agent: quilt/0.60-1 Date: Thu, 31 Oct 2013 07:27:18 +0100 From: Domenico Andreoli To: linux-arch@vger.kernel.org Subject: [PATCH 10/11] max8907: use the common machine reset handling References: <20131031062708.520968323@linux.com> Content-Disposition: inline; filename=max8907-machine-reset.patch X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131031_023029_602696_C724C483 X-CRM114-Status: GOOD ( 13.72 ) X-Spam-Score: -1.9 (-) Cc: Russell King , Arnd Bergmann , Ralf Baechle , Domenico Andreoli , linux-mips@lvger.kernel.org, Olof Johansson , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Domenico Andreoli Proof of concept: max8907 as provider of reset hooks. Cc: Russell King Cc: Arnd Bergmann Cc: Olof Johansson Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Domenico Andreoli --- 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 #include #include +#include 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;