These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / sm750fb / ddk750_dvi.c
1 #define USE_DVICHIP
2 #ifdef USE_DVICHIP
3 #include "ddk750_help.h"
4 #include "ddk750_reg.h"
5 #include "ddk750_dvi.h"
6 #include "ddk750_sii164.h"
7
8
9 /* This global variable contains all the supported driver and its corresponding
10    function API. Please set the function pointer to NULL whenever the function
11    is not supported. */
12 static dvi_ctrl_device_t g_dcftSupportedDviController[] = {
13 #ifdef DVI_CTRL_SII164
14         {
15                 .pfnInit = sii164InitChip,
16                 .pfnGetVendorId = sii164GetVendorID,
17                 .pfnGetDeviceId = sii164GetDeviceID,
18 #ifdef SII164_FULL_FUNCTIONS
19                 .pfnResetChip = sii164ResetChip,
20                 .pfnGetChipString = sii164GetChipString,
21                 .pfnSetPower = sii164SetPower,
22                 .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection,
23                 .pfnIsConnected = sii164IsConnected,
24                 .pfnCheckInterrupt = sii164CheckInterrupt,
25                 .pfnClearInterrupt = sii164ClearInterrupt,
26 #endif
27         },
28 #endif
29 };
30
31
32 int dviInit(
33         unsigned char edgeSelect,
34         unsigned char busSelect,
35         unsigned char dualEdgeClkSelect,
36         unsigned char hsyncEnable,
37         unsigned char vsyncEnable,
38         unsigned char deskewEnable,
39         unsigned char deskewSetting,
40         unsigned char continuousSyncEnable,
41         unsigned char pllFilterEnable,
42         unsigned char pllFilterValue
43                         )
44 {
45         dvi_ctrl_device_t *pCurrentDviCtrl;
46
47         pCurrentDviCtrl = g_dcftSupportedDviController;
48         if (pCurrentDviCtrl->pfnInit != NULL) {
49                 return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, dualEdgeClkSelect, hsyncEnable,
50                                                 vsyncEnable, deskewEnable, deskewSetting, continuousSyncEnable,
51                                                 pllFilterEnable, pllFilterValue);
52         }
53         return -1; /* error */
54 }
55
56
57 /*
58  *  dviGetVendorID
59  *      This function gets the vendor ID of the DVI controller chip.
60  *
61  *  Output:
62  *      Vendor ID
63  */
64 unsigned short dviGetVendorID(void)
65 {
66         dvi_ctrl_device_t *pCurrentDviCtrl;
67
68         pCurrentDviCtrl = g_dcftSupportedDviController;
69         if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0)
70                 return pCurrentDviCtrl->pfnGetVendorId();
71
72         return 0x0000;
73 }
74
75
76 /*
77  *  dviGetDeviceID
78  *      This function gets the device ID of the DVI controller chip.
79  *
80  *  Output:
81  *      Device ID
82  */
83 unsigned short dviGetDeviceID(void)
84 {
85         dvi_ctrl_device_t *pCurrentDviCtrl;
86
87         pCurrentDviCtrl = g_dcftSupportedDviController;
88         if (pCurrentDviCtrl != (dvi_ctrl_device_t *)0)
89                 return pCurrentDviCtrl->pfnGetDeviceId();
90
91         return 0x0000;
92 }
93
94 #endif
95
96