GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / camera / pipe / src / pipe_stagedesc.c
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 #include "ia_css_pipe_stagedesc.h"
16 #include "assert_support.h"
17 #include "ia_css_debug.h"
18
19 void ia_css_pipe_get_generic_stage_desc(
20         struct ia_css_pipeline_stage_desc *stage_desc,
21         struct ia_css_binary *binary,
22         struct ia_css_frame *out_frame[],
23         struct ia_css_frame *in_frame,
24         struct ia_css_frame *vf_frame)
25 {
26         unsigned int i;
27         IA_CSS_ENTER_PRIVATE("stage_desc = %p, binary = %p, out_frame = %p, in_frame = %p, vf_frame = %p",
28                              stage_desc, binary, out_frame, in_frame, vf_frame);
29
30         assert(stage_desc != NULL && binary != NULL && binary->info != NULL);
31         if (stage_desc == NULL || binary == NULL || binary->info == NULL) {
32                 IA_CSS_ERROR("invalid arguments");
33                 goto ERR;
34         }
35
36         stage_desc->binary = binary;
37         stage_desc->firmware = NULL;
38         stage_desc->sp_func = IA_CSS_PIPELINE_NO_FUNC;
39         stage_desc->max_input_width = 0;
40         stage_desc->mode = binary->info->sp.pipeline.mode;
41         stage_desc->in_frame = in_frame;
42         for (i = 0; i < IA_CSS_BINARY_MAX_OUTPUT_PORTS; i++) {
43                 stage_desc->out_frame[i] = out_frame[i];
44         }
45         stage_desc->vf_frame = vf_frame;
46 ERR:
47         IA_CSS_LEAVE_PRIVATE("");
48 }
49
50 void ia_css_pipe_get_firmwares_stage_desc(
51         struct ia_css_pipeline_stage_desc *stage_desc,
52         struct ia_css_binary *binary,
53         struct ia_css_frame *out_frame[],
54         struct ia_css_frame *in_frame,
55         struct ia_css_frame *vf_frame,
56         const struct ia_css_fw_info *fw,
57         unsigned int mode)
58 {
59         unsigned int i;
60
61         ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "ia_css_pipe_get_firmwares_stage_desc() enter:\n");
62         stage_desc->binary = binary;
63         stage_desc->firmware = fw;
64         stage_desc->sp_func = IA_CSS_PIPELINE_NO_FUNC;
65         stage_desc->max_input_width = 0;
66         stage_desc->mode = mode;
67         stage_desc->in_frame = in_frame;
68         for (i = 0; i < IA_CSS_BINARY_MAX_OUTPUT_PORTS; i++) {
69                 stage_desc->out_frame[i] = out_frame[i];
70         }
71         stage_desc->vf_frame = vf_frame;
72 }
73
74 void ia_css_pipe_get_acc_stage_desc(
75         struct ia_css_pipeline_stage_desc *stage_desc,
76         struct ia_css_binary *binary,
77         struct ia_css_fw_info *fw)
78 {
79         unsigned int i;
80
81         ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "ia_css_pipe_get_acc_stage_desc() enter:\n");
82         stage_desc->binary = binary;
83         stage_desc->firmware = fw;
84         stage_desc->sp_func = IA_CSS_PIPELINE_NO_FUNC;
85         stage_desc->max_input_width = 0;
86         stage_desc->mode = IA_CSS_BINARY_MODE_VF_PP;
87         stage_desc->in_frame = NULL;
88         for (i = 0; i < IA_CSS_BINARY_MAX_OUTPUT_PORTS; i++) {
89                 stage_desc->out_frame[i] = NULL;
90         }
91         stage_desc->vf_frame = NULL;
92 }
93
94 void ia_css_pipe_get_sp_func_stage_desc(
95         struct ia_css_pipeline_stage_desc *stage_desc,
96         struct ia_css_frame *out_frame,
97         enum ia_css_pipeline_stage_sp_func sp_func,
98         unsigned max_input_width)
99 {
100         unsigned int i;
101
102         ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "ia_css_pipe_get_sp_func_stage_desc() enter:\n");
103         stage_desc->binary = NULL;
104         stage_desc->firmware = NULL;
105         stage_desc->sp_func = sp_func;
106         stage_desc->max_input_width = max_input_width;
107         stage_desc->mode = (unsigned int)-1;
108         stage_desc->in_frame = NULL;
109         stage_desc->out_frame[0] = out_frame;
110         for (i = 1; i < IA_CSS_BINARY_MAX_OUTPUT_PORTS; i++) {
111                 stage_desc->out_frame[i] = NULL;
112         }
113         stage_desc->vf_frame = NULL;
114 }
115