mt8193_ctrl.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. #ifndef __mt8193_ctrl_h__
  2. #define __mt8193_ctrl_h__
  3. #ifdef HDMI_MT8193_SUPPORT
  4. #include <linux/interrupt.h>
  5. #include <linux/i2c.h>
  6. #include <linux/slab.h>
  7. #include <linux/irq.h>
  8. #include <linux/miscdevice.h>
  9. #include <asm/uaccess.h>
  10. #include <linux/delay.h>
  11. #include <linux/input.h>
  12. #include <linux/workqueue.h>
  13. #include <linux/kobject.h>
  14. /*#include <linux/earlysuspend.h>*/
  15. #include <linux/platform_device.h>
  16. #include <asm/atomic.h>
  17. #include <linux/init.h>
  18. #include <linux/module.h>
  19. #include <linux/sched.h>
  20. #include <linux/kthread.h>
  21. #include <linux/bitops.h>
  22. #include <linux/kernel.h>
  23. #include <linux/byteorder/generic.h>
  24. #include <linux/interrupt.h>
  25. #include <linux/time.h>
  26. #include <linux/rtpm_prio.h>
  27. #include <linux/dma-mapping.h>
  28. #include <linux/syscalls.h>
  29. #include <linux/reboot.h>
  30. #include <linux/vmalloc.h>
  31. #include <linux/fs.h>
  32. #include <linux/string.h>
  33. #include <linux/completion.h>
  34. #include <linux/types.h>
  35. #include <linux/types.h>
  36. #include "mach/irqs.h"
  37. #include "hdmi_drv.h"
  38. #include "ddp_hal.h"
  39. #include "mt8193hdcp.h"
  40. extern unsigned int mt8193_log_on;
  41. #define hdmiplllog (0x1)
  42. #define hdmidgilog (0x2)
  43. #define hdmitxhotpluglog (0x4)
  44. #define hdmitxvideolog (0x8)
  45. #define hdmitxaudiolog (0x10)
  46. #define hdmihdcplog (0x20)
  47. #define hdmiceclog (0x40)
  48. #define hdmiddclog (0x80)
  49. #define hdmiedidlog (0x100)
  50. #define hdmidrvlog (0x200)
  51. #define hdmideflog (0x400)
  52. #define mt8193hdmialllog (0xffff)
  53. #define hdmi_print pr_debug
  54. #define TRUE true
  55. #define FALSE false
  56. /* ////////////////////////////////////////////PLL////////////////////////////////////////////////////// */
  57. #define MT8193_PLL_LOG(fmt, arg...) \
  58. do {\
  59. if (mt8193_log_on&hdmiplllog) {\
  60. hdmi_print("[hdmi_pll]%s,%d ", __func__, __LINE__);\
  61. hdmi_print(fmt, ##arg); } \
  62. } while (0)
  63. #define MT8193_PLL_FUNC() \
  64. do {\
  65. if (mt8193_log_on&hdmiplllog) {\
  66. hdmi_print("[hdmi_pll] %s\n", __func__); } \
  67. } while (0)
  68. /* ////////////////////////////////////////////DGI////////////////////////////////////////////////////// */
  69. #define MT8193_DGI_LOG(fmt, arg...) \
  70. do {\
  71. if (mt8193_log_on&hdmidgilog) {\
  72. hdmi_print("[hdmi_dgi1]%s,%d ", __func__, __LINE__);\
  73. hdmi_print(fmt, ##arg); } \
  74. } while (0)
  75. #define MT8193_DGI_FUNC() \
  76. do {\
  77. if (mt8193_log_on&hdmidgilog) {\
  78. hdmi_print("[hdmi_dgi1] %s\n", __func__); } \
  79. } while (0)
  80. /* ////////////////////////////////////////////PLUG////////////////////////////////////////////////////// */
  81. #define MT8193_PLUG_LOG(fmt, arg...) \
  82. do {\
  83. if (mt8193_log_on&hdmitxhotpluglog) {\
  84. hdmi_print("[hdmi_plug]%s,%d ", __func__, __LINE__);\
  85. hdmi_print(fmt, ##arg); } \
  86. } while (0)
  87. #define MT8193_PLUG_FUNC() \
  88. do {\
  89. if (mt8193_log_on&hdmitxhotpluglog) {\
  90. hdmi_print("[hdmi_plug] %s\n", __func__); } \
  91. } while (0)
  92. /* //////////////////////////////////////////////VIDEO//////////////////////////////////////////////////// */
  93. #define MT8193_VIDEO_LOG(fmt, arg...) \
  94. do {\
  95. if (mt8193_log_on&hdmitxvideolog) {\
  96. hdmi_print("[hdmi_video]%s,%d ", __func__, __LINE__);\
  97. hdmi_print(fmt, ##arg); } \
  98. } while (0)
  99. #define MT8193_VIDEO_FUNC() \
  100. do {\
  101. if (mt8193_log_on&hdmitxvideolog) {\
  102. hdmi_print("[hdmi_video] %s\n", __func__); } \
  103. } while (0)
  104. /* //////////////////////////////////////////////AUDIO//////////////////////////////////////////////////// */
  105. #define MT8193_AUDIO_LOG(fmt, arg...) \
  106. do {\
  107. if (mt8193_log_on&hdmitxaudiolog) {\
  108. hdmi_print("[hdmi_audio]%s,%d ", __func__, __LINE__);\
  109. hdmi_print(fmt, ##arg); } \
  110. } while (0)
  111. #define MT8193_AUDIO_FUNC() \
  112. do {\
  113. if (mt8193_log_on&hdmitxaudiolog) {\
  114. hdmi_print("[hdmi_audio] %s\n", __func__); } \
  115. } while (0)
  116. /* ///////////////////////////////////////////////HDCP/////////////////////////////////////////////////// */
  117. #define MT8193_HDCP_LOG(fmt, arg...) \
  118. do {\
  119. if (mt8193_log_on&hdmihdcplog) {\
  120. hdmi_print("[hdmi_hdcp]%s,%d ", __func__, __LINE__);\
  121. hdmi_print(fmt, ##arg); } \
  122. } while (0)
  123. #define MT8193_HDCP_FUNC() \
  124. do {\
  125. if (mt8193_log_on&hdmihdcplog) {\
  126. hdmi_print("[hdmi_hdcp] %s\n", __func__); } \
  127. } while (0)
  128. /* ///////////////////////////////////////////////CEC/////////////////////////////////////////////////// */
  129. #define MT8193_CEC_LOG(fmt, arg...) \
  130. do {\
  131. if (mt8193_log_on&hdmiceclog) {\
  132. hdmi_print("[hdmi_cec]%s,%d ", __func__, __LINE__);\
  133. hdmi_print(fmt, ##arg); } \
  134. } while (0)
  135. #define MT8193_CEC_FUNC() \
  136. do {\
  137. if (mt8193_log_on&hdmiceclog) {\
  138. hdmi_print("[hdmi_cec] %s\n", __func__); } \
  139. } while (0)
  140. /* ///////////////////////////////////////////////DDC////////////////////////////////////////////////// */
  141. #define MT8193_DDC_LOG(fmt, arg...) \
  142. do {\
  143. if (mt8193_log_on&hdmiddclog) {\
  144. hdmi_print("[hdmi_ddc]%s,%d ", __func__, __LINE__);\
  145. hdmi_print(fmt, ##arg); } \
  146. } while (0)
  147. #define MT8193_DDC_FUNC() \
  148. do {\
  149. if (mt8193_log_on&hdmiddclog) {\
  150. hdmi_print("[hdmi_ddc] %s\n", __func__); } \
  151. } while (0)
  152. /* ///////////////////////////////////////////////EDID////////////////////////////////////////////////// */
  153. #define MT8193_EDID_LOG(fmt, arg...) \
  154. do {\
  155. if (mt8193_log_on&hdmiedidlog) {\
  156. hdmi_print("[hdmi_edid]%s,%d ", __func__, __LINE__);\
  157. hdmi_print(fmt, ##arg); } \
  158. } while (0)
  159. #define MT8193_EDID_FUNC() \
  160. do {\
  161. if (mt8193_log_on&hdmiedidlog) {\
  162. hdmi_print("[hdmi_edid] %s\n", __func__); } \
  163. } while (0)
  164. /* ////////////////////////////////////////////////DRV///////////////////////////////////////////////// */
  165. #define MT8193_DRV_LOG(fmt, arg...) \
  166. do {\
  167. if (mt8193_log_on&hdmidrvlog) {\
  168. hdmi_print("[hdmi_drv]%s,%d ", __func__, __LINE__);\
  169. hdmi_print(fmt, ##arg); } \
  170. } while (0)
  171. #define MT8193_DRV_FUNC() \
  172. do {\
  173. if (mt8193_log_on&hdmidrvlog) {\
  174. hdmi_print("[hdmi_drv] %s\n", __func__); } \
  175. } while (0)
  176. /* ///////////////////////////////////////////////////////////////////////////////////////////////// */
  177. #define HDMI_DEF_LOG(fmt, arg...) \
  178. do {\
  179. if (mt8193_log_on&hdmideflog) {\
  180. pr_debug(fmt, ##arg); } \
  181. } while (0)
  182. /* ///////////////////////////////////////////////////////////////////////////////////////////////// */
  183. extern int mt8193_i2c_read(unsigned short addr, unsigned int *data);
  184. extern int mt8193_i2c_write(unsigned short addr, unsigned int data);
  185. extern void mt8193_write(unsigned short u2Reg, unsigned int u4Data);
  186. extern void vSetClk(void);
  187. extern unsigned long dispsys_reg[DISP_REG_NUM];
  188. extern HDMI_CTRL_STATE_T e_hdmi_ctrl_state;
  189. extern HDCP_CTRL_STATE_T e_hdcp_ctrl_state;
  190. extern size_t mt8193_TmrValue[MAX_HDMI_TMR_NUMBER];
  191. extern size_t mt8193_hdmiCmd;
  192. #endif
  193. #endif