Skip to content

Commit 242ba66

Browse files
committed
Merge tag 'acpi-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI updates from Rafael Wysocki: "From the new functionality perspective, the most significant items here are the new driver for the 'ARM Generic Diagnostic Dump and Reset' device, the extension of fine grain fan control in the ACPI fan driver, and the change making it possible to use CPPC information to obtain CPU capacity. There are also a few new quirks, a bunch of fixes, including the platform-level _OSC handling change to make it actually take the platform firmware response into account, some code and documentation cleanups, and a notable update of the ACPI device enumeration documentation. Specifics: - Use uintptr_t and offsetof() in the ACPICA code to avoid compiler warnings regarding NULL pointer arithmetic (Rafael Wysocki). - Fix possible NULL pointer dereference in acpi_ns_walk_namespace() when passed "acpi=off" in the command line (Rafael Wysocki). - Fix and clean up acpi_os_read/write_port() (Rafael Wysocki). - Introduce acpi_bus_for_each_dev() and use it for walking all ACPI device objects in the Type C code (Rafael Wysocki). - Fix the _OSC platform capabilities negotioation and prevent CPPC from being used if the platform firmware indicates that it not supported via _OSC (Rafael Wysocki). - Use ida_alloc() instead of ida_simple_get() for ACPI enumeration of devices (Rafael Wysocki). - Add AGDI and CEDT to the list of known ACPI table signatures (Ilkka Koskinen, Robert Kiraly). - Add power management debug messages related to suspend-to-idle in two places (Rafael Wysocki). - Fix __acpi_node_get_property_reference() return value and clean up that function (Andy Shevchenko, Sakari Ailus). - Fix return value of the __setup handler in the ACPI PM timer clock source driver (Randy Dunlap). - Clean up double words in two comments (Tom Rix). - Add "skip i2c clients" quirks for Lenovo Yoga Tablet 1050F/L and Nextbook Ares 8 (Hans de Goede). - Clean up frequency invariance handling on x86 in the ACPI CPPC library (Huang Rui). - Work around broken XSDT on the Advantech DAC-BJ01 board (Mark Cilissen). - Make wakeup events checks in the ACPI EC driver more straightforward and clean up acpi_ec_submit_event() (Rafael Wysocki). - Make it possible to obtain the CPU capacity with the help of CPPC information (Ionela Voinescu). - Improve fine grained fan control in the ACPI fan driver and document it (Srinivas Pandruvada). - Add device HID and quirk for Microsoft Surface Go 3 to the ACPI battery driver (Maximilian Luz). - Make the ACPI driver for Intel SoCs (LPSS) let the SPI driver know the exact type of the controller (Andy Shevchenko). - Force native backlight mode on Clevo NL5xRU and NL5xNU (Werner Sembach). - Fix return value of __setup handlers in the APEI code (Randy Dunlap). - Add Arm Generic Diagnostic Dump and Reset device driver (Ilkka Koskinen). - Limit printable size of BERT table data (Darren Hart). - Fix up HEST and GHES initialization (Shuai Xue). - Update the ACPI device enumeration documentation and unify the ASL style in GPIO-related examples (Andy Shevchenko)" * tag 'acpi-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (52 commits) clocksource: acpi_pm: fix return value of __setup handler ACPI: bus: Avoid using CPPC if not supported by firmware Revert "ACPI: Pass the same capabilities to the _OSC regardless of the query flag" ACPI: video: Force backlight native for Clevo NL5xRU and NL5xNU arm64, topology: enable use of init_cpu_capacity_cppc() arch_topology: obtain cpu capacity using information from CPPC x86, ACPI: rename init_freq_invariance_cppc() to arch_init_invariance_cppc() ACPI: AGDI: Add driver for Arm Generic Diagnostic Dump and Reset device ACPI: tables: Add AGDI to the list of known table signatures ACPI/APEI: Limit printable size of BERT table data ACPI: docs: gpio-properties: Unify ASL style for GPIO examples ACPI / x86: Work around broken XSDT on Advantech DAC-BJ01 board ACPI: APEI: fix return value of __setup handlers x86/ACPI: CPPC: Move init_freq_invariance_cppc() into x86 CPPC x86: Expose init_freq_invariance() to topology header x86/ACPI: CPPC: Move AMD maximum frequency ratio setting function into x86 CPPC x86/ACPI: CPPC: Rename cppc_msr.c to cppc.c ACPI / x86: Add skip i2c clients quirk for Lenovo Yoga Tablet 1050F/L ACPI / x86: Add skip i2c clients quirk for Nextbook Ares 8 ACPICA: Avoid walking the ACPI Namespace if it is not there ...
2 parents 346658a + 1bde8bd commit 242ba66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1007
-459
lines changed

