From patchwork Thu Oct 31 06:27:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Domenico Andreoli X-Patchwork-Id: 3119401 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 85648BF924 for ; Thu, 31 Oct 2013 07:38:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77CDA20383 for ; Thu, 31 Oct 2013 07:38:43 +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 3125D2037D for ; Thu, 31 Oct 2013 07:38:42 +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 1VbloO-0005v0-T5; Thu, 31 Oct 2013 06:32:59 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vblnc-0008Mi-0N; Thu, 31 Oct 2013 06:32:08 +0000 Received: from mail-ee0-x22b.google.com ([2a00:1450:4013:c00::22b]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vblm3-0008C9-41 for linux-arm-kernel@lists.infradead.org; Thu, 31 Oct 2013 06:30:43 +0000 Received: by mail-ee0-f43.google.com with SMTP id b47so1111076eek.16 for ; Wed, 30 Oct 2013 23:30:09 -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=Jy18B1jpB7gs/XOgBOLgGc6Zx1WgPkPpVmxAd4fsC6I=; b=q1/3NTou0JxjvVpDOIFBd9fNIu/iMytG65MM+4oFESp6k/A1UTVcHT8JSmu/n/WYDG uBReVfGIu5DLreKI9W9/ihUmNJy7q4gxFCoOcfO0g2arFZGFMb+AVXDaUmmIAphFWlnb C/20kS7v/x9X+PE2jvQkpyMyYwNcSVsPvONupZKVl860+F3nYJ6WAFyQvVmbgWPQgtiw K0RCYctaDb5nV8Y8s+CsRPoPxcChIcZq49TL7+VMTRLrI0T5aqgu0O7quU2P7gtWp419 du1SGmcJLofIa1ybQEVEuE3Qf0VerTVK8uu7jiPzH7otpsM9TkUfIp/ka2pVGWaHyOjT DV5Q== X-Received: by 10.14.32.196 with SMTP id o44mr1407809eea.43.1383201009232; Wed, 30 Oct 2013 23:30:09 -0700 (PDT) Received: from shock.dandreoli.com (j115181.upc-j.chello.nl. [24.132.115.181]) by mx.google.com with ESMTPSA id h45sm4471586eeg.5.2013.10.30.23.30.05 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 CED6B3402E2; Thu, 31 Oct 2013 07:30:00 +0100 (CET) Message-Id: <20131031063000.608298078@linux.com> User-Agent: quilt/0.60-1 Date: Thu, 31 Oct 2013 07:27:17 +0100 From: Domenico Andreoli To: linux-arch@vger.kernel.org Subject: [PATCH 09/11] ARM: tps65910: use the common machine reset handling References: <20131031062708.520968323@linux.com> Content-Disposition: inline; filename=tps65910-machine-reset.patch X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131031_023031_431333_4D70DDD9 X-CRM114-Status: GOOD ( 15.24 ) 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: tps65910 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/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 #include #include +#include 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,