Lines Matching +full:acpi +full:- +full:based
1 .. SPDX-License-Identifier: GPL-2.0
4 ACPI Based Device Enumeration
7 ACPI 5 introduced a set of new resources (UartTSerialBus, I2cSerialBus,
12 SoC/Chipset to appear only in ACPI namespace. These are typically devices
13 that are accessed through memory-mapped registers.
15 In order to support this and re-use the existing drivers as much as
18 - Devices that have no bus connector resource are represented as
21 - Devices behind real busses where there is a connector resource
26 As both ACPI and Device Tree represent a tree of devices (and their
30 The ACPI implementation enumerates devices behind busses (platform, SPI,
32 to their ACPI handle in the ACPI namespace.
34 This means that when ACPI_HANDLE(dev) returns non-NULL the device was
35 enumerated from ACPI namespace. This handle can be used to extract other
36 device-specific configuration. There is an example of this below.
43 for the device and add supported ACPI IDs. If this same IP-block is used on
44 some other non-ACPI platform, the driver might work out of the box or needs
47 Adding ACPI support for an existing driver should be pretty
51 /* ACPI IDs here */
54 MODULE_DEVICE_TABLE(acpi, mydrv_acpi_match);
64 configuring GPIOs it can get its ACPI handle and extract this information
65 from ACPI tables.
67 ACPI device objects
71 ACPI is used as an interface between the platform firmware and the OS: Devices
77 there can be a corresponding ACPI device object in the ACPI Namespace in which
78 case the Linux kernel will create a struct acpi_device object based on it for
86 Moreover, the core ACPI device enumeration code creates struct platform_device
94 Historically, ACPI drivers that bound directly to struct acpi_device objects
99 for handling them, even though the corresponding ACPI device objects are the
104 get to the device configuration information stored in the ACPI device object
106 interface between the kernel and the ACPI Namespace, whereas device objects of
113 DMA controllers enumerated via ACPI should be registered in the system to
158 In the xlate function the proper channel must be chosen based on
191 Drivers enumerated via ACPI can have names to interrupts in the ACPI table
194 The interrupt name can be listed in _DSD as 'interrupt-names'. The names
196 resource in the ACPI table corresponding to its index.
211 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
213 Package () { "interrupt-names", Package () { "default", "alert" } },
223 The driver can call the function - fwnode_irq_get_byname() with the fwnode
233 Here is what the ACPI namespace for a SPI slave might look like::
251 The SPI device drivers only need to add ACPI IDs in a similar way to
252 the platform device drivers. Below is an example where we add ACPI support
253 to at25 SPI eeprom driver (this is meant for the above ACPI snippet)::
259 MODULE_DEVICE_TABLE(acpi, at25_acpi_match);
276 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
281 Package () { "address-width", 16 },
287 APIs during ->probe() phase like::
297 err = device_property_read_u32(dev, "address-width", &addr_width);
304 The slaves behind I2C bus controller only need to add the ACPI IDs like
309 Below is an example of how to add ACPI support to the existing mpu3050
316 MODULE_DEVICE_TABLE(acpi, mpu3050_acpi_match);
342 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
344 Package () { "compatible", Package () { "pwm-leds" } },
345 Package () { "label", "alarm-led" },
359 In the above example the PWM-based LED driver references to the PWM channel 0
366 ACPI 5 introduced two new resources to describe GPIO connections: GpioIo
368 the device to the driver. ACPI 5.1 extended this with _DSD (Device
391 // ACPI 5.1 _DSD used for naming the GPIOs
394 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
397 Package () { "power-gpios", Package () { ^DEV, 0, 0, 0 } },
398 Package () { "irq-gpios", Package () { ^DEV, 1, 0, 0 } },
409 Documentation/admin-guide/gpio/.
432 See Documentation/firmware-guide/acpi/gpio-properties.rst for more information
435 RS-485 support
438 ACPI _DSD (Device Specific Data) can be used to describe RS-485 capability
447 // ACPI 5.1 _DSD used for RS-485 capabilities
450 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
453 Package () {"rs485-rts-active-low", Zero},
454 Package () {"rs485-rx-active-high", Zero},
455 Package () {"rs485-rx-during-tx", Zero},
464 devices there needs to be an ACPI handle that they can use to reference
465 parts of the ACPI namespace that relate to them. In the Linux MFD subsystem
468 - The children share the parent ACPI handle.
469 - The MFD cell can specify the ACPI id of the device.
475 If the ACPI namespace has a device that we can match using an ACPI id or ACPI
489 The ACPI id "XYZ0001" is then used to lookup an ACPI device directly under
490 the MFD device and if found, that ACPI companion device is bound to the
496 The Device Tree protocol uses device identification based on the "compatible"
499 regarded as a device identification namespace analogous to the ACPI/PNP device
501 a new (and arguably redundant) ACPI/PNP device ID for a devices with an existing
506 In ACPI, the device identification object called _CID (Compatible ID) is used to
508 belong to one of the namespaces prescribed by the ACPI specification (see
509 Section 6.1.2 of ACPI 6.0 for details) and the DT namespace is not one of them.
511 object be present for all ACPI objects representing devices (Section 6.1 of ACPI
512 6.0). For non-enumerable bus types that object must be _HID and its value must
516 existing DT-compatible device identification in ACPI and to satisfy the above
517 requirements following from the ACPI specification at the same time. Namely,
518 if PRP0001 is returned by _HID, the ACPI subsystem will look for the
522 or its value is not valid, the device will not be enumerated by the ACPI
525 which case the ACPI core will leave the device enumeration to the parent's
539 For example, the following ACPI sample might be used to enumerate an lm75-type
547 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
574 "composite device" case described above) can be used in the ACPI environment.
578 Refer to Documentation/firmware-guide/acpi/DSD-properties-rules.rst for more
588 in a fixed position (ethernet, Wi-Fi, serial ports, etc.). In this conditions it
598 16 GPIOs and we want to add the property ``gpio-line-names`` [1]_ to these pins.
617 07:00.0 Serial controller: Exar Corp. XR17V3521 Dual PCIe UART (rev 03) <-- Exar
622 -[0000:00]-+-00.0
624 +-13.0-[01]----00.0
625 +-13.1-[02]----00.0
626 +-13.2-[03]--
627 +-14.0-[04]----00.0
628 +-14.1-[05-09]----00.0-[06-09]--+-01.0-[07]----00.0 <-- Exar
629 | +-02.0-[08]----00.0
630 | \-03.0-[09]--
632 \-1f.1
634 To describe this Exar device on the PCI bus, we must start from the ACPI name
637 Bus: 0 - Device: 14 - Function: 1
639 To find this information, it is necessary to disassemble the BIOS ACPI tables,
645 acpixtract -a acpidump
646 iasl -e ssdt?.* -d dsdt.dat
673 ACPI description for the Exar PCIe UART, also adding the list of its GPIO line
692 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
697 "gpio-line-names",
727 .. [1] Documentation/firmware-guide/acpi/gpio-properties.rst
729 .. [2] Documentation/admin-guide/acpi/initrd_table_override.rst
731 .. [3] ACPI Specifications, Version 6.3 - Paragraph 6.1.1 _ADR Address)
733 referenced 2020-11-18