Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Ricardo Rivera-Matos and committed by
Sebastian Reichel
da28e18d 2ce8284c

+15 -2
+15 -2
drivers/power/supply/bq24190_charger.c
··· 965 965 union power_supply_propval *val) 966 966 { 967 967 u8 v; 968 - int ret; 968 + int curr, ret; 969 969 970 970 ret = bq24190_read_mask(bdi, BQ24190_REG_PCTCC, 971 971 BQ24190_REG_PCTCC_IPRECHG_MASK, ··· 973 973 if (ret < 0) 974 974 return ret; 975 975 976 - val->intval = ++v * 128 * 1000; 976 + curr = ++v * 128 * 1000; 977 + 978 + ret = bq24190_read_mask(bdi, BQ24190_REG_CCC, 979 + BQ24190_REG_CCC_FORCE_20PCT_MASK, 980 + BQ24190_REG_CCC_FORCE_20PCT_SHIFT, &v); 981 + if (ret < 0) 982 + return ret; 983 + 984 + /* If FORCE_20PCT is enabled, then current is 50% of IPRECHG value */ 985 + if (v) 986 + curr /= 2; 987 + 988 + val->intval = curr; 989 + 977 990 return 0; 978 991 } 979 992