Loading Documentation/devicetree/bindings/arm/msm/bcl.txt +7 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,12 @@ Optional nodes: * 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. * thermal-handle = <&phandle_to_vdd_apps>: phandle to the "qcom,msm_thermal" vdd restriction property, "qcom,vdd-apps-rstr". This phandle is 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. Example: qcom,bcl { Loading @@ -87,5 +93,6 @@ Example: vph-channel = <0x07>; vph-high-threshold-uv = <3700000>; vph-low-threshold-uv = <3500000>; thermal-handle = <&msm_thermal_freq>; }; }; drivers/power/battery_current_limit.c +31 −4 Original line number Diff line number Diff line Loading @@ -888,8 +888,7 @@ static ssize_t freq_max_store(struct device *dev, ret = convert_to_int(buf, &val); if (ret) return ret; gbcl->btm_freq_max = (val >= BTM_8084_FREQ_MITIG_LIMIT) ? val : BTM_8084_FREQ_MITIG_LIMIT; gbcl->btm_freq_max = max_t(uint32_t, val, gbcl->btm_freq_limit); return count; } Loading Loading @@ -1139,6 +1138,34 @@ static int bcl_resume(struct device *dev) return 0; } static void get_vdd_rstr_freq(struct bcl_context *bcl, struct device_node *ibat_node) { int ret = 0; struct device_node *phandle = NULL; char *key = NULL; key = "thermal-handle"; phandle = of_parse_phandle(ibat_node, key, 0); if (!phandle) { pr_err("Thermal handle not present\n"); ret = -ENODEV; goto vdd_rstr_exit; } key = "qcom,levels"; ret = of_property_read_u32_index(phandle, key, 0, &bcl->btm_freq_limit); if (ret) { pr_err("Error reading property %s. ret:%d\n", key, ret); goto vdd_rstr_exit; } vdd_rstr_exit: if (ret) bcl->btm_freq_limit = BTM_8084_FREQ_MITIG_LIMIT; return; } static int probe_btm_properties(struct bcl_context *bcl) { int ret = 0, curr_ua = 0; Loading Loading @@ -1181,8 +1208,6 @@ static int probe_btm_properties(struct bcl_context *bcl) ret = of_property_read_u32(ibat_node, key, &bcl->btm_freq_max); if (ret < 0) goto btm_probe_exit; bcl->btm_freq_max = (bcl->btm_freq_max >= BTM_8084_FREQ_MITIG_LIMIT) ? bcl->btm_freq_max : BTM_8084_FREQ_MITIG_LIMIT; key = "ibat-channel"; ret = of_property_read_u32(ibat_node, key, &bcl->btm_ibat_chan); Loading Loading @@ -1223,6 +1248,8 @@ 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); bcl->btm_freq_max = max(bcl->btm_freq_max, bcl->btm_freq_limit); bcl->btm_mode = BCL_MONITOR_DISABLED; bcl->bcl_monitor_type = BCL_IBAT_MONITOR_TYPE; Loading Loading
Documentation/devicetree/bindings/arm/msm/bcl.txt +7 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,12 @@ Optional nodes: * 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. * thermal-handle = <&phandle_to_vdd_apps>: phandle to the "qcom,msm_thermal" vdd restriction property, "qcom,vdd-apps-rstr". This phandle is 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. Example: qcom,bcl { Loading @@ -87,5 +93,6 @@ Example: vph-channel = <0x07>; vph-high-threshold-uv = <3700000>; vph-low-threshold-uv = <3500000>; thermal-handle = <&msm_thermal_freq>; }; };
drivers/power/battery_current_limit.c +31 −4 Original line number Diff line number Diff line Loading @@ -888,8 +888,7 @@ static ssize_t freq_max_store(struct device *dev, ret = convert_to_int(buf, &val); if (ret) return ret; gbcl->btm_freq_max = (val >= BTM_8084_FREQ_MITIG_LIMIT) ? val : BTM_8084_FREQ_MITIG_LIMIT; gbcl->btm_freq_max = max_t(uint32_t, val, gbcl->btm_freq_limit); return count; } Loading Loading @@ -1139,6 +1138,34 @@ static int bcl_resume(struct device *dev) return 0; } static void get_vdd_rstr_freq(struct bcl_context *bcl, struct device_node *ibat_node) { int ret = 0; struct device_node *phandle = NULL; char *key = NULL; key = "thermal-handle"; phandle = of_parse_phandle(ibat_node, key, 0); if (!phandle) { pr_err("Thermal handle not present\n"); ret = -ENODEV; goto vdd_rstr_exit; } key = "qcom,levels"; ret = of_property_read_u32_index(phandle, key, 0, &bcl->btm_freq_limit); if (ret) { pr_err("Error reading property %s. ret:%d\n", key, ret); goto vdd_rstr_exit; } vdd_rstr_exit: if (ret) bcl->btm_freq_limit = BTM_8084_FREQ_MITIG_LIMIT; return; } static int probe_btm_properties(struct bcl_context *bcl) { int ret = 0, curr_ua = 0; Loading Loading @@ -1181,8 +1208,6 @@ static int probe_btm_properties(struct bcl_context *bcl) ret = of_property_read_u32(ibat_node, key, &bcl->btm_freq_max); if (ret < 0) goto btm_probe_exit; bcl->btm_freq_max = (bcl->btm_freq_max >= BTM_8084_FREQ_MITIG_LIMIT) ? bcl->btm_freq_max : BTM_8084_FREQ_MITIG_LIMIT; key = "ibat-channel"; ret = of_property_read_u32(ibat_node, key, &bcl->btm_ibat_chan); Loading Loading @@ -1223,6 +1248,8 @@ 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); bcl->btm_freq_max = max(bcl->btm_freq_max, bcl->btm_freq_limit); bcl->btm_mode = BCL_MONITOR_DISABLED; bcl->bcl_monitor_type = BCL_IBAT_MONITOR_TYPE; Loading