public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] power: supply: cpcap-battery: pass static battery cell data from device tree
@ 2026-01-30 13:40 Svyatoslav Ryhel
  2026-01-30 13:40 ` [PATCH v1 1/2] dt-bindings: power: supply: cpcap-battery: document monitored-battery property Svyatoslav Ryhel
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Svyatoslav Ryhel @ 2026-01-30 13:40 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Tony Lindgren, Svyatoslav Ryhel
  Cc: linux-pm, devicetree, linux-kernel

Add an option to populate battery cell properties from the device tree if
the driver cannot access the battery's NVMEM.

Svyatoslav Ryhel (2):
  dt-bindings: power: supply: cpcap-battery: document monitored-battery
    property
  power: supply: cpcap-battery: pass static battery cell data from
    device tree

 .../bindings/power/supply/cpcap-battery.yaml  |  1 +
 drivers/power/supply/cpcap-battery.c          | 27 +++++++++++++++++++
 2 files changed, 28 insertions(+)

-- 
2.51.0


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

* [PATCH v1 1/2] dt-bindings: power: supply: cpcap-battery: document monitored-battery property
  2026-01-30 13:40 [PATCH v1 0/2] power: supply: cpcap-battery: pass static battery cell data from device tree Svyatoslav Ryhel
@ 2026-01-30 13:40 ` Svyatoslav Ryhel
  2026-02-09 17:57   ` Rob Herring (Arm)
  2026-01-30 13:40 ` [PATCH v1 2/2] power: supply: cpcap-battery: pass static battery cell data from device tree Svyatoslav Ryhel
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Svyatoslav Ryhel @ 2026-01-30 13:40 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Tony Lindgren, Svyatoslav Ryhel
  Cc: linux-pm, devicetree, linux-kernel

Document monitored-battery used to describe static battery cell properties.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 .../devicetree/bindings/power/supply/cpcap-battery.yaml          | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/power/supply/cpcap-battery.yaml b/Documentation/devicetree/bindings/power/supply/cpcap-battery.yaml
index 694bfdb5815c..6dcca55d6d90 100644
--- a/Documentation/devicetree/bindings/power/supply/cpcap-battery.yaml
+++ b/Documentation/devicetree/bindings/power/supply/cpcap-battery.yaml
@@ -55,6 +55,7 @@ properties:
       - const: chg_isense
       - const: batti
 
+  monitored-battery: true
   power-supplies: true
 
 required:
-- 
2.51.0


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

* [PATCH v1 2/2] power: supply: cpcap-battery: pass static battery cell data from device tree
  2026-01-30 13:40 [PATCH v1 0/2] power: supply: cpcap-battery: pass static battery cell data from device tree Svyatoslav Ryhel
  2026-01-30 13:40 ` [PATCH v1 1/2] dt-bindings: power: supply: cpcap-battery: document monitored-battery property Svyatoslav Ryhel
@ 2026-01-30 13:40 ` Svyatoslav Ryhel
  2026-02-06  4:24   ` Tony Lindgren
  2026-03-02  7:44 ` [PATCH v1 0/2] " Svyatoslav Ryhel
  2026-03-02 23:51 ` Sebastian Reichel
  3 siblings, 1 reply; 7+ messages in thread
From: Svyatoslav Ryhel @ 2026-01-30 13:40 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Tony Lindgren, Svyatoslav Ryhel
  Cc: linux-pm, devicetree, linux-kernel

Add an option to populate battery cell properties from the device tree if
the driver cannot access the battery's NVMEM.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 drivers/power/supply/cpcap-battery.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
index 507fdc1c866d..9e686ba20282 100644
--- a/drivers/power/supply/cpcap-battery.c
+++ b/drivers/power/supply/cpcap-battery.c
@@ -404,6 +404,30 @@ static int cpcap_battery_match_nvmem(struct device *dev, const void *data)
 		return 0;
 }
 
+static void cpcap_battery_update_battery_data(struct cpcap_battery_ddata *ddata)
+{
+	struct power_supply_battery_info *info;
+
+	if (power_supply_get_battery_info(ddata->psy, &info) < 0)
+		return;
+
+	if (info->technology > 0)
+		ddata->config.info.technology = info->technology;
+
+	if (info->voltage_max_design_uv > 0)
+		ddata->config.info.voltage_max_design = info->voltage_max_design_uv;
+
+	if (info->voltage_min_design_uv > 0)
+		ddata->config.info.voltage_min_design = info->voltage_min_design_uv;
+
+	if (info->charge_full_design_uah > 0)
+		ddata->config.info.charge_full_design = info->charge_full_design_uah;
+
+	if (info->constant_charge_voltage_max_uv > 0)
+		ddata->config.bat.constant_charge_voltage_max_uv =
+			info->constant_charge_voltage_max_uv;
+}
+
 static void cpcap_battery_detect_battery_type(struct cpcap_battery_ddata *ddata)
 {
 	struct nvmem_device *nvmem;
@@ -431,6 +455,9 @@ static void cpcap_battery_detect_battery_type(struct cpcap_battery_ddata *ddata)
 	default:
 		ddata->config = cpcap_battery_unkown_data;
 	}
+
+	if (ddata->psy)
+		cpcap_battery_update_battery_data(ddata);
 }
 
 /**
-- 
2.51.0


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

* Re: [PATCH v1 2/2] power: supply: cpcap-battery: pass static battery cell data from device tree
  2026-01-30 13:40 ` [PATCH v1 2/2] power: supply: cpcap-battery: pass static battery cell data from device tree Svyatoslav Ryhel
