blob: 9601b929a40c28421277b7f7801feb9d0e066e48 [file] [log] [blame]
Guennadi Liakhovetski6de9edd2010-09-03 07:20:23 +00001#ifndef SH_MOBILE_LCDCFB_H
2#define SH_MOBILE_LCDCFB_H
3
4#include <linux/completion.h>
5#include <linux/fb.h>
Guennadi Liakhovetskidd210502010-09-14 14:48:54 +00006#include <linux/mutex.h>
Guennadi Liakhovetski6de9edd2010-09-03 07:20:23 +00007#include <linux/wait.h>
8
9/* per-channel registers */
10enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R,
Damian Hobson-Garcia53b50312011-02-24 05:47:13 +000011 LDSM2R, LDSA1R, LDSA2R, LDMLSR, LDHCNR, LDHSYNR, LDVLNR, LDVSYNR, LDPMR,
Guennadi Liakhovetski6de9edd2010-09-03 07:20:23 +000012 LDHAJR,
13 NR_CH_REGS };
14
15#define PALETTE_NR 16
16
Alexandre Courbot3b0fd9d2011-02-16 03:49:01 +000017struct backlight_device;
Laurent Pinchartd2ccdc82011-09-11 18:15:36 +020018struct fb_info;
19struct module;
20struct sh_mobile_lcdc_entity;
21struct sh_mobile_lcdc_priv;
22
23struct sh_mobile_lcdc_entity_ops {
24 /* Display */
25 int (*display_on)(struct sh_mobile_lcdc_entity *entity,
26 struct fb_info *info);
27 void (*display_off)(struct sh_mobile_lcdc_entity *entity);
28};
29
30struct sh_mobile_lcdc_entity {
31 struct module *owner;
32 const struct sh_mobile_lcdc_entity_ops *ops;
33};
Guennadi Liakhovetski6de9edd2010-09-03 07:20:23 +000034
Laurent Pinchart9a217e32011-07-13 12:13:47 +020035/*
36 * struct sh_mobile_lcdc_chan - LCDC display channel
37 *
38 * @base_addr_y: Frame buffer viewport base address (luma component)
39 * @base_addr_c: Frame buffer viewport base address (chroma component)
40 * @pitch: Frame buffer line pitch
41 */
Guennadi Liakhovetski6de9edd2010-09-03 07:20:23 +000042struct sh_mobile_lcdc_chan {
43 struct sh_mobile_lcdc_priv *lcdc;
Laurent Pinchart9a2985e2011-09-11 22:59:04 +020044 struct sh_mobile_lcdc_entity *tx_dev;
45
Guennadi Liakhovetski6de9edd2010-09-03 07:20:23 +000046 unsigned long *reg_offs;
47 unsigned long ldmt1r_value;
48 unsigned long enabled; /* ME and SE in LDCNT2R */
49 struct sh_mobile_lcdc_chan_cfg cfg;
50 u32 pseudo_palette[PALETTE_NR];
Guennadi Liakhovetski6de9edd2010-09-03 07:20:23 +000051 struct fb_info *info;
Alexandre Courbot3b0fd9d2011-02-16 03:49:01 +000052 struct backlight_device *bl;
Guennadi Liakhovetski6de9edd2010-09-03 07:20:23 +000053 dma_addr_t dma_handle;
54 struct fb_deferred_io defio;
55 struct scatterlist *sglist;
56 unsigned long frame_end;
57 unsigned long pan_offset;
58 wait_queue_head_t frame_end_wait;
59 struct completion vsync_completion;
Guennadi Liakhovetski1c120de2010-09-03 07:20:27 +000060 struct fb_var_screeninfo display_var;
Guennadi Liakhovetskidd210502010-09-14 14:48:54 +000061 int use_count;
Alexandre Courbot8857b9a2011-02-23 08:36:30 +000062 int blank_status;
Guennadi Liakhovetskidd210502010-09-14 14:48:54 +000063 struct mutex open_lock; /* protects the use counter */
Damian7caa4342011-05-18 11:10:07 +000064 int meram_enabled;
Laurent Pinchart9a217e32011-07-13 12:13:47 +020065
66 unsigned long base_addr_y;
67 unsigned long base_addr_c;
68 unsigned int pitch;
Guennadi Liakhovetski6de9edd2010-09-03 07:20:23 +000069};
70
71#endif