mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 13:22:57 +00:00
power: supply: bq24190: Considers FORCE_20PCT when getting IPRECHG
Adds a check of the FORCE_20PCT bit when getting the precharge current value. According to the bit description for the FORCE_20PCT bit, when FORCE_20PCT is true, the precharge current target is 50% of what is configured in the IPRECHG bit field. Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com> Reviewed-by: David Rhodes <drhodes@opensource.cirrus.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
2ce8284c31
commit
da28e18d6a
1 changed files with 15 additions and 2 deletions
|
@ -965,7 +965,7 @@ static int bq24190_charger_get_precharge(struct bq24190_dev_info *bdi,
|
|||
union power_supply_propval *val)
|
||||
{
|
||||
u8 v;
|
||||
int ret;
|
||||
int curr, ret;
|
||||
|
||||
ret = bq24190_read_mask(bdi, BQ24190_REG_PCTCC,
|
||||
BQ24190_REG_PCTCC_IPRECHG_MASK,
|
||||
|
@ -973,7 +973,20 @@ static int bq24190_charger_get_precharge(struct bq24190_dev_info *bdi,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
val->intval = ++v * 128 * 1000;
|
||||
curr = ++v * 128 * 1000;
|
||||
|
||||
ret = bq24190_read_mask(bdi, BQ24190_REG_CCC,
|
||||
BQ24190_REG_CCC_FORCE_20PCT_MASK,
|
||||
BQ24190_REG_CCC_FORCE_20PCT_SHIFT, &v);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* If FORCE_20PCT is enabled, then current is 50% of IPRECHG value */
|
||||
if (v)
|
||||
curr /= 2;
|
||||
|
||||
val->intval = curr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue