Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

omapfb.h

Go to the documentation of this file.
00001 /*
00002  * File: arch/arm/plat-omap/include/mach/omapfb.h
00003  *
00004  * Framebuffer driver for TI OMAP boards
00005  *
00006  * Copyright (C) 2004 Nokia Corporation
00007  * Author: Imre Deak <imre.deak@nokia.com>
00008  *
00009  * This program is free software; you can redistribute it and/or modify it
00010  * under the terms of the GNU General Public License as published by the
00011  * Free Software Foundation; either version 2 of the License, or (at your
00012  * option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License along
00020  * with this program; if not, write to the Free Software Foundation, Inc.,
00021  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022  */
00023 
00024 #ifndef __OMAPFB_H
00025 #define __OMAPFB_H
00026 
00027 #include <asm/ioctl.h>
00028 #include <asm/types.h>
00029 
00030 /* IOCTL commands. */
00031 
00032 #define OMAP_IOW(num, dtype)    _IOW('O', num, dtype)
00033 #define OMAP_IOR(num, dtype)    _IOR('O', num, dtype)
00034 #define OMAP_IOWR(num, dtype)   _IOWR('O', num, dtype)
00035 #define OMAP_IO(num)        _IO('O', num)
00036 
00037 #define OMAPFB_MIRROR       OMAP_IOW(31, int)
00038 #define OMAPFB_SYNC_GFX     OMAP_IO(37)
00039 #define OMAPFB_VSYNC        OMAP_IO(38)
00040 #define OMAPFB_SET_UPDATE_MODE  OMAP_IOW(40, int)
00041 #define OMAPFB_GET_CAPS     OMAP_IOR(42, struct omapfb_caps)
00042 #define OMAPFB_GET_UPDATE_MODE  OMAP_IOW(43, int)
00043 #define OMAPFB_LCD_TEST     OMAP_IOW(45, int)
00044 #define OMAPFB_CTRL_TEST    OMAP_IOW(46, int)
00045 #define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
00046 #define OMAPFB_SET_COLOR_KEY    OMAP_IOW(50, struct omapfb_color_key)
00047 #define OMAPFB_GET_COLOR_KEY    OMAP_IOW(51, struct omapfb_color_key)
00048 #define OMAPFB_SETUP_PLANE  OMAP_IOW(52, struct omapfb_plane_info)
00049 #define OMAPFB_QUERY_PLANE  OMAP_IOW(53, struct omapfb_plane_info)
00050 #define OMAPFB_UPDATE_WINDOW    OMAP_IOW(54, struct omapfb_update_window)
00051 #define OMAPFB_SETUP_MEM    OMAP_IOW(55, struct omapfb_mem_info)
00052 #define OMAPFB_QUERY_MEM    OMAP_IOW(56, struct omapfb_mem_info)
00053 #define OMAPFB_WAITFORVSYNC OMAP_IO(57)
00054 #define OMAPFB_MEMORY_READ  OMAP_IOR(58, struct omapfb_memory_read)
00055 
00056 #define OMAPFB_CAPS_GENERIC_MASK    0x00000fff
00057 #define OMAPFB_CAPS_LCDC_MASK       0x00fff000
00058 #define OMAPFB_CAPS_PANEL_MASK      0xff000000
00059 
00060 #define OMAPFB_CAPS_MANUAL_UPDATE   0x00001000
00061 #define OMAPFB_CAPS_TEARSYNC        0x00002000
00062 #define OMAPFB_CAPS_PLANE_RELOCATE_MEM  0x00004000
00063 #define OMAPFB_CAPS_PLANE_SCALE     0x00008000
00064 #define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000
00065 #define OMAPFB_CAPS_WINDOW_SCALE    0x00020000
00066 #define OMAPFB_CAPS_WINDOW_OVERLAY  0x00040000
00067 #define OMAPFB_CAPS_WINDOW_ROTATE   0x00080000
00068 #define OMAPFB_CAPS_SET_BACKLIGHT   0x01000000
00069 
00070 /* Values from DSP must map to lower 16-bits */
00071 #define OMAPFB_FORMAT_MASK      0x00ff
00072 #define OMAPFB_FORMAT_FLAG_DOUBLE   0x0100
00073 #define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200
00074 #define OMAPFB_FORMAT_FLAG_FORCE_VSYNC  0x0400
00075 #define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY   0x0800
00076 #define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY  0x1000
00077 
00078 #define OMAPFB_EVENT_READY  1
00079 #define OMAPFB_EVENT_DISABLED   2
00080 
00081 #define OMAPFB_MEMTYPE_SDRAM        0
00082 #define OMAPFB_MEMTYPE_SRAM     1
00083 #define OMAPFB_MEMTYPE_MAX      1
00084 
00085 enum omapfb_color_format {
00086     OMAPFB_COLOR_RGB565 = 0,
00087     OMAPFB_COLOR_YUV422,
00088     OMAPFB_COLOR_YUV420,
00089     OMAPFB_COLOR_CLUT_8BPP,
00090     OMAPFB_COLOR_CLUT_4BPP,
00091     OMAPFB_COLOR_CLUT_2BPP,
00092     OMAPFB_COLOR_CLUT_1BPP,
00093     OMAPFB_COLOR_RGB444,
00094     OMAPFB_COLOR_YUY422,
00095 
00096     OMAPFB_COLOR_ARGB16,
00097     OMAPFB_COLOR_RGB24U,    /* RGB24, 32-bit container */
00098     OMAPFB_COLOR_RGB24P,    /* RGB24, 24-bit container */
00099     OMAPFB_COLOR_ARGB32,
00100     OMAPFB_COLOR_RGBA32,
00101     OMAPFB_COLOR_RGBX32,
00102 };
00103 
00104 struct omapfb_update_window {
00105     __u32 x, y;
00106     __u32 width, height;
00107     __u32 format;
00108     __u32 out_x, out_y;
00109     __u32 out_width, out_height;
00110     __u32 reserved[8];
00111 };
00112 
00113 struct omapfb_update_window_old {
00114     __u32 x, y;
00115     __u32 width, height;
00116     __u32 format;
00117 };
00118 
00119 enum omapfb_plane {
00120     OMAPFB_PLANE_GFX = 0,
00121     OMAPFB_PLANE_VID1,
00122     OMAPFB_PLANE_VID2,
00123 };
00124 
00125 enum omapfb_channel_out {
00126     OMAPFB_CHANNEL_OUT_LCD = 0,
00127     OMAPFB_CHANNEL_OUT_DIGIT,
00128 };
00129 
00130 struct omapfb_plane_info {
00131     __u32 pos_x;
00132     __u32 pos_y;
00133     __u8  enabled;
00134     __u8  channel_out;
00135     __u8  mirror;
00136     __u8  reserved1;
00137     __u32 out_width;
00138     __u32 out_height;
00139     __u32 reserved2[12];
00140 };
00141 
00142 struct omapfb_mem_info {
00143     __u32 size;
00144     __u8  type;
00145     __u8  reserved[3];
00146 };
00147 
00148 struct omapfb_caps {
00149     __u32 ctrl;
00150     __u32 plane_color;
00151     __u32 wnd_color;
00152 };
00153 
00154 enum omapfb_color_key_type {
00155     OMAPFB_COLOR_KEY_DISABLED = 0,
00156     OMAPFB_COLOR_KEY_GFX_DST,
00157     OMAPFB_COLOR_KEY_VID_SRC,
00158 };
00159 
00160 struct omapfb_color_key {
00161     __u8  channel_out;
00162     __u32 background;
00163     __u32 trans_key;
00164     __u8  key_type;
00165 };
00166 
00167 enum omapfb_update_mode {
00168     OMAPFB_UPDATE_DISABLED = 0,
00169     OMAPFB_AUTO_UPDATE,
00170     OMAPFB_MANUAL_UPDATE
00171 };
00172 
00173 struct omapfb_memory_read {
00174     __u16 x;
00175     __u16 y;
00176     __u16 w;
00177     __u16 h;
00178     size_t buffer_size;
00179     void  *buffer;
00180 };
00181 
00182 #ifdef __KERNEL__
00183 
00184 #include <linux/completion.h>
00185 #include <linux/interrupt.h>
00186 #include <linux/fb.h>
00187 #include <linux/mutex.h>
00188 
00189 #include <mach/board.h>
00190 
00191 #define OMAP_LCDC_INV_VSYNC             0x0001
00192 #define OMAP_LCDC_INV_HSYNC             0x0002
00193 #define OMAP_LCDC_INV_PIX_CLOCK         0x0004
00194 #define OMAP_LCDC_INV_OUTPUT_EN         0x0008
00195 #define OMAP_LCDC_HSVS_RISING_EDGE      0x0010
00196 #define OMAP_LCDC_HSVS_OPPOSITE         0x0020
00197 
00198 #define OMAP_LCDC_SIGNAL_MASK       0x003f
00199 
00200 #define OMAP_LCDC_PANEL_TFT     0x0100
00201 
00202 #define OMAPFB_PLANE_XRES_MIN       8
00203 #define OMAPFB_PLANE_YRES_MIN       8
00204 
00205 #ifdef CONFIG_ARCH_OMAP1
00206 #define OMAPFB_PLANE_NUM        1
00207 #else
00208 #define OMAPFB_PLANE_NUM        3
00209 #endif
00210 
00211 struct omapfb_device;
00212 
00213 struct lcd_panel {
00214     const char  *name;
00215     int     config;     /* TFT/STN, signal inversion */
00216     int     bpp;        /* Pixel format in fb mem */
00217     int     data_lines; /* Lines on LCD HW interface */
00218 
00219     int     x_res, y_res;
00220     int     pixel_clock;    /* In kHz */
00221     int     hsw;        /* Horizontal synchronization
00222                        pulse width */
00223     int     hfp;        /* Horizontal front porch */
00224     int     hbp;        /* Horizontal back porch */
00225     int     vsw;        /* Vertical synchronization
00226                        pulse width */
00227     int     vfp;        /* Vertical front porch */
00228     int     vbp;        /* Vertical back porch */
00229     int     acb;        /* ac-bias pin frequency */
00230     int     pcd;        /* pixel clock divider.
00231                        Obsolete use pixel_clock instead */
00232 
00233     int     (*init)     (struct lcd_panel *panel,
00234                      struct omapfb_device *fbdev);
00235     void        (*cleanup)  (struct lcd_panel *panel);
00236     int     (*enable)   (struct lcd_panel *panel);
00237     void        (*disable)  (struct lcd_panel *panel);
00238     unsigned long   (*get_caps) (struct lcd_panel *panel);
00239     int     (*set_bklight_level)(struct lcd_panel *panel,
00240                          unsigned int level);
00241     unsigned int    (*get_bklight_level)(struct lcd_panel *panel);
00242     unsigned int    (*get_bklight_max)  (struct lcd_panel *panel);
00243     int     (*run_test) (struct lcd_panel *panel, int test_num);
00244 };
00245 
00246 struct extif_timings {
00247     int cs_on_time;
00248     int cs_off_time;
00249     int we_on_time;
00250     int we_off_time;
00251     int re_on_time;
00252     int re_off_time;
00253     int we_cycle_time;
00254     int re_cycle_time;
00255     int cs_pulse_width;
00256     int access_time;
00257 
00258     int clk_div;
00259 
00260     u32 tim[5];     /* set by extif->convert_timings */
00261 
00262     int converted;
00263 };
00264 
00265 struct lcd_ctrl_extif {
00266     int  (*init)        (struct omapfb_device *fbdev);
00267     void (*cleanup)     (void);
00268     void (*get_clk_info)    (u32 *clk_period, u32 *max_clk_div);
00269     unsigned long (*get_max_tx_rate)(void);
00270     int  (*convert_timings) (struct extif_timings *timings);
00271     void (*set_timings) (const struct extif_timings *timings);
00272     void (*set_bits_per_cycle)(int bpc);
00273     void (*write_command)   (const void *buf, unsigned int len);
00274     void (*read_data)   (void *buf, unsigned int len);
00275     void (*write_data)  (const void *buf, unsigned int len);
00276     void (*transfer_area)   (int width, int height,
00277                  void (callback)(void * data), void *data);
00278     int  (*setup_tearsync)  (unsigned pin_cnt,
00279                  unsigned hs_pulse_time, unsigned vs_pulse_time,
00280                  int hs_pol_inv, int vs_pol_inv, int div);
00281     int  (*enable_tearsync) (int enable, unsigned line);
00282 
00283     unsigned long       max_transmit_size;
00284 };
00285 
00286 struct omapfb_notifier_block {
00287     struct notifier_block   nb;
00288     void            *data;
00289     int         plane_idx;
00290 };
00291 
00292 typedef int (*omapfb_notifier_callback_t)(struct notifier_block *,
00293                       unsigned long event,
00294                       void *fbi);
00295 
00296 struct omapfb_mem_region {
00297     u32     paddr;
00298     void __iomem    *vaddr;
00299     unsigned long   size;
00300     u8      type;       /* OMAPFB_PLANE_MEM_* */
00301     enum omapfb_color_format format;/* OMAPFB_COLOR_* */
00302     unsigned    format_used:1;  /* Must be set when format is set.
00303                      * Needed b/c of the badly chosen 0
00304                      * base for OMAPFB_COLOR_* values
00305                      */
00306     unsigned    alloc:1;    /* allocated by the driver */
00307     unsigned    map:1;      /* kernel mapped by the driver */
00308 };
00309 
00310 struct omapfb_mem_desc {
00311     int             region_cnt;
00312     struct omapfb_mem_region    region[OMAPFB_PLANE_NUM];
00313 };
00314 
00315 struct lcd_ctrl {
00316     const char  *name;
00317     void        *data;
00318 
00319     int     (*init)       (struct omapfb_device *fbdev,
00320                        int ext_mode,
00321                        struct omapfb_mem_desc *req_md);
00322     void        (*cleanup)    (void);
00323     void        (*bind_client)    (struct omapfb_notifier_block *nb);
00324     void        (*get_caps)   (int plane, struct omapfb_caps *caps);
00325     int     (*set_update_mode)(enum omapfb_update_mode mode);
00326     enum omapfb_update_mode (*get_update_mode)(void);
00327     int     (*setup_plane)    (int plane, int channel_out,
00328                        unsigned long offset,
00329                        int screen_width,
00330                        int pos_x, int pos_y, int width,
00331                        int height, int color_mode);
00332     int     (*set_rotate)     (int angle);
00333     int     (*setup_mem)      (int plane, size_t size,
00334                        int mem_type, unsigned long *paddr);
00335     int     (*mmap)       (struct fb_info *info,
00336                        struct vm_area_struct *vma);
00337     int     (*set_scale)      (int plane,
00338                        int orig_width, int orig_height,
00339                        int out_width, int out_height);
00340     int     (*enable_plane)   (int plane, int enable);
00341     int     (*update_window)  (struct fb_info *fbi,
00342                        struct omapfb_update_window *win,
00343                        void (*callback)(void *),
00344                        void *callback_data);
00345     void        (*sync)       (void);
00346     void        (*suspend)    (void);
00347     void        (*resume)     (void);
00348     int     (*run_test)   (int test_num);
00349     int     (*setcolreg)      (u_int regno, u16 red, u16 green,
00350                        u16 blue, u16 transp,
00351                        int update_hw_mem);
00352     int     (*set_color_key)  (struct omapfb_color_key *ck);
00353     int     (*get_color_key)  (struct omapfb_color_key *ck);
00354 };
00355 
00356 enum omapfb_state {
00357     OMAPFB_DISABLED = 0,
00358     OMAPFB_SUSPENDED= 99,
00359     OMAPFB_ACTIVE   = 100
00360 };
00361 
00362 struct omapfb_plane_struct {
00363     int             idx;
00364     struct omapfb_plane_info    info;
00365     enum omapfb_color_format    color_mode;
00366     struct omapfb_device        *fbdev;
00367 };
00368 
00369 struct omapfb_device {
00370     int         state;
00371     int                     ext_lcdc;               /* Using external
00372                                                            LCD controller */
00373     struct mutex        rqueue_mutex;
00374 
00375     int         palette_size;
00376     u32         pseudo_palette[17];
00377 
00378     struct lcd_panel    *panel;         /* LCD panel */
00379     const struct lcd_ctrl   *ctrl;          /* LCD controller */
00380     const struct lcd_ctrl   *int_ctrl;      /* internal LCD ctrl */
00381     struct lcd_ctrl_extif   *ext_if;        /* LCD ctrl external
00382                                interface */
00383     struct device       *dev;
00384     struct fb_var_screeninfo    new_var;    /* for mode changes */
00385 
00386     struct omapfb_mem_desc      mem_desc;
00387     struct fb_info          *fb_info[OMAPFB_PLANE_NUM];
00388 };
00389 
00390 struct omapfb_platform_data {
00391     struct omap_lcd_config      lcd;
00392     struct omapfb_mem_desc      mem_desc;
00393     void                *ctrl_platform_data;
00394 };
00395 
00396 #ifdef CONFIG_ARCH_OMAP1
00397 extern struct lcd_ctrl omap1_lcd_ctrl;
00398 #else
00399 extern struct lcd_ctrl omap2_disp_ctrl;
00400 #endif
00401 
00402 extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
00403 
00404 extern void omapfb_reserve_sdram(void);
00405 extern void omapfb_register_panel(struct lcd_panel *panel);
00406 extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval);
00407 extern void omapfb_notify_clients(struct omapfb_device *fbdev,
00408                   unsigned long event);
00409 extern int  omapfb_register_client(struct omapfb_notifier_block *nb,
00410                    omapfb_notifier_callback_t callback,
00411                    void *callback_data);
00412 extern int  omapfb_unregister_client(struct omapfb_notifier_block *nb);
00413 extern int  omapfb_update_window_async(struct fb_info *fbi,
00414                        struct omapfb_update_window *win,
00415                        void (*callback)(void *),
00416                        void *callback_data);
00417 
00418 /* in arch/arm/plat-omap/fb.c */
00419 extern void omapfb_set_ctrl_platform_data(void *pdata);
00420 
00421 #endif /* __KERNEL__ */
00422 
00423 #endif /* __OMAPFB_H */

Generated by doxygen