Merge branches 'acpi-battery', 'acpi-sbs', 'acpi-button' and 'acpi-video'

Merge updates of the ACPI battery, ACPI SBS (Smart Battery System), ACPI
button, and ACPI video bus device drivers for 7.4:

 - Fix bogus cycle count values on systems without _BIX in the ACPI
   battery driver (Armin Wolf)

 - Fix NULL pointer dereference on allocation failure and report
   relative state of charge as CAPACITY in the ACPI SBS driver (Itay
   Shem-tov and Guangshuo Li)

 - Add lid_init_state quirk for Razer Blade Stealth 13 (Early 2020)
   RZ09-0310 to the ACPI button driver (Ian Gallagher)

 - Add new quirks to force the native backlight on Dell OptiPlex AIO
   7410 35W and Acer Nitro AN515-58 in the ACPI video bus device
   driver (Chitransh Mandhaniya and Dirga Yuza)

* acpi-battery:
  ACPI: battery: Fix bogus cycle count values on systems without _BIX

* acpi-sbs:
  ACPI: SBS: Fix NULL pointer dereference on allocation failure
  ACPI: SBS: report relative state of charge as CAPACITY

* acpi-button:
  ACPI: button: Add lid_init_state quirk for Razer Blade Stealth 13 (Early 2020) RZ09-0310

* acpi-video:
  ACPI: video: force native backlight on Dell OptiPlex AIO 7410 35W
  ACPI: video: add backlight=native DMI quirk on Acer Nitro AN515-58
This commit is contained in:
Rafael J. Wysocki 2026-10-19 13:36:55 +02:00
4 changed files with 144 additions and 23 deletions

View File

