1ed66f12bSSakari Ailus.. SPDX-License-Identifier: GPL-2.0 2ed66f12bSSakari Ailus 3ed66f12bSSakari Ailus======================================== 4ed66f12bSSakari AilusProbing devices in other D states than 0 5ed66f12bSSakari Ailus======================================== 6ed66f12bSSakari Ailus 7ed66f12bSSakari AilusIntroduction 8ed66f12bSSakari Ailus============ 9ed66f12bSSakari Ailus 10ed66f12bSSakari AilusIn some cases it may be preferred to leave certain devices powered off for the 11ed66f12bSSakari Ailusentire system bootup if powering on these devices has adverse side effects, 12ed66f12bSSakari Ailusbeyond just powering on the said device. 13ed66f12bSSakari Ailus 14ed66f12bSSakari AilusHow it works 15ed66f12bSSakari Ailus============ 16ed66f12bSSakari Ailus 17ed66f12bSSakari AilusThe _DSC (Device State for Configuration) object that evaluates to an integer 18ed66f12bSSakari Ailusmay be used to tell Linux the highest allowed D state for a device during 19ed66f12bSSakari Ailusprobe. The support for _DSC requires support from the kernel bus type if the 20ed66f12bSSakari Ailusbus driver normally sets the device in D0 state for probe. 21ed66f12bSSakari Ailus 22ed66f12bSSakari AilusThe downside of using _DSC is that as the device is not powered on, even if 23ed66f12bSSakari Ailusthere's a problem with the device, the driver likely probes just fine but the 24ed66f12bSSakari Ailusfirst user will find out the device doesn't work, instead of a failure at probe 25ed66f12bSSakari Ailustime. This feature should thus be used sparingly. 26ed66f12bSSakari Ailus 27ed66f12bSSakari AilusI²C 28ed66f12bSSakari Ailus--- 29ed66f12bSSakari Ailus 30ed66f12bSSakari AilusIf an I²C driver indicates its support for this by setting the 31ed66f12bSSakari AilusI2C_DRV_ACPI_WAIVE_D0_PROBE flag in struct i2c_driver.flags field and the 32ed66f12bSSakari Ailus_DSC object evaluates to integer higher than the D state of the device, 33ed66f12bSSakari Ailusthe device will not be powered on (put in D0 state) for probe. 34ed66f12bSSakari Ailus 35ed66f12bSSakari AilusD states 36ed66f12bSSakari Ailus-------- 37ed66f12bSSakari Ailus 38ed66f12bSSakari AilusThe D states and thus also the allowed values for _DSC are listed below. Refer 39ed66f12bSSakari Ailusto [1] for more information on device power states. 40ed66f12bSSakari Ailus 41ed66f12bSSakari Ailus.. code-block:: text 42ed66f12bSSakari Ailus 43ed66f12bSSakari Ailus Number State Description 44ed66f12bSSakari Ailus 0 D0 Device fully powered on 45ed66f12bSSakari Ailus 1 D1 46ed66f12bSSakari Ailus 2 D2 47ed66f12bSSakari Ailus 3 D3hot 48ed66f12bSSakari Ailus 4 D3cold Off 49ed66f12bSSakari Ailus 50ed66f12bSSakari AilusReferences 51ed66f12bSSakari Ailus========== 52ed66f12bSSakari Ailus 53ed66f12bSSakari Ailus[1] https://uefi.org/specifications/ACPI/6.4/02_Definition_of_Terms/Definition_of_Terms.html#device-power-state-definitions 54ed66f12bSSakari Ailus 55ed66f12bSSakari AilusExample 56ed66f12bSSakari Ailus======= 57ed66f12bSSakari Ailus 58ed66f12bSSakari AilusAn ASL example describing an ACPI device using _DSC object to tell Operating 59ed66f12bSSakari AilusSystem the device should remain powered off during probe looks like this. Some 60ed66f12bSSakari Ailusobjects not relevant from the example point of view have been omitted. 61ed66f12bSSakari Ailus 62ed66f12bSSakari Ailus.. code-block:: text 63ed66f12bSSakari Ailus 64ed66f12bSSakari Ailus Device (CAM0) 65ed66f12bSSakari Ailus { 66ed66f12bSSakari Ailus Name (_HID, "SONY319A") 67ed66f12bSSakari Ailus Name (_UID, Zero) 68ed66f12bSSakari Ailus Name (_CRS, ResourceTemplate () 69ed66f12bSSakari Ailus { 70ed66f12bSSakari Ailus I2cSerialBus(0x0020, ControllerInitiated, 0x00061A80, 71ed66f12bSSakari Ailus AddressingMode7Bit, "\\_SB.PCI0.I2C0", 72ed66f12bSSakari Ailus 0x00, ResourceConsumer) 73ed66f12bSSakari Ailus }) 74*dff5acfdSSakari Ailus Method (_DSC, 0, NotSerialized) 75ed66f12bSSakari Ailus { 76ed66f12bSSakari Ailus Return (0x4) 77ed66f12bSSakari Ailus } 78ed66f12bSSakari Ailus } 79