]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c
Merge remote-tracking branches 'asoc/topic/tas6424', 'asoc/topic/tfa9879', 'asoc...
[mirror_ubuntu-focal-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / ipu2_io_ls / yuv444_io_ls / ia_css_yuv444_io.host.c
1 #ifdef ISP2401
2 /*
3 Support for Intel Camera Imaging ISP subsystem.
4 Copyright (c) 2010 - 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_yuv444_io.host.h"
17 #include "dma.h"
18 #include "math_support.h"
19 #ifndef IA_CSS_NO_DEBUG
20 #include "ia_css_debug.h"
21 #endif
22 #include "ia_css_isp_params.h"
23 #include "ia_css_frame.h"
24
25 void
26 ia_css_yuv444_io_config(
27 const struct ia_css_binary *binary,
28 const struct sh_css_binary_args *args)
29 {
30 const struct ia_css_frame *in_frame = args->in_frame;
31 const struct ia_css_frame **out_frames = (const struct ia_css_frame **)& args->out_frame;
32 const struct ia_css_frame_info *in_frame_info = (in_frame) ? &in_frame->info : &binary->in_frame_info;
33
34 const unsigned ddr_bits_per_element = sizeof(short) * 8;
35 const unsigned ddr_elems_per_word = ceil_div(HIVE_ISP_DDR_WORD_BITS, ddr_bits_per_element);
36 unsigned size_get = 0, size_put = 0;
37 unsigned offset = 0;
38
39 if (binary->info->mem_offsets.offsets.param) {
40 size_get = binary->info->mem_offsets.offsets.param->dmem.get.size;
41 offset = binary->info->mem_offsets.offsets.param->dmem.get.offset;
42 }
43
44 if (size_get) {
45 struct ia_css_common_io_config *to = (struct ia_css_common_io_config *)&binary->mem_params.params[IA_CSS_PARAM_CLASS_PARAM][IA_CSS_ISP_DMEM].address[offset];
46 struct dma_port_config config;
47 #ifndef IA_CSS_NO_DEBUG
48 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "ia_css_yuv444_io_config() get part enter:\n");
49 #endif
50
51 ia_css_dma_configure_from_info(&config, in_frame_info);
52 // The base_address of the input frame will be set in the ISP
53 to->width = in_frame_info->res.width;
54 to->height = in_frame_info->res.height;
55 to->stride = config.stride;
56 to->ddr_elems_per_word = ddr_elems_per_word;
57 #ifndef IA_CSS_NO_DEBUG
58 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "ia_css_yuv444_io_config() get part leave:\n");
59 #endif
60 }
61
62 if (binary->info->mem_offsets.offsets.param) {
63 size_put = binary->info->mem_offsets.offsets.param->dmem.put.size;
64 offset = binary->info->mem_offsets.offsets.param->dmem.put.offset;
65 }
66
67 if (size_put) {
68 struct ia_css_common_io_config *to = (struct ia_css_common_io_config *)&binary->mem_params.params[IA_CSS_PARAM_CLASS_PARAM][IA_CSS_ISP_DMEM].address[offset];
69 struct dma_port_config config;
70 #ifndef IA_CSS_NO_DEBUG
71 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "ia_css_yuv444_io_config() put part enter:\n");
72 #endif
73
74 ia_css_dma_configure_from_info(&config, &out_frames[0]->info);
75 to->base_address = out_frames[0]->data;
76 to->width = out_frames[0]->info.res.width;
77 to->height = out_frames[0]->info.res.height;
78 to->stride = config.stride;
79 to->ddr_elems_per_word = ddr_elems_per_word;
80
81 #ifndef IA_CSS_NO_DEBUG
82 ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "ia_css_yuv444_io_config() put part leave:\n");
83 #endif
84 }
85 }
86 #endif