Documentation/admin-guide/acpi/fan_performance_states.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,31 @@ For example::
6060

6161
When a given field is not populated or its value provided by the platform
6262
firmware is invalid, the "not-defined" string is shown instead of the value.
63+
64+
ACPI Fan Fine Grain Control
65+
=============================
66+
67+
When _FIF object specifies support for fine grain control, then fan speed
68+
can be set from 0 to 100% with the recommended minimum "step size" via
69+
_FSL object. User can adjust fan speed using thermal sysfs cooling device.
70+
71+
Here use can look at fan performance states for a reference speed (speed_rpm)
72+
and set it by changing cooling device cur_state. If the fine grain control
73+
is supported then user can also adjust to some other speeds which are
74+
not defined in the performance states.
75+
76+
The support of fine grain control is presented via sysfs attribute
77+
"fine_grain_control". If fine grain control is present, this attribute
78+
will show "1" otherwise "0".
79+
80+
This sysfs attribute is presented in the same directory as performance states.
81+
82+
ACPI Fan Performance Feedback
83+
=============================
84+
85+
The optional _FST object provides status information for the fan device.
86+
This includes field to provide current fan speed in revolutions per minute
87+
at which the fan is rotating.
88+
89+
This speed is presented in the sysfs using the attribute "fan_speed_rpm",
90+
in the same directory as performance states.

Documentation/driver-api/gpio/board.rst

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ with the help of _DSD (Device Specific Data), introduced in ACPI 5.1::
7171

7272
Device (FOO) {
7373
Name (_CRS, ResourceTemplate () {
74-
GpioIo (Exclusive, ..., IoRestrictionOutputOnly,
75-
"\\_SB.GPI0") {15} // red
76-
GpioIo (Exclusive, ..., IoRestrictionOutputOnly,
77-
"\\_SB.GPI0") {16} // green
78-
GpioIo (Exclusive, ..., IoRestrictionOutputOnly,
79-
"\\_SB.GPI0") {17} // blue
80-
GpioIo (Exclusive, ..., IoRestrictionOutputOnly,
81-
"\\_SB.GPI0") {1} // power
74+
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
75+
"\\_SB.GPI0", 0, ResourceConsumer) { 15 } // red
76+
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
77+
"\\_SB.GPI0", 0, ResourceConsumer) { 16 } // green
78+
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
79+
"\\_SB.GPI0", 0, ResourceConsumer) { 17 } // blue
80+
GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionOutputOnly,
81+
"\\_SB.GPI0", 0, ResourceConsumer) { 1 } // power
8282
})
8383

8484
Name (_DSD, Package () {
@@ -92,10 +92,7 @@ with the help of _DSD (Device Specific Data), introduced in ACPI 5.1::
9292
^FOO, 2, 0, 1,
9393
}
9494
},
95-
Package () {
96-
"power-gpios",
97-
Package () {^FOO, 3, 0, 0},
98-
},
95+
Package () { "power-gpios", Package () { ^FOO, 3, 0, 0 } },
9996
}
10097
})
10198
}

Documentation/firmware-guide/acpi/enumeration.rst

Lines changed: 44 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ possible we decided to do following:
1919
platform devices.
2020

