L一

mx51 LCD driver 分析

以下为要用到的结构体

struct mxcfb_data {
        struct fb_info *fbi;
        struct fb_info *fbi_ovl;
        volatile int32_t vsync_flag;
        wait_queue_head_t vsync_wq;
        wait_queue_head_t suspend_wq;
        bool suspended;
        int backlight_level;
};

static struct mxcfb_data mxcfb_drv_data;

     58 struct mxcfb_info {
     59         int blank;
     60         ipu_channel_t ipu_ch;
     61         uint32_t ipu_ch_irq;
     62         uint32_t cur_ipu_buf;
     63
     64         u32 pseudo_palette[16];
     65
     66         struct semaphore flip_sem;
     67         spinlock_t fb_lock;
     68 };

 

struct fb_bitfield {
        __u32 offset;                   /* beginning of bitfield        */
        __u32 length;                   /* length of bitfield           */
        __u32 msb_right;                /* != 0 : Most significant bit is */
                                        /* right */
};

struct fb_var_screeninfo {
        __u32 xres;                     /* visible resolution           */
        __u32 yres;
        __u32 xres_virtual;             /* virtual resolution           */
        __u32 yres_virtual;
        __u32 xoffset;                  /* offset from virtual to visible */
        __u32 yoffset;                  /* resolution                   */

        __u32 bits_per_pixel;           /* guess what                   */
        __u32 grayscale;                /* != 0 Graylevels instead of colors */

        struct fb_bitfield red;         /* bitfield in fb mem if true color, */
        struct fb_bitfield green;       /* else only length is significant */
        struct fb_bitfield blue;
        struct fb_bitfield transp;      /* transparency                 */

        __u32 nonstd;                   /* != 0 Non standard pixel format */

        __u32 activate;                 /* see FB_ACTIVATE_*            */

        __u32 height;                   /* height of picture in mm    */

 

       __u32 width;                    /* width of picture in mm     */

        __u32 accel_flags;              /* (OBSOLETE) see fb_info.flags */

        /* Timing: All values in pixclocks, except pixclock (of course) */
        __u32 pixclock;                 /* pixel clock in ps (pico seconds) */
        __u32 left_margin;              /* time from sync to picture    */
        __u32 right_margin;             /* time from picture to sync    */
        __u32 upper_margin;             /* time from sync to picture    */
        __u32 lower_margin;
        __u32 hsync_len;                /* length of horizontal sync    */
        __u32 vsync_len;                /* length of vertical sync      */
        __u32 sync;                     /* see FB_SYNC_*                */
        __u32 vmode;                    /* see FB_VMODE_*               */
        __u32 rotate;                   /* angle we rotate counter clockwise */
        __u32 reserved[5];              /* Reserved for future compatibility */
};


struct fb_fix_screeninfo {
        char id[16];                    /* identification string eg "TT Builtin" */
        unsigned long smem_start;       /* Start of frame buffer mem */
                                        /* (physical address) */
        __u32 smem_len;                 /* Length of frame buffer mem */
        __u32 type;                     /* see FB_TYPE_*                */
        __u32 type_aux;                 /* Interleave for interleaved Planes */
        __u32 visual;                   /* see FB_VISUAL_*              */
        __u16 xpanstep;                 /* zero if no hardware panning  */
        __u16 ypanstep;                 /* zero if no hardware panning  */
        __u16 ywrapstep;                /* zero if no hardware ywrap    */
        __u32 line_length;              /* length of a line in bytes    */
        unsigned long mmio_start;       /* Start of Memory Mapped I/O   */
                                        /* (physical address) */
        __u32 mmio_len;                 /* Length of Memory Mapped I/O  */
        __u32 accel;                    /* Indicate to driver which     */
                                        /*  specific chip/card we have  */
        __u16 reserved[3];              /* Reserved for future compatibility */
};

 

struct fb_videomode {
        const char *name;       /* optional */
        u32 refresh;            /* optional */
        u32 xres;
        u32 yres;
        u32 pixclock;
        u32 left_margin;
        u32 right_margin;
        u32 upper_margin;
        u32 lower_margin;
        u32 hsync_len;
        u32 vsync_len;
        u32 sync;
        u32 vmode;
        u32 flag;
};

struct fb_chroma {
        __u32 redx;     /* in fraction of 1024 */
        __u32 greenx;
        __u32 bluex;
        __u32 whitex;
        __u32 redy;
        __u32 greeny;
        __u32 bluey;
        __u32 whitey;
};

 

struct fb_monspecs {
        struct fb_chroma chroma;
        struct fb_videomode *modedb;    /* mode database */
        __u8  manufacturer[4];          /* Manufacturer */
        __u8  monitor[14];              /* Monitor String */
        __u8  serial_no[14];            /* Serial Number */
        __u8  ascii[14];                /* ? */
        __u32 modedb_len;               /* mode database length */
        __u32 model;                    /* Monitor Model */
        __u32 serial;                   /* Serial Number - Integer */
        __u32 year;                     /* Year manufactured */
        __u32 week;                     /* Week Manufactured */
        __u32 hfmin;                    /* hfreq lower limit (Hz) */
        __u32 hfmax;                    /* hfreq upper limit (Hz) */
        __u32 dclkmin;                  /* pixelclock lower limit (Hz) */
        __u32 dclkmax;                  /* pixelclock upper limit (Hz) */
        __u16 input;                    /* display type - see FB_DISP_* */
        __u16 dpms;                     /* DPMS support - see FB_DPMS_ */
        __u16 signal;                   /* Signal Type - see FB_SIGNAL_* */
        __u16 vfmin;                    /* vfreq lower limit (Hz) */
        __u16 vfmax;                    /* vfreq upper limit (Hz) */
        __u16 gamma;                    /* Gamma - in fractions of 100 */

        __u16 gtf       : 1;            /* supports GTF */
        __u16 misc;                     /* Misc flags - see FB_MISC_* */
        __u8  version;                  /* EDID version... */
        __u8  revision;                 /* ...and revision */
        __u8  max_x;                    /* Maximum horizontal size (cm) */
        __u8  max_y;                    /* Maximum vertical size (cm) */
};
 
struct fb_pixmap {
        u8  *addr;              /* pointer to memory                    */
        u32 size;               /* size of buffer in bytes              */
        u32 offset;             /* current offset to buffer             */
        u32 buf_align;          /* byte alignment of each bitmap        */
        u32 scan_align;         /* alignment per scanline               */
        u32 access_align;       /* alignment per read/write (bits)      */
        u32 flags;              /* see FB_PIXMAP_*                      */
        u32 blit_x;             /* supported bit block dimensions (1-32)*/
        u32 blit_y;             /* Format: blit_x = 1 << (width - 1)    */
                                /*         blit_y = 1 << (height - 1)   */
                                /* if 0, will be set to 0xffffffff (all)*/
        /* access methods */
        void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size);
        void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);
};

struct fb_cmap {
        __u32 start;                    /* First entry  */
        __u32 len;                      /* Number of entries */
        __u16 *red;                     /* Red values   */
        __u16 *green;
        __u16 *blue;
        __u16 *transp;                  /* transparency, can be NULL */
};
 

struct fb_ops {
        /* open/release and usage marking */
        struct module *owner;
        int (*fb_open)(struct fb_info *info, int user);
        int (*fb_release)(struct fb_info *info, int user);

        /* For framebuffers with strange non linear layouts or that do not
         * work with normal memory mapped access
         */
        ssize_t (*fb_read)(struct fb_info *info, char __user *buf,
                           size_t count, loff_t *ppos);
        ssize_t (*fb_write)(struct fb_info *info, const char __user *buf,
                            size_t count, loff_t *ppos);

