exynos_drm.h 7.5 KB

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