devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND v2 1/1] mfd: palmas: Add power off control
@ 2013-08-08 11:45 Bill Huang
  2013-08-08 12:32 ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Bill Huang @ 2013-08-08 11:45 UTC (permalink / raw)
  To: sameo
  Cc: rob.herring, pawel.moll, mark.rutland, swarren, ian.campbell, rob,
	lee.jones, broonie, nm, j-keerthy, grant.likely, ian, devicetree,
	linux-doc, linux-kernel, Bill Huang, Mallikarjun Kasoju

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.

Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Signed-off-by: Bill Huang <bilhuang@nvidia.com>
---
 .../devicetree/bindings/regulator/palmas-pmic.txt  |    5 +++
 drivers/mfd/palmas.c                               |   33 ++++++++++++++++++--
 include/linux/mfd/palmas.h                         |    1 +
 3 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt
index 30b0581..4adca2a 100644
--- a/Documentation/devicetree/bindings/regulator/palmas-pmic.txt
+++ b/Documentation/devicetree/bindings/regulator/palmas-pmic.txt
@@ -36,6 +36,9 @@ Optional nodes:
 	       ti,smps-range - OTP has the wrong range set for the hardware so override
 	       0 - low range, 1 - high range.
 
+- ti,system-power-controller: Telling whether or not this pmic is controlling
+			      the system power.
+
 Example:
 
 #include <dt-bindings/interrupt-controller/irq.h>
@@ -48,6 +51,8 @@ pmic {
 
 	ti,ldo6-vibrator;
 
+	ti,system-power-controller;
+
 	regulators {
 		smps12_reg : smps12 {
 			regulator-name = "smps12";
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index e4d1c70..220a34d 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -229,6 +229,32 @@ static void palmas_dt_to_pdata(struct i2c_client *i2c,
 					PALMAS_POWER_CTRL_ENABLE2_MASK;
 	if (i2c->irq)
 		palmas_set_pdata_irq_flag(i2c, pdata);
+
+	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;
+	int ret, slave;
+
+	if (!palmas_dev)
+		return;
+
+	slave = PALMAS_BASE_TO_SLAVE(PALMAS_PMU_CONTROL_BASE);
+	addr = PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE, PALMAS_DEV_CTRL);
+
+	ret = regmap_update_bits(
+			palmas_dev->regmap[slave],
+			addr,
+			PALMAS_DEV_CTRL_DEV_ON,
+			0);
+
+	if (ret)
+		pr_err("%s: Unable to write to DEV_CTRL_DEV_ON: %d\n",
+				__func__, ret);
 }
 
 static unsigned int palmas_features = PALMAS_PMIC_FEATURE_SMPS10_BOOST;
@@ -423,10 +449,13 @@ no_irq:
 	 */
 	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;
+		}
 	}
 
 	return ret;
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 1a8dd7a..061cce0 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -258,6 +258,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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND v2 1/1] mfd: palmas: Add power off control
  2013-08-08 11:45 [PATCH RESEND v2 1/1] mfd: palmas: Add power off control Bill Huang
@ 2013-08-08 12:32 ` Lee Jones
  2013-08-09 13:01   ` Bill Huang
  0 siblings, 1 reply; 5+ messages in thread
From: Lee Jones @ 2013-08-08 12:32 UTC (permalink / raw)
  To: Bill Huang
  Cc: sameo, rob.herring, pawel.moll, mark.rutland, swarren,
	ian.campbell, rob, broonie, nm, j-keerthy, grant.likely, ian,
	devicetree, linux-doc, linux-kernel, Mallikarjun Kasoju

On Thu, 08 Aug 2013, Bill Huang wrote:

> 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.
> 
> Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
> Signed-off-by: Bill Huang <bilhuang@nvidia.com>
> ---
>  .../devicetree/bindings/regulator/palmas-pmic.txt  |    5 +++
>  drivers/mfd/palmas.c                               |   33 ++++++++++++++++++--
>  include/linux/mfd/palmas.h                         |    1 +
>  3 files changed, 37 insertions(+), 2 deletions(-)

Was a clear conclusion reached between Nishanth and yourself?

As he has strong opinions on this I'd ideally like his Ack before
applying the patch.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND v2 1/1] mfd: palmas: Add power off control
  2013-08-08 12:32 ` Lee Jones
@ 2013-08-09 13:01   ` Bill Huang
  2013-08-09 14:47     ` Nishanth Menon
  0 siblings, 1 reply; 5+ messages in thread
From: Bill Huang @ 2013-08-09 13:01 UTC (permalink / raw)
  To: Lee Jones
  Cc: sameo@linux.intel.com, rob.herring@calxeda.com,
	pawel.moll@arm.com, mark.rutland@arm.com, swarren@wwwdotorg.org,
	ian.campbell@citrix.com, rob@landley.net, broonie@linaro.org,
	nm@ti.com, j-keerthy@ti.com, grant.likely@linaro.org,
	ian@slimlogic.co.uk, devicetree@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mallikarjun Kasoju

On Thu, 2013-08-08 at 20:32 +0800, Lee Jones wrote:
> On Thu, 08 Aug 2013, Bill Huang wrote:
> 
> > 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.
> > 
> > Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
> > Signed-off-by: Bill Huang <bilhuang@nvidia.com>
> > ---
> >  .../devicetree/bindings/regulator/palmas-pmic.txt  |    5 +++
> >  drivers/mfd/palmas.c                               |   33 ++++++++++++++++++--
> >  include/linux/mfd/palmas.h                         |    1 +
> >  3 files changed, 37 insertions(+), 2 deletions(-)
> 
> Was a clear conclusion reached between Nishanth and yourself?
> 
> As he has strong opinions on this I'd ideally like his Ack before
> applying the patch.
> 
Hi Nishanth,

Feel free to NACK if you are feeling this can't fit what you would like
to add, then I'll pass the ball to you for implementing Palmas power off
since you have already wrote part of the driver (with USB IRQ unmask?).



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND v2 1/1] mfd: palmas: Add power off control
  2013-08-09 13:01   ` Bill Huang
