video: tegra: checkpatch changes
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-tegra / include / mach / dc.h
1 /*
2  * arch/arm/mach-tegra/include/mach/dc.h
3  *
4  * Copyright (C) 2010 Google, Inc.
5  *
6  * Author:
7  *      Erik Gilling <konkers@google.com>
8  *
9  * This software is licensed under the terms of the GNU General Public
10  * License version 2, as published by the Free Software Foundation, and
11  * may be copied, distributed, and modified under those terms.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  */
19
20 #ifndef __MACH_TEGRA_DC_H
21 #define __MACH_TEGRA_DC_H
22
23
24 #define TEGRA_MAX_DC            2
25 #define DC_N_WINDOWS            3
26
27 struct tegra_dc_blend {
28         u32     nokey;
29         u32     one_win;
30         u32     two_win_x;
31         u32     two_win_y;
32         u32     three_win_xy;
33 };
34
35 #define BLEND(key, control, weight0, weight1)                           \
36         (CKEY_ ## key | BLEND_CONTROL_ ## control |                     \
37          BLEND_WEIGHT0(weight0) | BLEND_WEIGHT0(weight1))
38
39 struct tegra_dc_mode {
40         int     pclk;
41         int     h_ref_to_sync;
42         int     v_ref_to_sync;
43         int     h_sync_width;
44         int     v_sync_width;
45         int     h_back_porch;
46         int     v_back_porch;
47         int     h_active;
48         int     v_active;
49         int     h_front_porch;
50         int     v_front_porch;
51 };
52
53 enum {
54         TEGRA_DC_OUT_RGB,
55 };
56
57 struct tegra_dc_out {
58         int                     type;
59
60         unsigned                order;
61         unsigned                align;
62
63         struct tegra_dc_mode    *modes;
64         int                     n_modes;
65 };
66
67 #define TEGRA_DC_ALIGN_MSB              0
68 #define TEGRA_DC_ALIGN_LSB              1
69
70 #define TEGRA_DC_ORDER_RED_BLUE         0
71 #define TEGRA_DC_ORDER_BLUE_RED         1
72
73 struct tegra_dc;
74
75 struct tegra_dc_win {
76         u8                      idx;
77         u8                      fmt;
78         u32                     flags;
79
80         void                    *virt_addr;
81         dma_addr_t              phys_addr;
82         unsigned                x;
83         unsigned                y;
84         unsigned                w;
85         unsigned                h;
86         unsigned                out_w;
87         unsigned                out_h;
88
89         int                     dirty;
90         struct tegra_dc         *dc;
91 };
92
93 #define TEGRA_WIN_FLAG_ENABLED          (1 << 0)
94 #define TEGRA_WIN_FLAG_COLOR_EXPAND     (1 << 1)
95
96 /* Note: These are the actual values written to the DC_WIN_COLOR_DEPTH register
97  * and may change in new tegra architectures.
98  */
99 #define TEGRA_WIN_FMT_P1                0
100 #define TEGRA_WIN_FMT_P2                1
101 #define TEGRA_WIN_FMT_P4                2
102 #define TEGRA_WIN_FMT_P8                3
103 #define TEGRA_WIN_FMT_B4G4R4A4          4
104 #define TEGRA_WIN_FMT_B5G5R5A           5
105 #define TEGRA_WIN_FMT_B5G6R5            6
106 #define TEGRA_WIN_FMT_AB5G5R5           7
107 #define TEGRA_WIN_FMT_B8G8R8A8          12
108 #define TEGRA_WIN_FMT_R8G8B8A8          13
109 #define TEGRA_WIN_FMT_B6x2G6x2R6x2A8    14
110 #define TEGRA_WIN_FMT_R6x2G6x2B6x2A8    15
111 #define TEGRA_WIN_FMT_YCbCr422          16
112 #define TEGRA_WIN_FMT_YUV422            17
113 #define TEGRA_WIN_FMT_YCbCr420P         18
114 #define TEGRA_WIN_FMT_YUV420P           19
115 #define TEGRA_WIN_FMT_YCbCr422P         20
116 #define TEGRA_WIN_FMT_YUV422P           21
117 #define TEGRA_WIN_FMT_YCbCr422R         22
118 #define TEGRA_WIN_FMT_YUV422R           23
119 #define TEGRA_WIN_FMT_YCbCr422RA        24
120 #define TEGRA_WIN_FMT_YUV422RA          25
121
122 struct tegra_fb_data {
123         int             win;
124
125         int             xres;
126         int             yres;
127         int             bits_per_pixel;
128 };
129
130 struct tegra_dc_platform_data {
131         unsigned long           flags;
132         struct tegra_dc_out     *default_out;
133         struct tegra_fb_data    *fb;
134 };
135
136 #define TEGRA_DC_FLAG_ENABLED           (1 << 0)
137
138 struct tegra_dc *tegra_dc_get_dc(unsigned idx);
139 struct tegra_dc_win *tegra_dc_get_window(struct tegra_dc *dc, unsigned win);
140
141 /* tegra_dc_update_windows and tegra_dc_sync_windows do not support windows
142  * with differenct dcs in one call
143  */
144 int tegra_dc_update_windows(struct tegra_dc_win *windows[], int n);
145 int tegra_dc_sync_windows(struct tegra_dc_win *windows[], int n);
146
147 /* will probably be replaced with an interface describing the window order */
148 void tegra_dc_set_blending(struct tegra_dc *dc, struct tegra_dc_blend *blend);
149
150 int tegra_dc_set_mode(struct tegra_dc *dc, struct tegra_dc_mode *mode);
151
152 #endif