2121
- Devices behind real busses where there is a connector resource
22-
are represented as struct spi_device or struct i2c_device
23-
(standard UARTs are not busses so there is no struct uart_device).
22+
are represented as struct spi_device or struct i2c_device. Note
23+
that standard UARTs are not busses so there is no struct uart_device,
24+
although some of them may be represented by sturct serdev_device.
2425

2526
As both ACPI and Device Tree represent a tree of devices (and their
2627
resources) this implementation follows the Device Tree way as much as
2728
possible.
2829

29-
The ACPI implementation enumerates devices behind busses (platform, SPI and
30-
I2C), creates the physical devices and binds them to their ACPI handle in
31-
the ACPI namespace.
30+
The ACPI implementation enumerates devices behind busses (platform, SPI,
31+
I2C, and in some cases UART), creates the physical devices and binds them
32+
to their ACPI handle in the ACPI namespace.
3233

3334
This means that when ACPI_HANDLE(dev) returns non-NULL the device was
3435
enumerated from ACPI namespace. This handle can be used to extract other
@@ -46,18 +47,16 @@ some minor changes.
4647
Adding ACPI support for an existing driver should be pretty
4748
straightforward. Here is the simplest example::
4849

49-
#ifdef CONFIG_ACPI
5050
static const struct acpi_device_id mydrv_acpi_match[] = {
5151
/* ACPI IDs here */
5252
{ }
5353
};
5454
MODULE_DEVICE_TABLE(acpi, mydrv_acpi_match);
55-
#endif
5655

5756
static struct platform_driver my_driver = {
5857
...
5958
.driver = {
60-
.acpi_match_table = ACPI_PTR(mydrv_acpi_match),
59+
.acpi_match_table = mydrv_acpi_match,
6160
},
6261
};
6362