@ -341,7 +341,9 @@ static int acpi_battery_get_property(struct power_supply *psy,
return ret;
}
static const enum power_supply_property charge_battery_props[] = {
/* For devices supporting the _BIX ACPI control method */
static const enum power_supply_property charge_battery_extended_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY,
@ -359,7 +361,7 @@ static const enum power_supply_property charge_battery_props[] = {
POWER_SUPPLY_PROP_SERIAL_NUMBER,
};
static const enum power_supply_property charge_battery_full_cap_broken_props[] = {
static const enum power_supply_property charge_battery_full_cap_broken_extended_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY,
@ -373,7 +375,7 @@ static const enum power_supply_property charge_battery_full_cap_broken_props[] =
POWER_SUPPLY_PROP_SERIAL_NUMBER,
};
static const enum power_supply_property energy_battery_props[] = {
static const enum power_supply_property energy_battery_extended_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY,
@ -391,7 +393,7 @@ static const enum power_supply_property energy_battery_props[] = {
POWER_SUPPLY_PROP_SERIAL_NUMBER,
};
static const enum power_supply_property energy_battery_full_cap_broken_props[] = {
static const enum power_supply_property energy_battery_full_cap_broken_extended_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY,
@ -405,6 +407,68 @@ static const enum power_supply_property energy_battery_full_cap_broken_props[] =
POWER_SUPPLY_PROP_SERIAL_NUMBER,
};
/* For devices supporting only the _BIF ACPI control method */
static const enum power_supply_property charge_battery_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY,
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
POWER_SUPPLY_PROP_CHARGE_FULL,
POWER_SUPPLY_PROP_CHARGE_NOW,
POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_CAPACITY_LEVEL,
POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_SERIAL_NUMBER,
};
static const enum power_supply_property charge_battery_full_cap_broken_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY,
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CHARGE_NOW,
POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_SERIAL_NUMBER,
};
static const enum power_supply_property energy_battery_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY,
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_POWER_NOW,
POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
POWER_SUPPLY_PROP_ENERGY_FULL,
POWER_SUPPLY_PROP_ENERGY_NOW,
POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_CAPACITY_LEVEL,
POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_SERIAL_NUMBER,
};
static const enum power_supply_property energy_battery_full_cap_broken_props[] = {
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_PRESENT,
POWER_SUPPLY_PROP_TECHNOLOGY,
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_POWER_NOW,
POWER_SUPPLY_PROP_ENERGY_NOW,
POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_SERIAL_NUMBER,
};
/* Battery Management */
struct acpi_offsets {
size_t offset; /* offset inside struct acpi_sbs_battery */
@ -904,6 +968,7 @@ static void __exit battery_hook_exit(void)
static int sysfs_add_battery(struct acpi_battery *battery)
{
bool extended_info_available = test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);
struct power_supply_config psy_cfg = {
.drv_data = battery,
.attr_grp = acpi_battery_groups,
@ -922,25 +987,55 @@ static int sysfs_add_battery(struct acpi_battery *battery)
if (power_unit == ACPI_BATTERY_POWER_UNIT_MA) {
if (full_cap_broken) {
battery->bat_desc.properties =
charge_battery_full_cap_broken_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(charge_battery_full_cap_broken_props);
if (extended_info_available) {
battery->bat_desc.properties =
charge_battery_full_cap_broken_extended_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(charge_battery_full_cap_broken_extended_props);
} else {
battery->bat_desc.properties =
charge_battery_full_cap_broken_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(charge_battery_full_cap_broken_props);
}
} else {
battery->bat_desc.properties = charge_battery_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(charge_battery_props);
if (extended_info_available) {
battery->bat_desc.properties =
charge_battery_extended_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(charge_battery_extended_props);
} else {
battery->bat_desc.properties =
charge_battery_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(charge_battery_props);
}
}
} else {
if (full_cap_broken) {
battery->bat_desc.properties =
energy_battery_full_cap_broken_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(energy_battery_full_cap_broken_props);
if (extended_info_available) {
battery->bat_desc.properties =
energy_battery_full_cap_broken_extended_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(energy_battery_full_cap_broken_extended_props);
} else {
battery->bat_desc.properties =
energy_battery_full_cap_broken_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(energy_battery_full_cap_broken_props);
}
} else {
battery->bat_desc.properties = energy_battery_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(energy_battery_props);
if (extended_info_available) {
battery->bat_desc.properties =
energy_battery_extended_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(energy_battery_extended_props);
} else {
battery->bat_desc.properties =
energy_battery_props;
battery->bat_desc.num_properties =
ARRAY_SIZE(energy_battery_props);
}
}
}

View File

@ -144,6 +144,18 @@ static const struct dmi_system_id dmi_lid_quirks[] = {
},
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
},
{
/*
* Razer Blade Stealth 13 early 2020, when the lid is opened
* while suspended the open notification is lost and _LID keeps
* returning closed after resume, causing spurious re-suspends.
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Razer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Blade Stealth 13 (Early 2020) - RZ09-0310"),
},
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
},
{
/*
* Samsung galaxybook2 ,initial _LID device notification returns

View File

@ -318,7 +318,7 @@ static struct acpi_battery_reader state_readers[] = {
{0x0a, SMBUS_READ_WORD, offsetof(struct acpi_battery, rate_now)},
{0x0b, SMBUS_READ_WORD, offsetof(struct acpi_battery, rate_avg)},
{0x0f, SMBUS_READ_WORD, offsetof(struct acpi_battery, capacity_now)},
{0x0e, SMBUS_READ_WORD, offsetof(struct acpi_battery, state_of_charge)},
{0x0d, SMBUS_READ_WORD, offsetof(struct acpi_battery, state_of_charge)},
{0x16, SMBUS_READ_WORD, offsetof(struct acpi_battery, state)},
};
@ -639,10 +639,8 @@ static int acpi_sbs_probe(struct platform_device *pdev)
return -ENODEV;
sbs = kzalloc_obj(struct acpi_sbs);
if (!sbs) {
result = -ENOMEM;
goto end;
}
if (!sbs)
return -ENOMEM;
mutex_init(&sbs->lock);

View File

@ -883,6 +883,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 7770 AIO"),
},
},
{
.callback = video_detect_force_native,
/* Dell OptiPlex AIO 7410 35W */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex AIO 7410 35W"),
},
},
/*
* Models which have nvidia-ec-wmi support, but should not use it.
@ -929,6 +937,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "Nitro AN515-46"),
},
},
{
.callback = video_detect_force_native,
/* Acer Nitro AN515-58 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Nitro AN515-58"),
},
},
/*
* x86 android tablets which directly control the backlight through