* [PATCH 0/4] power: supply: add battery driver for netronix ec
@ 2026-01-02 18:00 Josua Mayer
2026-01-02 18:00 ` [PATCH 1/4] dt-bindings: mfd: netronix,ntxec: add reference to power-supply Josua Mayer
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Josua Mayer @ 2026-01-02 18:00 UTC (permalink / raw)
To: Jonathan Neuschäfer, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: linux-kernel, linux-pm, devicetree, imx, linux-arm-kernel,
Josua Mayer
This series adds a new battery driver for the netronix embedded
controller multi-function device.
Bindings are updated supporting a monitored battery, and battery
description is added to kobo aura device-tree.
Signed-off-by: Josua Mayer <josua.mayer@jm0.eu>
---
Changes in v2:
- Fixed identity mixup between from address and SoB.
(Reported-by: Krzysztof Kozlowski <krzk@kernel.org>)
- Changed patch ordering, device-tree first.
- Separated new driver and mfd subdevice changes into separate patches.
(Reported-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>)
- reworded Kconfig to explicitly mention device-tree
instead of vague firmware tables expression.
(Reported-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>)
---
Josua Mayer (4):
dt-bindings: mfd: netronix,ntxec: add reference to power-supply
ARM: dts: imx: imx50-kobo-aura: add description for battery
power: supply: add battery driver for netronix ec
mfd: ntxec: register battery subdevice.
.../devicetree/bindings/mfd/netronix,ntxec.yaml | 9 +-
arch/arm/boot/dts/nxp/imx/imx50-kobo-aura.dts | 9 ++
drivers/mfd/ntxec.c | 1 +
drivers/power/supply/Kconfig | 9 ++
drivers/power/supply/Makefile | 1 +
drivers/power/supply/ntxec-battery.c | 101 +++++++++++++++++++++
6 files changed, 127 insertions(+), 3 deletions(-)
---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251227-kobo-aura-battery-3e60bc159d16
Best regards,
--
Josua Mayer <josua.mayer@jm0.eu>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] dt-bindings: mfd: netronix,ntxec: add reference to power-supply
2026-01-02 18:00 [PATCH 0/4] power: supply: add battery driver for netronix ec Josua Mayer
@ 2026-01-02 18:00 ` Josua Mayer
2026-01-05 8:35 ` Krzysztof Kozlowski
2026-01-02 18:00 ` [PATCH 2/4] ARM: dts: imx: imx50-kobo-aura: add description for battery Josua Mayer
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Josua Mayer @ 2026-01-02 18:00 UTC (permalink / raw)
To: Jonathan Neuschäfer, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: linux-kernel, linux-pm, devicetree, imx, linux-arm-kernel,
Josua Mayer
The Netronix Embedded Controller supports monitoring of battery voltage.
Voltage monitoring functionality is self-contained and requires no
supply- or battery-specific runtime configuration.
Battery design characteristics (e.g. voltage-min-design-microvolt) are
useful for users to understand the charge level and are commonly
provided by a separate battery node linked with monitored-battery
property.
Add reference to power-supply.yaml so that power-supplies and
monitored-battery properties become available.
Further drop reg property description and replace it with maxItems 1 as
is common for i2c devices with single bus address.
Finally replace additionalProperties with unevaluatedProperties to
allow properties from referenced schemas.
Signed-off-by: Josua Mayer <josua.mayer@jm0.eu>
---
Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml
index 37fbb953ea12..6599dcf0eceb 100644
--- a/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml
+++ b/Documentation/devicetree/bindings/mfd/netronix,ntxec.yaml
@@ -13,13 +13,15 @@ description: |
This EC is found in e-book readers of multiple brands (e.g. Kobo, Tolino), and
is typically implemented as a TI MSP430 microcontroller.
+allOf:
+ - $ref: /schemas/power/supply/power-supply.yaml
+
properties:
compatible:
const: netronix,ntxec
reg:
- items:
- - description: The I2C address of the EC
+ maxItems: 1
system-power-controller:
type: boolean
@@ -42,7 +44,7 @@ required:
- compatible
- reg
-additionalProperties: false
+unevaluatedProperties: false
examples:
- |
@@ -61,5 +63,6 @@ examples:
interrupt-parent = <&gpio4>;
interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
#pwm-cells = <2>;
+ monitored-battery = <&battery>;
};
};
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] ARM: dts: imx: imx50-kobo-aura: add description for battery
2026-01-02 18:00 [PATCH 0/4] power: supply: add battery driver for netronix ec Josua Mayer
2026-01-02 18:00 ` [PATCH 1/4] dt-bindings: mfd: netronix,ntxec: add reference to power-supply Josua Mayer
@ 2026-01-02 18:00 ` Josua Mayer
2026-01-02 18:00 ` [PATCH 3/4] power: supply: add battery driver for netronix ec Josua Mayer
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Josua Mayer @ 2026-01-02 18:00 UTC (permalink / raw)
To: Jonathan Neuschäfer, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: linux-kernel, linux-pm, devicetree, imx, linux-arm-kernel,
Josua Mayer
Kobo Aura has a rechargable battery that is monitored by the embedded
controller.
Battery markings: PR-285083 3.7V Typ. 1500mAh; 575327416288 5.55Wh.
Add description for this battery and link it for monitoring by the
embedded controller.
Reviewed-by: J. Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Josua Mayer <josua.mayer@jm0.eu>
---
arch/arm/boot/dts/nxp/imx/imx50-kobo-aura.dts | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm/boot/dts/nxp/imx/imx50-kobo-aura.dts b/arch/arm/boot/dts/nxp/imx/imx50-kobo-aura.dts
index b1a6a9c58ac3..dc8d9fd45cd2 100644
--- a/arch/arm/boot/dts/nxp/imx/imx50-kobo-aura.dts
+++ b/arch/arm/boot/dts/nxp/imx/imx50-kobo-aura.dts
@@ -16,6 +16,14 @@ chosen {
stdout-path = "serial1:115200n8";
};
+ battery: battery {
+ compatible = "simple-battery";
+ voltage-min-design-microvolt = <3400000>;
+ voltage-max-design-microvolt = <4100000>;
+ energy-full-design-microwatt-hours = <5550000>;
+ charge-full-design-microamp-hours = <1500000>;
+ };
+
memory@70000000 {
device_type = "memory";
reg = <0x70000000 0x10000000>;
@@ -151,6 +159,7 @@ embedded-controller@43 {
system-power-controller;
interrupts-extended = <&gpio4 11 IRQ_TYPE_EDGE_FALLING>;
#pwm-cells = <2>;
+ monitored-battery = <&battery>;
};
};
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] power: supply: add battery driver for netronix ec
2026-01-02 18:00 [PATCH 0/4] power: supply: add battery driver for netronix ec Josua Mayer
2026-01-02 18:00 ` [PATCH 1/4] dt-bindings: mfd: netronix,ntxec: add reference to power-supply Josua Mayer
2026-01-02 18:00 ` [PATCH 2/4] ARM: dts: imx: imx50-kobo-aura: add description for battery Josua Mayer
@ 2026-01-02 18:00 ` Josua Mayer
2026-01-02 18:00 ` [PATCH 4/4] mfd: ntxec: register battery subdevice Josua Mayer
2026-01-02 18:47 ` [PATCH 0/4] power: supply: add battery driver for netronix ec Ing. Josua Mayer
4 siblings, 0 replies; 7+ messages in thread
From: Josua Mayer @ 2026-01-02 18:00 UTC (permalink / raw)
To: Jonathan Neuschäfer, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: linux-kernel, linux-pm, devicetree, imx, linux-arm-kernel,
Josua Mayer
Implement a simple battery driver for monitoring voltage with the
netronix embedded controller found in certain ebook readers.
Signed-off-by: Josua Mayer <josua.mayer@jm0.eu>
---
drivers/power/supply/Kconfig | 9 ++++
drivers/power/supply/Makefile | 1 +
drivers/power/supply/ntxec-battery.c | 101 +++++++++++++++++++++++++++++++++++
3 files changed, 111 insertions(+)
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index 92f9f7aae92f..0f944c10e50b 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -1132,4 +1132,13 @@ config FUEL_GAUGE_MM8013
the state of charge, temperature, cycle count, actual and design
capacity, etc.
+config BATTERY_NTXEC
+ tristate "Battery driver for Netronix embedded controller"
+ depends on MFD_NTXEC
+ help
+ Say yes here to enable netronix ec battery monitoring driver.
+ It enables the monitoring battery voltage on certain e-book readers
+ using an embedded controller by ODM Netronix. Battery design
+ characteristics are read from device-tree if available.
+
endif # POWER_SUPPLY
diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile
index 4b79d5abc49a..db6fc815f9da 100644
--- a/drivers/power/supply/Makefile
+++ b/drivers/power/supply/Makefile
@@ -128,3 +128,4 @@ obj-$(CONFIG_CHARGER_SURFACE) += surface_charger.o
obj-$(CONFIG_BATTERY_UG3105) += ug3105_battery.o
obj-$(CONFIG_CHARGER_QCOM_SMB2) += qcom_smbx.o
obj-$(CONFIG_FUEL_GAUGE_MM8013) += mm8013.o
+obj-$(CONFIG_BATTERY_NTXEC) += ntxec-battery.o
diff --git a/drivers/power/supply/ntxec-battery.c b/drivers/power/supply/ntxec-battery.c
new file mode 100644
index 000000000000..f49f0966d18d
--- /dev/null
+++ b/drivers/power/supply/ntxec-battery.c
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * The Netronix embedded controller is a microcontroller found in some
+ * e-book readers designed by the original design manufacturer Netronix, Inc.
+ * It contains RTC, battery monitoring, system power management, and PWM
+ * functionality.
+ *
+ * This driver implements battery monitoring.
+ *
+ * Copyright 2021 Josua Mayer <josua.mayer@jm0.eu>
+ */
+
+#include <linux/mfd/ntxec.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/power_supply.h>
+#include <linux/property.h>
+#include <linux/regmap.h>
+
+static const enum power_supply_property ntxec_battery_properties[] = {
+ POWER_SUPPLY_PROP_VOLTAGE_NOW,
+};
+
+struct ntxec_battery {
+ struct ntxec *ec;
+};
+
+#define NTXEC_REG_READ_BATTERY 0x41
+
+static int ntxec_battery_get_property(struct power_supply *psy,
+ enum power_supply_property psp,
+ union power_supply_propval *val)
+{
+ struct ntxec_battery *priv = power_supply_get_drvdata(psy);
+ int ret;
+ unsigned int value;
+
+ switch (psp) {
+ case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+ ret = regmap_read(priv->ec->regmap, NTXEC_REG_READ_BATTERY, &value);
+ if (ret < 0)
+ return ret;
+
+ /* ec value to microvolt conversion:
+ * vendor kernel source suggests linear behaviour from 3V to 4.2V
+ * with readings 767 to 1023; each increment represents 4687,5uV.
+ * adjust 3V boundary slightly to report exactly 4.2V when full.
+ */
+ val->intval = 2999872 + (value - 767) * 4688;
+ break;
+ default:
+ dev_err(&psy->dev, "%s: invalid property %u\n", __func__, psp);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static const struct power_supply_desc ntxec_battery_desc = {
+ .name = "ec-battery",
+ .type = POWER_SUPPLY_TYPE_BATTERY,
+ .properties = ntxec_battery_properties,
+ .get_property = ntxec_battery_get_property,
+ .num_properties = ARRAY_SIZE(ntxec_battery_properties),
+};
+
+static int ntxec_battery_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct ntxec *ec = dev_get_drvdata(dev->parent);
+ struct power_supply_config psy_cfg = {};
+ struct ntxec_battery *priv;
+ struct power_supply *psy;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ priv->ec = ec;
+ psy_cfg.drv_data = priv;
+ psy_cfg.fwnode = dev_fwnode(dev->parent);
+ psy_cfg.no_wakeup_source = true;
+ psy = devm_power_supply_register(dev, &ntxec_battery_desc, &psy_cfg);
+ if (IS_ERR(psy))
+ return PTR_ERR(psy);
+
+ return 0;
+}
+
+static struct platform_driver ntxec_battery_driver = {
+ .driver = {
+ .name = "ntxec-battery",
+ },
+ .probe = ntxec_battery_probe,
+};
+module_platform_driver(ntxec_battery_driver);
+
+MODULE_AUTHOR("Josua Mayer <josua.mayer@jm0.eu>");
+MODULE_DESCRIPTION("Battery driver for Netronix EC");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:ntxec-battery");
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] mfd: ntxec: register battery subdevice.
2026-01-02 18:00 [PATCH 0/4] power: supply: add battery driver for netronix ec Josua Mayer
` (2 preceding siblings ...)
2026-01-02 18:00 ` [PATCH 3/4] power: supply: add battery driver for netronix ec Josua Mayer
@ 2026-01-02 18:00 ` Josua Mayer
2026-01-02 18:47 ` [PATCH 0/4] power: supply: add battery driver for netronix ec Ing. Josua Mayer
4 siblings, 0 replies; 7+ messages in thread
From: Josua Mayer @ 2026-01-02 18:00 UTC (permalink / raw)
To: Jonathan Neuschäfer, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: linux-kernel, linux-pm, devicetree, imx, linux-arm-kernel,
Josua Mayer
Add Netronix EC battery driver as subdevice.
Signed-off-by: Josua Mayer <josua.mayer@jm0.eu>
---
drivers/mfd/ntxec.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mfd/ntxec.c b/drivers/mfd/ntxec.c
index 08c68de0f01b..d5059b8862aa 100644
--- a/drivers/mfd/ntxec.c
+++ b/drivers/mfd/ntxec.c
@@ -139,6 +139,7 @@ static const struct regmap_config regmap_config = {
static const struct mfd_cell ntxec_subdev[] = {
{ .name = "ntxec-rtc" },
{ .name = "ntxec-pwm" },
+ { .name = "ntxec-battery" },
};
static const struct mfd_cell ntxec_subdev_pwm[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] power: supply: add battery driver for netronix ec
2026-01-02 18:00 [PATCH 0/4] power: supply: add battery driver for netronix ec Josua Mayer
` (3 preceding siblings ...)
2026-01-02 18:00 ` [PATCH 4/4] mfd: ntxec: register battery subdevice Josua Mayer
@ 2026-01-02 18:47 ` Ing. Josua Mayer
4 siblings, 0 replies; 7+ messages in thread
From: Ing. Josua Mayer @ 2026-01-02 18:47 UTC (permalink / raw)
To: Jonathan Neuschäfer, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: linux-kernel, linux-pm, devicetree, imx, linux-arm-kernel
Greetings everyone,
I made some mistake using "b4" on a different device,
and the v2 was not added as subject prefix.
I will try to fix it after hopefully some comments.
Am Fri, 02 Jan 2026 19:00:29 +0100
schrieb Josua Mayer <josua.mayer@jm0.eu>:
> This series adds a new battery driver for the netronix embedded
> controller multi-function device.
>
> Bindings are updated supporting a monitored battery, and battery
> description is added to kobo aura device-tree.
>
> Signed-off-by: Josua Mayer <josua.mayer@jm0.eu>
> ---
> Changes in v2:
> - Fixed identity mixup between from address and SoB.
> (Reported-by: Krzysztof Kozlowski <krzk@kernel.org>)
> - Changed patch ordering, device-tree first.
> - Separated new driver and mfd subdevice changes into separate
> patches. (Reported-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>)
> - reworded Kconfig to explicitly mention device-tree
> instead of vague firmware tables expression.
> (Reported-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>)
>
> ---
> Josua Mayer (4):
> dt-bindings: mfd: netronix,ntxec: add reference to power-supply
> ARM: dts: imx: imx50-kobo-aura: add description for battery
> power: supply: add battery driver for netronix ec
> mfd: ntxec: register battery subdevice.
>
> .../devicetree/bindings/mfd/netronix,ntxec.yaml | 9 +-
> arch/arm/boot/dts/nxp/imx/imx50-kobo-aura.dts | 9 ++
> drivers/mfd/ntxec.c | 1 +
> drivers/power/supply/Kconfig | 9 ++
> drivers/power/supply/Makefile | 1 +
> drivers/power/supply/ntxec-battery.c | 101
> +++++++++++++++++++++ 6 files changed, 127 insertions(+), 3
> deletions(-) ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251227-kobo-aura-battery-3e60bc159d16
>
> Best regards,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] dt-bindings: mfd: netronix,ntxec: add reference to power-supply
2026-01-02 18:00 ` [PATCH 1/4] dt-bindings: mfd: netronix,ntxec: add reference to power-supply Josua Mayer
@ 2026-01-05 8:35 ` Krzysztof Kozlowski
0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2026-01-05 8:35 UTC (permalink / raw)
To: Josua Mayer
Cc: Jonathan Neuschäfer, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
linux-kernel, linux-pm, devicetree, imx, linux-arm-kernel
On Fri, Jan 02, 2026 at 07:00:30PM +0100, Josua Mayer wrote:
> The Netronix Embedded Controller supports monitoring of battery voltage.
>
> Voltage monitoring functionality is self-contained and requires no
> supply- or battery-specific runtime configuration.
>
> Battery design characteristics (e.g. voltage-min-design-microvolt) are
> useful for users to understand the charge level and are commonly
> provided by a separate battery node linked with monitored-battery
> property.
b4 diff '20260102-kobo-aura-battery-v1-1-501f2a8fa575@jm0.eu'
Breaking thread to remove parents of 20260102-kobo-aura-battery-v1-0-501f2a8fa575@jm0.eu
---
Analyzing 6 messages in the thread
Could not find lower series to compare against.
Make it easier for us to review, not more difficult.
>
> Add reference to power-supply.yaml so that power-supplies and
> monitored-battery properties become available.
>
> Further drop reg property description and replace it with maxItems 1 as
> is common for i2c devices with single bus address.
>
> Finally replace additionalProperties with unevaluatedProperties to
> allow properties from referenced schemas.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-01-05 8:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 18:00 [PATCH 0/4] power: supply: add battery driver for netronix ec Josua Mayer
2026-01-02 18:00 ` [PATCH 1/4] dt-bindings: mfd: netronix,ntxec: add reference to power-supply Josua Mayer
2026-01-05 8:35 ` Krzysztof Kozlowski
2026-01-02 18:00 ` [PATCH 2/4] ARM: dts: imx: imx50-kobo-aura: add description for battery Josua Mayer
2026-01-02 18:00 ` [PATCH 3/4] power: supply: add battery driver for netronix ec Josua Mayer
2026-01-02 18:00 ` [PATCH 4/4] mfd: ntxec: register battery subdevice Josua Mayer
2026-01-02 18:47 ` [PATCH 0/4] power: supply: add battery driver for netronix ec Ing. Josua Mayer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).