        /* checks var and eventually tweaks it to something supported,
         * DO NOT MODIFY PAR */
        int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);

        /* set the video mode according to info->var */
        int (*fb_set_par)(struct fb_info *info);

        /* set color register */
        int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,
                            unsigned blue, unsigned transp, struct fb_info *info);

        /* set color registers in batch */
        int (*fb_setcmap)(struct fb_cmap *cmap, struct fb_info *info);

        /* blank display */
        int (*fb_blank)(int blank, struct fb_info *info);

        /* pan display */
        int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info);

        /* Draws a rectangle */
        void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
        /* Copy data from area to another */

        void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
        /* Draws a image to the display */
        void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);

        /* Draws cursor */
        int (*fb_cursor) (struct fb_info *info, struct fb_cursor *cursor);

        /* Rotates the display */
        void (*fb_rotate)(struct fb_info *info, int angle);

        /* wait for blit idle, optional */
        int (*fb_sync)(struct fb_info *info);

        /* perform fb specific ioctl (optional) */
        int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
                        unsigned long arg);


        /* Handle 32bit compat ioctl (optional) */
        int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd,
                        unsigned long arg);

        /* perform fb specific mmap */
        int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);

        /* save current hardware state */
        void (*fb_save_state)(struct fb_info *info);

        /* restore saved state */
        void (*fb_restore_state)(struct fb_info *info);

        /* get capability given var */
        void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
                            struct fb_var_screeninfo *var);

        /* teardown any resources to do with this framebuffer */
        void (*fb_destroy)(struct fb_info *info);
};

 

struct fb_info {
        int node;
        int flags;
        struct mutex lock;              /* Lock for open/release/ioctl funcs */
        struct mutex mm_lock;           /* Lock for fb_mmap and smem_* fields */
        struct fb_var_screeninfo var;   /* Current var */
        struct fb_fix_screeninfo fix;   /* Current fix */
        struct fb_monspecs monspecs;    /* Current Monitor specs */
        struct work_struct queue;       /* Framebuffer event queue */
        struct fb_pixmap pixmap;        /* Image hardware mapper */
        struct fb_pixmap sprite;        /* Cursor hardware mapper */
        struct fb_cmap cmap;            /* Current cmap */
        struct list_head modelist;      /* mode list */
        struct fb_videomode *mode;      /* current mode */

#ifdef CONFIG_FB_BACKLIGHT
        /* assigned backlight device */
        /* set before framebuffer registration,
           remove after unregister */
        struct backlight_device *bl_dev;

        /* Backlight level curve */

        u8 bl_curve[FB_BACKLIGHT_LEVELS];
#endif
#ifdef CONFIG_FB_DEFERRED_IO
        struct delayed_work deferred_work;
        struct fb_deferred_io *fbdefio;
#endif

        struct fb_ops *fbops;
        struct device *device;          /* This is the parent */
        struct device *dev;             /* This is this fb device */
        int class_flag;                    /* private sysfs flags */
#ifdef CONFIG_FB_TILEBLITTING
        struct fb_tile_ops *tileops;    /* Tile Blitting */
#endif
        char __iomem *screen_base;      /* Virtual address */
        unsigned long screen_size;      /* Amount of ioremapped VRAM or 0 */
        void *pseudo_palette;           /* Fake palette of 16 colors */
#define FBINFO_STATE_RUNNING    0
#define FBINFO_STATE_SUSPENDED  1
        u32 state;                      /* Hardware state i.e suspend */
        void *fbcon_par;                /* fbcon use-only private area */
        /* From here on everything is device dependent */
        void *par;

 /* we need the PCI or similiar aperture base/size not
           smem_start/size as smem_start may just be an object
           allocated inside the aperture so may not actually overlap */
        resource_size_t aperture_base;
        resource_size_t aperture_size;
};
 

 

 

 

你可能感兴趣的:(L一)