Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 1 | #ifndef SH_MOBILE_LCDCFB_H |
| 2 | #define SH_MOBILE_LCDCFB_H |
| 3 | |
| 4 | #include <linux/completion.h> |
| 5 | #include <linux/fb.h> |
Guennadi Liakhovetski | dd21050 | 2010-09-14 14:48:54 +0000 | [diff] [blame] | 6 | #include <linux/mutex.h> |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 7 | #include <linux/wait.h> |
| 8 | |
| 9 | /* per-channel registers */ |
| 10 | enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R, |
Damian Hobson-Garcia | 53b5031 | 2011-02-24 05:47:13 +0000 | [diff] [blame] | 11 | LDSM2R, LDSA1R, LDSA2R, LDMLSR, LDHCNR, LDHSYNR, LDVLNR, LDVSYNR, LDPMR, |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 12 | LDHAJR, |
| 13 | NR_CH_REGS }; |
| 14 | |
| 15 | #define PALETTE_NR 16 |
| 16 | |
Alexandre Courbot | 3b0fd9d | 2011-02-16 03:49:01 +0000 | [diff] [blame] | 17 | struct backlight_device; |
Laurent Pinchart | d2ccdc8 | 2011-09-11 18:15:36 +0200 | [diff] [blame] | 18 | struct fb_info; |
| 19 | struct module; |
Laurent Pinchart | e34d0bb | 2011-09-18 12:21:17 +0200 | [diff] [blame] | 20 | struct sh_mobile_lcdc_chan; |
Laurent Pinchart | fc9e78e | 2011-11-29 16:05:36 +0100 | [diff] [blame] | 21 | struct sh_mobile_lcdc_entity; |
| 22 | struct sh_mobile_lcdc_format_info; |
| 23 | struct sh_mobile_lcdc_priv; |
Laurent Pinchart | d2ccdc8 | 2011-09-11 18:15:36 +0200 | [diff] [blame] | 24 | |
Laurent Pinchart | 458981c | 2011-11-28 23:19:59 +0100 | [diff] [blame] | 25 | #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0 |
| 26 | #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1 |
| 27 | |
Laurent Pinchart | d2ccdc8 | 2011-09-11 18:15:36 +0200 | [diff] [blame] | 28 | struct sh_mobile_lcdc_entity_ops { |
| 29 | /* Display */ |
Laurent Pinchart | 5864ace | 2011-09-18 12:26:50 +0200 | [diff] [blame] | 30 | int (*display_on)(struct sh_mobile_lcdc_entity *entity); |
Laurent Pinchart | d2ccdc8 | 2011-09-11 18:15:36 +0200 | [diff] [blame] | 31 | void (*display_off)(struct sh_mobile_lcdc_entity *entity); |
| 32 | }; |
| 33 | |
Laurent Pinchart | ecd2994 | 2011-09-18 14:14:46 +0200 | [diff] [blame] | 34 | enum sh_mobile_lcdc_entity_event { |
| 35 | SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT, |
| 36 | SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT, |
| 37 | SH_MOBILE_LCDC_EVENT_DISPLAY_MODE, |
| 38 | }; |
| 39 | |
Laurent Pinchart | d2ccdc8 | 2011-09-11 18:15:36 +0200 | [diff] [blame] | 40 | struct sh_mobile_lcdc_entity { |
| 41 | struct module *owner; |
| 42 | const struct sh_mobile_lcdc_entity_ops *ops; |
Laurent Pinchart | e34d0bb | 2011-09-18 12:21:17 +0200 | [diff] [blame] | 43 | struct sh_mobile_lcdc_chan *lcdc; |
Laurent Pinchart | 13f80ee | 2011-11-29 01:46:12 +0100 | [diff] [blame] | 44 | struct fb_videomode def_mode; |
Laurent Pinchart | d2ccdc8 | 2011-09-11 18:15:36 +0200 | [diff] [blame] | 45 | }; |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 46 | |
Laurent Pinchart | 9a217e3 | 2011-07-13 12:13:47 +0200 | [diff] [blame] | 47 | /* |
| 48 | * struct sh_mobile_lcdc_chan - LCDC display channel |
| 49 | * |
Laurent Pinchart | a4aa25f | 2012-03-15 18:15:37 +0100 | [diff] [blame] | 50 | * @pan_y_offset: Panning linear offset in bytes (luma component) |
Laurent Pinchart | 9a217e3 | 2011-07-13 12:13:47 +0200 | [diff] [blame] | 51 | * @base_addr_y: Frame buffer viewport base address (luma component) |
| 52 | * @base_addr_c: Frame buffer viewport base address (chroma component) |
| 53 | * @pitch: Frame buffer line pitch |
| 54 | */ |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 55 | struct sh_mobile_lcdc_chan { |
| 56 | struct sh_mobile_lcdc_priv *lcdc; |
Laurent Pinchart | 9a2985e | 2011-09-11 22:59:04 +0200 | [diff] [blame] | 57 | struct sh_mobile_lcdc_entity *tx_dev; |
Laurent Pinchart | b5ef967 | 2011-11-22 00:56:58 +0100 | [diff] [blame] | 58 | const struct sh_mobile_lcdc_chan_cfg *cfg; |
Laurent Pinchart | 9a2985e | 2011-09-11 22:59:04 +0200 | [diff] [blame] | 59 | |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 60 | unsigned long *reg_offs; |
| 61 | unsigned long ldmt1r_value; |
| 62 | unsigned long enabled; /* ME and SE in LDCNT2R */ |
Laurent Pinchart | 4a237177 | 2012-03-15 12:40:47 +0100 | [diff] [blame] | 63 | void *cache; |
Laurent Pinchart | 740f802 | 2011-11-29 14:03:17 +0100 | [diff] [blame] | 64 | |
| 65 | struct mutex open_lock; /* protects the use counter */ |
| 66 | int use_count; |
| 67 | |
Laurent Pinchart | a67f379 | 2011-11-29 14:37:35 +0100 | [diff] [blame] | 68 | void *fb_mem; |
| 69 | unsigned long fb_size; |
Laurent Pinchart | b5ef967 | 2011-11-22 00:56:58 +0100 | [diff] [blame] | 70 | |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 71 | dma_addr_t dma_handle; |
Laurent Pinchart | a4aa25f | 2012-03-15 18:15:37 +0100 | [diff] [blame] | 72 | unsigned long pan_y_offset; |
Laurent Pinchart | 740f802 | 2011-11-29 14:03:17 +0100 | [diff] [blame] | 73 | |
| 74 | unsigned long frame_end; |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 75 | wait_queue_head_t frame_end_wait; |
| 76 | struct completion vsync_completion; |
Laurent Pinchart | 9a217e3 | 2011-07-13 12:13:47 +0200 | [diff] [blame] | 77 | |
Laurent Pinchart | fc9e78e | 2011-11-29 16:05:36 +0100 | [diff] [blame] | 78 | const struct sh_mobile_lcdc_format_info *format; |
Laurent Pinchart | 58f03d9 | 2011-11-30 23:07:30 +0100 | [diff] [blame] | 79 | u32 colorspace; |
| 80 | unsigned int xres; |
| 81 | unsigned int xres_virtual; |
| 82 | unsigned int yres; |
| 83 | unsigned int yres_virtual; |
| 84 | unsigned int pitch; |
| 85 | |
Laurent Pinchart | 9a217e3 | 2011-07-13 12:13:47 +0200 | [diff] [blame] | 86 | unsigned long base_addr_y; |
| 87 | unsigned long base_addr_c; |
Laurent Pinchart | 72c04af | 2012-05-18 10:58:26 +0200 | [diff] [blame] | 88 | unsigned int line_size; |
Laurent Pinchart | ecd2994 | 2011-09-18 14:14:46 +0200 | [diff] [blame] | 89 | |
| 90 | int (*notify)(struct sh_mobile_lcdc_chan *ch, |
| 91 | enum sh_mobile_lcdc_entity_event event, |
Laurent Pinchart | e0c8601 | 2011-11-29 01:05:47 +0100 | [diff] [blame] | 92 | const struct fb_videomode *mode, |
| 93 | const struct fb_monspecs *monspec); |
Laurent Pinchart | 740f802 | 2011-11-29 14:03:17 +0100 | [diff] [blame] | 94 | |
| 95 | /* Backlight */ |
| 96 | struct backlight_device *bl; |
Laurent Pinchart | 656d4f3 | 2012-08-15 18:10:03 +0200 | [diff] [blame] | 97 | unsigned int bl_brightness; |
Laurent Pinchart | 740f802 | 2011-11-29 14:03:17 +0100 | [diff] [blame] | 98 | |
| 99 | /* FB */ |
| 100 | struct fb_info *info; |
| 101 | u32 pseudo_palette[PALETTE_NR]; |
| 102 | struct { |
| 103 | unsigned int width; |
| 104 | unsigned int height; |
| 105 | struct fb_videomode mode; |
| 106 | } display; |
| 107 | struct fb_deferred_io defio; |
| 108 | struct scatterlist *sglist; |
| 109 | int blank_status; |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | #endif |