1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  */
6 
7 #ifndef __IA_CSS_FIRMWARE_H
8 #define __IA_CSS_FIRMWARE_H
9 
10 /* @file
11  * This file contains firmware loading/unloading support functionality
12  */
13 
14 #include <linux/device.h>
15 #include "ia_css_err.h"
16 #include "ia_css_env.h"
17 
18 /* CSS firmware package structure.
19  */
20 struct ia_css_fw {
21 	void	    *data;  /** pointer to the firmware data */
22 	unsigned int bytes; /** length in bytes of firmware data */
23 };
24 
25 struct device;
26 
27 /* @brief Loads the firmware
28  * @param[in]	env		Environment, provides functions to access the
29  *				environment in which the CSS code runs. This is
30  *				used for host side memory access and message
31  *				printing.
32  * @param[in]	fw		Firmware package containing the firmware for all
33  *				predefined ISP binaries.
34  * @return			Returns -EINVAL in case of any
35  *				errors and 0 otherwise.
36  *
37  * This function interprets the firmware package. All
38  * contents of this firmware package are copied into local data structures, so
39  * the fw pointer could be freed after this function completes.
40  */
41 int
42 ia_css_load_firmware(struct device *dev, const struct ia_css_env *env,
43 		     const struct ia_css_fw  *fw);
44 
45 /* @brief Unloads the firmware
46  * @return	None
47  *
48  * This function unloads the firmware loaded by ia_css_load_firmware.
49  * It is pointless to call this function if no firmware is loaded,
50  * but it won't harm. Use this to deallocate all memory associated with the firmware.
51  * This function may only be called when the CSS API is in uninitialized state
52  * (e.g. after calling ia_css_uninit()).
53  */
54 void
55 ia_css_unload_firmware(void);
56 
57 #endif /* __IA_CSS_FIRMWARE_H */
58