summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>2016-11-18 15:33:31 +0530
committerManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>2016-12-09 19:48:33 +0530
commitc2ec16b9e137ae66834aba47c5a1ce0952718ebb (patch)
treebf173105d2113808f355d3ab67166d2c4fe508f6
parent54fb4f8396b497698866ad18e127650282b34d7f (diff)
power: bcl: Add frequency mitigation as an optional property for BCL
For targets with LMH DCVSh hardware and OSM, BCL software frequency mitigation is not required. Since hardware is doing the frequency mitigation, there is no need for the HLOS BCL frequency mitigation. So make the properties "qcom,mitigation-freq-khz" and "qcom,thermal-handle" as optional properties. Change-Id: I0062f3b39f00ff2f0e74affcffbcf1afd89d3b2f Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
-rw-r--r--Documentation/devicetree/bindings/arm/msm/bcl.txt27
-rw-r--r--drivers/power/qcom-charger/battery_current_limit.c37
2 files changed, 42 insertions, 22 deletions
diff --git a/Documentation/devicetree/bindings/arm/msm/bcl.txt b/Documentation/devicetree/bindings/arm/msm/bcl.txt
index 42acaa49c2a5..710c70a57840 100644
--- a/Documentation/devicetree/bindings/arm/msm/bcl.txt
+++ b/Documentation/devicetree/bindings/arm/msm/bcl.txt
@@ -38,17 +38,19 @@ Optional parameters:
- qcom,bcl-framework-interface: If this property is defined, then the BCL uses
the BCL framework for monitoring battery voltage and current.
When this property is defined, the 'qcom,high-threshold-uamp',
- 'qcom,low-threshold-uamp', 'qcom,mitigation-freq-khz',
- 'qcom,vph-high-threshold-uv', 'qcom,vph-low-threshold-uv' and
- 'qcom,thermal-handle' properties should be defined in the
- 'qcom,ibat-monitor' node.
+ 'qcom,low-threshold-uamp', 'qcom,vph-high-threshold-uv',
+ 'qcom,vph-low-threshold-uv' and 'qcom,thermal-handle' properties
+ should be defined in the 'qcom,ibat-monitor' node.
- qcom,bcl-hotplug-list = <hotplug-phandle-list>: List of phandles to the cores
that are to be hotplugged, when battery current limit condition
is reached.
- qcom,bcl-soc-hotplug-list: List of phandles to the cores that are to be hotplugged,
when battery SOC limit condition is reached.
-- qcom,bcl-freq-control-list: List of phandles to the cores that are to be frequency
- mitigated when BCL condition is reached.
+- qcom,bcl-freq-control-list: This optional property takes list of phandles to the
+ cores that are to be frequency mitigated when BCL condition is
+ reached. When this property is defined, 'qcom,mitigation-freq-khz'
+ and 'qcom,thermal-handle' should be defined in the
+ 'qcom,ibat-monitor' node.
- qcom,bcl-no-bms: This is an optional node for BCL IAVAIL monitor mode.
If this property is defined, BCL IAVAIL monitor gets rbat value
from power supply battery module instead of bms module.
@@ -65,10 +67,12 @@ Optional nodes:
which the BCL driver should cap the maximum frequency.
* qcom,low-threshold-uamp: The battery current, in microampere, below
which the BCL driver should clear the CPU frequency mitigation.
- * qcom,mitigation-freq-khz: The maximum frequency value the BCL driver
- 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.
+ * qcom,mitigation-freq-khz: This optional property defines the maximum
+ frequency value the BCL driver should mitigate the CPUS's with.
+ This property is valid only if 'qcom,bcl-freq-control-list' is
+ defined in bcl parent node. This frequency shouldn't be less than
+ the minimum frequency request that the kernel thermal monitor
+ driver places during vdd restriction.
* qcom,ibat-channel: The ADC hardware's Ibat channel number.
* qcom,uv-to-ua-numerator: The conversion parameter required for converting
the voltage measure from ADC hardware to current value.
@@ -92,7 +96,8 @@ Optional nodes:
used by BCL driver to get the minimum frequency request that the
thermal driver places during vdd restriction. This frequency
value will be the lowest max frequency value the BCL driver can
- request.
+ request. This property is valid only if 'qcom,bcl-freq-control-list'
+ is defined in bcl parent node.
* qcom,soc-low-threshold: The battery SOC percentage threshold below which
mitigation needs to be applied.
diff --git a/drivers/power/qcom-charger/battery_current_limit.c b/drivers/power/qcom-charger/battery_current_limit.c
index 951d0544efa0..d2c25bfbf66c 100644
--- a/drivers/power/qcom-charger/battery_current_limit.c
+++ b/drivers/power/qcom-charger/battery_current_limit.c
@@ -1495,10 +1495,7 @@ static int probe_bcl_periph_prop(struct bcl_context *bcl)
bcl->ibat_high_thresh.trip_value);
if (ret)
goto ibat_probe_exit;
- BCL_FETCH_DT_U32(ibat_node, key, "qcom,mitigation-freq-khz", ret,
- bcl->bcl_p_freq_max);
- if (ret)
- goto ibat_probe_exit;
+
BCL_FETCH_DT_U32(ibat_node, key, "qcom,vph-high-threshold-uv", ret,
bcl->vbat_high_thresh.trip_value);
if (ret)
@@ -1520,7 +1517,18 @@ static int probe_bcl_periph_prop(struct bcl_context *bcl)
= bcl->ibat_low_thresh.trip_notify = bcl_periph_ibat_notify;
bcl->ibat_high_thresh.trip_data
= bcl->ibat_low_thresh.trip_data = (void *) bcl;
- get_vdd_rstr_freq(bcl, ibat_node);
+
+ if (bcl_frequency_mask) {
+ BCL_FETCH_DT_U32(ibat_node, key, "qcom,mitigation-freq-khz",
+ ret, bcl->bcl_p_freq_max);
+ if (ret)
+ goto ibat_probe_exit;
+ get_vdd_rstr_freq(bcl, ibat_node);
+ } else {
+ bcl->bcl_p_freq_max = UINT_MAX;
+ bcl->thermal_freq_limit = 0;
+ }
+
bcl->bcl_p_freq_max = max(bcl->bcl_p_freq_max, bcl->thermal_freq_limit);
bcl->btm_mode = BCL_MONITOR_DISABLED;
@@ -1574,11 +1582,6 @@ static int probe_btm_properties(struct bcl_context *bcl)
goto btm_probe_exit;
bcl->btm_high_threshold_uv = current_to_voltage(bcl, curr_ua);
- key = "qcom,mitigation-freq-khz";
- ret = of_property_read_u32(ibat_node, key, &bcl->btm_freq_max);
- if (ret < 0)
- goto btm_probe_exit;
-
key = "qcom,ibat-channel";
ret = of_property_read_u32(ibat_node, key, &bcl->btm_ibat_chan);
if (ret < 0)
@@ -1618,7 +1621,17 @@ static int probe_btm_properties(struct bcl_context *bcl)
ret = PTR_ERR(bcl->btm_vadc_dev);
goto btm_probe_exit;
}
- get_vdd_rstr_freq(bcl, ibat_node);
+
+ if (bcl_frequency_mask) {
+ key = "qcom,mitigation-freq-khz";
+ ret = of_property_read_u32(ibat_node, key, &bcl->btm_freq_max);
+ if (ret < 0)
+ goto btm_probe_exit;
+ get_vdd_rstr_freq(bcl, ibat_node);
+ } else {
+ bcl->btm_freq_max = UINT_MAX;
+ bcl->thermal_freq_limit = 0;
+ }
bcl->btm_freq_max = max(bcl->btm_freq_max, bcl->thermal_freq_limit);
bcl->btm_mode = BCL_MONITOR_DISABLED;
@@ -1738,6 +1751,8 @@ static int bcl_probe(struct platform_device *pdev)
}
}
for_each_possible_cpu(cpu) {
+ if (!(bcl_frequency_mask & BIT(cpu)))
+ continue;
snprintf(cpu_str, MAX_CPU_NAME, "cpu%d", cpu);
bcl->cpufreq_handle[cpu] = devmgr_register_mitigation_client(
&pdev->dev, cpu_str, NULL);