mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add support to make output voltage determined by VSET2[] bits
@ 2015-09-30  7:25 Wenyou Yang
  2015-09-30  7:25 ` [PATCH v2 1/2] regulator: act8865: support output voltage " Wenyou Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wenyou Yang @ 2015-09-30  7:25 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala
  Cc: Nicolas Ferre, linux-arm-kernel, linux-kernel, devicetree, Wenyou Yang

The patch is to add support to make the output voltage of ACT8865
DC/DC regulator determined by VSET2[] bits. The DT property
"active-semi,vsel-high" is used to specify the VSEL pin at high
on the board. When the VSEL pin is high, output voltage is programmed
by VSET2[] bits.

Changes in v2:
 - fix missed argument of macro "ACT88xx_REG" for act8865_alt_regulators
   structure variable.
 - set variable "voltage_select" initial value to avoid compile warning.

Wenyou Yang (2):
  regulator: act8865: support output voltage by VSET2[] bits
  regulator: act8865: add DT binding for property
    "active-semi,vsel-high"

 .../bindings/regulator/act8865-regulator.txt       |    3 +++
 drivers/regulator/act8865-regulator.c              |   24 ++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

-- 
1.7.9.5


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

* [PATCH v2 1/2] regulator: act8865: support output voltage by VSET2[] bits
  2015-09-30  7:25 [PATCH v2 0/2] Add support to make output voltage determined by VSET2[] bits Wenyou Yang
@ 2015-09-30  7:25 ` Wenyou Yang
  2015-09-30 13:21   ` Ludovic Desroches
  2015-09-30  7:25 ` [PATCH v2 2/2] regulator: act8865: add DT binding for property "active-semi,vsel-high" Wenyou Yang
  2015-10-02 16:55 ` [PATCH v2 0/2] Add support to make output voltage determined by VSET2[] bits Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Wenyou Yang @ 2015-09-30  7:25 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala
  Cc: Nicolas Ferre, linux-arm-kernel, linux-kernel, devicetree, Wenyou Yang

For the step-down DC/DC regulators, the output voltage is
selectable by setting VSEL pin that when VSEL is low, output
voltage is programmed by VSET1[] bits, and when VSEL is high,
output voltage is programmed by VSET2[] bits.

The DT property "active-semi,vsel-high" is used to specify
the VSEL pin at high on the board.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---

Changes in v2:
 - fix missed argument of macro "ACT88xx_REG" for act8865_alt_regulators
   structure variable.
 - set variable "voltage_select" initial value to avoid compile warning.

 drivers/regulator/act8865-regulator.c |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
index 896db16..f8d4cd3 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -261,6 +261,16 @@ static const struct regulator_desc act8865_regulators[] = {
 	ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"),
 };
 
+static const struct regulator_desc act8865_alt_regulators[] = {
+	ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET2, "vp1"),
+	ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET2, "vp2"),
+	ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET2, "vp3"),
+	ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET, "inl45"),
+	ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET, "inl45"),
+	ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET, "inl67"),
+	ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"),
+};
+
 #ifdef CONFIG_OF
 static const struct of_device_id act8865_dt_ids[] = {
 	{ .compatible = "active-semi,act8600", .data = (void *)ACT8600 },
@@ -413,6 +423,7 @@ static int act8865_pmic_probe(struct i2c_client *client,
 	struct act8865 *act8865;
 	unsigned long type;
 	int off_reg, off_mask;
+	int voltage_select = 0;
 
 	pdata = dev_get_platdata(dev);
 
@@ -424,6 +435,10 @@ static int act8865_pmic_probe(struct i2c_client *client,
 			return -ENODEV;
 
 		type = (unsigned long) id->data;
+
+		voltage_select = !!of_get_property(dev->of_node,
+						   "active-semi,vsel-high",
+						   NULL);
 	} else {
 		type = i2c_id->driver_data;
 	}
@@ -442,8 +457,13 @@ static int act8865_pmic_probe(struct i2c_client *client,
 		off_mask = ACT8846_OFF_SYSMASK;
 		break;
 	case ACT8865:
-		regulators = act8865_regulators;
-		num_regulators = ARRAY_SIZE(act8865_regulators);
+		if (voltage_select) {
+			regulators = act8865_alt_regulators;
+			num_regulators = ARRAY_SIZE(act8865_alt_regulators);
+		} else {
+			regulators = act8865_regulators;
+			num_regulators = ARRAY_SIZE(act8865_regulators);
+		}
 		off_reg = ACT8865_SYS_CTRL;
 		off_mask = ACT8865_MSTROFF;
 		break;
-- 
1.7.9.5


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

* [PATCH v2 2/2] regulator: act8865: add DT binding for property "active-semi,vsel-high"
  2015-09-30  7:25 [PATCH v2 0/2] Add support to make output voltage determined by VSET2[] bits Wenyou Yang
  2015-09-30  7:25 ` [PATCH v2 1/2] regulator: act8865: support output voltage " Wenyou Yang
