2 * drivers/video/tegra/dc/dc_priv.h
4 * Copyright (C) 2010 Google, Inc.
5 * Author: Erik Gilling <konkers@android.com>
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #ifndef __DRIVERS_VIDEO_TEGRA_DC_DC_PRIV_H
19 #define __DRIVERS_VIDEO_TEGRA_DC_DC_PRIV_H
22 #include <linux/list.h>
23 #include <linux/mutex.h>
24 #include <linux/wait.h>
25 #include "../host/dev.h"
29 struct tegra_dc_blend {
30 unsigned z[DC_N_WINDOWS];
31 unsigned flags[DC_N_WINDOWS];
34 struct tegra_dc_out_ops {
35 /* initialize output. dc clocks are not on at this point */
36 int (*init)(struct tegra_dc *dc);
37 /* destroy output. dc clocks are not on at this point */
38 void (*destroy)(struct tegra_dc *dc);
39 /* detect connected display. can sleep.*/
40 bool (*detect)(struct tegra_dc *dc);
41 /* enable output. dc clocks are on at this point */
42 void (*enable)(struct tegra_dc *dc);
43 /* disable output. dc clocks are on at this point */
44 void (*disable)(struct tegra_dc *dc);
46 /* suspend output. dc clocks are on at this point */
47 void (*suspend)(struct tegra_dc *dc);
48 /* resume output. dc clocks are on at this point */
49 void (*resume)(struct tegra_dc *dc);
53 struct list_head list;
55 struct nvhost_device *ndev;
56 struct tegra_dc_platform_data *pdata;
58 struct resource *base_res;
68 struct tegra_dc_out *out;
69 struct tegra_dc_out_ops *out_ops;
72 struct tegra_dc_mode mode;
74 struct tegra_dc_win windows[DC_N_WINDOWS];
75 struct tegra_dc_blend blend;
82 struct resource *fb_mem;
83 struct tegra_fb_info *fb;
89 unsigned long underflow_mask;
90 struct work_struct reset_work;
93 static inline void tegra_dc_io_start(struct tegra_dc *dc)
95 nvhost_module_busy(&dc->ndev->host->mod);
98 static inline void tegra_dc_io_end(struct tegra_dc *dc)
100 nvhost_module_idle(&dc->ndev->host->mod);
103 static inline unsigned long tegra_dc_readl(struct tegra_dc *dc,
106 BUG_ON(!nvhost_module_powered(&dc->ndev->host->mod));
107 return readl(dc->base + reg * 4);
110 static inline void tegra_dc_writel(struct tegra_dc *dc, unsigned long val,
113 BUG_ON(!nvhost_module_powered(&dc->ndev->host->mod));
114 writel(val, dc->base + reg * 4);
117 static inline void _tegra_dc_write_table(struct tegra_dc *dc, const u32 *table,
122 for (i = 0; i < len; i++)
123 tegra_dc_writel(dc, table[i * 2 + 1], table[i * 2]);
126 #define tegra_dc_write_table(dc, table) \
127 _tegra_dc_write_table(dc, table, ARRAY_SIZE(table) / 2)
129 static inline void tegra_dc_set_outdata(struct tegra_dc *dc, void *data)
134 static inline void *tegra_dc_get_outdata(struct tegra_dc *dc)
139 void tegra_dc_setup_clk(struct tegra_dc *dc, struct clk *clk);
141 extern struct tegra_dc_out_ops tegra_dc_rgb_ops;
142 extern struct tegra_dc_out_ops tegra_dc_hdmi_ops;