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 */ 29struct ia_css_fw { 30 void *data; /** pointer to the firmware data */ 31 unsigned int bytes; /** length in bytes of firmware data */ 32}; 33 34struct 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 * Rationale for this function is that it can be called before ia_css_init, and thus 51 * speeds up ia_css_init (ia_css_init is called each time a stream is created but the 52 * firmware only needs to be loaded once). 53 */ 54int 55ia_css_load_firmware(struct device *dev, const struct ia_css_env *env, 56 const struct ia_css_fw *fw); 57 58/* @brief Unloads the firmware 59 * @return None 60 * 61 * This function unloads the firmware loaded by ia_css_load_firmware. 62 * It is pointless to call this function if no firmware is loaded, 63 * but it won't harm. Use this to deallocate all memory associated with the firmware. 64 */ 65void 66ia_css_unload_firmware(void); 67 68#endif /* __IA_CSS_FIRMWARE_H */ 69