All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] power: bq25890: IBAT compensation support
@ 2020-09-26 19:05 Michał Mirosław
  2020-09-26 19:05 ` [PATCH v4 2/2] power: bq25890: support IBAT compensation Michał Mirosław
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Michał Mirosław @ 2020-09-26 19:05 UTC (permalink / raw)
  To: Angus Ainslie, Rob Herring, Sebastian Reichel, Yauhen Kharuzhy
  Cc: devicetree, linux-kernel, linux-pm

These two patches add support for IBAT compensation feature of bq2589x
chargers.

---
v4 fixed property names for the features and dropped other applied or rejected
   patches

Michał Mirosław (2):
  power: bq25890: document IBAT compensation DT properties
  power: bq25890: support IBAT compensation

 .../devicetree/bindings/power/supply/bq25890.txt  |  4 ++++
 drivers/power/supply/bq25890_charger.c            | 15 +++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

-- 
2.20.1


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

* [PATCH v4 1/2] power: bq25890: document IBAT compensation DT properties
  2020-09-26 19:05 [PATCH v4 0/2] power: bq25890: IBAT compensation support Michał Mirosław
  2020-09-26 19:05 ` [PATCH v4 2/2] power: bq25890: support IBAT compensation Michał Mirosław
@ 2020-09-26 19:05 ` Michał Mirosław
  2020-09-28 18:58   ` Rob Herring
  2020-09-29 23:17 ` [PATCH v4 0/2] power: bq25890: IBAT compensation support Sebastian Reichel
  2 siblings, 1 reply; 5+ messages in thread
From: Michał Mirosław @ 2020-09-26 19:05 UTC (permalink / raw)
  To: Angus Ainslie, Rob Herring, Sebastian Reichel, Yauhen Kharuzhy
  Cc: devicetree, linux-kernel, linux-pm

Document new properties for IBAT compensation feature.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
v2: initial version
v4: renamed properties applying property-suffix
---
 Documentation/devicetree/bindings/power/supply/bq25890.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/supply/bq25890.txt b/Documentation/devicetree/bindings/power/supply/bq25890.txt
index 3b4c69a7fa70..805040c6fff9 100644
--- a/Documentation/devicetree/bindings/power/supply/bq25890.txt
+++ b/Documentation/devicetree/bindings/power/supply/bq25890.txt
@@ -33,6 +33,10 @@ Optional properties:
 - 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,ibatcomp-micro-ohms: integer, value of a resistor in series with
+    the battery;
+- ti,ibatcomp-clamp-microvolt: integer, maximum charging voltage adjustment due
+    to expected voltage drop on in-series resistor;
 
 Example:
 
-- 
2.20.1


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

* [PATCH v4 2/2] power: bq25890: support IBAT compensation
  2020-09-26 19:05 [PATCH v4 0/2] power: bq25890: IBAT compensation support Michał Mirosław
@ 2020-09-26 19:05 ` Michał Mirosław
  2020-09-26 19:05 ` [PATCH v4 1/2] power: bq25890: document IBAT compensation DT properties Michał Mirosław
  2020-09-29 23:17 ` [PATCH v4 0/2] power: bq25890: IBAT compensation support Sebastian Reichel
  2 siblings, 0 replies; 5+ messages in thread
From: Michał Mirosław @ 2020-09-26 19:05 UTC (permalink / raw)
  To: Angus Ainslie, Rob Herring, Sebastian Reichel, Yauhen Kharuzhy
  Cc: devicetree, linux-kernel, linux-pm