@@ -155,7 +154,7 @@ Here is what the ACPI namespace for a SPI slave might look like::
155154
Device (EEP0)
156155
{
157156
Name (_ADR, 1)
158-
Name (_CID, Package() {
157+
Name (_CID, Package () {
159158
"ATML0025",
160159
"AT25",
161160
})
@@ -172,59 +171,51 @@ The SPI device drivers only need to add ACPI IDs in a similar way than with
172171
the platform device drivers. Below is an example where we add ACPI support
173172
to at25 SPI eeprom driver (this is meant for the above ACPI snippet)::
174173

175-
#ifdef CONFIG_ACPI
176174
static const struct acpi_device_id at25_acpi_match[] = {
177175
{ "AT25", 0 },
178-
{ },
176+
{ }
179177
};
180178
MODULE_DEVICE_TABLE(acpi, at25_acpi_match);
181-
#endif
182179

183180
static struct spi_driver at25_driver = {
184181
.driver = {
185182
...
186-
.acpi_match_table = ACPI_PTR(at25_acpi_match),
183+
.acpi_match_table = at25_acpi_match,
187184
},
188185
};
189186

190187
Note that this driver actually needs more information like page size of the
191-
eeprom etc. but at the time writing this there is no standard way of
192-
passing those. One idea is to return this in _DSM method like::
188+
eeprom, etc. This information can be passed via _DSD method like::
193189

194190
Device (EEP0)
195191
{
196192
...
197-
Method (_DSM, 4, NotSerialized)
193+
Name (_DSD, Package ()
198194
{
199-
Store (Package (6)
195+
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
196+
Package ()
200197
{
201-
"byte-len", 1024,
202-
"addr-mode", 2,
203-
"page-size, 32
204-
}, Local0)
205-
206-
// Check UUIDs etc.
207-
208-
Return (Local0)
209-
}
210-
211-
Then the at25 SPI driver can get this configuration by calling _DSM on its
212-
ACPI handle like::
213-
214-
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
215-
struct acpi_object_list input;
216-
acpi_status status;
198+
Package () { "size", 1024 },
199+
Package () { "pagesize", 32 },
200+
Package () { "address-width", 16 },
201+
}
202+
})
203+
}
217204

218-
/* Fill in the input buffer */
205+
Then the at25 SPI driver can get this configuration by calling device property
206+
APIs during ->probe() phase like::
219207

220-
status = acpi_evaluate_object(ACPI_HANDLE(&spi->dev), "_DSM",
221-
&input, &output);
222-
if (ACPI_FAILURE(status))
223-
/* Handle the error */
208+
err = device_property_read_u32(dev, "size", &size);
209+
if (err)
210+
...error handling...
224211

225-
/* Extract the data here */
212+
err = device_property_read_u32(dev, "pagesize", &page_size);
213+
if (err)
214+
...error handling...
226215

227-
kfree(output.pointer);
216+
err = device_property_read_u32(dev, "address-width", &addr_width);
217+
if (err)
218+
...error handling...
228219

229220
I2C serial bus support
230221
======================
@@ -237,26 +228,24 @@ registered.
237228
Below is an example of how to add ACPI support to the existing mpu3050
238229
input driver::
239230

240-
#ifdef CONFIG_ACPI
241231
static const struct acpi_device_id mpu3050_acpi_match[] = {
242232
{ "MPU3050", 0 },
243-
{ },
233+
{ }
244234
};
245235
MODULE_DEVICE_TABLE(acpi, mpu3050_acpi_match);
246-
#endif
247236

248237
static struct i2c_driver mpu3050_i2c_driver = {
249238
.driver = {
250239
.name = "mpu3050",
251-
.owner = THIS_MODULE,
252240
.pm = &mpu3050_pm,
253241
.of_match_table = mpu3050_of_match,
254-
.acpi_match_table = ACPI_PTR(mpu3050_acpi_match),
242+
.acpi_match_table = mpu3050_acpi_match,
255243
},
256244
.probe = mpu3050_probe,
257245
.remove = mpu3050_remove,
258246
.id_table = mpu3050_ids,
259247
};
248+
module_i2c_driver(mpu3050_i2c_driver);
260249

261250
Reference to PWM device
262251
=======================
@@ -282,9 +271,9 @@ introduced, i.e.::
282271
}
283272
}
284273
}
285-
286274
})
287275
...
276+
}
288277

289278
In the above example the PWM-based LED driver references to the PWM channel 0
290279
of \_SB.PCI0.PWM device with initial period setting equal to 600 ms (note that
@@ -306,26 +295,13 @@ For example::
306295
{
307296
Name (SBUF, ResourceTemplate()
308297
{
309-
...
310298
// Used to power on/off the device
311-
GpioIo (Exclusive, PullDefault, 0x0000, 0x0000,
312-
IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0",
313-
0x00, ResourceConsumer,,)
314-
{
315-
// Pin List
316-
0x0055
317-
}
299+
GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionOutputOnly,
300+
"\\_SB.PCI0.GPI0", 0, ResourceConsumer) { 85 }
318301

319302
// Interrupt for the device
320-
GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone,
321-
0x0000, "\\_SB.PCI0.GPI0", 0x00, ResourceConsumer,,)
322-
{
323-
// Pin list
324-
0x0058
325-
}
326-
327-
...
328-
303+
GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone, 0,
304+
"\\_SB.PCI0.GPI0", 0, ResourceConsumer) { 88 }
329305
}
330306

331307
Return (SBUF)
@@ -337,11 +313,12 @@ For example::
337313
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
338314
Package ()
339315
{
340-
Package () {"power-gpios", Package() {^DEV, 0, 0, 0 }},
341-
Package () {"irq-gpios", Package() {^DEV, 1, 0, 0 }},
316+
Package () { "power-gpios", Package () { ^DEV, 0, 0, 0 } },
317+
Package () { "irq-gpios", Package () { ^DEV, 1, 0, 0 } },
342318
}
343319
})
344320
...
321+
}
345322

