PageRenderTime 56ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/media/platform/msm/dvb/video/mpq_dvb_video_internal.h

https://gitlab.com/SpasilliumNexus/frankenclark_kernel
C Header | 233 lines | 183 code | 38 blank | 12 comment | 2 complexity | 7be3a13a6e5a735d5665e477dd780431 MD5 | raw file
  1. /* Copyright (c) 2010, 2012-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef MPQ_DVB_VIDEO_INTERNAL_H
  14. #define MPQ_DVB_VIDEO_INTERNAL_H
  15. #define MPQ_DBG_INFO "mpq_video:%d "
  16. #define MPQ_VID_DEC_NAME "mpq_vidc_dec"
  17. #define TRICKMODE_SUPPORT
  18. extern int mpq_debug;
  19. enum {
  20. MPQ_ERR = 0x001,
  21. MPQ_WRN = 0x002,
  22. MPQ_INF = 0x004,
  23. MPQ_DBG = 0x008
  24. };
  25. #define dprintk(dbg_mask, fmt, arg...) \
  26. do { \
  27. if (mpq_debug & dbg_mask) { \
  28. printk(MPQ_DBG_INFO fmt, dbg_mask, ## arg); \
  29. } \
  30. } while (0)
  31. #define DBG(x...) dprintk(MPQ_DBG, ## x)
  32. #define INF(x...) dprintk(MPQ_INF, ## x)
  33. #define WRN(x...) dprintk(MPQ_WRN, ## x)
  34. #define ERR(x...) dprintk(MPQ_ERR, ## x)
  35. #define DVB_MPQ_NUM_VIDEO_DEVICES 4
  36. #define SAFE_GAP 16
  37. #define MAX_NUM_BUFS 32
  38. #define MPQ_DVB_INPUT_BUF_COUNT_BIT 0x00000001
  39. #define MPQ_DVB_INPUT_BUF_REQ_BIT 0x00000002
  40. #define MPQ_DVB_INPUT_BUF_SETUP_BIT 0x00000004
  41. #define MPQ_DVB_OUTPUT_BUF_COUNT_BIT 0x00000008
  42. #define MPQ_DVB_OUTPUT_BUF_REQ_BIT 0x00000010
  43. #define MPQ_DVB_OUTPUT_BUF_SETUP_BIT 0x00000020
  44. #define MPQ_DVB_INPUT_STREAMON_BIT 0x00000040
  45. #define MPQ_DVB_OUTPUT_STREAMON_BIT 0x00000080
  46. #define MPQ_DVB_EVENT_FLUSH_DONE_BIT 0x00000100
  47. #define MPQ_DVB_INPUT_FLUSH_IN_PROGRESS_BIT 0x00000200
  48. #define MPQ_DVB_OUTPUT_FLUSH_IN_PROGRESS_BIT 0x00000400
  49. #define DEFAULT_INPUT_BUF_SIZE (1024*1024)
  50. #define DEFAULT_INPUT_BUF_NUM 16
  51. #define MPQ_VID_DEC_NAME "mpq_vidc_dec"
  52. #define EXTRADATA_HANDLING
  53. #define EXTRADATA_IDX(__num_planes) (__num_planes - 1)
  54. enum {
  55. OUTPUT_PORT = 0,
  56. CAPTURE_PORT,
  57. MAX_PORTS
  58. };
  59. enum {
  60. INPUT_MODE_LINEAR,
  61. INPUT_MODE_RING
  62. };
  63. enum {
  64. MPQ_INPUT_BUFFER_FREE,
  65. MPQ_INPUT_BUFFER_IN_USE
  66. };
  67. enum {
  68. MPQ_MSG_OUTPUT_BUFFER_DONE,
  69. MPQ_MSG_VIDC_EVENT
  70. };
  71. enum {
  72. MPQ_STATE_INIT,
  73. MPQ_STATE_READY,
  74. MPQ_STATE_RUNNING,
  75. MPQ_STATE_IDLE,
  76. MPQ_STATE_STOPPED
  77. };
  78. struct mpq_inq_msg {
  79. struct list_head list;
  80. u32 buf_index;
  81. };
  82. struct mpq_outq_msg {
  83. struct list_head list;
  84. u32 type;
  85. struct video_event vidc_event;
  86. };
  87. struct mpq_msg_q_msg {
  88. struct list_head list;
  89. u32 msg_type;
  90. };
  91. struct mpq_pkt_msg {
  92. struct list_head list;
  93. int ion_fd;
  94. u32 offset;
  95. u32 len;
  96. u64 pts;
  97. };
  98. struct mpq_extradata {
  99. int index;
  100. u32 uaddr;
  101. u32 length;
  102. u32 bytesused;
  103. int ion_fd;
  104. int fd_offset;
  105. };
  106. struct buffer_info {
  107. int index;
  108. int state;
  109. enum v4l2_buf_type buf_type;
  110. u32 size;
  111. u32 offset;
  112. u32 bytesused;
  113. u32 vaddr;
  114. int fd;
  115. u32 dev_addr;
  116. u32 kernel_vaddr;
  117. u32 buf_offset;
  118. u64 pts;
  119. struct msm_smem *handle;
  120. struct mpq_extradata extradata;
  121. };
  122. struct mpq_ring_buffer {
  123. struct buffer_info buf;
  124. size_t len;
  125. size_t write_idx;
  126. size_t read_idx;
  127. size_t release_idx;
  128. u32 flush_buffer;
  129. wait_queue_head_t write_wait;
  130. wait_queue_head_t read_wait;
  131. struct semaphore sem;
  132. };
  133. struct v4l2_instance {
  134. struct msm_vidc_instance *vidc_inst;
  135. void *mem_client;
  136. struct mutex lock;
  137. struct list_head msg_queue;
  138. struct semaphore msg_sem;
  139. wait_queue_head_t msg_wait;
  140. struct list_head inq;
  141. struct semaphore inq_sem;
  142. wait_queue_head_t inq_wait;
  143. struct list_head outq;
  144. struct semaphore outq_sem;
  145. wait_queue_head_t outq_wait;
  146. int video_codec;
  147. struct v4l2_requestbuffers bufreq[MAX_PORTS];
  148. struct v4l2_format fmt[MAX_PORTS];
  149. struct buffer_info buf_info[MAX_PORTS][MAX_NUM_BUFS];
  150. u32 input_mode;
  151. struct mpq_ring_buffer *ringbuf;
  152. u32 num_input_buffers;
  153. u32 input_buf_count;
  154. u32 num_output_buffers;
  155. u32 output_buf_count;
  156. u32 flag;
  157. u32 state;
  158. u32 vidc_etb;
  159. u32 vidc_ebd;
  160. u32 vidc_ftb;
  161. u32 vidc_fbd;
  162. struct mutex flush_lock;
  163. struct msm_smem *extradata_handle;
  164. u32 extradata_types;
  165. u32 extradata_size;
  166. struct extradata_buffer extradata;
  167. int playback_mode;
  168. };
  169. struct mpq_dmx_source {
  170. struct mpq_streambuffer *stream_buffer;
  171. wait_queue_head_t dmx_wait;
  172. int device_id;
  173. struct video_data_buffer dmx_video_buf;
  174. struct list_head pkt_queue;
  175. struct semaphore pkt_sem;
  176. wait_queue_head_t pkt_wait;
  177. };
  178. struct mpq_dvb_video_instance {
  179. struct dvb_device *video_dev;
  180. video_stream_source_t source;
  181. struct mpq_dmx_source *dmx_src_data;
  182. struct v4l2_instance *v4l2_inst;
  183. struct task_struct *input_task;
  184. struct task_struct *event_task;
  185. struct task_struct *demux_task;
  186. };
  187. struct mpq_dvb_video_device {
  188. s32 device_handle;
  189. u32 num_clients;
  190. struct mutex lock;
  191. struct dvb_adapter *mpq_adapter;
  192. struct mpq_dvb_video_instance dev_inst[DVB_MPQ_NUM_VIDEO_DEVICES];
  193. struct ion_client *ion_clnt;
  194. };
  195. #endif /* MPQ_DVB_VIDEO_INTERNAL_H */