1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef SH_MOBILE_LCDCFB_H
3 #define SH_MOBILE_LCDCFB_H
5 #include <linux/completion.h>
7 #include <linux/mutex.h>
8 #include <linux/wait.h>
10 /* per-channel registers */
11 enum { LDDCKPAT1R
, LDDCKPAT2R
, LDMT1R
, LDMT2R
, LDMT3R
, LDDFR
, LDSM1R
,
12 LDSM2R
, LDSA1R
, LDSA2R
, LDMLSR
, LDHCNR
, LDHSYNR
, LDVLNR
, LDVSYNR
, LDPMR
,
18 struct backlight_device
;
21 struct sh_mobile_lcdc_chan
;
22 struct sh_mobile_lcdc_entity
;
23 struct sh_mobile_lcdc_format_info
;
24 struct sh_mobile_lcdc_priv
;
26 #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0
27 #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1
29 struct sh_mobile_lcdc_entity_ops
{
31 int (*display_on
)(struct sh_mobile_lcdc_entity
*entity
);
32 void (*display_off
)(struct sh_mobile_lcdc_entity
*entity
);
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
,
41 struct sh_mobile_lcdc_entity
{
43 const struct sh_mobile_lcdc_entity_ops
*ops
;
44 struct sh_mobile_lcdc_chan
*lcdc
;
45 struct fb_videomode def_mode
;
49 * struct sh_mobile_lcdc_chan - LCDC display channel
51 * @pan_y_offset: Panning linear offset in bytes (luma component)
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
56 struct sh_mobile_lcdc_chan
{
57 struct sh_mobile_lcdc_priv
*lcdc
;
58 struct sh_mobile_lcdc_entity
*tx_dev
;
59 const struct sh_mobile_lcdc_chan_cfg
*cfg
;
61 unsigned long *reg_offs
;
62 unsigned long ldmt1r_value
;
63 unsigned long enabled
; /* ME and SE in LDCNT2R */
66 struct mutex open_lock
; /* protects the use counter */
70 unsigned long fb_size
;
72 dma_addr_t dma_handle
;
73 unsigned long pan_y_offset
;
75 unsigned long frame_end
;
76 wait_queue_head_t frame_end_wait
;
77 struct completion vsync_completion
;
79 const struct sh_mobile_lcdc_format_info
*format
;
82 unsigned int xres_virtual
;
84 unsigned int yres_virtual
;
87 unsigned long base_addr_y
;
88 unsigned long base_addr_c
;
89 unsigned int line_size
;
91 int (*notify
)(struct sh_mobile_lcdc_chan
*ch
,
92 enum sh_mobile_lcdc_entity_event event
,
93 const struct fb_videomode
*mode
,
94 const struct fb_monspecs
*monspec
);
97 struct backlight_device
*bl
;
98 unsigned int bl_brightness
;
101 struct fb_info
*info
;
102 u32 pseudo_palette
[PALETTE_NR
];
106 struct fb_videomode mode
;
108 struct fb_deferred_io defio
;
109 struct scatterlist
*sglist
;