* [PATCH V1 1/3] power: supply: sbs-battery: Fix false presence when registers read zero
@ 2025-12-29 8:56 LI Qingwu
2025-12-29 8:56 ` [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property LI Qingwu
2025-12-29 8:56 ` [PATCH V1 3/3] power: supply: sbs-battery: Add optional status monitoring LI Qingwu
0 siblings, 2 replies; 9+ messages in thread
From: LI Qingwu @ 2025-12-29 8:56 UTC (permalink / raw)
To: sre, robh, krzk+dt, conor+dt, linux-pm, devicetree, linux-kernel
Cc: bsp-development.geo, LI Qingwu
Some platforms return zero for all SBS battery registers when the
battery is physically absent, instead of failing with an I2C error.
This causes the driver to incorrectly report the battery as present.
Add a sanity check: when the status register returns zero, also read
voltage and capacity. Only report the battery as present if at least
one of these is non-zero. This prevents false-positive detection on
systems where unpopulated battery slots return all-zero values.
Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
---
drivers/power/supply/sbs-battery.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 943c82ee978f..9537b692f9fd 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -594,9 +594,17 @@ static int sbs_get_battery_presence_and_health(
return ret;
}
- if (psp == POWER_SUPPLY_PROP_PRESENT)
+ if (psp == POWER_SUPPLY_PROP_PRESENT) {
val->intval = 1; /* battery present */
- else { /* POWER_SUPPLY_PROP_HEALTH */
+ if (ret == 0) {
+ int voltage = sbs_read_word_data(
+ client, sbs_data[REG_VOLTAGE].addr);
+ int capacity = sbs_read_word_data(
+ client, sbs_data[REG_CAPACITY].addr);
+ if ((voltage == 0) && (capacity == 0))
+ val->intval = 0;
+ }
+ } else { /* POWER_SUPPLY_PROP_HEALTH */
if (sbs_bat_needs_calibration(client)) {
val->intval = POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED;
} else {
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property
2025-12-29 8:56 [PATCH V1 1/3] power: supply: sbs-battery: Fix false presence when registers read zero LI Qingwu
@ 2025-12-29 8:56 ` LI Qingwu
2025-12-29 9:16 ` Krzysztof Kozlowski
2025-12-29 10:36 ` Rob Herring (Arm)
2025-12-29 8:56 ` [PATCH V1 3/3] power: supply: sbs-battery: Add optional status monitoring LI Qingwu
1 sibling, 2 replies; 9+ messages in thread
From: LI Qingwu @ 2025-12-29 8:56 UTC (permalink / raw)
To: sre, robh, krzk+dt, conor+dt, linux-pm, devicetree, linux-kernel
Cc: bsp-development.geo, LI Qingwu
Add the optional sbs,monitoring-interval-ms property for SBS-compliant
batteries to configure a periodic polling interval on systems without
interrupt support. The driver periodically checks the battery status and
notifies userspace of changes when this property is set, and ignores it
when a GPIO interrupt is available.
The property defaults to 0 to preserve existing behaviour.
Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
---
.../bindings/power/supply/sbs,sbs-battery.yaml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml b/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
index 90b9d3d882a4..fbdd5dd5dda8 100644
--- a/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
+++ b/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
@@ -59,6 +59,15 @@ properties:
master implementation.
type: boolean
+ sbs,monitoring-interval-ms:
+ description:
+ Polling interval in milliseconds for battery status monitoring on
+ systems without interrupt support. The driver periodically checks
+ the battery status and notifies userspace of changes. Ignored when
+ GPIO interrupt is available.
+ default: 0
+ $ref: /schemas/types.yaml#/definitions/uint32
+
required:
- compatible
- reg
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH V1 3/3] power: supply: sbs-battery: Add optional status monitoring
2025-12-29 8:56 [PATCH V1 1/3] power: supply: sbs-battery: Fix false presence when registers read zero LI Qingwu
2025-12-29 8:56 ` [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property LI Qingwu
@ 2025-12-29 8:56 ` LI Qingwu
1 sibling, 0 replies; 9+ messages in thread
From: LI Qingwu @ 2025-12-29 8:56 UTC (permalink / raw)
To: sre, robh, krzk+dt, conor+dt, linux-pm, devicetree, linux-kernel
Cc: bsp-development.geo, LI Qingwu
Some systems do not have GPIO interrupt support for battery detection.
Without GPIO IRQ or SMBus Alert, the driver cannot proactively report
battery status changes.
Add an optional "sbs,monitoring-interval-ms" device property to enable
periodic status checks. When set, the driver polls the SBS status
register at the given interval and calls power_supply_changed() if the
battery state changes.
If a GPIO IRQ is successfully registered, monitoring is automatically
disabled since interrupt-based detection is preferred.
Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
---
drivers/power/supply/sbs-battery.c | 50 ++++++++++++++++++++++--------
1 file changed, 37 insertions(+), 13 deletions(-)
diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 9537b692f9fd..2874a741c809 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -214,6 +214,7 @@ struct sbs_info {
u32 poll_retry_count;
struct delayed_work work;
struct mutex mode_lock;
+ u32 monitoring_interval_ms;
u32 flags;
int technology;
char strings[NR_STRING_BUFFERS][I2C_SMBUS_BLOCK_MAX + 1];
@@ -1089,21 +1090,27 @@ static void sbs_delayed_work(struct work_struct *work)
/* if the read failed, give up on this work */
if (ret < 0) {
chip->poll_time = 0;
- return;
- }
-
- if (ret & BATTERY_FULL_CHARGED)
- ret = POWER_SUPPLY_STATUS_FULL;
- else if (ret & BATTERY_DISCHARGING)
- ret = POWER_SUPPLY_STATUS_DISCHARGING;
- else
- ret = POWER_SUPPLY_STATUS_CHARGING;
+ if (!chip->monitoring_interval_ms)
+ return;
+ } else {
+ if (ret & BATTERY_FULL_CHARGED)
+ ret = POWER_SUPPLY_STATUS_FULL;
+ else if (ret & BATTERY_DISCHARGING)
+ ret = POWER_SUPPLY_STATUS_DISCHARGING;
+ else
+ ret = POWER_SUPPLY_STATUS_CHARGING;
- sbs_status_correct(chip->client, &ret);
+ sbs_status_correct(chip->client, &ret);
- if (chip->last_state != ret) {
- chip->poll_time = 0;
- power_supply_changed(chip->power_supply);
+ if (chip->last_state != ret) {
+ chip->poll_time = 0;
+ power_supply_changed(chip->power_supply);
+ }
+ }
+ if (chip->monitoring_interval_ms) {
+ schedule_delayed_work(
+ &chip->work,
+ msecs_to_jiffies(chip->monitoring_interval_ms));
return;
}
if (chip->poll_time > 0) {
@@ -1171,6 +1178,13 @@ static int sbs_probe(struct i2c_client *client)
}
chip->i2c_retry_count = chip->i2c_retry_count + 1;
+ rc = device_property_read_u32(&client->dev, "sbs,monitoring-interval-ms",
+ &chip->monitoring_interval_ms);
+ if (rc)
+ chip->monitoring_interval_ms = 0;
+ if (chip->monitoring_interval_ms)
+ force_load = true;
+
chip->charger_broadcasts = !device_property_read_bool(&client->dev,
"sbs,disable-charger-broadcasts");
@@ -1198,6 +1212,11 @@ static int sbs_probe(struct i2c_client *client)
dev_warn(&client->dev, "Failed to request irq: %d\n", rc);
goto skip_gpio;
}
+ if (chip->monitoring_interval_ms) {
+ dev_info(&client->dev,
+ "GPIO IRQ registered, monitoring disabled\n");
+ chip->monitoring_interval_ms = 0;
+ }
skip_gpio:
/*
@@ -1228,6 +1247,11 @@ static int sbs_probe(struct i2c_client *client)
dev_info(&client->dev,
"%s: battery gas gauge device registered\n", client->name);
+ if (chip->monitoring_interval_ms > 0)
+ schedule_delayed_work(
+ &chip->work,
+ msecs_to_jiffies(chip->monitoring_interval_ms));
+
return 0;
}
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property
2025-12-29 8:56 ` [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property LI Qingwu
@ 2025-12-29 9:16 ` Krzysztof Kozlowski
2025-12-29 9:50 ` LI Qingwu
2025-12-29 10:36 ` Rob Herring (Arm)
1 sibling, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-29 9:16 UTC (permalink / raw)
To: LI Qingwu, sre, robh, krzk+dt, conor+dt, linux-pm, devicetree,
linux-kernel
Cc: bsp-development.geo
On 29/12/2025 09:56, LI Qingwu wrote:
> Add the optional sbs,monitoring-interval-ms property for SBS-compliant
> batteries to configure a periodic polling interval on systems without
> interrupt support. The driver periodically checks the battery status and
> notifies userspace of changes when this property is set, and ignores it
> when a GPIO interrupt is available.
>
> The property defaults to 0 to preserve existing behaviour.
>
> Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
> ---
> .../bindings/power/supply/sbs,sbs-battery.yaml | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml b/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
> index 90b9d3d882a4..fbdd5dd5dda8 100644
> --- a/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
> @@ -59,6 +59,15 @@ properties:
> master implementation.
> type: boolean
>
> + sbs,monitoring-interval-ms:
> + description:
> + Polling interval in milliseconds for battery status monitoring on
> + systems without interrupt support. The driver periodically checks
> + the battery status and notifies userspace of changes. Ignored when
> + GPIO interrupt is available.
You described the desired Linux feature or behavior, not the actual
hardware. The bindings are about the latter, so instead you need to
rephrase the property and its description to match actual hardware
capabilities/features/configuration etc.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property
2025-12-29 9:16 ` Krzysztof Kozlowski
@ 2025-12-29 9:50 ` LI Qingwu
2025-12-29 12:47 ` Krzysztof Kozlowski
0 siblings, 1 reply; 9+ messages in thread
From: LI Qingwu @ 2025-12-29 9:50 UTC (permalink / raw)
To: Krzysztof Kozlowski, sre, robh, krzk+dt, conor+dt, linux-pm,
devicetree, linux-kernel
Cc: GEO-CHHER-bsp-development
> -----Original Message-----
> From: Krzysztof Kozlowski <krzk@kernel.org>
> Sent: Monday, December 29, 2025 5:16 PM
> To: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>; sre@kernel.org;
> robh@kernel.org; krzk+dt@kernel.org; conor+dt@kernel.org;
> linux-pm@vger.kernel.org; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Cc: GEO-CHHER-bsp-development
> <bsp-development.geo@leica-geosystems.com>
> Subject: Re: [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval
> property
>
> This email is not from Hexagon’s Office 365 instance. Please be careful while
> clicking links, opening attachments, or replying to this email.
>
>
> On 29/12/2025 09:56, LI Qingwu wrote:
> > Add the optional sbs,monitoring-interval-ms property for SBS-compliant
> > batteries to configure a periodic polling interval on systems without
> > interrupt support. The driver periodically checks the battery status
> > and notifies userspace of changes when this property is set, and
> > ignores it when a GPIO interrupt is available.
> >
> > The property defaults to 0 to preserve existing behaviour.
> >
> > Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
> > ---
> > .../bindings/power/supply/sbs,sbs-battery.yaml | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
> > b/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
> > index 90b9d3d882a4..fbdd5dd5dda8 100644
> > ---
> > a/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
> > +++ b/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.y
> > +++ aml
> > @@ -59,6 +59,15 @@ properties:
> > master implementation.
> > type: boolean
> >
> > + sbs,monitoring-interval-ms:
> > + description:
> > + Polling interval in milliseconds for battery status monitoring on
> > + systems without interrupt support. The driver periodically checks
> > + the battery status and notifies userspace of changes. Ignored when
> > + GPIO interrupt is available.
>
>
> You described the desired Linux feature or behavior, not the actual hardware.
> The bindings are about the latter, so instead you need to rephrase the property
> and its description to match actual hardware
> capabilities/features/configuration etc.
>
Thanks for the quick feedback!
How about this?
sbs,monitoring-interval-ms:
description:
Polling interval in milliseconds for battery status monitoring.
Intended for hardware designs where the battery's interrupt signal
is not connected, necessitating periodic status checks to detect
changes.
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property
2025-12-29 8:56 ` [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property LI Qingwu
2025-12-29 9:16 ` Krzysztof Kozlowski
@ 2025-12-29 10:36 ` Rob Herring (Arm)
1 sibling, 0 replies; 9+ messages in thread
From: Rob Herring (Arm) @ 2025-12-29 10:36 UTC (permalink / raw)
To: LI Qingwu
Cc: conor+dt, devicetree, sre, bsp-development.geo, linux-pm,
krzk+dt, linux-kernel
On Mon, 29 Dec 2025 08:56:35 +0000, LI Qingwu wrote:
> Add the optional sbs,monitoring-interval-ms property for SBS-compliant
> batteries to configure a periodic polling interval on systems without
> interrupt support. The driver periodically checks the battery status and
> notifies userspace of changes when this property is set, and ignores it
> when a GPIO interrupt is available.
>
> The property defaults to 0 to preserve existing behaviour.
>
> Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
> ---
> .../bindings/power/supply/sbs,sbs-battery.yaml | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml: properties:sbs,monitoring-interval-ms: '$ref' should not be valid under {'const': '$ref'}
hint: Standard unit suffix properties don't need a type $ref
from schema $id: http://devicetree.org/meta-schemas/core.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.kernel.org/project/devicetree/patch/20251229085636.4082852-2-Qing-wu.Li@leica-geosystems.com.cn
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property
2025-12-29 9:50 ` LI Qingwu
@ 2025-12-29 12:47 ` Krzysztof Kozlowski
2025-12-30 9:40 ` LI Qingwu
0 siblings, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-29 12:47 UTC (permalink / raw)
To: LI Qingwu, sre, robh, krzk+dt, conor+dt, linux-pm, devicetree,
linux-kernel
Cc: GEO-CHHER-bsp-development
On 29/12/2025 10:50, LI Qingwu wrote:
>
>
>> -----Original Message-----
>> From: Krzysztof Kozlowski <krzk@kernel.org>
>> Sent: Monday, December 29, 2025 5:16 PM
>> To: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>; sre@kernel.org;
>> robh@kernel.org; krzk+dt@kernel.org; conor+dt@kernel.org;
>> linux-pm@vger.kernel.org; devicetree@vger.kernel.org;
>> linux-kernel@vger.kernel.org
>> Cc: GEO-CHHER-bsp-development
>> <bsp-development.geo@leica-geosystems.com>
>> Subject: Re: [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval
>> property
>>
>> This email is not from Hexagon’s Office 365 instance. Please be careful while
>> clicking links, opening attachments, or replying to this email.
>>
>>
>> On 29/12/2025 09:56, LI Qingwu wrote:
>>> Add the optional sbs,monitoring-interval-ms property for SBS-compliant
>>> batteries to configure a periodic polling interval on systems without
>>> interrupt support. The driver periodically checks the battery status
>>> and notifies userspace of changes when this property is set, and
>>> ignores it when a GPIO interrupt is available.
>>>
>>> The property defaults to 0 to preserve existing behaviour.
>>>
>>> Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
>>> ---
>>> .../bindings/power/supply/sbs,sbs-battery.yaml | 9 +++++++++
>>> 1 file changed, 9 insertions(+)
>>>
>>> diff --git
>>> a/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
>>> b/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
>>> index 90b9d3d882a4..fbdd5dd5dda8 100644
>>> ---
>>> a/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yaml
>>> +++ b/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.y
>>> +++ aml
>>> @@ -59,6 +59,15 @@ properties:
>>> master implementation.
>>> type: boolean
>>>
>>> + sbs,monitoring-interval-ms:
>>> + description:
>>> + Polling interval in milliseconds for battery status monitoring on
>>> + systems without interrupt support. The driver periodically checks
>>> + the battery status and notifies userspace of changes. Ignored when
>>> + GPIO interrupt is available.
>>
>>
>> You described the desired Linux feature or behavior, not the actual hardware.
>> The bindings are about the latter, so instead you need to rephrase the property
>> and its description to match actual hardware
>> capabilities/features/configuration etc.
>>
>
> Thanks for the quick feedback!
> How about this?
>
> sbs,monitoring-interval-ms:
> description:
> Polling interval in milliseconds for battery status monitoring.
> Intended for hardware designs where the battery's interrupt signal
> is not connected, necessitating periodic status checks to detect
> changes.
Nothing changed. It's exactly the same.
Explain me how "polling interval" by Linux driver is a hardware value?
What was not clear in my feedback?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property
2025-12-29 12:47 ` Krzysztof Kozlowski
@ 2025-12-30 9:40 ` LI Qingwu
2025-12-30 9:46 ` Krzysztof Kozlowski
0 siblings, 1 reply; 9+ messages in thread
From: LI Qingwu @ 2025-12-30 9:40 UTC (permalink / raw)
To: Krzysztof Kozlowski, sre, robh, krzk+dt, conor+dt, linux-pm,
devicetree, linux-kernel
Cc: GEO-CHHER-bsp-development
> -----Original Message-----
> From: Krzysztof Kozlowski <krzk@kernel.org>
> Sent: Monday, December 29, 2025 8:47 PM
> To: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>; sre@kernel.org;
> robh@kernel.org; krzk+dt@kernel.org; conor+dt@kernel.org;
> linux-pm@vger.kernel.org; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Cc: GEO-CHHER-bsp-development
> <bsp-development.geo@leica-geosystems.com>
> Subject: Re: [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval
> property
>
> This email is not from Hexagon’s Office 365 instance. Please be careful while
> clicking links, opening attachments, or replying to this email.
>
>
> On 29/12/2025 10:50, LI Qingwu wrote:
> >
> >
> >> -----Original Message-----
> >> From: Krzysztof Kozlowski <krzk@kernel.org>
> >> Sent: Monday, December 29, 2025 5:16 PM
> >> To: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>; sre@kernel.org;
> >> robh@kernel.org; krzk+dt@kernel.org; conor+dt@kernel.org;
> >> linux-pm@vger.kernel.org; devicetree@vger.kernel.org;
> >> linux-kernel@vger.kernel.org
> >> Cc: GEO-CHHER-bsp-development
> >> <bsp-development.geo@leica-geosystems.com>
> >> Subject: Re: [PATCH V1 2/3] dt-bindings: power: sbs-battery: add
> >> polling interval property
> >>
> >> This email is not from Hexagon’s Office 365 instance. Please be
> >> careful while clicking links, opening attachments, or replying to this email.
> >>
> >>
> >> On 29/12/2025 09:56, LI Qingwu wrote:
> >>> Add the optional sbs,monitoring-interval-ms property for
> >>> SBS-compliant batteries to configure a periodic polling interval on
> >>> systems without interrupt support. The driver periodically checks
> >>> the battery status and notifies userspace of changes when this
> >>> property is set, and ignores it when a GPIO interrupt is available.
> >>>
> >>> The property defaults to 0 to preserve existing behaviour.
> >>>
> >>> Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
> >>> ---
> >>> .../bindings/power/supply/sbs,sbs-battery.yaml | 9
> +++++++++
> >>> 1 file changed, 9 insertions(+)
> >>>
> >>> diff --git
> >>> a/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yam
> >>> l
> >>> b/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yam
> >>> l index 90b9d3d882a4..fbdd5dd5dda8 100644
> >>> ---
> >>> a/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery.yam
> >>> l
> >>> +++ b/Documentation/devicetree/bindings/power/supply/sbs,sbs-battery
> >>> +++ .y
> >>> +++ aml
> >>> @@ -59,6 +59,15 @@ properties:
> >>> master implementation.
> >>> type: boolean
> >>>
> >>> + sbs,monitoring-interval-ms:
> >>> + description:
> >>> + Polling interval in milliseconds for battery status monitoring on
> >>> + systems without interrupt support. The driver periodically checks
> >>> + the battery status and notifies userspace of changes. Ignored when
> >>> + GPIO interrupt is available.
> >>
> >>
> >> You described the desired Linux feature or behavior, not the actual hardware.
> >> The bindings are about the latter, so instead you need to rephrase
> >> the property and its description to match actual hardware
> >> capabilities/features/configuration etc.
> >>
> >
> > Thanks for the quick feedback!
> > How about this?
> >
> > sbs,monitoring-interval-ms:
> > description:
> > Polling interval in milliseconds for battery status monitoring.
> > Intended for hardware designs where the battery's interrupt signal
> > is not connected, necessitating periodic status checks to detect
> > changes.
>
>
> Nothing changed. It's exactly the same.
>
> Explain me how "polling interval" by Linux driver is a hardware value?
> What was not clear in my feedback?
>
Thank you for the feedback. I apologize, but I am still not clear on
the correct approach.
I understand that "polling interval" is software policy and should not
be in device tree. However, I am unsure whether:
1. I should rephrase the property to describe the hardware fact (e.g.,
"battery alert signal is not wired"), or
2. I should remove this from device tree entirely and use a module
parameter instead.
Please clarify which direction is acceptable?
Best regards,
Qingwu
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property
2025-12-30 9:40 ` LI Qingwu
@ 2025-12-30 9:46 ` Krzysztof Kozlowski
0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-30 9:46 UTC (permalink / raw)
To: LI Qingwu, sre, robh, krzk+dt, conor+dt, linux-pm, devicetree,
linux-kernel
Cc: GEO-CHHER-bsp-development
On 30/12/2025 10:40, LI Qingwu wrote:
>>>>>
>>>>> + sbs,monitoring-interval-ms:
>>>>> + description:
>>>>> + Polling interval in milliseconds for battery status monitoring on
>>>>> + systems without interrupt support. The driver periodically checks
>>>>> + the battery status and notifies userspace of changes. Ignored when
>>>>> + GPIO interrupt is available.
>>>>
>>>>
>>>> You described the desired Linux feature or behavior, not the actual hardware.
>>>> The bindings are about the latter, so instead you need to rephrase
>>>> the property and its description to match actual hardware
>>>> capabilities/features/configuration etc.
>>>>
>>>
>>> Thanks for the quick feedback!
>>> How about this?
>>>
>>> sbs,monitoring-interval-ms:
>>> description:
>>> Polling interval in milliseconds for battery status monitoring.
>>> Intended for hardware designs where the battery's interrupt signal
>>> is not connected, necessitating periodic status checks to detect
>>> changes.
>>
>>
>> Nothing changed. It's exactly the same.
>>
>> Explain me how "polling interval" by Linux driver is a hardware value?
>> What was not clear in my feedback?
>>
>
> Thank you for the feedback. I apologize, but I am still not clear on
> the correct approach.
>
> I understand that "polling interval" is software policy and should not
> be in device tree. However, I am unsure whether:
>
> 1. I should rephrase the property to describe the hardware fact (e.g.,
> "battery alert signal is not wired"), or
Isn't this already described in the binding implicitly by missing
interrupt? Or the device is not using dedicated interrupt pins and only
SMBus Alert? But if the latter, then alert is always available.
> 2. I should remove this from device tree entirely and use a module
> parameter instead.
Module parameters are usually not the way to configure anything. Look at
other devices and how they do it. Usually this is sysfs interface.
Regardless, I don't give you advice nor instruction how to implement
this. I just do not agree with current phrasing for DT. If you come with
proper hardware description for DT, it could be fine. If you want to
remove it from DT completely, I am fine as well.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-12-30 9:46 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-29 8:56 [PATCH V1 1/3] power: supply: sbs-battery: Fix false presence when registers read zero LI Qingwu
2025-12-29 8:56 ` [PATCH V1 2/3] dt-bindings: power: sbs-battery: add polling interval property LI Qingwu
2025-12-29 9:16 ` Krzysztof Kozlowski
2025-12-29 9:50 ` LI Qingwu
2025-12-29 12:47 ` Krzysztof Kozlowski
2025-12-30 9:40 ` LI Qingwu
2025-12-30 9:46 ` Krzysztof Kozlowski
2025-12-29 10:36 ` Rob Herring (Arm)
2025-12-29 8:56 ` [PATCH V1 3/3] power: supply: sbs-battery: Add optional status monitoring LI Qingwu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome