Merge branches 'acpi-tables', 'acpi-numa', 'acpi-sysfs', 'acpi-cppc', 'acpi-thermal' and 'acpi-battery'

Merge ACPI tables parsing code update, NUMA-related ACPI update, CPPC
documentation update, ACPI sysfs attributes handling update and ACPI
thermal and battery drivers updates for 5.17-rc1:

 - Add AEST to the list of known ACPI table signatures (Shuuichirou
   Ishii).

 - Make ACPI NUMA code take hotpluggable memblocks into account when
   CONFIG_MEMORY_HOTPLUG is not set (Vitaly Kuznetsov).

 - Use default_groups in kobj_type in the ACPI sysfs code (Greg
   Kroah-Hartman).

 - Rearrange _CPC structure documentation (Andy Shevchenko).

 - Drop an always true check from the ACPI thermal driver (Adam
   Borowski).

 - Add new "not charging" quirk for Lenovo ThinkPads to the ACPI
   battery driver (Thomas Weißschuh).

* acpi-tables:
  ACPI: tables: Add AEST to the list of known table signatures

* acpi-numa:
  ACPI: NUMA: Process hotpluggable memblocks when !CONFIG_MEMORY_HOTPLUG

* acpi-sysfs:
  ACPI: sysfs: use default_groups in kobj_type

* acpi-cppc:
  ACPI: CPPC: Amend documentation in the comments

* acpi-thermal:
  ACPI: thermal: drop an always true check

* acpi-battery:
  ACPI: battery: Add the ThinkPad "Not Charging" quirk
This commit is contained in:
Rafael J. Wysocki 2022-01-10 17:22:15 +01:00
Коммит 70df8e1bdc
7 изменённых файлов: 52 добавлений и 47 удалений

Просмотреть файл

@ -52,6 +52,7 @@ static bool battery_driver_registered;
static int battery_bix_broken_package; static int battery_bix_broken_package;
static int battery_notification_delay_ms; static int battery_notification_delay_ms;
static int battery_ac_is_broken; static int battery_ac_is_broken;
static int battery_quirk_notcharging;
static unsigned int cache_time = 1000; static unsigned int cache_time = 1000;
module_param(cache_time, uint, 0644); module_param(cache_time, uint, 0644);
MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@ -211,6 +212,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
val->intval = POWER_SUPPLY_STATUS_CHARGING; val->intval = POWER_SUPPLY_STATUS_CHARGING;
else if (acpi_battery_is_charged(battery)) else if (acpi_battery_is_charged(battery))
val->intval = POWER_SUPPLY_STATUS_FULL; val->intval = POWER_SUPPLY_STATUS_FULL;
else if (battery_quirk_notcharging)
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
else else
val->intval = POWER_SUPPLY_STATUS_UNKNOWN; val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
break; break;
@ -1098,6 +1101,12 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
return 0; 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 = { static const struct dmi_system_id bat_dmi_table[] __initconst = {
{ {
/* NEC LZ750/LS */ /* NEC LZ750/LS */
@ -1126,6 +1135,19 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"), 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"),
},
},
{}, {},
}; };

Просмотреть файл

@ -179,10 +179,11 @@ static struct attribute *cppc_attrs[] = {
&lowest_freq.attr, &lowest_freq.attr,
NULL NULL
}; };
ATTRIBUTE_GROUPS(cppc);
static struct kobj_type cppc_ktype = { static struct kobj_type cppc_ktype = {
.sysfs_ops = &kobj_sysfs_ops, .sysfs_ops = &kobj_sysfs_ops,
.default_attrs = cppc_attrs, .default_groups = cppc_groups,
}; };
static int check_pcc_chan(int pcc_ss_id, bool chk_err_bit) static int check_pcc_chan(int pcc_ss_id, bool chk_err_bit)
@ -604,47 +605,30 @@ static bool is_cppc_supported(int revision, int num_ent)
/* /*
* An example CPC table looks like the following. * An example CPC table looks like the following.
* *
* Name(_CPC, Package() * Name (_CPC, Package() {
* { * 17, // NumEntries
* 17, * 1, // Revision
* NumEntries * ResourceTemplate() {Register(PCC, 32, 0, 0x120, 2)}, // Highest Performance
* 1, * ResourceTemplate() {Register(PCC, 32, 0, 0x124, 2)}, // Nominal Performance
* // Revision * ResourceTemplate() {Register(PCC, 32, 0, 0x128, 2)}, // Lowest Nonlinear Performance
* ResourceTemplate(){Register(PCC, 32, 0, 0x120, 2)}, * ResourceTemplate() {Register(PCC, 32, 0, 0x12C, 2)}, // Lowest Performance
* // Highest Performance * ResourceTemplate() {Register(PCC, 32, 0, 0x130, 2)}, // Guaranteed Performance Register
* ResourceTemplate(){Register(PCC, 32, 0, 0x124, 2)}, * ResourceTemplate() {Register(PCC, 32, 0, 0x110, 2)}, // Desired Performance Register
* // Nominal Performance * ResourceTemplate() {Register(SystemMemory, 0, 0, 0, 0)},
* ResourceTemplate(){Register(PCC, 32, 0, 0x128, 2)}, * ...
* // Lowest Nonlinear Performance * ...
* ResourceTemplate(){Register(PCC, 32, 0, 0x12C, 2)}, * ...
* // Lowest Performance * }
* ResourceTemplate(){Register(PCC, 32, 0, 0x130, 2)},
* // Guaranteed Performance Register
* ResourceTemplate(){Register(PCC, 32, 0, 0x110, 2)},
* // Desired Performance Register
* ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)},
* ..
* ..
* ..
*
* }
* Each Register() encodes how to access that specific register. * Each Register() encodes how to access that specific register.
* e.g. a sample PCC entry has the following encoding: * e.g. a sample PCC entry has the following encoding:
* *
* Register ( * Register (
* PCC, * PCC, // AddressSpaceKeyword
* AddressSpaceKeyword * 8, // RegisterBitWidth
* 8, * 8, // RegisterBitOffset
* //RegisterBitWidth * 0x30, // RegisterAddress
* 8, * 9, // AccessSize (subspace ID)
* //RegisterBitOffset * )
* 0x30,
* //RegisterAddress
* 9
* //AccessSize (subspace ID)
* 0
* )
* }
*/ */
#ifndef init_freq_invariance_cppc #ifndef init_freq_invariance_cppc

