Skip to content

Commit 4a577fc

Browse files
committed
Merge branches 'acpi-battery', 'acpi-video' and 'acpi-misc'
Merge ACPI battery and backlight driver update and miscellaneous cleanup for 5.19-rc1: - Make the ACPI battery driver show the "not-charging" status by default unless "charging" or "full" is directly indicated (Werner Sembach). - Improve the PM notifier in the ACPI backlight driver (Zhang Rui). - Clean up some white space in the ACPI code (Ian Cowan). * acpi-battery: ACPI: battery: Make "not-charging" the default on no charging or full info * acpi-video: ACPI: video: improve PM notifer callback * acpi-misc: ACPI: clean up white space in a few places for consistency
4 parents 15f4bb9 + 185d206 + 1934fee + 4c19851 commit 4a577fc

File tree

3 files changed

+18
-41
lines changed

3 files changed

+18
-41
lines changed

drivers/acpi/ac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ MODULE_AUTHOR("Paul Diefenbaugh");
3232
MODULE_DESCRIPTION("ACPI AC Adapter Driver");
3333
MODULE_LICENSE("GPL");
3434

35-
3635
static int acpi_ac_add(struct acpi_device *device);
3736
static int acpi_ac_remove(struct acpi_device *device);
3837
static void acpi_ac_notify(struct acpi_device *device, u32 event);
@@ -125,6 +124,7 @@ static int get_ac_property(struct power_supply *psy,
125124
default:
126125
return -EINVAL;
127126
}
127+
128128
return 0;
129129
}
130130

@@ -286,6 +286,7 @@ static int acpi_ac_resume(struct device *dev)
286286
return 0;
287287
if (old_state != ac->state)
288288
kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE);
289+
289290
return 0;
290291
}
291292
#else
@@ -296,7 +297,6 @@ static int acpi_ac_remove(struct acpi_device *device)
296297
{
297298
struct acpi_ac *ac = NULL;
298299

299-
300300
if (!device || !acpi_driver_data(device))
301301
return -EINVAL;
302302

drivers/acpi/acpi_video.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,24 +1707,23 @@ static int acpi_video_resume(struct notifier_block *nb,
17071707
int i;
17081708

17091709
switch (val) {
1710-
case PM_HIBERNATION_PREPARE:
1711-
case PM_SUSPEND_PREPARE:
1712-
case PM_RESTORE_PREPARE:
1713-
return NOTIFY_DONE;
1714-
}
1715-
1716-
video = container_of(nb, struct acpi_video_bus, pm_nb);
1717-
1718-
dev_info(&video->device->dev, "Restoring backlight state\n");
1710+
case PM_POST_HIBERNATION:
1711+
case PM_POST_SUSPEND:
1712+
case PM_POST_RESTORE:
1713+
video = container_of(nb, struct acpi_video_bus, pm_nb);
1714+
1715+
dev_info(&video->device->dev, "Restoring backlight state\n");
1716+
1717+
for (i = 0; i < video->attached_count; i++) {
1718+
video_device = video->attached_array[i].bind_info;
1719+
if (video_device && video_device->brightness)
1720+
acpi_video_device_lcd_set_level(video_device,
1721+
video_device->brightness->curr);
1722+
}
17191723

1720-
for (i = 0; i < video->attached_count; i++) {
1721-
video_device = video->attached_array[i].bind_info;
1722-
if (video_device && video_device->brightness)
1723-
acpi_video_device_lcd_set_level(video_device,
1724-
video_device->brightness->curr);
1724+
return NOTIFY_OK;
17251725
}
1726-
1727-
return NOTIFY_OK;
1726+
return NOTIFY_DONE;
17281727
}
17291728

17301729
static acpi_status

drivers/acpi/battery.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ static bool battery_driver_registered;
5252
static int battery_bix_broken_package;
5353
static int battery_notification_delay_ms;
5454
static int battery_ac_is_broken;
55-
static int battery_quirk_notcharging;
5655
static unsigned int cache_time = 1000;
5756
module_param(cache_time, uint, 0644);
5857
MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -216,10 +215,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
216215
val->intval = POWER_SUPPLY_STATUS_CHARGING;
217216
else if (acpi_battery_is_charged(battery))
218217
val->intval = POWER_SUPPLY_STATUS_FULL;
219-
else if (battery_quirk_notcharging)
220-
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
221218
else
222-
val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
219+
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
223220
break;
224221
case POWER_SUPPLY_PROP_PRESENT:
225222
val->intval = acpi_battery_present(battery);
@@ -1105,12 +1102,6 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
11051102
return 0;
11061103
}
11071104

1108-
static int __init battery_quirk_not_charging(const struct dmi_system_id *d)
1109-
{
1110-
battery_quirk_notcharging = 1;
1111-
return 0;
1112-
}
1113-
11141105
static const struct dmi_system_id bat_dmi_table[] __initconst = {
11151106
{
11161107
/* NEC LZ750/LS */
@@ -1139,19 +1130,6 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
11391130
DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
11401131
},
11411132
},
1142-
{
1143-
/*
1144-
* On Lenovo ThinkPads the BIOS specification defines
1145-
* a state when the bits for charging and discharging
1146-
* are both set to 0. That state is "Not Charging".
1147-
*/
1148-
.callback = battery_quirk_not_charging,
1149-
.ident = "Lenovo ThinkPad",
1150-
.matches = {
1151-
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1152-
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"),
1153-
},
1154-
},
11551133
{
11561134
/* Microsoft Surface Go 3 */
11571135
.callback = battery_notification_delay_quirk,

0 commit comments

Comments
 (0)