Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
6de9edd5 GL |
2 | #ifndef SH_MOBILE_LCDCFB_H |
3 | #define SH_MOBILE_LCDCFB_H | |
4 | ||
5 | #include <linux/completion.h> | |
6 | #include <linux/fb.h> | |
dd210503 | 7 | #include <linux/mutex.h> |
6de9edd5 GL |
8 | #include <linux/wait.h> |
9 | ||
10 | /* per-channel registers */ | |
11 | enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R, | |
53b50314 | 12 | LDSM2R, LDSA1R, LDSA2R, LDMLSR, LDHCNR, LDHSYNR, LDVLNR, LDVSYNR, LDPMR, |
6de9edd5 GL |
13 | LDHAJR, |
14 | NR_CH_REGS }; | |
15 | ||
16 | #define PALETTE_NR 16 | |
17 | ||
3b0fd9d7 | 18 | struct backlight_device; |
d2ccdc80 LP |
19 | struct fb_info; |
20 | struct module; | |
fc9e78e6 | 21 | struct sh_mobile_lcdc_chan; |
d2ccdc80 | 22 | struct sh_mobile_lcdc_entity; |
fc9e78e6 | 23 | struct sh_mobile_lcdc_format_info; |
d2ccdc80 LP |
24 | struct sh_mobile_lcdc_priv; |
25 | ||
458981c3 LP |
26 | #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0 |
27 | #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1 | |
28 | ||
d2ccdc80 LP |
29 | struct sh_mobile_lcdc_entity_ops { |
30 | /* Display */ | |
5864ace1 | 31 | int (*display_on)(struct sh_mobile_lcdc_entity *entity); |
d2ccdc80 LP |
32 | void (*display_off)(struct sh_mobile_lcdc_entity *entity); |
33 | }; | |
34 | ||
ecd29947 LP |
35 | enum sh_mobile_lcdc_entity_event { |
36 | SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT, | |
37 | SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT, | |
38 | SH_MOBILE_LCDC_EVENT_DISPLAY_MODE, | |
39 | }; | |
40 | ||
d2ccdc80 LP |
41 | struct sh_mobile_lcdc_entity { |
42 | struct module *owner; | |
43 | const struct sh_mobile_lcdc_entity_ops *ops; | |
e34d0bbb | 44 | struct sh_mobile_lcdc_chan *lcdc; |
13f80eea | 45 | struct fb_videomode def_mode; |
d2ccdc80 | 46 | }; |
6de9edd5 | 47 | |
9a217e34 LP |
48 | /* |
49 | * struct sh_mobile_lcdc_chan - LCDC display channel | |
50 | * | |
a4aa25f6 | 51 | * @pan_y_offset: Panning linear offset in bytes (luma component) |
9a217e34 LP |
52 | * @base_addr_y: Frame buffer viewport base address (luma component) |
53 | * @base_addr_c: Frame buffer viewport base address (chroma component) | |
54 | * @pitch: Frame buffer line pitch | |
55 | */ | |
6de9edd5 GL |
56 | struct sh_mobile_lcdc_chan { |
57 | struct sh_mobile_lcdc_priv *lcdc; | |
9a2985e7 | 58 | struct sh_mobile_lcdc_entity *tx_dev; |
b5ef967d | 59 | const struct sh_mobile_lcdc_chan_cfg *cfg; |
9a2985e7 | 60 | |
6de9edd5 GL |
61 | unsigned long *reg_offs; |
62 | unsigned long ldmt1r_value; | |
63 | unsigned long enabled; /* ME and SE in LDCNT2R */ | |
4a237177 | 64 | void *cache; |
740f802a LP |
65 | |
66 | struct mutex open_lock; /* protects the use counter */ | |
67 | int use_count; | |
68 | ||
a67f379d LP |
69 | void *fb_mem; |
70 | unsigned long fb_size; | |
b5ef967d | 71 | |
6de9edd5 | 72 | dma_addr_t dma_handle; |
a4aa25f6 | 73 | unsigned long pan_y_offset; |
740f802a LP |
74 | |
75 | unsigned long frame_end; | |
6de9edd5 GL |
76 | wait_queue_head_t frame_end_wait; |
77 | struct completion vsync_completion; | |
9a217e34 | 78 | |
fc9e78e6 | 79 | const struct sh_mobile_lcdc_format_info *format; |
58f03d99 LP |
80 | u32 colorspace; |
81 | unsigned int xres; | |
82 | unsigned int xres_virtual; | |
83 | unsigned int yres; | |
84 | unsigned int yres_virtual; | |
85 | unsigned int pitch; | |
86 | ||
9a217e34 LP |
87 | unsigned long base_addr_y; |
88 | unsigned long base_addr_c; | |
72c04af9 | 89 | unsigned int line_size; |
ecd29947 LP |
90 | |
91 | int (*notify)(struct sh_mobile_lcdc_chan *ch, | |
92 | enum sh_mobile_lcdc_entity_event event, | |
e0c8601a LP |
93 | const struct fb_videomode *mode, |
94 | const struct fb_monspecs *monspec); | |
740f802a LP |
95 | |
96 | /* Backlight */ | |
97 | struct backlight_device *bl; | |
656d4f33 | 98 | unsigned int bl_brightness; |
740f802a LP |
99 | |
100 | /* FB */ | |
101 | struct fb_info *info; | |
102 | u32 pseudo_palette[PALETTE_NR]; | |
103 | struct { | |
104 | unsigned int width; | |
105 | unsigned int height; | |
106 | struct fb_videomode mode; | |
107 | } display; | |
108 | struct fb_deferred_io defio; | |
109 | struct scatterlist *sglist; | |
110 | int blank_status; | |
6de9edd5 GL |
111 | }; |
112 | ||
113 | #endif |