0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __OMAPFB_H
0012 #define __OMAPFB_H
0013
0014 #include <linux/fb.h>
0015 #include <linux/mutex.h>
0016 #include <linux/omapfb.h>
0017
0018 #define OMAPFB_EVENT_READY 1
0019 #define OMAPFB_EVENT_DISABLED 2
0020
0021 #define OMAP_LCDC_INV_VSYNC 0x0001
0022 #define OMAP_LCDC_INV_HSYNC 0x0002
0023 #define OMAP_LCDC_INV_PIX_CLOCK 0x0004
0024 #define OMAP_LCDC_INV_OUTPUT_EN 0x0008
0025 #define OMAP_LCDC_HSVS_RISING_EDGE 0x0010
0026 #define OMAP_LCDC_HSVS_OPPOSITE 0x0020
0027
0028 #define OMAP_LCDC_SIGNAL_MASK 0x003f
0029
0030 #define OMAP_LCDC_PANEL_TFT 0x0100
0031
0032 #define OMAPFB_PLANE_XRES_MIN 8
0033 #define OMAPFB_PLANE_YRES_MIN 8
0034
0035 struct omapfb_device;
0036
0037 #define OMAPFB_PLANE_NUM 1
0038
0039 struct omapfb_mem_region {
0040 u32 paddr;
0041 void __iomem *vaddr;
0042 unsigned long size;
0043 u8 type;
0044 enum omapfb_color_format format;
0045 unsigned format_used:1;
0046
0047
0048
0049 unsigned alloc:1;
0050 unsigned map:1;
0051 };
0052
0053 struct omapfb_mem_desc {
0054 int region_cnt;
0055 struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
0056 };
0057
0058 struct lcd_panel {
0059 const char *name;
0060 int config;
0061 int bpp;
0062 int data_lines;
0063
0064 int x_res, y_res;
0065 int pixel_clock;
0066 int hsw;
0067
0068 int hfp;
0069 int hbp;
0070 int vsw;
0071
0072 int vfp;
0073 int vbp;
0074 int acb;
0075 int pcd;
0076
0077
0078 int (*init) (struct lcd_panel *panel,
0079 struct omapfb_device *fbdev);
0080 void (*cleanup) (struct lcd_panel *panel);
0081 int (*enable) (struct lcd_panel *panel);
0082 void (*disable) (struct lcd_panel *panel);
0083 unsigned long (*get_caps) (struct lcd_panel *panel);
0084 int (*set_bklight_level)(struct lcd_panel *panel,
0085 unsigned int level);
0086 unsigned int (*get_bklight_level)(struct lcd_panel *panel);
0087 unsigned int (*get_bklight_max) (struct lcd_panel *panel);
0088 int (*run_test) (struct lcd_panel *panel, int test_num);
0089 };
0090
0091 struct extif_timings {
0092 int cs_on_time;
0093 int cs_off_time;
0094 int we_on_time;
0095 int we_off_time;
0096 int re_on_time;
0097 int re_off_time;
0098 int we_cycle_time;
0099 int re_cycle_time;
0100 int cs_pulse_width;
0101 int access_time;
0102
0103 int clk_div;
0104
0105 u32 tim[5];
0106
0107 int converted;
0108 };
0109
0110 struct lcd_ctrl_extif {
0111 int (*init) (struct omapfb_device *fbdev);
0112 void (*cleanup) (void);
0113 void (*get_clk_info) (u32 *clk_period, u32 *max_clk_div);
0114 unsigned long (*get_max_tx_rate)(void);
0115 int (*convert_timings) (struct extif_timings *timings);
0116 void (*set_timings) (const struct extif_timings *timings);
0117 void (*set_bits_per_cycle)(int bpc);
0118 void (*write_command) (const void *buf, unsigned int len);
0119 void (*read_data) (void *buf, unsigned int len);
0120 void (*write_data) (const void *buf, unsigned int len);
0121 void (*transfer_area) (int width, int height,
0122 void (callback)(void *data), void *data);
0123 int (*setup_tearsync) (unsigned pin_cnt,
0124 unsigned hs_pulse_time, unsigned vs_pulse_time,
0125 int hs_pol_inv, int vs_pol_inv, int div);
0126 int (*enable_tearsync) (int enable, unsigned line);
0127
0128 unsigned long max_transmit_size;
0129 };
0130
0131 struct omapfb_notifier_block {
0132 struct notifier_block nb;
0133 void *data;
0134 int plane_idx;
0135 };
0136
0137 typedef int (*omapfb_notifier_callback_t)(struct notifier_block *,
0138 unsigned long event,
0139 void *fbi);
0140
0141 struct lcd_ctrl {
0142 const char *name;
0143 void *data;
0144
0145 int (*init) (struct omapfb_device *fbdev,
0146 int ext_mode,
0147 struct omapfb_mem_desc *req_md);
0148 void (*cleanup) (void);
0149 void (*bind_client) (struct omapfb_notifier_block *nb);
0150 void (*get_caps) (int plane, struct omapfb_caps *caps);
0151 int (*set_update_mode)(enum omapfb_update_mode mode);
0152 enum omapfb_update_mode (*get_update_mode)(void);
0153 int (*setup_plane) (int plane, int channel_out,
0154 unsigned long offset,
0155 int screen_width,
0156 int pos_x, int pos_y, int width,
0157 int height, int color_mode);
0158 int (*set_rotate) (int angle);
0159 int (*setup_mem) (int plane, size_t size,
0160 int mem_type, unsigned long *paddr);
0161 int (*mmap) (struct fb_info *info,
0162 struct vm_area_struct *vma);
0163 int (*set_scale) (int plane,
0164 int orig_width, int orig_height,
0165 int out_width, int out_height);
0166 int (*enable_plane) (int plane, int enable);
0167 int (*update_window) (struct fb_info *fbi,
0168 struct omapfb_update_window *win,
0169 void (*callback)(void *),
0170 void *callback_data);
0171 void (*sync) (void);
0172 void (*suspend) (void);
0173 void (*resume) (void);
0174 int (*run_test) (int test_num);
0175 int (*setcolreg) (u_int regno, u16 red, u16 green,
0176 u16 blue, u16 transp,
0177 int update_hw_mem);
0178 int (*set_color_key) (struct omapfb_color_key *ck);
0179 int (*get_color_key) (struct omapfb_color_key *ck);
0180 };
0181
0182 enum omapfb_state {
0183 OMAPFB_DISABLED = 0,
0184 OMAPFB_SUSPENDED = 99,
0185 OMAPFB_ACTIVE = 100
0186 };
0187
0188 struct omapfb_plane_struct {
0189 int idx;
0190 struct omapfb_plane_info info;
0191 enum omapfb_color_format color_mode;
0192 struct omapfb_device *fbdev;
0193 };
0194
0195 struct omapfb_device {
0196 int state;
0197 int ext_lcdc;
0198
0199 struct mutex rqueue_mutex;
0200
0201 int palette_size;
0202 u32 pseudo_palette[17];
0203
0204 struct lcd_panel *panel;
0205 const struct lcd_ctrl *ctrl;
0206 const struct lcd_ctrl *int_ctrl;
0207 int ext_irq;
0208 int int_irq;
0209 struct lcd_ctrl_extif *ext_if;
0210
0211 struct device *dev;
0212 struct fb_var_screeninfo new_var;
0213
0214 struct omapfb_mem_desc mem_desc;
0215 struct fb_info *fb_info[OMAPFB_PLANE_NUM];
0216
0217 struct platform_device *dssdev;
0218 };
0219
0220 extern struct lcd_ctrl omap1_lcd_ctrl;
0221
0222 extern void omapfb_register_panel(struct lcd_panel *panel);
0223 extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval);
0224 extern void omapfb_notify_clients(struct omapfb_device *fbdev,
0225 unsigned long event);
0226 extern int omapfb_register_client(struct omapfb_notifier_block *nb,
0227 omapfb_notifier_callback_t callback,
0228 void *callback_data);
0229 extern int omapfb_unregister_client(struct omapfb_notifier_block *nb);
0230 #endif