ti,temp-range = <10 15 25 45 60>;
ti,charge-thermal-voltage-limit = <4352 4352 4352 4352 4200>;
ti,charge-current-limit = <1040 1040 2600 5200 2600>;
- ti,soc-range = <94 100>;
- ti,input-voltage-soc-limit = <4680 4760>;
+ ti,soc-range = <89 94 100>;
+ ti,input-voltage-soc-limit = <4200 4680 4760>;
ti,charge-term-current-limit-milliamp = <1>;
};
};
ti,temp-range = <10 15 25 45 60>;
ti,charge-thermal-voltage-limit = <4352 4352 4352 4352 4200>;
ti,charge-current-limit = <1040 1040 2600 5200 2600>;
- ti,soc-range = <94 100>;
- ti,input-voltage-soc-limit = <4680 4760>;
+ ti,soc-range = <89 94 100>;
+ ti,input-voltage-soc-limit = <4200 4680 4760>;
ti,charge-term-current-limit-milliamp = <1>;
};
};
struct bq2419x_reg_info chg_voltage_control;
struct bq2419x_vbus_platform_data *vbus_pdata;
struct bq2419x_charger_platform_data *charger_pdata;
+ int last_input_voltage;
};
static int current_to_reg(const unsigned int *tbl,
bq2419x->input_src.mask, bq2419x->input_src.val);
if (ret < 0)
dev_err(bq2419x->dev, "INPUT_SRC_REG write failed %d\n", ret);
+ bq2419x->last_input_voltage = (bq2419x->input_src.val >> 3) & 0xF;
ret = regmap_update_bits(bq2419x->regmap, BQ2419X_THERM_REG,
bq2419x->ir_comp_therm.mask, bq2419x->ir_comp_therm.val);
dev_err(bq2419x->dev, "INPUT_SRC_REG update failed %d\n", ret);
return ret;
}
+ bq2419x->last_input_voltage = (bq2419x->input_src.val >> 3) & 0xF;
/* Configure input current limit in steps */
val = current_to_reg(iinlim, ARRAY_SIZE(iinlim), in_current_limit);
if (!input_voltage_limit)
return 0;
+
/*Configure input voltage limit */
vreg = bq2419x_val_to_reg(input_voltage_limit,
BQ2419X_INPUT_VINDPM_OFFSET, 80, 4, 0);
+ if (bq2419x->last_input_voltage == vreg)
+ return 0;
+
+ dev_info(bq2419x->dev, "Changing VINDPM to soc:voltage:vreg %d:%d:%d\n",
+ battery_soc, input_voltage_limit, vreg);
+
ret = regmap_update_bits(bq2419x->regmap, BQ2419X_INPUT_SRC_REG,
BQ2419X_INPUT_VINDPM_MASK,
(vreg << 3));
dev_err(bq2419x->dev, "INPUT_VOLTAGE update failed %d\n", ret);
return ret;
}
+ bq2419x->last_input_voltage = vreg;
return 0;
}