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: 14050 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E44E423E2E for ; Tue, 15 Jan 2013 12:56:29 +0000 (UTC) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by fiordland.canonical.com (Postfix) with ESMTP id 8D1EEA192C6 for ; Tue, 15 Jan 2013 12:56:29 +0000 (UTC) Received: by mail-vc0-f176.google.com with SMTP id fo13so55255vcb.21 for ; Tue, 15 Jan 2013 04:56:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf: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=eVLFUJ6Hi0g4rU9BDuS/emFr5kg2ckMhr2+PeOZ1OsThePg9aDIzDC726YrUwyfocT AhYoxpluG4dj9XAFxQ+Z92ftPQgNS6KiZ9oOK0Whjsfmwg5e/zdG4v2xRua9Gxv2/qV6 7VxBUetGTQI8LCo1Bu1Ve7A7/rD6jhZoJ/SIH5nI70645oCvSJcCdmgZpqvGIWrX1q4J eoz2xBBVo17aJU6bmt8zB7zLofM7EADJIvEPnaeZZi//DCkgVZaCb5qzoTG2fs6AUhR1 KRhxZD7enmt7ldNN0DG4vXdOS8dyQ5LrAzq6/WSLM8Rds9tcOZcvf5Jx4Jgmr50l0+dp ZxLA== X-Received: by 10.220.218.197 with SMTP id hr5mr103133440vcb.8.1358254589048; Tue, 15 Jan 2013 04:56:29 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp110584veb; Tue, 15 Jan 2013 04:56:28 -0800 (PST) X-Received: by 10.194.174.234 with SMTP id bv10mr26250240wjc.47.1358254588009; Tue, 15 Jan 2013 04:56:28 -0800 (PST) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by mx.google.com with ESMTPS id t6si9132912wjw.34.2013.01.15.04.56.27 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jan 2013 04:56:27 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.177 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.177; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.177 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wi0-f177.google.com with SMTP id hm2so61045wib.10 for ; Tue, 15 Jan 2013 04:56:27 -0800 (PST) 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 Cc: arnd@arndb.de, linus.walleij@stericsson.com, sameo@linux.intel.com, Lee Jones 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: ALoCoQmSkbdHpQVri/V9gCi0AB4vF2PmRo/6EV74Wr6Ti5Za4lciBx8xUv7YjQTD2mECHv3kywBl 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;