GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / qplane / qplane_2 / ia_css_qplane.host.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_frame.h"
16 #include "ia_css_types.h"
17 #include "sh_css_defs.h"
18 #include "ia_css_debug.h"
19 #include "assert_support.h"
20 #define IA_CSS_INCLUDE_CONFIGURATIONS
21 #include "ia_css_isp_configs.h"
22 #include "isp.h"
23
24 #include "ia_css_qplane.host.h"
25
26 static const struct ia_css_qplane_configuration default_config = {
27         .pipe = (struct sh_css_sp_pipeline *)NULL,
28 };
29
30 void
31 ia_css_qplane_config(
32         struct sh_css_isp_qplane_isp_config *to,
33         const struct ia_css_qplane_configuration  *from,
34         unsigned size)
35 {
36         unsigned elems_a = ISP_VEC_NELEMS;
37
38         (void)size;
39         ia_css_dma_configure_from_info(&to->port_b, from->info);
40         to->width_a_over_b = elems_a / to->port_b.elems;
41
42         /* Assume divisiblity here, may need to generalize to fixed point. */
43         assert (elems_a % to->port_b.elems == 0);
44
45         to->inout_port_config = from->pipe->inout_port_config;
46         to->format = from->info->format;
47 }
48
49 void
50 ia_css_qplane_configure(
51         const struct sh_css_sp_pipeline *pipe,
52         const struct ia_css_binary      *binary,
53         const struct ia_css_frame_info  *info)
54 {
55         struct ia_css_qplane_configuration config = default_config;
56
57         config.pipe = pipe;
58         config.info = info;
59
60         ia_css_configure_qplane(binary, &config);
61 }