Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions Documentation/devicetree/bindings/hwmon/qcom,bcl-hwmon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/hwmon/qcom,bcl-hwmon.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Qualcomm SPMI PMIC Battery Current Limiting (BCL) Hardware Monitor

maintainers:
- Manaf Meethalavalappu Pallikunhi <manaf.pallikunhi@oss.qualcomm.com>

description: |
SPMI PMIC Battery Current Limiting (BCL) hardware provides monitoring and
alarm functionality for battery overcurrent and battery or system under
voltage conditions. It monitors battery voltage and current, and
can trigger interrupts when configurable thresholds are exceeded.

properties:
compatible:
oneOf:
- description: v1 based BCL
items:
- enum:
- qcom,pm7250b-bcl
- qcom,pm8250b-bcl
- const: qcom,bcl-v1

- description: v2 based BCL
items:
- enum:
- qcom,pm8350b-bcl
- qcom,pm8350c-bcl
- const: qcom,bcl-v2

- description: v3 bmx based BCL
items:
- enum:
- qcom,pm8550b-bcl
- qcom,pm7550ba-bcl
- const: qcom,bcl-v3-bmx

- description: v3 core based BCL
items:
- enum:
- qcom,pm8550-bc0l
- qcom,pm7550-bcl
- const: qcom,bcl-v3-core

- description: v3 wb based BCL
items:
- enum:
- qcom,pmw5100-bcl
- const: qcom,bcl-v3-wb

- description: v4 bmx based BCL
items:
- enum:
- qcom,pmih010-bcl
- const: qcom,bcl-v4-bmx

- description: v4 bmx with different scale based BCL
items:
- enum:
- qcom,pmv010-bcl
- const: qcom,bcl-v4-pmv010

- description: v4 core based BCL
items:
- enum:
- qcom,pmh010-bcl
- const: qcom,bcl-v4-core

- description: v4 wb based BCL
items:
- enum:
- qcom,pmw6100-bcl
- const: qcom,bcl-v4-wb

reg:
maxItems: 1
description: BCL base address in the SPMI PMIC register map

interrupts:
minItems: 2
maxItems: 2
description:
BCL alarm interrupts for different threshold levels

interrupt-names:
items:
- const: bcl-max-min
- const: bcl-critical

overcurrent-thresholds-milliamp:
description:
Current thresholds in milliamperes for the two configurable current
alarm levels (max and critical). These values are used to override
default thresholds if a platform has different battery ocp specification.
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 2
maxItems: 2

required:
- compatible
- reg
- interrupts
- interrupt-names

unevaluatedProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>

pmic {
#address-cells = <1>;
#size-cells = <0>;

sensor@1d00 {
compatible = "qcom,pm7250b-bcl", "qcom,bcl-v1";
reg = <0x1d00>;
interrupts = <0x2 0x1d 0x0 IRQ_TYPE_EDGE_RISING>,
<0x2 0x1d 0x1 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "bcl-max-min",
"bcl-critical";
overcurrent-thresholds-milliamp = <5500 6000>;
};
};
4 changes: 4 additions & 0 deletions Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ patternProperties:
type: object
$ref: /schemas/rtc/qcom-pm8xxx-rtc.yaml#

"^sensor@[0-9a-f]+$":
type: object
$ref: /schemas/hwmon/qcom,bcl-hwmon.yaml#

"^temp-alarm@[0-9a-f]+$":
type: object
$ref: /schemas/thermal/qcom,spmi-temp-alarm.yaml#
Expand Down
9 changes: 9 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -21056,6 +21056,15 @@ S: Maintained
F: Documentation/devicetree/bindings/net/qcom,bam-dmux.yaml
F: drivers/net/wwan/qcom_bam_dmux.c

QUALCOMM BCL HARDWARE MONITOR DRIVER
M: Manaf Meethalavalappu Pallikunhi <manaf.pallikunhi@oss.qualcomm.com>
L: linux-hwmon@vger.kernel.org
L: linux-arm-msm@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/hwmon/qcom,bcl-hwmon.yaml
F: drivers/hwmon/qcom-bcl-hwmon.c
F: drivers/hwmon/qcom-bcl-hwmon.h

QUALCOMM BLUETOOTH DRIVER
L: linux-arm-msm@vger.kernel.org
S: Maintained
Expand Down
10 changes: 10 additions & 0 deletions arch/arm64/boot/dts/qcom/pm7250b.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@
interrupt-controller;
#interrupt-cells = <2>;
};

sensor@1d00 {
compatible = "qcom,pm7250b-bcl", "qcom,bcl-v1";
reg = <0x1d00>;
interrupts = <PM7250B_SID 0x1d 0x0 IRQ_TYPE_EDGE_RISING>,
<PM7250B_SID 0x1d 0x1 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "bcl-max-min",
"bcl-critical";
overcurrent-thresholds-milliamp = <5500 6000>;
};
};

pmic@PM7250B_SID1 {
Expand Down
9 changes: 9 additions & 0 deletions arch/arm64/boot/dts/qcom/pm8350c.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
#pwm-cells = <2>;
status = "disabled";
};

sensor@4700 {
compatible = "qcom,pm8350c-bcl", "qcom,bcl-v2";
reg = <0x4700>;
interrupts = <0x2 0x47 0x0 IRQ_TYPE_EDGE_RISING>,
<0x2 0x47 0x1 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "bcl-max-min",
"bcl-critical";
};
};
};

Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/qcom.config
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ CONFIG_STM_SOURCE_FTRACE=m
CONFIG_STM_SOURCE_HEARTBEAT=m
CONFIG_SENSORS_AMC6821=y
CONFIG_SENSORS_EMC2305=y
CONFIG_SENSORS_QCOM_BCL=y
CONFIG_TRACE_MMIO_ACCESS=y
CONFIG_UCLAMP_TASK_GROUP=y
CONFIG_UCLAMP_TASK=y
Expand Down
9 changes: 9 additions & 0 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,15 @@ config SENSORS_PWM_FAN
This driver can also be built as a module. If so, the module
will be called pwm-fan.

config SENSORS_QCOM_BCL
tristate "Qualcomm BCL hardware monitoring"
help
Say yes here to enable support for Qualcomm battery over current
and under voltage alarms monitor.

This driver can also be built as a module. If so, the module
will be called qcom-bcl-hwmon.

config SENSORS_QNAP_MCU_HWMON
tristate "QNAP MCU hardware monitoring"
depends on MFD_QNAP_MCU
Expand Down
1 change: 1 addition & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ obj-$(CONFIG_SENSORS_POWERZ) += powerz.o
obj-$(CONFIG_SENSORS_POWR1220) += powr1220.o
obj-$(CONFIG_SENSORS_PT5161L) += pt5161l.o
obj-$(CONFIG_SENSORS_PWM_FAN) += pwm-fan.o
obj-$(CONFIG_SENSORS_QCOM_BCL) += qcom-bcl-hwmon.o
obj-$(CONFIG_SENSORS_QNAP_MCU_HWMON) += qnap-mcu-hwmon.o
obj-$(CONFIG_SENSORS_RASPBERRYPI_HWMON) += raspberrypi-hwmon.o
obj-$(CONFIG_SENSORS_SA67MCU) += sa67mcu-hwmon.o
Expand Down
Loading