On Fri, Apr 28, 2023 at 1:30 AM Jakob Hauser <jahau@xxxxxxxxxxxxxx> wrote: > This patch adds device driver of Richtek RT5033 PMIC. The driver supports > switching charger. rt5033 charger provides three charging modes. The charging > modes are pre-charge mode, fast charge mode and constant voltage mode. They > vary in charge rate, the charge parameters can be controlled by i2c interface. > > Cc: Beomho Seo <beomho.seo@xxxxxxxxxxx> > Cc: Chanwoo Choi <cw00.choi@xxxxxxxxxxx> > Tested-by: Raymond Hackley <raymondhackley@xxxxxxxxxxxxxx> > Signed-off-by: Jakob Hauser <jahau@xxxxxxxxxxxxxx> Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx> > + ret = power_supply_get_battery_info(charger->psy, &info); > + if (ret) { > + dev_err(charger->dev, "failed to get battery info\n"); > + return ERR_PTR(-EINVAL); > + } > + > + /* Assign data. Validity will be checked in the init functions. */ > + chg->pre_uamp = info->precharge_current_ua; > + chg->fast_uamp = info->constant_charge_current_max_ua; > + chg->eoc_uamp = info->charge_term_current_ua; > + chg->pre_uvolt = info->precharge_voltage_max_uv; > + chg->const_uvolt = info->constant_charge_voltage_max_uv; Code reuse, exactly how it should be! :) Yours, Linus Walleij