From patchwork Tue Jan 15 12:55:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1977641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 6F0213FE1F for ; Tue, 15 Jan 2013 13:00:59 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tv64d-0006hO-3z; Tue, 15 Jan 2013 12:57:03 +0000 Received: from mail-wg0-f50.google.com ([74.125.82.50]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tv646-0006U9-3l for linux-arm-kernel@lists.infradead.org; Tue, 15 Jan 2013 12:56:31 +0000 Received: by mail-wg0-f50.google.com with SMTP id es5so40146wgb.29 for ; Tue, 15 Jan 2013 04:56:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=bxCZjJYDU+sCjt+qSHQwxT+jcI1d+/saOhn4PbTorJY=; b=CByGM8dcI0EcLcLCIpm7LRRAOvuSW5hfcsV35EPw5wURE+mhnv64HXWZJr0cNbdOh2 qJNUYhATzdIKm9dyh+61SoQ8bE4KXtvdKc1vHkCVpLgJWds3dcKrb+7UNFB3jNLgdzr4 DBqMSR7U171zSeLZB+rrsTvJOTl/49tEPYFCGO9j0e4B6x8nt411qKA7qGfTFDWyBYHp tnh02XuKxvaf9Y43ZeM11+6RUfTZwIQwc+lQCoAwPRrFlo+q4qMvg0QopWC9GOfKWCG7 UKGd/Y2Ib3KD2bzkPIcIgqPuUDLGArlYAcwv7kT18vPbeLGPOrcto+Kk8C9gC7MuqlUK ktPQ== X-Received: by 10.180.72.232 with SMTP id g8mr3642552wiv.0.1358254587604; Tue, 15 Jan 2013 04:56:27 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id eo10sm3672833wib.9.2013.01.15.04.56.25 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jan 2013 04:56:26 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/26] mfd: ab8500-sysctrl: Provide a platform specific pm_power_off() call-back Date: Tue, 15 Jan 2013 12:55:41 +0000 Message-Id: <1358254566-12419-2-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1358254566-12419-1-git-send-email-lee.jones@linaro.org> References: <1358254566-12419-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnWKdng8F1JVv6gtHecf5YP8M09+mwNmknOHvc+WYFQt94HeIHiv8mxP/3DfN9fyomD2Kre X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130115_075630_407250_38FD16D8 X-CRM114-Status: GOOD ( 15.43 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.50 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Lee Jones , linus.walleij@stericsson.com, arnd@arndb.de, sameo@linux.intel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The kernel allows us to specify a function call-back which will be invoked when a system power-off request has been received. Here we provide one which is to be used when shutting down AB8500 based platforms. Signed-off-by: Lee Jones --- drivers/mfd/ab8500-sysctrl.c | 22 ++++++++++++++++++++++ include/linux/mfd/abx500/ab8500.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c index c28d4eb..799fb5e 100644 --- a/drivers/mfd/ab8500-sysctrl.c +++ b/drivers/mfd/ab8500-sysctrl.c @@ -7,12 +7,29 @@ #include #include #include +#include +#include #include #include #include static struct device *sysctrl_dev; +void ab8500_power_off(void) +{ + sigset_t old; + sigset_t all; + + sigfillset(&all); + + if (!sigprocmask(SIG_BLOCK, &all, &old)) { + (void)ab8500_sysctrl_set(AB8500_STW4500CTRL1, + AB8500_STW4500CTRL1_SWOFF | + AB8500_STW4500CTRL1_SWRESET4500N); + (void)sigprocmask(SIG_SETMASK, &old, NULL); + } +} + static inline bool valid_bank(u8 bank) { return ((bank == AB8500_SYS_CTRL1_BLOCK) || @@ -51,7 +68,12 @@ int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value) static int __devinit ab8500_sysctrl_probe(struct platform_device *pdev) { + struct ab8500_platform_data *plat; + sysctrl_dev = &pdev->dev; + plat = dev_get_platdata(pdev->dev.parent); + if (plat->pm_power_off) + pm_power_off = ab8500_power_off; return 0; } diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index 1491044..96840c4 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h @@ -274,6 +274,7 @@ struct ab8500_codec_platform_data; /** * struct ab8500_platform_data - AB8500 platform data * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used + * @pm_power_off: Should machine pm power off hook be registered or not * @init: board-specific initialization after detection of ab8500 * @num_regulator_reg_init: number of regulator init registers * @regulator_reg_init: regulator init registers @@ -282,6 +283,7 @@ struct ab8500_codec_platform_data; */ struct ab8500_platform_data { int irq_base; + bool pm_power_off; void (*init) (struct ab8500 *); int num_regulator_reg_init; struct ab8500_regulator_reg_init *regulator_reg_init;