0001
0002 #ifndef _LINUX_FB_H
0003 #define _LINUX_FB_H
0004
0005 #include <linux/refcount.h>
0006 #include <linux/kgdb.h>
0007 #include <uapi/linux/fb.h>
0008
0009 #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor_user)
0010
0011 #include <linux/fs.h>
0012 #include <linux/init.h>
0013 #include <linux/workqueue.h>
0014 #include <linux/notifier.h>
0015 #include <linux/list.h>
0016 #include <linux/backlight.h>
0017 #include <linux/slab.h>
0018 #include <asm/io.h>
0019
0020 struct vm_area_struct;
0021 struct fb_info;
0022 struct device;
0023 struct file;
0024 struct videomode;
0025 struct device_node;
0026
0027
0028 #define FB_DPMS_ACTIVE_OFF 1
0029 #define FB_DPMS_SUSPEND 2
0030 #define FB_DPMS_STANDBY 4
0031
0032 #define FB_DISP_DDI 1
0033 #define FB_DISP_ANA_700_300 2
0034 #define FB_DISP_ANA_714_286 4
0035 #define FB_DISP_ANA_1000_400 8
0036 #define FB_DISP_ANA_700_000 16
0037
0038 #define FB_DISP_MONO 32
0039 #define FB_DISP_RGB 64
0040 #define FB_DISP_MULTI 128
0041 #define FB_DISP_UNKNOWN 256
0042
0043 #define FB_SIGNAL_NONE 0
0044 #define FB_SIGNAL_BLANK_BLANK 1
0045 #define FB_SIGNAL_SEPARATE 2
0046 #define FB_SIGNAL_COMPOSITE 4
0047 #define FB_SIGNAL_SYNC_ON_GREEN 8
0048 #define FB_SIGNAL_SERRATION_ON 16
0049
0050 #define FB_MISC_PRIM_COLOR 1
0051 #define FB_MISC_1ST_DETAIL 2
0052 #define FB_MISC_HDMI 4
0053 struct fb_chroma {
0054 __u32 redx;
0055 __u32 greenx;
0056 __u32 bluex;
0057 __u32 whitex;
0058 __u32 redy;
0059 __u32 greeny;
0060 __u32 bluey;
0061 __u32 whitey;
0062 };
0063
0064 struct fb_monspecs {
0065 struct fb_chroma chroma;
0066 struct fb_videomode *modedb;
0067 __u8 manufacturer[4];
0068 __u8 monitor[14];
0069 __u8 serial_no[14];
0070 __u8 ascii[14];
0071 __u32 modedb_len;
0072 __u32 model;
0073 __u32 serial;
0074 __u32 year;
0075 __u32 week;
0076 __u32 hfmin;
0077 __u32 hfmax;
0078 __u32 dclkmin;
0079 __u32 dclkmax;
0080 __u16 input;
0081 __u16 dpms;
0082 __u16 signal;
0083 __u16 vfmin;
0084 __u16 vfmax;
0085 __u16 gamma;
0086 __u16 gtf : 1;
0087 __u16 misc;
0088 __u8 version;
0089 __u8 revision;
0090 __u8 max_x;
0091 __u8 max_y;
0092 };
0093
0094 struct fb_cmap_user {
0095 __u32 start;
0096 __u32 len;
0097 __u16 __user *red;
0098 __u16 __user *green;
0099 __u16 __user *blue;
0100 __u16 __user *transp;
0101 };
0102
0103 struct fb_image_user {
0104 __u32 dx;
0105 __u32 dy;
0106 __u32 width;
0107 __u32 height;
0108 __u32 fg_color;
0109 __u32 bg_color;
0110 __u8 depth;
0111 const char __user *data;
0112 struct fb_cmap_user cmap;
0113 };
0114
0115 struct fb_cursor_user {
0116 __u16 set;
0117 __u16 enable;
0118 __u16 rop;
0119 const char __user *mask;
0120 struct fbcurpos hot;
0121 struct fb_image_user image;
0122 };
0123
0124
0125
0126
0127
0128
0129 #define FB_EVENT_MODE_CHANGE 0x01
0130
0131 #ifdef CONFIG_GUMSTIX_AM200EPD
0132
0133 #define FB_EVENT_FB_REGISTERED 0x05
0134 #define FB_EVENT_FB_UNREGISTERED 0x06
0135 #endif
0136
0137
0138 #define FB_EVENT_BLANK 0x09
0139
0140 struct fb_event {
0141 struct fb_info *info;
0142 void *data;
0143 };
0144
0145 struct fb_blit_caps {
0146 u32 x;
0147 u32 y;
0148 u32 len;
0149 u32 flags;
0150 };
0151
0152 #ifdef CONFIG_FB_NOTIFY
0153 extern int fb_register_client(struct notifier_block *nb);
0154 extern int fb_unregister_client(struct notifier_block *nb);
0155 extern int fb_notifier_call_chain(unsigned long val, void *v);
0156 #else
0157 static inline int fb_register_client(struct notifier_block *nb)
0158 {
0159 return 0;
0160 };
0161
0162 static inline int fb_unregister_client(struct notifier_block *nb)
0163 {
0164 return 0;
0165 };
0166
0167 static inline int fb_notifier_call_chain(unsigned long val, void *v)
0168 {
0169 return 0;
0170 };
0171 #endif
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181 #define FB_PIXMAP_DEFAULT 1
0182 #define FB_PIXMAP_SYSTEM 2
0183 #define FB_PIXMAP_IO 4
0184 #define FB_PIXMAP_SYNC 256
0185
0186 struct fb_pixmap {
0187 u8 *addr;
0188 u32 size;
0189 u32 offset;
0190 u32 buf_align;
0191 u32 scan_align;
0192 u32 access_align;
0193 u32 flags;
0194 u32 blit_x;
0195 u32 blit_y;
0196
0197
0198
0199 void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size);
0200 void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);
0201 };
0202
0203 #ifdef CONFIG_FB_DEFERRED_IO
0204 struct fb_deferred_io_pageref {
0205 struct page *page;
0206 unsigned long offset;
0207
0208 struct list_head list;
0209 };
0210
0211 struct fb_deferred_io {
0212
0213 unsigned long delay;
0214 bool sort_pagereflist;
0215 struct mutex lock;
0216 struct list_head pagereflist;
0217
0218 void (*first_io)(struct fb_info *info);
0219 void (*deferred_io)(struct fb_info *info, struct list_head *pagelist);
0220 };
0221 #endif
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237 struct fb_ops {
0238
0239 struct module *owner;
0240 int (*fb_open)(struct fb_info *info, int user);
0241 int (*fb_release)(struct fb_info *info, int user);
0242
0243
0244
0245
0246 ssize_t (*fb_read)(struct fb_info *info, char __user *buf,
0247 size_t count, loff_t *ppos);
0248 ssize_t (*fb_write)(struct fb_info *info, const char __user *buf,
0249 size_t count, loff_t *ppos);
0250
0251
0252
0253 int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
0254
0255
0256 int (*fb_set_par)(struct fb_info *info);
0257
0258
0259 int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,
0260 unsigned blue, unsigned transp, struct fb_info *info);
0261
0262
0263 int (*fb_setcmap)(struct fb_cmap *cmap, struct fb_info *info);
0264
0265
0266 int (*fb_blank)(int blank, struct fb_info *info);
0267
0268
0269 int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info);
0270
0271
0272 void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
0273
0274 void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
0275
0276 void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);
0277
0278
0279 int (*fb_cursor) (struct fb_info *info, struct fb_cursor *cursor);
0280
0281
0282 int (*fb_sync)(struct fb_info *info);
0283
0284
0285 int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
0286 unsigned long arg);
0287
0288
0289 int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd,
0290 unsigned long arg);
0291
0292
0293 int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
0294
0295
0296 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
0297 struct fb_var_screeninfo *var);
0298
0299
0300 void (*fb_destroy)(struct fb_info *info);
0301
0302
0303 int (*fb_debug_enter)(struct fb_info *info);
0304 int (*fb_debug_leave)(struct fb_info *info);
0305 };
0306
0307 #ifdef CONFIG_FB_TILEBLITTING
0308 #define FB_TILE_CURSOR_NONE 0
0309 #define FB_TILE_CURSOR_UNDERLINE 1
0310 #define FB_TILE_CURSOR_LOWER_THIRD 2
0311 #define FB_TILE_CURSOR_LOWER_HALF 3
0312 #define FB_TILE_CURSOR_TWO_THIRDS 4
0313 #define FB_TILE_CURSOR_BLOCK 5
0314
0315 struct fb_tilemap {
0316 __u32 width;
0317 __u32 height;
0318 __u32 depth;
0319 __u32 length;
0320 const __u8 *data;
0321
0322 };
0323
0324 struct fb_tilerect {
0325 __u32 sx;
0326 __u32 sy;
0327 __u32 width;
0328 __u32 height;
0329 __u32 index;
0330 __u32 fg;
0331 __u32 bg;
0332 __u32 rop;
0333 };
0334
0335 struct fb_tilearea {
0336 __u32 sx;
0337 __u32 sy;
0338 __u32 dx;
0339 __u32 dy;
0340 __u32 width;
0341 __u32 height;
0342 };
0343
0344 struct fb_tileblit {
0345 __u32 sx;
0346 __u32 sy;
0347 __u32 width;
0348 __u32 height;
0349 __u32 fg;
0350 __u32 bg;
0351 __u32 length;
0352 __u32 *indices;
0353 };
0354
0355 struct fb_tilecursor {
0356 __u32 sx;
0357 __u32 sy;
0358 __u32 mode;
0359 __u32 shape;
0360 __u32 fg;
0361 __u32 bg;
0362 };
0363
0364 struct fb_tile_ops {
0365
0366 void (*fb_settile)(struct fb_info *info, struct fb_tilemap *map);
0367
0368
0369
0370
0371 void (*fb_tilecopy)(struct fb_info *info, struct fb_tilearea *area);
0372
0373 void (*fb_tilefill)(struct fb_info *info, struct fb_tilerect *rect);
0374
0375 void (*fb_tileblit)(struct fb_info *info, struct fb_tileblit *blit);
0376
0377 void (*fb_tilecursor)(struct fb_info *info,
0378 struct fb_tilecursor *cursor);
0379
0380 int (*fb_get_tilemax)(struct fb_info *info);
0381 };
0382 #endif
0383
0384
0385 #define FBINFO_DEFAULT 0
0386 #define FBINFO_HWACCEL_DISABLED 0x0002
0387
0388
0389
0390
0391
0392
0393 #define FBINFO_VIRTFB 0x0004
0394 #define FBINFO_PARTIAL_PAN_OK 0x0040
0395 #define FBINFO_READS_FAST 0x0080
0396
0397
0398
0399
0400
0401
0402
0403 #define FBINFO_HWACCEL_NONE 0x0000
0404 #define FBINFO_HWACCEL_COPYAREA 0x0100
0405 #define FBINFO_HWACCEL_FILLRECT 0x0200
0406 #define FBINFO_HWACCEL_IMAGEBLIT 0x0400
0407 #define FBINFO_HWACCEL_ROTATE 0x0800
0408 #define FBINFO_HWACCEL_XPAN 0x1000
0409 #define FBINFO_HWACCEL_YPAN 0x2000
0410 #define FBINFO_HWACCEL_YWRAP 0x4000
0411
0412 #define FBINFO_MISC_TILEBLITTING 0x20000
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424 #define FBINFO_MISC_ALWAYS_SETPAR 0x40000
0425
0426
0427 #define FBINFO_MISC_FIRMWARE 0x80000
0428
0429
0430
0431 #define FBINFO_FOREIGN_ENDIAN 0x100000
0432
0433
0434
0435
0436
0437 #define FBINFO_BE_MATH 0x100000
0438
0439
0440
0441
0442
0443 #define FBINFO_HIDE_SMEM_START 0x200000
0444
0445
0446 struct fb_info {
0447 refcount_t count;
0448 int node;
0449 int flags;
0450
0451
0452
0453
0454 int fbcon_rotate_hint;
0455 struct mutex lock;
0456 struct mutex mm_lock;
0457 struct fb_var_screeninfo var;
0458 struct fb_fix_screeninfo fix;
0459 struct fb_monspecs monspecs;
0460 struct fb_pixmap pixmap;
0461 struct fb_pixmap sprite;
0462 struct fb_cmap cmap;
0463 struct list_head modelist;
0464 struct fb_videomode *mode;
0465
0466 #if IS_ENABLED(CONFIG_FB_BACKLIGHT)
0467
0468
0469
0470 struct backlight_device *bl_dev;
0471
0472
0473 struct mutex bl_curve_mutex;
0474 u8 bl_curve[FB_BACKLIGHT_LEVELS];
0475 #endif
0476 #ifdef CONFIG_FB_DEFERRED_IO
0477 struct delayed_work deferred_work;
0478 unsigned long npagerefs;
0479 struct fb_deferred_io_pageref *pagerefs;
0480 struct fb_deferred_io *fbdefio;
0481 #endif
0482
0483 const struct fb_ops *fbops;
0484 struct device *device;
0485 struct device *dev;
0486 int class_flag;
0487 #ifdef CONFIG_FB_TILEBLITTING
0488 struct fb_tile_ops *tileops;
0489 #endif
0490 union {
0491 char __iomem *screen_base;
0492 char *screen_buffer;
0493 };
0494 unsigned long screen_size;
0495 void *pseudo_palette;
0496 #define FBINFO_STATE_RUNNING 0
0497 #define FBINFO_STATE_SUSPENDED 1
0498 u32 state;
0499 void *fbcon_par;
0500
0501 void *par;
0502
0503
0504
0505 struct apertures_struct {
0506 unsigned int count;
0507 struct aperture {
0508 resource_size_t base;
0509 resource_size_t size;
0510 } ranges[0];
0511 } *apertures;
0512
0513 bool skip_vt_switch;
0514 };
0515
0516 static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
0517 struct apertures_struct *a;
0518
0519 a = kzalloc(struct_size(a, ranges, max_num), GFP_KERNEL);
0520 if (!a)
0521 return NULL;
0522 a->count = max_num;
0523 return a;
0524 }
0525
0526 #define FBINFO_FLAG_DEFAULT FBINFO_DEFAULT
0527
0528
0529
0530
0531
0532
0533
0534 #define STUPID_ACCELF_TEXT_SHIT
0535
0536
0537 #if defined(__sparc__)
0538
0539
0540
0541
0542
0543
0544 #define fb_readb sbus_readb
0545 #define fb_readw sbus_readw
0546 #define fb_readl sbus_readl
0547 #define fb_readq sbus_readq
0548 #define fb_writeb sbus_writeb
0549 #define fb_writew sbus_writew
0550 #define fb_writel sbus_writel
0551 #define fb_writeq sbus_writeq
0552 #define fb_memset sbus_memset_io
0553 #define fb_memcpy_fromfb sbus_memcpy_fromio
0554 #define fb_memcpy_tofb sbus_memcpy_toio
0555
0556 #elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || \
0557 defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || \
0558 defined(__arm__) || defined(__aarch64__)
0559
0560 #define fb_readb __raw_readb
0561 #define fb_readw __raw_readw
0562 #define fb_readl __raw_readl
0563 #define fb_readq __raw_readq
0564 #define fb_writeb __raw_writeb
0565 #define fb_writew __raw_writew
0566 #define fb_writel __raw_writel
0567 #define fb_writeq __raw_writeq
0568 #define fb_memset memset_io
0569 #define fb_memcpy_fromfb memcpy_fromio
0570 #define fb_memcpy_tofb memcpy_toio
0571
0572 #else
0573
0574 #define fb_readb(addr) (*(volatile u8 *) (addr))
0575 #define fb_readw(addr) (*(volatile u16 *) (addr))
0576 #define fb_readl(addr) (*(volatile u32 *) (addr))
0577 #define fb_readq(addr) (*(volatile u64 *) (addr))
0578 #define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b))
0579 #define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b))
0580 #define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
0581 #define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b))
0582 #define fb_memset memset
0583 #define fb_memcpy_fromfb memcpy
0584 #define fb_memcpy_tofb memcpy
0585
0586 #endif
0587
0588 #define FB_LEFT_POS(p, bpp) (fb_be_math(p) ? (32 - (bpp)) : 0)
0589 #define FB_SHIFT_HIGH(p, val, bits) (fb_be_math(p) ? (val) >> (bits) : \
0590 (val) << (bits))
0591 #define FB_SHIFT_LOW(p, val, bits) (fb_be_math(p) ? (val) << (bits) : \
0592 (val) >> (bits))
0593
0594
0595
0596
0597
0598 extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var);
0599 extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var);
0600 extern int fb_blank(struct fb_info *info, int blank);
0601 extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
0602 extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
0603 extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image);
0604
0605
0606
0607 extern void sys_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
0608 extern void sys_copyarea(struct fb_info *info, const struct fb_copyarea *area);
0609 extern void sys_imageblit(struct fb_info *info, const struct fb_image *image);
0610 extern ssize_t fb_sys_read(struct fb_info *info, char __user *buf,
0611 size_t count, loff_t *ppos);
0612 extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
0613 size_t count, loff_t *ppos);
0614
0615
0616 extern int register_framebuffer(struct fb_info *fb_info);
0617 extern void unregister_framebuffer(struct fb_info *fb_info);
0618 extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
0619 const char *name);
0620 extern int remove_conflicting_framebuffers(struct apertures_struct *a,
0621 const char *name, bool primary);
0622 extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
0623 extern int fb_show_logo(struct fb_info *fb_info, int rotate);
0624 extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
0625 extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx,
0626 u32 height, u32 shift_high, u32 shift_low, u32 mod);
0627 extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height);
0628 extern void fb_set_suspend(struct fb_info *info, int state);
0629 extern int fb_get_color_depth(struct fb_var_screeninfo *var,
0630 struct fb_fix_screeninfo *fix);
0631 extern int fb_get_options(const char *name, char **option);
0632 extern int fb_new_modelist(struct fb_info *info);
0633
0634 extern struct fb_info *registered_fb[FB_MAX];
0635 extern int num_registered_fb;
0636 extern bool fb_center_logo;
0637 extern int fb_logo_count;
0638 extern struct class *fb_class;
0639
0640 #define for_each_registered_fb(i) \
0641 for (i = 0; i < FB_MAX; i++) \
0642 if (!registered_fb[i]) {} else
0643
0644 static inline void lock_fb_info(struct fb_info *info)
0645 {
0646 mutex_lock(&info->lock);
0647 }
0648
0649 static inline void unlock_fb_info(struct fb_info *info)
0650 {
0651 mutex_unlock(&info->lock);
0652 }
0653
0654 static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
0655 u8 *src, u32 s_pitch, u32 height)
0656 {
0657 u32 i, j;
0658
0659 d_pitch -= s_pitch;
0660
0661 for (i = height; i--; ) {
0662
0663 for (j = 0; j < s_pitch; j++)
0664 *dst++ = *src++;
0665 dst += d_pitch;
0666 }
0667 }
0668
0669
0670 int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma);
0671 extern int fb_deferred_io_init(struct fb_info *info);
0672 extern void fb_deferred_io_open(struct fb_info *info,
0673 struct inode *inode,
0674 struct file *file);
0675 extern void fb_deferred_io_cleanup(struct fb_info *info);
0676 extern int fb_deferred_io_fsync(struct file *file, loff_t start,
0677 loff_t end, int datasync);
0678
0679 static inline bool fb_be_math(struct fb_info *info)
0680 {
0681 #ifdef CONFIG_FB_FOREIGN_ENDIAN
0682 #if defined(CONFIG_FB_BOTH_ENDIAN)
0683 return info->flags & FBINFO_BE_MATH;
0684 #elif defined(CONFIG_FB_BIG_ENDIAN)
0685 return true;
0686 #elif defined(CONFIG_FB_LITTLE_ENDIAN)
0687 return false;
0688 #endif
0689 #else
0690 #ifdef __BIG_ENDIAN
0691 return true;
0692 #else
0693 return false;
0694 #endif
0695 #endif
0696 }
0697
0698
0699 extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
0700 extern void framebuffer_release(struct fb_info *info);
0701 extern int fb_init_device(struct fb_info *fb_info);
0702 extern void fb_cleanup_device(struct fb_info *head);
0703 extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
0704
0705
0706 #define FB_MAXTIMINGS 0
0707 #define FB_VSYNCTIMINGS 1
0708 #define FB_HSYNCTIMINGS 2
0709 #define FB_DCLKTIMINGS 3
0710 #define FB_IGNOREMON 0x100
0711
0712 #define FB_MODE_IS_UNKNOWN 0
0713 #define FB_MODE_IS_DETAILED 1
0714 #define FB_MODE_IS_STANDARD 2
0715 #define FB_MODE_IS_VESA 4
0716 #define FB_MODE_IS_CALCULATED 8
0717 #define FB_MODE_IS_FIRST 16
0718 #define FB_MODE_IS_FROM_VAR 32
0719
0720 extern int fbmon_dpms(const struct fb_info *fb_info);
0721 extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var,
0722 struct fb_info *info);
0723 extern int fb_validate_mode(const struct fb_var_screeninfo *var,
0724 struct fb_info *info);
0725 extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
0726 extern const unsigned char *fb_firmware_edid(struct device *device);
0727 extern void fb_edid_to_monspecs(unsigned char *edid,
0728 struct fb_monspecs *specs);
0729 extern void fb_destroy_modedb(struct fb_videomode *modedb);
0730 extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
0731 extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
0732
0733 extern int of_get_fb_videomode(struct device_node *np,
0734 struct fb_videomode *fb,
0735 int index);
0736 extern int fb_videomode_from_videomode(const struct videomode *vm,
0737 struct fb_videomode *fbmode);
0738
0739
0740 #define VESA_MODEDB_SIZE 43
0741 #define DMT_SIZE 0x50
0742
0743 extern void fb_var_to_videomode(struct fb_videomode *mode,
0744 const struct fb_var_screeninfo *var);
0745 extern void fb_videomode_to_var(struct fb_var_screeninfo *var,
0746 const struct fb_videomode *mode);
0747 extern int fb_mode_is_equal(const struct fb_videomode *mode1,
0748 const struct fb_videomode *mode2);
0749 extern int fb_add_videomode(const struct fb_videomode *mode,
0750 struct list_head *head);
0751 extern void fb_delete_videomode(const struct fb_videomode *mode,
0752 struct list_head *head);
0753 extern const struct fb_videomode *fb_match_mode(const struct fb_var_screeninfo *var,
0754 struct list_head *head);
0755 extern const struct fb_videomode *fb_find_best_mode(const struct fb_var_screeninfo *var,
0756 struct list_head *head);
0757 extern const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
0758 struct list_head *head);
0759 extern void fb_destroy_modelist(struct list_head *head);
0760 extern void fb_videomode_to_modelist(const struct fb_videomode *modedb, int num,
0761 struct list_head *head);
0762 extern const struct fb_videomode *fb_find_best_display(const struct fb_monspecs *specs,
0763 struct list_head *head);
0764
0765
0766 extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
0767 extern int fb_alloc_cmap_gfp(struct fb_cmap *cmap, int len, int transp, gfp_t flags);
0768 extern void fb_dealloc_cmap(struct fb_cmap *cmap);
0769 extern int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to);
0770 extern int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to);
0771 extern int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *fb_info);
0772 extern int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *fb_info);
0773 extern const struct fb_cmap *fb_default_cmap(int len);
0774 extern void fb_invert_cmaps(void);
0775
0776 struct fb_videomode {
0777 const char *name;
0778 u32 refresh;
0779 u32 xres;
0780 u32 yres;
0781 u32 pixclock;
0782 u32 left_margin;
0783 u32 right_margin;
0784 u32 upper_margin;
0785 u32 lower_margin;
0786 u32 hsync_len;
0787 u32 vsync_len;
0788 u32 sync;
0789 u32 vmode;
0790 u32 flag;
0791 };
0792
0793 struct dmt_videomode {
0794 u32 dmt_id;
0795 u32 std_2byte_code;
0796 u32 cvt_3byte_code;
0797 const struct fb_videomode *mode;
0798 };
0799
0800 extern const char *fb_mode_option;
0801 extern const struct fb_videomode vesa_modes[];
0802 extern const struct dmt_videomode dmt_modes[];
0803
0804 struct fb_modelist {
0805 struct list_head list;
0806 struct fb_videomode mode;
0807 };
0808
0809 extern int fb_find_mode(struct fb_var_screeninfo *var,
0810 struct fb_info *info, const char *mode_option,
0811 const struct fb_videomode *db,
0812 unsigned int dbsize,
0813 const struct fb_videomode *default_mode,
0814 unsigned int default_bpp);
0815
0816
0817 #define fb_err(fb_info, fmt, ...) \
0818 pr_err("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
0819 #define fb_notice(info, fmt, ...) \
0820 pr_notice("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
0821 #define fb_warn(fb_info, fmt, ...) \
0822 pr_warn("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
0823 #define fb_info(fb_info, fmt, ...) \
0824 pr_info("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
0825 #define fb_dbg(fb_info, fmt, ...) \
0826 pr_debug("fb%d: " fmt, (fb_info)->node, ##__VA_ARGS__)
0827
0828 #endif