sbuslib.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* sbuslib.h: SBUS fb helper library interfaces */
  3. #ifndef _SBUSLIB_H
  4. #define _SBUSLIB_H
  5. struct device_node;
  6. struct fb_info;
  7. struct fb_var_screeninfo;
  8. struct vm_area_struct;
  9. struct sbus_mmap_map {
  10. unsigned long voff;
  11. unsigned long poff;
  12. unsigned long size;
  13. };
  14. #define SBUS_MMAP_FBSIZE(n) (-n)
  15. #define SBUS_MMAP_EMPTY 0x80000000
  16. extern void sbusfb_fill_var(struct fb_var_screeninfo *var,
  17. struct device_node *dp, int bpp);
  18. extern int sbusfb_mmap_helper(const struct sbus_mmap_map *map,
  19. unsigned long physbase, unsigned long fbsize,
  20. unsigned long iospace,
  21. struct vm_area_struct *vma);
  22. int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
  23. struct fb_info *info,
  24. int type, int fb_depth, unsigned long fb_size);
  25. int sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd,
  26. unsigned long arg);
  27. /*
  28. * Initialize struct fb_ops for SBUS I/O.
  29. */
  30. #define __FB_DEFAULT_SBUS_OPS_RDWR(__prefix) \
  31. .fb_read = fb_io_read, \
  32. .fb_write = fb_io_write
  33. #define __FB_DEFAULT_SBUS_OPS_DRAW(__prefix) \
  34. .fb_fillrect = cfb_fillrect, \
  35. .fb_copyarea = cfb_copyarea, \
  36. .fb_imageblit = cfb_imageblit
  37. #ifdef CONFIG_COMPAT
  38. #define __FB_DEFAULT_SBUS_OPS_IOCTL(__prefix) \
  39. .fb_ioctl = __prefix ## _sbusfb_ioctl, \
  40. .fb_compat_ioctl = sbusfb_compat_ioctl
  41. #else
  42. #define __FB_DEFAULT_SBUS_OPS_IOCTL(__prefix) \
  43. .fb_ioctl = __prefix ## _sbusfb_ioctl
  44. #endif
  45. #define __FB_DEFAULT_SBUS_OPS_MMAP(__prefix) \
  46. .fb_mmap = __prefix ## _sbusfb_mmap
  47. #define FB_DEFAULT_SBUS_OPS(__prefix) \
  48. __FB_DEFAULT_SBUS_OPS_RDWR(__prefix), \
  49. __FB_DEFAULT_SBUS_OPS_DRAW(__prefix), \
  50. __FB_DEFAULT_SBUS_OPS_IOCTL(__prefix), \
  51. __FB_DEFAULT_SBUS_OPS_MMAP(__prefix)
  52. #endif /* _SBUSLIB_H */