adf_fbdev.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * Copyright (C) 2013 Google, Inc.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. */
  14. #ifndef _VIDEO_ADF_FBDEV_H_
  15. #define _VIDEO_ADF_FBDEV_H_
  16. #include <linux/fb.h>
  17. #include <linux/mutex.h>
  18. #include <video/adf.h>
  19. struct adf_fbdev {
  20. struct adf_interface *intf;
  21. struct adf_overlay_engine *eng;
  22. struct fb_info *info;
  23. u32 pseudo_palette[16];
  24. unsigned int refcount;
  25. struct mutex refcount_lock;
  26. struct dma_buf *dma_buf;
  27. u32 offset;
  28. u32 pitch;
  29. void *vaddr;
  30. u32 format;
  31. u16 default_xres_virtual;
  32. u16 default_yres_virtual;
  33. u32 default_format;
  34. };
  35. #if IS_ENABLED(CONFIG_ADF_FBDEV)
  36. void adf_modeinfo_to_fb_videomode(const struct drm_mode_modeinfo *mode,
  37. struct fb_videomode *vmode);
  38. void adf_modeinfo_from_fb_videomode(const struct fb_videomode *vmode,
  39. struct drm_mode_modeinfo *mode);
  40. int adf_fbdev_init(struct adf_fbdev *fbdev, struct adf_interface *interface,
  41. struct adf_overlay_engine *eng,
  42. u16 xres_virtual, u16 yres_virtual, u32 format,
  43. struct fb_ops *fbops, const char *fmt, ...);
  44. void adf_fbdev_destroy(struct adf_fbdev *fbdev);
  45. int adf_fbdev_open(struct fb_info *info, int user);
  46. int adf_fbdev_release(struct fb_info *info, int user);
  47. int adf_fbdev_check_var(struct fb_var_screeninfo *var, struct fb_info *info);
  48. int adf_fbdev_set_par(struct fb_info *info);
  49. int adf_fbdev_blank(int blank, struct fb_info *info);
  50. int adf_fbdev_pan_display(struct fb_var_screeninfo *var, struct fb_info *info);
  51. int adf_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma);
  52. #else
  53. static inline void adf_modeinfo_to_fb_videomode(const struct drm_mode_modeinfo *mode,
  54. struct fb_videomode *vmode)
  55. {
  56. WARN_ONCE(1, "%s: CONFIG_ADF_FBDEV is disabled\n", __func__);
  57. }
  58. static inline void adf_modeinfo_from_fb_videomode(const struct fb_videomode *vmode,
  59. struct drm_mode_modeinfo *mode)
  60. {
  61. WARN_ONCE(1, "%s: CONFIG_ADF_FBDEV is disabled\n", __func__);
  62. }
  63. static inline int adf_fbdev_init(struct adf_fbdev *fbdev,
  64. struct adf_interface *interface,
  65. struct adf_overlay_engine *eng,
  66. u16 xres_virtual, u16 yres_virtual, u32 format,
  67. struct fb_ops *fbops, const char *fmt, ...)
  68. {
  69. return -ENODEV;
  70. }
  71. static inline void adf_fbdev_destroy(struct adf_fbdev *fbdev) { }
  72. static inline int adf_fbdev_open(struct fb_info *info, int user)
  73. {
  74. return -ENODEV;
  75. }
  76. static inline int adf_fbdev_release(struct fb_info *info, int user)
  77. {
  78. return -ENODEV;
  79. }
  80. static inline int adf_fbdev_check_var(struct fb_var_screeninfo *var,
  81. struct fb_info *info)
  82. {
  83. return -ENODEV;
  84. }
  85. static inline int adf_fbdev_set_par(struct fb_info *info)
  86. {
  87. return -ENODEV;
  88. }
  89. static inline int adf_fbdev_blank(int blank, struct fb_info *info)
  90. {
  91. return -ENODEV;
  92. }
  93. static inline int adf_fbdev_pan_display(struct fb_var_screeninfo *var,
  94. struct fb_info *info)
  95. {
  96. return -ENODEV;
  97. }
  98. static inline int adf_fbdev_mmap(struct fb_info *info,
  99. struct vm_area_struct *vma)
  100. {
  101. return -ENODEV;
  102. }
  103. #endif
  104. #endif /* _VIDEO_ADF_FBDEV_H_ */