More ACPI updates for 5.19-rc1

- 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).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmKU8QcSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxiAsP/R4BxpJckE0s1UzOIkbarRi0TKPAIOCQ
 sgnOwqftgT5KS82wBozdZw6zg0R0ERhCy6x4b3KIpwo8pdkRGP1bNtajvuAFExUe
 BihXTkpMTNrRt4H/MgER/I2Tq8WPY+5WSDqUb0ae1WWela0zI0jiLNjXD4JYq78V
 xrvsdZ5Evj8Mo43t8aQJFTD1MeTIrFaRArRXURAmg2NP3RvN3J7C3AQuQGhzq0fV
 Jb1530WroUx9DpRgXkuMS0h826WLWfMtzuaP3vyy2wTxIPBWgAindvP+J66VGiM2
 LYvGfX8gI3hwwz9++pOYaN1zzfNKRiO9JYAQ8KRpznb+As3zKm+R7T9+quFTtRzz
 ty+6bGj3I0P6Sjy8FTe2F9IN3W34E+UeZLZWf6eGFvNSkUUddFjsjzXG8SGorO6H
 68IT51eNjh35x/jq9dMRZHBc8bxTNE7GAevOynLhxc7+PJrh2NHva4HeejJFelzb
 BQApnhJ25dn0hwZ+KY68e0jBHs0jiW8Brb5BcNv9HvhOqKRQMfCvfpvH+RVM+Ro6
 d7DsU0An2x2hRoe7ybfdSX4R7iPdZmoTECiiaJqB8Yv5/zwHwCfd7oT3t8UDvjVA
 a+w66sEMPDPEfQtYNKvO79ITvDch/0oUGs8pwAkGlTQqp09uqmAtw384wXg3HajV
 ifWNHaYBSdLV
 =rROP
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Linus Torvalds 2022-05-30 11:30:16 -07:00
commit 527953ef71
15 changed files with 53 additions and 162 deletions

View file

@ -32,7 +32,6 @@ MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION("ACPI AC Adapter Driver");
MODULE_LICENSE("GPL");
static int acpi_ac_add(struct acpi_device *device);
static int acpi_ac_remove(struct acpi_device *device);
static void acpi_ac_notify(struct acpi_device *device, u32 event);
@ -125,6 +124,7 @@ static int get_ac_property(struct power_supply *psy,
default:
return -EINVAL;
}
return 0;
}
@ -286,6 +286,7 @@ static int acpi_ac_resume(struct device *dev)
return 0;
if (old_state != ac->state)
kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE);
return 0;
}
#else
@ -296,7 +297,6 @@ static int acpi_ac_remove(struct acpi_device *device)
{
struct acpi_ac *ac = NULL;
if (!device || !acpi_driver_data(device))
return -EINVAL;

View file

@ -1707,24 +1707,23 @@ static int acpi_video_resume(struct notifier_block *nb,
int i;
switch (val) {
case PM_HIBERNATION_PREPARE:
case PM_SUSPEND_PREPARE:
case PM_RESTORE_PREPARE:
return NOTIFY_DONE;
case PM_POST_HIBERNATION:
case PM_POST_SUSPEND:
case PM_POST_RESTORE:
video = container_of(nb, struct acpi_video_bus, pm_nb);
dev_info(&video->device->dev, "Restoring backlight state\n");
for (i = 0; i < video->attached_count; i++) {
video_device = video->attached_array[i].bind_info;
if (video_device && video_device->brightness)
acpi_video_device_lcd_set_level(video_device,
video_device->brightness->curr);
}
return NOTIFY_OK;
}
video = container_of(nb, struct acpi_video_bus, pm_nb);
dev_info(&video->device->dev, "Restoring backlight state\n");
for (i = 0; i < video->attached_count; i++) {
video_device = video->attached_array[i].bind_info;
if (video_device && video_device->brightness)
acpi_video_device_lcd_set_level(video_device,
video_device->brightness->curr);
}
return NOTIFY_OK;
return NOTIFY_DONE;
}
static acpi_status

View file

@ -52,7 +52,6 @@ static bool battery_driver_registered;
static int battery_bix_broken_package;
static int battery_notification_delay_ms;
static int battery_ac_is_broken;
static int battery_quirk_notcharging;
static unsigned int cache_time = 1000;
module_param(cache_time, uint, 0644);
MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@ -216,10 +215,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
val->intval = POWER_SUPPLY_STATUS_CHARGING;
else if (acpi_battery_is_charged(battery))
val->intval = POWER_SUPPLY_STATUS_FULL;
else if (battery_quirk_notcharging)
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
else
val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
break;
case POWER_SUPPLY_PROP_PRESENT:
val->intval = acpi_battery_present(battery);
@ -1105,12 +1102,6 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
return 0;
}
static int __init battery_quirk_not_charging(const struct dmi_system_id *d)
{
battery_quirk_notcharging = 1;
return 0;
}
static const struct dmi_system_id bat_dmi_table[] __initconst = {
{
/* NEC LZ750/LS */
@ -1139,19 +1130,6 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
},
},
{
/*
* On Lenovo ThinkPads the BIOS specification defines
* a state when the bits for charging and discharging
* are both set to 0. That state is "Not Charging".
*/
.callback = battery_quirk_not_charging,
.ident = "Lenovo ThinkPad",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"),
},
},
{
/* Microsoft Surface Go 3 */
.callback = battery_notification_delay_quirk,

View file

@ -315,7 +315,7 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
goto end;
}
/* wait for completion and check for PCC errro bit */
/* wait for completion and check for PCC error bit */
ret = check_pcc_chan(pcc_ss_id, true);
if (pcc_ss_data->pcc_mrtt)

