Skip to content

Commit 70df8e1

Browse files
committed
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
7 parents af8fefd + 7e29a22 + bcf6f17 + 17f1841 + 1a901c9 + e5b5d25 + e96c119 commit 70df8e1

File tree

7 files changed

+52
-47
lines changed

7 files changed

+52
-47
lines changed

drivers/acpi/battery.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static bool battery_driver_registered;
5252
static int battery_bix_broken_package;
5353
static int battery_notification_delay_ms;
5454
static int battery_ac_is_broken;
55+
static int battery_quirk_notcharging;
5556
static unsigned int cache_time = 1000;
5657
module_param(cache_time, uint, 0644);
5758
MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -211,6 +212,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
211212
val->intval = POWER_SUPPLY_STATUS_CHARGING;
212213
else if (acpi_battery_is_charged(battery))
213214
val->intval = POWER_SUPPLY_STATUS_FULL;
215+
else if (battery_quirk_notcharging)
216+
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
214217
else
215218
val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
216219
break;
@@ -1098,6 +1101,12 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
10981101
return 0;
10991102
}
11001103

1104+
static int __init battery_quirk_not_charging(const struct dmi_system_id *d)
1105+
{
1106+
battery_quirk_notcharging = 1;
1107+
return 0;
1108+
}
1109+
11011110
static const struct dmi_system_id bat_dmi_table[] __initconst = {
11021111
{
11031112
/* NEC LZ750/LS */
@@ -1126,6 +1135,19 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
11261135
DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
11271136
},
11281137
},
1138+
{
1139+
/*
1140+
* On Lenovo ThinkPads the BIOS specification defines
1141+
* a state when the bits for charging and discharging
1142+
* are both set to 0. That state is "Not Charging".
1143+
*/
1144+
.callback = battery_quirk_not_charging,
1145+
.ident = "Lenovo ThinkPad",
1146+
.matches = {
1147+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1148+
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"),
1149+
},
1150+
},
11291151
{},
11301152
};
11311153

drivers/acpi/cppc_acpi.c

Lines changed: 23 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,11 @@ static struct attribute *cppc_attrs[] = {
179179
&lowest_freq.attr,
180180
NULL
181181
};
182+
ATTRIBUTE_GROUPS(cppc);
182183

183184
static struct kobj_type cppc_ktype = {
184185
.sysfs_ops = &kobj_sysfs_ops,
185-
.default_attrs = cppc_attrs,
186+
.default_groups = cppc_groups,
186187
};
187188

188189
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)
604605
/*
605606
* An example CPC table looks like the following.
606607
*
607-
* Name(_CPC, Package()
608-
* {
609-
* 17,
610-
* NumEntries
611-
* 1,
612-
* // Revision
613-
* ResourceTemplate(){Register(PCC, 32, 0, 0x120, 2)},
614-
* // Highest Performance
615-
* ResourceTemplate(){Register(PCC, 32, 0, 0x124, 2)},
616-
* // Nominal Performance
617-
* ResourceTemplate(){Register(PCC, 32, 0, 0x128, 2)},
618-
* // Lowest Nonlinear Performance
619-
* ResourceTemplate(){Register(PCC, 32, 0, 0x12C, 2)},
620-
* // Lowest Performance
621-
* ResourceTemplate(){Register(PCC, 32, 0, 0x130, 2)},
622-
* // Guaranteed Performance Register
623-
* ResourceTemplate(){Register(PCC, 32, 0, 0x110, 2)},
624-
* // Desired Performance Register
625-
* ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)},
626-
* ..
627-
* ..
628-
* ..
629-
*
630-
* }
608+
* Name (_CPC, Package() {
609+
* 17, // NumEntries
610+
* 1, // Revision
611+
* ResourceTemplate() {Register(PCC, 32, 0, 0x120, 2)}, // Highest Performance
612+
* ResourceTemplate() {Register(PCC, 32, 0, 0x124, 2)}, // Nominal Performance
613+
* ResourceTemplate() {Register(PCC, 32, 0, 0x128, 2)}, // Lowest Nonlinear Performance
614+
* ResourceTemplate() {Register(PCC, 32, 0, 0x12C, 2)}, // Lowest Performance
615+
* ResourceTemplate() {Register(PCC, 32, 0, 0x130, 2)}, // Guaranteed Performance Register
616+
* ResourceTemplate() {Register(PCC, 32, 0, 0x110, 2)}, // Desired Performance Register
617+
* ResourceTemplate() {Register(SystemMemory, 0, 0, 0, 0)},
618+
* ...
619+
* ...
620+
* ...
621+
* }
631622
* Each Register() encodes how to access that specific register.
632623
* e.g. a sample PCC entry has the following encoding:
633624
*
634-
* Register (
635-
* PCC,
636-
* AddressSpaceKeyword
637-
* 8,
638-
* //RegisterBitWidth
639-
* 8,
640-
* //RegisterBitOffset
641-
* 0x30,
642-
* //RegisterAddress
643-
* 9
644-
* //AccessSize (subspace ID)
645-
* 0
646-
* )
647-
* }
625+
* Register (
626+
* PCC, // AddressSpaceKeyword
627+
* 8, // RegisterBitWidth
628+
* 8, // RegisterBitOffset
629+
* 0x30, // RegisterAddress
630+
* 9, // AccessSize (subspace ID)
631+
* )
648632
*/
649633

