]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/crop/crop_1.0/ia_css_crop.host.c
staging/atomisp: Add support for the Intel IPU v2
[mirror_ubuntu-jammy-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / crop / crop_1.0 / ia_css_crop.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 <assert_support.h>
16 #include <ia_css_frame_public.h>
17 #include <ia_css_frame.h>
18 #include <ia_css_binary.h>
19 #define IA_CSS_INCLUDE_CONFIGURATIONS
20 #include "ia_css_isp_configs.h"
21 #include "isp.h"
22 #include "ia_css_crop.host.h"
23
24 static const struct ia_css_crop_configuration default_config = {
25 .info = (struct ia_css_frame_info *)NULL,
26 };
27
28 void
29 ia_css_crop_encode(
30 struct sh_css_isp_crop_isp_params *to,
31 const struct ia_css_crop_config *from,
32 unsigned size)
33 {
34 (void)size;
35 to->crop_pos = from->crop_pos;
36 }
37
38 void
39 ia_css_crop_config(
40 struct sh_css_isp_crop_isp_config *to,
41 const struct ia_css_crop_configuration *from,
42 unsigned size)
43 {
44 unsigned elems_a = ISP_VEC_NELEMS;
45
46 (void)size;
47 ia_css_dma_configure_from_info(&to->port_b, from->info);
48 to->width_a_over_b = elems_a / to->port_b.elems;
49
50 /* Assume divisiblity here, may need to generalize to fixed point. */
51 assert (elems_a % to->port_b.elems == 0);
52 }
53
54 void
55 ia_css_crop_configure(
56 const struct ia_css_binary *binary,
57 const struct ia_css_frame_info *info)
58 {
59 struct ia_css_crop_configuration config = default_config;
60
61 config.info = info;
62
63 ia_css_configure_crop(binary, &config);
64 }