1 /*
2 * Copyright (c) Texas Instruments Incorporated 2018
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the
15 * distribution.
16 *
17 * Neither the name of Texas Instruments Incorporated nor the names of
18 * its contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
34 /**
35 * \file dss_dctrlPriv.h
36 *
37 * \brief DSS Controller driver private header file.
38 */
40 #ifndef DSS_DCTRLPRIV_H_
41 #define DSS_DCTRLPRIV_H_
43 /* ========================================================================== */
44 /* Include Files */
45 /* ========================================================================== */
47 #include <ti/drv/dss/dss.h>
48 #include <ti/drv/dss/src/drv/dctrl/dss_dctrlIntr.h>
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
54 /* ========================================================================== */
55 /* Macros & Typedefs */
56 /* ========================================================================== */
58 /** @brief Enumeration for video port run states
59 *
60 * This is internally used for starting or stopping video ports
61 * synchronously
62 */
63 typedef enum {
64 /** Secondary VP START command */
65 DSS_DCTRL_VP_STARTING = 0,
66 /** primary VP START command */
67 DSS_DCTRL_VP_RUNNING = 1,
68 /** secondary VP STOP command */
69 DSS_DCTRL_VP_STOPPING = 2,
70 /** primary VP STOP command */
71 DSS_DCTRL_VP_IDLE = 3,
72 } Dss_DctrlVpState;
74 /* ========================================================================== */
75 /* Structure Declarations */
76 /* ========================================================================== */
78 /**
79 * \brief Different states of the controller driver.
80 */
81 typedef struct
82 {
83 uint32_t isInit;
84 /**< Flag to indicate initialization is done or not for an instance */
85 uint32_t isOpened;
86 /**< Flag to indicate whether the instance is opened or not */
87 uint32_t isStarted;
88 /**< Flag to indicate whether the display has started or not */
89 } Dss_DctrlDrvState;
91 /** \brief Forward declaration for instance object. */
92 typedef struct Dss_DctrlDrvInstObj_t Dss_DctrlDrvInstObj;
94 /**
95 * \brief Display controller driver common object.
96 */
97 typedef struct
98 {
99 Fvid2_DrvOps fvidDrvOps;
100 /**< FVID2 driver ops */
101 uint32_t isRegistered;
102 /**< FVID2 registration complete flag */
103 Dss_DctrlDrvInstObj *instObj;
104 /**< Display instance objects pointer */
105 Dss_DctrlDrvInitParams drvInitParams;
106 /**< Display driver initialization parameters objects pointer */
107 } Dss_DctrlDrvCommonObj;
109 /**
110 * \brief Display controller instance information.
111 */
112 struct Dss_DctrlDrvInstObj_t
113 {
114 uint32_t drvInstId;
115 /**< Driver Instance ID */
116 Dss_DctrlDrvState drvState;
117 /**< Instance state */
118 uint32_t numOpenDrvHandle;
119 /**< Number of open handles to the driver */
120 uint32_t numRegEvtHandle;
121 /**< Number of registered event group handles */
122 void *evtGroupHandle[DSS_DCTRL_EVT_MGR_MAX_CLIENTS];
123 /**< Handle to registered event groups */
124 SemaphoreP_Handle lockSem;
125 /**< Semaphore to protect the open/close calls and other memory
126 * allocation per instance */
127 };
129 /**
130 * \brief Display controller graph object.
131 */
132 typedef struct
133 {
134 void *graph;
135 /**< Pointer to graph object */
136 Fvid2_GraphInfo graphObj;
137 /**< Graph object */
138 Fvid2_GraphNodeList graphObjNodeList;
139 /**< Graph object node list */
140 Fvid2_GraphEdgeList graphObjEdgeList;
141 /**< Graph object edge list */
142 Fvid2_GraphNodeList dctrlNodeList;
143 /**< Display controller node list */
144 Fvid2_GraphEdgeList dctrlEdgeList;
145 /**< Display controller edge list */
146 Fvid2_GraphNodeInfo dctrlNodeObj[DSS_DCTRL_MAX_NODES];
147 /**< Display controller node object list */
148 Fvid2_GraphEdgeInfo dctrlEdgeObj[DSS_DCTRL_MAX_EDGES];
149 /**< Display controller edge object list */
150 Fvid2_GraphNodeInfo allDctrlNodes[DSS_DCTRL_MAX_NODES];
151 /**< All display controller node list */
152 Fvid2_GraphEdgeInfo allEdgeInfo[DSS_DCTRL_MAX_EDGES];
153 /**< All display controller edge list */
154 } Dss_DctrlDrvGraphObj;
156 /**
157 * \brief Display controller driver error count.
158 */
159 typedef struct
160 {
161 uint32_t vpsyncLost[CSL_DSS_VP_ID_MAX];
162 /**< SyncLost error count for video Port */
163 uint32_t vpSafetyViolation[CSL_DSS_VP_SAFETY_REGION_MAX][CSL_DSS_VP_ID_MAX];
164 /**< Safety violation count for video Port */
165 uint32_t vpSecurityViolation[CSL_DSS_VP_ID_MAX];
166 /**< Security violation count for video Port */
167 } Dss_DctrlDrvErrorCount;
169 /**
170 * \brief Display controller driver information.
171 */
172 typedef struct
173 {
174 uint32_t numValidPipes;
175 /**< Number of valid video pipes */
176 Dss_DctrlDrvPipeInfo pipeInfo[CSL_DSS_VID_PIPE_ID_MAX];
177 /**< Information about the connected video pipe */
178 Dss_DctrlVpParams vpParams[CSL_DSS_VP_ID_MAX];
179 /**< Information about the Video Port */
180 Dss_DctrlVpState vpState[CSL_DSS_VP_ID_MAX];
181 /**< Flag to indicate whether Video Port is running or not. */
182 uint32_t isPushSafe[CSL_DSS_VP_ID_MAX];
183 /**< Flag to indicate if buffer push is safe */
184 Dss_DctrlSyncLostCbParams syncLostCbParams[CSL_DSS_VP_ID_MAX];
185 /**< Video port sync lost callback parameters */
186 Dss_DctrlLineNumCbParams lineNumCbParams[CSL_DSS_VP_ID_MAX];
187 /**< Video port line number callback parameters */
188 Dss_DctrlVpSafetyChkParams safetyChkParams[CSL_DSS_VP_SAFETY_REGION_MAX][CSL_DSS_VP_ID_MAX];
189 /**< Video port safety error callback parameters */
190 Dss_DctrlDrvErrorCount errorCnt;
191 /**< Display controller driver error count */
192 Dss_DctrlDsiParams dsiParams;
193 } Dss_DctrlDrvInfo;
195 /* ========================================================================== */
196 /* Internal/Private Function Declarations */
197 /* ========================================================================== */
199 /* None */
201 /* ========================================================================== */
202 /* Function Declarations */
203 /* ========================================================================== */
205 void *Dss_dctrlDrvGraphInit(Dss_DctrlDrvGraphObj *newGraphObj);
207 void Dss_dctrlDrvGraphDeInit(void *dssHandle);
209 int32_t Dss_dctrlDrvCreateEdgeList(Dss_DctrlDrvGraphObj *graphObj,
210 const Dss_DctrlPathInfo *pathInfo);
212 void Dss_dctrlDrvFreeEdgeList(Dss_DctrlDrvGraphObj *graphObj);
214 #if defined(SOC_J721E)
215 int32_t Dss_dctrlDrvDisableVideoDP(void);
216 int32_t Dss_dctrlDrvEnableVideoDP(const Fvid2_ModeInfo *mInfo,
217 uint32_t hsyncPolarity,
218 uint32_t vsyncPolarity);
220 int32_t Dss_dctrlDrvInitDp(uint32_t isHpdSupported);
221 int32_t Dss_dctrlDrvProcessHpdDp(uint32_t hpdState);
222 int32_t Dss_dctrlDrvRegisterHpdCb(const Dss_DctrlDpHpdCbParams *cbParams);
223 #endif
225 void Dss_dctrlDrvInitDSI();
226 int32_t Dss_dctrlDrvSetDSIParams(Dss_DctrlDrvInfo *drvInfo,
227 const Dss_DctrlDsiParams *dsPrms);
228 int32_t Dss_dctrlDrvEnableVideoDSI(Dss_DctrlDrvInfo *drvInfo,
229 const Fvid2_ModeInfo *mInfo, uint32_t hsyncPolarity,
230 uint32_t vsyncPolarity);
233 /* ========================================================================== */
234 /* Static Function Definitions */
235 /* ========================================================================== */
237 /* None */
239 #ifdef __cplusplus
240 }
241 #endif
243 #endif /* #ifndef DSS_DCTRLPRIV_H_ */