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