// SPDX-License-Identifier: GPL-2.0 /* * Support for Intel Camera Imaging ISP subsystem. * Copyright (c) 2015, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ #include "ia_css_mipi.h" #include "sh_css_mipi.h" #include <type_support.h> #include "system_global.h" #include "ia_css_err.h" #include "ia_css_pipe.h" #include "ia_css_stream_format.h" #include "sh_css_stream_format.h" #include "ia_css_stream_public.h" #include "ia_css_frame_public.h" #include "ia_css_input_port.h" #include "ia_css_debug.h" #include "sh_css_struct.h" #include "sh_css_defs.h" #include "sh_css_sp.h" /* sh_css_update_host2sp_mipi_frame sh_css_update_host2sp_num_mipi_frames ... */ #include "sw_event_global.h" /* IA_CSS_PSYS_SW_EVENT_MIPI_BUFFERS_READY */ static u32 ref_count_mipi_allocation[N_CSI_PORTS]; /* Initialized in mipi_init */ /* Assumptions: * - A line is multiple of 4 bytes = 1 word. * - Each frame has SOF and EOF (each 1 word). * - Each line has format header and optionally SOL and EOL (each 1 word). * - Odd and even lines of YUV420 format are different in bites per pixel size. * - Custom size of embedded data. * -- Interleaved frames are not taken into account. * -- Lines are multiples of 8B, and not necessary of (custom 3B, or 7B * etc.). * Result is given in DDR mem words, 32B or 256 bits */ int ia_css_mipi_frame_calculate_size(const unsigned int width, const unsigned int height, const enum atomisp_input_format format, const bool hasSOLandEOL, const unsigned int embedded_data_size_words, unsigned int *size_mem_words) { … } void mipi_init(void) { … } bool mipi_is_free(void) { … } /* * @brief Calculate the required MIPI buffer sizes. * Based on the stream configuration, calculate the * required MIPI buffer sizes (in DDR words). * * @param[in] stream_cfg Point to the target stream configuration * @param[out] size_mem_words MIPI buffer size in DDR words. * * @return */ static int calculate_mipi_buff_size(struct ia_css_stream_config *stream_cfg, unsigned int *size_mem_words) { … } int allocate_mipi_frames(struct ia_css_pipe *pipe, struct ia_css_stream_info *info) { … } int free_mipi_frames(struct ia_css_pipe *pipe) { … } int send_mipi_frames(struct ia_css_pipe *pipe) { … }