* [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs
@ 2014-09-27 16:21 Romain Perier
2014-09-27 16:21 ` [PATCH v1 2/3] ARM: dts: rockchip: Enable power off in pmic for Radxa Rock Romain Perier
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Romain Perier @ 2014-09-27 16:21 UTC (permalink / raw)
To: heiko
Cc: linux-rockchip, linux-arm-kernel, devicetree, lgirdwood, broonie,
linux-kernel
When the property "active-semi,system-power-controller" is found in the
devicetree, the function pm_power_off is defined. This function sends the
rights bit fields to the global off control register. shutdown/poweroff
commands are now supported for hardware components which use these PMU.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
drivers/regulator/act8865-regulator.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
index afd06f9..6cf202d 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -61,6 +61,8 @@
#define ACT8846_REG12_VSET 0xa0
#define ACT8846_REG12_CTRL 0xa1
#define ACT8846_REG13_CTRL 0xb1
+#define ACT8846_GLB_OFF_CTRL 0xc3
+#define ACT8846_OFF_SYSMASK 0x18
/*
* ACT8865 Global Register Map.
@@ -84,6 +86,7 @@
#define ACT8865_LDO3_CTRL 0x61
#define ACT8865_LDO4_VSET 0x64
#define ACT8865_LDO4_CTRL 0x65
+#define ACT8865_MSTROFF 0x20
/*
* Field Definitions.
@@ -98,6 +101,8 @@
struct act8865 {
struct regmap *regmap;
+ int off_reg;
+ int off_mask;
};
static const struct regmap_config act8865_regmap_config = {
@@ -275,6 +280,16 @@ static struct regulator_init_data
return NULL;
}
+static struct i2c_client *act8865_i2c_client;
+static void act8865_power_off(void)
+{
+ struct act8865 *act8865;
+
+ act8865 = i2c_get_clientdata(act8865_i2c_client);
+ regmap_write(act8865->regmap, act8865->off_reg, act8865->off_mask);
+ while (1);
+}
+
static int act8865_pmic_probe(struct i2c_client *client,
const struct i2c_device_id *i2c_id)
{
@@ -285,6 +300,7 @@ static int act8865_pmic_probe(struct i2c_client *client,
int i, ret, num_regulators;
struct act8865 *act8865;
unsigned long type;
+ int off_reg, off_mask;
pdata = dev_get_platdata(dev);
@@ -304,10 +320,14 @@ static int act8865_pmic_probe(struct i2c_client *client,
case ACT8846:
regulators = act8846_regulators;
num_regulators = ARRAY_SIZE(act8846_regulators);
+ off_reg = ACT8846_GLB_OFF_CTRL;
+ off_mask = ACT8846_OFF_SYSMASK;
break;
case ACT8865:
regulators = act8865_regulators;
num_regulators = ARRAY_SIZE(act8865_regulators);
+ off_reg = ACT8865_SYS_CTRL;
+ off_mask = ACT8865_MSTROFF;
break;
default:
dev_err(dev, "invalid device id %lu\n", type);
@@ -345,6 +365,15 @@ static int act8865_pmic_probe(struct i2c_client *client,
return ret;
}
+ if (dev->of_node &&
+ of_property_read_bool(dev->of_node,
+ "active-semi,system-power-controller")) {
+ act8865_i2c_client = client;
+ act8865->off_reg = off_reg;
+ act8865->off_mask = off_mask;
+ pm_power_off = act8865_power_off;
+ }
+
/* Finally register devices */
for (i = 0; i < num_regulators; i++) {
const struct regulator_desc *desc = ®ulators[i];
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v1 2/3] ARM: dts: rockchip: Enable power off in pmic for Radxa Rock
2014-09-27 16:21 [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs Romain Perier
@ 2014-09-27 16:21 ` Romain Perier
2014-09-27 16:21 ` [PATCH v1 3/3] dt-bindings: Document the property system-power-controller for act8865 regulator Romain Perier
2014-09-28 10:33 ` [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs Mark Brown
2 siblings, 0 replies; 8+ messages in thread
From: Romain Perier @ 2014-09-27 16:21 UTC (permalink / raw)
To: heiko
Cc: linux-rockchip, linux-arm-kernel, devicetree, lgirdwood, broonie,
linux-kernel
Add "active-semi,system-power-controller" property to act8846 node.
shutdown/poweroff commands are now handled for this board.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
arch/arm/boot/dts/rk3188-radxarock.dts | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/boot/dts/rk3188-radxarock.dts b/arch/arm/boot/dts/rk3188-radxarock.dts
index e04bf8f..5b6a937 100644
--- a/arch/arm/boot/dts/rk3188-radxarock.dts
+++ b/arch/arm/boot/dts/rk3188-radxarock.dts
@@ -115,6 +115,8 @@
pinctrl-names = "default";
pinctrl-0 = <&act8846_dvs0_ctl>;
+ active-semi,system-power-controller;
+
regulators {
vcc_ddr: REG1 {
regulator-name = "VCC_DDR";
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v1 3/3] dt-bindings: Document the property system-power-controller for act8865 regulator
2014-09-27 16:21 [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs Romain Perier
2014-09-27 16:21 ` [PATCH v1 2/3] ARM: dts: rockchip: Enable power off in pmic for Radxa Rock Romain Perier
@ 2014-09-27 16:21 ` Romain Perier
2014-09-28 10:33 ` [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs Mark Brown
2 siblings, 0 replies; 8+ messages in thread
From: Romain Perier @ 2014-09-27 16:21 UTC (permalink / raw)
To: heiko
Cc: linux-rockchip, linux-arm-kernel, devicetree, lgirdwood, broonie,
linux-kernel
Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
Documentation/devicetree/bindings/regulator/act8865-regulator.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
index 865614b..653ddc1 100644
--- a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
@@ -5,6 +5,10 @@ Required properties:
- compatible: "active-semi,act8846" or "active-semi,act8865"
- reg: I2C slave address
+Optional properties:
+- active-semi,system-power-controller: Telling whether or not this pmic is controlling
+ the system power
+
Any standard regulator properties can be used to configure the single regulator.
The valid names for regulators are:
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs
2014-09-27 16:21 [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs Romain Perier
2014-09-27 16:21 ` [PATCH v1 2/3] ARM: dts: rockchip: Enable power off in pmic for Radxa Rock Romain Perier
2014-09-27 16:21 ` [PATCH v1 3/3] dt-bindings: Document the property system-power-controller for act8865 regulator Romain Perier
@ 2014-09-28 10:33 ` Mark Brown
[not found] ` <20140928103301.GN27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2014-09-28 10:33 UTC (permalink / raw)
To: Romain Perier
Cc: heiko, linux-rockchip, linux-arm-kernel, devicetree, lgirdwood,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 873 bytes --]
On Sat, Sep 27, 2014 at 04:21:44PM +0000, Romain Perier wrote:
> When the property "active-semi,system-power-controller" is found in the
> devicetree, the function pm_power_off is defined. This function sends the
> rights bit fields to the global off control register. shutdown/poweroff
> commands are now supported for hardware components which use these PMU.
We really need to come up with a standard property for this and document
it rather than continuing to add individual device specific properties
all doing the same thing, and probably also some helper code and/or a
standard operation for this - there's a lot of drivers implementing the
same pattern here.
> + if (dev->of_node &&
> + of_property_read_bool(dev->of_node,
> + "active-semi,system-power-controller")) {
> + act8865_i2c_client = client;
Indentation seems messed up here - tabs vs spaces?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs
[not found] ` <20140928103301.GN27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2014-09-28 12:00 ` PERIER Romain
[not found] ` <CABgxDo+h2AYjAO4darK4+RTXqnhf4OqouGLfF2yuJCpu7r6tLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: PERIER Romain @ 2014-09-28 12:00 UTC (permalink / raw)
To: Mark Brown
Cc: Heiko Stübner,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
Liam Girdwood, linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Mark,
2014-09-28 12:33 GMT+02:00 Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>:
> On Sat, Sep 27, 2014 at 04:21:44PM +0000, Romain Perier wrote:
>> When the property "active-semi,system-power-controller" is found in the
>> devicetree, the function pm_power_off is defined. This function sends the
>> rights bit fields to the global off control register. shutdown/poweroff
>> commands are now supported for hardware components which use these PMU.
>
> We really need to come up with a standard property for this and document
> it rather than continuing to add individual device specific properties
> all doing the same thing, and probably also some helper code and/or a
> standard operation for this - there's a lot of drivers implementing the
> same pattern here.
I completly agree about adding a unified and generic property for that purpose.
I already proposed something for that on devicetree ML, see the thread
"Proposal: generic property for system-power-controller".
Unfortunately I did not get replies :) .
>
>> + if (dev->of_node &&
>> + of_property_read_bool(dev->of_node,
>> + "active-semi,system-power-controller")) {
>> + act8865_i2c_client = client;
>
> Indentation seems messed up here - tabs vs spaces?
Yes, I really don't understand where the problem is. I use good emacs
settings to be compatible with kernel coding style and git diff does
not show me indent/spaces problems :/ .
Sorry because this is a very boring issue when reviewing patches... I
will investigate ^^
Romain
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs
[not found] ` <CABgxDo+h2AYjAO4darK4+RTXqnhf4OqouGLfF2yuJCpu7r6tLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-09-28 12:25 ` Mark Brown
[not found] ` <20140928122543.GA27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2014-09-28 12:25 UTC (permalink / raw)
To: PERIER Romain
Cc: Heiko Stübner,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
Liam Girdwood, linux-kernel-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 790 bytes --]
On Sun, Sep 28, 2014 at 02:00:54PM +0200, PERIER Romain wrote:
> 2014-09-28 12:33 GMT+02:00 Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>:
> > We really need to come up with a standard property for this and document
> > it rather than continuing to add individual device specific properties
> > all doing the same thing, and probably also some helper code and/or a
> > standard operation for this - there's a lot of drivers implementing the
> > same pattern here.
> I completly agree about adding a unified and generic property for that purpose.
> I already proposed something for that on devicetree ML, see the thread
> "Proposal: generic property for system-power-controller".
> Unfortunately I did not get replies :) .
Did you CC relevant maintainers and send a patch?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs
[not found] ` <20140928122543.GA27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2014-09-28 13:25 ` PERIER Romain
[not found] ` <CABgxDo+Gor=xnOV83Oca6kez7Auyu95XpaOr7QW+iRHbtByGAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: PERIER Romain @ 2014-09-28 13:25 UTC (permalink / raw)
To: Mark Brown
Cc: Heiko Stübner,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
Liam Girdwood, linux-kernel-u79uwXL29TY76Z2rM5mHXA
2014-09-28 14:25 GMT+02:00 Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>:
> On Sun, Sep 28, 2014 at 02:00:54PM +0200, PERIER Romain wrote:
>> 2014-09-28 12:33 GMT+02:00 Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>:
>
>> > We really need to come up with a standard property for this and document
>> > it rather than continuing to add individual device specific properties
>> > all doing the same thing, and probably also some helper code and/or a
>> > standard operation for this - there's a lot of drivers implementing the
>> > same pattern here.
>
>> I completly agree about adding a unified and generic property for that purpose.
>> I already proposed something for that on devicetree ML, see the thread
>> "Proposal: generic property for system-power-controller".
>> Unfortunately I did not get replies :) .
>
> Did you CC relevant maintainers and send a patch?
No I did not propose patches as I was an open discussion. Perhaps I
might propose something as part of my contribution for act8865... (at
least for the property)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs
[not found] ` <CABgxDo+Gor=xnOV83Oca6kez7Auyu95XpaOr7QW+iRHbtByGAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-09-28 15:04 ` PERIER Romain
0 siblings, 0 replies; 8+ messages in thread
From: PERIER Romain @ 2014-09-28 15:04 UTC (permalink / raw)
To: Mark Brown
Cc: Heiko Stübner,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
Liam Girdwood, linux-kernel-u79uwXL29TY76Z2rM5mHXA
Well, I will think about it and I will propose a separated patch with
a generic property and helper functions.
2014-09-28 15:25 GMT+02:00 PERIER Romain <romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> 2014-09-28 14:25 GMT+02:00 Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>:
>> On Sun, Sep 28, 2014 at 02:00:54PM +0200, PERIER Romain wrote:
>>> 2014-09-28 12:33 GMT+02:00 Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>:
>>
>>> > We really need to come up with a standard property for this and document
>>> > it rather than continuing to add individual device specific properties
>>> > all doing the same thing, and probably also some helper code and/or a
>>> > standard operation for this - there's a lot of drivers implementing the
>>> > same pattern here.
>>
>>> I completly agree about adding a unified and generic property for that purpose.
>>> I already proposed something for that on devicetree ML, see the thread
>>> "Proposal: generic property for system-power-controller".
>>> Unfortunately I did not get replies :) .
>>
>> Did you CC relevant maintainers and send a patch?
>
> No I did not propose patches as I was an open discussion. Perhaps I
> might propose something as part of my contribution for act8865... (at
> least for the property)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-09-28 15:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-27 16:21 [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs Romain Perier
2014-09-27 16:21 ` [PATCH v1 2/3] ARM: dts: rockchip: Enable power off in pmic for Radxa Rock Romain Perier
2014-09-27 16:21 ` [PATCH v1 3/3] dt-bindings: Document the property system-power-controller for act8865 regulator Romain Perier
2014-09-28 10:33 ` [PATCH v1 1/3] regulator: act8865: Add support to turn off all outputs Mark Brown
[not found] ` <20140928103301.GN27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-09-28 12:00 ` PERIER Romain
[not found] ` <CABgxDo+h2AYjAO4darK4+RTXqnhf4OqouGLfF2yuJCpu7r6tLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-28 12:25 ` Mark Brown
[not found] ` <20140928122543.GA27755-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-09-28 13:25 ` PERIER Romain
[not found] ` <CABgxDo+Gor=xnOV83Oca6kez7Auyu95XpaOr7QW+iRHbtByGAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-28 15:04 ` PERIER Romain
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).