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 | * |
| 50 | * @base_addr_y: Frame buffer viewport base address (luma component) |
| 51 | * @base_addr_c: Frame buffer viewport base address (chroma component) |
| 52 | * @pitch: Frame buffer line pitch |
| 53 | */ |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 54 | struct sh_mobile_lcdc_chan { |
| 55 | struct sh_mobile_lcdc_priv *lcdc; |
Laurent Pinchart | 9a2985e | 2011-09-11 22:59:04 +0200 | [diff] [blame] | 56 | struct sh_mobile_lcdc_entity *tx_dev; |
Laurent Pinchart | b5ef967 | 2011-11-22 00:56:58 +0100 | [diff] [blame] | 57 | const struct sh_mobile_lcdc_chan_cfg *cfg; |
Laurent Pinchart | 9a2985e | 2011-09-11 22:59:04 +0200 | [diff] [blame] | 58 | |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 59 | unsigned long *reg_offs; |
| 60 | unsigned long ldmt1r_value; |
| 61 | unsigned long enabled; /* ME and SE in LDCNT2R */ |
Laurent Pinchart | 4811005 | 2011-12-12 16:36:13 +0100 | [diff] [blame] | 62 | void *meram; |
Laurent Pinchart | 740f802 | 2011-11-29 14:03:17 +0100 | [diff] [blame] | 63 | |
| 64 | struct mutex open_lock; /* protects the use counter */ |
| 65 | int use_count; |
| 66 | |
Laurent Pinchart | a67f379 | 2011-11-29 14:37:35 +0100 | [diff] [blame] | 67 | void *fb_mem; |
| 68 | unsigned long fb_size; |
Laurent Pinchart | b5ef967 | 2011-11-22 00:56:58 +0100 | [diff] [blame] | 69 | |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 70 | dma_addr_t dma_handle; |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 71 | unsigned long pan_offset; |
Laurent Pinchart | 740f802 | 2011-11-29 14:03:17 +0100 | [diff] [blame] | 72 | |
| 73 | unsigned long frame_end; |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 74 | wait_queue_head_t frame_end_wait; |
| 75 | struct completion vsync_completion; |
Laurent Pinchart | 9a217e3 | 2011-07-13 12:13:47 +0200 | [diff] [blame] | 76 | |
Laurent Pinchart | fc9e78e | 2011-11-29 16:05:36 +0100 | [diff] [blame] | 77 | const struct sh_mobile_lcdc_format_info *format; |
Laurent Pinchart | 58f03d9 | 2011-11-30 23:07:30 +0100 | [diff] [blame] | 78 | u32 colorspace; |
| 79 | unsigned int xres; |
| 80 | unsigned int xres_virtual; |
| 81 | unsigned int yres; |
| 82 | unsigned int yres_virtual; |
| 83 | unsigned int pitch; |
| 84 | |
Laurent Pinchart | 9a217e3 | 2011-07-13 12:13:47 +0200 | [diff] [blame] | 85 | unsigned long base_addr_y; |
| 86 | unsigned long base_addr_c; |
Laurent Pinchart | 72c04af | 2012-05-18 10:58:26 +0200 | [diff] [blame] | 87 | unsigned int line_size; |
Laurent Pinchart | ecd2994 | 2011-09-18 14:14:46 +0200 | [diff] [blame] | 88 | |
| 89 | int (*notify)(struct sh_mobile_lcdc_chan *ch, |
| 90 | enum sh_mobile_lcdc_entity_event event, |
Laurent Pinchart | e0c8601 | 2011-11-29 01:05:47 +0100 | [diff] [blame] | 91 | const struct fb_videomode *mode, |
| 92 | const struct fb_monspecs *monspec); |
Laurent Pinchart | 740f802 | 2011-11-29 14:03:17 +0100 | [diff] [blame] | 93 | |
| 94 | /* Backlight */ |
| 95 | struct backlight_device *bl; |
| 96 | |
| 97 | /* FB */ |
| 98 | struct fb_info *info; |
| 99 | u32 pseudo_palette[PALETTE_NR]; |
| 100 | struct { |
| 101 | unsigned int width; |
| 102 | unsigned int height; |
| 103 | struct fb_videomode mode; |
| 104 | } display; |
| 105 | struct fb_deferred_io defio; |
| 106 | struct scatterlist *sglist; |
| 107 | int blank_status; |
Guennadi Liakhovetski | 6de9edd | 2010-09-03 07:20:23 +0000 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | #endif |