Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 923a327

Browse files
committed
Merge tag 'acpi-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki: "The only kind of new feature added by these is the hwmon interface support in the ACPI fan driver. Apart from that, they mostly address issues and clean up code. Specifics: - Switch the ACPI x86 utility code and the ACPI LPSS driver to new Intel CPU model defines (Tony Luck) - Add hwmon interface support to the ACPI fan driver (Armin Wolf) - Add sysfs entry for guaranteed performance to the ACPI CPPC library and replace a ternary operator with umax() in it (Petr Tesařík, Prabhakar Pujeri) - Clean up the ACPI PMIC driver in multiple ways (Andy Shevchenko, Christophe JAILLET) - Add support for charge limiting state to the ACPI battery driver and update _OSC to indicate support for it (Armin Wolf) - Clean up the sysfs interface in the ACPI battery, SBS (smart battery subsystem) and AC drivers (Thomas Weißschuh) - Coordinate header includes in the ACPI NUMA code and make it use ACCESS_COORDINATE_CPU when appropriate (Huang Ying, Thorsten Blum) - Downgrade Intel _OSC and _PDC messages in the ACPI processor driver to debug to reduce log noise (Mario Limonciello) - Still evaluate _OST when _PUR evaluation fails in the ACPI PAD (processor aggregator) driver as per the spec (Armin Wolf) - Skip ACPI IRQ override on Asus Vivobook Pro N6506MJ and N6506MU platforms (Tamim Khan) - Force native mode on some T2 macbooks in the ACPI backlight driver and replace strcpy() with strscpy() in it (Orlando Chamberlain, Muhammad Qasim Abdul Majeed) - Add missing MODULE_DESCRIPTION() macros in two places (Jeff Johnson)" * tag 'acpi-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (26 commits) ACPI: resource: Skip IRQ override on Asus Vivobook Pro N6506MJ ACPI: video: force native for some T2 macbooks ACPI: video: Use strscpy() instead of strcpy() ACPI: CPPC: Replace ternary operator with umax() ACPI: resource: Skip IRQ override on Asus Vivobook Pro N6506MU ACPI: PMIC: Constify struct pmic_table ACPI: bus: Indicate support for battery charge limiting thru _OSC ACPI: battery: Add support for charge limiting state ACPI: processor: Downgrade Intel _OSC and _PDC messages to debug ACPI: SBS: manage alarm sysfs attribute through psy core ACPI: battery: create alarm sysfs attribute atomically ACPI: battery: use sysfs_emit over sprintf ACPI: battery: constify powersupply properties ACPI: SBS: constify powersupply properties ACPI: AC: constify powersupply properties ACPI: PMIC: Replace open coded be16_to_cpu() ACPI: PMIC: Convert pr_*() to dev_*() printing macros ACPI: PMIC: Use sizeof() instead of hard coded value ACPI: NUMA: Consolidate header includes ACPI: CPPC: add sysfs entry for guaranteed performance ...
2 parents 4190624 + b77b0bc commit 923a327

27 files changed

+338
-91
lines changed

drivers/acpi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ obj-$(CONFIG_ACPI_TINY_POWER_BUTTON) += tiny-power-button.o
7777
obj-$(CONFIG_ACPI_FAN) += fan.o
7878
fan-objs := fan_core.o
7979
fan-objs += fan_attr.o
80+
fan-$(CONFIG_HWMON) += fan_hwmon.o
8081

8182
obj-$(CONFIG_ACPI_VIDEO) += video.o
8283
obj-$(CONFIG_ACPI_TAD) += acpi_tad.o

drivers/acpi/ac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static int get_ac_property(struct power_supply *psy,
112112
return 0;
113113
}
114114

