1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2015, Intel Corporation.
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.
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
16 #ifndef __IA_CSS_CONTROL_H
17 #define __IA_CSS_CONTROL_H
20 * This file contains functionality for starting and controlling CSS
23 #include <type_support.h>
24 #include <ia_css_env.h>
25 #include <ia_css_firmware.h>
26 #include <ia_css_irq.h>
28 /* @brief Initialize the CSS API.
29 * @param[in] env Environment, provides functions to access the
30 * environment in which the CSS code runs. This is
31 * used for host side memory access and message
32 * printing. May not be NULL.
33 * @param[in] fw Firmware package containing the firmware for all
34 * predefined ISP binaries.
35 * if fw is NULL the firmware must be loaded before
36 * through a call of ia_css_load_firmware
37 * @param[in] l1_base Base index (isp2400)
38 * of the L1 page table. This is a physical
40 * @param[in] irq_type The type of interrupt to be used (edge or level)
41 * @return Returns -EINVAL in case of any
42 * errors and 0 otherwise.
44 * This function initializes the API which includes allocating and initializing
45 * internal data structures. This also interprets the firmware package. All
46 * contents of this firmware package are copied into local data structures, so
47 * the fw pointer could be freed after this function completes.
49 int ia_css_init(struct device *dev,
50 const struct ia_css_env *env,
51 const struct ia_css_fw *fw,
53 enum ia_css_irq_type irq_type);
55 /* @brief Un-initialize the CSS API.
58 * This function deallocates all memory that has been allocated by the CSS API
59 * Exception: if you explicitly loaded firmware through ia_css_load_firmware
60 * you need to call ia_css_unload_firmware to deallocate the memory reserved
62 * After this function is called, no other CSS functions should be called
63 * with the exception of ia_css_init which will re-initialize the CSS code,
64 * ia_css_unload_firmware to unload the firmware or ia_css_load_firmware
65 * to load new firmware
70 /* @brief Enable use of a separate queue for ISYS events.
72 * @param[in] enable: enable or disable use of separate ISYS event queues.
73 * @return error if called when SP is running.
75 * @deprecated{This is a temporary function that allows drivers to migrate to
76 * the use of the separate ISYS event queue. Once all drivers supports this, it
77 * will be made the default and this function will be removed.
78 * This function should only be called when the SP is not running, calling it
79 * when the SP is running will result in an error value being returned. }
82 ia_css_enable_isys_event_queue(bool enable);
84 /* @brief Test whether the ISP has started.
86 * @return Boolean flag true if the ISP has started or false otherwise.
88 * Temporary function to poll whether the ISP has been started. Once it has,
89 * the sensor can also be started. */
91 ia_css_isp_has_started(void);
93 /* @brief Test whether the SP has initialized.
95 * @return Boolean flag true if the SP has initialized or false otherwise.
97 * Temporary function to poll whether the SP has been initialized. Once it has,
98 * we can enqueue buffers. */
100 ia_css_sp_has_initialized(void);
102 /* @brief Test whether the SP has terminated.
104 * @return Boolean flag true if the SP has terminated or false otherwise.
106 * Temporary function to poll whether the SP has been terminated. Once it has,
107 * we can switch mode. */
109 ia_css_sp_has_terminated(void);
111 /* @brief start SP hardware
113 * @return 0 or error code upon error.
115 * It will boot the SP hardware and start multi-threading infrastructure.
116 * All threads will be started and blocked by semaphore. This function should
117 * be called before any ia_css_stream_start().
120 ia_css_start_sp(void);
122 /* @brief stop SP hardware
124 * @return 0 or error code upon error.
126 * This function will terminate all threads and shut down SP. It should be
127 * called after all ia_css_stream_stop().
130 ia_css_stop_sp(void);
132 #endif /* __IA_CSS_CONTROL_H */