650634
#ifndef init_freq_invariance_cppc

drivers/acpi/device_sysfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ static struct attribute *acpi_data_node_default_attrs[] = {
5353
&data_node_path.attr,
5454
NULL
5555
};
56+
ATTRIBUTE_GROUPS(acpi_data_node_default);
5657

5758
#define to_data_node(k) container_of(k, struct acpi_data_node, kobj)
5859
#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)
7980

8081
static struct kobj_type acpi_data_node_ktype = {
8182
.sysfs_ops = &acpi_data_node_sysfs_ops,
82-
.default_attrs = acpi_data_node_default_attrs,
83+
.default_groups = acpi_data_node_default_groups,
8384
.release = acpi_data_node_release,
8485
};
8586

drivers/acpi/numa/srat.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,8 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
254254
}
255255
if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
256256
goto out_err;
257-
hotpluggable = ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE;
258-
if (hotpluggable && !IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
259-
goto out_err;
257+
hotpluggable = IS_ENABLED(CONFIG_MEMORY_HOTPLUG) &&
258+
(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE);
260259

261260
start = ma->base_address;
262261
end = start + ma->length;

drivers/acpi/sysfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,10 +939,11 @@ static struct attribute *hotplug_profile_attrs[] = {
939939
&hotplug_enabled_attr.attr,
940940
NULL
941941
};
942+
ATTRIBUTE_GROUPS(hotplug_profile);
942943

943944
static struct kobj_type acpi_hotplug_profile_ktype = {
944945
.sysfs_ops = &kobj_sysfs_ops,
945-
.default_attrs = hotplug_profile_attrs,
946+
.default_groups = hotplug_profile_groups,
946947
};
947948

948949
void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug,

drivers/acpi/tables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ static const char table_sigs[][ACPI_NAMESEG_SIZE] __initconst = {
500500
ACPI_SIG_WDDT, ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT,
501501
ACPI_SIG_PSDT, ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT,
502502
ACPI_SIG_IORT, ACPI_SIG_NFIT, ACPI_SIG_HMAT, ACPI_SIG_PPTT,
503-
ACPI_SIG_NHLT };
503+
ACPI_SIG_NHLT, ACPI_SIG_AEST };
504504

505505
#define ACPI_HEADER_SIZE sizeof(struct acpi_table_header)
506506

drivers/acpi/thermal.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,8 +1097,6 @@ static int acpi_thermal_resume(struct device *dev)
10971097
return -EINVAL;
10981098

10991099
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
1100-
if (!(&tz->trips.active[i]))
1101-
break;
11021100
if (!tz->trips.active[i].flags.valid)
11031101
break;
11041102
tz->trips.active[i].flags.enabled = 1;

0 commit comments

Comments
 (0)