public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>,
	Manaf Meethalavalappu Pallikunhi
	<manaf.pallikunhi@oss.qualcomm.com>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	amit.kucheria@oss.qualcomm.com,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Gaurav Kohli <gaurav.kohli@oss.qualcomm.com>,
	linux-hwmon@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] hwmon: Add Qualcomm PMIC BCL hardware monitor driver
Date: Fri, 20 Mar 2026 08:22:17 -0700	[thread overview]
Message-ID: <a922cf55-ebe7-4256-b3bb-cc732e45e1ff@roeck-us.net> (raw)
In-Reply-To: <ab1fSWx7pqlSANph@mai.linaro.org>

On 3/20/26 07:52, Daniel Lezcano wrote:
> Hi Manaf,
> 
> On Fri, Feb 06, 2026 at 02:44:06AM +0530, Manaf Meethalavalappu Pallikunhi wrote:
>> Add support for Qualcomm PMIC Battery Current Limiting (BCL) hardware
>> monitor driver. The BCL peripheral is present in Qualcomm PMICs and
>> provides real-time monitoring and protection against battery
>> overcurrent and under voltage conditions.
>>
>> The driver monitors:
>> - Battery voltage with configurable low voltage thresholds
>> - Battery current with configurable high current thresholds
>> - Two limit alarm interrupts (max/min, critical)
> 
> Can you describe the behavior of the alarm ?
> 
> I assume the alarm is raised when a threshold is crossed from normal
> to anormal condition leading to a hwmon event.
> 
>   * Does the BCL trigger an interrupt when going back to the normal condition ?
> 
>   * When is the alarm flag reset ?
> 
>   * Can we have a flood of events if the current / voltage is wavering
>     around the thresholds ?
> 
> Overall, the driver is too big, so hard to review. It is better to
> provide a simplified version with one version supported.
> 
>> The driver integrates with the Linux hwmon subsystem and provides
>> standard hwmon attributes for monitoring battery conditions.
>>
>> Signed-off-by: Manaf Meethalavalappu Pallikunhi <manaf.pallikunhi@oss.qualcomm.com>
>> ---
>>   MAINTAINERS                    |   9 +
>>   drivers/hwmon/Kconfig          |   9 +
>>   drivers/hwmon/Makefile         |   1 +
>>   drivers/hwmon/qcom-bcl-hwmon.c | 982 +++++++++++++++++++++++++++++++++++++++++
>>   drivers/hwmon/qcom-bcl-hwmon.h | 311 +++++++++++++
>>   5 files changed, 1312 insertions(+)
> 
> [ ... ]
> 
>> diff --git a/drivers/hwmon/qcom-bcl-hwmon.c b/drivers/hwmon/qcom-bcl-hwmon.c
>> new file mode 100644
>> index 000000000000..a7e3b865de5c
>> --- /dev/null
>> +++ b/drivers/hwmon/qcom-bcl-hwmon.c
>> @@ -0,0 +1,982 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Qualcomm pmic BCL hardware driver for battery overcurrent and
>> + * battery or system under voltage monitor
>> + *
>> + * Copyright (c) 2026, Qualcomm Innovation Center, Inc. All rights reserved.
>> + */
> 
> Old copyright format
> 
>> +#include <linux/devm-helpers.h>
>> +#include <linux/err.h>
>> +#include <linux/hwmon.h>
>> +#include <linux/interrupt.h>
>> +#include <linux/kernel.h>
>> +#include <linux/module.h>
>> +#include <linux/mod_devicetable.h>
>> +#include <linux/mutex.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/property.h>
>> +#include <linux/regmap.h>
>> +#include <linux/workqueue.h>
>> +
>> +#include "qcom-bcl-hwmon.h"
>> +
>> +ADD_BCL_HWMON_ALARM_MAPS(in, min, lcrit);
>> +ADD_BCL_HWMON_ALARM_MAPS(curr, max, crit);
>> +
>> +/* Interrupt names for each alarm level */
>> +static const char * const bcl_int_names[ALARM_MAX] = {
>> +	[LVL0] = "bcl-max-min",
>> +	[LVL1] = "bcl-critical",
>> +};
> 
> IIUC there are three levels of alarms but the hwmon only has max/min
> and critical. Would it make sense to do adaptative min / max ? So when