View file

@ -151,6 +151,7 @@ static int pch_fivr_remove(struct platform_device *pdev)
static const struct acpi_device_id pch_fivr_device_ids[] = {
{"INTC1045", 0},
{"INTC1049", 0},
{"INTC1064", 0},
{"INTC10A3", 0},
{"", 0},
};

View file

@ -232,6 +232,8 @@ static const struct acpi_device_id int3407_device_ids[] = {
{"INTC1050", 0},
{"INTC1060", 0},
{"INTC1061", 0},
{"INTC1065", 0},
{"INTC1066", 0},
{"INTC10A4", 0},
{"INTC10A5", 0},
{"", 0},

View file

@ -27,6 +27,7 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = {
{"INT3532"},
{"INTC1040"},
{"INTC1041"},
{"INTC1042"},
{"INTC1043"},
{"INTC1044"},
{"INTC1045"},
@ -37,6 +38,11 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = {
{"INTC1050"},
{"INTC1060"},
{"INTC1061"},
{"INTC1062"},
{"INTC1063"},
{"INTC1064"},
{"INTC1065"},
{"INTC1066"},
{"INTC10A0"},
{"INTC10A1"},
{"INTC10A2"},

View file

@ -14,6 +14,7 @@
{"INT3404", }, /* Fan */ \
{"INTC1044", }, /* Fan for Tiger Lake generation */ \
{"INTC1048", }, /* Fan for Alder Lake generation */ \
{"INTC1063", }, /* Fan for Meteor Lake generation */ \
{"INTC10A2", }, /* Fan for Raptor Lake generation */ \
{"PNP0C0B", } /* Generic ACPI fan */

View file

@ -79,17 +79,17 @@ static struct acpi_bus_type *acpi_get_bus_type(struct device *dev)
static int find_child_checks(struct acpi_device *adev, bool check_children)
{
bool sta_present = true;
unsigned long long sta;
acpi_status status;
status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
if (status == AE_NOT_FOUND)
sta_present = false;
else if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
if (check_children && list_empty(&adev->children))
return -ENODEV;
if (check_children && list_empty(&adev->children))
status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
if (status == AE_NOT_FOUND)
return FIND_CHILD_MIN_SCORE;
if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED))
return -ENODEV;
/*
@ -99,8 +99,10 @@ static int find_child_checks(struct acpi_device *adev, bool check_children)
* matched going forward. [This means a second spec violation in a row,
* so whatever we do here is best effort anyway.]
*/
return sta_present && !adev->pnp.type.platform_id ?
FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE;
if (adev->pnp.type.platform_id)
return FIND_CHILD_MIN_SCORE;
return FIND_CHILD_MAX_SCORE;
}
struct acpi_device *acpi_find_child_device(struct acpi_device *parent,

View file

@ -36,7 +36,6 @@
#include <linux/io-64-nonatomic-lo-hi.h>
#include "acpica/accommon.h"
#include "acpica/acnamesp.h"
#include "internal.h"
/* Definitions for ACPI_DEBUG_PRINT() */
@ -1496,91 +1495,6 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
}
EXPORT_SYMBOL(acpi_check_region);
static acpi_status acpi_deactivate_mem_region(acpi_handle handle, u32 level,
void *_res, void **return_value)
{
struct acpi_mem_space_context **mem_ctx;
union acpi_operand_object *handler_obj;
union acpi_operand_object *region_obj2;
union acpi_operand_object *region_obj;
struct resource *res = _res;
acpi_status status;
region_obj = acpi_ns_get_attached_object(handle);
if (!region_obj)
return AE_OK;
handler_obj = region_obj->region.handler;
if (!handler_obj)
return AE_OK;
if (region_obj->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
return AE_OK;
if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE))
return AE_OK;
region_obj2 = acpi_ns_get_secondary_object(region_obj);
if (!region_obj2)
return AE_OK;
mem_ctx = (void *)&region_obj2->extra.region_context;
if (!(mem_ctx[0]->address >= res->start &&
mem_ctx[0]->address < res->end))
return AE_OK;
status = handler_obj->address_space.setup(region_obj,
ACPI_REGION_DEACTIVATE,
NULL, (void **)mem_ctx);
if (ACPI_SUCCESS(status))
region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);
return status;
}
/**
* acpi_release_memory - Release any mappings done to a memory region
* @handle: Handle to namespace node
* @res: Memory resource
* @level: A level that terminates the search
*
* Walks through @handle and unmaps all SystemMemory Operation Regions that
* overlap with @res and that have already been activated (mapped).
*
* This is a helper that allows drivers to place special requirements on memory
* region that may overlap with operation regions, primarily allowing them to
* safely map the region as non-cached memory.
*
* The unmapped Operation Regions will be automatically remapped next time they
* are called, so the drivers do not need to do anything else.
*/
acpi_status acpi_release_memory(acpi_handle handle, struct resource *res,
u32 level)
{
acpi_status status;
if (!(res->flags & IORESOURCE_MEM))
return AE_TYPE;
status = acpi_walk_namespace(ACPI_TYPE_REGION, handle, level,
acpi_deactivate_mem_region, NULL,
res, NULL);
if (ACPI_FAILURE(status))
return status;
/*
* Wait for all of the mappings queued up for removal by
* acpi_deactivate_mem_region() to actually go away.
*/
synchronize_rcu();
rcu_barrier();
flush_scheduled_work();
return AE_OK;
}
EXPORT_SYMBOL_GPL(acpi_release_memory);
/*
* Let drivers know whether the resource checks are effective
*/