@ 2026-02-06  4:24   ` Tony Lindgren
  0 siblings, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2026-02-06  4:24 UTC (permalink / raw)
  To: Svyatoslav Ryhel
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-pm, devicetree, linux-kernel

* Svyatoslav Ryhel <clamor95@gmail.com> [260130 13:40]:
> Add an option to populate battery cell properties from the device tree if
> the driver cannot access the battery's NVMEM.

Makes sense to me:

Reviewed-by: Tony Lindgren <tony@atomide.com>

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

* Re: [PATCH v1 1/2] dt-bindings: power: supply: cpcap-battery: document monitored-battery property
  2026-01-30 13:40 ` [PATCH v1 1/2] dt-bindings: power: supply: cpcap-battery: document monitored-battery property Svyatoslav Ryhel
@ 2026-02-09 17:57   ` Rob Herring (Arm)
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring (Arm) @ 2026-02-09 17:57 UTC (permalink / raw)
  To: Svyatoslav Ryhel
  Cc: Tony Lindgren, Krzysztof Kozlowski, linux-kernel, Conor Dooley,
	devicetree, linux-pm, Sebastian Reichel


On Fri, 30 Jan 2026 15:40:20 +0200, Svyatoslav Ryhel wrote:
> Document monitored-battery used to describe static battery cell properties.
> 
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
>  .../devicetree/bindings/power/supply/cpcap-battery.yaml          | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring (Arm) <robh@kernel.org>


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

* Re: [PATCH v1 0/2] power: supply: cpcap-battery: pass static battery cell data from device tree
  2026-01-30 13:40 [PATCH v1 0/2] power: supply: cpcap-battery: pass static battery cell data from device tree Svyatoslav Ryhel
  2026-01-30 13:40 ` [PATCH v1 1/2] dt-bindings: power: supply: cpcap-battery: document monitored-battery property Svyatoslav Ryhel
  2026-01-30 13:40 ` [PATCH v1 2/2] power: supply: cpcap-battery: pass static battery cell data from device tree Svyatoslav Ryhel
@ 2026-03-02  7:44 ` Svyatoslav Ryhel
  2026-03-02 23:51 ` Sebastian Reichel
  3 siblings, 0 replies; 7+ messages in thread
From: Svyatoslav Ryhel @ 2026-03-02  7:44 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Tony Lindgren, Svyatoslav Ryhel
  Cc: linux-pm, devicetree, linux-kernel

пт, 30 січ. 2026 р. о 15:40 Svyatoslav Ryhel <clamor95@gmail.com> пише:
>
> Add an option to populate battery cell properties from the device tree if
> the driver cannot access the battery's NVMEM.
>
> Svyatoslav Ryhel (2):
>   dt-bindings: power: supply: cpcap-battery: document monitored-battery
>     property
>   power: supply: cpcap-battery: pass static battery cell data from
>     device tree
>
>  .../bindings/power/supply/cpcap-battery.yaml  |  1 +
>  drivers/power/supply/cpcap-battery.c          | 27 +++++++++++++++++++
>  2 files changed, 28 insertions(+)
>

Hello Sebastian!

Would you mind to pick these 2 patches if you are fine with them?

Best regards,
Svyatoslav R.

> --
> 2.51.0
>

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

* Re: [PATCH v1 0/2] power: supply: cpcap-battery: pass static battery cell data from device tree
  2026-01-30 13:40 [PATCH v1 0/2] power: supply: cpcap-battery: pass static battery cell data from device tree Svyatoslav Ryhel
                   ` (2 preceding siblings ...)
  2026-03-02  7:44 ` [PATCH v1 0/2] " Svyatoslav Ryhel
@ 2026-03-02 23:51 ` Sebastian Reichel
  3 siblings, 0 replies; 7+ messages in thread
From: Sebastian Reichel @ 2026-03-02 23:51 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Tony Lindgren, Svyatoslav Ryhel
  Cc: linux-pm, devicetree, linux-kernel


On Fri, 30 Jan 2026 15:40:19 +0200, Svyatoslav Ryhel wrote:
> Add an option to populate battery cell properties from the device tree if
> the driver cannot access the battery's NVMEM.
> 
> Svyatoslav Ryhel (2):
>   dt-bindings: power: supply: cpcap-battery: document monitored-battery
>     property
>   power: supply: cpcap-battery: pass static battery cell data from
>     device tree
> 
> [...]

Applied, thanks!

[1/2] dt-bindings: power: supply: cpcap-battery: document monitored-battery property
      commit: 62c395fa887c38dad878741b7a1095ef441ba813
[2/2] power: supply: cpcap-battery: pass static battery cell data from device tree
      commit: ca2199cb7ae0375071609460470eadbbde8a4dd5

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>


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

end of thread, other threads:[~2026-03-02 23:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-30 13:40 [PATCH v1 0/2] power: supply: cpcap-battery: pass static battery cell data from device tree Svyatoslav Ryhel
2026-01-30 13:40 ` [PATCH v1 1/2] dt-bindings: power: supply: cpcap-battery: document monitored-battery property Svyatoslav Ryhel
2026-02-09 17:57   ` Rob Herring (Arm)
2026-01-30 13:40 ` [PATCH v1 2/2] power: supply: cpcap-battery: pass static battery cell data from device tree Svyatoslav Ryhel
2026-02-06  4:24   ` Tony Lindgren
2026-03-02  7:44 ` [PATCH v1 0/2] " Svyatoslav Ryhel
2026-03-02 23:51 ` Sebastian Reichel

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