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