Add configuration for compensation of IBAT measuring resistor in series
with the battery.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
v4: renamed properties applying property-suffix
---
 drivers/power/supply/bq25890_charger.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 77150667e36b..ab8398f935c5 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -83,6 +83,8 @@ struct bq25890_init_data {
 	u8 boostf;	/* boost frequency		*/
 	u8 ilim_en;	/* enable ILIM pin		*/
 	u8 treg;	/* thermal regulation threshold */
+	u8 rbatcomp;	/* IBAT sense resistor value    */
+	u8 vclamp;	/* IBAT compensation voltage limit */
 };
 
 struct bq25890_state {
@@ -258,6 +260,8 @@ enum bq25890_table_ids {
 	TBL_VREG,
 	TBL_BOOSTV,
 	TBL_SYSVMIN,
+	TBL_VBATCOMP,
+	TBL_RBATCOMP,
 
 	/* lookup tables */
 	TBL_TREG,
@@ -299,6 +303,8 @@ 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_VBATCOMP] ={ .rt = {0,        224000, 32000} },	 /* uV */
+	[TBL_RBATCOMP] ={ .rt = {0,        140000, 20000} },	 /* uOhm */
 
 	/* lookup tables */
 	[TBL_TREG] =	{ .lt = {bq25890_treg_tbl, BQ25890_TREG_TBL_SIZE} },
@@ -648,7 +654,9 @@ 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_TREG,	 bq->init_data.treg}
+		{F_TREG,	 bq->init_data.treg},
+		{F_BATCMP,	 bq->init_data.rbatcomp},
+		{F_VCLAMP,	 bq->init_data.vclamp},
 	};
 
 	ret = bq25890_chip_reset(bq);
@@ -859,11 +867,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,ibatcomp-micro-ohms", true, TBL_RBATCOMP, &init->rbatcomp},
+		{"ti,ibatcomp-clamp-microvolt", true, TBL_VBATCOMP, &init->vclamp},
 	};
 
 	/* initialize data for optional properties */
 	init->treg = 3; /* 120 degrees Celsius */
+	init->rbatcomp = init->vclamp = 0; /* IBAT compensation disabled */
 
 	for (i = 0; i < ARRAY_SIZE(props); i++) {
 		ret = device_property_read_u32(bq->dev, props[i].name,
-- 
2.20.1


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

* Re: [PATCH v4 1/2] power: bq25890: document IBAT compensation DT properties
  2020-09-26 19:05 ` [PATCH v4 1/2] power: bq25890: document IBAT compensation DT properties Michał Mirosław
@ 2020-09-28 18:58   ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2020-09-28 18:58 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Rob Herring, devicetree, Angus Ainslie, linux-pm,
	Sebastian Reichel, linux-kernel, Yauhen Kharuzhy

On Sat, 26 Sep 2020 21:05:34 +0200, Michał Mirosław wrote:
> Document new properties for IBAT compensation feature.
> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
> v2: initial version
> v4: renamed properties applying property-suffix
> ---
>  Documentation/devicetree/bindings/power/supply/bq25890.txt | 4 ++++
>  1 file changed, 4 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v4 0/2] power: bq25890: IBAT compensation support
  2020-09-26 19:05 [PATCH v4 0/2] power: bq25890: IBAT compensation support Michał Mirosław
  2020-09-26 19:05 ` [PATCH v4 2/2] power: bq25890: support IBAT compensation Michał Mirosław
  2020-09-26 19:05 ` [PATCH v4 1/2] power: bq25890: document IBAT compensation DT properties Michał Mirosław
@ 2020-09-29 23:17 ` Sebastian Reichel
  2 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2020-09-29 23:17 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Angus Ainslie, Rob Herring, Yauhen Kharuzhy, devicetree,
	linux-kernel, linux-pm

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

Hi,

On Sat, Sep 26, 2020 at 09:05:31PM +0200, Michał Mirosław wrote:
> These two patches add support for IBAT compensation feature of bq2589x
> chargers.

Thanks, queued.

-- Sebastian

> v4 fixed property names for the features and dropped other applied or rejected
>    patches
> 
> Michał Mirosław (2):
>   power: bq25890: document IBAT compensation DT properties
>   power: bq25890: support IBAT compensation
> 
>  .../devicetree/bindings/power/supply/bq25890.txt  |  4 ++++
>  drivers/power/supply/bq25890_charger.c            | 15 +++++++++++++--
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> -- 
> 2.20.1
> 

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

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

end of thread, other threads:[~2020-09-29 23:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-26 19:05 [PATCH v4 0/2] power: bq25890: IBAT compensation support Michał Mirosław
2020-09-26 19:05 ` [PATCH v4 2/2] power: bq25890: support IBAT compensation Michał Mirosław
2020-09-26 19:05 ` [PATCH v4 1/2] power: bq25890: document IBAT compensation DT properties Michał Mirosław
2020-09-28 18:58   ` Rob Herring
2020-09-29 23:17 ` [PATCH v4 0/2] power: bq25890: IBAT compensation support Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.