Skip to content

Commit 21e0ff5

Browse files
committed
Merge tag 'acpi-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki: "From the functional perspective, the most significant changes here are the ACPI fan driver update allowing it to handle fans with fine-grained state checking supported, but without fine-grained control, and the ACPI button driver update making it subscribe to system event notifications (in addition to device notifications) which on some systems is requisite for waking up the system from sleep. The rest is fixes and cleanups including removal of some dead code. Specifics: - Use the str_on_off() helper function instead of hard-coded strings in the ACPI power resources handling code (Thorsten Blum) - Add fan speed reporting for ACPI fans that have _FST, but otherwise do not support the entire ACPI 4 fan interface (Joshua Grisham) - Fix a stale comment regarding trip points in acpi_thermal_add() that diverged from the commented code after removing _CRT evaluation from acpi_thermal_get_trip_points() (xueqin Luo) - Make ACPI button driver also subscribe to system events (Mario Limonciello) - Use the str_yes_no() helper function instead of hard-coded strings in the ACPI backlight (video) driver (Thorsten Blum) - Add a missing header file include to the x86 arch CPPC code (Mario Limonciello) - Rework the sysfs attributes implementation in the ACPI platform-profile driver and improve the unregistration code in it (Nathan Chancellor, Kurt Borja) - Prevent the ACPI HED driver from being built as a module and change its initcall level to subsys_initcall to avoid initialization ordering issues related to it (Xiaofei Tan) - Update a maintainer email address in the ACPI PMIC entry in MAINTAINERS (Mika Westerberg) - Address a GCC 15's -Wunterminated-string-initialization warning in the core PNP subsystem code and remove some dead code from it (Kees Cook, David Alan Gilbert)" * tag 'acpi-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PNP: Expand length of fixup id string PNP: Remove prehistoric deadcode ACPI: button: Install notifier for system events as well ACPI: fan: Add fan speed reporting for fans with only _FST ACPI: HED: Always initialize before evged x86/ACPI: CPPC: Add missing include ACPI: video: Use str_yes_no() helper in acpi_video_bus_add() ACPI: platform_profile: Improve platform_profile_unregister() ACPI: platform-profile: Fix CFI violation when accessing sysfs files ACPI: power: Use str_on_off() helper function ACPI: thermal: Fix stale comment regarding trip points MAINTAINERS: Use my kernel.org address for ACPI PMIC work
2 parents a5b3d86 + 8b30d2a commit 21e0ff5

File tree

19 files changed

+99
-113
lines changed

19 files changed

+99
-113
lines changed

Documentation/admin-guide/pnp.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ pnp_put_protocol
129129
pnp_register_protocol
130130
use this to register a new PnP protocol
131131

132-
pnp_unregister_protocol
133-
use this function to remove a PnP protocol from the Plug and Play Layer
134-
135132
pnp_register_driver
136133
adds a PnP driver to the Plug and Play Layer
137134

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ ACPI PMIC DRIVERS
356356
M: "Rafael J. Wysocki" <rafael@kernel.org>
357357
M: Len Brown <lenb@kernel.org>
358358
R: Andy Shevchenko <andy@kernel.org>
359-
R: Mika Westerberg <mika.westerberg@linux.intel.com>
359+
R: Mika Westerberg <westeri@kernel.org>
360360
L: linux-acpi@vger.kernel.org
361361
S: Supported
362362
Q: https://patchwork.kernel.org/project/linux-acpi/list/

arch/x86/kernel/acpi/cppc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Copyright (c) 2016, Intel Corporation.
55
*/
66

7+
#include <linux/bitfield.h>
8+
79
#include <acpi/cppc_acpi.h>
810
#include <asm/msr.h>
911
#include <asm/processor.h>

drivers/acpi/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ config ACPI_SBS
452452
the modules will be called sbs and sbshc.
453453

454454
config ACPI_HED
455-
tristate "Hardware Error Device"
455+
bool "Hardware Error Device"
456456
help
457457
This driver supports the Hardware Error Device (PNP0C33),
458458
which is used to report some hardware errors notified via

drivers/acpi/acpi_video.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/acpi.h>
2828
#include <acpi/video.h>
2929
#include <linux/uaccess.h>
30+
#include <linux/string_choices.h>
3031

3132
#define ACPI_VIDEO_BUS_NAME "Video Bus"
3233
#define ACPI_VIDEO_DEVICE_NAME "Video Device"
@@ -2039,9 +2040,9 @@ static int acpi_video_bus_add(struct acpi_device *device)
20392040