@ 2015-09-30  7:25 ` Wenyou Yang
  2015-09-30 13:21   ` [PATCH v2 2/2] regulator: act8865: add DT binding for property "active-semi, vsel-high" Ludovic Desroches
  2015-10-02 16:55 ` [PATCH v2 0/2] Add support to make output voltage determined by VSET2[] bits Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Wenyou Yang @ 2015-09-30  7:25 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala
  Cc: Nicolas Ferre, linux-arm-kernel, linux-kernel, devicetree, Wenyou Yang

Add a DT property "active-semi,vsel-high" to indicate the VSEL pin
is high. If this property is missing, then assume the VSEL pin is
low(0).

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---

Changes in v2: None

 .../bindings/regulator/act8865-regulator.txt       |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
index e91485d..6067d98 100644
--- a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
@@ -8,6 +8,8 @@ Required properties:
 Optional properties:
 - system-power-controller: Telling whether or not this pmic is controlling
   the system power. See Documentation/devicetree/bindings/power/power-controller.txt .
+- active-semi,vsel-high: Indicates the VSEL pin is high.
+  If this property is missing, assume the VSEL pin is low(0).
 
 Optional input supply properties:
 - for act8600:
@@ -49,6 +51,7 @@ Example:
 			pmic: act8865@5b {
 				compatible = "active-semi,act8865";
 				reg = <0x5b>;
+				active-semi,vsel-high;
 				status = "disabled";
 
 				regulators {
-- 
1.7.9.5


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

* Re: [PATCH v2 1/2] regulator: act8865: support output voltage by VSET2[] bits
  2015-09-30  7:25 ` [PATCH v2 1/2] regulator: act8865: support output voltage " Wenyou Yang
@ 2015-09-30 13:21   ` Ludovic Desroches
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Desroches @ 2015-09-30 13:21 UTC (permalink / raw)
  To: Wenyou Yang
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, devicetree, Nicolas Ferre,
	linux-kernel, linux-arm-kernel

Hi Wenyou,

I see nothing wrong in it.

On Wed, Sep 30, 2015 at 03:25:49PM +0800, Wenyou Yang wrote:
> For the step-down DC/DC regulators, the output voltage is
> selectable by setting VSEL pin that when VSEL is low, output
> voltage is programmed by VSET1[] bits, and when VSEL is high,
> output voltage is programmed by VSET2[] bits.
> 
> The DT property "active-semi,vsel-high" is used to specify
> the VSEL pin at high on the board.
> 
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>

Minor comment below, it's only my point of view.

Anyway, Reviewed-by: Ludovic Desroches <ludovic.desroches@atmel.com>

> ---
> 
> Changes in v2:
>  - fix missed argument of macro "ACT88xx_REG" for act8865_alt_regulators
>    structure variable.
>  - set variable "voltage_select" initial value to avoid compile warning.
> 
>  drivers/regulator/act8865-regulator.c |   24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
> index 896db16..f8d4cd3 100644
> --- a/drivers/regulator/act8865-regulator.c
> +++ b/drivers/regulator/act8865-regulator.c
> @@ -261,6 +261,16 @@ static const struct regulator_desc act8865_regulators[] = {
>  	ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"),
>  };
>  
> +static const struct regulator_desc act8865_alt_regulators[] = {
> +	ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET2, "vp1"),
> +	ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET2, "vp2"),
> +	ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET2, "vp3"),
> +	ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET, "inl45"),
> +	ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET, "inl45"),
> +	ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET, "inl67"),
> +	ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"),
> +};
> +
>  #ifdef CONFIG_OF
>  static const struct of_device_id act8865_dt_ids[] = {
>  	{ .compatible = "active-semi,act8600", .data = (void *)ACT8600 },
> @@ -413,6 +423,7 @@ static int act8865_pmic_probe(struct i2c_client *client,
>  	struct act8865 *act8865;
>  	unsigned long type;
>  	int off_reg, off_mask;
> +	int voltage_select = 0;

I think adding this variable is useless...

>  
>  	pdata = dev_get_platdata(dev);
>  
> @@ -424,6 +435,10 @@ static int act8865_pmic_probe(struct i2c_client *client,
>  			return -ENODEV;
>  
>  		type = (unsigned long) id->data;
> +
> +		voltage_select = !!of_get_property(dev->of_node,
> +						   "active-semi,vsel-high",
> +						   NULL);
>  	} else {
>  		type = i2c_id->driver_data;
>  	}
> @@ -442,8 +457,13 @@ static int act8865_pmic_probe(struct i2c_client *client,
>  		off_mask = ACT8846_OFF_SYSMASK;
>  		break;
>  	case ACT8865:
> -		regulators = act8865_regulators;
> -		num_regulators = ARRAY_SIZE(act8865_regulators);
> +		if (voltage_select) {

I would directly do

if (of_get_property(dev->of_node, "active-semi,vsel-high", NULL) {

> +			regulators = act8865_alt_regulators;
> +			num_regulators = ARRAY_SIZE(act8865_alt_regulators);
> +		} else {
> +			regulators = act8865_regulators;
> +			num_regulators = ARRAY_SIZE(act8865_regulators);
> +		}
>  		off_reg = ACT8865_SYS_CTRL;
>  		off_mask = ACT8865_MSTROFF;
>  		break;
> -- 
> 1.7.9.5
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/2] regulator: act8865: add DT binding for property "active-semi, vsel-high"
  2015-09-30  7:25 ` [PATCH v2 2/2] regulator: act8865: add DT binding for property "active-semi,vsel-high" Wenyou Yang
