exynos_drm.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /* exynos_drm.h
  2. *
  3. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  4. * Authors:
  5. * Inki Dae <inki.dae@samsung.com>
  6. * Joonyoung Shim <jy0922.shim@samsung.com>
  7. * Seung-Woo Kim <sw0312.kim@samsung.com>
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a
  10. * copy of this software and associated documentation files (the "Software"),
  11. * to deal in the Software without restriction, including without limitation
  12. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  13. * and/or sell copies of the Software, and to permit persons to whom the
  14. * Software is furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice (including the next
  17. * paragraph) shall be included in all copies or substantial portions of the
  18. * Software.
  19. *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  23. * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  24. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  25. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  26. * OTHER DEALINGS IN THE SOFTWARE.
  27. */
  28. #ifndef _EXYNOS_DRM_H_
  29. #define _EXYNOS_DRM_H_
  30. #include "drm.h"
  31. /**
  32. * User-desired buffer creation information structure.
  33. *
  34. * @size: user-desired memory allocation size.
  35. * - this size value would be page-aligned internally.
  36. * @flags: user request for setting memory type or cache attributes.
  37. * @handle: returned a handle to created gem object.
  38. * - this handle will be set by gem module of kernel side.
  39. */
  40. struct drm_exynos_gem_create {
  41. uint64_t size;
  42. unsigned int flags;
  43. unsigned int handle;
  44. };
  45. /**
  46. * A structure for getting buffer offset.
  47. *
  48. * @handle: a pointer to gem object created.
  49. * @pad: just padding to be 64-bit aligned.
  50. * @offset: relatived offset value of the memory region allocated.
  51. * - this value should be set by user.
  52. */
  53. struct drm_exynos_gem_map_off {
  54. unsigned int handle;
  55. unsigned int pad;
  56. uint64_t offset;
  57. };
  58. /**
  59. * A structure for mapping buffer.
  60. *
  61. * @handle: a handle to gem object created.
  62. * @pad: just padding to be 64-bit aligned.
  63. * @size: memory size to be mapped.
  64. * @mapped: having user virtual address mmaped.
  65. * - this variable would be filled by exynos gem module
  66. * of kernel side with user virtual address which is allocated
  67. * by do_mmap().
  68. */
  69. struct drm_exynos_gem_mmap {
  70. unsigned int handle;
  71. unsigned int pad;
  72. uint64_t size;
  73. uint64_t mapped;
  74. };
  75. /**
  76. * A structure to gem information.
  77. *
  78. * @handle: a handle to gem object created.
  79. * @flags: flag value including memory type and cache attribute and
  80. * this value would be set by driver.
  81. * @size: size to memory region allocated by gem and this size would
  82. * be set by driver.
  83. */
  84. struct drm_exynos_gem_info {
  85. unsigned int handle;
  86. unsigned int flags;
  87. uint64_t size;
  88. };
  89. /**
  90. * A structure for user connection request of virtual display.
  91. *
  92. * @connection: indicate whether doing connetion or not by user.
  93. * @extensions: if this value is 1 then the vidi driver would need additional
  94. * 128bytes edid data.
  95. * @edid: the edid data pointer from user side.
  96. */
  97. struct drm_exynos_vidi_connection {
  98. unsigned int connection;
  99. unsigned int extensions;
  100. uint64_t edid;
  101. };
  102. /* memory type definitions. */
  103. enum e_drm_exynos_gem_mem_type {
  104. /* Physically Continuous memory and used as default. */
  105. EXYNOS_BO_CONTIG = 0 << 0,
  106. /* Physically Non-Continuous memory. */
  107. EXYNOS_BO_NONCONTIG = 1 << 0,
  108. /* non-cachable mapping and used as default. */
  109. EXYNOS_BO_NONCACHABLE = 0 << 1,
  110. /* cachable mapping. */
  111. EXYNOS_BO_CACHABLE = 1 << 1,
  112. /* write-combine mapping. */
  113. EXYNOS_BO_WC = 1 << 2,
  114. EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |
  115. EXYNOS_BO_WC
  116. };
  117. struct drm_exynos_g2d_get_ver {
  118. __u32 major;
  119. __u32 minor;
  120. };
  121. struct drm_exynos_g2d_cmd {
  122. __u32 offset;
  123. __u32 data;
  124. };
  125. enum drm_exynos_g2d_event_type {
  126. G2D_EVENT_NOT,
  127. G2D_EVENT_NONSTOP,
  128. G2D_EVENT_STOP, /* not yet */
  129. };
  130. struct drm_exynos_g2d_set_cmdlist {
  131. __u64 cmd;
  132. __u64 cmd_gem;
  133. __u32 cmd_nr;
  134. __u32 cmd_gem_nr;
  135. /* for g2d event */
  136. __u64 event_type;
  137. __u64 user_data;
  138. };
  139. struct drm_exynos_g2d_exec {
  140. __u64 async;
  141. };
  142. #define DRM_EXYNOS_GEM_CREATE 0x00
  143. #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
  144. #define DRM_EXYNOS_GEM_MMAP 0x02
  145. /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
  146. #define DRM_EXYNOS_GEM_GET 0x04
  147. #define DRM_EXYNOS_VIDI_CONNECTION 0x07
  148. /* G2D */
  149. #define DRM_EXYNOS_G2D_GET_VER 0x20
  150. #define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
  151. #define DRM_EXYNOS_G2D_EXEC 0x22
  152. #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
  153. DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
  154. #define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
  155. DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
  156. #define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
  157. DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
  158. #define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
  159. DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
  160. #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
  161. DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
  162. #define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
  163. DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
  164. #define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
  165. DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
  166. #define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
  167. DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
  168. /* EXYNOS specific events */
  169. #define DRM_EXYNOS_G2D_EVENT 0x80000000
  170. struct drm_exynos_g2d_event {
  171. struct drm_event base;
  172. __u64 user_data;
  173. __u32 tv_sec;
  174. __u32 tv_usec;
  175. __u32 cmdlist_no;
  176. __u32 reserved;
  177. };
  178. #ifdef __KERNEL__
  179. /**
  180. * A structure for lcd panel information.
  181. *
  182. * @timing: default video mode for initializing
  183. * @width_mm: physical size of lcd width.
  184. * @height_mm: physical size of lcd height.
  185. */
  186. struct exynos_drm_panel_info {
  187. struct fb_videomode timing;
  188. u32 width_mm;
  189. u32 height_mm;
  190. };
  191. /**
  192. * Platform Specific Structure for DRM based FIMD.
  193. *
  194. * @panel: default panel info for initializing
  195. * @default_win: default window layer number to be used for UI.
  196. * @bpp: default bit per pixel.
  197. */
  198. struct exynos_drm_fimd_pdata {
  199. struct exynos_drm_panel_info panel;
  200. u32 vidcon0;
  201. u32 vidcon1;
  202. unsigned int default_win;
  203. unsigned int bpp;
  204. };
  205. /**
  206. * Platform Specific Structure for DRM based HDMI.
  207. *
  208. * @hdmi_dev: device point to specific hdmi driver.
  209. * @mixer_dev: device point to specific mixer driver.
  210. *
  211. * this structure is used for common hdmi driver and each device object
  212. * would be used to access specific device driver(hdmi or mixer driver)
  213. */
  214. struct exynos_drm_common_hdmi_pd {
  215. struct device *hdmi_dev;
  216. struct device *mixer_dev;
  217. };
  218. /**
  219. * Platform Specific Structure for DRM based HDMI core.
  220. *
  221. * @is_v13: set if hdmi version 13 is.
  222. * @cfg_hpd: function pointer to configure hdmi hotplug detection pin
  223. * @get_hpd: function pointer to get value of hdmi hotplug detection pin
  224. */
  225. struct exynos_drm_hdmi_pdata {
  226. bool is_v13;
  227. void (*cfg_hpd)(bool external);
  228. int (*get_hpd)(void);
  229. };
  230. #endif /* __KERNEL__ */
  231. #endif /* _EXYNOS_DRM_H_ */