hwmon has lcrit, min, max, and crit alarms for all sensor types, plus
an additional _cap_alarm for power attributes and _emergency_alarm
for temperature attributes. There is also a generic _alarm attribute
for each sensor, which is supposed to be used if the specific alarm
type is not known.

What exactly are the three levels of alarms ?

Thanks,
Guenter


  reply	other threads:[~2026-03-20 15:22 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 21:14 [PATCH 0/4] hwmon: Add Qualcomm PMIC BCL hardware monitor driver Manaf Meethalavalappu Pallikunhi
2026-02-05 21:14 ` [PATCH 1/4] dt-bindings: hwmon: Add qcom,bcl-hwmon yaml bindings Manaf Meethalavalappu Pallikunhi
2026-02-06  8:09   ` Krzysztof Kozlowski
2026-02-12 20:24     ` Manaf Meethalavalappu Pallikunhi
2026-02-06  9:08   ` Dmitry Baryshkov
2026-02-12 20:41     ` Manaf Meethalavalappu Pallikunhi
2026-02-06  9:08   ` Konrad Dybcio
2026-02-13  6:04     ` Manaf Meethalavalappu Pallikunhi
2026-02-13 10:41       ` Konrad Dybcio
2026-02-13 12:00         ` Manaf Meethalavalappu Pallikunhi
2026-02-05 21:14 ` [PATCH 2/4] hwmon: Add Qualcomm PMIC BCL hardware monitor driver Manaf Meethalavalappu Pallikunhi
2026-02-06  8:12   ` Krzysztof Kozlowski
2026-02-13  6:21     ` Manaf Meethalavalappu Pallikunhi
2026-02-06  9:27   ` Konrad Dybcio
2026-02-06  9:38     ` Krzysztof Kozlowski
2026-02-13  9:42     ` Manaf Meethalavalappu Pallikunhi
2026-02-13 10:55       ` Konrad Dybcio
2026-02-06 13:24   ` Bjorn Andersson
2026-02-13 11:38     ` Manaf Meethalavalappu Pallikunhi
2026-02-08  1:27   ` kernel test robot
2026-03-20 14:52   ` Daniel Lezcano
2026-03-20 15:22     ` Guenter Roeck [this message]
2026-03-20 16:08       ` Daniel Lezcano
2026-03-20 16:59         ` Guenter Roeck
2026-03-20 17:23           ` Daniel Lezcano
2026-02-05 21:14 ` [PATCH 3/4] arm64: dts: qcom: pm7250b: Enable Qualcomm BCL device Manaf Meethalavalappu Pallikunhi
2026-02-06  8:13   ` Krzysztof Kozlowski
2026-02-13 11:44     ` Manaf Meethalavalappu Pallikunhi
2026-02-06  9:11   ` Konrad Dybcio
2026-02-13 11:55     ` Manaf Meethalavalappu Pallikunhi
2026-02-16 11:48       ` Konrad Dybcio
2026-02-19 11:34         ` Manaf Meethalavalappu Pallikunhi
2026-02-19 13:04           ` Konrad Dybcio
2026-02-24 18:35             ` Manaf Meethalavalappu Pallikunhi
2026-02-25 11:47               ` Konrad Dybcio
2026-02-06  9:11   ` Konrad Dybcio
2026-02-13 11:56     ` Manaf Meethalavalappu Pallikunhi
2026-02-05 21:14 ` [PATCH 4/4] arm64: dts: qcom: pm8350c: " Manaf Meethalavalappu Pallikunhi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a922cf55-ebe7-4256-b3bb-cc732e45e1ff@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=amit.kucheria@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=daniel.lezcano@oss.qualcomm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gaurav.kohli@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manaf.pallikunhi@oss.qualcomm.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox