From: Bill Huang <bilhuang@nvidia.com>
To: <sameo@linux.intel.com>
Cc: <gg@slimlogic.co.uk>, <ldewangan@nvidia.com>,
<broonie@opensource.wolfsonmicro.com>, <ian@slimlogic.co.uk>,
<linux-kernel@vger.kernel.org>, <swarren@nvidia.com>,
Bill Huang <bilhuang@nvidia.com>
Subject: [PATCH 1/1] mfd: palmas: Add power off control
Date: Thu, 14 Mar 2013 03:58:00 -0700 [thread overview]
Message-ID: <1363258680-12600-1-git-send-email-bilhuang@nvidia.com> (raw)
Hook up "pm_power_off" to palmas power off routine if there is DT
property "ti,system-power-controller" defined, so platform which is
powered by this regulator can be powered off properly.
Based on work by:
Mallikarjun Kasoju <mkasoju@nvidia.com>
Signed-off-by: Bill Huang <bilhuang@nvidia.com>
---
drivers/mfd/palmas.c | 25 +++++++++++++++++++++++--
include/linux/mfd/palmas.h | 1 +
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index bbdbc50..ee8180d 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -283,6 +283,22 @@ static void palmas_dt_to_pdata(struct device_node *node,
pdata->power_ctrl = PALMAS_POWER_CTRL_NSLEEP_MASK |
PALMAS_POWER_CTRL_ENABLE1_MASK |
PALMAS_POWER_CTRL_ENABLE2_MASK;
+
+ pdata->pm_off = of_property_read_bool(node,
+ "ti,system-power-controller");
+}
+
+static struct palmas *palmas_dev;
+static void palmas_power_off(void)
+{
+ unsigned int addr;
+
+ if (!palmas_dev)
+ return;
+
+ addr = PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE, PALMAS_DEV_CTRL);
+
+ regmap_update_bits(palmas_dev->regmap[0], addr, 1, 0);
}
static int palmas_i2c_probe(struct i2c_client *i2c,
@@ -435,10 +451,15 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
*/
if (node) {
ret = of_platform_populate(node, NULL, NULL, &i2c->dev);
- if (ret < 0)
+ if (ret < 0) {
goto err_irq;
- else
+ } else {
+ if (pdata->pm_off && !pm_power_off) {
+ palmas_dev = palmas;
+ pm_power_off = palmas_power_off;
+ }
return ret;
+ }
}
children = kmemdup(palmas_children, sizeof(palmas_children),
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index a4d13d7..a447e54 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -232,6 +232,7 @@ struct palmas_platform_data {
*/
int mux_from_pdata;
u8 pad1, pad2;
+ bool pm_off;
struct palmas_pmic_platform_data *pmic_pdata;
struct palmas_gpadc_platform_data *gpadc_pdata;
--
1.7.9.5
next reply other threads:[~2013-03-14 10:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-14 10:58 Bill Huang [this message]
2013-03-15 5:19 ` Stephen Warren
2013-03-15 5:51 ` Bill Huang
2013-03-15 17:22 ` Stephen Warren
2013-03-16 2:02 ` Bill Huang
2013-07-30 12:05 Bill Huang
2013-07-30 13:17 ` Nishanth Menon
2013-07-31 6:22 ` Bill Huang
2013-07-31 11:58 ` Nishanth Menon
2013-07-31 17:16 ` Stephen Warren
2013-07-31 9:56 ` Lee Jones
2013-07-31 10:49 ` Bill Huang
2013-07-31 17:17 ` Stephen Warren
2013-08-01 8:47 ` Lee Jones
2013-08-01 16:13 ` Stephen Warren
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=1363258680-12600-1-git-send-email-bilhuang@nvidia.com \
--to=bilhuang@nvidia.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=gg@slimlogic.co.uk \
--cc=ian@slimlogic.co.uk \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=swarren@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome