Linux-PM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] Allow VINDPM to be set in the device tree
@ 2019-05-20 18:07 Angus Ainslie (Purism)
  2019-05-20 18:07 ` [PATCH 1/2] power: supply: bq25890: Add support for setting bq25890 and bq25896's VINDPM Angus Ainslie (Purism)
  2019-05-20 18:07 ` [PATCH 2/2] dt-bindings: power: supply: Add documentation for the VINDPM properties Angus Ainslie (Purism)
  0 siblings, 2 replies; 5+ messages in thread
From: Angus Ainslie (Purism) @ 2019-05-20 18:07 UTC (permalink / raw)
  To: angus.ainslie
  Cc: Sebastian Reichel, Rob Herring, Mark Rutland, linux-pm,
	devicetree, linux-kernel, Angus Ainslie (Purism)

The BQ25890 can control the input voltage limit so allow it to be set.

Angus Ainslie (Purism) (1):
  dt-bindings: power: supply: Add documentation for the VINDPM
    properties

Eric Kuzmenko (1):
  power: supply: bq25890: Add support for setting bq25890 and bq25896's
    VINDPM

 .../devicetree/bindings/power/supply/bq25890.txt    |  8 ++++++++
 drivers/power/supply/bq25890_charger.c              | 13 ++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

-- 
2.17.1


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

* [PATCH 1/2] power: supply: bq25890: Add support for setting bq25890 and bq25896's VINDPM
  2019-05-20 18:07 [PATCH 0/2] Allow VINDPM to be set in the device tree Angus Ainslie (Purism)
@ 2019-05-20 18:07 ` Angus Ainslie (Purism)
  2019-05-20 18:07 ` [PATCH 2/2] dt-bindings: power: supply: Add documentation for the VINDPM properties Angus Ainslie (Purism)
  1 sibling, 0 replies; 5+ messages in thread
From: Angus Ainslie (Purism) @ 2019-05-20 18:07 UTC (permalink / raw)
  To: angus.ainslie
  Cc: Sebastian Reichel, Rob Herring, Mark Rutland, linux-pm,
	devicetree, linux-kernel, Eric Kuzmenko, Angus Ainslie

From: Eric Kuzmenko <eric.kuzmenko@puri.sm>

The bq25890 has low voltage protection on VIN. Allow the register
to be set from the device tree.

Signed-off-by: Eric Kuzmenko <eric.kuzmenko@puri.sm>
Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
---
 drivers/power/supply/bq25890_charger.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 66991e6f75d9..34fc89776994 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -75,6 +75,8 @@ struct bq25890_init_data {
 	u8 boosti;	/* boost current limit		*/
 	u8 boostf;	/* boost frequency		*/
 	u8 ilim_en;	/* enable ILIM pin		*/
+	u8 force_vindpm;/* force vinmin threshold	*/
+	u8 vindpm;	/* vinmin threshold		*/
 	u8 treg;	/* thermal regulation threshold */
 };
 
@@ -250,6 +252,7 @@ enum bq25890_table_ids {
 	TBL_VREG,
 	TBL_BOOSTV,
 	TBL_SYSVMIN,
+	TBL_VINDPM,
 
 	/* lookup tables */
 	TBL_TREG,
@@ -289,6 +292,7 @@ static const union {
 	[TBL_VREG] =	{ .rt = {3840000, 4608000, 16000} },	 /* uV */
 	[TBL_BOOSTV] =	{ .rt = {4550000, 5510000, 64000} },	 /* uV */
 	[TBL_SYSVMIN] = { .rt = {3000000, 3700000, 100000} },	 /* uV */
+	[TBL_VINDPM] =	{ .rt = {2600000, 15300000, 100000} },	 /* uV */
 
 	/* lookup tables */
 	[TBL_TREG] =	{ .lt = {bq25890_treg_tbl, BQ25890_TREG_TBL_SIZE} },
@@ -621,6 +625,8 @@ static int bq25890_hw_init(struct bq25890_device *bq)
 		{F_BOOSTI,	 bq->init_data.boosti},
 		{F_BOOSTF,	 bq->init_data.boostf},
 		{F_EN_ILIM,	 bq->init_data.ilim_en},
+		{F_FORCE_VINDPM, bq->init_data.force_vindpm},
+		{F_VINDPM,	 bq->init_data.vindpm},
 		{F_TREG,	 bq->init_data.treg}
 	};
 
@@ -783,11 +789,14 @@ static int bq25890_fw_read_u32_props(struct bq25890_device *bq)
 		{"ti,boost-max-current", false, TBL_BOOSTI, &init->boosti},
 
 		/* optional properties */
-		{"ti,thermal-regulation-threshold", true, TBL_TREG, &init->treg}
+		{"ti,thermal-regulation-threshold",
+			true, TBL_TREG, &init->treg},
+		{"ti,vinmin-threshold", true, TBL_VINDPM, &init->vindpm}
 	};
 
 	/* initialize data for optional properties */
 	init->treg = 3; /* 120 degrees Celsius */
+	init->vindpm = 0x12; /* 4.4V */
 
 	for (i = 0; i < ARRAY_SIZE(props); i++) {
 		ret = device_property_read_u32(bq->dev, props[i].name,
@@ -820,6 +829,8 @@ static int bq25890_fw_probe(struct bq25890_device *bq)
 
 	init->ilim_en = device_property_read_bool(bq->dev, "ti,use-ilim-pin");
 	init->boostf = device_property_read_bool(bq->dev, "ti,boost-low-freq");
+	init->force_vindpm =
+		device_property_read_bool(bq->dev, "ti,use-vinmin-threshold");
 
 	return 0;
 }
-- 
2.17.1


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

* [PATCH 2/2] dt-bindings: power: supply: Add documentation for the VINDPM properties
  2019-05-20 18:07 [PATCH 0/2] Allow VINDPM to be set in the device tree Angus Ainslie (Purism)
  2019-05-20 18:07 ` [PATCH 1/2] power: supply: bq25890: Add support for setting bq25890 and bq25896's VINDPM Angus Ainslie (Purism)
@ 2019-05-20 18:07 ` Angus Ainslie (Purism)
  2019-06-13 23:09   ` Rob Herring
  1 sibling, 1 reply; 5+ messages in thread
From: Angus Ainslie (Purism) @ 2019-05-20 18:07 UTC (permalink / raw)
  To: angus.ainslie
  Cc: Sebastian Reichel, Rob Herring, Mark Rutland, linux-pm,
	devicetree, linux-kernel, Angus Ainslie (Purism)

Add documentation on how to control VINDPM from the devicetree.

Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
---
 .../devicetree/bindings/power/supply/bq25890.txt          | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/supply/bq25890.txt b/Documentation/devicetree/bindings/power/supply/bq25890.txt
index dc0568933359..fe8b709dd666 100644
--- a/Documentation/devicetree/bindings/power/supply/bq25890.txt
+++ b/Documentation/devicetree/bindings/power/supply/bq25890.txt
@@ -26,9 +26,15 @@ Optional properties:
 - ti,use-ilim-pin: boolean, if present the ILIM resistor will be used and the
     input current will be the lower between the resistor setting and the IINLIM
     register setting;
+- ti,use-vinmin-threshold: boolean, if present the FORCE_VINDPM bit will be set
+    and the input voltage limit will be configured based on "ti,vinmin-threshold"
 - ti,thermal-regulation-threshold: integer, temperature above which the charge
     current is lowered, to avoid overheating (in degrees Celsius). If omitted,
     the default setting will be used (120 degrees);
+- ti,vinmin-threshold: integer, lower absolute threshold for VINDPM. If the
+    voltage falls below this threshold the charge current is reduced until the
+    input voltage rises above the input voltage limit. If omitted, the default
+    setting will be used (4.4V);
 
 Example:
 
@@ -46,4 +52,6 @@ bq25890 {
 
         ti,use-ilim-pin;
         ti,thermal-regulation-threshold = <120>;
+        ti,use-vinmin-threshold;
+        ti,vinmin-threshold = <3900000>;
 };
-- 
2.17.1


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

* Re: [PATCH 2/2] dt-bindings: power: supply: Add documentation for the VINDPM properties
  2019-05-20 18:07 ` [PATCH 2/2] dt-bindings: power: supply: Add documentation for the VINDPM properties Angus Ainslie (Purism)
@ 2019-06-13 23:09   ` Rob Herring
  2019-06-25 22:13     ` Sebastian Reichel
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2019-06-13 23:09 UTC (permalink / raw)
  To: Angus Ainslie (Purism)
  Cc: angus.ainslie, Sebastian Reichel, Mark Rutland, linux-pm,
	devicetree, linux-kernel

On Mon, May 20, 2019 at 11:07:12AM -0700, Angus Ainslie (Purism) wrote:
> Add documentation on how to control VINDPM from the devicetree.
> 
> Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
> ---
>  .../devicetree/bindings/power/supply/bq25890.txt          | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/bq25890.txt b/Documentation/devicetree/bindings/power/supply/bq25890.txt
> index dc0568933359..fe8b709dd666 100644
> --- a/Documentation/devicetree/bindings/power/supply/bq25890.txt
> +++ b/Documentation/devicetree/bindings/power/supply/bq25890.txt
> @@ -26,9 +26,15 @@ Optional properties:
>  - ti,use-ilim-pin: boolean, if present the ILIM resistor will be used and the
>      input current will be the lower between the resistor setting and the IINLIM
>      register setting;
> +- ti,use-vinmin-threshold: boolean, if present the FORCE_VINDPM bit will be set
> +    and the input voltage limit will be configured based on "ti,vinmin-threshold"

Isn't presence of ti,vinmin-threshold enough to determine whether to set 
FORCE_VINDPM or not? Just get rid of the default being 4.4V.

>  - ti,thermal-regulation-threshold: integer, temperature above which the charge
>      current is lowered, to avoid overheating (in degrees Celsius). If omitted,
>      the default setting will be used (120 degrees);
> +- ti,vinmin-threshold: integer, lower absolute threshold for VINDPM. If the
> +    voltage falls below this threshold the charge current is reduced until the
> +    input voltage rises above the input voltage limit. If omitted, the default
> +    setting will be used (4.4V);
>  
>  Example:
>  
> @@ -46,4 +52,6 @@ bq25890 {
>  
>          ti,use-ilim-pin;
>          ti,thermal-regulation-threshold = <120>;
> +        ti,use-vinmin-threshold;
> +        ti,vinmin-threshold = <3900000>;
>  };
> -- 
> 2.17.1
> 

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

* Re: [PATCH 2/2] dt-bindings: power: supply: Add documentation for the VINDPM properties
  2019-06-13 23:09   ` Rob Herring
@ 2019-06-25 22:13     ` Sebastian Reichel
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2019-06-25 22:13 UTC (permalink / raw)
  To: Rob Herring
  Cc: Angus Ainslie (Purism),
	angus.ainslie, Mark Rutland, linux-pm, devicetree, linux-kernel

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

Hi,

On Thu, Jun 13, 2019 at 05:09:06PM -0600, Rob Herring wrote:
> On Mon, May 20, 2019 at 11:07:12AM -0700, Angus Ainslie (Purism) wrote:
> > Add documentation on how to control VINDPM from the devicetree.
> > 
> > Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
> > ---
> >  .../devicetree/bindings/power/supply/bq25890.txt          | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/power/supply/bq25890.txt b/Documentation/devicetree/bindings/power/supply/bq25890.txt
> > index dc0568933359..fe8b709dd666 100644
> > --- a/Documentation/devicetree/bindings/power/supply/bq25890.txt
> > +++ b/Documentation/devicetree/bindings/power/supply/bq25890.txt
> > @@ -26,9 +26,15 @@ Optional properties:
> >  - ti,use-ilim-pin: boolean, if present the ILIM resistor will be used and the
> >      input current will be the lower between the resistor setting and the IINLIM
> >      register setting;
> > +- ti,use-vinmin-threshold: boolean, if present the FORCE_VINDPM bit will be set
> > +    and the input voltage limit will be configured based on "ti,vinmin-threshold"
> 
> Isn't presence of ti,vinmin-threshold enough to determine whether to set 
> FORCE_VINDPM or not? Just get rid of the default being 4.4V.
>
> >  - ti,thermal-regulation-threshold: integer, temperature above which the charge
> >      current is lowered, to avoid overheating (in degrees Celsius). If omitted,
> >      the default setting will be used (120 degrees);
> > +- ti,vinmin-threshold: integer, lower absolute threshold for VINDPM. If the
> > +    voltage falls below this threshold the charge current is reduced until the
> > +    input voltage rises above the input voltage limit. If omitted, the default
> > +    setting will be used (4.4V);

We already have a "input-voltage-min-microvolt" property used by
Maxim chargers, please resuse that for the bq25890 instead of
creating a new property name.

-- Sebastian

> >  
> >  Example:
> >  
> > @@ -46,4 +52,6 @@ bq25890 {
> >  
> >          ti,use-ilim-pin;
> >          ti,thermal-regulation-threshold = <120>;
> > +        ti,use-vinmin-threshold;
> > +        ti,vinmin-threshold = <3900000>;
> >  };
> > -- 
> > 2.17.1
> > 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 18:07 [PATCH 0/2] Allow VINDPM to be set in the device tree Angus Ainslie (Purism)
2019-05-20 18:07 ` [PATCH 1/2] power: supply: bq25890: Add support for setting bq25890 and bq25896's VINDPM Angus Ainslie (Purism)
2019-05-20 18:07 ` [PATCH 2/2] dt-bindings: power: supply: Add documentation for the VINDPM properties Angus Ainslie (Purism)
2019-06-13 23:09   ` Rob Herring
2019-06-25 22:13     ` Sebastian Reichel

Linux-PM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pm/0 linux-pm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pm linux-pm/ https://lore.kernel.org/linux-pm \
		linux-pm@vger.kernel.org linux-pm@archiver.kernel.org
	public-inbox-index linux-pm


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox