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_MIPI_H 17 #define __IA_CSS_MIPI_H 18 19 /* @file 20 * This file contains MIPI support functionality 21 */ 22 23 #include <type_support.h> 24 #include "ia_css_err.h" 25 #include "ia_css_stream_format.h" 26 #include "ia_css_input_port.h" 27 28 /* Backward compatible for CSS API 2.0 only 29 * TO BE REMOVED when all drivers move to CSS API 2.1. 30 */ 31 /* @brief Specify a CSS MIPI frame buffer. 32 * 33 * @param[in] size_mem_words The frame size in memory words (32B). 34 * @param[in] contiguous Allocate memory physically contiguously or not. 35 * @return The error code. 36 * 37 * \deprecated{Use ia_css_mipi_buffer_config instead.} 38 * 39 * Specifies a CSS MIPI frame buffer: size in memory words (32B). 40 */ 41 int 42 ia_css_mipi_frame_specify(const unsigned int size_mem_words, 43 const bool contiguous); 44 45 #if !defined(HAS_NO_INPUT_SYSTEM) 46 /* @brief Register size of a CSS MIPI frame for check during capturing. 47 * 48 * @param[in] port CSI-2 port this check is registered. 49 * @param[in] size_mem_words The frame size in memory words (32B). 50 * @return Return the error in case of failure. E.g. MAX_NOF_ENTRIES REACHED 51 * 52 * Register size of a CSS MIPI frame to check during capturing. Up to 53 * IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES entries per port allowed. Entries are reset 54 * when stream is stopped. 55 * 56 * 57 */ 58 int 59 ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, 60 const unsigned int size_mem_words); 61 #endif 62 63 /* @brief Calculate the size of a mipi frame. 64 * 65 * @param[in] width The width (in pixels) of the frame. 66 * @param[in] height The height (in lines) of the frame. 67 * @param[in] format The frame (MIPI) format. 68 * @param[in] hasSOLandEOL Whether frame (MIPI) contains (optional) SOL and EOF packets. 69 * @param[in] embedded_data_size_words Embedded data size in memory words. 70 * @param size_mem_words The mipi frame size in memory words (32B). 71 * @return The error code. 72 * 73 * Calculate the size of a mipi frame, based on the resolution and format. 74 */ 75 int 76 ia_css_mipi_frame_calculate_size(const unsigned int width, 77 const unsigned int height, 78 const enum atomisp_input_format format, 79 const bool hasSOLandEOL, 80 const unsigned int embedded_data_size_words, 81 unsigned int *size_mem_words); 82 83 #endif /* __IA_CSS_MIPI_H */ 84