On Fri, Jul 15, 2022 at 9:08 PM Brennan Vincent <brennan@xxxxxxxxxxxxxx> wrote: > > This property, expressed in thousands of a percent, > reports how accurate the device claims its > capacity metrics to be. It may be useful for battery > monitoring tools. For changes like this, it is usually required to at least provide a pointer to a user space utility that will use the given ABI. Are you aware of any plans to use this new attribute in any existing utilities? > --- > drivers/acpi/battery.c | 7 +++++++ > drivers/power/supply/power_supply_sysfs.c | 1 + > include/linux/power_supply.h | 1 + > 3 files changed, 9 insertions(+) > > diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c > index 306513fec1e1..933f3de4dd67 100644 > --- a/drivers/acpi/battery.c > +++ b/drivers/acpi/battery.c > @@ -300,6 +300,9 @@ static int acpi_battery_get_property(struct power_supply *psy, > case POWER_SUPPLY_PROP_SERIAL_NUMBER: > val->strval = battery->serial_number; > break; > + case POWER_SUPPLY_PROP_MEASUREMENT_ACCURACY: > + val->intval = battery->measurement_accuracy; > + break; > default: > ret = -EINVAL; > } > @@ -322,6 +325,7 @@ static enum power_supply_property charge_battery_props[] = { > POWER_SUPPLY_PROP_MODEL_NAME, > POWER_SUPPLY_PROP_MANUFACTURER, > POWER_SUPPLY_PROP_SERIAL_NUMBER, > + POWER_SUPPLY_PROP_MEASUREMENT_ACCURACY, > }; > > static enum power_supply_property charge_battery_full_cap_broken_props[] = { > @@ -336,6 +340,7 @@ static enum power_supply_property charge_battery_full_cap_broken_props[] = { > POWER_SUPPLY_PROP_MODEL_NAME, > POWER_SUPPLY_PROP_MANUFACTURER, > POWER_SUPPLY_PROP_SERIAL_NUMBER, > + POWER_SUPPLY_PROP_MEASUREMENT_ACCURACY, > }; > > static enum power_supply_property energy_battery_props[] = { > @@ -354,6 +359,7 @@ static enum power_supply_property energy_battery_props[] = { > POWER_SUPPLY_PROP_MODEL_NAME, > POWER_SUPPLY_PROP_MANUFACTURER, > POWER_SUPPLY_PROP_SERIAL_NUMBER, > + POWER_SUPPLY_PROP_MEASUREMENT_ACCURACY, > }; > > static enum power_supply_property energy_battery_full_cap_broken_props[] = { > @@ -368,6 +374,7 @@ static enum power_supply_property energy_battery_full_cap_broken_props[] = { > POWER_SUPPLY_PROP_MODEL_NAME, > POWER_SUPPLY_PROP_MANUFACTURER, > POWER_SUPPLY_PROP_SERIAL_NUMBER, > + POWER_SUPPLY_PROP_MEASUREMENT_ACCURACY, > }; > > /* Battery Management */ > diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c > index 4239591e1522..844dbd61295f 100644 > --- a/drivers/power/supply/power_supply_sysfs.c > +++ b/drivers/power/supply/power_supply_sysfs.c > @@ -220,6 +220,7 @@ static struct power_supply_attr power_supply_attrs[] = { > POWER_SUPPLY_ATTR(MODEL_NAME), > POWER_SUPPLY_ATTR(MANUFACTURER), > POWER_SUPPLY_ATTR(SERIAL_NUMBER), > + POWER_SUPPLY_ATTR(MEASUREMENT_ACCURACY), > }; > > static struct attribute * > diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h > index cb380c1d9459..4c48ee26f1b5 100644 > --- a/include/linux/power_supply.h > +++ b/include/linux/power_supply.h > @@ -174,6 +174,7 @@ enum power_supply_property { > POWER_SUPPLY_PROP_MODEL_NAME, > POWER_SUPPLY_PROP_MANUFACTURER, > POWER_SUPPLY_PROP_SERIAL_NUMBER, > + POWER_SUPPLY_PROP_MEASUREMENT_ACCURACY, > }; > > enum power_supply_type { > -- > 2.34.1