aboutsummaryrefslogtreecommitdiff
path: root/include/video/sh_mobile_lcdc.h
blob: d964e68fc61dab119e504f3f8feb1a5d0a44d36d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef __ASM_SH_MOBILE_LCDC_H__
#define __ASM_SH_MOBILE_LCDC_H__

#include <linux/fb.h>
#include <video/sh_mobile_meram.h>

enum {
	RGB8,   /* 24bpp, 8:8:8 */
	RGB9,   /* 18bpp, 9:9 */
	RGB12A, /* 24bpp, 12:12 */
	RGB12B, /* 12bpp */
	RGB16,  /* 16bpp */
	RGB18,  /* 18bpp */
	RGB24,  /* 24bpp */
	YUV422, /* 16bpp */
	SYS8A,  /* 24bpp, 8:8:8 */
	SYS8B,  /* 18bpp, 8:8:2 */
	SYS8C,  /* 18bpp, 2:8:8 */
	SYS8D,  /* 16bpp, 8:8 */
	SYS9,   /* 18bpp, 9:9 */
	SYS12,  /* 24bpp, 12:12 */
	SYS16A, /* 16bpp */
	SYS16B, /* 18bpp, 16:2 */
	SYS16C, /* 18bpp, 2:16 */
	SYS18,  /* 18bpp */
	SYS24,  /* 24bpp */
};

enum { LCDC_CHAN_DISABLED = 0,
       LCDC_CHAN_MAINLCD,
       LCDC_CHAN_SUBLCD };

enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL };

#define LCDC_FLAGS_DWPOL (1 << 0) /* Rising edge dot clock data latch */
#define LCDC_FLAGS_DIPOL (1 << 1) /* Active low display enable polarity */
#define LCDC_FLAGS_DAPOL (1 << 2) /* Active low display data polarity */
#define LCDC_FLAGS_HSCNT (1 << 3) /* Disable HSYNC during VBLANK */
#define LCDC_FLAGS_DWCNT (1 << 4) /* Disable dotclock during blanking */

struct sh_mobile_lcdc_sys_bus_cfg {
	unsigned long ldmt2r;
	unsigned long ldmt3r;
	unsigned long deferred_io_msec;
};

struct sh_mobile_lcdc_sys_bus_ops {
	void (*write_index)(void *handle, unsigned long data);
	void (*write_data)(void *handle, unsigned long data);
	unsigned long (*read_data)(void *handle);
};

struct module;
struct sh_mobile_lcdc_board_cfg {
	struct module *owner;
	void *board_data;
	int (*setup_sys)(void *board_data, void *sys_ops_handle,
			 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
	void (*start_transfer)(void *board_data, void *sys_ops_handle,
			       struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
	void (*display_on)(void *board_data, struct fb_info *info);
	void (*display_off)(void *board_data);
	int (*set_brightness)(void *board_data, int brightness);
	int (*get_brightness)(void *board_data);
};

struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
	unsigned long width;
	unsigned long height;
};

/* backlight info */
struct sh_mobile_lcdc_bl_info {
	const char *name;
	int max_brightness;
};

struct sh_mobile_lcdc_chan_cfg {
	int chan;
	int bpp;
	int interface_type; /* selects RGBn or SYSn I/F, see above */
	int clock_divider;
	unsigned long flags; /* LCDC_FLAGS_... */
	const struct fb_videomode *lcd_cfg;
	int num_cfg;
	struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg;
	struct sh_mobile_lcdc_board_cfg board_cfg;
	struct sh_mobile_lcdc_bl_info bl_info;
	struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
	int nonstd;
	struct sh_mobile_meram_cfg *meram_cfg;
};

struct sh_mobile_lcdc_info {
	int clock_source;
	struct sh_mobile_lcdc_chan_cfg ch[2];
	struct sh_mobile_meram_info *meram_dev;
};

#endif /* __ASM_SH_MOBILE_LCDC_H__ */