request_firmware.rst 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ====================
  2. request_firmware API
  3. ====================
  4. You would typically load firmware and then load it into your device somehow.
  5. The typical firmware work flow is reflected below::
  6. if(request_firmware(&fw_entry, $FIRMWARE, device) == 0)
  7. copy_fw_to_device(fw_entry->data, fw_entry->size);
  8. release_firmware(fw_entry);
  9. Synchronous firmware requests
  10. =============================
  11. Synchronous firmware requests will wait until the firmware is found or until
  12. an error is returned.
  13. request_firmware
  14. ----------------
  15. .. kernel-doc:: drivers/base/firmware_loader/main.c
  16. :functions: request_firmware
  17. firmware_request_nowarn
  18. -----------------------
  19. .. kernel-doc:: drivers/base/firmware_loader/main.c
  20. :functions: firmware_request_nowarn
  21. request_firmware_direct
  22. -----------------------
  23. .. kernel-doc:: drivers/base/firmware_loader/main.c
  24. :functions: request_firmware_direct
  25. request_firmware_into_buf
  26. -------------------------
  27. .. kernel-doc:: drivers/base/firmware_loader/main.c
  28. :functions: request_firmware_into_buf
  29. Asynchronous firmware requests
  30. ==============================
  31. Asynchronous firmware requests allow driver code to not have to wait
  32. until the firmware or an error is returned. Function callbacks are
  33. provided so that when the firmware or an error is found the driver is
  34. informed through the callback. request_firmware_nowait() cannot be called
  35. in atomic contexts.
  36. request_firmware_nowait
  37. -----------------------
  38. .. kernel-doc:: drivers/base/firmware_loader/main.c
  39. :functions: request_firmware_nowait
  40. Special optimizations on reboot
  41. ===============================
  42. Some devices have an optimization in place to enable the firmware to be
  43. retained during system reboot. When such optimizations are used the driver
  44. author must ensure the firmware is still available on resume from suspend,
  45. this can be done with firmware_request_cache() instead of requesting for the
  46. firmware to be loaded.
  47. firmware_request_cache()
  48. ------------------------
  49. .. kernel-doc:: drivers/base/firmware_loader/main.c
  50. :functions: firmware_request_cache
  51. request firmware API expected driver use
  52. ========================================
  53. Once an API call returns you process the firmware and then release the
  54. firmware. For example if you used request_firmware() and it returns,
  55. the driver has the firmware image accessible in fw_entry->{data,size}.
  56. If something went wrong request_firmware() returns non-zero and fw_entry
  57. is set to NULL. Once your driver is done with processing the firmware it
  58. can call call release_firmware(fw_entry) to release the firmware image
  59. and any related resource.