346323
These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
347324
specifies the path to the controller. In order to use these GPIOs in Linux
@@ -460,10 +437,10 @@ namespace link::
460437
Device (TMP0)
461438
{
462439
Name (_HID, "PRP0001")
463-
Name (_DSD, Package() {
440+
Name (_DSD, Package () {
464441
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
465442
Package () {
466-
Package (2) { "compatible", "ti,tmp75" },
443+
Package () { "compatible", "ti,tmp75" },
467444
}
468445
})
469446
Method (_CRS, 0, Serialized)

Documentation/firmware-guide/acpi/gpio-properties.rst

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ index, like the ASL example below shows::
2121
Name (_CRS, ResourceTemplate ()
2222
{
2323
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
24-
"\\_SB.GPO0", 0, ResourceConsumer) {15}
24+
"\\_SB.GPO0", 0, ResourceConsumer) { 15 }
2525
GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly,
26-
"\\_SB.GPO0", 0, ResourceConsumer) {27, 31}
26+
"\\_SB.GPO0", 0, ResourceConsumer) { 27, 31 }
2727
})
2828

2929
Name (_DSD, Package ()
3030
{
3131
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
3232
Package ()
33-
{
34-
Package () {"reset-gpios", Package() {^BTH, 1, 1, 0 }},
35-
Package () {"shutdown-gpios", Package() {^BTH, 0, 0, 0 }},
33+
{
34+
Package () { "reset-gpios", Package () { ^BTH, 1, 1, 0 } },
35+
Package () { "shutdown-gpios", Package () { ^BTH, 0, 0, 0 } },
3636
}
3737
})
3838
}
@@ -123,17 +123,17 @@ Example::
123123
// _DSD Hierarchical Properties Extension UUID
124124
ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
125125
Package () {
126-
Package () {"hog-gpio8", "G8PU"}
126+
Package () { "hog-gpio8", "G8PU" }
127127
}
128128
})
129129

130130
Name (G8PU, Package () {
131131
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
132132
Package () {
133-
Package () {"gpio-hog", 1},
134-
Package () {"gpios", Package () {8, 0}},
135-
Package () {"output-high", 1},
136-
Package () {"line-name", "gpio8-pullup"},
133+
Package () { "gpio-hog", 1 },
134+
Package () { "gpios", Package () { 8, 0 } },
135+
Package () { "output-high", 1 },
136+
Package () { "line-name", "gpio8-pullup" },
137137
}
138138
})
139139

@@ -266,15 +266,17 @@ have a device like below::
266266

267267
Name (_CRS, ResourceTemplate () {
268268
GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionNone,
269-
"\\_SB.GPO0", 0, ResourceConsumer) {15}
269+
"\\_SB.GPO0", 0, ResourceConsumer) { 15 }
270270
GpioIo (Exclusive, PullNone, 0, 0, IoRestrictionNone,
271-
"\\_SB.GPO0", 0, ResourceConsumer) {27}
271+
"\\_SB.GPO0", 0, ResourceConsumer) { 27 }
272272
})
273273
}
274274

275275
The driver might expect to get the right GPIO when it does::
276276

277277
desc = gpiod_get(dev, "reset", GPIOD_OUT_LOW);
278+
if (IS_ERR(desc))
279+
...error handling...
278280

279281
but since there is no way to know the mapping between "reset" and
280282
the GpioIo() in _CRS desc will hold ERR_PTR(-ENOENT).

arch/arm64/include/asm/topology.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ void update_freq_counters_refs(void);
2424
#define arch_scale_freq_capacity topology_get_freq_scale
2525
#define arch_scale_freq_invariant topology_scale_freq_invariant
2626

27+
#ifdef CONFIG_ACPI_CPPC_LIB
28+
#define arch_init_invariance_cppc topology_init_cpu_capacity_cppc
29+
#endif
30+
2731
/* Replace task scheduler's default cpu-invariant accounting */
2832
#define arch_scale_cpu_capacity topology_get_cpu_scale
2933

0 commit comments

Comments
 (0)