From 53adc478c89511d5614940fd7580e8225160d007 Mon Sep 17 00:00:00 2001 From: Vikram Mulukutla Date: Mon, 5 Aug 2013 11:39:20 -0700 Subject: firmware_class: Introduce the request_firmware_direct API On devices with low memory, using request_firmware on rather large firmware images results in a memory usage penalty that might be unaffordable. Introduce a new API that allows the firmware image to be directly loaded to a destination address without using any intermediate buffer. Change-Id: I51b55dd9044ea669e2126a3f908028850bf76325 Signed-off-by: Vikram Mulukutla [joshc: renamed request_firmware_direct to request_firmware_into_buf, avoiding namespace conflict] Signed-off-by: Josh Cartwright [vmulukut: upstream merge conflict fixups] Signed-off-by: Vikram Mulukutla [dkeitel: upstream merge conflict fixups] Signed-off-by: David Keitel --- include/linux/firmware.h | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 5c41c5e75b5c..bb31b5ad09f7 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h @@ -48,6 +48,18 @@ int request_firmware_nowait( int request_firmware_direct(const struct firmware **fw, const char *name, struct device *device); +int request_firmware_into_buf(const char *name, struct device *device, + phys_addr_t dest_addr, size_t dest_size, + void * (*map_fw_mem)(phys_addr_t phys, + size_t size), + void (*unmap_fw_mem)(void *virt)); +int request_firmware_nowait_into_buf( + struct module *module, bool uevent, + const char *name, struct device *device, gfp_t gfp, void *context, + void (*cont)(const struct firmware *fw, void *context), + phys_addr_t dest_addr, size_t dest_size, + void * (*map_fw_mem)(phys_addr_t phys, size_t size), + void (*unmap_fw_mem)(void *virt)); void release_firmware(const struct firmware *fw); #else static inline int request_firmware(const struct firmware **fw, @@ -56,6 +68,16 @@ static inline int request_firmware(const struct firmware **fw, { return -EINVAL; } +static inline int request_firmware_into_buf(const char *name, + struct device *device, + phys_addr_t dest_addr, + size_t dest_size, + void * (*map_fw_mem)(phys_addr_t phys, + size_t size), + void (*unmap_fw_mem)(void *virt)) +{ + return -EINVAL; +} static inline int request_firmware_nowait( struct module *module, bool uevent, const char *name, struct device *device, gfp_t gfp, void *context, @@ -63,7 +85,16 @@ static inline int request_firmware_nowait( { return -EINVAL; } - +static inline int request_firmware_nowait_into_buf( + struct module *module, bool uevent, + const char *name, struct device *device, gfp_t gfp, void *context, + void (*cont)(const struct firmware *fw, void *context), + phys_addr_t dest_addr, size_t dest_size, + void * (*map_fw_mem)(phys_addr_t phys, size_t size), + void (*unmap_fw_mem)(void *virt)) +{ + return -EINVAL; +} static inline void release_firmware(const struct firmware *fw) { } -- cgit v1.2.3