Messages in this thread |  | | Date | Tue, 5 May 2026 08:22:40 +0300 | | Subject | Re: [PATCH] power: supply: bd71828: sysfs for auto input current limitation | | From | Matti Vaittinen <> |
| |
Thanks Andreas!
On 04/05/2026 19:40, Andreas Kemnade wrote: > Add the possibility to disable the auto adjustment for input current > limitation via sysfs because it gives strange results under certain > circumstances e.g. when powering the device with solar panels > resulting in no input power usage at all. > > Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
> --- > .../ABI/testing/sysfs-class-power-bd71828 | 12 ++++ > drivers/power/supply/bd71828-power.c | 69 ++++++++++++++++++- > 2 files changed, 80 insertions(+), 1 deletion(-) > create mode 100644 Documentation/ABI/testing/sysfs-class-power-bd71828
// snip
> +static ssize_t auto_dcin_limit_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t len) > +{ > + struct bd71828_power *pwr = dev_get_drvdata(dev->parent); > + int ret; > + bool v; > + > + ret = kstrtobool(buf, &v); > + if (ret < 0) > + return ret; > + > + ret = regmap_update_bits(pwr->regmap, BD71828_REG_DCIN_SET, > + BD71828_MASK_ILIM_DCIN_EN, > + v ? BD71828_MASK_ILIM_DCIN_EN : 0);
'nit'. I am not a big fan of the ternary. I would consider using an if-else or the regmap_assign_bits(). Not worth re-spinning though.
> +static bool bd71828_ac_sysfs_group_visible(struct kobject *kobj) > +{ > + struct device *dev = kobj_to_dev(kobj); > + struct bd71828_power *pwr = dev_get_drvdata(dev->parent); > + > + return !!pwr->regs->dcin_set; > +} > + > +DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(bd71828_ac_sysfs);
Ah. I didn't know DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE() existed. Thanks for teaching me a thing again :)
Yours, -- Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
|  |