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

Commit f2b2e8d4 authored by Ram Chandrasekar's avatar Ram Chandrasekar
Browse files

power: battery_current_limit: Support Vph battery voltage monitoring



Add support to monitor the Vph battery voltage.

When enabled, BCL driver sets thresholds for the Vph battery
voltage monitoring. When the Vph voltage goes below a certain
threshold, it enables the Ibat current monitoring. When the
Vph voltage goes above a certain high threshold, BCL driver
disables the Ibat monitoring and any CPU frequency mitigation.

BCL driver supports two new sysfs nodes vph_high_thresh_uv and
vph_low_thresh_uv to configure the Vph high and low thresholds
respectively. These values can be configured by disabling the
BCL driver and once done with the configuring the BCL driver
should be re-enabled to set the new configuration.

BCL driver exposes two API's, which can be used by other
battery monitoring driver to notify the battery voltage
and current threshold status. Based on these status
notifications, BCL driver will apply or remove the
CPU mitigation.

CRs-Fixed: 629894
Change-Id: Ia45079e3a49387802b3bc1690b40919670824477
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent eb2c33c0
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ This Battery Current Limit(BCL) device, provides an interface to detect and noti
interested applications when the SOC is drawing current in excess of the limits
specified.
The BCL driver has another operation mode, where it monitors the battery
current sensor via ADC TM hardware called BTM. The newer devices support
current and voltage via ADC TM hardware called BTM. The newer devices support
a BTM hardware configuration, which can measure the battery current and voltage.
This ADC hardware is capable of sampling the sensor every 1 msec and interrupts
the BCL driver, which in turn mitigates the CPU frequency based on the
@@ -52,7 +52,7 @@ Optional nodes:
		should mitigate the CPUS's with. This frequency shouldn't be
		less than the minimum frequency request that the kernel thermal
		monitor driver places during vdd restriction.
	* ibat-channel: The ADC hardware's channel number.
	* ibat-channel: The ADC hardware's Ibat channel number.
	* uv-to-ua-numerator: The conversion parameter required for converting
		the voltage measure from ADC hardware to current value.
	* uv-to-ua-denominator: The conversion parameter required for
@@ -62,6 +62,14 @@ Optional nodes:
		ua = (uv * uv-to-ua-numerator) / uv-to-ua-denominator
	* adc-interval-usec: The polling interval, in microseconds, for the ADC
		hardware.
	* vph-channel: The ADC hardware's Vph channel number.
	* vph-high-threshold-uv: The battery voltage threshold above which the
		BCL driver clears the previously applied mitigation, disables
		the battery current monitoring, and starts monitoring for low
		battery voltage.
	* vph-low-threshold-uv: The battery voltage threshold below which the
		BCL driver starts monitoring the battery current thresholds and
		mitigates the CPU on the event of high load.

Example:
	qcom,bcl {
@@ -76,5 +84,8 @@ Example:
			adc-interval-usec = <3900>;
			uv-to-ua-numerator = <2>;
			uv-to-ua-denominator = <1>;
			vph-channel = <0x07>;
			vph-high-threshold-uv = <3700000>;
			vph-low-threshold-uv = <3500000>;
		};
	};
+413 −153

File changed.

Preview size limit exceeded, changes collapsed.