power: bq24190: add get_current_limit
This commit is contained in:
1 parent
bbf04e9a89
commit
a75c8520d0
1 file changed
+24
@@ -611,6 +611,29 @@ out:
|
||||
}
|
||||
|
||||
#ifdef CONFIG_REGULATOR
|
||||
static int bq24190_get_charging_current(struct regulator_dev *dev)
|
||||
{
|
||||
struct bq24190_dev_info *bdi = rdev_get_drvdata(dev);
|
||||
int in_current_limit;
|
||||
int ret;
|
||||
|
||||
dev_info(bdi->dev, "Getting charging current\n");
|
||||
|
||||
ret = bq24190_get_field_val(bdi, BQ24190_REG_ISC,
|
||||
BQ24190_REG_ISC_IINLIM_MASK,
|
||||
BQ24190_REG_ISC_IINLIM_SHIFT,
|
||||
bq24190_isc_iinlim_values,
|
||||
ARRAY_SIZE(bq24190_isc_iinlim_values),
|
||||
&in_current_limit);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
return in_current_limit;
|
||||
error:
|
||||
dev_err(bdi->dev, "Charger enable failed, err = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int bq24190_set_charging_current(struct regulator_dev *dev,
|
||||
int min_uA, int max_uA)
|
||||
{
|
||||
@@ -645,6 +668,7 @@ error:
|
||||
}
|
||||
|
||||
static const struct regulator_ops bq24190_chrg_ops = {
|
||||
.get_current_limit = bq24190_get_charging_current,
|
||||
.set_current_limit = bq24190_set_charging_current,
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user