@ 2013-08-09 14:47     ` Nishanth Menon
  2013-08-12 13:52       ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Nishanth Menon @ 2013-08-09 14:47 UTC (permalink / raw)
  To: Bill Huang
  Cc: Lee Jones, sameo@linux.intel.com, rob.herring@calxeda.com,
	pawel.moll@arm.com, mark.rutland@arm.com, swarren@wwwdotorg.org,
	ian.campbell@citrix.com, rob@landley.net, broonie@linaro.org,
	j-keerthy@ti.com, grant.likely@linaro.org, ian@slimlogic.co.uk,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, Mallikarjun Kasoju

On 08/09/2013 08:01 AM, Bill Huang wrote:
> On Thu, 2013-08-08 at 20:32 +0800, Lee Jones wrote:
>> On Thu, 08 Aug 2013, Bill Huang wrote:
>>
>>> 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.
>>>
>>> Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
>>> Signed-off-by: Bill Huang <bilhuang@nvidia.com>
>>> ---
>>>   .../devicetree/bindings/regulator/palmas-pmic.txt  |    5 +++
>>>   drivers/mfd/palmas.c                               |   33 ++++++++++++++++++--
>>>   include/linux/mfd/palmas.h                         |    1 +
>>>   3 files changed, 37 insertions(+), 2 deletions(-)
>>
>> Was a clear conclusion reached between Nishanth and yourself?
>>
>> As he has strong opinions on this I'd ideally like his Ack before
>> applying the patch.
>>
> Feel free to NACK if you are feeling this can't fit what you would like
> to add, then I'll pass the ball to you for implementing Palmas power off
> since you have already wrote part of the driver (with USB IRQ unmask?).
Apologies on the delay in review. As long as we are ok with not having a 
drivers/power/reset driver, I can buy this as a step #1. USB IRQ unmask 
could go on top of it.

Other than that,
Acked-by: Nishanth Menon <nm@ti.com>

-- 
Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RESEND v2 1/1] mfd: palmas: Add power off control
  2013-08-09 14:47     ` Nishanth Menon
@ 2013-08-12 13:52       ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2013-08-12 13:52 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Bill Huang, sameo@linux.intel.com, rob.herring@calxeda.com,
	pawel.moll@arm.com, mark.rutland@arm.com, swarren@wwwdotorg.org,
	ian.campbell@citrix.com, rob@landley.net, broonie@linaro.org,
	j-keerthy@ti.com, grant.likely@linaro.org, ian@slimlogic.co.uk,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, Mallikarjun Kasoju

On Fri, 09 Aug 2013, Nishanth Menon wrote:

> On 08/09/2013 08:01 AM, Bill Huang wrote:
> >On Thu, 2013-08-08 at 20:32 +0800, Lee Jones wrote:
> >>On Thu, 08 Aug 2013, Bill Huang wrote:
> >>
> >>>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.
> >>>
> >>>Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
> >>>Signed-off-by: Bill Huang <bilhuang@nvidia.com>
> >>>---
> >>>  .../devicetree/bindings/regulator/palmas-pmic.txt  |    5 +++
> >>>  drivers/mfd/palmas.c                               |   33 ++++++++++++++++++--
> >>>  include/linux/mfd/palmas.h                         |    1 +
> >>>  3 files changed, 37 insertions(+), 2 deletions(-)
> >>
> >>Was a clear conclusion reached between Nishanth and yourself?
> >>
> >>As he has strong opinions on this I'd ideally like his Ack before
> >>applying the patch.
> >>
> >Feel free to NACK if you are feeling this can't fit what you would like
> >to add, then I'll pass the ball to you for implementing Palmas power off
> >since you have already wrote part of the driver (with USB IRQ unmask?).
> Apologies on the delay in review. As long as we are ok with not
> having a drivers/power/reset driver, I can buy this as a step #1.
> USB IRQ unmask could go on top of it.
> 
> Other than that,
> Acked-by: Nishanth Menon <nm@ti.com>

Applied with Nishanth's Ack, thanks.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-12 13:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 11:45 [PATCH RESEND v2 1/1] mfd: palmas: Add power off control Bill Huang
2013-08-08 12:32 ` Lee Jones
2013-08-09 13:01   ` Bill Huang
2013-08-09 14:47     ` Nishanth Menon
2013-08-12 13:52       ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).