1 #ifndef SH_MOBILE_LCDCFB_H
2 #define SH_MOBILE_LCDCFB_H
4 #include <linux/completion.h>
6 #include <linux/mutex.h>
7 #include <linux/wait.h>
9 /* per-channel registers */
10 enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R,
11 LDSM2R, LDSA1R, LDSA2R, LDMLSR, LDHCNR, LDHSYNR, LDVLNR, LDVSYNR, LDPMR,
17 struct backlight_device;
20 struct sh_mobile_lcdc_entity;
21 struct sh_mobile_lcdc_priv;
22 struct sh_mobile_lcdc_chan;
24 #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0
25 #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1
27 struct sh_mobile_lcdc_entity_ops {
29 int (*display_on)(struct sh_mobile_lcdc_entity *entity);
30 void (*display_off)(struct sh_mobile_lcdc_entity *entity);
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,
39 struct sh_mobile_lcdc_entity {
41 const struct sh_mobile_lcdc_entity_ops *ops;
42 struct sh_mobile_lcdc_chan *lcdc;
43 struct fb_videomode def_mode;
47 * struct sh_mobile_lcdc_chan - LCDC display channel
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
53 struct sh_mobile_lcdc_chan {
54 struct sh_mobile_lcdc_priv *lcdc;
55 struct sh_mobile_lcdc_entity *tx_dev;
57 unsigned long *reg_offs;
58 unsigned long ldmt1r_value;
59 unsigned long enabled; /* ME and SE in LDCNT2R */
60 struct sh_mobile_lcdc_chan_cfg cfg;
61 u32 pseudo_palette[PALETTE_NR];
63 struct backlight_device *bl;
64 dma_addr_t dma_handle;
65 struct fb_deferred_io defio;
66 struct scatterlist *sglist;
67 unsigned long frame_end;
68 unsigned long pan_offset;
69 wait_queue_head_t frame_end_wait;
70 struct completion vsync_completion;
74 struct fb_videomode mode;
78 struct mutex open_lock; /* protects the use counter */
81 unsigned long base_addr_y;
82 unsigned long base_addr_c;
85 int (*notify)(struct sh_mobile_lcdc_chan *ch,
86 enum sh_mobile_lcdc_entity_event event,
87 const struct fb_videomode *mode,
88 const struct fb_monspecs *monspec);