Loading drivers/power/supply/qcom/step-chg-jeita.c +8 −9 Original line number Original line Diff line number Diff line /* Copyright (c) 2017 The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License version 2 and Loading @@ -20,7 +20,6 @@ #include <linux/pmic-voter.h> #include <linux/pmic-voter.h> #include "step-chg-jeita.h" #include "step-chg-jeita.h" #define MAX_STEP_CHG_ENTRIES 8 #define STEP_CHG_VOTER "STEP_CHG_VOTER" #define STEP_CHG_VOTER "STEP_CHG_VOTER" #define JEITA_VOTER "JEITA_VOTER" #define JEITA_VOTER "JEITA_VOTER" Loading @@ -30,12 +29,6 @@ || ((left) <= (right) && (left) <= (value) \ || ((left) <= (right) && (left) <= (value) \ && (value) <= (right))) && (value) <= (right))) struct range_data { u32 low_threshold; u32 high_threshold; u32 value; }; struct step_chg_cfg { struct step_chg_cfg { u32 psy_prop; u32 psy_prop; char *prop_name; char *prop_name; Loading Loading @@ -118,12 +111,17 @@ static bool is_bms_available(struct step_chg_info *chip) return true; return true; } } static int read_range_data_from_node(struct device_node *node, int read_range_data_from_node(struct device_node *node, const char *prop_str, struct range_data *ranges, const char *prop_str, struct range_data *ranges, u32 max_threshold, u32 max_value) u32 max_threshold, u32 max_value) { { int rc = 0, i, length, per_tuple_length, tuples; int rc = 0, i, length, per_tuple_length, tuples; if (!node || !prop_str || !ranges) { pr_err("Invalid parameters passed\n"); return -EINVAL; } rc = of_property_count_elems_of_size(node, prop_str, sizeof(u32)); rc = of_property_count_elems_of_size(node, prop_str, sizeof(u32)); if (rc < 0) { if (rc < 0) { pr_err("Count %s failed, rc=%d\n", prop_str, rc); pr_err("Count %s failed, rc=%d\n", prop_str, rc); Loading Loading @@ -184,6 +182,7 @@ static int read_range_data_from_node(struct device_node *node, memset(ranges, 0, tuples * sizeof(struct range_data)); memset(ranges, 0, tuples * sizeof(struct range_data)); return rc; return rc; } } EXPORT_SYMBOL(read_range_data_from_node); static int get_step_chg_jeita_setting_from_profile(struct step_chg_info *chip) static int get_step_chg_jeita_setting_from_profile(struct step_chg_info *chip) { { Loading drivers/power/supply/qcom/step-chg-jeita.h +13 −1 Original line number Original line Diff line number Diff line /* Copyright (c) 2017 The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License version 2 and Loading @@ -12,7 +12,19 @@ #ifndef __STEP_CHG_H__ #ifndef __STEP_CHG_H__ #define __STEP_CHG_H__ #define __STEP_CHG_H__ #define MAX_STEP_CHG_ENTRIES 8 struct range_data { u32 low_threshold; u32 high_threshold; u32 value; }; int qcom_step_chg_init(struct device *dev, int qcom_step_chg_init(struct device *dev, bool step_chg_enable, bool sw_jeita_enable); bool step_chg_enable, bool sw_jeita_enable); void qcom_step_chg_deinit(void); void qcom_step_chg_deinit(void); int read_range_data_from_node(struct device_node *node, const char *prop_str, struct range_data *ranges, u32 max_threshold, u32 max_value); #endif /* __STEP_CHG_H__ */ #endif /* __STEP_CHG_H__ */ Loading
drivers/power/supply/qcom/step-chg-jeita.c +8 −9 Original line number Original line Diff line number Diff line /* Copyright (c) 2017 The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License version 2 and Loading @@ -20,7 +20,6 @@ #include <linux/pmic-voter.h> #include <linux/pmic-voter.h> #include "step-chg-jeita.h" #include "step-chg-jeita.h" #define MAX_STEP_CHG_ENTRIES 8 #define STEP_CHG_VOTER "STEP_CHG_VOTER" #define STEP_CHG_VOTER "STEP_CHG_VOTER" #define JEITA_VOTER "JEITA_VOTER" #define JEITA_VOTER "JEITA_VOTER" Loading @@ -30,12 +29,6 @@ || ((left) <= (right) && (left) <= (value) \ || ((left) <= (right) && (left) <= (value) \ && (value) <= (right))) && (value) <= (right))) struct range_data { u32 low_threshold; u32 high_threshold; u32 value; }; struct step_chg_cfg { struct step_chg_cfg { u32 psy_prop; u32 psy_prop; char *prop_name; char *prop_name; Loading Loading @@ -118,12 +111,17 @@ static bool is_bms_available(struct step_chg_info *chip) return true; return true; } } static int read_range_data_from_node(struct device_node *node, int read_range_data_from_node(struct device_node *node, const char *prop_str, struct range_data *ranges, const char *prop_str, struct range_data *ranges, u32 max_threshold, u32 max_value) u32 max_threshold, u32 max_value) { { int rc = 0, i, length, per_tuple_length, tuples; int rc = 0, i, length, per_tuple_length, tuples; if (!node || !prop_str || !ranges) { pr_err("Invalid parameters passed\n"); return -EINVAL; } rc = of_property_count_elems_of_size(node, prop_str, sizeof(u32)); rc = of_property_count_elems_of_size(node, prop_str, sizeof(u32)); if (rc < 0) { if (rc < 0) { pr_err("Count %s failed, rc=%d\n", prop_str, rc); pr_err("Count %s failed, rc=%d\n", prop_str, rc); Loading Loading @@ -184,6 +182,7 @@ static int read_range_data_from_node(struct device_node *node, memset(ranges, 0, tuples * sizeof(struct range_data)); memset(ranges, 0, tuples * sizeof(struct range_data)); return rc; return rc; } } EXPORT_SYMBOL(read_range_data_from_node); static int get_step_chg_jeita_setting_from_profile(struct step_chg_info *chip) static int get_step_chg_jeita_setting_from_profile(struct step_chg_info *chip) { { Loading
drivers/power/supply/qcom/step-chg-jeita.h +13 −1 Original line number Original line Diff line number Diff line /* Copyright (c) 2017 The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License version 2 and Loading @@ -12,7 +12,19 @@ #ifndef __STEP_CHG_H__ #ifndef __STEP_CHG_H__ #define __STEP_CHG_H__ #define __STEP_CHG_H__ #define MAX_STEP_CHG_ENTRIES 8 struct range_data { u32 low_threshold; u32 high_threshold; u32 value; }; int qcom_step_chg_init(struct device *dev, int qcom_step_chg_init(struct device *dev, bool step_chg_enable, bool sw_jeita_enable); bool step_chg_enable, bool sw_jeita_enable); void qcom_step_chg_deinit(void); void qcom_step_chg_deinit(void); int read_range_data_from_node(struct device_node *node, const char *prop_str, struct range_data *ranges, u32 max_threshold, u32 max_value); #endif /* __STEP_CHG_H__ */ #endif /* __STEP_CHG_H__ */