Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'acpi-5.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more ACPI updates from Rafael Wysocki:
"These add some new device IDs, update a few drivers (processor,
battery, backlight) and clean up code in a few places.

Specifics:

- Add Meteor Lake ACPI IDs for DPTF devices (Sumeet Pawnikar)

- Rearrange find_child_checks() to simplify code (Rafael Wysocki)

- Use memremap() to map the UCSI mailbox that is always in main
memory and drop acpi_release_memory() that has no more users
(Heikki Krogerus, Dan Carpenter)

- Make max_cstate/nocst/bm_check_disable processor module parameters
visible in sysfs (Yajun Deng)

- Fix typo in the CPPC driver (Julia Lawall)

- 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)"

* tag 'acpi-5.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
usb: typec: ucsi: acpi: fix a NULL vs IS_ERR() check in probe
ACPI: DPTF: Support Meteor Lake
ACPI: CPPC: fix typo in comment
ACPI: video: improve PM notifer callback
ACPI: clean up white space in a few places for consistency
ACPI: glue: Rearrange find_child_checks()
ACPI: processor: idle: Expose max_cstate/nocst/bm_check_disable read-only in sysfs
ACPI: battery: Make "not-charging" the default on no charging or full info
ACPI: OSL: Remove the helper for deactivating memory region
usb: typec: ucsi: acpi: Map the mailbox with memremap()

+53 -162
+2 -2
drivers/acpi/ac.c
··· 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); ··· 124 125 default: 125 126 return -EINVAL; 126 127 } 128 + 127 129 return 0; 128 130 } 129 131 ··· 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 295 static int acpi_ac_remove(struct acpi_device *device) 297 296 { 298 297 struct acpi_ac *ac = NULL; 299 - 300 298 301 299 if (!device || !acpi_driver_data(device)) 302 300 return -EINVAL;
+16 -17
drivers/acpi/acpi_video.c
··· 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; 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 + } 1723 + 1724 + return NOTIFY_OK; 1714 1725 } 1715 - 1716 - video = container_of(nb, struct acpi_video_bus, pm_nb); 1717 - 1718 - dev_info(&video->device->dev, "Restoring backlight state\n"); 1719 - 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); 1725 - } 1726 - 1727 - return NOTIFY_OK; 1726 + return NOTIFY_DONE; 1728 1727 } 1729 1728 1730 1729 static acpi_status
+1 -23
drivers/acpi/battery.c
··· 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"); ··· 215 216 val->intval = POWER_SUPPLY_STATUS_CHARGING; 216 217 else if (acpi_battery_is_charged(battery)) 217 218 val->intval = POWER_SUPPLY_STATUS_FULL; 218 - else if (battery_quirk_notcharging) 219 - val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; 220 219 else 221 - val->intval = POWER_SUPPLY_STATUS_UNKNOWN; 220 + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; 222 221 break; 223 222 case POWER_SUPPLY_PROP_PRESENT: 224 223 val->intval = acpi_battery_present(battery); ··· 1102 1105 return 0; 1103 1106 } 1104 1107 1105 - static int __init battery_quirk_not_charging(const struct dmi_system_id *d) 1106 - { 1107 - battery_quirk_notcharging = 1; 1108 - return 0; 1109 - } 1110 - 1111 1108 static const struct dmi_system_id bat_dmi_table[] __initconst = { 1112 1109 { 1113 1110 /* NEC LZ750/LS */ ··· 1128 1137 DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1013"), 1129 1138 /* Above matches are too generic, add bios-date match */ 1130 1139 DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"), 1131 - }, 1132 - }, 1133 - { 1134 - /* 1135 - * On Lenovo ThinkPads the BIOS specification defines 1136 - * a state when the bits for charging and discharging 1137 - * are both set to 0. That state is "Not Charging". 1138 - */ 1139 - .callback = battery_quirk_not_charging, 1140 - .ident = "Lenovo ThinkPad", 1141 - .matches = { 1142 - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1143 - DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), 1144 1140 }, 1145 1141 }, 1146 1142 {
+1 -1
drivers/acpi/cppc_acpi.c
··· 315 315 goto end; 316 316 } 317 317 318 - /* wait for completion and check for PCC errro bit */ 318 + /* wait for completion and check for PCC error bit */ 319 319 ret = check_pcc_chan(pcc_ss_id, true); 320 320 321 321 if (pcc_ss_data->pcc_mrtt)
+1
drivers/acpi/dptf/dptf_pch_fivr.c
··· 151 151 static const struct acpi_device_id pch_fivr_device_ids[] = { 152 152 {"INTC1045", 0}, 153 153 {"INTC1049", 0}, 154 + {"INTC1064", 0}, 154 155 {"INTC10A3", 0}, 155 156 {"", 0}, 156 157 };
+2
drivers/acpi/dptf/dptf_power.c
··· 232 232 {"INTC1050", 0}, 233 233 {"INTC1060", 0}, 234 234 {"INTC1061", 0}, 235 + {"INTC1065", 0}, 236 + {"INTC1066", 0}, 235 237 {"INTC10A4", 0}, 236 238 {"INTC10A5", 0}, 237 239 {"", 0},
+6
drivers/acpi/dptf/int340x_thermal.c
··· 27 27 {"INT3532"}, 28 28 {"INTC1040"}, 29 29 {"INTC1041"}, 30 + {"INTC1042"}, 30 31 {"INTC1043"}, 31 32 {"INTC1044"}, 32 33 {"INTC1045"}, ··· 38 37 {"INTC1050"}, 39 38 {"INTC1060"}, 40 39 {"INTC1061"}, 40 + {"INTC1062"}, 41 + {"INTC1063"}, 42 + {"INTC1064"}, 43 + {"INTC1065"}, 44 + {"INTC1066"}, 41 45 {"INTC10A0"}, 42 46 {"INTC10A1"}, 43 47 {"INTC10A2"},
+1
drivers/acpi/fan.h
··· 14 14 {"INT3404", }, /* Fan */ \ 15 15 {"INTC1044", }, /* Fan for Tiger Lake generation */ \ 16 16 {"INTC1048", }, /* Fan for Alder Lake generation */ \ 17 + {"INTC1063", }, /* Fan for Meteor Lake generation */ \ 17 18 {"INTC10A2", }, /* Fan for Raptor Lake generation */ \ 18 19 {"PNP0C0B", } /* Generic ACPI fan */ 19 20
+10 -8
drivers/acpi/glue.c
··· 79 79 80 80 static int find_child_checks(struct acpi_device *adev, bool check_children) 81 81 { 82 - bool sta_present = true; 83 82 unsigned long long sta; 84 83 acpi_status status; 85 84 86 - status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); 87 - if (status == AE_NOT_FOUND) 88 - sta_present = false; 89 - else if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED)) 85 + if (check_children && list_empty(&adev->children)) 90 86 return -ENODEV; 91 87 92 - if (check_children && list_empty(&adev->children)) 88 + status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); 89 + if (status == AE_NOT_FOUND) 90 + return FIND_CHILD_MIN_SCORE; 91 + 92 + if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED)) 93 93 return -ENODEV; 94 94 95 95 /* ··· 99 99 * matched going forward. [This means a second spec violation in a row, 100 100 * so whatever we do here is best effort anyway.] 101 101 */ 102 - return sta_present && !adev->pnp.type.platform_id ? 103 - FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE; 102 + if (adev->pnp.type.platform_id) 103 + return FIND_CHILD_MIN_SCORE; 104 + 105 + return FIND_CHILD_MAX_SCORE; 104 106 } 105 107 106 108 struct acpi_device *acpi_find_child_device(struct acpi_device *parent,
-86
drivers/acpi/osl.c
··· 36 36 #include <linux/io-64-nonatomic-lo-hi.h> 37 37 38 38 #include "acpica/accommon.h" 39 - #include "acpica/acnamesp.h" 40 39 #include "internal.h" 41 40 42 41 /* Definitions for ACPI_DEBUG_PRINT() */ ··· 1494 1495 return acpi_check_resource_conflict(&res); 1495 1496 } 1496 1497 EXPORT_SYMBOL(acpi_check_region); 1497 - 1498 - static acpi_status acpi_deactivate_mem_region(acpi_handle handle, u32 level, 1499 - void *_res, void **return_value) 1500 - { 1501 - struct acpi_mem_space_context **mem_ctx; 1502 - union acpi_operand_object *handler_obj; 1503 - union acpi_operand_object *region_obj2; 1504 - union acpi_operand_object *region_obj; 1505 - struct resource *res = _res; 1506 - acpi_status status; 1507 - 1508 - region_obj = acpi_ns_get_attached_object(handle); 1509 - if (!region_obj) 1510 - return AE_OK; 1511 - 1512 - handler_obj = region_obj->region.handler; 1513 - if (!handler_obj) 1514 - return AE_OK; 1515 - 1516 - if (region_obj->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) 1517 - return AE_OK; 1518 - 1519 - if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) 1520 - return AE_OK; 1521 - 1522 - region_obj2 = acpi_ns_get_secondary_object(region_obj); 1523 - if (!region_obj2) 1524 - return AE_OK; 1525 - 1526 - mem_ctx = (void *)&region_obj2->extra.region_context; 1527 - 1528 - if (!(mem_ctx[0]->address >= res->start && 1529 - mem_ctx[0]->address < res->end)) 1530 - return AE_OK; 1531 - 1532 - status = handler_obj->address_space.setup(region_obj, 1533 - ACPI_REGION_DEACTIVATE, 1534 - NULL, (void **)mem_ctx); 1535 - if (ACPI_SUCCESS(status)) 1536 - region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); 1537 - 1538 - return status; 1539 - } 1540 - 1541 - /** 1542 - * acpi_release_memory - Release any mappings done to a memory region 1543 - * @handle: Handle to namespace node 1544 - * @res: Memory resource 1545 - * @level: A level that terminates the search 1546 - * 1547 - * Walks through @handle and unmaps all SystemMemory Operation Regions that 1548 - * overlap with @res and that have already been activated (mapped). 1549 - * 1550 - * This is a helper that allows drivers to place special requirements on memory 1551 - * region that may overlap with operation regions, primarily allowing them to 1552 - * safely map the region as non-cached memory. 1553 - * 1554 - * The unmapped Operation Regions will be automatically remapped next time they 1555 - * are called, so the drivers do not need to do anything else. 1556 - */ 1557 - acpi_status acpi_release_memory(acpi_handle handle, struct resource *res, 1558 - u32 level) 1559 - { 1560 - acpi_status status; 1561 - 1562 - if (!(res->flags & IORESOURCE_MEM)) 1563 - return AE_TYPE; 1564 - 1565 - status = acpi_walk_namespace(ACPI_TYPE_REGION, handle, level, 1566 - acpi_deactivate_mem_region, NULL, 1567 - res, NULL); 1568 - if (ACPI_FAILURE(status)) 1569 - return status; 1570 - 1571 - /* 1572 - * Wait for all of the mappings queued up for removal by 1573 - * acpi_deactivate_mem_region() to actually go away. 1574 - */ 1575 - synchronize_rcu(); 1576 - rcu_barrier(); 1577 - flush_scheduled_work(); 1578 - 1579 - return AE_OK; 1580 - } 1581 - EXPORT_SYMBOL_GPL(acpi_release_memory); 1582 1498 1583 1499 /* 1584 1500 * Let drivers know whether the resource checks are effective
+5 -5
drivers/acpi/processor_idle.c
··· 38 38 #define ACPI_IDLE_STATE_START (IS_ENABLED(CONFIG_ARCH_HAS_CPU_RELAX) ? 1 : 0) 39 39 40 40 static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; 41 - module_param(max_cstate, uint, 0000); 42 - static unsigned int nocst __read_mostly; 43 - module_param(nocst, uint, 0000); 44 - static int bm_check_disable __read_mostly; 45 - module_param(bm_check_disable, uint, 0000); 41 + module_param(max_cstate, uint, 0400); 42 + static bool nocst __read_mostly; 43 + module_param(nocst, bool, 0400); 44 + static bool bm_check_disable __read_mostly; 45 + module_param(bm_check_disable, bool, 0400); 46 46 47 47 static unsigned int latency_factor __read_mostly = 2; 48 48 module_param(latency_factor, uint, 0644);
+1
drivers/thermal/intel/int340x_thermal/int3400_thermal.c
··· 663 663 {"INT3400", 0}, 664 664 {"INTC1040", 0}, 665 665 {"INTC1041", 0}, 666 + {"INTC1042", 0}, 666 667 {"INTC10A0", 0}, 667 668 {} 668 669 };
+1
drivers/thermal/intel/int340x_thermal/int3403_thermal.c
··· 285 285 {"INT3403", 0}, 286 286 {"INTC1043", 0}, 287 287 {"INTC1046", 0}, 288 + {"INTC1062", 0}, 288 289 {"INTC10A1", 0}, 289 290 {"", 0}, 290 291 };
+6 -17
drivers/usb/typec/ucsi/ucsi_acpi.c
··· 19 19 struct ucsi_acpi { 20 20 struct device *dev; 21 21 struct ucsi *ucsi; 22 - void __iomem *base; 22 + void *base; 23 23 struct completion complete; 24 24 unsigned long flags; 25 25 guid_t guid; ··· 51 51 if (ret) 52 52 return ret; 53 53 54 - memcpy(val, (const void __force *)(ua->base + offset), val_len); 54 + memcpy(val, ua->base + offset, val_len); 55 55 56 56 return 0; 57 57 } ··· 61 61 { 62 62 struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); 63 63 64 - memcpy((void __force *)(ua->base + offset), val, val_len); 64 + memcpy(ua->base + offset, val, val_len); 65 65 66 66 return ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_WRITE); 67 67 } ··· 132 132 return -ENODEV; 133 133 } 134 134 135 - /* This will make sure we can use ioremap() */ 136 - status = acpi_release_memory(ACPI_HANDLE(&pdev->dev), res, 1); 137 - if (ACPI_FAILURE(status)) 138 - return -ENOMEM; 139 - 140 - /* 141 - * NOTE: The memory region for the data structures is used also in an 142 - * operation region, which means ACPI has already reserved it. Therefore 143 - * it can not be requested here, and we can not use 144 - * devm_ioremap_resource(). 145 - */ 146 - ua->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); 147 - if (!ua->base) 148 - return -ENOMEM; 135 + ua->base = devm_memremap(&pdev->dev, res->start, resource_size(res), MEMREMAP_WB); 136 + if (IS_ERR(ua->base)) 137 + return PTR_ERR(ua->base); 149 138 150 139 ret = guid_parse(UCSI_DSM_UUID, &ua->guid); 151 140 if (ret)
-3
include/linux/acpi.h
··· 520 520 int acpi_check_region(resource_size_t start, resource_size_t n, 521 521 const char *name); 522 522 523 - acpi_status acpi_release_memory(acpi_handle handle, struct resource *res, 524 - u32 level); 525 - 526 523 int acpi_resources_are_enforced(void); 527 524 528 525 #ifdef CONFIG_HIBERNATION