diff options
Diffstat (limited to 'drivers/video/fbdev/omap2/dss/dss.h')
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dss.h | 225 |
1 files changed, 117 insertions, 108 deletions
diff --git a/drivers/video/fbdev/omap2/dss/dss.h b/drivers/video/fbdev/omap2/dss/dss.h index 8ff22c134c62..14fb0c23f4a2 100644 --- a/drivers/video/fbdev/omap2/dss/dss.h +++ b/drivers/video/fbdev/omap2/dss/dss.h | |||
@@ -100,35 +100,77 @@ enum dss_writeback_channel { | |||
100 | DSS_WB_LCD3_MGR = 7, | 100 | DSS_WB_LCD3_MGR = 7, |
101 | }; | 101 | }; |
102 | 102 | ||
103 | struct dispc_clock_info { | 103 | struct dss_pll; |
104 | |||
105 | #define DSS_PLL_MAX_HSDIVS 4 | ||
106 | |||
107 | /* | ||
108 | * Type-A PLLs: clkout[]/mX[] refer to hsdiv outputs m4, m5, m6, m7. | ||
109 | * Type-B PLLs: clkout[0] refers to m2. | ||
110 | */ | ||
111 | struct dss_pll_clock_info { | ||
104 | /* rates that we get with dividers below */ | 112 | /* rates that we get with dividers below */ |
105 | unsigned long lck; | 113 | unsigned long fint; |
106 | unsigned long pck; | 114 | unsigned long clkdco; |
115 | unsigned long clkout[DSS_PLL_MAX_HSDIVS]; | ||
107 | 116 | ||
108 | /* dividers */ | 117 | /* dividers */ |
109 | u16 lck_div; | 118 | u16 n; |
110 | u16 pck_div; | 119 | u16 m; |
120 | u32 mf; | ||
121 | u16 mX[DSS_PLL_MAX_HSDIVS]; | ||
122 | u16 sd; | ||
123 | }; | ||
124 | |||
125 | struct dss_pll_ops { | ||
126 | int (*enable)(struct dss_pll *pll); | ||
127 | void (*disable)(struct dss_pll *pll); | ||
128 | int (*set_config)(struct dss_pll *pll, | ||
129 | const struct dss_pll_clock_info *cinfo); | ||
130 | }; | ||
131 | |||
132 | struct dss_pll_hw { | ||
133 | unsigned n_max; | ||
134 | unsigned m_min; | ||
135 | unsigned m_max; | ||
136 | unsigned mX_max; | ||
137 | |||
138 | unsigned long fint_min, fint_max; | ||
139 | unsigned long clkdco_min, clkdco_low, clkdco_max; | ||
140 | |||
141 | u8 n_msb, n_lsb; | ||
142 | u8 m_msb, m_lsb; | ||
143 | u8 mX_msb[DSS_PLL_MAX_HSDIVS], mX_lsb[DSS_PLL_MAX_HSDIVS]; | ||
144 | |||
145 | bool has_stopmode; | ||
146 | bool has_freqsel; | ||
147 | bool has_selfreqdco; | ||
148 | bool has_refsel; | ||
111 | }; | 149 | }; |
112 | 150 | ||
113 | struct dsi_clock_info { | 151 | struct dss_pll { |
152 | const char *name; | ||
153 | |||
154 | struct clk *clkin; | ||
155 | struct regulator *regulator; | ||
156 | |||
157 | void __iomem *base; | ||
158 | |||
159 | const struct dss_pll_hw *hw; | ||
160 | |||
161 | const struct dss_pll_ops *ops; | ||
162 | |||
163 | struct dss_pll_clock_info cinfo; | ||
164 | }; | ||
165 | |||
166 | struct dispc_clock_info { | ||
114 | /* rates that we get with dividers below */ | 167 | /* rates that we get with dividers below */ |
115 | unsigned long fint; | 168 | unsigned long lck; |
116 | unsigned long clkin4ddr; | 169 | unsigned long pck; |
117 | unsigned long clkin; | ||
118 | unsigned long dsi_pll_hsdiv_dispc_clk; /* OMAP3: DSI1_PLL_CLK | ||
119 | * OMAP4: PLLx_CLK1 */ | ||
120 | unsigned long dsi_pll_hsdiv_dsi_clk; /* OMAP3: DSI2_PLL_CLK | ||
121 | * OMAP4: PLLx_CLK2 */ | ||
122 | unsigned long lp_clk; | ||
123 | 170 | ||
124 | /* dividers */ | 171 | /* dividers */ |
125 | u16 regn; | 172 | u16 lck_div; |
126 | u16 regm; | 173 | u16 pck_div; |
127 | u16 regm_dispc; /* OMAP3: REGM3 | ||
128 | * OMAP4: REGM4 */ | ||
129 | u16 regm_dsi; /* OMAP3: REGM4 | ||
130 | * OMAP4: REGM5 */ | ||
131 | u16 lp_clk_div; | ||
132 | }; | 174 | }; |
133 | 175 | ||
134 | struct dss_lcd_mgr_config { | 176 | struct dss_lcd_mgr_config { |
@@ -209,12 +251,16 @@ int dss_init_platform_driver(void) __init; | |||
209 | void dss_uninit_platform_driver(void); | 251 | void dss_uninit_platform_driver(void); |
210 | 252 | ||
211 | unsigned long dss_get_dispc_clk_rate(void); | 253 | unsigned long dss_get_dispc_clk_rate(void); |
212 | int dss_dpi_select_source(enum omap_channel channel); | 254 | int dss_dpi_select_source(int port, enum omap_channel channel); |
213 | void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select); | 255 | void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select); |
214 | enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void); | 256 | enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void); |
215 | const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); | 257 | const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); |
216 | void dss_dump_clocks(struct seq_file *s); | 258 | void dss_dump_clocks(struct seq_file *s); |
217 | 259 | ||
260 | /* dss-of */ | ||
261 | struct device_node *dss_of_port_get_parent_device(struct device_node *port); | ||
262 | u32 dss_of_port_get_port_number(struct device_node *port); | ||
263 | |||
218 | #if defined(CONFIG_OMAP2_DSS_DEBUGFS) | 264 | #if defined(CONFIG_OMAP2_DSS_DEBUGFS) |
219 | void dss_debug_dump_clocks(struct seq_file *s); | 265 | void dss_debug_dump_clocks(struct seq_file *s); |
220 | #endif | 266 | #endif |
@@ -244,16 +290,22 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min, | |||
244 | int sdi_init_platform_driver(void) __init; | 290 | int sdi_init_platform_driver(void) __init; |
245 | void sdi_uninit_platform_driver(void) __exit; | 291 | void sdi_uninit_platform_driver(void) __exit; |
246 | 292 | ||
293 | #ifdef CONFIG_OMAP2_DSS_SDI | ||
247 | int sdi_init_port(struct platform_device *pdev, struct device_node *port) __init; | 294 | int sdi_init_port(struct platform_device *pdev, struct device_node *port) __init; |
248 | void sdi_uninit_port(void) __exit; | 295 | void sdi_uninit_port(struct device_node *port) __exit; |
296 | #else | ||
297 | static inline int __init sdi_init_port(struct platform_device *pdev, | ||
298 | struct device_node *port) | ||
299 | { | ||
300 | return 0; | ||
301 | } | ||
302 | static inline void __exit sdi_uninit_port(struct device_node *port) | ||
303 | { | ||
304 | } | ||
305 | #endif | ||
249 | 306 | ||
250 | /* DSI */ | 307 | /* DSI */ |
251 | 308 | ||
252 | typedef bool (*dsi_pll_calc_func)(int regn, int regm, unsigned long fint, | ||
253 | unsigned long pll, void *data); | ||
254 | typedef bool (*dsi_hsdiv_calc_func)(int regm_dispc, unsigned long dispc, | ||
255 | void *data); | ||
256 | |||
257 | #ifdef CONFIG_OMAP2_DSS_DSI | 309 | #ifdef CONFIG_OMAP2_DSS_DSI |
258 | 310 | ||
259 | struct dentry; | 311 | struct dentry; |
@@ -262,104 +314,36 @@ struct file_operations; | |||
262 | int dsi_init_platform_driver(void) __init; | 314 | int dsi_init_platform_driver(void) __init; |
263 | void dsi_uninit_platform_driver(void) __exit; | 315 | void dsi_uninit_platform_driver(void) __exit; |
264 | 316 | ||
265 | int dsi_runtime_get(struct platform_device *dsidev); | ||
266 | void dsi_runtime_put(struct platform_device *dsidev); | ||
267 | |||
268 | void dsi_dump_clocks(struct seq_file *s); | 317 | void dsi_dump_clocks(struct seq_file *s); |
269 | 318 | ||
270 | void dsi_irq_handler(void); | 319 | void dsi_irq_handler(void); |
271 | u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt); | 320 | u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt); |
272 | 321 | ||
273 | unsigned long dsi_get_pll_clkin(struct platform_device *dsidev); | ||
274 | |||
275 | bool dsi_hsdiv_calc(struct platform_device *dsidev, unsigned long pll, | ||
276 | unsigned long out_min, dsi_hsdiv_calc_func func, void *data); | ||
277 | bool dsi_pll_calc(struct platform_device *dsidev, unsigned long clkin, | ||
278 | unsigned long pll_min, unsigned long pll_max, | ||
279 | dsi_pll_calc_func func, void *data); | ||
280 | |||
281 | unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev); | ||
282 | int dsi_pll_set_clock_div(struct platform_device *dsidev, | ||
283 | struct dsi_clock_info *cinfo); | ||
284 | int dsi_pll_init(struct platform_device *dsidev, bool enable_hsclk, | ||
285 | bool enable_hsdiv); | ||
286 | void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanes); | ||
287 | void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev); | ||
288 | void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev); | ||
289 | struct platform_device *dsi_get_dsidev_from_id(int module); | ||
290 | #else | 322 | #else |
291 | static inline int dsi_runtime_get(struct platform_device *dsidev) | ||
292 | { | ||
293 | return 0; | ||
294 | } | ||
295 | static inline void dsi_runtime_put(struct platform_device *dsidev) | ||
296 | { | ||
297 | } | ||
298 | static inline u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt) | 323 | static inline u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt) |
299 | { | 324 | { |
300 | WARN("%s: DSI not compiled in, returning pixel_size as 0\n", __func__); | 325 | WARN("%s: DSI not compiled in, returning pixel_size as 0\n", __func__); |
301 | return 0; | 326 | return 0; |
302 | } | 327 | } |
303 | static inline unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev) | ||
304 | { | ||
305 | WARN("%s: DSI not compiled in, returning rate as 0\n", __func__); | ||
306 | return 0; | ||
307 | } | ||
308 | static inline int dsi_pll_set_clock_div(struct platform_device *dsidev, | ||
309 | struct dsi_clock_info *cinfo) | ||
310 | { | ||
311 | WARN("%s: DSI not compiled in\n", __func__); | ||
312 | return -ENODEV; | ||
313 | } | ||
314 | static inline int dsi_pll_init(struct platform_device *dsidev, | ||
315 | bool enable_hsclk, bool enable_hsdiv) | ||
316 | { | ||
317 | WARN("%s: DSI not compiled in\n", __func__); | ||
318 | return -ENODEV; | ||
319 | } | ||
320 | static inline void dsi_pll_uninit(struct platform_device *dsidev, | ||
321 | bool disconnect_lanes) | ||
322 | { | ||
323 | } | ||
324 | static inline void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev) | ||
325 | { | ||
326 | } | ||
327 | static inline void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev) | ||
328 | { | ||
329 | } | ||
330 | static inline struct platform_device *dsi_get_dsidev_from_id(int module) | ||
331 | { | ||
332 | return NULL; | ||
333 | } | ||
334 | |||
335 | static inline unsigned long dsi_get_pll_clkin(struct platform_device *dsidev) | ||
336 | { | ||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | static inline bool dsi_hsdiv_calc(struct platform_device *dsidev, | ||
341 | unsigned long pll, unsigned long out_min, | ||
342 | dsi_hsdiv_calc_func func, void *data) | ||
343 | { | ||
344 | return false; | ||
345 | } | ||
346 | |||
347 | static inline bool dsi_pll_calc(struct platform_device *dsidev, | ||
348 | unsigned long clkin, | ||
349 | unsigned long pll_min, unsigned long pll_max, | ||
350 | dsi_pll_calc_func func, void *data) | ||
351 | { | ||
352 | return false; | ||
353 | } | ||
354 | |||
355 | #endif | 328 | #endif |
356 | 329 | ||
357 | /* DPI */ | 330 | /* DPI */ |
358 | int dpi_init_platform_driver(void) __init; | 331 | int dpi_init_platform_driver(void) __init; |
359 | void dpi_uninit_platform_driver(void) __exit; | 332 | void dpi_uninit_platform_driver(void) __exit; |
360 | 333 | ||
334 | #ifdef CONFIG_OMAP2_DSS_DPI | ||
361 | int dpi_init_port(struct platform_device *pdev, struct device_node *port) __init; | 335 | int dpi_init_port(struct platform_device *pdev, struct device_node *port) __init; |
362 | void dpi_uninit_port(void) __exit; | 336 | void dpi_uninit_port(struct device_node *port) __exit; |
337 | #else | ||
338 | static inline int __init dpi_init_port(struct platform_device *pdev, | ||
339 | struct device_node *port) | ||
340 | { | ||
341 | return 0; | ||
342 | } | ||
343 | static inline void __exit dpi_uninit_port(struct device_node *port) | ||
344 | { | ||
345 | } | ||
346 | #endif | ||
363 | 347 | ||
364 | /* DISPC */ | 348 | /* DISPC */ |
365 | int dispc_init_platform_driver(void) __init; | 349 | int dispc_init_platform_driver(void) __init; |
@@ -438,4 +422,29 @@ static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr) | |||
438 | } | 422 | } |
439 | #endif | 423 | #endif |
440 | 424 | ||
425 | /* PLL */ | ||
426 | typedef bool (*dss_pll_calc_func)(int n, int m, unsigned long fint, | ||
427 | unsigned long clkdco, void *data); | ||
428 | typedef bool (*dss_hsdiv_calc_func)(int m_dispc, unsigned long dispc, | ||
429 | void *data); | ||
430 | |||
431 | int dss_pll_register(struct dss_pll *pll); | ||
432 | void dss_pll_unregister(struct dss_pll *pll); | ||
433 | struct dss_pll *dss_pll_find(const char *name); | ||
434 | int dss_pll_enable(struct dss_pll *pll); | ||
435 | void dss_pll_disable(struct dss_pll *pll); | ||
436 | int dss_pll_set_config(struct dss_pll *pll, | ||
437 | const struct dss_pll_clock_info *cinfo); | ||
438 | |||
439 | bool dss_pll_hsdiv_calc(const struct dss_pll *pll, unsigned long clkdco, | ||
440 | unsigned long out_min, unsigned long out_max, | ||
441 | dss_hsdiv_calc_func func, void *data); | ||
442 | bool dss_pll_calc(const struct dss_pll *pll, unsigned long clkin, | ||
443 | unsigned long pll_min, unsigned long pll_max, | ||
444 | dss_pll_calc_func func, void *data); | ||
445 | int dss_pll_write_config_type_a(struct dss_pll *pll, | ||
446 | const struct dss_pll_clock_info *cinfo); | ||
447 | int dss_pll_write_config_type_b(struct dss_pll *pll, | ||
448 | const struct dss_pll_clock_info *cinfo); | ||
449 | |||
441 | #endif | 450 | #endif |