1
2
3
4
5
6
7 #ifndef __TILCDC_DRV_H__
8 #define __TILCDC_DRV_H__
9
10 #include <linux/cpufreq.h>
11 #include <linux/irqreturn.h>
12
13 #include <drm/drm_print.h>
14
15 struct clk;
16 struct workqueue_struct;
17
18 struct drm_connector;
19 struct drm_connector_helper_funcs;
20 struct drm_crtc;
21 struct drm_device;
22 struct drm_display_mode;
23 struct drm_encoder;
24 struct drm_framebuffer;
25 struct drm_minor;
26 struct drm_pending_vblank_event;
27 struct drm_plane;
28
29
30 #define TILCDC_DEFAULT_MAX_PIXELCLOCK 126000
31
32 #define TILCDC_DEFAULT_MAX_WIDTH 2048
33
34
35
36
37
38 #define TILCDC_DEFAULT_MAX_BANDWIDTH (1280*1024*60)
39
40
41 struct tilcdc_drm_private {
42 void __iomem *mmio;
43
44 struct clk *clk;
45 int rev;
46
47
48 uint32_t max_bandwidth;
49
50
51
52
53 uint32_t max_pixelclock;
54
55
56
57
58 uint32_t max_width;
59
60
61 const uint32_t *pixelformats;
62 uint32_t num_pixelformats;
63
64 #ifdef CONFIG_CPU_FREQ
65 struct notifier_block freq_transition;
66 #endif
67
68 struct workqueue_struct *wq;
69
70 struct drm_crtc *crtc;
71
72 unsigned int num_encoders;
73 struct drm_encoder *encoders[8];
74
75 unsigned int num_connectors;
76 struct drm_connector *connectors[8];
77
78 struct drm_encoder *external_encoder;
79 struct drm_connector *external_connector;
80
81 bool is_registered;
82 bool is_componentized;
83 };
84
85
86
87
88
89
90
91 struct tilcdc_module;
92
93 struct tilcdc_module_ops {
94
95 int (*modeset_init)(struct tilcdc_module *mod, struct drm_device *dev);
96 #ifdef CONFIG_DEBUG_FS
97
98 int (*debugfs_init)(struct tilcdc_module *mod, struct drm_minor *minor);
99 #endif
100 };
101
102 struct tilcdc_module {
103 const char *name;
104 struct list_head list;
105 const struct tilcdc_module_ops *funcs;
106 };
107
108 void tilcdc_module_init(struct tilcdc_module *mod, const char *name,
109 const struct tilcdc_module_ops *funcs);
110 void tilcdc_module_cleanup(struct tilcdc_module *mod);
111
112
113
114
115
116 struct tilcdc_panel_info {
117
118
119 uint32_t ac_bias;
120
121
122 uint32_t ac_bias_intrpt;
123
124
125 uint32_t dma_burst_sz;
126
127
128 uint32_t bpp;
129
130
131 uint32_t fdd;
132
133
134 bool tft_alt_mode;
135
136
137 bool invert_pxl_clk;
138
139
140 uint32_t sync_edge;
141
142
143 uint32_t sync_ctrl;
144
145
146 uint32_t raster_order;
147
148
149 uint32_t fifo_th;
150 };
151
152 #define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__)
153
154 int tilcdc_crtc_create(struct drm_device *dev);
155 irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc);
156 void tilcdc_crtc_update_clk(struct drm_crtc *crtc);
157 void tilcdc_crtc_set_panel_info(struct drm_crtc *crtc,
158 const struct tilcdc_panel_info *info);
159 void tilcdc_crtc_set_simulate_vesa_sync(struct drm_crtc *crtc,
160 bool simulate_vesa_sync);
161 int tilcdc_crtc_max_width(struct drm_crtc *crtc);
162 void tilcdc_crtc_shutdown(struct drm_crtc *crtc);
163 int tilcdc_crtc_update_fb(struct drm_crtc *crtc,
164 struct drm_framebuffer *fb,
165 struct drm_pending_vblank_event *event);
166
167 int tilcdc_plane_init(struct drm_device *dev, struct drm_plane *plane);
168
169 #endif