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