|
@@ -656,6 +656,30 @@ int request_firmware_direct(const struct firmware **firmware_p,
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(request_firmware_direct);
|
|
|
|
|
|
+/**
|
|
|
+ * firmware_request_cache: - cache firmware for suspend so resume can use it
|
|
|
+ * @name: name of firmware file
|
|
|
+ * @device: device for which firmware should be cached for
|
|
|
+ *
|
|
|
+ * There are some devices with an optimization that enables the device to not
|
|
|
+ * require loading firmware on system reboot. This optimization may still
|
|
|
+ * require the firmware present on resume from suspend. This routine can be
|
|
|
+ * used to ensure the firmware is present on resume from suspend in these
|
|
|
+ * situations. This helper is not compatible with drivers which use
|
|
|
+ * request_firmware_into_buf() or request_firmware_nowait() with no uevent set.
|
|
|
+ **/
|
|
|
+int firmware_request_cache(struct device *device, const char *name)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ mutex_lock(&fw_lock);
|
|
|
+ ret = fw_add_devm_name(device, name);
|
|
|
+ mutex_unlock(&fw_lock);
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(firmware_request_cache);
|
|
|
+
|
|
|
/**
|
|
|
* request_firmware_into_buf - load firmware into a previously allocated buffer
|
|
|
* @firmware_p: pointer to firmware image
|