xref: /linux/include/video/sh_mobile_lcdc.h (revision 40331b21f5fdb746e80fc609ef60ef71b5cd47d9)
1225c9a8dSPaul Mundt #ifndef __ASM_SH_MOBILE_LCDC_H__
2225c9a8dSPaul Mundt #define __ASM_SH_MOBILE_LCDC_H__
3225c9a8dSPaul Mundt 
4225c9a8dSPaul Mundt #include <linux/fb.h>
5225c9a8dSPaul Mundt 
6225c9a8dSPaul Mundt enum { RGB8,   /* 24bpp, 8:8:8 */
7225c9a8dSPaul Mundt        RGB9,   /* 18bpp, 9:9 */
8225c9a8dSPaul Mundt        RGB12A, /* 24bpp, 12:12 */
9225c9a8dSPaul Mundt        RGB12B, /* 12bpp */
10225c9a8dSPaul Mundt        RGB16,  /* 16bpp */
11225c9a8dSPaul Mundt        RGB18,  /* 18bpp */
12225c9a8dSPaul Mundt        RGB24,  /* 24bpp */
13225c9a8dSPaul Mundt        SYS8A,  /* 24bpp, 8:8:8 */
14225c9a8dSPaul Mundt        SYS8B,  /* 18bpp, 8:8:2 */
15225c9a8dSPaul Mundt        SYS8C,  /* 18bpp, 2:8:8 */
16225c9a8dSPaul Mundt        SYS8D,  /* 16bpp, 8:8 */
17225c9a8dSPaul Mundt        SYS9,   /* 18bpp, 9:9 */
18225c9a8dSPaul Mundt        SYS12,  /* 24bpp, 12:12 */
19225c9a8dSPaul Mundt        SYS16A, /* 16bpp */
20225c9a8dSPaul Mundt        SYS16B, /* 18bpp, 16:2 */
21225c9a8dSPaul Mundt        SYS16C, /* 18bpp, 2:16 */
22225c9a8dSPaul Mundt        SYS18,  /* 18bpp */
23225c9a8dSPaul Mundt        SYS24 };/* 24bpp */
24225c9a8dSPaul Mundt 
25225c9a8dSPaul Mundt enum { LCDC_CHAN_DISABLED = 0,
26225c9a8dSPaul Mundt        LCDC_CHAN_MAINLCD,
27225c9a8dSPaul Mundt        LCDC_CHAN_SUBLCD };
28225c9a8dSPaul Mundt 
29225c9a8dSPaul Mundt enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL };
30225c9a8dSPaul Mundt 
31f400f510SMagnus Damm #define LCDC_FLAGS_DWPOL (1 << 0) /* Rising edge dot clock data latch */
32f400f510SMagnus Damm #define LCDC_FLAGS_DIPOL (1 << 1) /* Active low display enable polarity */
33f400f510SMagnus Damm #define LCDC_FLAGS_DAPOL (1 << 2) /* Active low display data polarity */
34f400f510SMagnus Damm #define LCDC_FLAGS_HSCNT (1 << 3) /* Disable HSYNC during VBLANK */
35f400f510SMagnus Damm #define LCDC_FLAGS_DWCNT (1 << 4) /* Disable dotclock during blanking */
36f400f510SMagnus Damm 
37*40331b21SPhil Edworthy #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
38*40331b21SPhil Edworthy 
39225c9a8dSPaul Mundt struct sh_mobile_lcdc_sys_bus_cfg {
40225c9a8dSPaul Mundt 	unsigned long ldmt2r;
41225c9a8dSPaul Mundt 	unsigned long ldmt3r;
428564557aSMagnus Damm 	unsigned long deferred_io_msec;
43225c9a8dSPaul Mundt };
44225c9a8dSPaul Mundt 
45225c9a8dSPaul Mundt struct sh_mobile_lcdc_sys_bus_ops {
46225c9a8dSPaul Mundt 	void (*write_index)(void *handle, unsigned long data);
47225c9a8dSPaul Mundt 	void (*write_data)(void *handle, unsigned long data);
48225c9a8dSPaul Mundt 	unsigned long (*read_data)(void *handle);
49225c9a8dSPaul Mundt };
50225c9a8dSPaul Mundt 
51225c9a8dSPaul Mundt struct sh_mobile_lcdc_board_cfg {
52225c9a8dSPaul Mundt 	void *board_data;
53225c9a8dSPaul Mundt 	int (*setup_sys)(void *board_data, void *sys_ops_handle,
54225c9a8dSPaul Mundt 			 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
55ef61aae4SMagnus Damm 	void (*start_transfer)(void *board_data, void *sys_ops_handle,
56ef61aae4SMagnus Damm 			       struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
57225c9a8dSPaul Mundt 	void (*display_on)(void *board_data);
58225c9a8dSPaul Mundt 	void (*display_off)(void *board_data);
59225c9a8dSPaul Mundt };
60225c9a8dSPaul Mundt 
61225c9a8dSPaul Mundt struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
62225c9a8dSPaul Mundt 	unsigned long width;
63225c9a8dSPaul Mundt 	unsigned long height;
64225c9a8dSPaul Mundt };
65225c9a8dSPaul Mundt 
66225c9a8dSPaul Mundt struct sh_mobile_lcdc_chan_cfg {
67225c9a8dSPaul Mundt 	int chan;
68225c9a8dSPaul Mundt 	int bpp;
69225c9a8dSPaul Mundt 	int interface_type; /* selects RGBn or SYSn I/F, see above */
70225c9a8dSPaul Mundt 	int clock_divider;
71f400f510SMagnus Damm 	unsigned long flags; /* LCDC_FLAGS_... */
72225c9a8dSPaul Mundt 	struct fb_videomode lcd_cfg;
73225c9a8dSPaul Mundt 	struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg;
74225c9a8dSPaul Mundt 	struct sh_mobile_lcdc_board_cfg board_cfg;
75225c9a8dSPaul Mundt 	struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
76225c9a8dSPaul Mundt };
77225c9a8dSPaul Mundt 
78225c9a8dSPaul Mundt struct sh_mobile_lcdc_info {
79225c9a8dSPaul Mundt 	int clock_source;
80225c9a8dSPaul Mundt 	struct sh_mobile_lcdc_chan_cfg ch[2];
81225c9a8dSPaul Mundt };
82225c9a8dSPaul Mundt 
83225c9a8dSPaul Mundt #endif /* __ASM_SH_MOBILE_LCDC_H__ */
84