Merge tag 'powerpc-4.15-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[sfrench/cifs-2.6.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / ia_css_mipi.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #ifndef __IA_CSS_MIPI_H
16 #define __IA_CSS_MIPI_H
17
18 /* @file
19  * This file contains MIPI support functionality
20  */
21
22 #include <type_support.h>
23 #include "ia_css_err.h"
24 #include "ia_css_stream_format.h"
25 #include "ia_css_input_port.h"
26
27 /* Backward compatible for CSS API 2.0 only
28  * TO BE REMOVED when all drivers move to CSS API 2.1.
29  */
30 /* @brief Specify a CSS MIPI frame buffer.
31  *
32  * @param[in]   size_mem_words  The frame size in memory words (32B).
33  * @param[in]   contiguous      Allocate memory physically contiguously or not.
34  * @return              The error code.
35  *
36  * \deprecated{Use ia_css_mipi_buffer_config instead.}
37  *
38  * Specifies a CSS MIPI frame buffer: size in memory words (32B).
39  */
40 enum ia_css_err
41 ia_css_mipi_frame_specify(const unsigned int    size_mem_words,
42                                 const bool contiguous);
43
44 #if !defined(HAS_NO_INPUT_SYSTEM)
45 /* @brief Register size of a CSS MIPI frame for check during capturing.
46  *
47  * @param[in]   port    CSI-2 port this check is registered.
48  * @param[in]   size_mem_words  The frame size in memory words (32B).
49  * @return              Return the error in case of failure. E.g. MAX_NOF_ENTRIES REACHED
50  *
51  * Register size of a CSS MIPI frame to check during capturing. Up to
52  *              IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES entries per port allowed. Entries are reset
53  *              when stream is stopped.
54  *
55  *
56  */
57 enum ia_css_err
58 ia_css_mipi_frame_enable_check_on_size(const enum ia_css_csi2_port port,
59                                 const unsigned int      size_mem_words);
60 #endif
61
62 /* @brief Calculate the size of a mipi frame.
63  *
64  * @param[in]   width           The width (in pixels) of the frame.
65  * @param[in]   height          The height (in lines) of the frame.
66  * @param[in]   format          The frame (MIPI) format.
67  * @param[in]   hasSOLandEOL    Whether frame (MIPI) contains (optional) SOL and EOF packets.
68  * @param[in]   embedded_data_size_words                Embedded data size in memory words.
69  * @param               size_mem_words                                  The mipi frame size in memory words (32B).
70  * @return              The error code.
71  *
72  * Calculate the size of a mipi frame, based on the resolution and format.
73  */
74 enum ia_css_err
75 ia_css_mipi_frame_calculate_size(const unsigned int width,
76                                 const unsigned int height,
77                                 const enum ia_css_stream_format format,
78                                 const bool hasSOLandEOL,
79                                 const unsigned int embedded_data_size_words,
80                                 unsigned int *size_mem_words);
81
82 #endif /* __IA_CSS_MIPI_H */