summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-09-30 18:23:53 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-30 18:23:53 -0700
commit778103250b32b248a7ea7823fbcc2557fdac5ea3 (patch)
tree5e1a15008ce875e5606aca4cb63ecdda28d14e89
parent511ce51b857e8fa6225ffa369f9752e589d88e03 (diff)
parentff753ada17b532d46426a81ecaf78064b96ec35d (diff)
Merge "power: qpnp-fg-gen3: fix SRAM encodings"
-rw-r--r--Documentation/devicetree/bindings/power/qcom-charger/qpnp-fg-gen3.txt4
-rw-r--r--drivers/power/qcom-charger/qpnp-fg-gen3.c14
2 files changed, 10 insertions, 8 deletions
diff --git a/Documentation/devicetree/bindings/power/qcom-charger/qpnp-fg-gen3.txt b/Documentation/devicetree/bindings/power/qcom-charger/qpnp-fg-gen3.txt
index bd236df6c056..199b5c0857f8 100644
--- a/Documentation/devicetree/bindings/power/qcom-charger/qpnp-fg-gen3.txt
+++ b/Documentation/devicetree/bindings/power/qcom-charger/qpnp-fg-gen3.txt
@@ -78,7 +78,9 @@ First Level Node - FG Gen3 device
Definition: Battery current (in mA) at which the fuel gauge will try to
scale towards 100%. When the charge current goes above this
the SOC should be at 100%. If this property is not
- specified, then the default value used will be 125mA.
+ specified, then the default value used will be -125mA.
+ This value has to be specified in negative values for
+ the charging current.
- qcom,fg-delta-soc-thr
Usage: optional
diff --git a/drivers/power/qcom-charger/qpnp-fg-gen3.c b/drivers/power/qcom-charger/qpnp-fg-gen3.c
index 5d59d0940991..a163061156ba 100644
--- a/drivers/power/qcom-charger/qpnp-fg-gen3.c
+++ b/drivers/power/qcom-charger/qpnp-fg-gen3.c
@@ -84,7 +84,7 @@
#define CHG_TERM_CURR_v2_WORD 15
#define CHG_TERM_CURR_v2_OFFSET 1
#define EMPTY_VOLT_v2_WORD 15
-#define EMPTY_VOLT_v2_OFFSET 2
+#define EMPTY_VOLT_v2_OFFSET 3
#define VBATT_LOW_v2_WORD 16
#define VBATT_LOW_v2_OFFSET 0
@@ -164,10 +164,10 @@ static struct fg_sram_param pmicobalt_v2_sram_params[] = {
/* Entries below here are configurable during initialization */
PARAM(CUTOFF_VOLT, CUTOFF_VOLT_WORD, CUTOFF_VOLT_OFFSET, 2, 1000000,
244141, 0, fg_encode_voltage, NULL),
- PARAM(EMPTY_VOLT, EMPTY_VOLT_v2_WORD, EMPTY_VOLT_v2_OFFSET, 1, 100000,
- 390625, -2000, fg_encode_voltage, NULL),
- PARAM(VBATT_LOW, VBATT_LOW_v2_WORD, VBATT_LOW_v2_OFFSET, 1, 100000,
- 390625, -2000, fg_encode_voltage, NULL),
+ PARAM(EMPTY_VOLT, EMPTY_VOLT_v2_WORD, EMPTY_VOLT_v2_OFFSET, 1, 1000,
+ 15625, -2000, fg_encode_voltage, NULL),
+ PARAM(VBATT_LOW, VBATT_LOW_v2_WORD, VBATT_LOW_v2_OFFSET, 1, 1000,
+ 15625, -2000, fg_encode_voltage, NULL),
PARAM(SYS_TERM_CURR, SYS_TERM_CURR_WORD, SYS_TERM_CURR_OFFSET, 3,
1000000, 122070, 0, fg_encode_current, NULL),
PARAM(CHG_TERM_CURR, CHG_TERM_CURR_v2_WORD, CHG_TERM_CURR_v2_OFFSET, 1,
@@ -477,7 +477,7 @@ static void fg_encode_current(struct fg_sram_param *sp,
int64_t temp;
s64 current_ma;
- current_ma = -val;
+ current_ma = val;
temp = (int64_t)div_s64(current_ma * sp[id].numrtr, sp[id].denmtr);
pr_debug("temp: %llx id: %d, val: %d, buf: [ ", temp, id, val);
for (i = 0; i < sp[id].len; i++) {
@@ -1343,7 +1343,7 @@ static int fg_register_interrupts(struct fg_chip *chip)
#define DEFAULT_CUTOFF_VOLT_MV 3200
#define DEFAULT_EMPTY_VOLT_MV 3100
#define DEFAULT_CHG_TERM_CURR_MA 100
-#define DEFAULT_SYS_TERM_CURR_MA 125
+#define DEFAULT_SYS_TERM_CURR_MA -125
#define DEFAULT_DELTA_SOC_THR 1
#define DEFAULT_RECHARGE_SOC_THR 95
#define DEFAULT_BATT_TEMP_COLD 0