exynos_drm.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. * @size: memory size to be mapped.
  63. * @mapped: having user virtual address mmaped.
  64. * - this variable would be filled by exynos gem module
  65. * of kernel side with user virtual address which is allocated
  66. * by do_mmap().
  67. */
  68. struct drm_exynos_gem_mmap {
  69. unsigned int handle;
  70. unsigned int size;
  71. uint64_t mapped;
  72. };
  73. /**
  74. * A structure to gem information.
  75. *
  76. * @handle: a handle to gem object created.
  77. * @flags: flag value including memory type and cache attribute and
  78. * this value would be set by driver.
  79. * @size: size to memory region allocated by gem and this size would
  80. * be set by driver.
  81. */
  82. struct drm_exynos_gem_info {
  83. unsigned int handle;
  84. unsigned int flags;
  85. uint64_t size;
  86. };
  87. /**
  88. * A structure for user connection request of virtual display.
  89. *
  90. * @connection: indicate whether doing connetion or not by user.
  91. * @extensions: if this value is 1 then the vidi driver would need additional
  92. * 128bytes edid data.
  93. * @edid: the edid data pointer from user side.
  94. */
  95. struct drm_exynos_vidi_connection {
  96. unsigned int connection;
  97. unsigned int extensions;
  98. uint64_t edid;
  99. };
  100. struct drm_exynos_plane_set_zpos {
  101. __u32 plane_id;
  102. __s32 zpos;
  103. };
  104. /* memory type definitions. */
  105. enum e_drm_exynos_gem_mem_type {
  106. /* Physically Continuous memory and used as default. */
  107. EXYNOS_BO_CONTIG = 0 << 0,
  108. /* Physically Non-Continuous memory. */
  109. EXYNOS_BO_NONCONTIG = 1 << 0,
  110. /* non-cachable mapping and used as default. */
  111. EXYNOS_BO_NONCACHABLE = 0 << 1,
  112. /* cachable mapping. */
  113. EXYNOS_BO_CACHABLE = 1 << 1,
  114. /* write-combine mapping. */
  115. EXYNOS_BO_WC = 1 << 2,
  116. EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |
  117. EXYNOS_BO_WC
  118. };
  119. struct drm_exynos_g2d_get_ver {
  120. __u32 major;
  121. __u32 minor;
  122. };
  123. struct drm_exynos_g2d_cmd {
  124. __u32 offset;
  125. __u32 data;
  126. };
  127. enum drm_exynos_g2d_event_type {
  128. G2D_EVENT_NOT,
  129. G2D_EVENT_NONSTOP,
  130. G2D_EVENT_STOP, /* not yet */
  131. };
  132. struct drm_exynos_g2d_set_cmdlist {
  133. __u64 cmd;
  134. __u64 cmd_gem;
  135. __u32 cmd_nr;
  136. __u32 cmd_gem_nr;
  137. /* for g2d event */
  138. __u64 event_type;
  139. __u64 user_data;
  140. };
  141. struct drm_exynos_g2d_exec {
  142. __u64 async;
  143. };
  144. #define DRM_EXYNOS_GEM_CREATE 0x00
  145. #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
  146. #define DRM_EXYNOS_GEM_MMAP 0x02
  147. /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
  148. #define DRM_EXYNOS_GEM_GET 0x04
  149. #define DRM_EXYNOS_PLANE_SET_ZPOS 0x06
  150. #define DRM_EXYNOS_VIDI_CONNECTION 0x07
  151. /* G2D */
  152. #define DRM_EXYNOS_G2D_GET_VER 0x20
  153. #define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
  154. #define DRM_EXYNOS_G2D_EXEC 0x22
  155. #define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
  156. DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
  157. #define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
  158. DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
  159. #define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
  160. DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
  161. #define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
  162. DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
  163. #define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
  164. DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
  165. #define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
  166. DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
  167. #define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
  168. DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
  169. #define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
  170. DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
  171. #define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
  172. DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
  173. /* EXYNOS specific events */
  174. #define DRM_EXYNOS_G2D_EVENT 0x80000000
  175. struct drm_exynos_g2d_event {
  176. struct drm_event base;
  177. __u64 user_data;
  178. __u32 tv_sec;
  179. __u32 tv_usec;
  180. __u32 cmdlist_no;
  181. __u32 reserved;
  182. };
  183. #ifdef __KERNEL__
  184. /**
  185. * A structure for lcd panel information.
  186. *
  187. * @timing: default video mode for initializing
  188. * @width_mm: physical size of lcd width.
  189. * @height_mm: physical size of lcd height.
  190. */
  191. struct exynos_drm_panel_info {
  192. struct fb_videomode timing;
  193. u32 width_mm;
  194. u32 height_mm;
  195. };
  196. /**
  197. * Platform Specific Structure for DRM based FIMD.
  198. *
  199. * @panel: default panel info for initializing
  200. * @default_win: default window layer number to be used for UI.
  201. * @bpp: default bit per pixel.
  202. */
  203. struct exynos_drm_fimd_pdata {
  204. struct exynos_drm_panel_info panel;
  205. u32 vidcon0;
  206. u32 vidcon1;
  207. unsigned int default_win;
  208. unsigned int bpp;
  209. };
  210. /**
  211. * Platform Specific Structure for DRM based HDMI.
  212. *
  213. * @hdmi_dev: device point to specific hdmi driver.
  214. * @mixer_dev: device point to specific mixer driver.
  215. *
  216. * this structure is used for common hdmi driver and each device object
  217. * would be used to access specific device driver(hdmi or mixer driver)
  218. */
  219. struct exynos_drm_common_hdmi_pd {
  220. struct device *hdmi_dev;
  221. struct device *mixer_dev;
  222. };
  223. /**
  224. * Platform Specific Structure for DRM based HDMI core.
  225. *
  226. * @is_v13: set if hdmi version 13 is.
  227. * @cfg_hpd: function pointer to configure hdmi hotplug detection pin
  228. * @get_hpd: function pointer to get value of hdmi hotplug detection pin
  229. */
  230. struct exynos_drm_hdmi_pdata {
  231. bool is_v13;
  232. void (*cfg_hpd)(bool external);
  233. int (*get_hpd)(void);
  234. };
  235. #endif /* __KERNEL__ */
  236. #endif /* _EXYNOS_DRM_H_ */