115-
static enum power_supply_property ac_props[] = {
115+
static const enum power_supply_property ac_props[] = {
116116
POWER_SUPPLY_PROP_ONLINE,
117117
};
118118

drivers/acpi/acpi_pad.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
#define ACPI_PROCESSOR_AGGREGATOR_CLASS "acpi_pad"
2626
#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
2727
#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
28+
29+
#define ACPI_PROCESSOR_AGGREGATOR_STATUS_SUCCESS 0
30+
#define ACPI_PROCESSOR_AGGREGATOR_STATUS_NO_ACTION 1
31+
2832
static DEFINE_MUTEX(isolated_cpus_lock);
2933
static DEFINE_MUTEX(round_robin_lock);
3034

@@ -382,16 +386,23 @@ static void acpi_pad_handle_notify(acpi_handle handle)
382386
.length = 4,
383387
.pointer = (void *)&idle_cpus,
384388
};
389+
u32 status;
385390

386391
mutex_lock(&isolated_cpus_lock);
387392
num_cpus = acpi_pad_pur(handle);
388393
if (num_cpus < 0) {
389-
mutex_unlock(&isolated_cpus_lock);
390-
return;
394+
/* The ACPI specification says that if no action was performed when
395+
* processing the _PUR object, _OST should still be evaluated, albeit
396+
* with a different status code.
397+
*/
398+
status = ACPI_PROCESSOR_AGGREGATOR_STATUS_NO_ACTION;
399+
} else {
400+
status = ACPI_PROCESSOR_AGGREGATOR_STATUS_SUCCESS;
401+
acpi_pad_idle_cpus(num_cpus);
391402
}
392-
acpi_pad_idle_cpus(num_cpus);
403+
393404
idle_cpus = acpi_pad_idle_cpus_num();
394-
acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, 0, &param);
405+
acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, status, &param);
395406
mutex_unlock(&isolated_cpus_lock);
396407
}
397408

drivers/acpi/acpi_processor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,9 @@ static bool __init acpi_early_processor_osc(void)
619619
void __init acpi_early_processor_control_setup(void)
620620
{
621621
if (acpi_early_processor_osc()) {
622-
pr_info("_OSC evaluated successfully for all CPUs\n");
622+
pr_debug("_OSC evaluated successfully for all CPUs\n");
623623
} else {
624-
pr_info("_OSC evaluation for CPUs failed, trying _PDC\n");
624+
pr_debug("_OSC evaluation for CPUs failed, trying _PDC\n");
625625
acpi_early_processor_set_pdc();
626626
}
627627
}

drivers/acpi/acpi_tad.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/pm_runtime.h>
2828
#include <linux/suspend.h>
2929

30+
MODULE_DESCRIPTION("ACPI Time and Alarm (TAD) Device Driver");
3031
MODULE_LICENSE("GPL v2");
3132
MODULE_AUTHOR("Rafael J. Wysocki");
3233

drivers/acpi/acpi_video.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,8 +1128,8 @@ static int acpi_video_bus_get_one_device(struct acpi_device *device, void *arg)
11281128
return -ENOMEM;
11291129
}
11301130

1131-
strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
1132-
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
1131+
strscpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
1132+
strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
11331133

11341134
data->device_id = device_id;
11351135
data->video = video;
@@ -2010,8 +2010,8 @@ static int acpi_video_bus_add(struct acpi_device *device)
20102010
}
20112011

20122012
video->device = device;
2013-
strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
2014-
strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
2013+
strscpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
2014+
strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
20152015
device->driver_data = video;
20162016

20172017
acpi_video_bus_find_cap(video);

drivers/acpi/battery.c

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@
3838
/* Battery power unit: 0 means mW, 1 means mA */
3939
#define ACPI_BATTERY_POWER_UNIT_MA 1
4040

41-
#define ACPI_BATTERY_STATE_DISCHARGING 0x1
42-
#define ACPI_BATTERY_STATE_CHARGING 0x2
43-
#define ACPI_BATTERY_STATE_CRITICAL 0x4
41+
#define ACPI_BATTERY_STATE_DISCHARGING 0x1
42+
#define ACPI_BATTERY_STATE_CHARGING 0x2
43+
#define ACPI_BATTERY_STATE_CRITICAL 0x4
44+
#define ACPI_BATTERY_STATE_CHARGE_LIMITING 0x8
4445

