^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) ACPI Based Device Enumeration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) ACPI 5 introduced a set of new resources (UartTSerialBus, I2cSerialBus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) SpiSerialBus, GpioIo and GpioInt) which can be used in enumerating slave
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) devices behind serial bus controllers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) In addition we are starting to see peripherals integrated in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) SoC/Chipset to appear only in ACPI namespace. These are typically devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) that are accessed through memory-mapped registers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) In order to support this and re-use the existing drivers as much as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) possible we decided to do following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) - Devices that have no bus connector resource are represented as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) platform devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) - Devices behind real busses where there is a connector resource
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) are represented as struct spi_device or struct i2c_device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) (standard UARTs are not busses so there is no struct uart_device).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) As both ACPI and Device Tree represent a tree of devices (and their
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) resources) this implementation follows the Device Tree way as much as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) possible.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) The ACPI implementation enumerates devices behind busses (platform, SPI and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) I2C), creates the physical devices and binds them to their ACPI handle in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) the ACPI namespace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) This means that when ACPI_HANDLE(dev) returns non-NULL the device was
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) enumerated from ACPI namespace. This handle can be used to extract other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) device-specific configuration. There is an example of this below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) Platform bus support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) ====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) Since we are using platform devices to represent devices that are not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) connected to any physical bus we only need to implement a platform driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) for the device and add supported ACPI IDs. If this same IP-block is used on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) some other non-ACPI platform, the driver might work out of the box or needs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) some minor changes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) Adding ACPI support for an existing driver should be pretty
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) straightforward. Here is the simplest example::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #ifdef CONFIG_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static const struct acpi_device_id mydrv_acpi_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /* ACPI IDs here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) MODULE_DEVICE_TABLE(acpi, mydrv_acpi_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static struct platform_driver my_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) .acpi_match_table = ACPI_PTR(mydrv_acpi_match),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) If the driver needs to perform more complex initialization like getting and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) configuring GPIOs it can get its ACPI handle and extract this information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) from ACPI tables.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) DMA support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) DMA controllers enumerated via ACPI should be registered in the system to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) provide generic access to their resources. For example, a driver that would
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) like to be accessible to slave devices via generic API call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) dma_request_chan() must register itself at the end of the probe function like
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) this::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) err = devm_acpi_dma_controller_register(dev, xlate_func, dw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /* Handle the error if it's not a case of !CONFIG_ACPI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) and implement custom xlate function if needed (usually acpi_dma_simple_xlate()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) is enough) which converts the FixedDMA resource provided by struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) acpi_dma_spec into the corresponding DMA channel. A piece of code for that case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) could look like::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #ifdef CONFIG_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct filter_args {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) /* Provide necessary information for the filter_func */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) static bool filter_func(struct dma_chan *chan, void *param)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) /* Choose the proper channel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) static struct dma_chan *xlate_func(struct acpi_dma_spec *dma_spec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct acpi_dma *adma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) dma_cap_mask_t cap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) struct filter_args args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /* Prepare arguments for filter_func */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) return dma_request_channel(cap, filter_func, &args);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static struct dma_chan *xlate_func(struct acpi_dma_spec *dma_spec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct acpi_dma *adma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) dma_request_chan() will call xlate_func() for each registered DMA controller.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) In the xlate function the proper channel must be chosen based on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) information in struct acpi_dma_spec and the properties of the controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) provided by struct acpi_dma.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) Clients must call dma_request_chan() with the string parameter that corresponds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) to a specific FixedDMA resource. By default "tx" means the first entry of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) FixedDMA resource array, "rx" means the second entry. The table below shows a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) layout::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) Device (I2C0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) Method (_CRS, 0, NotSerialized)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) Name (DBUF, ResourceTemplate ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) FixedDMA (0x0018, 0x0004, Width32bit, _Y48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) FixedDMA (0x0019, 0x0005, Width32bit, )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) So, the FixedDMA with request line 0x0018 is "tx" and next one is "rx" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) this example.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) In robust cases the client unfortunately needs to call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) acpi_dma_request_slave_chan_by_index() directly and therefore choose the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) specific FixedDMA resource by its index.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) SPI serial bus support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) ======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) Slave devices behind SPI bus have SpiSerialBus resource attached to them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) This is extracted automatically by the SPI core and the slave devices are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) enumerated once spi_register_master() is called by the bus driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) Here is what the ACPI namespace for a SPI slave might look like::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) Device (EEP0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) Name (_ADR, 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) Name (_CID, Package() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) "ATML0025",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) "AT25",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) Method (_CRS, 0, NotSerialized)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) SPISerialBus(1, PolarityLow, FourWireMode, 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) ControllerInitiated, 1000000, ClockPolarityLow,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) ClockPhaseFirst, "\\_SB.PCI0.SPI1",)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) The SPI device drivers only need to add ACPI IDs in a similar way than with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) the platform device drivers. Below is an example where we add ACPI support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) to at25 SPI eeprom driver (this is meant for the above ACPI snippet)::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) #ifdef CONFIG_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) static const struct acpi_device_id at25_acpi_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) { "AT25", 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) MODULE_DEVICE_TABLE(acpi, at25_acpi_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static struct spi_driver at25_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) .acpi_match_table = ACPI_PTR(at25_acpi_match),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) Note that this driver actually needs more information like page size of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) eeprom etc. but at the time writing this there is no standard way of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) passing those. One idea is to return this in _DSM method like::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) Device (EEP0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) Method (_DSM, 4, NotSerialized)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) Store (Package (6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) "byte-len", 1024,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) "addr-mode", 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) "page-size, 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }, Local0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) // Check UUIDs etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) Return (Local0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) Then the at25 SPI driver can get this configuration by calling _DSM on its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) ACPI handle like::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) struct acpi_object_list input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) /* Fill in the input buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) status = acpi_evaluate_object(ACPI_HANDLE(&spi->dev), "_DSM",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) &input, &output);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) if (ACPI_FAILURE(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /* Handle the error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) /* Extract the data here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) kfree(output.pointer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) I2C serial bus support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) ======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) The slaves behind I2C bus controller only need to add the ACPI IDs like
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) with the platform and SPI drivers. The I2C core automatically enumerates
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) any slave devices behind the controller device once the adapter is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) registered.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) Below is an example of how to add ACPI support to the existing mpu3050
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) input driver::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) #ifdef CONFIG_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) static const struct acpi_device_id mpu3050_acpi_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) { "MPU3050", 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) MODULE_DEVICE_TABLE(acpi, mpu3050_acpi_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) static struct i2c_driver mpu3050_i2c_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) .name = "mpu3050",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) .pm = &mpu3050_pm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .of_match_table = mpu3050_of_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) .acpi_match_table = ACPI_PTR(mpu3050_acpi_match),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) .probe = mpu3050_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) .remove = mpu3050_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) .id_table = mpu3050_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) GPIO support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) ACPI 5 introduced two new resources to describe GPIO connections: GpioIo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) and GpioInt. These resources can be used to pass GPIO numbers used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) the device to the driver. ACPI 5.1 extended this with _DSD (Device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) Specific Data) which made it possible to name the GPIOs among other things.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) For example::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) Device (DEV)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) Method (_CRS, 0, NotSerialized)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) Name (SBUF, ResourceTemplate()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) // Used to power on/off the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) GpioIo (Exclusive, PullDefault, 0x0000, 0x0000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 0x00, ResourceConsumer,,)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) // Pin List
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 0x0055
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) // Interrupt for the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 0x0000, "\\_SB.PCI0.GPI0", 0x00, ResourceConsumer,,)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) // Pin list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 0x0058
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) Return (SBUF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) // ACPI 5.1 _DSD used for naming the GPIOs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) Name (_DSD, Package ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) Package ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) Package () {"power-gpios", Package() {^DEV, 0, 0, 0 }},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) Package () {"irq-gpios", Package() {^DEV, 1, 0, 0 }},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) specifies the path to the controller. In order to use these GPIOs in Linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) we need to translate them to the corresponding Linux GPIO descriptors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) There is a standard GPIO API for that and is documented in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) Documentation/admin-guide/gpio/.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) In the above example we can get the corresponding two GPIO descriptors with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) a code like this::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) #include <linux/gpio/consumer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) struct gpio_desc *irq_desc, *power_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) irq_desc = gpiod_get(dev, "irq");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) if (IS_ERR(irq_desc))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) /* handle error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) power_desc = gpiod_get(dev, "power");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) if (IS_ERR(power_desc))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) /* handle error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) /* Now we can use the GPIO descriptors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) There are also devm_* versions of these functions which release the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) descriptors once the device is released.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) See Documentation/firmware-guide/acpi/gpio-properties.rst for more information about the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) _DSD binding related to GPIOs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) MFD devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) The MFD devices register their children as platform devices. For the child
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) devices there needs to be an ACPI handle that they can use to reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) parts of the ACPI namespace that relate to them. In the Linux MFD subsystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) we provide two ways:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) - The children share the parent ACPI handle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) - The MFD cell can specify the ACPI id of the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) For the first case, the MFD drivers do not need to do anything. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) resulting child platform device will have its ACPI_COMPANION() set to point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) to the parent device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) If the ACPI namespace has a device that we can match using an ACPI id or ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) adr, the cell should be set like::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) static struct mfd_cell_acpi_match my_subdevice_cell_acpi_match = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) .pnpid = "XYZ0001",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) .adr = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) static struct mfd_cell my_subdevice_cell = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) .name = "my_subdevice",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) /* set the resources relative to the parent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) .acpi_match = &my_subdevice_cell_acpi_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) The ACPI id "XYZ0001" is then used to lookup an ACPI device directly under
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) the MFD device and if found, that ACPI companion device is bound to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) resulting child platform device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) Device Tree namespace link device ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) ====================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) The Device Tree protocol uses device identification based on the "compatible"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) property whose value is a string or an array of strings recognized as device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) identifiers by drivers and the driver core. The set of all those strings may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) regarded as a device identification namespace analogous to the ACPI/PNP device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) ID namespace. Consequently, in principle it should not be necessary to allocate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) a new (and arguably redundant) ACPI/PNP device ID for a devices with an existing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) identification string in the Device Tree (DT) namespace, especially if that ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) is only needed to indicate that a given device is compatible with another one,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) presumably having a matching driver in the kernel already.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) In ACPI, the device identification object called _CID (Compatible ID) is used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) list the IDs of devices the given one is compatible with, but those IDs must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) belong to one of the namespaces prescribed by the ACPI specification (see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) Section 6.1.2 of ACPI 6.0 for details) and the DT namespace is not one of them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) Moreover, the specification mandates that either a _HID or an _ADR identification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) object be present for all ACPI objects representing devices (Section 6.1 of ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 6.0). For non-enumerable bus types that object must be _HID and its value must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) be a device ID from one of the namespaces prescribed by the specification too.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) The special DT namespace link device ID, PRP0001, provides a means to use the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) existing DT-compatible device identification in ACPI and to satisfy the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) requirements following from the ACPI specification at the same time. Namely,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) if PRP0001 is returned by _HID, the ACPI subsystem will look for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) "compatible" property in the device object's _DSD and will use the value of that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) property to identify the corresponding device in analogy with the original DT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) device identification algorithm. If the "compatible" property is not present
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) or its value is not valid, the device will not be enumerated by the ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) subsystem. Otherwise, it will be enumerated automatically as a platform device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) (except when an I2C or SPI link from the device to its parent is present, in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) which case the ACPI core will leave the device enumeration to the parent's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) driver) and the identification strings from the "compatible" property value will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) be used to find a driver for the device along with the device IDs listed by _CID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) (if present).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) Analogously, if PRP0001 is present in the list of device IDs returned by _CID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) the identification strings listed by the "compatible" property value (if present
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) and valid) will be used to look for a driver matching the device, but in that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) case their relative priority with respect to the other device IDs listed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) _HID and _CID depends on the position of PRP0001 in the _CID return package.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) Specifically, the device IDs returned by _HID and preceding PRP0001 in the _CID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) return package will be checked first. Also in that case the bus type the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) will be enumerated to depends on the device ID returned by _HID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) For example, the following ACPI sample might be used to enumerate an lm75-type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) I2C temperature sensor and match it to the driver using the Device Tree
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) namespace link::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) Device (TMP0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) Name (_HID, "PRP0001")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) Name (_DSD, Package() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) Package () {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) Package (2) { "compatible", "ti,tmp75" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) Method (_CRS, 0, Serialized)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) Name (SBUF, ResourceTemplate ()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) I2cSerialBusV2 (0x48, ControllerInitiated,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 400000, AddressingMode7Bit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) "\\_SB.PCI0.I2C1", 0x00,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) ResourceConsumer, , Exclusive,)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) Return (SBUF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) It is valid to define device objects with a _HID returning PRP0001 and without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) the "compatible" property in the _DSD or a _CID as long as one of their
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) ancestors provides a _DSD with a valid "compatible" property. Such device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) objects are then simply regarded as additional "blocks" providing hierarchical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) configuration information to the driver of the composite ancestor device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) However, PRP0001 can only be returned from either _HID or _CID of a device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) object if all of the properties returned by the _DSD associated with it (either
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) the _DSD of the device object itself or the _DSD of its ancestor in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) "composite device" case described above) can be used in the ACPI environment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) Otherwise, the _DSD itself is regarded as invalid and therefore the "compatible"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) property returned by it is meaningless.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) Refer to :doc:`DSD-properties-rules` for more information.