dpi_drv.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2010. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. *
  31. * The following software/firmware and/or related documentation ("MediaTek Software")
  32. * have been modified by MediaTek Inc. All revisions are subject to any receiver's
  33. * applicable license agreements with MediaTek Inc.
  34. */
  35. /*****************************************************************************
  36. * Copyright Statement:
  37. * --------------------
  38. * This software is protected by Copyright and the information contained
  39. * herein is confidential. The software may not be copied and the information
  40. * contained herein may not be used or disclosed except with the written
  41. * permission of MediaTek Inc. (C) 2008
  42. *
  43. * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  44. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  45. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  46. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  47. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  48. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  49. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  50. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  51. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  52. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  53. * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  54. * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  55. *
  56. * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  57. * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  58. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  59. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  60. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  61. *
  62. * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  63. * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  64. * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  65. * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  66. * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  67. *
  68. *****************************************************************************/
  69. #ifndef __DPI_DRV_H__
  70. #define __DPI_DRV_H__
  71. #include "disp_drv.h"
  72. #include "lcm_drv.h"
  73. #ifdef __cplusplus
  74. extern "C" {
  75. #endif
  76. // ---------------------------------------------------------------------------
  77. #define DPI_CHECK_RET(expr) \
  78. do { \
  79. DPI_STATUS ret = (expr); \
  80. ASSERT(DPI_STATUS_OK == ret); \
  81. } while (0)
  82. // ---------------------------------------------------------------------------
  83. typedef enum {
  84. DPI_STATUS_OK = 0,
  85. DPI_STATUS_ERROR,
  86. } DPI_STATUS;
  87. typedef enum {
  88. DPI_FB_FORMAT_RGB565 = 0,
  89. DPI_FB_FORMAT_RGB888 = 1,
  90. DPI_FB_FORMAT_XRGB888 = 1,
  91. DPI_FB_FORMAT_RGBX888 = 1,
  92. DPI_FB_FORMAT_NUM,
  93. } DPI_FB_FORMAT;
  94. typedef enum {
  95. DPI_RGB_ORDER_RGB = 0,
  96. DPI_RGB_ORDER_BGR = 1,
  97. } DPI_RGB_ORDER;
  98. typedef enum {
  99. DPI_FB_0 = 0,
  100. DPI_FB_1 = 1,
  101. DPI_FB_2 = 2,
  102. DPI_FB_NUM,
  103. } DPI_FB_ID;
  104. typedef enum {
  105. DPI_POLARITY_RISING = 0,
  106. DPI_POLARITY_FALLING = 1
  107. } DPI_POLARITY;
  108. // ---------------------------------------------------------------------------
  109. DPI_STATUS DPI_Init(BOOL isDpiPoweredOn);
  110. DPI_STATUS DPI_Deinit(void);
  111. DPI_STATUS DPI_Init_PLL(unsigned int mipi_pll_clk_ref,unsigned int mipi_pll_clk_div1,unsigned int mipi_pll_clk_div2);
  112. DPI_STATUS DPI_Set_DrivingCurrent(LCM_PARAMS *lcm_params);
  113. DPI_STATUS DPI_PowerOn(void);
  114. DPI_STATUS DPI_PowerOff(void);
  115. DPI_STATUS DPI_EnableClk(void);
  116. DPI_STATUS DPI_DisableClk(void);
  117. DPI_STATUS DPI_EnableSeqOutput(BOOL enable);
  118. DPI_STATUS DPI_SetRGBOrder(DPI_RGB_ORDER input, DPI_RGB_ORDER output);
  119. DPI_STATUS DPI_ConfigPixelClk(DPI_POLARITY polarity, UINT32 divisor, UINT32 duty);
  120. DPI_STATUS DPI_ConfigDataEnable(DPI_POLARITY polarity);
  121. DPI_STATUS DPI_ConfigVsync(DPI_POLARITY polarity,
  122. UINT32 pulseWidth, UINT32 backPorch, UINT32 frontPorch);
  123. DPI_STATUS DPI_ConfigHsync(DPI_POLARITY polarity,
  124. UINT32 pulseWidth, UINT32 backPorch, UINT32 frontPorch);
  125. DPI_STATUS DPI_FBSyncFlipWithLCD(BOOL enable);
  126. DPI_STATUS DPI_SetDSIMode(BOOL enable);
  127. BOOL DPI_IsDSIMode(void);
  128. DPI_STATUS DPI_FBSetFormat(DPI_FB_FORMAT format);
  129. DPI_FB_FORMAT DPI_FBGetFormat(void);
  130. DPI_STATUS DPI_FBSetSize(UINT32 width, UINT32 height);
  131. DPI_STATUS DPI_FBEnable(DPI_FB_ID id, BOOL enable);
  132. DPI_STATUS DPI_FBSetAddress(DPI_FB_ID id, UINT32 address);
  133. DPI_STATUS DPI_FBSetPitch(DPI_FB_ID id, UINT32 pitchInByte);
  134. DPI_STATUS DPI_SetFifoThreshold(UINT32 low, UINT32 high);
  135. // Debug
  136. DPI_STATUS DPI_DumpRegisters(void);
  137. DPI_STATUS DPI_Capture_Framebuffer(unsigned int pvbuf, unsigned int bpp);
  138. //FM De-sense
  139. DPI_STATUS DPI_FMDesense_Query(void);
  140. DPI_STATUS DPI_FM_Desense(unsigned long freq);
  141. DPI_STATUS DPI_Get_Default_CLK(unsigned int *clk);
  142. DPI_STATUS DPI_Get_Current_CLK(unsigned int *clk);
  143. DPI_STATUS DPI_Change_CLK(unsigned int clk);
  144. DPI_STATUS DPI_Reset_CLK(void);
  145. void DPI_mipi_switch(BOOL on);
  146. void DPI_DisableIrq(void);
  147. void DPI_EnableIrq(void);
  148. DPI_STATUS DPI_FreeIRQ(void);
  149. DPI_STATUS DPI_EnableInterrupt(DISP_INTERRUPT_EVENTS eventID);
  150. DPI_STATUS DPI_SetInterruptCallback(void (*pCB)(DISP_INTERRUPT_EVENTS eventID));
  151. void DPI_WaitVSYNC(void);
  152. void DPI_InitVSYNC(unsigned int vsync_interval);
  153. void DPI_PauseVSYNC(BOOL enable);
  154. DPI_STATUS DPI_ConfigLVDS(LCM_PARAMS *lcm_params);
  155. DPI_STATUS DPI_WaitVsync(void);
  156. // ---------------------------------------------------------------------------
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160. #endif // __DPI_DRV_H__