xref: /linux/drivers/staging/media/atomisp/pci/ia_css_firmware.h (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 
16 #ifndef __IA_CSS_FIRMWARE_H
17 #define __IA_CSS_FIRMWARE_H
18 
19 /* @file
20  * This file contains firmware loading/unloading support functionality
21  */
22 
23 #include <linux/device.h>
24 #include "ia_css_err.h"
25 #include "ia_css_env.h"
26 
27 /* CSS firmware package structure.
28  */
29 struct ia_css_fw {
30 	void	    *data;  /** pointer to the firmware data */
31 	unsigned int bytes; /** length in bytes of firmware data */
32 };
33 
34 struct device;
35 
36 /* @brief Loads the firmware
37  * @param[in]	env		Environment, provides functions to access the
38  *				environment in which the CSS code runs. This is
39  *				used for host side memory access and message
40  *				printing.
41  * @param[in]	fw		Firmware package containing the firmware for all
42  *				predefined ISP binaries.
43  * @return			Returns -EINVAL in case of any
44  *				errors and 0 otherwise.
45  *
46  * This function interprets the firmware package. All
47  * contents of this firmware package are copied into local data structures, so
48  * the fw pointer could be freed after this function completes.
49  */
50 int
51 ia_css_load_firmware(struct device *dev, const struct ia_css_env *env,
52 		     const struct ia_css_fw  *fw);
53 
54 /* @brief Unloads the firmware
55  * @return	None
56  *
57  * This function unloads the firmware loaded by ia_css_load_firmware.
58  * It is pointless to call this function if no firmware is loaded,
59  * but it won't harm. Use this to deallocate all memory associated with the firmware.
60  * This function may only be called when the CSS API is in uninitialized state
61  * (e.g. after calling ia_css_uninit()).
62  */
63 void
64 ia_css_unload_firmware(void);
65 
66 #endif /* __IA_CSS_FIRMWARE_H */
67