Re: [PATCH 2/4] hwmon: Add Qualcomm PMIC BCL hardware monitor driver

Konrad Dybcio
2026-02-13T10:55:16Z

On 2/13/26 10:42 AM, Manaf Meethalavalappu Pallikunhi wrote:
> Hi Konrad,
>
>
> On 2/6/2026 2:57 PM, Konrad Dybcio wrote:
>> On 2/5/26 10:14 PM, 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)
>>>
>>> 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>
>>> ---

[...]

>>> +                    enum bcl_channel_type type, u8 field_width)
>>> +{
>>> +    u32 def_scale = desc->channel[type].default_scale_nu;
>>> +    u32 lsb_weight = field_width > 8 ? 1 : 1 << field_width;
>>> +    u32 scaling_factor = def_scale * lsb_weight;
>> Would this be equivalent?
>>
>> if (field_width > 8)
>>     def_scale <<= field_width;

Actually reading it again, that'd be "if (field_width *<=* 8)"

and the div_s64 could become a mult_frac() if you take care of the types

I would then read that as "some PMICs have a higher resolution ADC
but with the same range" - would that be right?

Konrad