View file

@ -38,11 +38,11 @@
#define ACPI_IDLE_STATE_START (IS_ENABLED(CONFIG_ARCH_HAS_CPU_RELAX) ? 1 : 0)
static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
module_param(max_cstate, uint, 0000);
static unsigned int nocst __read_mostly;
module_param(nocst, uint, 0000);
static int bm_check_disable __read_mostly;
module_param(bm_check_disable, uint, 0000);
module_param(max_cstate, uint, 0400);
static bool nocst __read_mostly;
module_param(nocst, bool, 0400);
static bool bm_check_disable __read_mostly;
module_param(bm_check_disable, bool, 0400);
static unsigned int latency_factor __read_mostly = 2;
module_param(latency_factor, uint, 0644);

View file

@ -663,6 +663,7 @@ static const struct acpi_device_id int3400_thermal_match[] = {
{"INT3400", 0},
{"INTC1040", 0},
{"INTC1041", 0},
{"INTC1042", 0},
{"INTC10A0", 0},
{}
};

View file

@ -285,6 +285,7 @@ static const struct acpi_device_id int3403_device_ids[] = {
{"INT3403", 0},
{"INTC1043", 0},
{"INTC1046", 0},
{"INTC1062", 0},
{"INTC10A1", 0},
{"", 0},
};

View file

@ -19,7 +19,7 @@
struct ucsi_acpi {
struct device *dev;
struct ucsi *ucsi;
void __iomem *base;
void *base;
struct completion complete;
unsigned long flags;
guid_t guid;
@ -51,7 +51,7 @@ static int ucsi_acpi_read(struct ucsi *ucsi, unsigned int offset,
if (ret)
return ret;
memcpy(val, (const void __force *)(ua->base + offset), val_len);
memcpy(val, ua->base + offset, val_len);
return 0;
}
@ -61,7 +61,7 @@ static int ucsi_acpi_async_write(struct ucsi *ucsi, unsigned int offset,
{
struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
memcpy((void __force *)(ua->base + offset), val, val_len);
memcpy(ua->base + offset, val, val_len);
return ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_WRITE);
}
@ -132,20 +132,9 @@ static int ucsi_acpi_probe(struct platform_device *pdev)
return -ENODEV;
}
/* This will make sure we can use ioremap() */
status = acpi_release_memory(ACPI_HANDLE(&pdev->dev), res, 1);
if (ACPI_FAILURE(status))
return -ENOMEM;
/*
* NOTE: The memory region for the data structures is used also in an
* operation region, which means ACPI has already reserved it. Therefore
* it can not be requested here, and we can not use
* devm_ioremap_resource().
*/
ua->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
if (!ua->base)
return -ENOMEM;
ua->base = devm_memremap(&pdev->dev, res->start, resource_size(res), MEMREMAP_WB);
if (IS_ERR(ua->base))
return PTR_ERR(ua->base);
ret = guid_parse(UCSI_DSM_UUID, &ua->guid);
if (ret)

View file

@ -520,9 +520,6 @@ int acpi_check_resource_conflict(const struct resource *res);
int acpi_check_region(resource_size_t start, resource_size_t n,
const char *name);
acpi_status acpi_release_memory(acpi_handle handle, struct resource *res,
u32 level);
int acpi_resources_are_enforced(void);
#ifdef CONFIG_HIBERNATION