fbdev: sh_mobile_lcdc: Reorganize the sh_mobile_lcdc_chan structure
[GitHub/LineageOS/android_kernel_samsung_universal7580.git] / drivers / video / sh_mobile_lcdcfb.h
1 #ifndef SH_MOBILE_LCDCFB_H
2 #define SH_MOBILE_LCDCFB_H
3
4 #include <linux/completion.h>
5 #include <linux/fb.h>
6 #include <linux/mutex.h>
7 #include <linux/wait.h>
8
9 /* per-channel registers */
10 enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R,
11 LDSM2R, LDSA1R, LDSA2R, LDMLSR, LDHCNR, LDHSYNR, LDVLNR, LDVSYNR, LDPMR,
12 LDHAJR,
13 NR_CH_REGS };
14
15 #define PALETTE_NR 16
16
17 struct backlight_device;
18 struct fb_info;
19 struct module;
20 struct sh_mobile_lcdc_entity;
21 struct sh_mobile_lcdc_priv;
22 struct sh_mobile_lcdc_chan;
23
24 #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0
25 #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1
26
27 struct sh_mobile_lcdc_entity_ops {
28 /* Display */
29 int (*display_on)(struct sh_mobile_lcdc_entity *entity);
30 void (*display_off)(struct sh_mobile_lcdc_entity *entity);
31 };
32
33 enum sh_mobile_lcdc_entity_event {
34 SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT,
35 SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT,
36 SH_MOBILE_LCDC_EVENT_DISPLAY_MODE,
37 };
38
39 struct sh_mobile_lcdc_entity {
40 struct module *owner;
41 const struct sh_mobile_lcdc_entity_ops *ops;
42 struct sh_mobile_lcdc_chan *lcdc;
43 struct fb_videomode def_mode;
44 };
45
46 /*
47 * struct sh_mobile_lcdc_chan - LCDC display channel
48 *
49 * @base_addr_y: Frame buffer viewport base address (luma component)
50 * @base_addr_c: Frame buffer viewport base address (chroma component)
51 * @pitch: Frame buffer line pitch
52 */
53 struct sh_mobile_lcdc_chan {
54 struct sh_mobile_lcdc_priv *lcdc;
55 struct sh_mobile_lcdc_entity *tx_dev;
56 struct sh_mobile_lcdc_chan_cfg cfg;
57
58 unsigned long *reg_offs;
59 unsigned long ldmt1r_value;
60 unsigned long enabled; /* ME and SE in LDCNT2R */
61 int meram_enabled;
62
63 struct mutex open_lock; /* protects the use counter */
64 int use_count;
65
66 dma_addr_t dma_handle;
67 unsigned long pan_offset;
68
69 unsigned long frame_end;
70 wait_queue_head_t frame_end_wait;
71 struct completion vsync_completion;
72
73 unsigned long base_addr_y;
74 unsigned long base_addr_c;
75 unsigned int pitch;
76
77 int (*notify)(struct sh_mobile_lcdc_chan *ch,
78 enum sh_mobile_lcdc_entity_event event,
79 const struct fb_videomode *mode,
80 const struct fb_monspecs *monspec);
81
82 /* Backlight */
83 struct backlight_device *bl;
84
85 /* FB */
86 struct fb_info *info;
87 u32 pseudo_palette[PALETTE_NR];
88 struct {
89 unsigned int width;
90 unsigned int height;
91 struct fb_videomode mode;
92 } display;
93 struct fb_deferred_io defio;
94 struct scatterlist *sglist;
95 int blank_status;
96 };
97
98 #endif