20402041
pr_info("%s [%s] (multi-head: %s rom: %s post: %s)\n",
20412042
ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
2042-
video->flags.multihead ? "yes" : "no",
2043-
video->flags.rom ? "yes" : "no",
2044-
video->flags.post ? "yes" : "no");
2043+
str_yes_no(video->flags.multihead),
2044+
str_yes_no(video->flags.rom),
2045+
str_yes_no(video->flags.post));
20452046
mutex_lock(&video_list_lock);
20462047
list_add_tail(&video->entry, &video_bus_head);
20472048
mutex_unlock(&video_list_lock);

drivers/acpi/button.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#define ACPI_BUTTON_CLASS "button"
2525
#define ACPI_BUTTON_FILE_STATE "state"
2626
#define ACPI_BUTTON_TYPE_UNKNOWN 0x00
27+
#define ACPI_BUTTON_NOTIFY_WAKE 0x02
2728
#define ACPI_BUTTON_NOTIFY_STATUS 0x80
2829

2930
#define ACPI_BUTTON_SUBCLASS_POWER "power"
@@ -443,7 +444,12 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
443444
struct input_dev *input;
444445
int keycode;
445446

446-
if (event != ACPI_BUTTON_NOTIFY_STATUS) {
447+
switch (event) {
448+
case ACPI_BUTTON_NOTIFY_STATUS:
449+
break;
450+
case ACPI_BUTTON_NOTIFY_WAKE:
451+
break;
452+
default:
447453
acpi_handle_debug(device->handle, "Unsupported event [0x%x]\n",
448454
event);
449455
return;
@@ -629,7 +635,7 @@ static int acpi_button_add(struct acpi_device *device)
629635
break;
630636
default:
631637
status = acpi_install_notify_handler(device->handle,
632-
ACPI_DEVICE_NOTIFY, handler,
638+
ACPI_ALL_NOTIFY, handler,
633639
device);
634640
break;
635641
}

drivers/acpi/fan.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ struct acpi_fan_fst {
4949

5050
struct acpi_fan {
5151
bool acpi4;
52+
bool has_fst;
5253
struct acpi_fan_fif fif;
5354
struct acpi_fan_fps *fps;
5455
int fps_count;

drivers/acpi/fan_attr.c

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,6 @@ int acpi_fan_create_attributes(struct acpi_device *device)
7575
struct acpi_fan *fan = acpi_driver_data(device);
7676
int i, status;
7777

78-
sysfs_attr_init(&fan->fine_grain_control.attr);
79-
fan->fine_grain_control.show = show_fine_grain_control;
80-
fan->fine_grain_control.store = NULL;
81-
fan->fine_grain_control.attr.name = "fine_grain_control";
82-
fan->fine_grain_control.attr.mode = 0444;
83-
status = sysfs_create_file(&device->dev.kobj, &fan->fine_grain_control.attr);
84-
if (status)
85-
return status;
86-
8778
/* _FST is present if we are here */
8879
sysfs_attr_init(&fan->fst_speed.attr);
8980
fan->fst_speed.show = show_fan_speed;
@@ -92,7 +83,19 @@ int acpi_fan_create_attributes(struct acpi_device *device)
9283
fan->fst_speed.attr.mode = 0444;
9384
status = sysfs_create_file(&device->dev.kobj, &fan->fst_speed.attr);
9485
if (status)
95-
goto rem_fine_grain_attr;
86+
return status;
87+
88+
if (!fan->acpi4)
89+
return 0;
90+
91+
sysfs_attr_init(&fan->fine_grain_control.attr);
92+
fan->fine_grain_control.show = show_fine_grain_control;
93+
fan->fine_grain_control.store = NULL;
94+
fan->fine_grain_control.attr.name = "fine_grain_control";
95+
fan->fine_grain_control.attr.mode = 0444;
96+
status = sysfs_create_file(&device->dev.kobj, &fan->fine_grain_control.attr);
97+
if (status)
98+
goto rem_fst_attr;
9699

97100
for (i = 0; i < fan->fps_count; ++i) {
98101
struct acpi_fan_fps *fps = &fan->fps[i];
@@ -109,18 +112,18 @@ int acpi_fan_create_attributes(struct acpi_device *device)
109112

110113
for (j = 0; j < i; ++j)
111114
sysfs_remove_file(&device->dev.kobj, &fan->fps[j].dev_attr.attr);
112-
goto rem_fst_attr;
115+
goto rem_fine_grain_attr;
113116
}
114117
}
115118

116119
return 0;
117120

118-
rem_fst_attr:
119-
sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr);
120-
121121
rem_fine_grain_attr:
122122
sysfs_remove_file(&device->dev.kobj, &fan->fine_grain_control.attr);
123123

124+
rem_fst_attr:
125+
sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr);
126+
124127
return status;
125128
}
126129

