Lynx framebuffers multidomain implementation.
[linux/elbrus.git] / drivers / video / lynxfb / ddk750_dvi.c
blobb92d1beff2d2dac7b65c223782e7b6507a70a60d
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 *******************************************************************/
19 #ifdef USE_DVICHIP
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
28 is not supported. */
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,
43 #endif
45 #endif
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,
59 int domain)
61 dvi_ctrl_device_t *pCurrentDviCtrl;
62 pCurrentDviCtrl = g_dcftSupportedDviController;
63 if (pCurrentDviCtrl->pfnInit != NULL) {
64 return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect,
65 dualEdgeClkSelect,
66 hsyncEnable, vsyncEnable,
67 deskewEnable,
68 deskewSetting,
69 continuousSyncEnable,
70 pllFilterEnable,
71 pllFilterValue,
72 domain);
74 return -1; /* error */
79 * dviGetVendorID
80 * This function gets the vendor ID of the DVI controller chip.
82 * Output:
83 * Vendor ID
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);
94 return 0x0000;
99 * dviGetDeviceID
100 * This function gets the device ID of the DVI controller chip.
102 * Output:
103 * Device ID
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);
114 return 0x0000;
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,
135 dualEdgeClkSelect,
136 hsyncEnable, vsyncEnable,
137 deskewEnable,
138 deskewSetting,
139 continuousSyncEnable,
140 pllFilterEnable,
141 pllFilterValue);
143 return -1; /* error */
148 * dviGetVendorID
149 * This function gets the vendor ID of the DVI controller chip.
151 * Output:
152 * Vendor ID
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();
163 return 0x0000;
168 * dviGetDeviceID
169 * This function gets the device ID of the DVI controller chip.
171 * Output:
172 * Device ID
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();
183 return 0x0000;
186 #endif /* CONFIG_FB_LYNXFB_DOMAINS */
189 #endif