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