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
Unified · Split
| @@ -32,7 +32,6 @@ MODULE_AUTHOR("Paul Diefenbaugh"); · 31 unmodified lines | ||
| 32 | 32 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
| 33 | 33 | MODULE_LICENSE("GPL"); |
| 34 | 34 | |
| 35 | − | |
| 36 | 35 | static int acpi_ac_add(struct acpi_device *device); |
| 37 | 36 | static int acpi_ac_remove(struct acpi_device *device); |
| 38 | 37 | static void acpi_ac_notify(struct acpi_device *device, u32 event); |
| @@ -125,6 +124,7 @@ static int get_ac_property(struct power_supply *psy, · 86 unmodified lines | ||
| 125 | 124 | default: |
| 126 | 125 | return -EINVAL; |
| 127 | 126 | } |
| 127 | + | |
| 128 | 128 | return 0; |
| 129 | 129 | } |
| 130 | 130 | |
| @@ -286,6 +286,7 @@ static int acpi_ac_resume(struct device *dev) · 155 unmodified lines | ||
| 286 | 286 | return 0; |
| 287 | 287 | if (old_state != ac->state) |
| 288 | 288 | kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); |
| 289 | + | |
| 289 | 290 | return 0; |
| 290 | 291 | } |
| 291 | 292 | #else |
| @@ -296,7 +297,6 @@ static int acpi_ac_remove(struct acpi_device *device) · 4 unmodified lines | ||
| 296 | 297 | { |
| 297 | 298 | struct acpi_ac *ac = NULL; |
| 298 | 299 | |
| 299 | − | |
| 300 | 300 | if (!device || !acpi_driver_data(device)) |
| 301 | 301 | return -EINVAL; |
| 302 | 302 | |
| @@ -1707,24 +1707,23 @@ static int acpi_video_resume(struct notifier_block *nb, · 1706 unmodified lines | ||
| 1707 | 1707 | int i; |
| 1708 | 1708 | |
| 1709 | 1709 | 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 | + } | |
| 1719 | 1723 | |
| 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; | |
| 1725 | 1725 | } |
| 1726 | − | |
| 1727 | − return NOTIFY_OK; | |
| 1726 | + return NOTIFY_DONE; | |
| 1728 | 1727 | } |
| 1729 | 1728 | |
| 1730 | 1729 | static acpi_status |
| @@ -52,7 +52,6 @@ static bool battery_driver_registered; · 51 unmodified lines | ||
| 52 | 52 | static int battery_bix_broken_package; |
| 53 | 53 | static int battery_notification_delay_ms; |
| 54 | 54 | static int battery_ac_is_broken; |
| 55 | −static int battery_quirk_notcharging; | |
| 56 | 55 | static unsigned int cache_time = 1000; |
| 57 | 56 | module_param(cache_time, uint, 0644); |
| 58 | 57 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
| @@ -216,10 +215,8 @@ static int acpi_battery_get_property(struct power_supply *psy, · 157 unmodified lines | ||
| 216 | 215 | val->intval = POWER_SUPPLY_STATUS_CHARGING; |
| 217 | 216 | else if (acpi_battery_is_charged(battery)) |
| 218 | 217 | val->intval = POWER_SUPPLY_STATUS_FULL; |
| 219 | − else if (battery_quirk_notcharging) | |
| 220 | − val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; | |
| 221 | 218 | else |
| 222 | − val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | |
| 219 | + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; | |
| 223 | 220 | break; |
| 224 | 221 | case POWER_SUPPLY_PROP_PRESENT: |
| 225 | 222 | val->intval = acpi_battery_present(battery); |
| @@ -1105,12 +1102,6 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d) · 879 unmodified lines | ||
| 1105 | 1102 | return 0; |
| 1106 | 1103 | } |
| 1107 | 1104 | |
| 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 | − | |
| 1114 | 1105 | static const struct dmi_system_id bat_dmi_table[] __initconst = { |
| 1115 | 1106 | { |
| 1116 | 1107 | /* NEC LZ750/LS */ |
| @@ -1139,19 +1130,6 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { · 22 unmodified lines | ||
| 1139 | 1130 | DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"), |
| 1140 | 1131 | }, |
| 1141 | 1132 | }, |
| 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 | − }, | |
| 1155 | 1133 | { |
| 1156 | 1134 | /* Microsoft Surface Go 3 */ |
| 1157 | 1135 | .callback = battery_notification_delay_quirk, |