Loading drivers/power/supply/qcom/battery_current_limit.c +18 −12 Original line number Diff line number Diff line Loading @@ -288,23 +288,13 @@ static void soc_mitigate(struct work_struct *work) update_cpu_freq(); } static int power_supply_callback(struct notifier_block *nb, unsigned long event, void *data) static int get_and_evaluate_battery_soc(void) { struct power_supply *psy = data; static struct power_supply *batt_psy; union power_supply_propval ret = {0,}; int battery_percentage; enum bcl_threshold_state prev_soc_state; if (gbcl->bcl_mode != BCL_DEVICE_ENABLED) { pr_debug("BCL is not enabled\n"); return NOTIFY_OK; } if (strcmp(psy->desc->name, "battery")) return NOTIFY_OK; if (!batt_psy) batt_psy = power_supply_get_by_name("battery"); if (batt_psy) { Loading @@ -328,6 +318,22 @@ static int power_supply_callback(struct notifier_block *nb, return NOTIFY_OK; } static int power_supply_callback(struct notifier_block *nb, unsigned long event, void *data) { struct power_supply *psy = data; if (gbcl->bcl_mode != BCL_DEVICE_ENABLED) { pr_debug("BCL is not enabled\n"); return NOTIFY_OK; } if (strcmp(psy->desc->name, "battery")) return NOTIFY_OK; return get_and_evaluate_battery_soc(); } static int bcl_get_battery_voltage(int *vbatt_mv) { static struct power_supply *psy; Loading Loading @@ -646,7 +652,7 @@ static void bcl_periph_mode_set(enum bcl_device_mode mode) * power state changes. Make sure we read the current SoC * and mitigate. */ power_supply_callback(&gbcl->psy_nb, 1, gbcl); get_and_evaluate_battery_soc(); ret = power_supply_reg_notifier(&gbcl->psy_nb); if (ret < 0) { pr_err("Unable to register soc notifier rc = %d\n", Loading drivers/power/supply/qcom/bcl_peripheral.c +4 −2 Original line number Diff line number Diff line /* * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -482,8 +482,10 @@ static int bcl_access_monitor_enable(bool enable) if (enable == bcl_perph->enabled) goto access_exit; if ((bcl_perph_version == BCL_PMI8998) && !hw_enabled && enable) if ((bcl_perph_version == BCL_PMI8998) && !hw_enabled && enable) { bcl_lmh_dcvs_enable(); hw_enabled = true; } for (; i < BCL_PARAM_MAX; i++) { perph_data = &bcl_perph->param[i]; Loading Loading
drivers/power/supply/qcom/battery_current_limit.c +18 −12 Original line number Diff line number Diff line Loading @@ -288,23 +288,13 @@ static void soc_mitigate(struct work_struct *work) update_cpu_freq(); } static int power_supply_callback(struct notifier_block *nb, unsigned long event, void *data) static int get_and_evaluate_battery_soc(void) { struct power_supply *psy = data; static struct power_supply *batt_psy; union power_supply_propval ret = {0,}; int battery_percentage; enum bcl_threshold_state prev_soc_state; if (gbcl->bcl_mode != BCL_DEVICE_ENABLED) { pr_debug("BCL is not enabled\n"); return NOTIFY_OK; } if (strcmp(psy->desc->name, "battery")) return NOTIFY_OK; if (!batt_psy) batt_psy = power_supply_get_by_name("battery"); if (batt_psy) { Loading @@ -328,6 +318,22 @@ static int power_supply_callback(struct notifier_block *nb, return NOTIFY_OK; } static int power_supply_callback(struct notifier_block *nb, unsigned long event, void *data) { struct power_supply *psy = data; if (gbcl->bcl_mode != BCL_DEVICE_ENABLED) { pr_debug("BCL is not enabled\n"); return NOTIFY_OK; } if (strcmp(psy->desc->name, "battery")) return NOTIFY_OK; return get_and_evaluate_battery_soc(); } static int bcl_get_battery_voltage(int *vbatt_mv) { static struct power_supply *psy; Loading Loading @@ -646,7 +652,7 @@ static void bcl_periph_mode_set(enum bcl_device_mode mode) * power state changes. Make sure we read the current SoC * and mitigate. */ power_supply_callback(&gbcl->psy_nb, 1, gbcl); get_and_evaluate_battery_soc(); ret = power_supply_reg_notifier(&gbcl->psy_nb); if (ret < 0) { pr_err("Unable to register soc notifier rc = %d\n", Loading
drivers/power/supply/qcom/bcl_peripheral.c +4 −2 Original line number Diff line number Diff line /* * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -482,8 +482,10 @@ static int bcl_access_monitor_enable(bool enable) if (enable == bcl_perph->enabled) goto access_exit; if ((bcl_perph_version == BCL_PMI8998) && !hw_enabled && enable) if ((bcl_perph_version == BCL_PMI8998) && !hw_enabled && enable) { bcl_lmh_dcvs_enable(); hw_enabled = true; } for (; i < BCL_PARAM_MAX; i++) { perph_data = &bcl_perph->param[i]; Loading