non-d0-probe.rst 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. .. SPDX-License-Identifier: GPL-2.0
  2. ========================================
  3. Probing devices in other D states than 0
  4. ========================================
  5. Introduction
  6. ============
  7. In some cases it may be preferred to leave certain devices powered off for the
  8. entire system bootup if powering on these devices has adverse side effects,
  9. beyond just powering on the said device.
  10. How it works
  11. ============
  12. The _DSC (Device State for Configuration) object that evaluates to an integer
  13. may be used to tell Linux the highest allowed D state for a device during
  14. probe. The support for _DSC requires support from the kernel bus type if the
  15. bus driver normally sets the device in D0 state for probe.
  16. The downside of using _DSC is that as the device is not powered on, even if
  17. there's a problem with the device, the driver likely probes just fine but the
  18. first user will find out the device doesn't work, instead of a failure at probe
  19. time. This feature should thus be used sparingly.
  20. I²C
  21. ---
  22. If an I²C driver indicates its support for this by setting the
  23. I2C_DRV_ACPI_WAIVE_D0_PROBE flag in struct i2c_driver.flags field and the
  24. _DSC object evaluates to integer higher than the D state of the device,
  25. the device will not be powered on (put in D0 state) for probe.
  26. D states
  27. --------
  28. The D states and thus also the allowed values for _DSC are listed below. Refer
  29. to [1] for more information on device power states.
  30. .. code-block:: text
  31. Number State Description
  32. 0 D0 Device fully powered on
  33. 1 D1
  34. 2 D2
  35. 3 D3hot
  36. 4 D3cold Off
  37. References
  38. ==========
  39. [1] https://uefi.org/specifications/ACPI/6.4/02_Definition_of_Terms/Definition_of_Terms.html#device-power-state-definitions
  40. Example
  41. =======
  42. An ASL example describing an ACPI device using _DSC object to tell Operating
  43. System the device should remain powered off during probe looks like this. Some
  44. objects not relevant from the example point of view have been omitted.
  45. .. code-block:: text
  46. Device (CAM0)
  47. {
  48. Name (_HID, "SONY319A")
  49. Name (_UID, Zero)
  50. Name (_CRS, ResourceTemplate ()
  51. {
  52. I2cSerialBus(0x0020, ControllerInitiated, 0x00061A80,
  53. AddressingMode7Bit, "\\_SB.PCI0.I2C0",
  54. 0x00, ResourceConsumer)
  55. })
  56. Method (_DSC, 0, NotSerialized)
  57. {
  58. Return (0x4)
  59. }
  60. }