@ 2015-09-30 13:21   ` Ludovic Desroches
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Desroches @ 2015-09-30 13:21 UTC (permalink / raw)
  To: Wenyou Yang
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, devicetree, Nicolas Ferre,
	linux-kernel, linux-arm-kernel

On Wed, Sep 30, 2015 at 03:25:50PM +0800, Wenyou Yang wrote:
> Add a DT property "active-semi,vsel-high" to indicate the VSEL pin
> is high. If this property is missing, then assume the VSEL pin is
> low(0).
> 
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Ludovic Desroches <ludovic.desroches@atmel.com>

> ---
> 
> Changes in v2: None
> 
>  .../bindings/regulator/act8865-regulator.txt       |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
> index e91485d..6067d98 100644
> --- a/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
> +++ b/Documentation/devicetree/bindings/regulator/act8865-regulator.txt
> @@ -8,6 +8,8 @@ Required properties:
>  Optional properties:
>  - system-power-controller: Telling whether or not this pmic is controlling
>    the system power. See Documentation/devicetree/bindings/power/power-controller.txt .
> +- active-semi,vsel-high: Indicates the VSEL pin is high.
> +  If this property is missing, assume the VSEL pin is low(0).
>  
>  Optional input supply properties:
>  - for act8600:
> @@ -49,6 +51,7 @@ Example:
>  			pmic: act8865@5b {
>  				compatible = "active-semi,act8865";
>  				reg = <0x5b>;
> +				active-semi,vsel-high;
>  				status = "disabled";
>  
>  				regulators {
> -- 
> 1.7.9.5
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 0/2] Add support to make output voltage determined by VSET2[] bits
  2015-09-30  7:25 [PATCH v2 0/2] Add support to make output voltage determined by VSET2[] bits Wenyou Yang
  2015-09-30  7:25 ` [PATCH v2 1/2] regulator: act8865: support output voltage " Wenyou Yang
  2015-09-30  7:25 ` [PATCH v2 2/2] regulator: act8865: add DT binding for property "active-semi,vsel-high" Wenyou Yang
@ 2015-10-02 16:55 ` Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2015-10-02 16:55 UTC (permalink / raw)
  To: Wenyou Yang
  Cc: Liam Girdwood, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Nicolas Ferre, linux-arm-kernel,
	linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

On Wed, Sep 30, 2015 at 03:25:48PM +0800, Wenyou Yang wrote:
> The patch is to add support to make the output voltage of ACT8865
> DC/DC regulator determined by VSET2[] bits. The DT property
> "active-semi,vsel-high" is used to specify the VSEL pin at high
> on the board. When the VSEL pin is high, output voltage is programmed
> by VSET2[] bits.

I'll apply these but they'll probably need some rework when someone
needs to support a board where the pin is connected to a GPIO and
controllable for fast voltage switching.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2015-10-02 16:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-30  7:25 [PATCH v2 0/2] Add support to make output voltage determined by VSET2[] bits Wenyou Yang
2015-09-30  7:25 ` [PATCH v2 1/2] regulator: act8865: support output voltage " Wenyou Yang
2015-09-30 13:21   ` Ludovic Desroches
2015-09-30  7:25 ` [PATCH v2 2/2] regulator: act8865: add DT binding for property "active-semi,vsel-high" Wenyou Yang
2015-09-30 13:21   ` [PATCH v2 2/2] regulator: act8865: add DT binding for property "active-semi, vsel-high" Ludovic Desroches
2015-10-02 16:55 ` [PATCH v2 0/2] Add support to make output voltage determined by VSET2[] bits Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®