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_CONTROL_H 8 #define __IA_CSS_CONTROL_H 9 10 /* @file 11 * This file contains functionality for starting and controlling CSS 12 */ 13 14 #include <type_support.h> 15 #include <ia_css_env.h> 16 #include <ia_css_firmware.h> 17 #include <ia_css_irq.h> 18 19 /* @brief Initialize the CSS API. 20 * @param[in] env Environment, provides functions to access the 21 * environment in which the CSS code runs. This is 22 * used for host side memory access and message 23 * printing. May not be NULL. 24 * @param[in] l1_base Base index (isp2400) 25 * of the L1 page table. This is a physical 26 * address or index. 27 * @param[in] irq_type The type of interrupt to be used (edge or level) 28 * @return Returns -EINVAL in case of any 29 * errors and 0 otherwise. 30 * 31 * This function initializes the API which includes allocating and initializing 32 * internal data structures. 33 * ia_css_load_firmware() must be called to load the firmware before calling 34 * this function. 35 */ 36 int ia_css_init(struct device *dev, 37 const struct ia_css_env *env, 38 u32 l1_base, 39 enum ia_css_irq_type irq_type); 40 41 /* @brief Un-initialize the CSS API. 42 * @return None 43 * 44 * This function deallocates all memory that has been allocated by the CSS API. 45 * After this function is called, no other CSS functions should be called. 46 */ 47 void 48 ia_css_uninit(void); 49 50 /* @brief Enable use of a separate queue for ISYS events. 51 * 52 * @param[in] enable: enable or disable use of separate ISYS event queues. 53 * @return error if called when SP is running. 54 * 55 * @deprecated{This is a temporary function that allows drivers to migrate to 56 * the use of the separate ISYS event queue. Once all drivers supports this, it 57 * will be made the default and this function will be removed. 58 * This function should only be called when the SP is not running, calling it 59 * when the SP is running will result in an error value being returned. } 60 */ 61 int 62 ia_css_enable_isys_event_queue(bool enable); 63 64 /* @brief Test whether the ISP has started. 65 * 66 * @return Boolean flag true if the ISP has started or false otherwise. 67 * 68 * Temporary function to poll whether the ISP has been started. Once it has, 69 * the sensor can also be started. */ 70 bool 71 ia_css_isp_has_started(void); 72 73 /* @brief Test whether the SP has initialized. 74 * 75 * @return Boolean flag true if the SP has initialized or false otherwise. 76 * 77 * Temporary function to poll whether the SP has been initialized. Once it has, 78 * we can enqueue buffers. */ 79 bool 80 ia_css_sp_has_initialized(void); 81 82 /* @brief Test whether the SP has terminated. 83 * 84 * @return Boolean flag true if the SP has terminated or false otherwise. 85 * 86 * Temporary function to poll whether the SP has been terminated. Once it has, 87 * we can switch mode. */ 88 bool 89 ia_css_sp_has_terminated(void); 90 91 /* @brief start SP hardware 92 * 93 * @return 0 or error code upon error. 94 * 95 * It will boot the SP hardware and start multi-threading infrastructure. 96 * All threads will be started and blocked by semaphore. This function should 97 * be called before any ia_css_stream_start(). 98 */ 99 int 100 ia_css_start_sp(void); 101 102 /* @brief stop SP hardware 103 * 104 * @return 0 or error code upon error. 105 * 106 * This function will terminate all threads and shut down SP. It should be 107 * called after all ia_css_stream_stop(). 108 */ 109 int 110 ia_css_stop_sp(void); 111 112 #endif /* __IA_CSS_CONTROL_H */ 113