GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / macc / macc1_5 / ia_css_macc1_5.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_types.h"
16 #include "sh_css_defs.h"
17
18 #ifndef IA_CSS_NO_DEBUG
19 /* FIXME: See BZ 4427 */
20 #include "ia_css_debug.h"
21 #endif
22
23 #include "ia_css_macc1_5.host.h"
24
25 const struct ia_css_macc1_5_config default_macc1_5_config = {
26         1
27 };
28
29 void
30 ia_css_macc1_5_encode(
31         struct sh_css_isp_macc1_5_params *to,
32         const struct ia_css_macc1_5_config *from,
33         unsigned int size)
34 {
35         (void)size;
36         to->exp = from->exp;
37 }
38
39 void
40 ia_css_macc1_5_vmem_encode(
41         struct sh_css_isp_macc1_5_vmem_params *params,
42         const struct ia_css_macc1_5_table *from,
43         unsigned int size)
44 {
45         unsigned int i, j, k, idx;
46         unsigned int idx_map[] = {
47                 0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8};
48
49         (void)size;
50
51         for (k = 0; k < 4; k++)
52                 for (i = 0; i < IA_CSS_MACC_NUM_AXES; i++) {
53                         idx = idx_map[i] + (k * IA_CSS_MACC_NUM_AXES);
54                         j   = 4 * i;
55
56                         params->data[0][(idx)] = from->data[j];
57                         params->data[1][(idx)] = from->data[j + 1];
58                         params->data[2][(idx)] = from->data[j + 2];
59                         params->data[3][(idx)] = from->data[j + 3];
60                 }
61
62 }
63
64 #ifndef IA_CSS_NO_DEBUG
65 void
66 ia_css_macc1_5_debug_dtrace(
67         const struct ia_css_macc1_5_config *config,
68         unsigned int level)
69 {
70         ia_css_debug_dtrace(level,
71                 "config.exp=%d\n",
72                 config->exp);
73 }
74 #endif