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 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); | 32 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
| 33 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
| 34 | 34 | ||
| 35 | |||
| 36 | static int acpi_ac_add(struct acpi_device *device); | 35 | static int acpi_ac_add(struct acpi_device *device); |
| 37 | static int acpi_ac_remove(struct acpi_device *device); | 36 | static int acpi_ac_remove(struct acpi_device *device); |
| 38 | static void acpi_ac_notify(struct acpi_device *device, u32 event); | 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 | default: | 124 | default: |
| 126 | return -EINVAL; | 125 | return -EINVAL; |
| 127 | } | 126 | } |
| 127 | |||
| 128 | return 0; | 128 | return 0; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| @@ -286,6 +286,7 @@ static int acpi_ac_resume(struct device *dev) · 155 unmodified lines | |||
| 286 | return 0; | 286 | return 0; |
| 287 | if (old_state != ac->state) | 287 | if (old_state != ac->state) |
| 288 | kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); | 288 | kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); |
| 289 | |||
| 289 | return 0; | 290 | return 0; |
| 290 | } | 291 | } |
| 291 | #else | 292 | #else |
| @@ -296,7 +297,6 @@ static int acpi_ac_remove(struct acpi_device *device) · 4 unmodified lines | |||
| 296 | { | 297 | { |
| 297 | struct acpi_ac *ac = NULL; | 298 | struct acpi_ac *ac = NULL; |
| 298 | 299 | ||
| 299 | |||
| 300 | if (!device || !acpi_driver_data(device)) | 300 | if (!device || !acpi_driver_data(device)) |
| 301 | return -EINVAL; | 301 | return -EINVAL; |
| 302 | 302 | ||
| @@ -1707,24 +1707,23 @@ static int acpi_video_resume(struct notifier_block *nb, · 1706 unmodified lines | |||
| 1707 | int i; | 1707 | int i; |
| 1708 | 1708 | ||
| 1709 | switch (val) { | 1709 | switch (val) { |
| 1710 | case PM_HIBERNATION_PREPARE: | 1710 | case PM_POST_HIBERNATION: |
| 1711 | case PM_SUSPEND_PREPARE: | 1711 | case PM_POST_SUSPEND: |
| 1712 | case PM_RESTORE_PREPARE: | 1712 | case PM_POST_RESTORE: |
| 1713 | return NOTIFY_DONE; | 1713 | video = container_of(nb, struct acpi_video_bus, pm_nb); |
| 1714 | } | 1714 | |
| 1715 | 1715 | dev_info(&video->device->dev, "Restoring backlight state\n"); | |
| 1716 | video = container_of(nb, struct acpi_video_bus, pm_nb); | 1716 | |
| 1717 | 1717 | for (i = 0; i < video->attached_count; i++) { | |
| 1718 | dev_info(&video->device->dev, "Restoring backlight state\n"); | 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++) { | 1724 | return NOTIFY_OK; |
| 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); | ||
| 1725 | } | 1725 | } |
| 1726 | 1726 | return NOTIFY_DONE; | |
| 1727 | return NOTIFY_OK; | ||
| 1728 | } | 1727 | } |
| 1729 | 1728 | ||
| 1730 | static acpi_status | 1729 | static acpi_status |
| @@ -52,7 +52,6 @@ static bool battery_driver_registered; · 51 unmodified lines | |||
| 52 | static int battery_bix_broken_package; | 52 | static int battery_bix_broken_package; |
| 53 | static int battery_notification_delay_ms; | 53 | static int battery_notification_delay_ms; |
| 54 | static int battery_ac_is_broken; | 54 | static int battery_ac_is_broken; |
| 55 | static int battery_quirk_notcharging; | ||
| 56 | static unsigned int cache_time = 1000; | 55 | static unsigned int cache_time = 1000; |
| 57 | module_param(cache_time, uint, 0644); | 56 | module_param(cache_time, uint, 0644); |
| 58 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | 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 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | 215 | val->intval = POWER_SUPPLY_STATUS_CHARGING; |
| 217 | else if (acpi_battery_is_charged(battery)) | 216 | else if (acpi_battery_is_charged(battery)) |
| 218 | val->intval = POWER_SUPPLY_STATUS_FULL; | 217 | val->intval = POWER_SUPPLY_STATUS_FULL; |
| 219 | else if (battery_quirk_notcharging) | ||
| 220 | val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; | ||
| 221 | else | 218 | else |
| 222 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | 219 | val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; |
| 223 | break; | 220 | break; |
| 224 | case POWER_SUPPLY_PROP_PRESENT: | 221 | case POWER_SUPPLY_PROP_PRESENT: |
| 225 | val->intval = acpi_battery_present(battery); | 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 | return 0; | 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 | static const struct dmi_system_id bat_dmi_table[] __initconst = { | 1105 | static const struct dmi_system_id bat_dmi_table[] __initconst = { |
| 1115 | { | 1106 | { |
| 1116 | /* NEC LZ750/LS */ | 1107 | /* NEC LZ750/LS */ |
| @@ -1139,19 +1130,6 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { · 22 unmodified lines | |||
| 1139 | DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"), | 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 | /* Microsoft Surface Go 3 */ | 1134 | /* Microsoft Surface Go 3 */ |
| 1157 | .callback = battery_notification_delay_quirk, | 1135 | .callback = battery_notification_delay_quirk, |