* [PATCH 1/2] dt-bindings: power: supply: ab8500_fg: Add line impedance
@ 2022-03-01 12:42 Linus Walleij
2022-03-01 12:42 ` [PATCH 2/2] power: supply: ab8500_fg: Account for " Linus Walleij
2022-03-02 18:25 ` [PATCH 1/2] dt-bindings: power: supply: ab8500_fg: Add " Rob Herring
0 siblings, 2 replies; 4+ messages in thread
From: Linus Walleij @ 2022-03-01 12:42 UTC (permalink / raw)
To: Sebastian Reichel, Marcus Cooper
Cc: linux-pm, Matti Vaittinen, Linus Walleij, devicetree
To improve the inner resistance measurement of the battery we need
to account for the line impedance of the connector to the battery.
Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
.../bindings/power/supply/stericsson,ab8500-fg.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-fg.yaml b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-fg.yaml
index 54ac42a9d354..2ce408a7c0ae 100644
--- a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-fg.yaml
+++ b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-fg.yaml
@@ -25,6 +25,11 @@ properties:
$ref: /schemas/types.yaml#/definitions/phandle
deprecated: true
+ line-impedance-micro-ohms:
+ description: The line impedance between the battery and the
+ AB8500 inputs, to compensate for this when determining internal
+ resistance.
+
interrupts:
maxItems: 5
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] power: supply: ab8500_fg: Account for line impedance
2022-03-01 12:42 [PATCH 1/2] dt-bindings: power: supply: ab8500_fg: Add line impedance Linus Walleij
@ 2022-03-01 12:42 ` Linus Walleij
2022-03-02 18:25 ` [PATCH 1/2] dt-bindings: power: supply: ab8500_fg: Add " Rob Herring
1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2022-03-01 12:42 UTC (permalink / raw)
To: Sebastian Reichel, Marcus Cooper; +Cc: linux-pm, Matti Vaittinen, Linus Walleij
We add the line impedance to the inner resistance determined
from the battery voltage or other means to improve the
capacity estimations.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/power/supply/ab8500_fg.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c
index 1abe10c7ff2a..3ae8086907de 100644
--- a/drivers/power/supply/ab8500_fg.c
+++ b/drivers/power/supply/ab8500_fg.c
@@ -213,6 +213,7 @@ struct ab8500_fg {
int init_cnt;
int low_bat_cnt;
int nbr_cceoc_irq_cnt;
+ u32 line_impedance_uohm;
bool recovery_needed;
bool high_curr_mode;
bool init_capacity;
@@ -910,6 +911,9 @@ static int ab8500_fg_battery_resistance(struct ab8500_fg *di, int vbat_uncomp_uv
resistance = bi->factory_internal_resistance_uohm / 1000;
}
+ /* Compensate for line impedance */
+ resistance += (di->line_impedance_uohm / 1000);
+
dev_dbg(di->dev, "%s Temp: %d battery internal resistance: %d"
" fg resistance %d, total: %d (mOhm)\n",
__func__, di->bat_temp, resistance, di->bm->fg_res / 10,
@@ -3098,6 +3102,11 @@ static int ab8500_fg_probe(struct platform_device *pdev)
return ret;
}
+ if (!of_property_read_u32(dev->of_node, "line-impedance-micro-ohms",
+ &di->line_impedance_uohm))
+ dev_info(dev, "line impedance: %u uOhm\n",
+ di->line_impedance_uohm);
+
psy_cfg.supplied_to = supply_interface;
psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface);
psy_cfg.drv_data = di;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] dt-bindings: power: supply: ab8500_fg: Add line impedance
2022-03-01 12:42 [PATCH 1/2] dt-bindings: power: supply: ab8500_fg: Add line impedance Linus Walleij
2022-03-01 12:42 ` [PATCH 2/2] power: supply: ab8500_fg: Account for " Linus Walleij
@ 2022-03-02 18:25 ` Rob Herring
2022-03-04 21:09 ` Sebastian Reichel
1 sibling, 1 reply; 4+ messages in thread
From: Rob Herring @ 2022-03-02 18:25 UTC (permalink / raw)
To: Linus Walleij
Cc: Sebastian Reichel, Marcus Cooper, linux-pm, Matti Vaittinen, devicetree
On Tue, Mar 01, 2022 at 01:42:53PM +0100, Linus Walleij wrote:
> To improve the inner resistance measurement of the battery we need
> to account for the line impedance of the connector to the battery.
>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> .../bindings/power/supply/stericsson,ab8500-fg.yaml | 5 +++++
> 1 file changed, 5 insertions(+)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] dt-bindings: power: supply: ab8500_fg: Add line impedance
2022-03-02 18:25 ` [PATCH 1/2] dt-bindings: power: supply: ab8500_fg: Add " Rob Herring
@ 2022-03-04 21:09 ` Sebastian Reichel
0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Reichel @ 2022-03-04 21:09 UTC (permalink / raw)
To: Rob Herring
Cc: Linus Walleij, Marcus Cooper, linux-pm, Matti Vaittinen, devicetree
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
Hi,
On Wed, Mar 02, 2022 at 12:25:26PM -0600, Rob Herring wrote:
> On Tue, Mar 01, 2022 at 01:42:53PM +0100, Linus Walleij wrote:
> > To improve the inner resistance measurement of the battery we need
> > to account for the line impedance of the connector to the battery.
> >
> > Cc: devicetree@vger.kernel.org
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > ---
> > .../bindings/power/supply/stericsson,ab8500-fg.yaml | 5 +++++
> > 1 file changed, 5 insertions(+)
>
> Acked-by: Rob Herring <robh@kernel.org>
Thanks, queued (together with patch 2/2)
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-04 21:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 12:42 [PATCH 1/2] dt-bindings: power: supply: ab8500_fg: Add line impedance Linus Walleij
2022-03-01 12:42 ` [PATCH 2/2] power: supply: ab8500_fg: Account for " Linus Walleij
2022-03-02 18:25 ` [PATCH 1/2] dt-bindings: power: supply: ab8500_fg: Add " Rob Herring
2022-03-04 21:09 ` 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.