@@ -129,9 +132,13 @@ void acpi_fan_delete_attributes(struct acpi_device *device)
129132
struct acpi_fan *fan = acpi_driver_data(device);
130133
int i;
131134

135+
sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr);
136+
137+
if (!fan->acpi4)
138+
return;
139+
132140
for (i = 0; i < fan->fps_count; ++i)
133141
sysfs_remove_file(&device->dev.kobj, &fan->fps[i].dev_attr.attr);
134142

135-
sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr);
136143
sysfs_remove_file(&device->dev.kobj, &fan->fine_grain_control.attr);
137144
}

drivers/acpi/fan_core.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,16 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = {
203203
* --------------------------------------------------------------------------
204204
*/
205205

206+
static bool acpi_fan_has_fst(struct acpi_device *device)
207+
{
208+
return acpi_has_method(device->handle, "_FST");
209+
}
210+
206211
static bool acpi_fan_is_acpi4(struct acpi_device *device)
207212
{
208213
return acpi_has_method(device->handle, "_FIF") &&
209214
acpi_has_method(device->handle, "_FPS") &&
210-
acpi_has_method(device->handle, "_FSL") &&
211-
acpi_has_method(device->handle, "_FST");
215+
acpi_has_method(device->handle, "_FSL");
212216
}
213217

214218
static int acpi_fan_get_fif(struct acpi_device *device)
@@ -327,25 +331,32 @@ static int acpi_fan_probe(struct platform_device *pdev)
327331
device->driver_data = fan;
328332
platform_set_drvdata(pdev, fan);
329333

330-
if (acpi_fan_is_acpi4(device)) {
334+
if (acpi_fan_has_fst(device)) {
335+
fan->has_fst = true;
336+
fan->acpi4 = acpi_fan_is_acpi4(device);
337+
}
338+
339+
if (fan->acpi4) {
331340
result = acpi_fan_get_fif(device);
332341
if (result)
333342
return result;
334343

335344
result = acpi_fan_get_fps(device);
336345
if (result)
337346
return result;
347+
}
338348

349+
if (fan->has_fst) {
339350
result = devm_acpi_fan_create_hwmon(device);
340351
if (result)
341352
return result;
342353

343354
result = acpi_fan_create_attributes(device);
344355
if (result)
345356
return result;
357+
}
346358

347-
fan->acpi4 = true;
348-
} else {
359+
if (!fan->acpi4) {
349360
result = acpi_device_update_power(device, NULL);
350361
if (result) {
351362
dev_err(&device->dev, "Failed to set initial power state\n");
@@ -391,7 +402,7 @@ static int acpi_fan_probe(struct platform_device *pdev)
391402
err_unregister:
392403
thermal_cooling_device_unregister(cdev);
393404
err_end:
394-
if (fan->acpi4)
405+
if (fan->has_fst)
395406
acpi_fan_delete_attributes(device);
396407

397408
return result;
@@ -401,7 +412,7 @@ static void acpi_fan_remove(struct platform_device *pdev)
401412
{
402413
struct acpi_fan *fan = platform_get_drvdata(pdev);
403414

404-
if (fan->acpi4) {
415+
if (fan->has_fst) {
405416
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
406417

407418
acpi_fan_delete_attributes(device);

drivers/acpi/fan_hwmon.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ static umode_t acpi_fan_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_
4343
case hwmon_fan_input:
4444
return 0444;
4545
case hwmon_fan_target:
46+
/* Only acpi4 fans support fan control. */
47+
if (!fan->acpi4)
48+
return 0;
49+
4650
/*
4751
* When in fine grain control mode, not every fan control value
4852
* has an associated fan performance state.
@@ -57,6 +61,10 @@ static umode_t acpi_fan_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_
5761
case hwmon_power:
5862
switch (attr) {
5963
case hwmon_power_input:
64+
/* Only acpi4 fans support fan control. */
65+
if (!fan->acpi4)
66+
return 0;
67+
6068
/*
6169
* When in fine grain control mode, not every fan control value
6270
* has an associated fan performance state.

0 commit comments

Comments
 (0)