1 /*******************************************************************
2 *Copyright (c) 2012 by Silicon Motion, Inc. (SMI)
3 *Permission is hereby granted, free of charge, to any person obtaining a copy
4 *of this software and associated documentation files (the "Software"), to deal
5 *in the Software without restriction, including without limitation the rights to
6 *use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 *of the Software, and to permit persons to whom the Software is furnished to
8 *do so, subject to the following conditions:
10 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
12 *OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13 *NONINFRINGEMENT. IN NO EVENT SHALL Mill.Chen and Monk.Liu OR COPYRIGHT
14 *HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
15 *WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16 *FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
17 *OTHER DEALINGS IN THE SOFTWARE.
18 *******************************************************************/
20 #include "ddk750_help.h"
21 #include "ddk750_reg.h"
22 #include "ddk750_dvi.h"
23 #include "ddk750_sii164.h"
26 /* This global variable contains all the supported driver and its corresponding
27 function API. Please set the function pointer to NULL whenever the function
29 static dvi_ctrl_device_t g_dcftSupportedDviController
[] = {
30 #ifdef DVI_CTRL_SII164
32 .pfnInit
= sii164InitChip
,
33 .pfnGetVendorId
= sii164GetVendorID
,
34 .pfnGetDeviceId
= sii164GetDeviceID
,
35 #ifdef SII164_FULL_FUNCTIONS
36 .pfnResetChip
= sii164ResetChip
,
37 .pfnGetChipString
= sii164GetChipString
,
38 .pfnSetPower
= sii164SetPower
,
39 .pfnEnableHotPlugDetection
= sii164EnableHotPlugDetection
,
40 .pfnIsConnected
= sii164IsConnected
,
41 .pfnCheckInterrupt
= sii164CheckInterrupt
,
42 .pfnClearInterrupt
= sii164ClearInterrupt
,
48 #ifdef CONFIG_FB_LYNXFB_DOMAINS
50 int dviInit(unsigned char edgeSelect
,
51 unsigned char busSelect
,
52 unsigned char dualEdgeClkSelect
,
53 unsigned char hsyncEnable
,
54 unsigned char vsyncEnable
,
55 unsigned char deskewEnable
,
56 unsigned char deskewSetting
,
57 unsigned char continuousSyncEnable
,
58 unsigned char pllFilterEnable
, unsigned char pllFilterValue
,
61 dvi_ctrl_device_t
*pCurrentDviCtrl
;
62 pCurrentDviCtrl
= g_dcftSupportedDviController
;
63 if (pCurrentDviCtrl
->pfnInit
!= NULL
) {
64 return pCurrentDviCtrl
->pfnInit(edgeSelect
, busSelect
,
66 hsyncEnable
, vsyncEnable
,
74 return -1; /* error */
80 * This function gets the vendor ID of the DVI controller chip.
85 unsigned short dviGetVendorID(int domain
)
87 dvi_ctrl_device_t
*pCurrentDviCtrl
;
89 /*pCurrentDviCtrl = getDviCtrl(); */
90 pCurrentDviCtrl
= g_dcftSupportedDviController
;
91 if (pCurrentDviCtrl
!= (dvi_ctrl_device_t
*) 0)
92 return pCurrentDviCtrl
->pfnGetVendorId(domain
);
100 * This function gets the device ID of the DVI controller chip.
105 unsigned short dviGetDeviceID(int domain
)
107 dvi_ctrl_device_t
*pCurrentDviCtrl
;
109 /* pCurrentDviCtrl = getDviCtrl(); */
110 pCurrentDviCtrl
= g_dcftSupportedDviController
;
111 if (pCurrentDviCtrl
!= (dvi_ctrl_device_t
*) 0)
112 return pCurrentDviCtrl
->pfnGetDeviceId(domain
);
118 #else /* !CONFIG_FB_LYNXFB_DOMAINS: */
121 int dviInit(unsigned char edgeSelect
,
122 unsigned char busSelect
,
123 unsigned char dualEdgeClkSelect
,
124 unsigned char hsyncEnable
,
125 unsigned char vsyncEnable
,
126 unsigned char deskewEnable
,
127 unsigned char deskewSetting
,
128 unsigned char continuousSyncEnable
,
129 unsigned char pllFilterEnable
, unsigned char pllFilterValue
)
131 dvi_ctrl_device_t
*pCurrentDviCtrl
;
132 pCurrentDviCtrl
= g_dcftSupportedDviController
;
133 if (pCurrentDviCtrl
->pfnInit
!= NULL
) {
134 return pCurrentDviCtrl
->pfnInit(edgeSelect
, busSelect
,
136 hsyncEnable
, vsyncEnable
,
139 continuousSyncEnable
,
143 return -1; /* error */
149 * This function gets the vendor ID of the DVI controller chip.
154 unsigned short dviGetVendorID()
156 dvi_ctrl_device_t
*pCurrentDviCtrl
;
158 /*pCurrentDviCtrl = getDviCtrl(); */
159 pCurrentDviCtrl
= g_dcftSupportedDviController
;
160 if (pCurrentDviCtrl
!= (dvi_ctrl_device_t
*) 0)
161 return pCurrentDviCtrl
->pfnGetVendorId();
169 * This function gets the device ID of the DVI controller chip.
174 unsigned short dviGetDeviceID()
176 dvi_ctrl_device_t
*pCurrentDviCtrl
;
178 /* pCurrentDviCtrl = getDviCtrl(); */
179 pCurrentDviCtrl
= g_dcftSupportedDviController
;
180 if (pCurrentDviCtrl
!= (dvi_ctrl_device_t
*) 0)
181 return pCurrentDviCtrl
->pfnGetDeviceId();
186 #endif /* CONFIG_FB_LYNXFB_DOMAINS */