4546
#define MAX_STRING_LENGTH 64
4647

@@ -155,7 +156,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery);
155156

156157
static int acpi_battery_is_charged(struct acpi_battery *battery)
157158
{
158-
/* charging, discharging or critical low */
159+
/* charging, discharging, critical low or charge limited */
159160
if (battery->state != 0)
160161
return 0;
161162

@@ -215,6 +216,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
215216
val->intval = acpi_battery_handle_discharging(battery);
216217
else if (battery->state & ACPI_BATTERY_STATE_CHARGING)
217218
val->intval = POWER_SUPPLY_STATUS_CHARGING;
219+
else if (battery->state & ACPI_BATTERY_STATE_CHARGE_LIMITING)
220+
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
218221
else if (acpi_battery_is_charged(battery))
219222
val->intval = POWER_SUPPLY_STATUS_FULL;
220223
else
@@ -308,7 +311,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
308311
return ret;
309312
}
310313

311-
static enum power_supply_property charge_battery_props[] = {
314+
static const enum power_supply_property charge_battery_props[] = {
312315
POWER_SUPPLY_PROP_STATUS,
313316
POWER_SUPPLY_PROP_PRESENT,
314317
POWER_SUPPLY_PROP_TECHNOLOGY,
@@ -326,7 +329,7 @@ static enum power_supply_property charge_battery_props[] = {
326329
POWER_SUPPLY_PROP_SERIAL_NUMBER,
327330
};
328331

329-
static enum power_supply_property charge_battery_full_cap_broken_props[] = {
332+
static const enum power_supply_property charge_battery_full_cap_broken_props[] = {
330333
POWER_SUPPLY_PROP_STATUS,
331334
POWER_SUPPLY_PROP_PRESENT,
332335
POWER_SUPPLY_PROP_TECHNOLOGY,
@@ -340,7 +343,7 @@ static enum power_supply_property charge_battery_full_cap_broken_props[] = {
340343
POWER_SUPPLY_PROP_SERIAL_NUMBER,
341344
};
342345

343-
static enum power_supply_property energy_battery_props[] = {
346+
static const enum power_supply_property energy_battery_props[] = {
344347
POWER_SUPPLY_PROP_STATUS,
345348
POWER_SUPPLY_PROP_PRESENT,
346349
POWER_SUPPLY_PROP_TECHNOLOGY,
@@ -358,7 +361,7 @@ static enum power_supply_property energy_battery_props[] = {
358361
POWER_SUPPLY_PROP_SERIAL_NUMBER,
359362
};
360363

361-
static enum power_supply_property energy_battery_full_cap_broken_props[] = {
364+
static const enum power_supply_property energy_battery_full_cap_broken_props[] = {
362365
POWER_SUPPLY_PROP_STATUS,
363366
POWER_SUPPLY_PROP_PRESENT,
364367
POWER_SUPPLY_PROP_TECHNOLOGY,
@@ -661,7 +664,7 @@ static ssize_t acpi_battery_alarm_show(struct device *dev,
661664
{
662665
struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
663666

664-
return sprintf(buf, "%d\n", battery->alarm * 1000);
667+
return sysfs_emit(buf, "%d\n", battery->alarm * 1000);
665668
}
666669

667670
static ssize_t acpi_battery_alarm_store(struct device *dev,
@@ -678,12 +681,18 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
678681
return count;
679682
}
680683

681-
static const struct device_attribute alarm_attr = {
684+
static struct device_attribute alarm_attr = {
682685
.attr = {.name = "alarm", .mode = 0644},
683686
.show = acpi_battery_alarm_show,
684687
.store = acpi_battery_alarm_store,
685688
};
686689

690+
static struct attribute *acpi_battery_attrs[] = {
691+
&alarm_attr.attr,
692+
NULL
693+
};
694+
ATTRIBUTE_GROUPS(acpi_battery);
695+
687696
/*
688697
* The Battery Hooking API
689698
*
@@ -838,7 +847,10 @@ static void __exit battery_hook_exit(void)
838847

839848
static int sysfs_add_battery(struct acpi_battery *battery)
840849
{
841-
struct power_supply_config psy_cfg = { .drv_data = battery, };
850+
struct power_supply_config psy_cfg = {
851+
.drv_data = battery,
852+
.attr_grp = acpi_battery_groups,
853+
};
842854
bool full_cap_broken = false;
843855

844856
if (!ACPI_BATTERY_CAPACITY_VALID(battery->full_charge_capacity) &&
@@ -883,7 +895,7 @@ static int sysfs_add_battery(struct acpi_battery *battery)
883895
return result;
884896
}
885897
battery_hook_add_battery(battery);
886-
return device_create_file(&battery->bat->dev, &alarm_attr);
898+
return 0;
887899
}
888900

889901
static void sysfs_remove_battery(struct acpi_battery *battery)
@@ -894,7 +906,6 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
894906
return;
895907
}
896908
battery_hook_remove_battery(battery);
897-
device_remove_file(&battery->bat->dev, &alarm_attr);
898909
power_supply_unregister(battery->bat);
899910
battery->bat = NULL;
900911
mutex_unlock(&battery->sysfs_lock);

drivers/acpi/bus.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ static void acpi_bus_osc_negotiate_platform_control(void)
329329
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT;
330330
if (IS_ENABLED(CONFIG_ACPI_THERMAL))
331331
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_FAST_THERMAL_SAMPLING_SUPPORT;
332+
if (IS_ENABLED(CONFIG_ACPI_BATTERY))
333+
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_BATTERY_CHARGE_LIMITING_SUPPORT;
332334

333335
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
334336
capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PCLPI_SUPPORT;

drivers/acpi/cppc_acpi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, highest_perf);
160160
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_perf);
161161
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, nominal_perf);
162162
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_nonlinear_perf);
163+
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, guaranteed_perf);
163164
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, lowest_freq);
164165
show_cppc_data(cppc_get_perf_caps, cppc_perf_caps, nominal_freq);
165166

@@ -196,6 +197,7 @@ static struct attribute *cppc_attrs[] = {
196197
&highest_perf.attr,
197198
&lowest_perf.attr,
198199
&lowest_nonlinear_perf.attr,
200+
&guaranteed_perf.attr,
199201
&nominal_perf.attr,
200202
&nominal_freq.attr,
201203
&lowest_freq.attr,
@@ -1837,7 +1839,7 @@ static void cppc_find_dmi_mhz(const struct dmi_header *dm, void *private)
18371839
dm->length >= DMI_ENTRY_PROCESSOR_MIN_LENGTH) {
18381840
u16 val = (u16)get_unaligned((const u16 *)
18391841
(dmi_data + DMI_PROCESSOR_MAX_SPEED));
1840-
*mhz = val > *mhz ? val : *mhz;
1842+
*mhz = umax(val, *mhz);
18411843
}
18421844
}
18431845

drivers/acpi/fan.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#ifndef _ACPI_FAN_H_
1111
#define _ACPI_FAN_H_
1212

13+
#include <linux/kconfig.h>
14+
1315
#define ACPI_FAN_DEVICE_IDS \
1416
{"INT3404", }, /* Fan */ \
1517
{"INTC1044", }, /* Fan for Tiger Lake generation */ \
@@ -57,4 +59,11 @@ struct acpi_fan {
5759
int acpi_fan_get_fst(struct acpi_device *device, struct acpi_fan_fst *fst);
5860
int acpi_fan_create_attributes(struct acpi_device *device);
5961
void acpi_fan_delete_attributes(struct acpi_device *device);
62+
63+
#if IS_REACHABLE(CONFIG_HWMON)
64+
int devm_acpi_fan_create_hwmon(struct acpi_device *device);
65+
#else
66+
static inline int devm_acpi_fan_create_hwmon(struct acpi_device *device) { return 0; };
67+
#endif
68+
6069
#endif

0 commit comments

Comments
 (0)