Skip to main content

Configure battery overcurrent and undervoltage alarms

The Qualcomm PMIC battery current limit (BCL) hardware monitor driver enables real-time detection of battery overcurrent (discharge) and undervoltage conditions. Integrated directly to the Qualcomm PMICs, this driver plays a critical role in safeguarding the battery and overall system by responding to damaging electrical events. The BCL hardware monitors battery voltage and current using dedicated sensing channels with configurable threshold values. It supports multiple alarm levels, each associated with an independent interrupt line. Table: BCL alarm features
AlarmsThreshold levelsInterrupt line
Level 0 (LVL0)Maximum/Minimum thresholdMapped to hwmon min/max
Level 1 (LVL1)Critical thresholdMapped to hwmon lcrit/crit
The BCL hardware operates in two distinct modes: Table: BCL modes
BCL modesDescription
BCL in Battery PMICSupports both undervoltage and overcurrent monitoring
BCL in Core PMICSupports only undervoltage monitoring

sysfs attributes

When the driver is loaded, it detects the sensors present on the system and creates corresponding sysfs attributes under /sys/class/hwmon/hwmon<X>/, where <X> is an index assigned based on the presence and order of other hwmon devices in the system.

Battery PMIC attributes

The following attributes are supported for BCL in Battery PMIC (for example, PM7250B): Table: Supported BCL attributes in Battery PMIC
PMIC namePermDescription
curr1_inputRead-only (RO)Current in milliamperes (mA)
curr1_labelROCurrent sensor label
curr1_maxRead/Write (RW)Level 0 current threshold in mA
curr1_max_alarmROLevel 0 high current alarm status
curr1_critRWLevel 1 current threshold in mA
curr1_crit_alarmROLevel 1 high current alarm status
in0_inputROVoltage in millivolts (mV)
in0_labelROVoltage sensor label
in0_minRWLevel 0 low voltage threshold in mV
in0_min_alarmROLevel 0 low voltage alarm status
in0_lcritRWLevel 1 low voltage threshold in mV
in0_lcrit_alarmROLevel 1 low voltage alarm status
Note
  • Alarm attributes are automatically updated when thresholds are exceeded.
  • Threshold values can be configured at runtime through the RW attributes.
Following are the examples of sysfs structure for Battery PMIC:
-rw-r--r-- 1 root root 4096 Jan  1 00:05 curr1_crit
-r--r--r-- 1 root root 4096 Jan  1 00:05 curr1_crit_alarm
-r--r--r-- 1 root root 4096 Jan  1 00:05 curr1_input
-r--r--r-- 1 root root 4096 Jan  1 00:05 curr1_label
-rw-r--r-- 1 root root 4096 Jan  1 00:05 curr1_max
-r--r--r-- 1 root root 4096 Jan  1 00:05 curr1_max_alarm
lrwxrwxrwx 1 root root    0 Jan  1 00:05 device -> ../../../c440000.spmi:pmic@8:bcl@1d00
-r--r--r-- 1 root root 4096 Jan  1 00:05 in0_input
-r--r--r-- 1 root root 4096 Jan  1 00:05 in0_label
-rw-r--r-- 1 root root 4096 Jan  1 00:05 in0_lcrit
-r--r--r-- 1 root root 4096 Jan  1 00:05 in0_lcrit_alarm
-rw-r--r-- 1 root root 4096 Jan  1 00:05 in0_min
-r--r--r-- 1 root root 4096 Jan  1 00:05 in0_min_alarm
-r--r--r-- 1 root root 4096 Jan  1 00:05 name

Core PMIC attributes

The following attributes are supported for BCL in Core PMIC (for example, PM8350C): Table: Supported BCL attributes in Core PMIC
PMIC namePermDescription
in0_labelROVoltage sensor label
in0_minRWLevel 0 low voltage threshold in mV
in0_min_alarmROLevel 0 low voltage alarm status
in0_lcritRWLevel 1 low voltage threshold in mV
in0_lcrit_alarmROLevel 1 low voltage alarm status
Note
  • Alarm attributes are automatically updated when thresholds are exceeded.
  • Threshold values can be configured at runtime through the RW attributes.
The following are the examples of sysfs structure for Core PMIC:
-r--r--r-- 1 root root 4096 Jan  1 00:03 in0_label
-rw-r--r-- 1 root root 4096 Jan  1 00:03 in0_lcrit
-r--r--r-- 1 root root 4096 Jan  1 00:03 in0_lcrit_alarm
-rw-r--r-- 1 root root 4096 Jan  1 00:03 in0_min
-r--r--r-- 1 root root 4096 Jan  1 00:03 in0_min_alarm
-r--r--r-- 1 root root 4096 Jan  1 00:03 name
lrwxrwxrwx 1 root root    0 Jan  1 00:03 of_node ->
To know more about Qualcomm PMIC BCL, see Patch series of Qualcomm PMIC BCL.

Next steps