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. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #ifndef _DSI_CTRL_HW_H_ |
| 16 | #define _DSI_CTRL_HW_H_ |
| 17 | |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/types.h> |
| 20 | #include <linux/bitops.h> |
| 21 | #include <linux/bitmap.h> |
| 22 | |
| 23 | #include "dsi_defs.h" |
| 24 | |
| 25 | /** |
| 26 | * Modifier flag for command transmission. If this flag is set, command |
| 27 | * information is programmed to hardware and transmission is not triggered. |
| 28 | * Caller should call the trigger_command_dma() to start the transmission. This |
| 29 | * flag is valed for kickoff_command() and kickoff_fifo_command() operations. |
| 30 | */ |
| 31 | #define DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER 0x1 |
| 32 | |
| 33 | /** |
| 34 | * enum dsi_ctrl_version - version of the dsi host controller |
| 35 | * @DSI_CTRL_VERSION_UNKNOWN: Unknown controller version |
| 36 | * @DSI_CTRL_VERSION_1_4: DSI host v1.4 controller |
| 37 | * @DSI_CTRL_VERSION_2_0: DSI host v2.0 controller |
| 38 | * @DSI_CTRL_VERSION_MAX: max version |
| 39 | */ |
| 40 | enum dsi_ctrl_version { |
| 41 | DSI_CTRL_VERSION_UNKNOWN, |
| 42 | DSI_CTRL_VERSION_1_4, |
| 43 | DSI_CTRL_VERSION_2_0, |
Shashank Babu Chinta Venkata | afef820 | 2017-04-21 13:49:56 -0700 | [diff] [blame] | 44 | DSI_CTRL_VERSION_2_2, |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 45 | DSI_CTRL_VERSION_MAX |
| 46 | }; |
| 47 | |
| 48 | /** |
| 49 | * enum dsi_ctrl_hw_features - features supported by dsi host controller |
| 50 | * @DSI_CTRL_VIDEO_TPG: Test pattern support for video mode. |
| 51 | * @DSI_CTRL_CMD_TPG: Test pattern support for command mode. |
| 52 | * @DSI_CTRL_VARIABLE_REFRESH_RATE: variable panel timing |
| 53 | * @DSI_CTRL_DYNAMIC_REFRESH: variable pixel clock rate |
| 54 | * @DSI_CTRL_NULL_PACKET_INSERTION: NULL packet insertion |
| 55 | * @DSI_CTRL_DESKEW_CALIB: Deskew calibration support |
| 56 | * @DSI_CTRL_DPHY: Controller support for DPHY |
| 57 | * @DSI_CTRL_CPHY: Controller support for CPHY |
| 58 | * @DSI_CTRL_MAX_FEATURES: |
| 59 | */ |
| 60 | enum dsi_ctrl_hw_features { |
| 61 | DSI_CTRL_VIDEO_TPG, |
| 62 | DSI_CTRL_CMD_TPG, |
| 63 | DSI_CTRL_VARIABLE_REFRESH_RATE, |
| 64 | DSI_CTRL_DYNAMIC_REFRESH, |
| 65 | DSI_CTRL_NULL_PACKET_INSERTION, |
| 66 | DSI_CTRL_DESKEW_CALIB, |
| 67 | DSI_CTRL_DPHY, |
| 68 | DSI_CTRL_CPHY, |
| 69 | DSI_CTRL_MAX_FEATURES |
| 70 | }; |
| 71 | |
| 72 | /** |
| 73 | * enum dsi_test_pattern - test pattern type |
| 74 | * @DSI_TEST_PATTERN_FIXED: Test pattern is fixed, based on init value. |
| 75 | * @DSI_TEST_PATTERN_INC: Incremental test pattern, base on init value. |
| 76 | * @DSI_TEST_PATTERN_POLY: Pattern generated from polynomial and init val. |
| 77 | * @DSI_TEST_PATTERN_MAX: |
| 78 | */ |
| 79 | enum dsi_test_pattern { |
| 80 | DSI_TEST_PATTERN_FIXED = 0, |
| 81 | DSI_TEST_PATTERN_INC, |
| 82 | DSI_TEST_PATTERN_POLY, |
| 83 | DSI_TEST_PATTERN_MAX |
| 84 | }; |
| 85 | |
| 86 | /** |
| 87 | * enum dsi_status_int_type - status interrupts generated by DSI controller |
| 88 | * @DSI_CMD_MODE_DMA_DONE: Command mode DMA packets are sent out. |
| 89 | * @DSI_CMD_STREAM0_FRAME_DONE: A frame of command mode stream0 is sent out. |
| 90 | * @DSI_CMD_STREAM1_FRAME_DONE: A frame of command mode stream1 is sent out. |
| 91 | * @DSI_CMD_STREAM2_FRAME_DONE: A frame of command mode stream2 is sent out. |
| 92 | * @DSI_VIDEO_MODE_FRAME_DONE: A frame of video mode stream is sent out. |
| 93 | * @DSI_BTA_DONE: A BTA is completed. |
| 94 | * @DSI_CMD_FRAME_DONE: A frame of selected command mode stream is |
| 95 | * sent out by MDP. |
| 96 | * @DSI_DYN_REFRESH_DONE: The dynamic refresh operation has completed. |
| 97 | * @DSI_DESKEW_DONE: The deskew calibration operation has completed |
| 98 | * @DSI_DYN_BLANK_DMA_DONE: The dynamic blankin DMA operation has |
| 99 | * completed. |
| 100 | */ |
| 101 | enum dsi_status_int_type { |
| 102 | DSI_CMD_MODE_DMA_DONE = BIT(0), |
| 103 | DSI_CMD_STREAM0_FRAME_DONE = BIT(1), |
| 104 | DSI_CMD_STREAM1_FRAME_DONE = BIT(2), |
| 105 | DSI_CMD_STREAM2_FRAME_DONE = BIT(3), |
| 106 | DSI_VIDEO_MODE_FRAME_DONE = BIT(4), |
| 107 | DSI_BTA_DONE = BIT(5), |
| 108 | DSI_CMD_FRAME_DONE = BIT(6), |
| 109 | DSI_DYN_REFRESH_DONE = BIT(7), |
| 110 | DSI_DESKEW_DONE = BIT(8), |
| 111 | DSI_DYN_BLANK_DMA_DONE = BIT(9) |
| 112 | }; |
| 113 | |
| 114 | /** |
| 115 | * enum dsi_error_int_type - error interrupts generated by DSI controller |
| 116 | * @DSI_RDBK_SINGLE_ECC_ERR: Single bit ECC error in read packet. |
| 117 | * @DSI_RDBK_MULTI_ECC_ERR: Multi bit ECC error in read packet. |
| 118 | * @DSI_RDBK_CRC_ERR: CRC error in read packet. |
| 119 | * @DSI_RDBK_INCOMPLETE_PKT: Incomplete read packet. |
| 120 | * @DSI_PERIPH_ERROR_PKT: Error packet returned from peripheral, |
| 121 | * @DSI_LP_RX_TIMEOUT: Low power reverse transmission timeout. |
| 122 | * @DSI_HS_TX_TIMEOUT: High speed forward transmission timeout. |
| 123 | * @DSI_BTA_TIMEOUT: BTA timeout. |
| 124 | * @DSI_PLL_UNLOCK: PLL has unlocked. |
| 125 | * @DSI_DLN0_ESC_ENTRY_ERR: Incorrect LP Rx escape entry. |
| 126 | * @DSI_DLN0_ESC_SYNC_ERR: LP Rx data is not byte aligned. |
| 127 | * @DSI_DLN0_LP_CONTROL_ERR: Incorrect LP Rx state sequence. |
| 128 | * @DSI_PENDING_HS_TX_TIMEOUT: Pending High-speed transfer timeout. |
| 129 | * @DSI_INTERLEAVE_OP_CONTENTION: Interleave operation contention. |
| 130 | * @DSI_CMD_DMA_FIFO_UNDERFLOW: Command mode DMA FIFO underflow. |
| 131 | * @DSI_CMD_MDP_FIFO_UNDERFLOW: Command MDP FIFO underflow (failed to |
| 132 | * receive one complete line from MDP). |
| 133 | * @DSI_DLN0_HS_FIFO_OVERFLOW: High speed FIFO for data lane 0 overflows. |
| 134 | * @DSI_DLN1_HS_FIFO_OVERFLOW: High speed FIFO for data lane 1 overflows. |
| 135 | * @DSI_DLN2_HS_FIFO_OVERFLOW: High speed FIFO for data lane 2 overflows. |
| 136 | * @DSI_DLN3_HS_FIFO_OVERFLOW: High speed FIFO for data lane 3 overflows. |
| 137 | * @DSI_DLN0_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 0 underflows. |
| 138 | * @DSI_DLN1_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 1 underflows. |
| 139 | * @DSI_DLN2_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 2 underflows. |
| 140 | * @DSI_DLN3_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 3 undeflows. |
| 141 | * @DSI_DLN0_LP0_CONTENTION: PHY level contention while lane 0 is low. |
| 142 | * @DSI_DLN1_LP0_CONTENTION: PHY level contention while lane 1 is low. |
| 143 | * @DSI_DLN2_LP0_CONTENTION: PHY level contention while lane 2 is low. |
| 144 | * @DSI_DLN3_LP0_CONTENTION: PHY level contention while lane 3 is low. |
| 145 | * @DSI_DLN0_LP1_CONTENTION: PHY level contention while lane 0 is high. |
| 146 | * @DSI_DLN1_LP1_CONTENTION: PHY level contention while lane 1 is high. |
| 147 | * @DSI_DLN2_LP1_CONTENTION: PHY level contention while lane 2 is high. |
| 148 | * @DSI_DLN3_LP1_CONTENTION: PHY level contention while lane 3 is high. |
| 149 | */ |
| 150 | enum dsi_error_int_type { |
| 151 | DSI_RDBK_SINGLE_ECC_ERR = BIT(0), |
| 152 | DSI_RDBK_MULTI_ECC_ERR = BIT(1), |
| 153 | DSI_RDBK_CRC_ERR = BIT(2), |
| 154 | DSI_RDBK_INCOMPLETE_PKT = BIT(3), |
| 155 | DSI_PERIPH_ERROR_PKT = BIT(4), |
| 156 | DSI_LP_RX_TIMEOUT = BIT(5), |
| 157 | DSI_HS_TX_TIMEOUT = BIT(6), |
| 158 | DSI_BTA_TIMEOUT = BIT(7), |
| 159 | DSI_PLL_UNLOCK = BIT(8), |
| 160 | DSI_DLN0_ESC_ENTRY_ERR = BIT(9), |
| 161 | DSI_DLN0_ESC_SYNC_ERR = BIT(10), |
| 162 | DSI_DLN0_LP_CONTROL_ERR = BIT(11), |
| 163 | DSI_PENDING_HS_TX_TIMEOUT = BIT(12), |
| 164 | DSI_INTERLEAVE_OP_CONTENTION = BIT(13), |
| 165 | DSI_CMD_DMA_FIFO_UNDERFLOW = BIT(14), |
| 166 | DSI_CMD_MDP_FIFO_UNDERFLOW = BIT(15), |
| 167 | DSI_DLN0_HS_FIFO_OVERFLOW = BIT(16), |
| 168 | DSI_DLN1_HS_FIFO_OVERFLOW = BIT(17), |
| 169 | DSI_DLN2_HS_FIFO_OVERFLOW = BIT(18), |
| 170 | DSI_DLN3_HS_FIFO_OVERFLOW = BIT(19), |
| 171 | DSI_DLN0_HS_FIFO_UNDERFLOW = BIT(20), |
| 172 | DSI_DLN1_HS_FIFO_UNDERFLOW = BIT(21), |
| 173 | DSI_DLN2_HS_FIFO_UNDERFLOW = BIT(22), |
| 174 | DSI_DLN3_HS_FIFO_UNDERFLOW = BIT(23), |
| 175 | DSI_DLN0_LP0_CONTENTION = BIT(24), |
| 176 | DSI_DLN1_LP0_CONTENTION = BIT(25), |
| 177 | DSI_DLN2_LP0_CONTENTION = BIT(26), |
| 178 | DSI_DLN3_LP0_CONTENTION = BIT(27), |
| 179 | DSI_DLN0_LP1_CONTENTION = BIT(28), |
| 180 | DSI_DLN1_LP1_CONTENTION = BIT(29), |
| 181 | DSI_DLN2_LP1_CONTENTION = BIT(30), |
| 182 | DSI_DLN3_LP1_CONTENTION = BIT(31), |
| 183 | }; |
| 184 | |
| 185 | /** |
| 186 | * struct dsi_ctrl_cmd_dma_info - command buffer information |
| 187 | * @offset: IOMMU VA for command buffer address. |
| 188 | * @length: Length of the command buffer. |
| 189 | * @en_broadcast: Enable broadcast mode if set to true. |
| 190 | * @is_master: Is master in broadcast mode. |
| 191 | * @use_lpm: Use low power mode for command transmission. |
| 192 | */ |
| 193 | struct dsi_ctrl_cmd_dma_info { |
| 194 | u32 offset; |
| 195 | u32 length; |
| 196 | bool en_broadcast; |
| 197 | bool is_master; |
| 198 | bool use_lpm; |
| 199 | }; |
| 200 | |
| 201 | /** |
| 202 | * struct dsi_ctrl_cmd_dma_fifo_info - command payload tp be sent using FIFO |
| 203 | * @command: VA for command buffer. |
| 204 | * @size: Size of the command buffer. |
| 205 | * @en_broadcast: Enable broadcast mode if set to true. |
| 206 | * @is_master: Is master in broadcast mode. |
| 207 | * @use_lpm: Use low power mode for command transmission. |
| 208 | */ |
| 209 | struct dsi_ctrl_cmd_dma_fifo_info { |
| 210 | u32 *command; |
| 211 | u32 size; |
| 212 | bool en_broadcast; |
| 213 | bool is_master; |
| 214 | bool use_lpm; |
| 215 | }; |
| 216 | |
| 217 | struct dsi_ctrl_hw; |
| 218 | |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 219 | struct ctrl_ulps_config_ops { |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 220 | /** |
| 221 | * ulps_request() - request ulps entry for specified lanes |
| 222 | * @ctrl: Pointer to the controller host hardware. |
| 223 | * @lanes: ORed list of lanes (enum dsi_data_lanes) which need |
| 224 | * to enter ULPS. |
| 225 | * |
| 226 | * Caller should check if lanes are in ULPS mode by calling |
| 227 | * get_lanes_in_ulps() operation. |
| 228 | */ |
| 229 | void (*ulps_request)(struct dsi_ctrl_hw *ctrl, u32 lanes); |
| 230 | |
| 231 | /** |
| 232 | * ulps_exit() - exit ULPS on specified lanes |
| 233 | * @ctrl: Pointer to the controller host hardware. |
| 234 | * @lanes: ORed list of lanes (enum dsi_data_lanes) which need |
| 235 | * to exit ULPS. |
| 236 | * |
| 237 | * Caller should check if lanes are in active mode by calling |
| 238 | * get_lanes_in_ulps() operation. |
| 239 | */ |
| 240 | void (*ulps_exit)(struct dsi_ctrl_hw *ctrl, u32 lanes); |
| 241 | |
| 242 | /** |
| 243 | * get_lanes_in_ulps() - returns the list of lanes in ULPS mode |
| 244 | * @ctrl: Pointer to the controller host hardware. |
| 245 | * |
| 246 | * Returns an ORed list of lanes (enum dsi_data_lanes) that are in ULPS |
| 247 | * state. If 0 is returned, all the lanes are active. |
| 248 | * |
| 249 | * Return: List of lanes in ULPS state. |
| 250 | */ |
| 251 | u32 (*get_lanes_in_ulps)(struct dsi_ctrl_hw *ctrl); |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 252 | }; |
| 253 | |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 254 | /** |
| 255 | * struct dsi_ctrl_hw_ops - operations supported by dsi host hardware |
| 256 | */ |
| 257 | struct dsi_ctrl_hw_ops { |
| 258 | |
| 259 | /** |
| 260 | * host_setup() - Setup DSI host configuration |
| 261 | * @ctrl: Pointer to controller host hardware. |
| 262 | * @config: Configuration for DSI host controller |
| 263 | */ |
| 264 | void (*host_setup)(struct dsi_ctrl_hw *ctrl, |
| 265 | struct dsi_host_common_cfg *config); |
| 266 | |
| 267 | /** |
| 268 | * video_engine_en() - enable DSI video engine |
| 269 | * @ctrl: Pointer to controller host hardware. |
| 270 | * @on: Enable/disabel video engine. |
| 271 | */ |
| 272 | void (*video_engine_en)(struct dsi_ctrl_hw *ctrl, bool on); |
| 273 | |
| 274 | /** |
| 275 | * video_engine_setup() - Setup dsi host controller for video mode |
| 276 | * @ctrl: Pointer to controller host hardware. |
| 277 | * @common_cfg: Common configuration parameters. |
| 278 | * @cfg: Video mode configuration. |
| 279 | * |
| 280 | * Set up DSI video engine with a specific configuration. Controller and |
| 281 | * video engine are not enabled as part of this function. |
| 282 | */ |
| 283 | void (*video_engine_setup)(struct dsi_ctrl_hw *ctrl, |
| 284 | struct dsi_host_common_cfg *common_cfg, |
| 285 | struct dsi_video_engine_cfg *cfg); |
| 286 | |
| 287 | /** |
| 288 | * set_video_timing() - set up the timing for video frame |
| 289 | * @ctrl: Pointer to controller host hardware. |
| 290 | * @mode: Video mode information. |
| 291 | * |
| 292 | * Set up the video timing parameters for the DSI video mode operation. |
| 293 | */ |
| 294 | void (*set_video_timing)(struct dsi_ctrl_hw *ctrl, |
| 295 | struct dsi_mode_info *mode); |
| 296 | |
| 297 | /** |
| 298 | * cmd_engine_setup() - setup dsi host controller for command mode |
| 299 | * @ctrl: Pointer to the controller host hardware. |
| 300 | * @common_cfg: Common configuration parameters. |
| 301 | * @cfg: Command mode configuration. |
| 302 | * |
| 303 | * Setup DSI CMD engine with a specific configuration. Controller and |
| 304 | * command engine are not enabled as part of this function. |
| 305 | */ |
| 306 | void (*cmd_engine_setup)(struct dsi_ctrl_hw *ctrl, |
| 307 | struct dsi_host_common_cfg *common_cfg, |
| 308 | struct dsi_cmd_engine_cfg *cfg); |
| 309 | |
| 310 | /** |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 311 | * setup_cmd_stream() - set up parameters for command pixel streams |
Alexander Beykun | ac18235 | 2017-02-27 17:46:51 -0500 | [diff] [blame] | 312 | * @ctrl: Pointer to controller host hardware. |
| 313 | * @mode: Pointer to mode information. |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 314 | * @h_stride: Horizontal stride in bytes. |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 315 | * @vc_id: stream_id. |
| 316 | * |
| 317 | * Setup parameters for command mode pixel stream size. |
| 318 | */ |
| 319 | void (*setup_cmd_stream)(struct dsi_ctrl_hw *ctrl, |
Alexander Beykun | ac18235 | 2017-02-27 17:46:51 -0500 | [diff] [blame] | 320 | struct dsi_mode_info *mode, |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 321 | u32 h_stride, |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 322 | u32 vc_id); |
| 323 | |
| 324 | /** |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 325 | * ctrl_en() - enable DSI controller engine |
| 326 | * @ctrl: Pointer to the controller host hardware. |
| 327 | * @on: turn on/off the DSI controller engine. |
| 328 | */ |
| 329 | void (*ctrl_en)(struct dsi_ctrl_hw *ctrl, bool on); |
| 330 | |
| 331 | /** |
| 332 | * cmd_engine_en() - enable DSI controller command engine |
| 333 | * @ctrl: Pointer to the controller host hardware. |
| 334 | * @on: Turn on/off the DSI command engine. |
| 335 | */ |
| 336 | void (*cmd_engine_en)(struct dsi_ctrl_hw *ctrl, bool on); |
| 337 | |
| 338 | /** |
| 339 | * phy_sw_reset() - perform a soft reset on the PHY. |
| 340 | * @ctrl: Pointer to the controller host hardware. |
| 341 | */ |
| 342 | void (*phy_sw_reset)(struct dsi_ctrl_hw *ctrl); |
| 343 | |
| 344 | /** |
| 345 | * soft_reset() - perform a soft reset on DSI controller |
| 346 | * @ctrl: Pointer to the controller host hardware. |
| 347 | * |
Lloyd Atkinson | 8c49c58 | 2016-11-18 14:23:54 -0500 | [diff] [blame] | 348 | * The video, command and controller engines will be disabled before the |
| 349 | * reset is triggered. After, the engines will be re-enabled to the same |
| 350 | * state as before the reset. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 351 | * |
| 352 | * 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] | 353 | * engine should be re-enabled only during the vertical blanking time. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 354 | */ |
| 355 | void (*soft_reset)(struct dsi_ctrl_hw *ctrl); |
| 356 | |
| 357 | /** |
| 358 | * setup_lane_map() - setup mapping between logical and physical lanes |
| 359 | * @ctrl: Pointer to the controller host hardware. |
| 360 | * @lane_map: Structure defining the mapping between DSI logical |
| 361 | * lanes and physical lanes. |
| 362 | */ |
| 363 | void (*setup_lane_map)(struct dsi_ctrl_hw *ctrl, |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 364 | struct dsi_lane_map *lane_map); |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 365 | |
| 366 | /** |
| 367 | * kickoff_command() - transmits commands stored in memory |
| 368 | * @ctrl: Pointer to the controller host hardware. |
| 369 | * @cmd: Command information. |
| 370 | * @flags: Modifiers for command transmission. |
| 371 | * |
| 372 | * The controller hardware is programmed with address and size of the |
| 373 | * command buffer. The transmission is kicked off if |
| 374 | * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag is not set. If this flag is |
| 375 | * set, caller should make a separate call to trigger_command_dma() to |
| 376 | * transmit the command. |
| 377 | */ |
| 378 | void (*kickoff_command)(struct dsi_ctrl_hw *ctrl, |
| 379 | struct dsi_ctrl_cmd_dma_info *cmd, |
| 380 | u32 flags); |
| 381 | |
| 382 | /** |
| 383 | * kickoff_fifo_command() - transmits a command using FIFO in dsi |
| 384 | * hardware. |
| 385 | * @ctrl: Pointer to the controller host hardware. |
| 386 | * @cmd: Command information. |
| 387 | * @flags: Modifiers for command transmission. |
| 388 | * |
| 389 | * The controller hardware FIFO is programmed with command header and |
| 390 | * payload. The transmission is kicked off if |
| 391 | * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag is not set. If this flag is |
| 392 | * set, caller should make a separate call to trigger_command_dma() to |
| 393 | * transmit the command. |
| 394 | */ |
| 395 | void (*kickoff_fifo_command)(struct dsi_ctrl_hw *ctrl, |
| 396 | struct dsi_ctrl_cmd_dma_fifo_info *cmd, |
| 397 | u32 flags); |
| 398 | |
| 399 | void (*reset_cmd_fifo)(struct dsi_ctrl_hw *ctrl); |
| 400 | /** |
| 401 | * trigger_command_dma() - trigger transmission of command buffer. |
| 402 | * @ctrl: Pointer to the controller host hardware. |
| 403 | * |
| 404 | * This trigger can be only used if there was a prior call to |
| 405 | * kickoff_command() of kickoff_fifo_command() with |
| 406 | * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag. |
| 407 | */ |
| 408 | void (*trigger_command_dma)(struct dsi_ctrl_hw *ctrl); |
| 409 | |
| 410 | /** |
| 411 | * get_cmd_read_data() - get data read from the peripheral |
| 412 | * @ctrl: Pointer to the controller host hardware. |
| 413 | * @rd_buf: Buffer where data will be read into. |
| 414 | * @total_read_len: Number of bytes to read. |
| 415 | */ |
| 416 | u32 (*get_cmd_read_data)(struct dsi_ctrl_hw *ctrl, |
| 417 | u8 *rd_buf, |
| 418 | u32 total_read_len); |
| 419 | |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 420 | /** |
| 421 | * wait_for_lane_idle() - wait for DSI lanes to go to idle state |
| 422 | * @ctrl: Pointer to the controller host hardware. |
| 423 | * @lanes: ORed list of lanes (enum dsi_data_lanes) which need |
| 424 | * to be checked to be in idle state. |
| 425 | */ |
| 426 | int (*wait_for_lane_idle)(struct dsi_ctrl_hw *ctrl, u32 lanes); |
| 427 | |
| 428 | struct ctrl_ulps_config_ops ulps_ops; |
| 429 | |
| 430 | /** |
| 431 | * clamp_enable() - enable DSI clamps |
| 432 | * @ctrl: Pointer to the controller host hardware. |
| 433 | * @lanes: ORed list of lanes which need to have clamps released. |
| 434 | * @enable_ulps: ulps state. |
| 435 | */ |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 436 | |
| 437 | /** |
| 438 | * clamp_enable() - enable DSI clamps to keep PHY driving a stable link |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 439 | * @ctrl: Pointer to the controller host hardware. |
| 440 | * @lanes: ORed list of lanes which need to have clamps released. |
| 441 | * @enable_ulps: TODO:?? |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 442 | */ |
| 443 | void (*clamp_enable)(struct dsi_ctrl_hw *ctrl, |
| 444 | u32 lanes, |
| 445 | bool enable_ulps); |
| 446 | |
| 447 | /** |
| 448 | * clamp_disable() - disable DSI clamps |
| 449 | * @ctrl: Pointer to the controller host hardware. |
| 450 | * @lanes: ORed list of lanes which need to have clamps released. |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 451 | * @disable_ulps: ulps state. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 452 | */ |
| 453 | void (*clamp_disable)(struct dsi_ctrl_hw *ctrl, |
| 454 | u32 lanes, |
| 455 | bool disable_ulps); |
| 456 | |
| 457 | /** |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 458 | * phy_reset_config() - Disable/enable propagation of reset signal |
| 459 | * from ahb domain to DSI PHY |
| 460 | * @ctrl: Pointer to the controller host hardware. |
| 461 | * @enable: True to mask the reset signal, false to unmask |
| 462 | */ |
| 463 | void (*phy_reset_config)(struct dsi_ctrl_hw *ctrl, |
| 464 | bool enable); |
| 465 | |
| 466 | /** |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 467 | * get_interrupt_status() - returns the interrupt status |
| 468 | * @ctrl: Pointer to the controller host hardware. |
| 469 | * |
| 470 | * Returns the ORed list of interrupts(enum dsi_status_int_type) that |
| 471 | * are active. This list does not include any error interrupts. Caller |
| 472 | * should call get_error_status for error interrupts. |
| 473 | * |
| 474 | * Return: List of active interrupts. |
| 475 | */ |
| 476 | u32 (*get_interrupt_status)(struct dsi_ctrl_hw *ctrl); |
| 477 | |
| 478 | /** |
| 479 | * clear_interrupt_status() - clears the specified interrupts |
| 480 | * @ctrl: Pointer to the controller host hardware. |
| 481 | * @ints: List of interrupts to be cleared. |
| 482 | */ |
| 483 | void (*clear_interrupt_status)(struct dsi_ctrl_hw *ctrl, u32 ints); |
| 484 | |
| 485 | /** |
| 486 | * enable_status_interrupts() - enable the specified interrupts |
| 487 | * @ctrl: Pointer to the controller host hardware. |
| 488 | * @ints: List of interrupts to be enabled. |
| 489 | * |
| 490 | * Enables the specified interrupts. This list will override the |
| 491 | * previous interrupts enabled through this function. Caller has to |
| 492 | * maintain the state of the interrupts enabled. To disable all |
| 493 | * interrupts, set ints to 0. |
| 494 | */ |
| 495 | void (*enable_status_interrupts)(struct dsi_ctrl_hw *ctrl, u32 ints); |
| 496 | |
| 497 | /** |
| 498 | * get_error_status() - returns the error status |
| 499 | * @ctrl: Pointer to the controller host hardware. |
| 500 | * |
| 501 | * Returns the ORed list of errors(enum dsi_error_int_type) that are |
| 502 | * active. This list does not include any status interrupts. Caller |
| 503 | * should call get_interrupt_status for status interrupts. |
| 504 | * |
| 505 | * Return: List of active error interrupts. |
| 506 | */ |
| 507 | u64 (*get_error_status)(struct dsi_ctrl_hw *ctrl); |
| 508 | |
| 509 | /** |
| 510 | * clear_error_status() - clears the specified errors |
| 511 | * @ctrl: Pointer to the controller host hardware. |
| 512 | * @errors: List of errors to be cleared. |
| 513 | */ |
| 514 | void (*clear_error_status)(struct dsi_ctrl_hw *ctrl, u64 errors); |
| 515 | |
| 516 | /** |
| 517 | * enable_error_interrupts() - enable the specified interrupts |
| 518 | * @ctrl: Pointer to the controller host hardware. |
| 519 | * @errors: List of errors to be enabled. |
| 520 | * |
| 521 | * Enables the specified interrupts. This list will override the |
| 522 | * previous interrupts enabled through this function. Caller has to |
| 523 | * maintain the state of the interrupts enabled. To disable all |
| 524 | * interrupts, set errors to 0. |
| 525 | */ |
| 526 | void (*enable_error_interrupts)(struct dsi_ctrl_hw *ctrl, u64 errors); |
| 527 | |
| 528 | /** |
| 529 | * video_test_pattern_setup() - setup test pattern engine for video mode |
| 530 | * @ctrl: Pointer to the controller host hardware. |
| 531 | * @type: Type of test pattern. |
| 532 | * @init_val: Initial value to use for generating test pattern. |
| 533 | */ |
| 534 | void (*video_test_pattern_setup)(struct dsi_ctrl_hw *ctrl, |
| 535 | enum dsi_test_pattern type, |
| 536 | u32 init_val); |
| 537 | |
| 538 | /** |
| 539 | * cmd_test_pattern_setup() - setup test patttern engine for cmd mode |
| 540 | * @ctrl: Pointer to the controller host hardware. |
| 541 | * @type: Type of test pattern. |
| 542 | * @init_val: Initial value to use for generating test pattern. |
| 543 | * @stream_id: Stream Id on which packets are generated. |
| 544 | */ |
| 545 | void (*cmd_test_pattern_setup)(struct dsi_ctrl_hw *ctrl, |
| 546 | enum dsi_test_pattern type, |
| 547 | u32 init_val, |
| 548 | u32 stream_id); |
| 549 | |
| 550 | /** |
| 551 | * test_pattern_enable() - enable test pattern engine |
| 552 | * @ctrl: Pointer to the controller host hardware. |
| 553 | * @enable: Enable/Disable test pattern engine. |
| 554 | */ |
| 555 | void (*test_pattern_enable)(struct dsi_ctrl_hw *ctrl, bool enable); |
| 556 | |
| 557 | /** |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 558 | * clear_phy0_ln_err() - clear DSI PHY lane-0 errors |
| 559 | * @ctrl: Pointer to the controller host hardware. |
| 560 | */ |
| 561 | void (*clear_phy0_ln_err)(struct dsi_ctrl_hw *ctrl); |
| 562 | |
| 563 | /** |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 564 | * trigger_cmd_test_pattern() - trigger a command mode frame update with |
| 565 | * test pattern |
| 566 | * @ctrl: Pointer to the controller host hardware. |
| 567 | * @stream_id: Stream on which frame update is sent. |
| 568 | */ |
| 569 | void (*trigger_cmd_test_pattern)(struct dsi_ctrl_hw *ctrl, |
| 570 | u32 stream_id); |
Ajay Singh Parmar | 48ea427 | 2016-06-27 11:44:34 -0700 | [diff] [blame] | 571 | |
| 572 | ssize_t (*reg_dump_to_buffer)(struct dsi_ctrl_hw *ctrl, |
| 573 | char *buf, |
| 574 | u32 size); |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 575 | }; |
| 576 | |
| 577 | /* |
| 578 | * 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] | 579 | * @base: VA for the DSI controller base address. |
| 580 | * @length: Length of the DSI controller register map. |
| 581 | * @mmss_misc_base: Base address of mmss_misc register map. |
| 582 | * @mmss_misc_length: Length of mmss_misc register map. |
| 583 | * @disp_cc_base: Base address of disp_cc register map. |
| 584 | * @disp_cc_length: Length of disp_cc register map. |
| 585 | * @index: Instance ID of the controller. |
| 586 | * @feature_map: Features supported by the DSI controller. |
| 587 | * @ops: Function pointers to the operations supported by the |
| 588 | * controller. |
| 589 | * @supported_interrupts: Number of supported interrupts. |
| 590 | * @supported_errors: Number of supported errors. |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 591 | */ |
| 592 | struct dsi_ctrl_hw { |
| 593 | void __iomem *base; |
| 594 | u32 length; |
| 595 | void __iomem *mmss_misc_base; |
| 596 | u32 mmss_misc_length; |
Shashank Babu Chinta Venkata | afef820 | 2017-04-21 13:49:56 -0700 | [diff] [blame] | 597 | void __iomem *disp_cc_base; |
| 598 | u32 disp_cc_length; |
Ajay Singh Parmar | 7509888 | 2016-05-16 17:43:17 -0700 | [diff] [blame] | 599 | u32 index; |
| 600 | |
| 601 | /* features */ |
| 602 | DECLARE_BITMAP(feature_map, DSI_CTRL_MAX_FEATURES); |
| 603 | struct dsi_ctrl_hw_ops ops; |
| 604 | |
| 605 | /* capabilities */ |
| 606 | u32 supported_interrupts; |
| 607 | u64 supported_errors; |
| 608 | }; |
| 609 | |
| 610 | #endif /* _DSI_CTRL_HW_H_ */ |