Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 1 | /* |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 2 | * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #ifndef _DSI_CTRL_HW_H_ |
| 15 | #define _DSI_CTRL_HW_H_ |
| 16 | |
| 17 | #include <linux/kernel.h> |
| 18 | #include <linux/types.h> |
| 19 | #include <linux/bitops.h> |
| 20 | #include <linux/bitmap.h> |
| 21 | |
| 22 | #include "dsi_defs.h" |
| 23 | |
| 24 | /** |
| 25 | * Modifier flag for command transmission. If this flag is set, command |
| 26 | * information is programmed to hardware and transmission is not triggered. |
| 27 | * Caller should call the trigger_command_dma() to start the transmission. This |
| 28 | * flag is valed for kickoff_command() and kickoff_fifo_command() operations. |
| 29 | */ |
| 30 | #define DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER 0x1 |
| 31 | |
| 32 | /** |
| 33 | * enum dsi_ctrl_version - version of the dsi host controller |
| 34 | * @DSI_CTRL_VERSION_UNKNOWN: Unknown controller version |
| 35 | * @DSI_CTRL_VERSION_1_4: DSI host v1.4 controller |
| 36 | * @DSI_CTRL_VERSION_2_0: DSI host v2.0 controller |
| 37 | * @DSI_CTRL_VERSION_MAX: max version |
| 38 | */ |
| 39 | enum dsi_ctrl_version { |
| 40 | DSI_CTRL_VERSION_UNKNOWN, |
| 41 | DSI_CTRL_VERSION_1_4, |
| 42 | DSI_CTRL_VERSION_2_0, |
Shashank Babu Chinta Venkata | afef820 | 2017-04-21 13:49:56 -0700 | [diff] [blame] | 43 | DSI_CTRL_VERSION_2_2, |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 44 | DSI_CTRL_VERSION_MAX |
| 45 | }; |
| 46 | |
| 47 | /** |
| 48 | * enum dsi_ctrl_hw_features - features supported by dsi host controller |
| 49 | * @DSI_CTRL_VIDEO_TPG: Test pattern support for video mode. |
| 50 | * @DSI_CTRL_CMD_TPG: Test pattern support for command mode. |
| 51 | * @DSI_CTRL_VARIABLE_REFRESH_RATE: variable panel timing |
| 52 | * @DSI_CTRL_DYNAMIC_REFRESH: variable pixel clock rate |
| 53 | * @DSI_CTRL_NULL_PACKET_INSERTION: NULL packet insertion |
| 54 | * @DSI_CTRL_DESKEW_CALIB: Deskew calibration support |
| 55 | * @DSI_CTRL_DPHY: Controller support for DPHY |
| 56 | * @DSI_CTRL_CPHY: Controller support for CPHY |
| 57 | * @DSI_CTRL_MAX_FEATURES: |
| 58 | */ |
| 59 | enum dsi_ctrl_hw_features { |
| 60 | DSI_CTRL_VIDEO_TPG, |
| 61 | DSI_CTRL_CMD_TPG, |
| 62 | DSI_CTRL_VARIABLE_REFRESH_RATE, |
| 63 | DSI_CTRL_DYNAMIC_REFRESH, |
| 64 | DSI_CTRL_NULL_PACKET_INSERTION, |
| 65 | DSI_CTRL_DESKEW_CALIB, |
| 66 | DSI_CTRL_DPHY, |
| 67 | DSI_CTRL_CPHY, |
| 68 | DSI_CTRL_MAX_FEATURES |
| 69 | }; |
| 70 | |
| 71 | /** |
| 72 | * enum dsi_test_pattern - test pattern type |
| 73 | * @DSI_TEST_PATTERN_FIXED: Test pattern is fixed, based on init value. |
| 74 | * @DSI_TEST_PATTERN_INC: Incremental test pattern, base on init value. |
| 75 | * @DSI_TEST_PATTERN_POLY: Pattern generated from polynomial and init val. |
| 76 | * @DSI_TEST_PATTERN_MAX: |
| 77 | */ |
| 78 | enum dsi_test_pattern { |
| 79 | DSI_TEST_PATTERN_FIXED = 0, |
| 80 | DSI_TEST_PATTERN_INC, |
| 81 | DSI_TEST_PATTERN_POLY, |
| 82 | DSI_TEST_PATTERN_MAX |
| 83 | }; |
| 84 | |
| 85 | /** |
Clarence Ip | 80ada7f | 2017-05-04 09:55:21 -0700 | [diff] [blame] | 86 | * enum dsi_status_int_index - index of interrupts generated by DSI controller |
| 87 | * @DSI_SINT_CMD_MODE_DMA_DONE: Command mode DMA packets are sent out. |
| 88 | * @DSI_SINT_CMD_STREAM0_FRAME_DONE: A frame of cmd mode stream0 is sent out. |
| 89 | * @DSI_SINT_CMD_STREAM1_FRAME_DONE: A frame of cmd mode stream1 is sent out. |
| 90 | * @DSI_SINT_CMD_STREAM2_FRAME_DONE: A frame of cmd mode stream2 is sent out. |
| 91 | * @DSI_SINT_VIDEO_MODE_FRAME_DONE: A frame of video mode stream is sent out. |
| 92 | * @DSI_SINT_BTA_DONE: A BTA is completed. |
| 93 | * @DSI_SINT_CMD_FRAME_DONE: A frame of selected cmd mode stream is |
| 94 | * sent out by MDP. |
| 95 | * @DSI_SINT_DYN_REFRESH_DONE: The dynamic refresh operation completed. |
| 96 | * @DSI_SINT_DESKEW_DONE: The deskew calibration operation done. |
| 97 | * @DSI_SINT_DYN_BLANK_DMA_DONE: The dynamic blankin DMA operation has |
| 98 | * completed. |
Sandeep Panda | 11b20d8 | 2017-06-19 12:57:27 +0530 | [diff] [blame] | 99 | * @DSI_SINT_ERROR: DSI error has happened. |
Clarence Ip | 80ada7f | 2017-05-04 09:55:21 -0700 | [diff] [blame] | 100 | */ |
| 101 | enum dsi_status_int_index { |
| 102 | DSI_SINT_CMD_MODE_DMA_DONE = 0, |
| 103 | DSI_SINT_CMD_STREAM0_FRAME_DONE = 1, |
| 104 | DSI_SINT_CMD_STREAM1_FRAME_DONE = 2, |
| 105 | DSI_SINT_CMD_STREAM2_FRAME_DONE = 3, |
| 106 | DSI_SINT_VIDEO_MODE_FRAME_DONE = 4, |
| 107 | DSI_SINT_BTA_DONE = 5, |
| 108 | DSI_SINT_CMD_FRAME_DONE = 6, |
| 109 | DSI_SINT_DYN_REFRESH_DONE = 7, |
| 110 | DSI_SINT_DESKEW_DONE = 8, |
| 111 | DSI_SINT_DYN_BLANK_DMA_DONE = 9, |
Sandeep Panda | 11b20d8 | 2017-06-19 12:57:27 +0530 | [diff] [blame] | 112 | DSI_SINT_ERROR = 10, |
Clarence Ip | 80ada7f | 2017-05-04 09:55:21 -0700 | [diff] [blame] | 113 | |
| 114 | DSI_STATUS_INTERRUPT_COUNT |
| 115 | }; |
| 116 | |
| 117 | /** |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 118 | * enum dsi_status_int_type - status interrupts generated by DSI controller |
| 119 | * @DSI_CMD_MODE_DMA_DONE: Command mode DMA packets are sent out. |
| 120 | * @DSI_CMD_STREAM0_FRAME_DONE: A frame of command mode stream0 is sent out. |
| 121 | * @DSI_CMD_STREAM1_FRAME_DONE: A frame of command mode stream1 is sent out. |
| 122 | * @DSI_CMD_STREAM2_FRAME_DONE: A frame of command mode stream2 is sent out. |
| 123 | * @DSI_VIDEO_MODE_FRAME_DONE: A frame of video mode stream is sent out. |
| 124 | * @DSI_BTA_DONE: A BTA is completed. |
| 125 | * @DSI_CMD_FRAME_DONE: A frame of selected command mode stream is |
| 126 | * sent out by MDP. |
| 127 | * @DSI_DYN_REFRESH_DONE: The dynamic refresh operation has completed. |
| 128 | * @DSI_DESKEW_DONE: The deskew calibration operation has completed |
| 129 | * @DSI_DYN_BLANK_DMA_DONE: The dynamic blankin DMA operation has |
| 130 | * completed. |
Sandeep Panda | 11b20d8 | 2017-06-19 12:57:27 +0530 | [diff] [blame] | 131 | * @DSI_ERROR: DSI error has happened. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 132 | */ |
| 133 | enum dsi_status_int_type { |
Clarence Ip | 80ada7f | 2017-05-04 09:55:21 -0700 | [diff] [blame] | 134 | DSI_CMD_MODE_DMA_DONE = BIT(DSI_SINT_CMD_MODE_DMA_DONE), |
| 135 | DSI_CMD_STREAM0_FRAME_DONE = BIT(DSI_SINT_CMD_STREAM0_FRAME_DONE), |
| 136 | DSI_CMD_STREAM1_FRAME_DONE = BIT(DSI_SINT_CMD_STREAM1_FRAME_DONE), |
| 137 | DSI_CMD_STREAM2_FRAME_DONE = BIT(DSI_SINT_CMD_STREAM2_FRAME_DONE), |
| 138 | DSI_VIDEO_MODE_FRAME_DONE = BIT(DSI_SINT_VIDEO_MODE_FRAME_DONE), |
| 139 | DSI_BTA_DONE = BIT(DSI_SINT_BTA_DONE), |
| 140 | DSI_CMD_FRAME_DONE = BIT(DSI_SINT_CMD_FRAME_DONE), |
| 141 | DSI_DYN_REFRESH_DONE = BIT(DSI_SINT_DYN_REFRESH_DONE), |
| 142 | DSI_DESKEW_DONE = BIT(DSI_SINT_DESKEW_DONE), |
Sandeep Panda | 11b20d8 | 2017-06-19 12:57:27 +0530 | [diff] [blame] | 143 | DSI_DYN_BLANK_DMA_DONE = BIT(DSI_SINT_DYN_BLANK_DMA_DONE), |
| 144 | DSI_ERROR = BIT(DSI_SINT_ERROR) |
Clarence Ip | 80ada7f | 2017-05-04 09:55:21 -0700 | [diff] [blame] | 145 | }; |
| 146 | |
| 147 | /** |
| 148 | * enum dsi_error_int_index - index of error interrupts from DSI controller |
| 149 | * @DSI_EINT_RDBK_SINGLE_ECC_ERR: Single bit ECC error in read packet. |
| 150 | * @DSI_EINT_RDBK_MULTI_ECC_ERR: Multi bit ECC error in read packet. |
| 151 | * @DSI_EINT_RDBK_CRC_ERR: CRC error in read packet. |
| 152 | * @DSI_EINT_RDBK_INCOMPLETE_PKT: Incomplete read packet. |
| 153 | * @DSI_EINT_PERIPH_ERROR_PKT: Error packet returned from peripheral, |
| 154 | * @DSI_EINT_LP_RX_TIMEOUT: Low power reverse transmission timeout. |
| 155 | * @DSI_EINT_HS_TX_TIMEOUT: High speed fwd transmission timeout. |
| 156 | * @DSI_EINT_BTA_TIMEOUT: BTA timeout. |
| 157 | * @DSI_EINT_PLL_UNLOCK: PLL has unlocked. |
| 158 | * @DSI_EINT_DLN0_ESC_ENTRY_ERR: Incorrect LP Rx escape entry. |
| 159 | * @DSI_EINT_DLN0_ESC_SYNC_ERR: LP Rx data is not byte aligned. |
| 160 | * @DSI_EINT_DLN0_LP_CONTROL_ERR: Incorrect LP Rx state sequence. |
| 161 | * @DSI_EINT_PENDING_HS_TX_TIMEOUT: Pending High-speed transfer timeout. |
| 162 | * @DSI_EINT_INTERLEAVE_OP_CONTENTION: Interleave operation contention. |
| 163 | * @DSI_EINT_CMD_DMA_FIFO_UNDERFLOW: Command mode DMA FIFO underflow. |
| 164 | * @DSI_EINT_CMD_MDP_FIFO_UNDERFLOW: Command MDP FIFO underflow (failed to |
| 165 | * receive one complete line from MDP). |
| 166 | * @DSI_EINT_DLN0_HS_FIFO_OVERFLOW: High speed FIFO data lane 0 overflows. |
| 167 | * @DSI_EINT_DLN1_HS_FIFO_OVERFLOW: High speed FIFO data lane 1 overflows. |
| 168 | * @DSI_EINT_DLN2_HS_FIFO_OVERFLOW: High speed FIFO data lane 2 overflows. |
| 169 | * @DSI_EINT_DLN3_HS_FIFO_OVERFLOW: High speed FIFO data lane 3 overflows. |
| 170 | * @DSI_EINT_DLN0_HS_FIFO_UNDERFLOW: High speed FIFO data lane 0 underflows. |
| 171 | * @DSI_EINT_DLN1_HS_FIFO_UNDERFLOW: High speed FIFO data lane 1 underflows. |
| 172 | * @DSI_EINT_DLN2_HS_FIFO_UNDERFLOW: High speed FIFO data lane 2 underflows. |
| 173 | * @DSI_EINT_DLN3_HS_FIFO_UNDERFLOW: High speed FIFO data lane 3 undeflows. |
| 174 | * @DSI_EINT_DLN0_LP0_CONTENTION: PHY level contention while lane 0 low. |
| 175 | * @DSI_EINT_DLN1_LP0_CONTENTION: PHY level contention while lane 1 low. |
| 176 | * @DSI_EINT_DLN2_LP0_CONTENTION: PHY level contention while lane 2 low. |
| 177 | * @DSI_EINT_DLN3_LP0_CONTENTION: PHY level contention while lane 3 low. |
| 178 | * @DSI_EINT_DLN0_LP1_CONTENTION: PHY level contention while lane 0 high. |
| 179 | * @DSI_EINT_DLN1_LP1_CONTENTION: PHY level contention while lane 1 high. |
| 180 | * @DSI_EINT_DLN2_LP1_CONTENTION: PHY level contention while lane 2 high. |
| 181 | * @DSI_EINT_DLN3_LP1_CONTENTION: PHY level contention while lane 3 high. |
Sandeep Panda | 11b20d8 | 2017-06-19 12:57:27 +0530 | [diff] [blame] | 182 | * @DSI_EINT_PANEL_SPECIFIC_ERR: DSI Protocol violation error. |
Clarence Ip | 80ada7f | 2017-05-04 09:55:21 -0700 | [diff] [blame] | 183 | */ |
| 184 | enum dsi_error_int_index { |
| 185 | DSI_EINT_RDBK_SINGLE_ECC_ERR = 0, |
| 186 | DSI_EINT_RDBK_MULTI_ECC_ERR = 1, |
| 187 | DSI_EINT_RDBK_CRC_ERR = 2, |
| 188 | DSI_EINT_RDBK_INCOMPLETE_PKT = 3, |
| 189 | DSI_EINT_PERIPH_ERROR_PKT = 4, |
| 190 | DSI_EINT_LP_RX_TIMEOUT = 5, |
| 191 | DSI_EINT_HS_TX_TIMEOUT = 6, |
| 192 | DSI_EINT_BTA_TIMEOUT = 7, |
| 193 | DSI_EINT_PLL_UNLOCK = 8, |
| 194 | DSI_EINT_DLN0_ESC_ENTRY_ERR = 9, |
| 195 | DSI_EINT_DLN0_ESC_SYNC_ERR = 10, |
| 196 | DSI_EINT_DLN0_LP_CONTROL_ERR = 11, |
| 197 | DSI_EINT_PENDING_HS_TX_TIMEOUT = 12, |
| 198 | DSI_EINT_INTERLEAVE_OP_CONTENTION = 13, |
| 199 | DSI_EINT_CMD_DMA_FIFO_UNDERFLOW = 14, |
| 200 | DSI_EINT_CMD_MDP_FIFO_UNDERFLOW = 15, |
| 201 | DSI_EINT_DLN0_HS_FIFO_OVERFLOW = 16, |
| 202 | DSI_EINT_DLN1_HS_FIFO_OVERFLOW = 17, |
| 203 | DSI_EINT_DLN2_HS_FIFO_OVERFLOW = 18, |
| 204 | DSI_EINT_DLN3_HS_FIFO_OVERFLOW = 19, |
| 205 | DSI_EINT_DLN0_HS_FIFO_UNDERFLOW = 20, |
| 206 | DSI_EINT_DLN1_HS_FIFO_UNDERFLOW = 21, |
| 207 | DSI_EINT_DLN2_HS_FIFO_UNDERFLOW = 22, |
| 208 | DSI_EINT_DLN3_HS_FIFO_UNDERFLOW = 23, |
| 209 | DSI_EINT_DLN0_LP0_CONTENTION = 24, |
| 210 | DSI_EINT_DLN1_LP0_CONTENTION = 25, |
| 211 | DSI_EINT_DLN2_LP0_CONTENTION = 26, |
| 212 | DSI_EINT_DLN3_LP0_CONTENTION = 27, |
| 213 | DSI_EINT_DLN0_LP1_CONTENTION = 28, |
| 214 | DSI_EINT_DLN1_LP1_CONTENTION = 29, |
| 215 | DSI_EINT_DLN2_LP1_CONTENTION = 30, |
| 216 | DSI_EINT_DLN3_LP1_CONTENTION = 31, |
Sandeep Panda | 11b20d8 | 2017-06-19 12:57:27 +0530 | [diff] [blame] | 217 | DSI_EINT_PANEL_SPECIFIC_ERR = 32, |
Clarence Ip | 80ada7f | 2017-05-04 09:55:21 -0700 | [diff] [blame] | 218 | |
| 219 | DSI_ERROR_INTERRUPT_COUNT |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | /** |
| 223 | * enum dsi_error_int_type - error interrupts generated by DSI controller |
| 224 | * @DSI_RDBK_SINGLE_ECC_ERR: Single bit ECC error in read packet. |
| 225 | * @DSI_RDBK_MULTI_ECC_ERR: Multi bit ECC error in read packet. |
| 226 | * @DSI_RDBK_CRC_ERR: CRC error in read packet. |
| 227 | * @DSI_RDBK_INCOMPLETE_PKT: Incomplete read packet. |
| 228 | * @DSI_PERIPH_ERROR_PKT: Error packet returned from peripheral, |
| 229 | * @DSI_LP_RX_TIMEOUT: Low power reverse transmission timeout. |
| 230 | * @DSI_HS_TX_TIMEOUT: High speed forward transmission timeout. |
| 231 | * @DSI_BTA_TIMEOUT: BTA timeout. |
| 232 | * @DSI_PLL_UNLOCK: PLL has unlocked. |
| 233 | * @DSI_DLN0_ESC_ENTRY_ERR: Incorrect LP Rx escape entry. |
| 234 | * @DSI_DLN0_ESC_SYNC_ERR: LP Rx data is not byte aligned. |
| 235 | * @DSI_DLN0_LP_CONTROL_ERR: Incorrect LP Rx state sequence. |
| 236 | * @DSI_PENDING_HS_TX_TIMEOUT: Pending High-speed transfer timeout. |
| 237 | * @DSI_INTERLEAVE_OP_CONTENTION: Interleave operation contention. |
| 238 | * @DSI_CMD_DMA_FIFO_UNDERFLOW: Command mode DMA FIFO underflow. |
| 239 | * @DSI_CMD_MDP_FIFO_UNDERFLOW: Command MDP FIFO underflow (failed to |
| 240 | * receive one complete line from MDP). |
| 241 | * @DSI_DLN0_HS_FIFO_OVERFLOW: High speed FIFO for data lane 0 overflows. |
| 242 | * @DSI_DLN1_HS_FIFO_OVERFLOW: High speed FIFO for data lane 1 overflows. |
| 243 | * @DSI_DLN2_HS_FIFO_OVERFLOW: High speed FIFO for data lane 2 overflows. |
| 244 | * @DSI_DLN3_HS_FIFO_OVERFLOW: High speed FIFO for data lane 3 overflows. |
| 245 | * @DSI_DLN0_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 0 underflows. |
| 246 | * @DSI_DLN1_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 1 underflows. |
| 247 | * @DSI_DLN2_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 2 underflows. |
| 248 | * @DSI_DLN3_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 3 undeflows. |
| 249 | * @DSI_DLN0_LP0_CONTENTION: PHY level contention while lane 0 is low. |
| 250 | * @DSI_DLN1_LP0_CONTENTION: PHY level contention while lane 1 is low. |
| 251 | * @DSI_DLN2_LP0_CONTENTION: PHY level contention while lane 2 is low. |
| 252 | * @DSI_DLN3_LP0_CONTENTION: PHY level contention while lane 3 is low. |
| 253 | * @DSI_DLN0_LP1_CONTENTION: PHY level contention while lane 0 is high. |
| 254 | * @DSI_DLN1_LP1_CONTENTION: PHY level contention while lane 1 is high. |
| 255 | * @DSI_DLN2_LP1_CONTENTION: PHY level contention while lane 2 is high. |
| 256 | * @DSI_DLN3_LP1_CONTENTION: PHY level contention while lane 3 is high. |
Sandeep Panda | 11b20d8 | 2017-06-19 12:57:27 +0530 | [diff] [blame] | 257 | * @DSI_PANEL_SPECIFIC_ERR: DSI Protocol violation. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 258 | */ |
| 259 | enum dsi_error_int_type { |
Clarence Ip | 80ada7f | 2017-05-04 09:55:21 -0700 | [diff] [blame] | 260 | DSI_RDBK_SINGLE_ECC_ERR = BIT(DSI_EINT_RDBK_SINGLE_ECC_ERR), |
| 261 | DSI_RDBK_MULTI_ECC_ERR = BIT(DSI_EINT_RDBK_MULTI_ECC_ERR), |
| 262 | DSI_RDBK_CRC_ERR = BIT(DSI_EINT_RDBK_CRC_ERR), |
| 263 | DSI_RDBK_INCOMPLETE_PKT = BIT(DSI_EINT_RDBK_INCOMPLETE_PKT), |
| 264 | DSI_PERIPH_ERROR_PKT = BIT(DSI_EINT_PERIPH_ERROR_PKT), |
| 265 | DSI_LP_RX_TIMEOUT = BIT(DSI_EINT_LP_RX_TIMEOUT), |
| 266 | DSI_HS_TX_TIMEOUT = BIT(DSI_EINT_HS_TX_TIMEOUT), |
| 267 | DSI_BTA_TIMEOUT = BIT(DSI_EINT_BTA_TIMEOUT), |
| 268 | DSI_PLL_UNLOCK = BIT(DSI_EINT_PLL_UNLOCK), |
| 269 | DSI_DLN0_ESC_ENTRY_ERR = BIT(DSI_EINT_DLN0_ESC_ENTRY_ERR), |
| 270 | DSI_DLN0_ESC_SYNC_ERR = BIT(DSI_EINT_DLN0_ESC_SYNC_ERR), |
| 271 | DSI_DLN0_LP_CONTROL_ERR = BIT(DSI_EINT_DLN0_LP_CONTROL_ERR), |
| 272 | DSI_PENDING_HS_TX_TIMEOUT = BIT(DSI_EINT_PENDING_HS_TX_TIMEOUT), |
| 273 | DSI_INTERLEAVE_OP_CONTENTION = BIT(DSI_EINT_INTERLEAVE_OP_CONTENTION), |
| 274 | DSI_CMD_DMA_FIFO_UNDERFLOW = BIT(DSI_EINT_CMD_DMA_FIFO_UNDERFLOW), |
| 275 | DSI_CMD_MDP_FIFO_UNDERFLOW = BIT(DSI_EINT_CMD_MDP_FIFO_UNDERFLOW), |
| 276 | DSI_DLN0_HS_FIFO_OVERFLOW = BIT(DSI_EINT_DLN0_HS_FIFO_OVERFLOW), |
| 277 | DSI_DLN1_HS_FIFO_OVERFLOW = BIT(DSI_EINT_DLN1_HS_FIFO_OVERFLOW), |
| 278 | DSI_DLN2_HS_FIFO_OVERFLOW = BIT(DSI_EINT_DLN2_HS_FIFO_OVERFLOW), |
| 279 | DSI_DLN3_HS_FIFO_OVERFLOW = BIT(DSI_EINT_DLN3_HS_FIFO_OVERFLOW), |
| 280 | DSI_DLN0_HS_FIFO_UNDERFLOW = BIT(DSI_EINT_DLN0_HS_FIFO_UNDERFLOW), |
| 281 | DSI_DLN1_HS_FIFO_UNDERFLOW = BIT(DSI_EINT_DLN1_HS_FIFO_UNDERFLOW), |
| 282 | DSI_DLN2_HS_FIFO_UNDERFLOW = BIT(DSI_EINT_DLN2_HS_FIFO_UNDERFLOW), |
| 283 | DSI_DLN3_HS_FIFO_UNDERFLOW = BIT(DSI_EINT_DLN3_HS_FIFO_UNDERFLOW), |
| 284 | DSI_DLN0_LP0_CONTENTION = BIT(DSI_EINT_DLN0_LP0_CONTENTION), |
| 285 | DSI_DLN1_LP0_CONTENTION = BIT(DSI_EINT_DLN1_LP0_CONTENTION), |
| 286 | DSI_DLN2_LP0_CONTENTION = BIT(DSI_EINT_DLN2_LP0_CONTENTION), |
| 287 | DSI_DLN3_LP0_CONTENTION = BIT(DSI_EINT_DLN3_LP0_CONTENTION), |
| 288 | DSI_DLN0_LP1_CONTENTION = BIT(DSI_EINT_DLN0_LP1_CONTENTION), |
| 289 | DSI_DLN1_LP1_CONTENTION = BIT(DSI_EINT_DLN1_LP1_CONTENTION), |
| 290 | DSI_DLN2_LP1_CONTENTION = BIT(DSI_EINT_DLN2_LP1_CONTENTION), |
| 291 | DSI_DLN3_LP1_CONTENTION = BIT(DSI_EINT_DLN3_LP1_CONTENTION), |
Sandeep Panda | 11b20d8 | 2017-06-19 12:57:27 +0530 | [diff] [blame] | 292 | DSI_PANEL_SPECIFIC_ERR = BIT(DSI_EINT_PANEL_SPECIFIC_ERR), |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 293 | }; |
| 294 | |
| 295 | /** |
| 296 | * struct dsi_ctrl_cmd_dma_info - command buffer information |
| 297 | * @offset: IOMMU VA for command buffer address. |
| 298 | * @length: Length of the command buffer. |
Vara Reddy | dbeab89 | 2017-11-17 16:38:16 -0800 | [diff] [blame] | 299 | * @datatype: Datatype of cmd. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 300 | * @en_broadcast: Enable broadcast mode if set to true. |
| 301 | * @is_master: Is master in broadcast mode. |
| 302 | * @use_lpm: Use low power mode for command transmission. |
| 303 | */ |
| 304 | struct dsi_ctrl_cmd_dma_info { |
| 305 | u32 offset; |
| 306 | u32 length; |
Vara Reddy | dbeab89 | 2017-11-17 16:38:16 -0800 | [diff] [blame] | 307 | u8 datatype; |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 308 | bool en_broadcast; |
| 309 | bool is_master; |
| 310 | bool use_lpm; |
| 311 | }; |
| 312 | |
| 313 | /** |
| 314 | * struct dsi_ctrl_cmd_dma_fifo_info - command payload tp be sent using FIFO |
| 315 | * @command: VA for command buffer. |
| 316 | * @size: Size of the command buffer. |
| 317 | * @en_broadcast: Enable broadcast mode if set to true. |
| 318 | * @is_master: Is master in broadcast mode. |
| 319 | * @use_lpm: Use low power mode for command transmission. |
| 320 | */ |
| 321 | struct dsi_ctrl_cmd_dma_fifo_info { |
| 322 | u32 *command; |
| 323 | u32 size; |
| 324 | bool en_broadcast; |
| 325 | bool is_master; |
| 326 | bool use_lpm; |
| 327 | }; |
| 328 | |
| 329 | struct dsi_ctrl_hw; |
| 330 | |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 331 | struct ctrl_ulps_config_ops { |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 332 | /** |
| 333 | * ulps_request() - request ulps entry for specified lanes |
| 334 | * @ctrl: Pointer to the controller host hardware. |
| 335 | * @lanes: ORed list of lanes (enum dsi_data_lanes) which need |
| 336 | * to enter ULPS. |
| 337 | * |
| 338 | * Caller should check if lanes are in ULPS mode by calling |
| 339 | * get_lanes_in_ulps() operation. |
| 340 | */ |
| 341 | void (*ulps_request)(struct dsi_ctrl_hw *ctrl, u32 lanes); |
| 342 | |
| 343 | /** |
| 344 | * ulps_exit() - exit ULPS on specified lanes |
| 345 | * @ctrl: Pointer to the controller host hardware. |
| 346 | * @lanes: ORed list of lanes (enum dsi_data_lanes) which need |
| 347 | * to exit ULPS. |
| 348 | * |
| 349 | * Caller should check if lanes are in active mode by calling |
| 350 | * get_lanes_in_ulps() operation. |
| 351 | */ |
| 352 | void (*ulps_exit)(struct dsi_ctrl_hw *ctrl, u32 lanes); |
| 353 | |
| 354 | /** |
| 355 | * get_lanes_in_ulps() - returns the list of lanes in ULPS mode |
| 356 | * @ctrl: Pointer to the controller host hardware. |
| 357 | * |
| 358 | * Returns an ORed list of lanes (enum dsi_data_lanes) that are in ULPS |
| 359 | * state. If 0 is returned, all the lanes are active. |
| 360 | * |
| 361 | * Return: List of lanes in ULPS state. |
| 362 | */ |
| 363 | u32 (*get_lanes_in_ulps)(struct dsi_ctrl_hw *ctrl); |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 364 | }; |
| 365 | |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 366 | /** |
| 367 | * struct dsi_ctrl_hw_ops - operations supported by dsi host hardware |
| 368 | */ |
| 369 | struct dsi_ctrl_hw_ops { |
| 370 | |
| 371 | /** |
| 372 | * host_setup() - Setup DSI host configuration |
| 373 | * @ctrl: Pointer to controller host hardware. |
| 374 | * @config: Configuration for DSI host controller |
| 375 | */ |
| 376 | void (*host_setup)(struct dsi_ctrl_hw *ctrl, |
| 377 | struct dsi_host_common_cfg *config); |
| 378 | |
| 379 | /** |
| 380 | * video_engine_en() - enable DSI video engine |
| 381 | * @ctrl: Pointer to controller host hardware. |
| 382 | * @on: Enable/disabel video engine. |
| 383 | */ |
| 384 | void (*video_engine_en)(struct dsi_ctrl_hw *ctrl, bool on); |
| 385 | |
| 386 | /** |
| 387 | * video_engine_setup() - Setup dsi host controller for video mode |
| 388 | * @ctrl: Pointer to controller host hardware. |
| 389 | * @common_cfg: Common configuration parameters. |
| 390 | * @cfg: Video mode configuration. |
| 391 | * |
| 392 | * Set up DSI video engine with a specific configuration. Controller and |
| 393 | * video engine are not enabled as part of this function. |
| 394 | */ |
| 395 | void (*video_engine_setup)(struct dsi_ctrl_hw *ctrl, |
| 396 | struct dsi_host_common_cfg *common_cfg, |
| 397 | struct dsi_video_engine_cfg *cfg); |
| 398 | |
| 399 | /** |
| 400 | * set_video_timing() - set up the timing for video frame |
| 401 | * @ctrl: Pointer to controller host hardware. |
| 402 | * @mode: Video mode information. |
| 403 | * |
| 404 | * Set up the video timing parameters for the DSI video mode operation. |
| 405 | */ |
| 406 | void (*set_video_timing)(struct dsi_ctrl_hw *ctrl, |
| 407 | struct dsi_mode_info *mode); |
| 408 | |
| 409 | /** |
| 410 | * cmd_engine_setup() - setup dsi host controller for command mode |
| 411 | * @ctrl: Pointer to the controller host hardware. |
| 412 | * @common_cfg: Common configuration parameters. |
| 413 | * @cfg: Command mode configuration. |
| 414 | * |
| 415 | * Setup DSI CMD engine with a specific configuration. Controller and |
| 416 | * command engine are not enabled as part of this function. |
| 417 | */ |
| 418 | void (*cmd_engine_setup)(struct dsi_ctrl_hw *ctrl, |
| 419 | struct dsi_host_common_cfg *common_cfg, |
| 420 | struct dsi_cmd_engine_cfg *cfg); |
| 421 | |
| 422 | /** |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 423 | * setup_cmd_stream() - set up parameters for command pixel streams |
Alexander Beykun | ac18235 | 2017-02-27 17:46:51 -0500 | [diff] [blame] | 424 | * @ctrl: Pointer to controller host hardware. |
| 425 | * @mode: Pointer to mode information. |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 426 | * @h_stride: Horizontal stride in bytes. |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 427 | * @vc_id: stream_id. |
| 428 | * |
| 429 | * Setup parameters for command mode pixel stream size. |
| 430 | */ |
| 431 | void (*setup_cmd_stream)(struct dsi_ctrl_hw *ctrl, |
Alexander Beykun | ac18235 | 2017-02-27 17:46:51 -0500 | [diff] [blame] | 432 | struct dsi_mode_info *mode, |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 433 | u32 h_stride, |
Lloyd Atkinson | 16e96de | 2017-04-19 11:18:14 -0400 | [diff] [blame] | 434 | u32 vc_id, |
| 435 | struct dsi_rect *roi); |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 436 | |
| 437 | /** |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 438 | * ctrl_en() - enable DSI controller engine |
| 439 | * @ctrl: Pointer to the controller host hardware. |
| 440 | * @on: turn on/off the DSI controller engine. |
| 441 | */ |
| 442 | void (*ctrl_en)(struct dsi_ctrl_hw *ctrl, bool on); |
| 443 | |
| 444 | /** |
| 445 | * cmd_engine_en() - enable DSI controller command engine |
| 446 | * @ctrl: Pointer to the controller host hardware. |
| 447 | * @on: Turn on/off the DSI command engine. |
| 448 | */ |
| 449 | void (*cmd_engine_en)(struct dsi_ctrl_hw *ctrl, bool on); |
| 450 | |
| 451 | /** |
| 452 | * phy_sw_reset() - perform a soft reset on the PHY. |
| 453 | * @ctrl: Pointer to the controller host hardware. |
| 454 | */ |
| 455 | void (*phy_sw_reset)(struct dsi_ctrl_hw *ctrl); |
| 456 | |
| 457 | /** |
Dhaval Patel | f9f3ffe | 2017-08-16 16:03:10 -0700 | [diff] [blame] | 458 | * debug_bus() - get dsi debug bus status. |
| 459 | * @ctrl: Pointer to the controller host hardware. |
| 460 | */ |
| 461 | void (*debug_bus)(struct dsi_ctrl_hw *ctrl); |
| 462 | |
| 463 | /** |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 464 | * soft_reset() - perform a soft reset on DSI controller |
| 465 | * @ctrl: Pointer to the controller host hardware. |
| 466 | * |
Lloyd Atkinson | 8c49c58 | 2016-11-18 14:23:54 -0500 | [diff] [blame] | 467 | * The video, command and controller engines will be disabled before the |
| 468 | * reset is triggered. After, the engines will be re-enabled to the same |
| 469 | * state as before the reset. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 470 | * |
| 471 | * If the reset is done while MDP timing engine is turned on, the video |
Lloyd Atkinson | 8c49c58 | 2016-11-18 14:23:54 -0500 | [diff] [blame] | 472 | * engine should be re-enabled only during the vertical blanking time. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 473 | */ |
| 474 | void (*soft_reset)(struct dsi_ctrl_hw *ctrl); |
| 475 | |
| 476 | /** |
| 477 | * setup_lane_map() - setup mapping between logical and physical lanes |
| 478 | * @ctrl: Pointer to the controller host hardware. |
| 479 | * @lane_map: Structure defining the mapping between DSI logical |
| 480 | * lanes and physical lanes. |
| 481 | */ |
| 482 | void (*setup_lane_map)(struct dsi_ctrl_hw *ctrl, |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 483 | struct dsi_lane_map *lane_map); |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 484 | |
| 485 | /** |
| 486 | * kickoff_command() - transmits commands stored in memory |
| 487 | * @ctrl: Pointer to the controller host hardware. |
| 488 | * @cmd: Command information. |
| 489 | * @flags: Modifiers for command transmission. |
| 490 | * |
| 491 | * The controller hardware is programmed with address and size of the |
| 492 | * command buffer. The transmission is kicked off if |
| 493 | * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag is not set. If this flag is |
| 494 | * set, caller should make a separate call to trigger_command_dma() to |
| 495 | * transmit the command. |
| 496 | */ |
| 497 | void (*kickoff_command)(struct dsi_ctrl_hw *ctrl, |
| 498 | struct dsi_ctrl_cmd_dma_info *cmd, |
| 499 | u32 flags); |
| 500 | |
| 501 | /** |
Vara Reddy | dbeab89 | 2017-11-17 16:38:16 -0800 | [diff] [blame] | 502 | * kickoff_command_non_embedded_mode() - cmd in non embedded mode |
| 503 | * @ctrl: Pointer to the controller host hardware. |
| 504 | * @cmd: Command information. |
| 505 | * @flags: Modifiers for command transmission. |
| 506 | * |
| 507 | * If command length is greater than DMA FIFO size of 256 bytes we use |
| 508 | * this non- embedded mode. |
| 509 | * The controller hardware is programmed with address and size of the |
| 510 | * command buffer. The transmission is kicked off if |
| 511 | * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag is not set. If this flag is |
| 512 | * set, caller should make a separate call to trigger_command_dma() to |
| 513 | * transmit the command. |
| 514 | */ |
| 515 | |
| 516 | void (*kickoff_command_non_embedded_mode)(struct dsi_ctrl_hw *ctrl, |
| 517 | struct dsi_ctrl_cmd_dma_info *cmd, |
| 518 | u32 flags); |
| 519 | |
| 520 | /** |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 521 | * kickoff_fifo_command() - transmits a command using FIFO in dsi |
| 522 | * hardware. |
| 523 | * @ctrl: Pointer to the controller host hardware. |
| 524 | * @cmd: Command information. |
| 525 | * @flags: Modifiers for command transmission. |
| 526 | * |
| 527 | * The controller hardware FIFO is programmed with command header and |
| 528 | * payload. The transmission is kicked off if |
| 529 | * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag is not set. If this flag is |
| 530 | * set, caller should make a separate call to trigger_command_dma() to |
| 531 | * transmit the command. |
| 532 | */ |
| 533 | void (*kickoff_fifo_command)(struct dsi_ctrl_hw *ctrl, |
| 534 | struct dsi_ctrl_cmd_dma_fifo_info *cmd, |
| 535 | u32 flags); |
| 536 | |
| 537 | void (*reset_cmd_fifo)(struct dsi_ctrl_hw *ctrl); |
| 538 | /** |
| 539 | * trigger_command_dma() - trigger transmission of command buffer. |
| 540 | * @ctrl: Pointer to the controller host hardware. |
| 541 | * |
| 542 | * This trigger can be only used if there was a prior call to |
| 543 | * kickoff_command() of kickoff_fifo_command() with |
| 544 | * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag. |
| 545 | */ |
| 546 | void (*trigger_command_dma)(struct dsi_ctrl_hw *ctrl); |
| 547 | |
| 548 | /** |
| 549 | * get_cmd_read_data() - get data read from the peripheral |
| 550 | * @ctrl: Pointer to the controller host hardware. |
| 551 | * @rd_buf: Buffer where data will be read into. |
Sandeep Panda | 7945000 | 2017-05-08 17:14:24 +0530 | [diff] [blame] | 552 | * @read_offset: Offset from where to read. |
| 553 | * @rx_byte: Number of bytes to be read. |
| 554 | * @pkt_size: Size of response expected. |
| 555 | * @hw_read_cnt: Actual number of bytes read by HW. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 556 | */ |
| 557 | u32 (*get_cmd_read_data)(struct dsi_ctrl_hw *ctrl, |
| 558 | u8 *rd_buf, |
Sandeep Panda | 7945000 | 2017-05-08 17:14:24 +0530 | [diff] [blame] | 559 | u32 read_offset, |
| 560 | u32 rx_byte, |
| 561 | u32 pkt_size, |
| 562 | u32 *hw_read_cnt); |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 563 | |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 564 | /** |
Shashank Babu Chinta Venkata | 7d60873 | 2017-05-31 14:10:26 -0700 | [diff] [blame] | 565 | * get_cont_splash_status() - get continuous splash status |
| 566 | * @ctrl: Pointer to the controller host hardware. |
| 567 | */ |
| 568 | bool (*get_cont_splash_status)(struct dsi_ctrl_hw *ctrl); |
| 569 | |
| 570 | /** |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 571 | * wait_for_lane_idle() - wait for DSI lanes to go to idle state |
| 572 | * @ctrl: Pointer to the controller host hardware. |
| 573 | * @lanes: ORed list of lanes (enum dsi_data_lanes) which need |
| 574 | * to be checked to be in idle state. |
| 575 | */ |
| 576 | int (*wait_for_lane_idle)(struct dsi_ctrl_hw *ctrl, u32 lanes); |
| 577 | |
| 578 | struct ctrl_ulps_config_ops ulps_ops; |
| 579 | |
| 580 | /** |
| 581 | * clamp_enable() - enable DSI clamps |
| 582 | * @ctrl: Pointer to the controller host hardware. |
| 583 | * @lanes: ORed list of lanes which need to have clamps released. |
| 584 | * @enable_ulps: ulps state. |
| 585 | */ |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 586 | |
| 587 | /** |
| 588 | * clamp_enable() - enable DSI clamps to keep PHY driving a stable link |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 589 | * @ctrl: Pointer to the controller host hardware. |
| 590 | * @lanes: ORed list of lanes which need to have clamps released. |
| 591 | * @enable_ulps: TODO:?? |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 592 | */ |
| 593 | void (*clamp_enable)(struct dsi_ctrl_hw *ctrl, |
| 594 | u32 lanes, |
| 595 | bool enable_ulps); |
| 596 | |
| 597 | /** |
| 598 | * clamp_disable() - disable DSI clamps |
| 599 | * @ctrl: Pointer to the controller host hardware. |
| 600 | * @lanes: ORed list of lanes which need to have clamps released. |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 601 | * @disable_ulps: ulps state. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 602 | */ |
| 603 | void (*clamp_disable)(struct dsi_ctrl_hw *ctrl, |
| 604 | u32 lanes, |
| 605 | bool disable_ulps); |
| 606 | |
| 607 | /** |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 608 | * phy_reset_config() - Disable/enable propagation of reset signal |
| 609 | * from ahb domain to DSI PHY |
| 610 | * @ctrl: Pointer to the controller host hardware. |
| 611 | * @enable: True to mask the reset signal, false to unmask |
| 612 | */ |
| 613 | void (*phy_reset_config)(struct dsi_ctrl_hw *ctrl, |
| 614 | bool enable); |
| 615 | |
| 616 | /** |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 617 | * get_interrupt_status() - returns the interrupt status |
| 618 | * @ctrl: Pointer to the controller host hardware. |
| 619 | * |
| 620 | * Returns the ORed list of interrupts(enum dsi_status_int_type) that |
| 621 | * are active. This list does not include any error interrupts. Caller |
| 622 | * should call get_error_status for error interrupts. |
| 623 | * |
| 624 | * Return: List of active interrupts. |
| 625 | */ |
| 626 | u32 (*get_interrupt_status)(struct dsi_ctrl_hw *ctrl); |
| 627 | |
| 628 | /** |
| 629 | * clear_interrupt_status() - clears the specified interrupts |
| 630 | * @ctrl: Pointer to the controller host hardware. |
| 631 | * @ints: List of interrupts to be cleared. |
| 632 | */ |
| 633 | void (*clear_interrupt_status)(struct dsi_ctrl_hw *ctrl, u32 ints); |
| 634 | |
| 635 | /** |
| 636 | * enable_status_interrupts() - enable the specified interrupts |
| 637 | * @ctrl: Pointer to the controller host hardware. |
| 638 | * @ints: List of interrupts to be enabled. |
| 639 | * |
| 640 | * Enables the specified interrupts. This list will override the |
| 641 | * previous interrupts enabled through this function. Caller has to |
| 642 | * maintain the state of the interrupts enabled. To disable all |
| 643 | * interrupts, set ints to 0. |
| 644 | */ |
| 645 | void (*enable_status_interrupts)(struct dsi_ctrl_hw *ctrl, u32 ints); |
| 646 | |
| 647 | /** |
| 648 | * get_error_status() - returns the error status |
| 649 | * @ctrl: Pointer to the controller host hardware. |
| 650 | * |
| 651 | * Returns the ORed list of errors(enum dsi_error_int_type) that are |
| 652 | * active. This list does not include any status interrupts. Caller |
| 653 | * should call get_interrupt_status for status interrupts. |
| 654 | * |
| 655 | * Return: List of active error interrupts. |
| 656 | */ |
| 657 | u64 (*get_error_status)(struct dsi_ctrl_hw *ctrl); |
| 658 | |
| 659 | /** |
| 660 | * clear_error_status() - clears the specified errors |
| 661 | * @ctrl: Pointer to the controller host hardware. |
| 662 | * @errors: List of errors to be cleared. |
| 663 | */ |
| 664 | void (*clear_error_status)(struct dsi_ctrl_hw *ctrl, u64 errors); |
| 665 | |
| 666 | /** |
| 667 | * enable_error_interrupts() - enable the specified interrupts |
| 668 | * @ctrl: Pointer to the controller host hardware. |
| 669 | * @errors: List of errors to be enabled. |
| 670 | * |
| 671 | * Enables the specified interrupts. This list will override the |
| 672 | * previous interrupts enabled through this function. Caller has to |
| 673 | * maintain the state of the interrupts enabled. To disable all |
| 674 | * interrupts, set errors to 0. |
| 675 | */ |
| 676 | void (*enable_error_interrupts)(struct dsi_ctrl_hw *ctrl, u64 errors); |
| 677 | |
| 678 | /** |
| 679 | * video_test_pattern_setup() - setup test pattern engine for video mode |
| 680 | * @ctrl: Pointer to the controller host hardware. |
| 681 | * @type: Type of test pattern. |
| 682 | * @init_val: Initial value to use for generating test pattern. |
| 683 | */ |
| 684 | void (*video_test_pattern_setup)(struct dsi_ctrl_hw *ctrl, |
| 685 | enum dsi_test_pattern type, |
| 686 | u32 init_val); |
| 687 | |
| 688 | /** |
| 689 | * cmd_test_pattern_setup() - setup test patttern engine for cmd mode |
| 690 | * @ctrl: Pointer to the controller host hardware. |
| 691 | * @type: Type of test pattern. |
| 692 | * @init_val: Initial value to use for generating test pattern. |
| 693 | * @stream_id: Stream Id on which packets are generated. |
| 694 | */ |
| 695 | void (*cmd_test_pattern_setup)(struct dsi_ctrl_hw *ctrl, |
| 696 | enum dsi_test_pattern type, |
| 697 | u32 init_val, |
| 698 | u32 stream_id); |
| 699 | |
| 700 | /** |
| 701 | * test_pattern_enable() - enable test pattern engine |
| 702 | * @ctrl: Pointer to the controller host hardware. |
| 703 | * @enable: Enable/Disable test pattern engine. |
| 704 | */ |
| 705 | void (*test_pattern_enable)(struct dsi_ctrl_hw *ctrl, bool enable); |
| 706 | |
| 707 | /** |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 708 | * clear_phy0_ln_err() - clear DSI PHY lane-0 errors |
| 709 | * @ctrl: Pointer to the controller host hardware. |
| 710 | */ |
| 711 | void (*clear_phy0_ln_err)(struct dsi_ctrl_hw *ctrl); |
| 712 | |
| 713 | /** |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 714 | * trigger_cmd_test_pattern() - trigger a command mode frame update with |
| 715 | * test pattern |
| 716 | * @ctrl: Pointer to the controller host hardware. |
| 717 | * @stream_id: Stream on which frame update is sent. |
| 718 | */ |
| 719 | void (*trigger_cmd_test_pattern)(struct dsi_ctrl_hw *ctrl, |
| 720 | u32 stream_id); |
Ajay Singh Parmar | 48ea427 | 2016-06-27 11:44:34 -0700 | [diff] [blame] | 721 | |
| 722 | ssize_t (*reg_dump_to_buffer)(struct dsi_ctrl_hw *ctrl, |
| 723 | char *buf, |
| 724 | u32 size); |
Rajkumar Subbiah | 01e6dd64 | 2017-07-05 14:47:47 -0400 | [diff] [blame] | 725 | |
| 726 | /** |
| 727 | * setup_misr() - Setup frame MISR |
| 728 | * @ctrl: Pointer to the controller host hardware. |
| 729 | * @panel_mode: CMD or VIDEO mode indicator |
| 730 | * @enable: Enable/disable MISR. |
| 731 | * @frame_count: Number of frames to accumulate MISR. |
| 732 | */ |
| 733 | void (*setup_misr)(struct dsi_ctrl_hw *ctrl, |
| 734 | enum dsi_op_mode panel_mode, |
| 735 | bool enable, u32 frame_count); |
| 736 | |
| 737 | /** |
| 738 | * collect_misr() - Read frame MISR |
| 739 | * @ctrl: Pointer to the controller host hardware. |
| 740 | * @panel_mode: CMD or VIDEO mode indicator |
| 741 | */ |
| 742 | u32 (*collect_misr)(struct dsi_ctrl_hw *ctrl, |
| 743 | enum dsi_op_mode panel_mode); |
| 744 | |
Raviteja Tamatam | 68892de | 2017-06-20 04:47:19 +0530 | [diff] [blame] | 745 | /** |
| 746 | * set_timing_db() - enable/disable Timing DB register |
| 747 | * @ctrl: Pointer to controller host hardware. |
| 748 | * @enable: Enable/Disable flag. |
| 749 | * |
| 750 | * Enable or Disabe the Timing DB register. |
| 751 | */ |
| 752 | void (*set_timing_db)(struct dsi_ctrl_hw *ctrl, |
| 753 | bool enable); |
Sandeep Panda | 7945000 | 2017-05-08 17:14:24 +0530 | [diff] [blame] | 754 | /** |
| 755 | * clear_rdbk_register() - Clear and reset read back register |
| 756 | * @ctrl: Pointer to the controller host hardware. |
| 757 | */ |
| 758 | void (*clear_rdbk_register)(struct dsi_ctrl_hw *ctrl); |
Sandeep Panda | a2a3c8c | 2017-07-09 02:10:44 +0530 | [diff] [blame] | 759 | |
| 760 | /** schedule_dma_cmd() - Schdeule DMA command transfer on a |
| 761 | * particular blanking line. |
| 762 | * @ctrl: Pointer to the controller host hardware. |
| 763 | * @line_no: Blanking line number on whihch DMA command |
| 764 | * needs to be sent. |
| 765 | */ |
| 766 | void (*schedule_dma_cmd)(struct dsi_ctrl_hw *ctrl, int line_no); |
Sandeep Panda | 11b20d8 | 2017-06-19 12:57:27 +0530 | [diff] [blame] | 767 | |
| 768 | /** |
| 769 | * ctrl_reset() - Reset DSI lanes to recover from DSI errors |
| 770 | * @ctrl: Pointer to the controller host hardware. |
| 771 | * @mask: Indicates the error type. |
| 772 | */ |
| 773 | int (*ctrl_reset)(struct dsi_ctrl_hw *ctrl, int mask); |
| 774 | |
| 775 | /** |
| 776 | * mask_error_int() - Mask/Unmask particular DSI error interrupts |
| 777 | * @ctrl: Pointer to the controller host hardware. |
| 778 | * @idx: Indicates the errors to be masked. |
| 779 | * @en: Bool for mask or unmask of the error |
| 780 | */ |
| 781 | void (*mask_error_intr)(struct dsi_ctrl_hw *ctrl, u32 idx, bool en); |
| 782 | |
| 783 | /** |
| 784 | * error_intr_ctrl() - Mask/Unmask master DSI error interrupt |
| 785 | * @ctrl: Pointer to the controller host hardware. |
| 786 | * @en: Bool for mask or unmask of DSI error |
| 787 | */ |
| 788 | void (*error_intr_ctrl)(struct dsi_ctrl_hw *ctrl, bool en); |
| 789 | |
| 790 | /** |
| 791 | * get_error_mask() - get DSI error interrupt mask status |
| 792 | * @ctrl: Pointer to the controller host hardware. |
| 793 | */ |
| 794 | u32 (*get_error_mask)(struct dsi_ctrl_hw *ctrl); |
| 795 | |
| 796 | /** |
| 797 | * get_hw_version() - get DSI controller hw version |
| 798 | * @ctrl: Pointer to the controller host hardware. |
| 799 | */ |
| 800 | u32 (*get_hw_version)(struct dsi_ctrl_hw *ctrl); |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 801 | }; |
| 802 | |
| 803 | /* |
| 804 | * struct dsi_ctrl_hw - DSI controller hardware object specific to an instance |
Shashank Babu Chinta Venkata | afef820 | 2017-04-21 13:49:56 -0700 | [diff] [blame] | 805 | * @base: VA for the DSI controller base address. |
| 806 | * @length: Length of the DSI controller register map. |
| 807 | * @mmss_misc_base: Base address of mmss_misc register map. |
| 808 | * @mmss_misc_length: Length of mmss_misc register map. |
| 809 | * @disp_cc_base: Base address of disp_cc register map. |
| 810 | * @disp_cc_length: Length of disp_cc register map. |
| 811 | * @index: Instance ID of the controller. |
| 812 | * @feature_map: Features supported by the DSI controller. |
| 813 | * @ops: Function pointers to the operations supported by the |
| 814 | * controller. |
| 815 | * @supported_interrupts: Number of supported interrupts. |
| 816 | * @supported_errors: Number of supported errors. |
Dhaval Patel | abfaa08 | 2017-07-28 12:41:10 -0700 | [diff] [blame] | 817 | * @phy_isolation_enabled: A boolean property allows to isolate the phy from |
| 818 | * dsi controller and run only dsi controller. |
Sravanthi Kollukuduru | d880932 | 2017-10-26 15:24:13 +0530 | [diff] [blame] | 819 | * @null_insertion_enabled: A boolean property to allow dsi controller to |
| 820 | * insert null packet. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 821 | */ |
| 822 | struct dsi_ctrl_hw { |
| 823 | void __iomem *base; |
| 824 | u32 length; |
| 825 | void __iomem *mmss_misc_base; |
| 826 | u32 mmss_misc_length; |
Shashank Babu Chinta Venkata | afef820 | 2017-04-21 13:49:56 -0700 | [diff] [blame] | 827 | void __iomem *disp_cc_base; |
| 828 | u32 disp_cc_length; |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 829 | u32 index; |
| 830 | |
| 831 | /* features */ |
| 832 | DECLARE_BITMAP(feature_map, DSI_CTRL_MAX_FEATURES); |
| 833 | struct dsi_ctrl_hw_ops ops; |
| 834 | |
| 835 | /* capabilities */ |
| 836 | u32 supported_interrupts; |
| 837 | u64 supported_errors; |
Dhaval Patel | abfaa08 | 2017-07-28 12:41:10 -0700 | [diff] [blame] | 838 | |
| 839 | bool phy_isolation_enabled; |
Sravanthi Kollukuduru | d880932 | 2017-10-26 15:24:13 +0530 | [diff] [blame] | 840 | bool null_insertion_enabled; |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 841 | }; |
| 842 | |
| 843 | #endif /* _DSI_CTRL_HW_H_ */ |