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 "ia_css_err.h" 24 #include "ia_css_env.h" 25 26 /* CSS firmware package structure. 27 */ 28 struct ia_css_fw { 29 void *data; /** pointer to the firmware data */ 30 unsigned int bytes; /** length in bytes of firmware data */ 31 }; 32 33 /* @brief Loads the firmware 34 * @param[in] env Environment, provides functions to access the 35 * environment in which the CSS code runs. This is 36 * used for host side memory access and message 37 * printing. 38 * @param[in] fw Firmware package containing the firmware for all 39 * predefined ISP binaries. 40 * @return Returns -EINVAL in case of any 41 * errors and 0 otherwise. 42 * 43 * This function interprets the firmware package. All 44 * contents of this firmware package are copied into local data structures, so 45 * the fw pointer could be freed after this function completes. 46 * 47 * Rationale for this function is that it can be called before ia_css_init, and thus 48 * speeds up ia_css_init (ia_css_init is called each time a stream is created but the 49 * firmware only needs to be loaded once). 50 */ 51 int 52 ia_css_load_firmware(struct device *dev, const struct ia_css_env *env, 53 const struct ia_css_fw *fw); 54 55 /* @brief Unloads the firmware 56 * @return None 57 * 58 * This function unloads the firmware loaded by ia_css_load_firmware. 59 * It is pointless to call this function if no firmware is loaded, 60 * but it won't harm. Use this to deallocate all memory associated with the firmware. 61 */ 62 void 63 ia_css_unload_firmware(void); 64 65 #endif /* __IA_CSS_FIRMWARE_H */ 66