tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / drivers / video / sprdfb / dsi_1_21a / mipi_dsih_hal.c
1 /**\r
2  * @file mipi_dsih_hal.c\r
3  * @brief Hardware Abstraction Level of DWC MIPI DSI HOST controller\r
4  *\r
5  *  Synopsys Inc.\r
6  *  SG DWC PT02\r
7  */\r
8 #include "mipi_dsih_hal.h"\r
9 \r
10 /**\r
11  * Write a 32-bit word to the DSI Host core\r
12  * @param instance pointer to structure holding the DSI Host core information\r
13  * @param reg_address register offset in core\r
14  * @param data 32-bit word to be written to register\r
15  */\r
16 void mipi_dsih_write_word(dsih_ctrl_t * instance, uint32_t reg_address, uint32_t data)\r
17 {\r
18 \r
19         instance->core_write_function(instance->address, reg_address, data);\r
20 }\r
21 /**\r
22  * Write a bit field o a 32-bit word to the DSI Host core\r
23  * @param instance pointer to structure holding the DSI Host core information\r
24  * @param reg_address register offset in core\r
25  * @param data to be written to register\r
26  * @param shift bit shift from the left (system is BIG ENDIAN)\r
27  * @param width of bit field\r
28  */\r
29 void mipi_dsih_write_part(dsih_ctrl_t * instance, uint32_t reg_address, uint32_t data, uint8_t shift, uint8_t width)\r
30 {\r
31         uint32_t mask = (1 << width) - 1;\r
32         uint32_t temp = mipi_dsih_read_word(instance, reg_address);\r
33 \r
34         temp &= ~(mask << shift);\r
35         temp |= (data & mask) << shift;\r
36         mipi_dsih_write_word(instance, reg_address, temp);\r
37 }\r
38 /**\r
39  * Write a 32-bit word to the DSI Host core\r
40  * @param instance pointer to structure holding the DSI Host core information\r
41  * @param reg_address offset of register\r
42  * @return 32-bit word value stored in register\r
43  */\r
44 uint32_t mipi_dsih_read_word(dsih_ctrl_t * instance, uint32_t reg_address)\r
45 {\r
46         return instance->core_read_function(instance->address, reg_address);\r
47 }\r
48 /**\r
49  * Write a 32-bit word to the DSI Host core\r
50  * @param instance pointer to structure holding the DSI Host core information\r
51  * @param reg_address offset of register in core\r
52  * @param shift bit shift from the left (system is BIG ENDIAN)\r
53  * @param width of bit field\r
54  * @return bit field read from register\r
55  */\r
56 uint32_t mipi_dsih_read_part(dsih_ctrl_t * instance, uint32_t reg_address, uint8_t shift, uint8_t width)\r
57 {\r
58         return (mipi_dsih_read_word(instance, reg_address) >> shift) & ((1 << width) - 1);\r
59 }\r
60 /**\r
61  * Get DSI Host core version\r
62  * @param instance pointer to structure holding the DSI Host core information\r
63  * @return ascii number of the version\r
64  */\r
65 uint32_t mipi_dsih_hal_get_version(dsih_ctrl_t * instance)\r
66 {\r
67         return mipi_dsih_read_word(instance, R_DSI_HOST_VERSION);\r
68 }\r
69 /**\r
70  * Modify power status of DSI Host core\r
71  * @param instance pointer to structure holding the DSI Host core information\r
72  * @param on (1) or off (0)\r
73  */\r
74 void mipi_dsih_hal_power(dsih_ctrl_t * instance, int on)\r
75 {\r
76         mipi_dsih_write_part(instance, R_DSI_HOST_PWR_UP, on, 0, 1);\r
77 }\r
78 /**\r
79  * Get the power status of the DSI Host core\r
80  * @param instance pointer to structure holding the DSI Host core information\r
81  * @return power status\r
82  */\r
83 int mipi_dsih_hal_get_power(dsih_ctrl_t * instance)\r
84 {\r
85         return (int)(mipi_dsih_read_part(instance, R_DSI_HOST_PWR_UP, 0, 1));\r
86 }\r
87 /**\r
88  * Write transmission escape timeout\r
89  * a safe guard so that the state machine would reset if transmission\r
90  * takes too long\r
91  * @param instance pointer to structure holding the DSI Host core information\r
92  * @param tx_escape_division\r
93  */\r
94 void mipi_dsih_hal_tx_escape_division(dsih_ctrl_t * instance, uint8_t tx_escape_division)\r
95 {\r
96         mipi_dsih_write_part(instance, R_DSI_HOST_CLK_MGR, tx_escape_division, 0, 8);\r
97 }\r
98 /**\r
99  * Write the DPI video virtual channel destination\r
100  * @param instance pointer to structure holding the DSI Host core information\r
101  * @param vc virtual channel\r
102  */\r
103 void mipi_dsih_hal_dpi_video_vc(dsih_ctrl_t * instance, uint8_t vc)\r
104 {\r
105         mipi_dsih_write_part(instance, R_DSI_HOST_DPI_VCID, (uint32_t)(vc), 0, 2);\r
106 }\r
107 /**\r
108  * Get the DPI video virtual channel destination\r
109  * @param instance pointer to structure holding the DSI Host core information\r
110  * @return virtual channel\r
111  */\r
112 uint8_t mipi_dsih_hal_dpi_get_video_vc(dsih_ctrl_t * instance)\r
113 {\r
114         return mipi_dsih_read_part(instance, R_DSI_HOST_DPI_VCID, 0, 2);\r
115 }\r
116 /**\r
117  * Set DPI video color coding\r
118  * @param instance pointer to structure holding the DSI Host core information\r
119  * @param color_coding enum (configuration and color depth)\r
120  * @return error code\r
121  */\r
122 dsih_error_t mipi_dsih_hal_dpi_color_coding(dsih_ctrl_t * instance, dsih_color_coding_t color_coding)\r
123 {\r
124         dsih_error_t err = OK;\r
125         if (color_coding > COLOR_CODE_MAX)\r
126         {\r
127                 if (instance->log_error != 0)\r
128                 {\r
129                         instance->log_error("invalid colour configuration");\r
130                 }\r
131                 err = ERR_DSI_COLOR_CODING;\r
132         }\r
133         else\r
134         {\r
135                 mipi_dsih_write_part(instance, R_DSI_HOST_DPI_COLOR_CODE, color_coding, 0, 4);\r
136         }\r
137         return err;\r
138 }\r
139 /**\r
140  * Get DPI video color coding\r
141  * @param instance pointer to structure holding the DSI Host core information\r
142  * @return color coding enum (configuration and color depth)\r
143  */\r
144 dsih_color_coding_t mipi_dsih_hal_dpi_get_color_coding(dsih_ctrl_t * instance)\r
145 {\r
146         return (dsih_color_coding_t)(mipi_dsih_read_part(instance, R_DSI_HOST_DPI_COLOR_CODE, 0, 4));\r
147 }\r
148 /**\r
149  * Get DPI video color depth\r
150  * @param instance pointer to structure holding the DSI Host core information\r
151  * @return number of bits per pixel\r
152  */\r
153 uint8_t mipi_dsih_hal_dpi_get_color_depth(dsih_ctrl_t * instance)\r
154 {\r
155         uint8_t color_depth = 0;\r
156         switch (mipi_dsih_read_part(instance, R_DSI_HOST_DPI_COLOR_CODE, 0, 4))\r
157         {\r
158         case 0:\r
159         case 1:\r
160         case 2:\r
161                 color_depth = 16;\r
162                 break;\r
163         case 3:\r
164         case 4:\r
165                 color_depth = 18;\r
166                 break;\r
167         case 5:\r
168                 color_depth = 24;\r
169                 break;\r
170         case 6:\r
171                 color_depth = 20;\r
172                 break;\r
173         case 7:\r
174                 color_depth = 24;\r
175                 break;\r
176         case 8:\r
177                 color_depth = 16;\r
178                 break;\r
179         case 9:\r
180                 color_depth = 30;\r
181                 break;\r
182         case 10:\r
183                 color_depth = 36;\r
184                 break;\r
185         case 11:\r
186                 color_depth = 12;\r
187                 break;\r
188         default:\r
189         color_depth = 24;\r
190                 break;\r
191         }\r
192         return color_depth;\r
193 }\r
194 /**\r
195  * Get DPI video pixel configuration\r
196  * @param instance pointer to structure holding the DSI Host core information\r
197  * @return pixel configuration\r
198  */\r
199 uint8_t mipi_dsih_hal_dpi_get_color_config(dsih_ctrl_t * instance)\r
200 {\r
201         uint8_t color_config = 0;\r
202         switch (mipi_dsih_read_part(instance, R_DSI_HOST_DPI_COLOR_CODE, 0, 4))\r
203         {\r
204         case 0:\r
205                 color_config = 1;\r
206             break;\r
207         case 1:\r
208                 color_config = 2;\r
209                 break;\r
210         case 2:\r
211                 color_config = 3;\r
212                 break;\r
213         case 3:\r
214                 color_config = 1;\r
215                 break;\r
216         case 4:\r
217                 color_config = 2;\r
218                 break;\r
219         default:\r
220                 color_config = 0;\r
221                 break;\r
222         }\r
223         return color_config;\r
224 }\r
225 /**\r
226  * Set DPI loosely packetisation video (used only when color depth = 18\r
227  * @param instance pointer to structure holding the DSI Host core information\r
228  * @param enable\r
229  */\r
230 void mipi_dsih_hal_dpi_18_loosely_packet_en(dsih_ctrl_t * instance, int enable)\r
231 {\r
232         mipi_dsih_write_part(instance, R_DSI_HOST_DPI_COLOR_CODE, enable, 8, 1);\r
233 }\r
234 /**\r
235  * Set DPI color mode pin polarity\r
236  * @param instance pointer to structure holding the DSI Host core information\r
237  * @param active_low (1) or active high (0)\r
238  */\r
239 void mipi_dsih_hal_dpi_color_mode_pol(dsih_ctrl_t * instance, int active_low)\r
240 {\r
241         mipi_dsih_write_part(instance, R_DSI_HOST_DPI_CFG_POL, active_low, 4, 1);\r
242 }\r
243 /**\r
244  * Set DPI shut down pin polarity\r
245  * @param instance pointer to structure holding the DSI Host core information\r
246  * @param active_low (1) or active high (0)\r
247  */\r
248 void mipi_dsih_hal_dpi_shut_down_pol(dsih_ctrl_t * instance, int active_low)\r
249 {\r
250         mipi_dsih_write_part(instance, R_DSI_HOST_DPI_CFG_POL, active_low, 3, 1);\r
251 }\r
252 /**\r
253  * Set DPI horizontal sync pin polarity\r
254  * @param instance pointer to structure holding the DSI Host core information\r
255  * @param active_low (1) or active high (0)\r
256  */\r
257 void mipi_dsih_hal_dpi_hsync_pol(dsih_ctrl_t * instance, int active_low)\r
258 {\r
259         mipi_dsih_write_part(instance, R_DSI_HOST_DPI_CFG_POL, active_low, 2, 1);\r
260 }\r
261 /**\r
262  * Set DPI vertical sync pin polarity\r
263  * @param instance pointer to structure holding the DSI Host core information\r
264  * @param active_low (1) or active high (0)\r
265  */\r
266 void mipi_dsih_hal_dpi_vsync_pol(dsih_ctrl_t * instance, int active_low)\r
267 {\r
268         mipi_dsih_write_part(instance, R_DSI_HOST_DPI_CFG_POL, active_low, 1, 1);\r
269 }\r
270 /**\r
271  * Set DPI data enable pin polarity\r
272  * @param instance pointer to structure holding the DSI Host core information\r
273  * @param active_low (1) or active high (0)\r
274  */\r
275 void mipi_dsih_hal_dpi_dataen_pol(dsih_ctrl_t * instance, int active_low)\r
276 {\r
277         mipi_dsih_write_part(instance, R_DSI_HOST_DPI_CFG_POL, active_low, 0, 1);\r
278 }\r
279 /**\r
280  * Enable FRAME BTA ACK\r
281  * @param instance pointer to structure holding the DSI Host core information\r
282  * @param enable (1) - disable (0)\r
283  */\r
284 void mipi_dsih_hal_dpi_frame_ack_en(dsih_ctrl_t * instance, int enable)\r
285 {\r
286         mipi_dsih_write_part(instance, R_DSI_HOST_VID_MODE_CFG, enable, 14, 1);\r
287 }\r
288 /**\r
289  * Enable null packets (value in null packet size will be taken in calculations)\r
290  * @param instance pointer to structure holding the DSI Host core information\r
291  * @param enable (1) - disable (0)\r
292  * @note function retained for backward compatibility (not used from 1.20a on)\r
293  */\r
294 void mipi_dsih_hal_dpi_null_packet_en(dsih_ctrl_t * instance, int enable)\r
295 {\r
296 }\r
297 /**\r
298  * Enable multi packets (value in no of chunks will be taken in calculations)\r
299  * @param instance pointer to structure holding the DSI Host core information\r
300  * @param enable (1) - disable (0)\r
301  */\r
302 void mipi_dsih_hal_dpi_multi_packet_en(dsih_ctrl_t * instance, int enable)\r
303 {\r
304 }\r
305 /**\r
306  * Enable return to low power mode inside horizontal front porch periods when\r
307  *  timing allows\r
308  * @param instance pointer to structure holding the DSI Host core information\r
309  * @param enable (1) - disable (0)\r
310  */\r
311 void mipi_dsih_hal_dpi_lp_during_hfp(dsih_ctrl_t * instance, int enable)\r
312 {\r
313         mipi_dsih_write_part(instance, R_DSI_HOST_VID_MODE_CFG, enable, 13, 1);\r
314 }\r
315 /**\r
316  * Enable return to low power mode inside horizontal back porch periods when\r
317  *  timing allows\r
318  * @param instance pointer to structure holding the DSI Host core information\r
319  * @param enable (1) - disable (0)\r
320  */\r
321 void mipi_dsih_hal_dpi_lp_during_hbp(dsih_ctrl_t * instance, int enable)\r
322 {\r
323         mipi_dsih_write_part(instance, R_DSI_HOST_VID_MODE_CFG, enable, 12, 1);\r
324 }\r
325 /**\r
326  * Enable return to low power mode inside vertical active lines periods when\r
327  *  timing allows\r
328  * @param instance pointer to structure holding the DSI Host core information\r
329  * @param enable (1) - disable (0)\r
330  */\r
331 void mipi_dsih_hal_dpi_lp_during_vactive(dsih_ctrl_t * instance, int enable)\r
332 {\r
333         mipi_dsih_write_part(instance, R_DSI_HOST_VID_MODE_CFG, enable, 11, 1);\r
334 }\r
335 /**\r
336  * Enable return to low power mode inside vertical front porch periods when\r
337  *  timing allows\r
338  * @param instance pointer to structure holding the DSI Host core information\r
339  * @param enable (1) - disable (0)\r
340  */\r
341 void mipi_dsih_hal_dpi_lp_during_vfp(dsih_ctrl_t * instance, int enable)\r
342 {\r
343         mipi_dsih_write_part(instance, R_DSI_HOST_VID_MODE_CFG, enable, 10, 1);\r
344 }\r
345 /**\r
346  * Enable return to low power mode inside vertical back porch periods when\r
347  * timing allows\r
348  * @param instance pointer to structure holding the DSI Host core information\r
349  * @param enable (1) - disable (0)\r
350  */\r
351 void mipi_dsih_hal_dpi_lp_during_vbp(dsih_ctrl_t * instance, int enable)\r
352 {\r
353         mipi_dsih_write_part(instance, R_DSI_HOST_VID_MODE_CFG, enable, 9, 1);\r
354 }\r
355 /**\r
356  * Enable return to low power mode inside vertical sync periods when\r
357  *  timing allows\r
358  * @param instance pointer to structure holding the DSI Host core information\r
359  * @param enable (1) - disable (0)\r
360  */\r
361 void mipi_dsih_hal_dpi_lp_during_vsync(dsih_ctrl_t * instance, int enable)\r
362 {\r
363         mipi_dsih_write_part(instance, R_DSI_HOST_VID_MODE_CFG, enable, 8, 1);\r
364 }\r
365 /**\r
366  * Set DPI video mode type (burst/non-burst - with sync pulses or events)\r
367  * @param instance pointer to structure holding the DSI Host core information\r
368  * @param type\r
369  * @return error code\r
370  */\r
371 dsih_error_t mipi_dsih_hal_dpi_video_mode_type(dsih_ctrl_t * instance, dsih_video_mode_t type)\r
372 {\r
373         if (type < 3)\r
374         {\r
375                 mipi_dsih_write_part(instance, R_DSI_HOST_VID_MODE_CFG, type, 0, 2);\r
376                 return OK;\r
377         }\r
378         else\r
379         {\r
380                 if (instance->log_error != 0)\r
381                 {\r
382                         instance->log_error("undefined type");\r
383                 }\r
384                 return ERR_DSI_OUT_OF_BOUND;\r
385         }\r
386 }\r
387 /**\r
388  * Enable/disable DPI video mode\r
389  * @param instance pointer to structure holding the DSI Host core information\r
390  * @param enable (1) - disable (0)\r
391  */\r
392 void mipi_dsih_hal_dpi_video_mode_en(dsih_ctrl_t * instance, int enable)\r
393 {\r
394         mipi_dsih_write_part(instance, R_DSI_HOST_MODE_CFG, enable? 0: 1, 0, 1);\r
395 }\r
396 /**\r
397  * Get the status of video mode, whether enabled or not in core\r
398  * @param instance pointer to structure holding the DSI Host core information\r
399  * @return status\r
400  */\r
401 int mipi_dsih_hal_dpi_is_video_mode(dsih_ctrl_t * instance)\r
402 {\r
403         return (mipi_dsih_read_part(instance, R_DSI_HOST_MODE_CFG, 0, 1) == 0);\r
404 }\r
405 /**\r
406  * Write the null packet size - will only be taken into account when null\r
407  * packets are enabled.\r
408  * @param instance pointer to structure holding the DSI Host core information\r
409  * @param size of null packet\r
410  * @return error code\r
411  */\r
412 dsih_error_t mipi_dsih_hal_dpi_null_packet_size(dsih_ctrl_t * instance, uint16_t size)\r
413 {\r
414         if (size < (1 << 13)) /* 13-bit field */\r
415         {\r
416                 mipi_dsih_write_part(instance, R_DSI_HOST_VID_NULL_SIZE, size, 0, 13);\r
417                 return OK;\r
418         }\r
419         else\r
420         {\r
421                 return ERR_DSI_OUT_OF_BOUND;\r
422         }\r
423 }\r
424 /**\r
425  * Write no of chunks to core - taken into consideration only when multi packet\r
426  * is enabled\r
427  * @param instance pointer to structure holding the DSI Host core information\r
428  * @param no of chunks\r
429  */\r
430 dsih_error_t mipi_dsih_hal_dpi_chunks_no(dsih_ctrl_t * instance, uint16_t no)\r
431 {\r
432         if (no < (1 << 13))\r
433         {\r
434                 mipi_dsih_write_part(instance, R_DSI_HOST_VID_NUM_CHUNKS, no, 0, 13);\r
435                 return OK;\r
436         }\r
437         else\r
438         {\r
439                 return ERR_DSI_OUT_OF_BOUND;\r
440         }\r
441 }\r
442 /**\r
443  * Write video packet size. obligatory for sending video\r
444  * @param instance pointer to structure holding the DSI Host core information\r
445  * @param size of video packet - containing information\r
446  * @return error code\r
447  */\r
448 dsih_error_t mipi_dsih_hal_dpi_video_packet_size(dsih_ctrl_t * instance, uint16_t size)\r
449 {\r
450         if (size < (1 << 14)) /* 14-bit field */\r
451         {\r
452                 mipi_dsih_write_part(instance, R_DSI_HOST_VID_PKT_SIZE, size, 0, 14);\r
453                 return OK;\r
454         }\r
455         else\r
456         {\r
457                 return ERR_DSI_OUT_OF_BOUND;\r
458         }\r
459 }\r
460 /**\r
461  * function retained for backward compatibility (not used from 1.20a on)\r
462  * @param instance pointer to structure holding the DSI Host core information\r
463  * @param enable (1) - disable (0)\r
464  */\r
465 void mipi_dsih_hal_edpi_enable(dsih_ctrl_t * instance, int enable)\r
466 {\r
467 }\r
468 /**\r
469  * Specifiy the size of the packet memory write start/continue\r
470  * @param instance pointer to structure holding the DSI Host core information\r
471  * @ size of the packet\r
472  * @note when different than zero (0) eDPI is enabled\r
473  */\r
474 void mipi_dsih_hal_edpi_max_allowed_size(dsih_ctrl_t * instance, uint16_t size)\r
475 {\r
476         mipi_dsih_write_part(instance, R_DSI_HOST_EDPI_CMD_SIZE, size, 0, 16);\r
477 }\r
478 /**\r
479  * Enable tear effect acknowledge\r
480  * @param instance pointer to structure holding the DSI Host core information\r
481  * @param enable (1) - disable (0)\r
482  */\r
483 void mipi_dsih_hal_tear_effect_ack_en(dsih_ctrl_t * instance, int enable)\r
484 {\r
485         mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, enable, 0, 1);\r
486 }\r
487 /**\r
488  * Enable packets acknowledge request after each packet transmission\r
489  * @param instance pointer to structure holding the DSI Host core information\r
490  * @param enable (1) - disable (0)\r
491  */\r
492 void mipi_dsih_hal_cmd_ack_en(dsih_ctrl_t * instance, int enable)\r
493 {\r
494         mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, enable, 1, 1);\r
495 }\r
496 /**\r
497  * Set DCS command packet transmission to transmission type\r
498  * @param instance pointer to structure holding the DSI Host core information\r
499  * @param no_of_param of command\r
500  * @param lp transmit in low power\r
501  * @return error code\r
502  */\r
503 dsih_error_t mipi_dsih_hal_dcs_wr_tx_type(dsih_ctrl_t * instance, unsigned no_of_param, int lp)\r
504 {\r
505         switch (no_of_param)\r
506         {\r
507         case 0:\r
508                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 16, 1);\r
509                 break;\r
510         case 1:\r
511                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 17, 1);\r
512                 break;\r
513         default:\r
514                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 19, 1);\r
515                 break;\r
516         }\r
517         return OK;\r
518 }\r
519 /**\r
520  * Set DCS read command packet transmission to transmission type\r
521  * @param instance pointer to structure holding the DSI Host core information\r
522  * @param no_of_param of command\r
523  * @param lp transmit in low power\r
524  * @return error code\r
525  */\r
526 dsih_error_t mipi_dsih_hal_dcs_rd_tx_type(dsih_ctrl_t * instance, unsigned no_of_param, int lp)\r
527 {\r
528         dsih_error_t err = OK;\r
529         switch (no_of_param)\r
530         {\r
531         case 0:\r
532                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 18, 1);\r
533                 break;\r
534         default:\r
535                 if (instance->log_error != 0)\r
536                 {\r
537                         instance->log_error("undefined DCS Read packet type");\r
538                 }\r
539                 err = ERR_DSI_OUT_OF_BOUND;\r
540                 break;\r
541         }\r
542         return err;\r
543 }\r
544 \r
545 /*Jessica add begin: to support max read packet size command */\r
546 dsih_error_t mipi_dsih_hal_max_rd_packet_size_type(dsih_ctrl_t * instance, int lp)\r
547 {\r
548     dsih_error_t err = OK;\r
549         #if 1//def 1.21A\r
550     mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 24, 1);\r
551         #else\r
552         mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 10, 1);\r
553         #endif\r
554     return err;\r
555 }\r
556 /*Jessica add end*/\r
557 \r
558 /**\r
559  * Set generic write command packet transmission to transmission type\r
560  * @param instance pointer to structure holding the DSI Host core information\r
561  * @param no_of_param of command\r
562  * @param lp transmit in low power\r
563  * @return error code\r
564  */\r
565 dsih_error_t mipi_dsih_hal_gen_wr_tx_type(dsih_ctrl_t * instance, unsigned no_of_param, int lp)\r
566 {\r
567         switch (no_of_param)\r
568         {\r
569         case 0:\r
570                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 8, 1);\r
571                 break;\r
572         case 1:\r
573                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 9, 1);\r
574                 break;\r
575         case 2:\r
576                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 10, 1);\r
577                 break;\r
578         default:\r
579                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 14, 1);\r
580                 break;\r
581         }\r
582         return OK;\r
583 }\r
584 /**\r
585  * Set generic command packet transmission to transmission type\r
586  * @param instance pointer to structure holding the DSI Host core information\r
587  * @param no_of_param of command\r
588  * @param lp transmit in low power\r
589  * @return error code\r
590  */\r
591 dsih_error_t mipi_dsih_hal_gen_rd_tx_type(dsih_ctrl_t * instance, unsigned no_of_param, int lp)\r
592 {\r
593         dsih_error_t err = OK;\r
594         switch (no_of_param)\r
595         {\r
596         case 0:\r
597                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 11, 1);\r
598                 break;\r
599         case 1:\r
600                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 12, 1);\r
601                 break;\r
602         case 2:\r
603                 mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 13, 1);\r
604                 break;\r
605         default:\r
606                 if (instance->log_error != 0)\r
607                 {\r
608                         instance->log_error("undefined Generic Read packet type");\r
609                 }\r
610                 err = ERR_DSI_OUT_OF_BOUND;\r
611                 break;\r
612         }\r
613         return err;\r
614 }\r
615 /**\r
616  * Configure maximum read packet size command transmission type\r
617  * @param instance pointer to structure holding the DSI Host core information\r
618  * @param lp set to low power\r
619  */\r
620 void mipi_dsih_hal_max_rd_size_tx_type(dsih_ctrl_t * instance, int lp)\r
621 {\r
622         mipi_dsih_write_part(instance, R_DSI_HOST_CMD_MODE_CFG, lp, 24, 1);\r
623 }\r
624 /**\r
625  * Enable command mode (Generic interface)\r
626  * @param instance pointer to structure holding the DSI Host core information\r
627  * @param enable\r
628  */\r
629 void mipi_dsih_hal_gen_cmd_mode_en(dsih_ctrl_t * instance, int enable)\r
630 {\r
631         mipi_dsih_write_part(instance, R_DSI_HOST_MODE_CFG, enable? 1: 0, 0, 1);\r
632 }\r
633 /**\r
634  * Retrieve the controller's status of whether command mode is ON or not\r
635  * @param instance pointer to structure holding the DSI Host core information\r
636  * @return whether command mode is ON\r
637  */\r
638 int mipi_dsih_hal_gen_is_cmd_mode(dsih_ctrl_t * instance)\r
639 {\r
640         return (mipi_dsih_read_part(instance, R_DSI_HOST_MODE_CFG, 0, 1) == 1);\r
641 }\r
642 /**\r
643  * Configure the Horizontal Line time\r
644  * @param instance pointer to structure holding the DSI Host core information\r
645  * @param time taken to transmit the total of the horizontal line\r
646  */\r
647 void mipi_dsih_hal_dpi_hline(dsih_ctrl_t * instance, uint16_t time)\r
648 {\r
649         mipi_dsih_write_part(instance, R_DSI_HOST_VID_HLINE_TIME, time, 0, 15);\r
650 }\r
651 /**\r
652  * Configure the Horizontal back porch time\r
653  * @param instance pointer to structure holding the DSI Host core information\r
654  * @param time taken to transmit the horizontal back porch\r
655  */\r
656 void mipi_dsih_hal_dpi_hbp(dsih_ctrl_t * instance, uint16_t time)\r
657 {\r
658         mipi_dsih_write_part(instance, R_DSI_HOST_VID_HBP_TIME, time, 0, 12);\r
659 }\r
660 /**\r
661  * Configure the Horizontal sync time\r
662  * @param instance pointer to structure holding the DSI Host core information\r
663  * @param time taken to transmit the horizontal sync\r
664  */\r
665 void mipi_dsih_hal_dpi_hsa(dsih_ctrl_t * instance, uint16_t time)\r
666 {\r
667         mipi_dsih_write_part(instance, R_DSI_HOST_VID_HSA_TIME, time, 0, 12);\r
668 }\r
669 /**\r
670  * Configure the vertical active lines of the video stream\r
671  * @param instance pointer to structure holding the DSI Host core information\r
672  * @param lines\r
673  */\r
674 void mipi_dsih_hal_dpi_vactive(dsih_ctrl_t * instance, uint16_t lines)\r
675 {\r
676         mipi_dsih_write_part(instance, R_DSI_HOST_VID_VACTIVE_LINES, lines, 0, 14);\r
677 }\r
678 /**\r
679  * Configure the vertical front porch lines of the video stream\r
680  * @param instance pointer to structure holding the DSI Host core information\r
681  * @param lines\r
682  */\r
683 void mipi_dsih_hal_dpi_vfp(dsih_ctrl_t * instance, uint16_t lines)\r
684 {\r
685         mipi_dsih_write_part(instance, R_DSI_HOST_VID_VFP_LINES, lines, 0, 10);\r
686 }\r
687 /**\r
688  * Configure the vertical back porch lines of the video stream\r
689  * @param instance pointer to structure holding the DSI Host core information\r
690  * @param lines\r
691  */\r
692 void mipi_dsih_hal_dpi_vbp(dsih_ctrl_t * instance, uint16_t lines)\r
693 {\r
694         mipi_dsih_write_part(instance, R_DSI_HOST_VID_VBP_LINES, lines, 0, 10);\r
695 }\r
696 /**\r
697  * Configure the vertical sync lines of the video stream\r
698  * @param instance pointer to structure holding the DSI Host core information\r
699  * @param lines\r
700  */\r
701 void mipi_dsih_hal_dpi_vsync(dsih_ctrl_t * instance, uint16_t lines)\r
702 {\r
703         mipi_dsih_write_part(instance, R_DSI_HOST_VID_VSA_LINES, lines, 0, 10);\r
704 }\r
705 /**\r
706  * configure timeout divisions (so they would have more clock ticks)\r
707  * @param instance pointer to structure holding the DSI Host core information\r
708  * @param byte_clk_division_factor no of hs cycles before transiting back to LP in\r
709  *  (lane_clk / byte_clk_division_factor)\r
710  */\r
711 void mipi_dsih_hal_timeout_clock_division(dsih_ctrl_t * instance, uint8_t byte_clk_division_factor)\r
712 {\r
713         mipi_dsih_write_part(instance, R_DSI_HOST_CLK_MGR, byte_clk_division_factor, 8, 8);\r
714 }\r
715 /**\r
716  * Configure the Low power receive time out\r
717  * @param instance pointer to structure holding the DSI Host core information\r
718  * @param count (of byte cycles)\r
719  */\r
720 void mipi_dsih_hal_lp_rx_timeout(dsih_ctrl_t * instance, uint16_t count)\r
721 {\r
722         mipi_dsih_write_part(instance, R_DSI_HOST_TO_CNT_CFG, count, 0, 16);\r
723 }\r
724 /**\r
725  * Configure a high speed transmission time out7\r
726  * @param instance pointer to structure holding the DSI Host core information\r
727  * @param count (byte cycles)\r
728  */\r
729 void mipi_dsih_hal_hs_tx_timeout(dsih_ctrl_t * instance, uint16_t count)\r
730 {\r
731         mipi_dsih_write_part(instance, R_DSI_HOST_TO_CNT_CFG, count, 16, 16);\r
732 }\r
733 /**\r
734  * Get the error 0 interrupt register status\r
735  * @param instance pointer to structure holding the DSI Host core information\r
736  * @param mask the mask to be read from the register\r
737  * @return error status 0 value\r
738  */\r
739 uint32_t mipi_dsih_hal_int_status_0(dsih_ctrl_t * instance, uint32_t mask)\r
740 {\r
741         return (mipi_dsih_read_word(instance, R_DSI_HOST_INT_ST0) & mask);\r
742 }\r
743 /**\r
744  * Get the error 1 interrupt register status\r
745  * @param instance pointer to structure holding the DSI Host core information\r
746  * @param mask the mask to be read from the register\r
747  * @return error status 1 value\r
748  */\r
749 uint32_t mipi_dsih_hal_int_status_1(dsih_ctrl_t * instance, uint32_t mask)\r
750 {\r
751         return (mipi_dsih_read_word(instance, R_DSI_HOST_INT_ST1) & mask);\r
752 }\r
753 /**\r
754  * Configure MASK (hiding) of interrupts coming from error 0 source\r
755  * @param instance pointer to structure holding the DSI Host core information\r
756  * @param mask to be written to the register\r
757  */\r
758 void mipi_dsih_hal_int_mask_0(dsih_ctrl_t * instance, uint32_t mask)\r
759 {\r
760         mipi_dsih_write_word(instance, R_DSI_HOST_INT_MSK0, mask);\r
761 }\r
762 /**\r
763  * Get the ERROR MASK  0 register status\r
764  * @param instance pointer to structure holding the DSI Host core information\r
765  * @param mask the bits to read from the mask register\r
766  */\r
767 uint32_t mipi_dsih_hal_int_get_mask_0(dsih_ctrl_t * instance, uint32_t mask)\r
768 {\r
769         return (mipi_dsih_read_word(instance, R_DSI_HOST_INT_MSK0) & mask);\r
770 }\r
771 /**\r
772  * Configure MASK (hiding) of interrupts coming from error 0 source\r
773  * @param instance pointer to structure holding the DSI Host core information\r
774  * @param mask the mask to be written to the register\r
775  */\r
776 void mipi_dsih_hal_int_mask_1(dsih_ctrl_t * instance, uint32_t mask)\r
777 {\r
778         mipi_dsih_write_word(instance, R_DSI_HOST_INT_MSK1, mask);\r
779 }\r
780 /**\r
781  * Get the ERROR MASK  1 register status\r
782  * @param instance pointer to structure holding the DSI Host core information\r
783  * @param mask the bits to read from the mask register\r
784  */\r
785 uint32_t mipi_dsih_hal_int_get_mask_1(dsih_ctrl_t * instance, uint32_t mask)\r
786 {\r
787         return (mipi_dsih_read_word(instance, R_DSI_HOST_INT_MSK1) & mask);\r
788 }\r
789 /* DBI NOT IMPLEMENTED */\r
790 void mipi_dsih_hal_dbi_out_color_coding(dsih_ctrl_t * instance, uint8_t color_depth, uint8_t option);\r
791 void mipi_dsih_hal_dbi_in_color_coding(dsih_ctrl_t * instance, uint8_t color_depth, uint8_t option);\r
792 void mipi_dsih_hal_dbi_lut_size(dsih_ctrl_t * instance, uint8_t size);\r
793 void mipi_dsih_hal_dbi_partitioning_en(dsih_ctrl_t * instance, int enable);\r
794 void mipi_dsih_hal_dbi_dcs_vc(dsih_ctrl_t * instance, uint8_t vc);\r
795 void mipi_dsih_hal_dbi_max_cmd_size(dsih_ctrl_t * instance, uint16_t size);\r
796 void mipi_dsih_hal_dbi_cmd_size(dsih_ctrl_t * instance, uint16_t size);\r
797 int mipi_dsih_hal_dbi_rd_cmd_busy(dsih_ctrl_t * instance);\r
798 int mipi_dsih_hal_dbi_read_fifo_full(dsih_ctrl_t * instance);\r
799 int mipi_dsih_hal_dbi_read_fifo_empty(dsih_ctrl_t * instance);\r
800 int mipi_dsih_hal_dbi_write_fifo_full(dsih_ctrl_t * instance);\r
801 int mipi_dsih_hal_dbi_write_fifo_empty(dsih_ctrl_t * instance);\r
802 int mipi_dsih_hal_dbi_cmd_fifo_full(dsih_ctrl_t * instance);\r
803 int mipi_dsih_hal_dbi_cmd_fifo_empty(dsih_ctrl_t * instance);\r
804 \r
805 /**\r
806  * Write command header in the generic interface\r
807  * (which also sends DCS commands) as a subset\r
808  * @param instance pointer to structure holding the DSI Host core information\r
809  * @param vc of destination\r
810  * @param packet_type (or type of DCS command)\r
811  * @param ls_byte (if DCS, it is the DCS command)\r
812  * @param ms_byte (only parameter of short DCS packet)\r
813  * @return error code\r
814  */\r
815 dsih_error_t mipi_dsih_hal_gen_packet_header(dsih_ctrl_t * instance, uint8_t vc, uint8_t packet_type, uint8_t ms_byte, uint8_t ls_byte)\r
816 {\r
817         if (vc < 4)\r
818         {\r
819                 mipi_dsih_write_part(instance, R_DSI_HOST_GEN_HDR, (ms_byte <<  16) | (ls_byte << 8 ) | ((vc << 6) | packet_type), 0, 24);\r
820                 return OK;\r
821         }\r
822         return  ERR_DSI_OVERFLOW;\r
823 }\r
824 /**\r
825  * Write the payload of the long packet commands\r
826  * @param instance pointer to structure holding the DSI Host core information\r
827  * @param payload array of bytes of payload\r
828  * @return error code\r
829  */\r
830 dsih_error_t mipi_dsih_hal_gen_packet_payload(dsih_ctrl_t * instance, uint32_t payload)\r
831 {\r
832         if (mipi_dsih_hal_gen_write_fifo_full(instance))\r
833         {\r
834                 return ERR_DSI_OVERFLOW;\r
835         }\r
836         mipi_dsih_write_word(instance, R_DSI_HOST_GEN_PLD_DATA, payload);\r
837         return OK;\r
838 \r
839 }\r
840 /**\r
841  * Write the payload of the long packet commands\r
842  * @param instance pointer to structure holding the DSI Host core information\r
843  * @param payload pointer to 32-bit array to hold read information\r
844  * @return error code\r
845  */\r
846 dsih_error_t  mipi_dsih_hal_gen_read_payload(dsih_ctrl_t * instance, uint32_t* payload)\r
847 {\r
848         *payload = mipi_dsih_read_word(instance, R_DSI_HOST_GEN_PLD_DATA);\r
849         return OK;\r
850 }\r
851 \r
852 /**\r
853  * Configure the read back virtual channel for the generic interface\r
854  * @param instance pointer to structure holding the DSI Host core information\r
855  * @param vc to listen to on the line\r
856  */\r
857 void mipi_dsih_hal_gen_rd_vc(dsih_ctrl_t * instance, uint8_t vc)\r
858 {\r
859         mipi_dsih_write_part(instance, R_DSI_HOST_GEN_VCID, vc, 0, 2);\r
860 }\r
861 /**\r
862  * Enable EOTp reception\r
863  * @param instance pointer to structure holding the DSI Host core information\r
864  * @param enable\r
865  */\r
866 void mipi_dsih_hal_gen_eotp_rx_en(dsih_ctrl_t * instance, int enable)\r
867 {\r
868         mipi_dsih_write_part(instance, R_DSI_HOST_PCKHDL_CFG, enable, 1, 1);\r
869 }\r
870 /**\r
871  * Enable EOTp transmission\r
872  * @param instance pointer to structure holding the DSI Host core information\r
873  * @param enable\r
874  */\r
875 void mipi_dsih_hal_gen_eotp_tx_en(dsih_ctrl_t * instance, int enable)\r
876 {\r
877         mipi_dsih_write_part(instance, R_DSI_HOST_PCKHDL_CFG, enable, 0, 1);\r
878 }\r
879 /**\r
880  * Enable Bus Turn-around request\r
881  * @param instance pointer to structure holding the DSI Host core information\r
882  * @param enable\r
883  */\r
884 void mipi_dsih_hal_bta_en(dsih_ctrl_t * instance, int enable)\r
885 {\r
886         mipi_dsih_write_part(instance, R_DSI_HOST_PCKHDL_CFG, enable, 2, 1);\r
887 }\r
888 /**\r
889  * Enable ECC reception, error correction and reporting\r
890  * @param instance pointer to structure holding the DSI Host core information\r
891  * @param enable\r
892  */\r
893 void mipi_dsih_hal_gen_ecc_rx_en(dsih_ctrl_t * instance, int enable)\r
894 {\r
895         mipi_dsih_write_part(instance, R_DSI_HOST_PCKHDL_CFG, enable, 3, 1);\r
896 }\r
897 /**\r
898  * Enable CRC reception, error reporting\r
899  * @param instance pointer to structure holding the DSI Host core information\r
900  * @param enable\r
901  */\r
902 void mipi_dsih_hal_gen_crc_rx_en(dsih_ctrl_t * instance, int enable)\r
903 {\r
904         mipi_dsih_write_part(instance, R_DSI_HOST_PCKHDL_CFG, enable, 4, 1);\r
905 }\r
906 /**\r
907  * Get status of read command\r
908  * @param instance pointer to structure holding the DSI Host core information\r
909  * @return 1 if busy\r
910  */\r
911 int mipi_dsih_hal_gen_rd_cmd_busy(dsih_ctrl_t * instance)\r
912 {\r
913         return mipi_dsih_read_part(instance, R_DSI_HOST_CMD_PKT_STATUS, 6, 1);\r
914 }\r
915 /**\r
916  * Get the FULL status of generic read payload fifo\r
917  * @param instance pointer to structure holding the DSI Host core information\r
918  * @return 1 if fifo full\r
919  */\r
920 int mipi_dsih_hal_gen_read_fifo_full(dsih_ctrl_t * instance)\r
921 {\r
922         return mipi_dsih_read_part(instance, R_DSI_HOST_CMD_PKT_STATUS, 5, 1);\r
923 }\r
924 /**\r
925  * Get the EMPTY status of generic read payload fifo\r
926  * @param instance pointer to structure holding the DSI Host core information\r
927  * @return 1 if fifo empty\r
928  */\r
929 int mipi_dsih_hal_gen_read_fifo_empty(dsih_ctrl_t * instance)\r
930 {\r
931         return mipi_dsih_read_part(instance, R_DSI_HOST_CMD_PKT_STATUS, 4, 1);\r
932 }\r
933 /**\r
934  * Get the FULL status of generic write payload fifo\r
935  * @param instance pointer to structure holding the DSI Host core information\r
936  * @return 1 if fifo full\r
937  */\r
938 int mipi_dsih_hal_gen_write_fifo_full(dsih_ctrl_t * instance)\r
939 {\r
940         return mipi_dsih_read_part(instance, R_DSI_HOST_CMD_PKT_STATUS, 3, 1);\r
941 }\r
942 /**\r
943  * Get the EMPTY status of generic write payload fifo\r
944  * @param instance pointer to structure holding the DSI Host core information\r
945  * @return 1 if fifo empty\r
946  */\r
947 int mipi_dsih_hal_gen_write_fifo_empty(dsih_ctrl_t * instance)\r
948 {\r
949         return mipi_dsih_read_part(instance, R_DSI_HOST_CMD_PKT_STATUS, 2, 1);\r
950 }\r
951 /**\r
952  * Get the FULL status of generic command fifo\r
953  * @param instance pointer to structure holding the DSI Host core information\r
954  * @return 1 if fifo full\r
955  */\r
956 int mipi_dsih_hal_gen_cmd_fifo_full(dsih_ctrl_t * instance)\r
957 {\r
958         return mipi_dsih_read_part(instance, R_DSI_HOST_CMD_PKT_STATUS, 1, 1);\r
959 }\r
960 /**\r
961  * Get the EMPTY status of generic command fifo\r
962  * @param instance pointer to structure holding the DSI Host core information\r
963  * @return 1 if fifo empty\r
964  */\r
965 int mipi_dsih_hal_gen_cmd_fifo_empty(dsih_ctrl_t * instance)\r
966 {\r
967         return mipi_dsih_read_part(instance, R_DSI_HOST_CMD_PKT_STATUS, 0, 1);\r
968 }\r
969 /* only if DPI */\r
970 /**\r
971  * Configure how many cycles of byte clock would the PHY module take\r
972  * to switch data lane from high speed to low power\r
973  * @param instance pointer to structure holding the DSI Host core information\r
974  * @param no_of_byte_cycles\r
975  * @return error code\r
976  */\r
977 dsih_error_t mipi_dsih_phy_hs2lp_config(dsih_ctrl_t * instance, uint8_t no_of_byte_cycles)\r
978 {\r
979         mipi_dsih_write_part(instance, R_DSI_HOST_PHY_TMR_CFG, no_of_byte_cycles, 24, 8);\r
980         return OK;\r
981 }\r
982 /**\r
983  * Configure how many cycles of byte clock would the PHY module take\r
984  * to switch the data lane from to low power high speed\r
985  * @param instance pointer to structure holding the DSI Host core information\r
986  * @param no_of_byte_cycles\r
987  * @return error code\r
988  */\r
989 dsih_error_t mipi_dsih_phy_lp2hs_config(dsih_ctrl_t * instance, uint8_t no_of_byte_cycles)\r
990 {\r
991         mipi_dsih_write_part(instance, R_DSI_HOST_PHY_TMR_CFG, no_of_byte_cycles, 16, 8);\r
992         return OK;\r
993 }\r
994 /**\r
995  * Configure how many cycles of byte clock would the PHY module take\r
996  * to switch clock lane from high speed to low power\r
997  * @param instance pointer to structure holding the DSI Host core information\r
998  * @param no_of_byte_cycles\r
999  * @return error code\r
1000  */\r
1001 dsih_error_t mipi_dsih_phy_clk_hs2lp_config(dsih_ctrl_t * instance, uint8_t no_of_byte_cycles)\r
1002 {\r
1003         mipi_dsih_write_part(instance, R_DSI_HOST_PHY_TMR_LPCLK_CFG, no_of_byte_cycles, 16, 10);\r
1004         return OK;\r
1005 }\r
1006 /**\r
1007  * Configure how many cycles of byte clock would the PHY module take\r
1008  * to switch clock lane from to low power high speed\r
1009  * @param instance pointer to structure holding the DSI Host core information\r
1010  * @param no_of_byte_cycles\r
1011  * @return error code\r
1012  */\r
1013 dsih_error_t mipi_dsih_phy_clk_lp2hs_config(dsih_ctrl_t * instance, uint8_t no_of_byte_cycles)\r
1014 {\r
1015         mipi_dsih_write_part(instance, R_DSI_HOST_PHY_TMR_LPCLK_CFG, no_of_byte_cycles, 0, 10);\r
1016         return OK;\r
1017 }\r
1018 /**\r
1019  * Configure how many cycles of byte clock would the PHY module take\r
1020  * to turn the bus around to start receiving\r
1021  * @param instance pointer to structure holding the DSI Host core information\r
1022  * @param no_of_byte_cycles\r
1023  * @return error code\r
1024  */\r
1025 dsih_error_t mipi_dsih_phy_bta_time(dsih_ctrl_t * instance, uint16_t no_of_byte_cycles)\r
1026 {\r
1027         /*Jessica modified: From ASIC, the second table in spec is correct, this 15 bits are max rd time*/\r
1028         if (no_of_byte_cycles < 0x8000) /* 15-bit field */\r
1029         {\r
1030         //mipi_dsih_write_part(instance, R_DSI_HOST_PHY_TMR_CFG, no_of_byte_cycles, 0, 12);\r
1031                 mipi_dsih_write_part(instance, R_DSI_HOST_PHY_TMR_CFG, no_of_byte_cycles, 0, 15);\r
1032         }\r
1033         else\r
1034         {\r
1035                 return ERR_DSI_OVERFLOW;\r
1036         }\r
1037         return OK;\r
1038 }\r
1039 /**\r
1040  * Enable the automatic mechanism to stop providing clock in the clock\r
1041  * lane when time allows\r
1042  * @param instance pointer to structure holding the DSI Host core information\r
1043  * @param enable\r
1044  * @return error code\r
1045  */\r
1046 void mipi_dsih_non_continuous_clock(dsih_ctrl_t * instance, int enable)\r
1047 {\r
1048         mipi_dsih_write_part(instance, R_DSI_HOST_LPCLK_CTRL, enable, 1, 1);\r
1049 }\r
1050 /**\r
1051  * Get the status of the automatic mechanism to stop providing clock in the\r
1052  * clock lane when time allows\r
1053  * @param instance pointer to structure holding the DSI Host core information\r
1054  * @return status 1 (enabled) 0 (disabled)\r
1055  */\r
1056 int mipi_dsih_non_continuous_clock_status(dsih_ctrl_t * instance)\r
1057 {\r
1058         return mipi_dsih_read_part(instance, R_DSI_HOST_LPCLK_CTRL, 1, 1);\r
1059 }\r
1060 /* PRESP Time outs */\r
1061 /**\r
1062  * Timeout for peripheral (for controller to stay still) after LP data\r
1063  * transmission write requests\r
1064  * @param instance pointer to structure holding the DSI Host core information\r
1065  * @param no_of_byte_cycles period for which the DWC_mipi_dsi_host keeps the\r
1066  * link still, after sending a low power write operation. This period is\r
1067  * measured in cycles of lanebyteclk\r
1068  */\r
1069 void mipi_dsih_hal_presp_timeout_low_power_write(dsih_ctrl_t * instance, uint16_t no_of_byte_cycles)\r
1070 {\r
1071         mipi_dsih_write_part(instance, R_DSI_HOST_LP_WR_TO_CNT, no_of_byte_cycles, 0, 16);\r
1072 }\r
1073 /**\r
1074  * Timeout for peripheral (for controller to stay still) after LP data\r
1075  * transmission read requests\r
1076  * @param instance pointer to structure holding the DSI Host core information\r
1077  * @param no_of_byte_cycles period for which the DWC_mipi_dsi_host keeps the\r
1078  * link still, after sending a low power read operation. This period is\r
1079  * measured in cycles of lanebyteclk\r
1080  */\r
1081 void mipi_dsih_hal_presp_timeout_low_power_read(dsih_ctrl_t * instance, uint16_t no_of_byte_cycles)\r
1082 {\r
1083         mipi_dsih_write_part(instance, R_DSI_HOST_LP_RD_TO_CNT, no_of_byte_cycles, 0, 16);\r
1084 }\r
1085 /**\r
1086  * Timeout for peripheral (for controller to stay still) after HS data\r
1087  * transmission write requests\r
1088  * @param instance pointer to structure holding the DSI Host core information\r
1089  * @param no_of_byte_cycles period for which the DWC_mipi_dsi_host keeps the\r
1090  * link still, after sending a high-speed write operation. This period is\r
1091  * measured in cycles of lanebyteclk\r
1092  */\r
1093 void mipi_dsih_hal_presp_timeout_high_speed_write(dsih_ctrl_t * instance, uint16_t no_of_byte_cycles)\r
1094 {\r
1095         mipi_dsih_write_part(instance, R_DSI_HOST_HS_WR_TO_CNT, no_of_byte_cycles, 0, 16);\r
1096 }\r
1097 /**\r
1098  * Timeout for peripheral between HS data transmission read requests\r
1099  * @param instance pointer to structure holding the DSI Host core information\r
1100  * @param no_of_byte_cycles period for which the DWC_mipi_dsi_host keeps the\r
1101  * link still, after sending a high-speed read operation. This period is\r
1102  * measured in cycles of lanebyteclk\r
1103  */\r
1104 void mipi_dsih_hal_presp_timeout_high_speed_read(dsih_ctrl_t * instance, uint16_t no_of_byte_cycles)\r
1105 {\r
1106         mipi_dsih_write_part(instance, R_DSI_HOST_HS_RD_TO_CNT, no_of_byte_cycles, 0, 16);\r
1107 }\r
1108 /**\r
1109  * Timeout for peripheral (for controller to stay still) after bus turn around\r
1110  * @param instance pointer to structure holding the DSI Host core information\r
1111  * @param no_of_byte_cycles period for which the DWC_mipi_dsi_host keeps the\r
1112  * link still, after sending a BTA operation. This period is\r
1113  * measured in cycles of lanebyteclk\r
1114  */\r
1115 void mipi_dsih_hal_presp_timeout_bta(dsih_ctrl_t * instance, uint16_t no_of_byte_cycles)\r
1116 {\r
1117         mipi_dsih_write_part(instance, R_DSI_HOST_BTA_TO_CNT, no_of_byte_cycles, 0, 16);\r
1118 }\r