]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blob - drivers/video/tegra/dc/dc_priv.h
Revert "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_fmt_bpp(int fmt)
160 {
161         switch (tegra_dc_fmt(fmt)) {
162         case TEGRA_WIN_FMT_P1:
163                 return 1;
164
165         case TEGRA_WIN_FMT_P2:
166                 return 2;
167
168         case TEGRA_WIN_FMT_P4:
169                 return 4;
170
171         case TEGRA_WIN_FMT_P8:
172                 return 8;
173
174         case TEGRA_WIN_FMT_B4G4R4A4:
175         case TEGRA_WIN_FMT_B5G5R5A:
176         case TEGRA_WIN_FMT_B5G6R5:
177         case TEGRA_WIN_FMT_AB5G5R5:
178         case TEGRA_WIN_FMT_T_R4G4B4A4:
179                 return 16;
180
181         case TEGRA_WIN_FMT_B8G8R8A8:
182         case TEGRA_WIN_FMT_R8G8B8A8:
183         case TEGRA_WIN_FMT_B6x2G6x2R6x2A8:
184         case TEGRA_WIN_FMT_R6x2G6x2B6x2A8:
185         case TEGRA_WIN_FMT_T_A2R10G10B10:
186         case TEGRA_WIN_FMT_T_A2B10G10R10:
187         case TEGRA_WIN_FMT_T_X2BL10GL10RL10_XRBIAS:
188         case TEGRA_WIN_FMT_T_X2BL10GL10RL10_XVYCC:
189                 return 32;
190
191         /* for planar formats, size of the Y plane, 8bit */
192         case TEGRA_WIN_FMT_YCbCr420P:
193         case TEGRA_WIN_FMT_YUV420P:
194         case TEGRA_WIN_FMT_YCbCr422P:
195         case TEGRA_WIN_FMT_YUV422P:
196         case TEGRA_WIN_FMT_YCbCr422R:
197         case TEGRA_WIN_FMT_YUV422R:
198         case TEGRA_WIN_FMT_YCbCr422RA:
199         case TEGRA_WIN_FMT_YUV422RA:
200         case TEGRA_WIN_FMT_YCbCr444P:
201         case TEGRA_WIN_FMT_YUV444P:
202         case TEGRA_WIN_FMT_YUV422SP:
203         case TEGRA_WIN_FMT_YUV420SP:
204         case TEGRA_WIN_FMT_YCbCr420SP:
205         case TEGRA_WIN_FMT_YCbCr422SP:
206         case TEGRA_WIN_FMT_T_Y10___U10___V10_N420:
207         case TEGRA_WIN_FMT_T_Y10___U10___V10_N444:
208         case TEGRA_WIN_FMT_T_Y10___V10U10_N420:
209         case TEGRA_WIN_FMT_T_Y10___U10V10_N422:
210         case TEGRA_WIN_FMT_T_Y10___U10V10_N422R:
211         case TEGRA_WIN_FMT_T_Y10___U10V10_N444:
212         case TEGRA_WIN_FMT_T_Y12___U12___V12_N420:
213         case TEGRA_WIN_FMT_T_Y12___U12___V12_N444:
214         case TEGRA_WIN_FMT_T_Y12___V12U12_N420:
215         case TEGRA_WIN_FMT_T_Y12___U12V12_N422:
216         case TEGRA_WIN_FMT_T_Y12___U12V12_N422R:
217         case TEGRA_WIN_FMT_T_Y12___U12V12_N444:
218                 return 8;
219
220         /* YUV packed into 32-bits */
221         case TEGRA_WIN_FMT_YCbCr422:
222         case TEGRA_WIN_FMT_YUV422:
223                 return 16;
224
225         /* RGB with 64-bits size */
226         case TEGRA_WIN_FMT_T_R16_G16_B16_A16:
227                 return 64;
228
229         }
230         return 0;
231 }
232
233 static inline bool tegra_dc_is_yuv(int fmt)
234 {
235         switch (tegra_dc_fmt(fmt)) {
236         case TEGRA_WIN_FMT_YUV420P:
237         case TEGRA_WIN_FMT_YCbCr420P:
238         case TEGRA_WIN_FMT_YCbCr422P:
239         case TEGRA_WIN_FMT_YUV422P:
240         case TEGRA_WIN_FMT_YCbCr422:
241         case TEGRA_WIN_FMT_YUV422:
242         case TEGRA_WIN_FMT_YCbCr422R:
243         case TEGRA_WIN_FMT_YUV422R:
244         case TEGRA_WIN_FMT_YCbCr422RA:
245         case TEGRA_WIN_FMT_YUV422RA:
246         case TEGRA_WIN_FMT_YCbCr444P:
247         case TEGRA_WIN_FMT_YUV444P:
248         case TEGRA_WIN_FMT_YUV422SP:
249         case TEGRA_WIN_FMT_YCbCr422SP:
250         case TEGRA_WIN_FMT_YCbCr420SP:
251         case TEGRA_WIN_FMT_YUV420SP:
252
253         case TEGRA_WIN_FMT_T_Y10___U10___V10_N420:
254         case TEGRA_WIN_FMT_T_Y10___U10___V10_N444:
255         case TEGRA_WIN_FMT_T_Y10___V10U10_N420:
256         case TEGRA_WIN_FMT_T_Y10___U10V10_N422:
257         case TEGRA_WIN_FMT_T_Y10___U10V10_N422R:
258         case TEGRA_WIN_FMT_T_Y10___U10V10_N444:
259         case TEGRA_WIN_FMT_T_Y12___U12___V12_N420:
260         case TEGRA_WIN_FMT_T_Y12___U12___V12_N444:
261         case TEGRA_WIN_FMT_T_Y12___V12U12_N420:
262         case TEGRA_WIN_FMT_T_Y12___U12V12_N422:
263         case TEGRA_WIN_FMT_T_Y12___U12V12_N422R:
264         case TEGRA_WIN_FMT_T_Y12___U12V12_N444:
265
266                 return true;
267         }
268         return false;
269 }
270
271 static inline bool tegra_dc_is_yuv_planar(int fmt)
272 {
273         switch (tegra_dc_fmt(fmt)) {
274         case TEGRA_WIN_FMT_YUV420P:
275         case TEGRA_WIN_FMT_YCbCr420P:
276         case TEGRA_WIN_FMT_YCbCr422P:
277         case TEGRA_WIN_FMT_YUV422P:
278         case TEGRA_WIN_FMT_YCbCr422R:
279         case TEGRA_WIN_FMT_YUV422R:
280         case TEGRA_WIN_FMT_YCbCr422RA:
281         case TEGRA_WIN_FMT_YUV422RA:
282         case TEGRA_WIN_FMT_YCbCr444P:
283         case TEGRA_WIN_FMT_YUV444P:
284         case TEGRA_WIN_FMT_T_Y10___U10___V10_N420:
285         case TEGRA_WIN_FMT_T_Y10___U10___V10_N444:
286         case TEGRA_WIN_FMT_T_Y10___V10U10_N420:
287         case TEGRA_WIN_FMT_T_Y10___U10V10_N422:
288         case TEGRA_WIN_FMT_T_Y10___U10V10_N422R:
289         case TEGRA_WIN_FMT_T_Y10___U10V10_N444:
290         case TEGRA_WIN_FMT_T_Y12___U12___V12_N420:
291         case TEGRA_WIN_FMT_T_Y12___U12___V12_N444:
292         case TEGRA_WIN_FMT_T_Y12___V12U12_N420:
293         case TEGRA_WIN_FMT_T_Y12___U12V12_N422:
294         case TEGRA_WIN_FMT_T_Y12___U12V12_N422R:
295         case TEGRA_WIN_FMT_T_Y12___U12V12_N444:
296                 return true;
297         }
298         return false;
299 }
300
301 static inline bool tegra_dc_is_yuv_full_planar(int fmt)
302 {
303         switch (fmt) {
304         case TEGRA_WIN_FMT_YCbCr444P:
305         case TEGRA_WIN_FMT_YUV444P:
306         case TEGRA_WIN_FMT_T_Y10___U10___V10_N420:
307         case TEGRA_WIN_FMT_T_Y10___U10___V10_N444:
308         case TEGRA_WIN_FMT_T_Y12___U12___V12_N420:
309         case TEGRA_WIN_FMT_T_Y12___U12___V12_N444:
310                 return true;
311         }
312         return false;
313 }
314
315 static inline bool tegra_dc_is_yuv_semi_planar(int fmt)
316 {
317         switch (fmt) {
318         case TEGRA_WIN_FMT_YUV420SP:
319         case TEGRA_WIN_FMT_YCbCr420SP:
320         case TEGRA_WIN_FMT_YCbCr422SP:
321         case TEGRA_WIN_FMT_YUV422SP:
322         case TEGRA_WIN_FMT_T_Y10___V10U10_N420:
323         case TEGRA_WIN_FMT_T_Y10___U10V10_N422:
324         case TEGRA_WIN_FMT_T_Y10___U10V10_N422R:
325         case TEGRA_WIN_FMT_T_Y10___U10V10_N444:
326         case TEGRA_WIN_FMT_T_Y12___V12U12_N420:
327         case TEGRA_WIN_FMT_T_Y12___U12V12_N422:
328         case TEGRA_WIN_FMT_T_Y12___U12V12_N422R:
329         case TEGRA_WIN_FMT_T_Y12___U12V12_N444:
330                 return true;
331         }
332         return false;
333 }
334
335 static inline u32 tegra_dc_unmask_interrupt(struct tegra_dc *dc, u32 int_val)
336 {
337         u32 val;
338
339         val = tegra_dc_readl(dc, DC_CMD_INT_MASK);
340         tegra_dc_writel(dc, val | int_val, DC_CMD_INT_MASK);
341         return val;
342 }
343
344 static inline u32 tegra_dc_flush_interrupt(struct tegra_dc *dc, u32 val)
345 {
346         unsigned long flag;
347
348         local_irq_save(flag);
349
350         tegra_dc_writel(dc, val, DC_CMD_INT_STATUS);
351
352         local_irq_restore(flag);
353
354         return val;
355 }
356
357 static inline u32 tegra_dc_mask_interrupt(struct tegra_dc *dc, u32 int_val)
358 {
359         u32 val;
360
361         val = tegra_dc_readl(dc, DC_CMD_INT_MASK);
362         tegra_dc_writel(dc, val & ~int_val, DC_CMD_INT_MASK);
363         return val;
364 }
365
366 static inline void tegra_dc_restore_interrupt(struct tegra_dc *dc, u32 val)
367 {
368         tegra_dc_writel(dc, val, DC_CMD_INT_MASK);
369 }
370
371 static inline unsigned long tegra_dc_clk_get_rate(struct tegra_dc *dc)
372 {
373         if (!tegra_platform_is_silicon())
374                 return dc->mode.pclk;
375
376         return clk_get_rate(dc->clk);
377 }
378
379 #if !defined(CONFIG_ARCH_TEGRA_2x_SOC) && !defined(CONFIG_ARCH_TEGRA_3x_SOC)
380 static inline void tegra_dc_powergate_locked(struct tegra_dc *dc)
381 {
382         tegra_powergate_partition(dc->powergate_id);
383 }
384
385 static inline void tegra_dc_unpowergate_locked(struct tegra_dc *dc)
386 {
387         int ret;
388         ret = tegra_unpowergate_partition(dc->powergate_id);
389         if (ret < 0)
390                 dev_err(&dc->ndev->dev, "%s: could not unpowergate %d\n",
391                                                         __func__, ret);
392 }
393
394 static inline bool tegra_dc_is_powered(struct tegra_dc *dc)
395 {
396         return tegra_powergate_is_powered(dc->powergate_id);
397 }
398
399 static inline void tegra_dc_set_edid(struct tegra_dc *dc,
400         struct tegra_edid *edid)
401 {
402         dc->edid = edid;
403 }
404
405 void tegra_dc_powergate_locked(struct tegra_dc *dc);
406 void tegra_dc_unpowergate_locked(struct tegra_dc *dc);
407 #else
408 static inline void tegra_dc_powergate_locked(struct tegra_dc *dc) { }
409 static inline void tegra_dc_unpowergate_locked(struct tegra_dc *dc) { }
410 static inline bool tegra_dc_is_powered(struct tegra_dc *dc)
411 {
412         return true;
413 }
414 #endif
415
416 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
417 static inline u32 tegra_dc_reg_l32(dma_addr_t v)
418 {
419         return v & 0xffffffff;
420 }
421
422 static inline u32 tegra_dc_reg_h32(dma_addr_t v)
423 {
424         return v >> 32;
425 }
426 #else
427 static inline u32 tegra_dc_reg_l32(dma_addr_t v)
428 {
429         return v;
430 }
431
432 static inline u32 tegra_dc_reg_h32(dma_addr_t v)
433 {
434         return 0;
435 }
436 #endif
437 extern struct tegra_dc_out_ops tegra_dc_rgb_ops;
438 extern struct tegra_dc_out_ops tegra_dc_dsi_ops;
439
440 #if defined(CONFIG_TEGRA_HDMI2_0)
441 extern struct tegra_dc_out_ops tegra_dc_hdmi2_0_ops;
442 #elif defined(CONFIG_TEGRA_HDMI)
443 extern struct tegra_dc_out_ops tegra_dc_hdmi_ops;
444 #endif
445
446 #ifdef CONFIG_TEGRA_DP
447 extern struct tegra_dc_out_ops tegra_dc_dp_ops;
448 #endif
449 #ifdef CONFIG_TEGRA_LVDS
450 extern struct tegra_dc_out_ops tegra_dc_lvds_ops;
451 #endif
452 #ifdef CONFIG_TEGRA_NVSR
453 extern struct tegra_dc_out_ops tegra_dc_nvsr_ops;
454 #endif
455
456 extern struct tegra_dc_out_ops tegra_dc_null_ops;
457
458 /* defined in dc_sysfs.c, used by dc.c */
459 void tegra_dc_remove_sysfs(struct device *dev);
460 void tegra_dc_create_sysfs(struct device *dev);
461
462 /* defined in dc.c, used by dc_sysfs.c */
463 void tegra_dc_stats_enable(struct tegra_dc *dc, bool enable);
464 bool tegra_dc_stats_get(struct tegra_dc *dc);
465
466 /* defined in dc.c, used by dc_sysfs.c */
467 u32 tegra_dc_read_checksum_latched(struct tegra_dc *dc);
468 void tegra_dc_enable_crc(struct tegra_dc *dc);
469 void tegra_dc_disable_crc(struct tegra_dc *dc);
470
471 void tegra_dc_set_out_pin_polars(struct tegra_dc *dc,
472                                 const struct tegra_dc_out_pin *pins,
473                                 const unsigned int n_pins);
474 /* defined in dc.c, used in bandwidth.c and ext/dev.c */
475 unsigned int tegra_dc_has_multiple_dc(void);
476
477 /* defined in dc.c, used in hdmihdcp.c */
478 int tegra_dc_ddc_enable(struct tegra_dc *dc, bool enabled);
479
480 /* defined in dc.c, used in dsi.c */
481 void tegra_dc_clk_enable(struct tegra_dc *dc);
482 void tegra_dc_clk_disable(struct tegra_dc *dc);
483
484 /* defined in dc.c, used in nvsd.c and dsi.c */
485 void tegra_dc_get(struct tegra_dc *dc);
486 void tegra_dc_put(struct tegra_dc *dc);
487
488 /* defined in dc.c, used in tegra_adf.c */
489 void tegra_dc_hold_dc_out(struct tegra_dc *dc);
490 void tegra_dc_release_dc_out(struct tegra_dc *dc);
491
492 /* defined in dc.c, used in ext/dev.c */
493 void tegra_dc_call_flip_callback(void);
494
495 /* defined in dc.c, used in sor.c */
496 unsigned long tegra_dc_poll_register(struct tegra_dc *dc,
497 u32 reg, u32 mask, u32 exp_val, u32 poll_interval_us,
498 u32 timeout_ms);
499 void tegra_dc_enable_general_act(struct tegra_dc *dc);
500
501 /* defined in dc.c, used by ext/dev.c */
502 extern int no_vsync;
503
504 /* defined in dc.c, used in ext/dev.c */
505 int tegra_dc_config_frame_end_intr(struct tegra_dc *dc, bool enable);
506
507 /* defined in dc.c, used in dsi.c */
508 int _tegra_dc_wait_for_frame_end(struct tegra_dc *dc,
509         u32 timeout_ms);
510
511 /* defined in bandwidth.c, used in dc.c */
512 void tegra_dc_clear_bandwidth(struct tegra_dc *dc);
513 void tegra_dc_program_bandwidth(struct tegra_dc *dc, bool use_new);
514 int tegra_dc_set_dynamic_emc(struct tegra_dc *dc);
515 #ifdef CONFIG_TEGRA_ISOMGR
516 int tegra_dc_bandwidth_negotiate_bw(struct tegra_dc *dc,
517                         struct tegra_dc_win *windows[], int n);
518 void tegra_dc_bandwidth_renegotiate(void *p, u32 avail_bw);
519 #endif
520 unsigned long tegra_dc_get_bandwidth(struct tegra_dc_win *windows[], int n);
521 long tegra_dc_calc_min_bandwidth(struct tegra_dc *dc);
522
523 /* defined in mode.c, used in dc.c, window.c and hdmi2.0.c */
524 int tegra_dc_program_mode(struct tegra_dc *dc, struct tegra_dc_mode *mode);
525 int tegra_dc_calc_refresh(const struct tegra_dc_mode *m);
526 int tegra_dc_calc_fb_refresh(const struct fb_videomode *fbmode);
527 int tegra_dc_update_mode(struct tegra_dc *dc);
528 u32 tegra_dc_get_aspect_ratio(struct tegra_dc *dc);
529
530 /* defined in clock.c, used in dc.c, rgb.c, dsi.c and hdmi.c */
531 void tegra_dc_setup_clk(struct tegra_dc *dc, struct clk *clk);
532 unsigned long tegra_dc_pclk_round_rate(struct tegra_dc *dc, int pclk);
533 unsigned long tegra_dc_pclk_predict_rate(
534         int out_type, struct clk *parent, int pclk);
535
536 /* defined in lut.c, used in dc.c */
537 void tegra_dc_init_lut_defaults(struct tegra_dc_lut *lut);
538 void tegra_dc_set_lut(struct tegra_dc *dc, struct tegra_dc_win *win);
539
540 /* defined in csc.c, used in dc.c */
541 void tegra_dc_init_csc_defaults(struct tegra_dc_csc *csc);
542 void tegra_dc_set_csc(struct tegra_dc *dc, struct tegra_dc_csc *csc);
543
544 /* defined in window.c, used in dc.c */
545 void tegra_dc_trigger_windows(struct tegra_dc *dc);
546
547 void tegra_dc_set_color_control(struct tegra_dc *dc);
548 #ifdef CONFIG_TEGRA_DC_CMU
549 void tegra_dc_cmu_enable(struct tegra_dc *dc, bool cmu_enable);
550 int tegra_dc_update_cmu(struct tegra_dc *dc, struct tegra_dc_cmu *cmu);
551 int tegra_dc_update_cmu_aligned(struct tegra_dc *dc, struct tegra_dc_cmu *cmu);
552 #endif
553
554 struct device_node *tegra_get_panel_node_out_type_check
555         (struct tegra_dc *dc, u32 out_type);
556
557 struct tegra_dc_platform_data
558         *of_dc_parse_platform_data(struct platform_device *ndev);
559
560 /* defined in dc.c, used in dc.c and dev.c */
561 void tegra_dc_set_act_vfp(struct tegra_dc *dc, int vfp);
562
563 /* defined in dc.c, used in dc.c and window.c */
564 bool tegra_dc_windows_are_dirty(struct tegra_dc *dc, u32 win_act_req_mask);
565 int tegra_dc_get_v_count(struct tegra_dc *dc);
566
567 /* defined in dc.c, used in vrr.c */
568 s32 tegra_dc_calc_v_front_porch(struct tegra_dc_mode *mode,
569                                 int desired_fps);
570
571 /* defined in cursor.c, used in dc.c and ext/cursor.c */
572 int tegra_dc_cursor_image(struct tegra_dc *dc,
573         enum tegra_dc_cursor_format format, enum tegra_dc_cursor_size size,
574         u32 fg, u32 bg, dma_addr_t phys_addr);
575 int tegra_dc_cursor_set(struct tegra_dc *dc, bool enable, int x, int y);
576 int tegra_dc_cursor_clip(struct tegra_dc *dc, unsigned clip);
577 int tegra_dc_cursor_suspend(struct tegra_dc *dc);
578 int tegra_dc_cursor_resume(struct tegra_dc *dc);
579 void tegra_dc_win_partial_update(struct tegra_dc *dc, struct tegra_dc_win *win,
580         unsigned int xoff, unsigned int yoff, unsigned int width,
581         unsigned int height);
582 int tegra_dc_slgc_disp0(struct notifier_block *nb, unsigned long unused0,
583         void *unused1);
584
585 #ifdef CONFIG_TEGRA_NVDISPLAY
586 int tegra_nvdisp_init(struct tegra_dc *dc);
587 int tegra_nvdisp_update_windows(struct tegra_dc *dc,
588         struct tegra_dc_win *windows[], int n,
589         u16 *dirty_rect, bool wait_for_vblank);
590 int tegra_nvdisp_head_enable(struct tegra_dc *dc);
591 int tegra_nvdisp_head_disable(struct tegra_dc *dc);
592 int tegra_nvdisp_get_linestride(struct tegra_dc *dc, int win);
593 void tegra_nvdisp_enable_crc(struct tegra_dc *dc);
594 void tegra_nvdisp_disable_crc(struct tegra_dc *dc);
595 u32 tegra_nvdisp_read_rg_crc(struct tegra_dc *dc);
596 int tegra_nvdisp_program_mode(struct tegra_dc *dc,
597                         struct tegra_dc_mode *mode);
598
599 struct tegra_fb_info *tegra_nvdisp_fb_register(struct platform_device *ndev,
600         struct tegra_dc *dc, struct tegra_fb_data *fb_data,
601         struct resource *fb_mem);
602
603 void nvdisp_dc_feature_register(struct tegra_dc *dc);
604 int nvdisp_set_cursor_position(struct tegra_dc *dc, s16 x, s16 y);
605 #endif
606
607 #endif