Просмотреть файл

@ -53,6 +53,7 @@ static struct attribute *acpi_data_node_default_attrs[] = {
&data_node_path.attr, &data_node_path.attr,
NULL NULL
}; };
ATTRIBUTE_GROUPS(acpi_data_node_default);
#define to_data_node(k) container_of(k, struct acpi_data_node, kobj) #define to_data_node(k) container_of(k, struct acpi_data_node, kobj)
#define to_attr(a) container_of(a, struct acpi_data_node_attr, attr) #define to_attr(a) container_of(a, struct acpi_data_node_attr, attr)
@ -79,7 +80,7 @@ static void acpi_data_node_release(struct kobject *kobj)
static struct kobj_type acpi_data_node_ktype = { static struct kobj_type acpi_data_node_ktype = {
.sysfs_ops = &acpi_data_node_sysfs_ops, .sysfs_ops = &acpi_data_node_sysfs_ops,
.default_attrs = acpi_data_node_default_attrs, .default_groups = acpi_data_node_default_groups,
.release = acpi_data_node_release, .release = acpi_data_node_release,
}; };

Просмотреть файл

@ -254,9 +254,8 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
} }
if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0) if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
goto out_err; goto out_err;
hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE; hotpluggable = IS_ENABLED(CONFIG_MEMORY_HOTPLUG) &&
if (hotpluggable && !IS_ENABLED(CONFIG_MEMORY_HOTPLUG)) (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE);
goto out_err;
start = ma->base_address; start = ma->base_address;
end = start + ma->length; end = start + ma->length;

Просмотреть файл

@ -939,10 +939,11 @@ static struct attribute *hotplug_profile_attrs[] = {
&hotplug_enabled_attr.attr, &hotplug_enabled_attr.attr,
NULL NULL
}; };
ATTRIBUTE_GROUPS(hotplug_profile);
static struct kobj_type acpi_hotplug_profile_ktype = { static struct kobj_type acpi_hotplug_profile_ktype = {
.sysfs_ops = &kobj_sysfs_ops, .sysfs_ops = &kobj_sysfs_ops,
.default_attrs = hotplug_profile_attrs, .default_groups = hotplug_profile_groups,
}; };
void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug, void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug,

Просмотреть файл

@ -500,7 +500,7 @@ static const char table_sigs[][ACPI_NAMESEG_SIZE] __initconst = {
ACPI_SIG_WDDT, ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT, ACPI_SIG_WDDT, ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT,
ACPI_SIG_PSDT, ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, ACPI_SIG_PSDT, ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT,
ACPI_SIG_IORT, ACPI_SIG_NFIT, ACPI_SIG_HMAT, ACPI_SIG_PPTT, ACPI_SIG_IORT, ACPI_SIG_NFIT, ACPI_SIG_HMAT, ACPI_SIG_PPTT,
ACPI_SIG_NHLT }; ACPI_SIG_NHLT, ACPI_SIG_AEST };
#define ACPI_HEADER_SIZE sizeof(struct acpi_table_header) #define ACPI_HEADER_SIZE sizeof(struct acpi_table_header)

Просмотреть файл

@ -1097,8 +1097,6 @@ static int acpi_thermal_resume(struct device *dev)
return -EINVAL; return -EINVAL;
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
if (!(&tz->trips.active[i]))
break;
if (!tz->trips.active[i].flags.valid) if (!tz->trips.active[i].flags.valid)
break; break;
tz->trips.active[i].flags.enabled = 1; tz->trips.active[i].flags.enabled = 1;