xref: /linux/drivers/staging/media/atomisp/pci/camera/pipe/src/pipe_util.c (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
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 #include "ia_css_pipe_util.h"
17 #include "ia_css_frame_public.h"
18 #include "ia_css_pipe.h"
19 #include "ia_css_util.h"
20 #include "assert_support.h"
21 
ia_css_pipe_util_pipe_input_format_bpp(const struct ia_css_pipe * const pipe)22 unsigned int ia_css_pipe_util_pipe_input_format_bpp(
23     const struct ia_css_pipe *const pipe)
24 {
25 	assert(pipe);
26 	assert(pipe->stream);
27 
28 	return ia_css_util_input_format_bpp(pipe->stream->config.input_config.format,
29 					    pipe->stream->config.pixels_per_clock == 2);
30 }
31 
ia_css_pipe_util_create_output_frames(struct ia_css_frame * frames[])32 void ia_css_pipe_util_create_output_frames(
33     struct ia_css_frame *frames[])
34 {
35 	unsigned int i;
36 
37 	assert(frames);
38 	for (i = 0; i < IA_CSS_BINARY_MAX_OUTPUT_PORTS; i++) {
39 		frames[i] = NULL;
40 	}
41 }
42 
ia_css_pipe_util_set_output_frames(struct ia_css_frame * frames[],unsigned int idx,struct ia_css_frame * frame)43 void ia_css_pipe_util_set_output_frames(
44     struct ia_css_frame *frames[],
45     unsigned int idx,
46     struct ia_css_frame *frame)
47 {
48 	assert(idx < IA_CSS_BINARY_MAX_OUTPUT_PORTS);
49 
50 	frames[idx] = frame;
51 }
52