Linux-libre 4.15.7-gnu
[librecmc/linux-libre.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / ia_css_tpg.h
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 #ifndef __IA_CSS_TPG_H
16 #define __IA_CSS_TPG_H
17
18 /* @file
19  * This file contains support for the test pattern generator (TPG)
20  */
21
22 /* Enumerate the TPG IDs.
23  */
24 enum ia_css_tpg_id {
25         IA_CSS_TPG_ID0,
26         IA_CSS_TPG_ID1,
27         IA_CSS_TPG_ID2
28 };
29
30 /**
31  * Maximum number of TPG IDs.
32  *
33  * Make sure the value of this define gets changed to reflect the correct
34  * number of ia_css_tpg_id enum if you add/delete an item in the enum.
35  */
36 #define N_CSS_TPG_IDS (IA_CSS_TPG_ID2+1)
37
38 /* Enumerate the TPG modes.
39  */
40 enum ia_css_tpg_mode {
41         IA_CSS_TPG_MODE_RAMP,
42         IA_CSS_TPG_MODE_CHECKERBOARD,
43         IA_CSS_TPG_MODE_FRAME_BASED_COLOR,
44         IA_CSS_TPG_MODE_MONO
45 };
46
47 /* @brief Configure the test pattern generator.
48  *
49  * Configure the Test Pattern Generator, the way these values are used to
50  * generate the pattern can be seen in the HRT extension for the test pattern
51  * generator:
52  * devices/test_pat_gen/hrt/include/test_pat_gen.h: hrt_calc_tpg_data().
53  *
54  * This interface is deprecated, it is not portable -> move to input system API
55  *
56 @code
57 unsigned int test_pattern_value(unsigned int x, unsigned int y)
58 {
59  unsigned int x_val, y_val;
60  if (x_delta > 0) (x_val = (x << x_delta) & x_mask;
61  else (x_val = (x >> -x_delta) & x_mask;
62  if (y_delta > 0) (y_val = (y << y_delta) & y_mask;
63  else (y_val = (y >> -y_delta) & x_mask;
64  return (x_val + y_val) & xy_mask;
65 }
66 @endcode
67  */
68 struct ia_css_tpg_config {
69         enum ia_css_tpg_id   id;
70         enum ia_css_tpg_mode mode;
71         unsigned int         x_mask;
72         int                  x_delta;
73         unsigned int         y_mask;
74         int                  y_delta;
75         unsigned int         xy_mask;
76 };
77
78 #endif /* __IA_CSS_TPG_H */