Re: [EXTERNAL] Re: [PATCH v14 4/4] power: supply: bq25150 introduce the bq25150
From: Sebastian Reichel
Date: Wed Jul 01 2020 - 12:17:17 EST
Hi,
On Tue, Jun 30, 2020 at 11:17:30PM -0500, Ricardo Rivera-Matos wrote:
> [...]
> > > +static int bq2515x_battery_set_property(struct power_supply *psy,
> > > + enum power_supply_property prop,
> > > + const union power_supply_propval *val)
> > > +{
> > > + struct bq2515x_device *bq2515x = power_supply_get_drvdata(psy);
> > > + int ret;
> > > +
> > > + switch (prop) {
> > > + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
> > > + ret = bq2515x_set_batt_reg(bq2515x, val->intval);
> > > + break;
> > > + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
> > > + ret = bq2515x_set_const_charge_current(bq2515x, val->intval);
> > > + break;
> > > + case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
> > > + ret = bq2515x_set_precharge_current(bq2515x, val->intval);
> > > + break;
> > > + default:
> > > + return -EINVAL;
> > > + }
> > > +
> > > + return ret;
> > > +}
> > Expose those through the charger device. The battery device
> > can expose maximum data (e.g. POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX),
> > but should not control the charging itself.
> ACK. Just to confirm this would eliminate the need for the
> bq2515x_battery_set_property altogether as these three properties should be
> set in the charger device. There will only be a bq2515x_battery_get_property
> to report the CONSTANT_CHARGE_VOLTAGE_MAX and CONSTANT_CHARGE_CURRENT_MAX
> values captured from the devicetree.
Right.
-- Sebastian