xref: /utopia/UTPA2-700.0.x/modules/hdmi/drv/mhl/drvMHL.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ///////////////////////////////////////////////////////////////////////////////////////////////////
79 ///
80 /// @file   Mdrv_mhl.h
81 /// @author MStar Semiconductor Inc.
82 /// @brief  MHL driver Function
83 ///////////////////////////////////////////////////////////////////////////////////////////////////
84 
85 #ifndef _DRV_MHL_H_
86 #define _DRV_MHL_H_
87 
88 #include "MsCommon.h"
89 #include "mdrv_mhl_st.h"
90 
91 //-------------------------------------------------------------------------------------------------
92 //  Macro and Define
93 //-------------------------------------------------------------------------------------------------
94 #ifndef UNUSED
95 #define UNUSED(x) (void)(x)
96 #endif
97 
98 enum MHL_SYSTEM_CONTROL_TYPE
99 {
100     MHL_CABLE_PLUGGED = 0,
101     MHL_CABLE_UNPLUGGED,
102     MHL_INPUT_SOURCE_CHANGE,
103     MHL_CBUS_UNCONNECTION,
104     MHL_CBUS_CONNECTION,
105     MHL_CBUS_NORMAL_24BIT_MODE,
106     MHL_CBUS_PACKET_PIXEL_MODE,
107     MHL_CBUS_AUTO_EQ_SETTING,
108     MHL_CBUS_WAKE_UP_DETECT,
109     MHL_CBUS_TEST_RASING,
110     MHL_CBUS_TEST_FALLING,
111 };
112 
113 enum MHL_CABLE_DETECT_TYPE
114 {
115     MHL_CABLE_DETECT_PORTA_FLAG = 0x01,
116     MHL_CABLE_DETECT_PORTB_FLAG = 0x02,
117     MHL_CABLE_DETECT_PORTC_FLAG = 0x04,
118     MHL_CABLE_DETECT_PORTD_FLAG = 0x08,
119 };
120 
121 enum MHL_ECBUS_STATUS_TYPE
122 {
123     MHL_CBUS_TX_QUEUE_FREEZE_FLAG = BIT(0),
124 };
125 
126 #define MHL_UTOPIA_VERSION_10       1
127 #define MHL_UTOPIA_VERSION_20       2
128 
129 #define MHL_USE_UTOPIA_VERSION      MHL_UTOPIA_VERSION_20
130 
131 //-------------------------------------------------------------------------------------------------
132 //  Type and Structure
133 //-------------------------------------------------------------------------------------------------
134 
135 //-------------------------------------------------------------------------------------------------
136 //  Function Prototype
137 //-------------------------------------------------------------------------------------------------
138 #if(MHL_USE_UTOPIA_VERSION == MHL_UTOPIA_VERSION_10)
139 MS_U32 mdrv_mhl_STREventProc(EN_POWER_MODE usPowerState);
140 void mdrv_mhl_MHLSupportPath(MS_U8 ucSelect);
141 void mdrv_mhl_Initial(MS_U8 *edid, MS_U8 *DevCap);
142 MS_U16 mdrv_mhl_Handler(void);
143 MS_BOOL mdrv_mhl_AutoSwitchHandler(MS_BOOL bReset, MS_U8 *ucCbusPath);
144 MS_U32 mdrv_mhl_SetPowerState(EN_POWER_MODE usPowerState);
145 void mdrv_mhl_CbusControl(MS_U8 ucState);
146 void mdrv_mhl_LoadEDID(MS_U8 *edid);
147 void mdrv_mhl_ReadEDID(MS_U16 usSize, MS_U8 *edid);
148 void mdrv_mhl_LoadDeviceCapability(MS_U8 *devcap);
149 void mdrv_mhl_SetVenderID(MS_U8 ucVenderID);
150 void mdrv_mhl_InvertCableDetect(MS_BOOL bCableDetectInvert);
151 void mdrv_mhl_VbusConfigSetting(MS_U8 ucState);
152 void mdrv_mhl_AdjustSettingIControl(MS_U8 ucIControl);
153 void mdrv_mhl_AdjustImpedanceSetting(MS_U8 ucImpedance);
154 MS_BOOL mdrv_mhl_GetCableDetectFlag(void);
155 MS_BOOL mdrv_mhl_GetCbusConnectFlag(void);
156 MS_BOOL mdrv_mhl_CbusWakeupIntFlag(void);
157 MS_BOOL mdrv_mhl_SrcRCPSupportFlag(void);
158 MS_BOOL mdrv_mhl_SrcRAPSupportFlag(void);
159 MS_BOOL mdrv_mhl_CbusGetStatusFlag(MS_U8 ucState);
160 MS_BOOL mdrv_mhl_SendRAPCommand(MS_U8 ucKeyCode);
161 MS_BOOL mdrv_mhl_SendRCPAutoReleaseCmd(MS_U8 ucKeyCode);
162 MS_BOOL mdrv_mhl_SendUCPCommand(MS_U8 ucKeyCode);
163 MS_BOOL mdrv_mhl_SendWriteBurst(MS_U8 ucAddr, MS_U8 ucLength, MS_U8 *ucData);
164 MS_BOOL mdrv_mhl_CbusSendUserWriteBurst(MS_U8 ucLength, MS_U8 *ucData);
165 MS_BOOL mdrv_mhl_GetDeviceCapability(MS_U16 usDevcapMask, MS_U8 *ucDevcap);
166 MS_BOOL mdrv_mhl_GetExtendDeviceCapability(MS_U16 usExtendDevcapMask, MS_U8 *ucExtendDevcap);
167 MS_BOOL mdrv_mhl_GetDeviceVenderID(MS_U8 *ucVenderID);
168 MS_BOOL mdrv_mhl_GetWriteBurstData(MS_U8 *ucData);
169 void mdrv_mhl_RegisterCallBackFunctions(MS_BOOL bRCPfunctionFlag, MS_BOOL bRAPfunctionFlag);
170 void mdrv_mhl_RegisterRcpCallBackFunction(MS_BOOL bRCPfunctionFlag);
171 void mdrv_mhl_RegisterRapCallBackFunction(MS_BOOL bRAPfunctionFlag);
172 void mdrv_mhl_RegisterUcpCallBackFunction(MS_BOOL bUCPfunctionFlag);
173 void mdrv_mhl_RegisterAttCallBackFunction(MS_BOOL bATTfunctionFlag);
174 void mdrv_mhl_RegisterRbpCallBackFunction(MS_BOOL bRBPfunctionFlag);
175 stMHL_INITIAL_CONFIG_INFO mdrv_mhl_GetConfiguration(void);
176 
177 #elif(MHL_USE_UTOPIA_VERSION == MHL_UTOPIA_VERSION_20)
178 MS_U32 mdrv_mhl_STREventProc(void* pModule, EN_POWER_MODE usPowerState);
179 void mdrv_mhl_MHLSupportPath(void* pInstance, MS_U8 ucSelect);
180 void mdrv_mhl_Initial(void* pInstance, MS_U8 *edid, MS_U8 *DevCap);
181 MS_U16 mdrv_mhl_Handler(void* pInstance);
182 MS_BOOL mdrv_mhl_AutoSwitchHandler(void* pInstance, MS_BOOL bReset, MS_U8 *ucCbusPath);
183 MS_U32 mdrv_mhl_SetPowerState(void* pInstance, EN_POWER_MODE usPowerState);
184 void mdrv_mhl_CbusControl(void* pInstance, MS_U8 ucState);
185 void mdrv_mhl_LoadEDID(void* pInstance, MS_U8 *edid);
186 void mdrv_mhl_ReadEDID(void* pInstance, MS_U16 usSize, MS_U8 *edid);
187 void mdrv_mhl_LoadDeviceCapability(void* pInstance, MS_U8 *devcap);
188 void mdrv_mhl_SetVenderID(void* pInstance, MS_U8 ucVenderID);
189 void mdrv_mhl_InvertCableDetect(void* pInstance, MS_BOOL bCableDetectInvert);
190 void mdrv_mhl_VbusConfigSetting(void* pInstance, MS_U8 ucState);
191 void mdrv_mhl_AdjustSettingIControl(void* pInstance, MS_U8 ucIControl);
192 void mdrv_mhl_AdjustImpedanceSetting(void* pInstance, MS_U8 ucImpedance);
193 MS_BOOL mdrv_mhl_GetCableDetectFlag(void* pInstance);
194 MS_BOOL mdrv_mhl_GetCbusConnectFlag(void* pInstance);
195 MS_BOOL mdrv_mhl_CbusWakeupIntFlag(void* pInstance);
196 MS_BOOL mdrv_mhl_SrcRCPSupportFlag(void* pInstance);
197 MS_BOOL mdrv_mhl_SrcRAPSupportFlag(void* pInstance);
198 MS_BOOL mdrv_mhl_CbusGetStatusFlag(void* pInstance, MS_U8 ucState);
199 MS_BOOL mdrv_mhl_SendRAPCommand(void* pInstance, MS_U8 ucKeyCode);
200 MS_BOOL mdrv_mhl_SendRCPAutoReleaseCmd(void* pInstance, MS_U8 ucKeyCode);
201 MS_BOOL mdrv_mhl_SendUCPCommand(void* pInstance, MS_U8 ucKeyCode);
202 MS_BOOL mdrv_mhl_SendWriteBurst(void* pInstance, MS_U8 ucAddr, MS_U8 ucLength, MS_U8 *ucData);
203 MS_BOOL mdrv_mhl_CbusSendUserWriteBurst(void* pInstance, MS_U8 ucLength, MS_U8 *ucData);
204 MS_BOOL mdrv_mhl_GetDeviceCapability(void* pInstance, MS_U16 usDevcapMask, MS_U8 *ucDevcap);
205 MS_BOOL mdrv_mhl_GetExtendDeviceCapability(void* pInstance, MS_U16 usExtendDevcapMask, MS_U8 *ucExtendDevcap);
206 MS_BOOL mdrv_mhl_GetDeviceVenderID(void* pInstance, MS_U8 *ucVenderID);
207 MS_BOOL mdrv_mhl_GetWriteBurstData(void* pInstance, MS_U8 *ucData);
208 void mdrv_mhl_RegisterCallBackFunctions(void* pInstance, MS_BOOL bRCPfunctionFlag, MS_BOOL bRAPfunctionFlag);
209 void mdrv_mhl_RegisterRcpCallBackFunction(void* pInstance, MS_BOOL bRCPfunctionFlag);
210 void mdrv_mhl_RegisterRapCallBackFunction(void* pInstance, MS_BOOL bRAPfunctionFlag);
211 void mdrv_mhl_RegisterUcpCallBackFunction(void* pInstance, MS_BOOL bUCPfunctionFlag);
212 void mdrv_mhl_RegisterAttCallBackFunction(void* pInstance, MS_BOOL bATTfunctionFlag);
213 void mdrv_mhl_RegisterRbpCallBackFunction(void* pInstance, MS_BOOL bRBPfunctionFlag);
214 stMHL_INITIAL_CONFIG_INFO mdrv_mhl_GetConfiguration(void* pInstance);
215 #ifdef CONFIG_UTOPIA_PROC_DBG_SUPPORT
216 void mdrv_mhl_MDCMDEchoCommand(void* pInstance, MS_U64* u64ReqHdl, char* pcCmdLine);
217 void mdrv_mhl_MDCMDGetInfo(void* pInstance, MS_U64* u64ReqHdl);
218 #endif
219 
220 #endif
221 
222 #endif //_MDRV_MHL_H_