]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blob - drivers/video/tegra/dc/dc_priv.h
video: tegra: dc: make SOR instance configurable
[sojka/nv-tegra/linux-3.10.git] / drivers / video / tegra / dc / dc_priv.h
1 /*
2  * drivers/video/tegra/dc/dc_priv.h
3  *
4  * Copyright (C) 2010 Google, Inc.
5  * Author: Erik Gilling <konkers@android.com>
6  *
7  * Copyright (c) 2010-2015, NVIDIA CORPORATION, All rights reserved.
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 __DRIVERS_VIDEO_TEGRA_DC_DC_PRIV_H
21 #define __DRIVERS_VIDEO_TEGRA_DC_DC_PRIV_H
22
23 #include "dc_priv_defs.h"
24 #ifndef CREATE_TRACE_POINTS
25 # include <trace/events/display.h>
26 #define WIN_IS_BLOCKLINEAR(win) ((win)->flags & TEGRA_WIN_FLAG_BLOCKLINEAR)
27 #endif
28 #include <linux/tegra-powergate.h>
29 #include <video/tegra_dc_ext.h>
30
31
32 #define WIN_IS_TILED(win)       ((win)->flags & TEGRA_WIN_FLAG_TILED)
33 #define WIN_IS_ENABLED(win)     ((win)->flags & TEGRA_WIN_FLAG_ENABLED)
34 #define WIN_IS_FB(win)          ((win)->flags & TEGRA_WIN_FLAG_FB)
35
36 #define WIN_IS_INTERLACE(win) ((win)->flags & TEGRA_WIN_FLAG_INTERLACE)
37
38 #if defined(CONFIG_ARCH_TEGRA_14x_SOC)
39 #define WIN_ALL_ACT_REQ (WIN_A_ACT_REQ | WIN_B_ACT_REQ | WIN_C_ACT_REQ | \
40         WIN_D_ACT_REQ | WIN_H_ACT_REQ)
41 #else
42 #define WIN_ALL_ACT_REQ (WIN_A_ACT_REQ | WIN_B_ACT_REQ | WIN_C_ACT_REQ)
43 #endif
44
45 /*
46  * Second definition is needed to prevent inadvertent sanity failures
47  * on p1859 for now.
48  */
49 #ifndef CONFIG_ARCH_TEGRA_VCM30T124
50 #define tegra_dc_hotplug_supported(dc) (dc && dc->out ? \
51                 (dc->out->hotplug_gpio >= 0 && \
52                 !(dc->out->type == TEGRA_DC_OUT_DP && \
53                 !tegra_dc_is_ext_dp_panel(dc))) : 0)
54 #else
55 #define tegra_dc_hotplug_supported(dc) (dc && dc->out ? \
56                 (dc->out->hotplug_gpio >= 0 || \
57                 dc->out->type == TEGRA_DC_OUT_DP) : 0)
58 #endif
59
60 static inline int tegra_dc_io_start(struct tegra_dc *dc)
61 {
62         int ret = 0;
63         ret = nvhost_module_busy_ext(dc->ndev);
64         if (ret < 0) {
65                 dev_warn(&dc->ndev->dev,
66                         "Host1x powerup failed with err=%d\n", ret);
67         }
68         return ret;
69 }
70
71 static inline void tegra_dc_io_end(struct tegra_dc *dc)
72 {
73         nvhost_module_idle_ext(dc->ndev);
74 }
75
76 static inline unsigned long tegra_dc_readl(struct tegra_dc *dc,
77                                            unsigned long reg)
78 {
79         unsigned long ret;
80
81         if (likely(tegra_platform_is_silicon())) {
82                 BUG_ON(!nvhost_module_powered_ext(dc->ndev));
83                 if (WARN(!tegra_is_clk_enabled(dc->clk),
84                         "DC is clock-gated.\n") ||
85                         WARN(!tegra_powergate_is_powered(
86                         dc->powergate_id), "DC is power-gated.\n"))
87                         return 0;
88         }
89
90         ret = readl(dc->base + reg * 4);
91         trace_display_readl(dc, ret, dc->base + reg * 4);
92         return ret;
93 }
94
95 static inline void tegra_dc_writel(struct tegra_dc *dc, unsigned long val,
96                                    unsigned long reg)
97 {
98         if (likely(tegra_platform_is_silicon())) {
99                 BUG_ON(!nvhost_module_powered_ext(dc->ndev));
100                 if (WARN(!tegra_is_clk_enabled(dc->clk),
101                         "DC is clock-gated.\n") ||
102                         WARN(!tegra_powergate_is_powered(
103                         dc->powergate_id), "DC is power-gated.\n"))
104                         return;
105         }
106
107         trace_display_writel(dc, val, dc->base + reg * 4);
108         writel(val, dc->base + reg * 4);
109 }
110
111 static inline void tegra_dc_power_on(struct tegra_dc *dc)
112 {
113         tegra_dc_writel(dc, PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE |
114                                         PW4_ENABLE | PM0_ENABLE | PM1_ENABLE,
115                                         DC_CMD_DISPLAY_POWER_CONTROL);
116 }
117
118 static inline void _tegra_dc_write_table(struct tegra_dc *dc, const u32 *table,
119                                          unsigned len)
120 {
121         int i;
122
123         for (i = 0; i < len; i++)
124                 tegra_dc_writel(dc, table[i * 2 + 1], table[i * 2]);
125 }
126
127 #define tegra_dc_write_table(dc, table)         \
128         _tegra_dc_write_table(dc, table, ARRAY_SIZE(table) / 2)
129
130 static inline void tegra_dc_set_outdata(struct tegra_dc *dc, void *data)
131 {
132         dc->out_data = data;
133 }
134
135 static inline void *tegra_dc_get_outdata(struct tegra_dc *dc)
136 {
137         return dc->out_data;
138 }
139
140 static inline unsigned long tegra_dc_get_default_emc_clk_rate(
141         struct tegra_dc *dc)
142 {
143         return dc->pdata->emc_clk_rate ? dc->pdata->emc_clk_rate : ULONG_MAX;
144 }
145
146 /* return the color format field */
147 static inline int tegra_dc_fmt(int fmt)
148 {
149         return (fmt & TEGRA_DC_EXT_FMT_MASK) >> TEGRA_DC_EXT_FMT_SHIFT;
150 }
151
152 /* return the byte swap field */
153 static inline int tegra_dc_fmt_byteorder(int fmt)
154 {
155         return (fmt & TEGRA_DC_EXT_FMT_BYTEORDER_MASK) >>
156                 TEGRA_DC_EXT_FMT_BYTEORDER_SHIFT;
157 }
158
159 static inline int tegra_dc_which_sor(struct tegra_dc *dc)
160 {
161         return dc->sor_instance;
162 }
163
164 static inline int tegra_dc_fmt_bpp(int fmt)
165 {
166         switch (tegra_dc_fmt(fmt)) {
167         case TEGRA_WIN_FMT_P1:
168                 return 1;
169
170         case TEGRA_WIN_FMT_P2:
171                 return 2;
172
173         case TEGRA_WIN_FMT_P4:
174                 return 4;
175
176         case TEGRA_WIN_FMT_P8:
177                 return 8;
178
179         case TEGRA_WIN_FMT_B4G4R4A4:
180         case TEGRA_WIN_FMT_B5G5R5A:
181         case TEGRA_WIN_FMT_B5G6R5:
182         case TEGRA_WIN_FMT_AB5G5R5:
183         case TEGRA_WIN_FMT_T_R4G4B4A4:
184                 return 16;
185
186         case TEGRA_WIN_FMT_B8G8R8A8:
187         case TEGRA_WIN_FMT_R8G8B8A8:
188         case TEGRA_WIN_FMT_B6x2G6x2R6x2A8:
189         case TEGRA_WIN_FMT_R6x2G6x2B6x2A8:
190         case TEGRA_WIN_FMT_T_A2R10G10B10:
191         case TEGRA_WIN_FMT_T_A2B10G10R10:
192         case TEGRA_WIN_FMT_T_X2BL10GL10RL10_XRBIAS:
193         case TEGRA_WIN_FMT_T_X2BL10GL10RL10_XVYCC:
194                 return 32;
195
196         /* for planar formats, size of the Y plane, 8bit */
197         case TEGRA_WIN_FMT_YCbCr420P:
198         case TEGRA_WIN_FMT_YUV420P:
199         case TEGRA_WIN_FMT_YCbCr422P:
200         case TEGRA_WIN_FMT_YUV422P:
201         case TEGRA_WIN_FMT_YCbCr422R:
202         case TEGRA_WIN_FMT_YUV422R:
203         case TEGRA_WIN_FMT_YCbCr422RA:
204         case TEGRA_WIN_FMT_YUV422RA:
205         case TEGRA_WIN_FMT_YCbCr444P:
206         case TEGRA_WIN_FMT_YUV444P:
207         case TEGRA_WIN_FMT_YUV422SP:
208         case TEGRA_WIN_FMT_YUV420SP:
209         case TEGRA_WIN_FMT_YCbCr420SP:
210         case TEGRA_WIN_FMT_YCbCr422SP:
211         case TEGRA_WIN_FMT_T_Y10___U10___V10_N420:
212         case TEGRA_WIN_FMT_T_Y10___U10___V10_N444:
213         case TEGRA_WIN_FMT_T_Y10___V10U10_N420:
214         case TEGRA_WIN_FMT_T_Y10___U10V10_N422:
215         case TEGRA_WIN_FMT_T_Y10___U10V10_N422R:
216         case TEGRA_WIN_FMT_T_Y10___U10V10_N444:
217         case TEGRA_WIN_FMT_T_Y12___U12___V12_N420:
218         case TEGRA_WIN_FMT_T_Y12___U12___V12_N444:
219         case TEGRA_WIN_FMT_T_Y12___V12U12_N420:
220         case TEGRA_WIN_FMT_T_Y12___U12V12_N422:
221         case TEGRA_WIN_FMT_T_Y12___U12V12_N422R:
222         case TEGRA_WIN_FMT_T_Y12___U12V12_N444:
223                 return 8;
224
225         /* YUV packed into 32-bits */
226         case TEGRA_WIN_FMT_YCbCr422:
227         case TEGRA_WIN_FMT_YUV422:
228                 return 16;
229
230         /* RGB with 64-bits size */
231         case TEGRA_WIN_FMT_T_R16_G16_B16_A16:
232                 return 64;
233
234         }
235         return 0;
236 }
237
238 static inline bool tegra_dc_is_yuv(int fmt)
239 {
240         switch (tegra_dc_fmt(fmt)) {
241         case TEGRA_WIN_FMT_YUV420P:
242         case TEGRA_WIN_FMT_YCbCr420P:
243         case TEGRA_WIN_FMT_YCbCr422P:
244         case TEGRA_WIN_FMT_YUV422P:
245         case TEGRA_WIN_FMT_YCbCr422:
246         case TEGRA_WIN_FMT_YUV422:
247         case TEGRA_WIN_FMT_YCbCr422R:
248         case TEGRA_WIN_FMT_YUV422R:
249         case TEGRA_WIN_FMT_YCbCr422RA:
250         case TEGRA_WIN_FMT_YUV422RA:
251         case TEGRA_WIN_FMT_YCbCr444P:
252         case TEGRA_WIN_FMT_YUV444P:
253         case TEGRA_WIN_FMT_YUV422SP:
254         case TEGRA_WIN_FMT_YCbCr422SP:
255         case TEGRA_WIN_FMT_YCbCr420SP:
256         case TEGRA_WIN_FMT_YUV420SP:
257
258         case TEGRA_WIN_FMT_T_Y10___U10___V10_N420:
259         case TEGRA_WIN_FMT_T_Y10___U10___V10_N444:
260         case TEGRA_WIN_FMT_T_Y10___V10U10_N420:
261         case TEGRA_WIN_FMT_T_Y10___U10V10_N422:
262         case TEGRA_WIN_FMT_T_Y10___U10V10_N422R:
263         case TEGRA_WIN_FMT_T_Y10___U10V10_N444:
264         case TEGRA_WIN_FMT_T_Y12___U12___V12_N420:
265         case TEGRA_WIN_FMT_T_Y12___U12___V12_N444:
266         case TEGRA_WIN_FMT_T_Y12___V12U12_N420:
267         case TEGRA_WIN_FMT_T_Y12___U12V12_N422:
268         case TEGRA_WIN_FMT_T_Y12___U12V12_N422R:
269         case TEGRA_WIN_FMT_T_Y12___U12V12_N444:
270
271                 return true;
272         }
273         return false;
274 }
275
276 static inline bool tegra_dc_is_yuv_planar(int fmt)
277 {
278         switch (tegra_dc_fmt(fmt)) {
279         case TEGRA_WIN_FMT_YUV420P:
280         case TEGRA_WIN_FMT_YCbCr420P:
281         case TEGRA_WIN_FMT_YCbCr422P:
282         case TEGRA_WIN_FMT_YUV422P:
283         case TEGRA_WIN_FMT_YCbCr422R:
284         case TEGRA_WIN_FMT_YUV422R:
285         case TEGRA_WIN_FMT_YCbCr422RA:
286         case TEGRA_WIN_FMT_YUV422RA:
287         case TEGRA_WIN_FMT_YCbCr444P:
288         case TEGRA_WIN_FMT_YUV444P:
289         case TEGRA_WIN_FMT_T_Y10___U10___V10_N420:
290         case TEGRA_WIN_FMT_T_Y10___U10___V10_N444:
291         case TEGRA_WIN_FMT_T_Y10___V10U10_N420:
292         case TEGRA_WIN_FMT_T_Y10___U10V10_N422:
293         case TEGRA_WIN_FMT_T_Y10___U10V10_N422R:
294         case TEGRA_WIN_FMT_T_Y10___U10V10_N444:
295         case TEGRA_WIN_FMT_T_Y12___U12___V12_N420:
296         case TEGRA_WIN_FMT_T_Y12___U12___V12_N444:
297         case TEGRA_WIN_FMT_T_Y12___V12U12_N420:
298         case TEGRA_WIN_FMT_T_Y12___U12V12_N422:
299         case TEGRA_WIN_FMT_T_Y12___U12V12_N422R:
300         case TEGRA_WIN_FMT_T_Y12___U12V12_N444:
301                 return true;
302         }
303         return false;
304 }
305
306 static inline bool tegra_dc_is_yuv_full_planar(int fmt)
307 {
308         switch (fmt) {
309         case TEGRA_WIN_FMT_YCbCr444P:
310         case TEGRA_WIN_FMT_YUV444P:
311         case TEGRA_WIN_FMT_T_Y10___U10___V10_N420:
312         case TEGRA_WIN_FMT_T_Y10___U10___V10_N444:
313         case TEGRA_WIN_FMT_T_Y12___U12___V12_N420:
314         case TEGRA_WIN_FMT_T_Y12___U12___V12_N444:
315                 return true;
316         }
317         return false;
318 }
319
320 static inline bool tegra_dc_is_yuv_semi_planar(int fmt)
321 {
322         switch (fmt) {
323         case TEGRA_WIN_FMT_YUV420SP:
324         case TEGRA_WIN_FMT_YCbCr420SP:
325         case TEGRA_WIN_FMT_YCbCr422SP:
326         case TEGRA_WIN_FMT_YUV422SP:
327         case TEGRA_WIN_FMT_T_Y10___V10U10_N420:
328         case TEGRA_WIN_FMT_T_Y10___U10V10_N422:
329         case TEGRA_WIN_FMT_T_Y10___U10V10_N422R:
330         case TEGRA_WIN_FMT_T_Y10___U10V10_N444:
331         case TEGRA_WIN_FMT_T_Y12___V12U12_N420:
332         case TEGRA_WIN_FMT_T_Y12___U12V12_N422:
333         case TEGRA_WIN_FMT_T_Y12___U12V12_N422R:
334         case TEGRA_WIN_FMT_T_Y12___U12V12_N444:
335                 return true;
336         }
337         return false;
338 }
339
340 static inline u32 tegra_dc_unmask_interrupt(struct tegra_dc *dc, u32 int_val)
341 {
342         u32 val;
343
344         val = tegra_dc_readl(dc, DC_CMD_INT_MASK);
345         tegra_dc_writel(dc, val | int_val, DC_CMD_INT_MASK);
346         return val;
347 }
348
349 static inline u32 tegra_dc_flush_interrupt(struct tegra_dc *dc, u32 val)
350 {
351         unsigned long flag;
352
353         local_irq_save(flag);
354
355         tegra_dc_writel(dc, val, DC_CMD_INT_STATUS);
356
357         local_irq_restore(flag);
358
359         return val;
360 }
361
362 static inline u32 tegra_dc_mask_interrupt(struct tegra_dc *dc, u32 int_val)
363 {
364         u32 val;
365
366         val = tegra_dc_readl(dc, DC_CMD_INT_MASK);
367         tegra_dc_writel(dc, val & ~int_val, DC_CMD_INT_MASK);
368         return val;
369 }
370
371 static inline void tegra_dc_restore_interrupt(struct tegra_dc *dc, u32 val)
372 {
373         tegra_dc_writel(dc, val, DC_CMD_INT_MASK);
374 }
375
376 static inline unsigned long tegra_dc_clk_get_rate(struct tegra_dc *dc)
377 {
378         if (!tegra_platform_is_silicon())
379                 return dc->mode.pclk;
380
381         return clk_get_rate(dc->clk);
382 }
383
384 #if !defined(CONFIG_ARCH_TEGRA_2x_SOC) && !defined(CONFIG_ARCH_TEGRA_3x_SOC)
385 static inline void tegra_dc_powergate_locked(struct tegra_dc *dc)
386 {
387         tegra_powergate_partition(dc->powergate_id);
388 }
389
390 static inline void tegra_dc_unpowergate_locked(struct tegra_dc *dc)
391 {
392         int ret;
393         ret = tegra_unpowergate_partition(dc->powergate_id);
394         if (ret < 0)
395                 dev_err(&dc->ndev->dev, "%s: could not unpowergate %d\n",
396                                                         __func__, ret);
397 }
398
399 static inline bool tegra_dc_is_powered(struct tegra_dc *dc)
400 {
401         return tegra_powergate_is_powered(dc->powergate_id);
402 }
403
404 static inline void tegra_dc_set_edid(struct tegra_dc *dc,
405         struct tegra_edid *edid)
406 {
407         dc->edid = edid;
408 }
409
410 void tegra_dc_powergate_locked(struct tegra_dc *dc);
411 void tegra_dc_unpowergate_locked(struct tegra_dc *dc);
412 #else
413 static inline void tegra_dc_powergate_locked(struct tegra_dc *dc) { }
414 static inline void tegra_dc_unpowergate_locked(struct tegra_dc *dc) { }
415 static inline bool tegra_dc_is_powered(struct tegra_dc *dc)
416 {
417         return true;
418 }
419 #endif
420
421 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
422 static inline u32 tegra_dc_reg_l32(dma_addr_t v)
423 {
424         return v & 0xffffffff;
425 }
426
427 static inline u32 tegra_dc_reg_h32(dma_addr_t v)
428 {
429         return v >> 32;
430 }
431 #else
432 static inline u32 tegra_dc_reg_l32(dma_addr_t v)
433 {
434         return v;
435 }
436
437 static inline u32 tegra_dc_reg_h32(dma_addr_t v)
438 {
439         return 0;
440 }
441 #endif
442 extern struct tegra_dc_out_ops tegra_dc_rgb_ops;
443 extern struct tegra_dc_out_ops tegra_dc_dsi_ops;
444
445 #if defined(CONFIG_TEGRA_HDMI2_0)
446 extern struct tegra_dc_out_ops tegra_dc_hdmi2_0_ops;
447 #elif defined(CONFIG_TEGRA_HDMI)
448 extern struct tegra_dc_out_ops tegra_dc_hdmi_ops;
449 #endif
450
451 #ifdef CONFIG_TEGRA_DP
452 extern struct tegra_dc_out_ops tegra_dc_dp_ops;
453 #endif
454 #ifdef CONFIG_TEGRA_LVDS
455 extern struct tegra_dc_out_ops tegra_dc_lvds_ops;
456 #endif
457 #ifdef CONFIG_TEGRA_NVSR
458 extern struct tegra_dc_out_ops tegra_dc_nvsr_ops;
459 #endif
460
461 extern struct tegra_dc_out_ops tegra_dc_null_ops;
462
463 /* defined in dc_sysfs.c, used by dc.c */
464 void tegra_dc_remove_sysfs(struct device *dev);
465 void tegra_dc_create_sysfs(struct device *dev);
466
467 /* defined in dc.c, used by dc_sysfs.c */
468 void tegra_dc_stats_enable(struct tegra_dc *dc, bool enable);
469 bool tegra_dc_stats_get(struct tegra_dc *dc);
470
471 /* defined in dc.c, used by dc_sysfs.c */
472 u32 tegra_dc_read_checksum_latched(struct tegra_dc *dc);
473 void tegra_dc_enable_crc(struct tegra_dc *dc);
474 void tegra_dc_disable_crc(struct tegra_dc *dc);
475
476 void tegra_dc_set_out_pin_polars(struct tegra_dc *dc,
477                                 const struct tegra_dc_out_pin *pins,
478                                 const unsigned int n_pins);
479 /* defined in dc.c, used in bandwidth.c and ext/dev.c */
480 unsigned int tegra_dc_has_multiple_dc(void);
481
482 /* defined in dc.c, used in hdmihdcp.c */
483 int tegra_dc_ddc_enable(struct tegra_dc *dc, bool enabled);
484
485 /* defined in dc.c, used in dsi.c */
486 void tegra_dc_clk_enable(struct tegra_dc *dc);
487 void tegra_dc_clk_disable(struct tegra_dc *dc);
488
489 /* defined in dc.c, used in nvsd.c and dsi.c */
490 void tegra_dc_get(struct tegra_dc *dc);
491 void tegra_dc_put(struct tegra_dc *dc);
492
493 /* defined in dc.c, used in tegra_adf.c */
494 void tegra_dc_hold_dc_out(struct tegra_dc *dc);
495 void tegra_dc_release_dc_out(struct tegra_dc *dc);
496
497 /* defined in dc.c, used in ext/dev.c */
498 void tegra_dc_call_flip_callback(void);
499
500 /* defined in dc.c, used in sor.c */
501 unsigned long tegra_dc_poll_register(struct tegra_dc *dc,
502 u32 reg, u32 mask, u32 exp_val, u32 poll_interval_us,
503 u32 timeout_ms);
504 void tegra_dc_enable_general_act(struct tegra_dc *dc);
505
506 /* defined in dc.c, used by ext/dev.c */
507 extern int no_vsync;
508
509 /* defined in dc.c, used in ext/dev.c */
510 int tegra_dc_config_frame_end_intr(struct tegra_dc *dc, bool enable);
511
512 /* defined in dc.c, used in dsi.c */
513 int _tegra_dc_wait_for_frame_end(struct tegra_dc *dc,
514         u32 timeout_ms);
515
516 /* defined in bandwidth.c, used in dc.c */
517 void tegra_dc_clear_bandwidth(struct tegra_dc *dc);
518 void tegra_dc_program_bandwidth(struct tegra_dc *dc, bool use_new);
519 int tegra_dc_set_dynamic_emc(struct tegra_dc *dc);
520 #ifdef CONFIG_TEGRA_ISOMGR
521 int tegra_dc_bandwidth_negotiate_bw(struct tegra_dc *dc,
522                         struct tegra_dc_win *windows[], int n);
523 void tegra_dc_bandwidth_renegotiate(void *p, u32 avail_bw);
524 #endif
525 unsigned long tegra_dc_get_bandwidth(struct tegra_dc_win *windows[], int n);
526 long tegra_dc_calc_min_bandwidth(struct tegra_dc *dc);
527
528 /* defined in mode.c, used in dc.c, window.c and hdmi2.0.c */
529 int tegra_dc_program_mode(struct tegra_dc *dc, struct tegra_dc_mode *mode);
530 int tegra_dc_calc_refresh(const struct tegra_dc_mode *m);
531 int tegra_dc_calc_fb_refresh(const struct fb_videomode *fbmode);
532 int tegra_dc_update_mode(struct tegra_dc *dc);
533 u32 tegra_dc_get_aspect_ratio(struct tegra_dc *dc);
534
535 /* defined in clock.c, used in dc.c, rgb.c, dsi.c and hdmi.c */
536 void tegra_dc_setup_clk(struct tegra_dc *dc, struct clk *clk);
537 unsigned long tegra_dc_pclk_round_rate(struct tegra_dc *dc, int pclk);
538 unsigned long tegra_dc_pclk_predict_rate(
539         int out_type, struct clk *parent, int pclk);
540
541 /* defined in lut.c, used in dc.c */
542 void tegra_dc_init_lut_defaults(struct tegra_dc_lut *lut);
543 void tegra_dc_set_lut(struct tegra_dc *dc, struct tegra_dc_win *win);
544
545 /* defined in csc.c, used in dc.c */
546 void tegra_dc_init_csc_defaults(struct tegra_dc_csc *csc);
547 void tegra_dc_set_csc(struct tegra_dc *dc, struct tegra_dc_csc *csc);
548
549 /* defined in window.c, used in dc.c */
550 void tegra_dc_trigger_windows(struct tegra_dc *dc);
551
552 void tegra_dc_set_color_control(struct tegra_dc *dc);
553 #ifdef CONFIG_TEGRA_DC_CMU
554 void tegra_dc_cmu_enable(struct tegra_dc *dc, bool cmu_enable);
555 int tegra_dc_update_cmu(struct tegra_dc *dc, struct tegra_dc_cmu *cmu);
556 int tegra_dc_update_cmu_aligned(struct tegra_dc *dc, struct tegra_dc_cmu *cmu);
557 #endif
558
559 struct device_node *tegra_get_panel_node_out_type_check
560         (struct tegra_dc *dc, u32 out_type);
561
562 struct tegra_dc_platform_data
563         *of_dc_parse_platform_data(struct platform_device *ndev);
564
565 /* defined in dc.c, used in dc.c and dev.c */
566 void tegra_dc_set_act_vfp(struct tegra_dc *dc, int vfp);
567
568 /* defined in dc.c, used in dc.c and window.c */
569 bool tegra_dc_windows_are_dirty(struct tegra_dc *dc, u32 win_act_req_mask);
570 int tegra_dc_get_v_count(struct tegra_dc *dc);
571
572 /* defined in dc.c, used in vrr.c */
573 s32 tegra_dc_calc_v_front_porch(struct tegra_dc_mode *mode,
574                                 int desired_fps);
575
576 /* defined in cursor.c, used in dc.c and ext/cursor.c */
577 int tegra_dc_cursor_image(struct tegra_dc *dc,
578         enum tegra_dc_cursor_format format, enum tegra_dc_cursor_size size,
579         u32 fg, u32 bg, dma_addr_t phys_addr);
580 int tegra_dc_cursor_set(struct tegra_dc *dc, bool enable, int x, int y);
581 int tegra_dc_cursor_clip(struct tegra_dc *dc, unsigned clip);
582 int tegra_dc_cursor_suspend(struct tegra_dc *dc);
583 int tegra_dc_cursor_resume(struct tegra_dc *dc);
584 void tegra_dc_win_partial_update(struct tegra_dc *dc, struct tegra_dc_win *win,
585         unsigned int xoff, unsigned int yoff, unsigned int width,
586         unsigned int height);
587 int tegra_dc_slgc_disp0(struct notifier_block *nb, unsigned long unused0,
588         void *unused1);
589
590 #ifdef CONFIG_TEGRA_NVDISPLAY
591 int tegra_nvdisp_init(struct tegra_dc *dc);
592 int tegra_nvdisp_update_windows(struct tegra_dc *dc,
593         struct tegra_dc_win *windows[], int n,
594         u16 *dirty_rect, bool wait_for_vblank);
595 int tegra_nvdisp_head_enable(struct tegra_dc *dc);
596 int tegra_nvdisp_head_disable(struct tegra_dc *dc);
597 int tegra_nvdisp_get_linestride(struct tegra_dc *dc, int win);
598 void tegra_nvdisp_enable_crc(struct tegra_dc *dc);
599 void tegra_nvdisp_disable_crc(struct tegra_dc *dc);
600 u32 tegra_nvdisp_read_rg_crc(struct tegra_dc *dc);
601 int tegra_nvdisp_program_mode(struct tegra_dc *dc,
602                         struct tegra_dc_mode *mode);
603
604 struct tegra_fb_info *tegra_nvdisp_fb_register(struct platform_device *ndev,
605         struct tegra_dc *dc, struct tegra_fb_data *fb_data,
606         struct resource *fb_mem);
607
608 void nvdisp_dc_feature_register(struct tegra_dc *dc);
609 int nvdisp_set_cursor_position(struct tegra_dc *dc, s16 x, s16 y);
610 #endif
611
612 #endif