Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 090a4457 authored by Ram Chandrasekar's avatar Ram Chandrasekar
Browse files

power: bcl_peripheral: Add a new BCL peripheral driver



Add a new BCL peripheral driver, which implements interfaces
to configure and interact with PMIC BCL peripheral.

This BCL peripheral driver registers with the BCL
framework to be used by the top level BCL mitigation
modules.

Change-Id: I2d9c0a465d887b5fecdb9d266bbef61c6ac9f014
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent 0171e31d
Loading
Loading
Loading
Loading
+63 −0
Original line number Diff line number Diff line
@@ -96,3 +96,66 @@ Example:
			thermal-handle = <&msm_thermal_freq>;
		};
	};

===============================================================================
BCL PMIC Peripheral driver:
===============================================================================
In newer targets from MSM8994, the PMIC has BCL monitoring capabilities
in the hardware. The PMIC exposes this BCL monitoring peripheral as a PMIC
peripheral. The BCL peripheral driver interacts with the PMIC peripheral using
the SPMI driver interfaces. The details and the configuration for the BCL
peripheral can be inputted using the device tree.

The units of the Vbat and Ibat values returned and read depends on the scaling
factor that is given as input for BCL peripheral driver through device tree. The
scaling factors should be configured to handle Vbat in micro-volt and Ibat in
micro-amps.

Required Parameters:
- compatible: must be qcom,msm-bcl
- reg: <a b> where 'a' is the starting register address of the PMIC
	peripheral and 'b' is the size of the peripheral address space.
-interrupts: <a b c> Where 'a' is the SLAVE ID of the PMIC, 'b' is
		the peripheral ID and 'c' is the interrupt number in PMIC.
- interrupt-names: user defined names for the interrupts. These
		interrupt names will be used by the drivers to identify the
		interrupts, instead of specifying the ID's.
- qcom,vbat-scaling-factor: The scaling factor to be used for converting
		the raw vbat ADC value to milli-volt.
- qcom,vbat-gain-numerator: The numerator of the vbat gain correction factor.
- qcom,vbat-gain-denominator: The denominator of the vbat gain correction
		factor.
- qcom,vbat-polling-delay-ms: Software polling interval for monitoring vbat
		high threshold.
- qcom,ibat-scaling-factor: The scaling factor to be used for converting
		the raw ibat ADC value to micro-amps.
- qcom, ibat-gain-numerator: The numerator of the ibat gain correction factor.
- qcom, ibat-gain-denominator: The denominator of the ibat gain correction
		factor.
- qcom, ibat-offset-numerator: The numerator of the ibat offset correction
		factor.
- qcom, ibat-offset-denominator: The denominator of the ibat offset
		correction factor.
- qcom,ibat-polling-delay-ms: Software polling interval for monitoring ibat
		low threshold.

                bcl@4200 {
                        compatible = "qcom,msm-bcl";
                        reg = <0x4200 0xFF>;
                        interrupts = <0x2 0x42 0x0>,
                                        <0x2 0x42 0x1>;
                        interrupt-names = "bcl-high-ibat-int",
                                        "bcl-low-vbat-int";
                        qcom,vbat-scaling-factor = <39>;
                        qcom,vbat-gain-numerator = <1>;
                        qcom,vbat-gain-denominator = <32>;
                        qcom,vbat-polling-delay-ms = <50>;
                        qcom,ibat-scaling-factor = <39>;
                        qcom,ibat-gain-numerator = <1>;
                        qcom,ibat-gain-denominator = <32>;
                        qcom,ibat-offset-numerator = <12>;
                        qcom,ibat-offset-denominator = <10>;
                        qcom,ibat-polling-delay-ms = <50>;
                };

+9 −0
Original line number Diff line number Diff line
@@ -534,6 +534,15 @@ config MSM_BCL_CTL
	  basic functionalities. This framework abstracts the underlying
	  hardware for the top level modules.

config MSM_BCL_PERIPHERAL_CTL
	bool "BCL driver to control the PMIC BCL peripheral"
	depends on SPMI
	depends on MSM_BCL_CTL
	help
	  Say Y here to enable this BCL PMIC peripheral driver. This driver
	  provides routines to configure and monitor the BCL
	  PMIC peripheral.

source "drivers/power/reset/Kconfig"

endif # POWER_SUPPLY
+1 −0
Original line number Diff line number Diff line
@@ -68,5 +68,6 @@ obj-$(CONFIG_CHARGER_SMB347) += smb347-charger.o
obj-$(CONFIG_CHARGER_TPS65090)	+= tps65090-charger.o
obj-$(CONFIG_BATTERY_BCL)	+= battery_current_limit.o
obj-$(CONFIG_MSM_BCL_CTL)	+= msm_bcl.o
obj-$(CONFIG_MSM_BCL_PERIPHERAL_CTL) += bcl_peripheral.o
obj-$(CONFIG_POWER_RESET)	+= reset/
obj-y				+= qcom/