Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -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 | 0e18781 | 2016-05-16 17:45:31 -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_CATALOG_H_ |
| 16 | #define _DSI_CATALOG_H_ |
| 17 | |
| 18 | #include "dsi_ctrl_hw.h" |
| 19 | #include "dsi_phy_hw.h" |
| 20 | |
| 21 | /** |
| 22 | * dsi_catalog_ctrl_setup() - return catalog info for dsi controller |
| 23 | * @ctrl: Pointer to DSI controller hw object. |
| 24 | * @version: DSI controller version. |
| 25 | * @index: DSI controller instance ID. |
| 26 | * |
| 27 | * This function setups the catalog information in the dsi_ctrl_hw object. |
| 28 | * |
| 29 | * return: error code for failure and 0 for success. |
| 30 | */ |
| 31 | int dsi_catalog_ctrl_setup(struct dsi_ctrl_hw *ctrl, |
| 32 | enum dsi_ctrl_version version, |
| 33 | u32 index); |
| 34 | |
| 35 | /** |
| 36 | * dsi_catalog_phy_setup() - return catalog info for dsi phy hardware |
Padmanabhan Komanduru | 56611ef | 2016-12-19 12:21:11 +0530 | [diff] [blame] | 37 | * @phy: Pointer to DSI PHY hw object. |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 38 | * @version: DSI PHY version. |
| 39 | * @index: DSI PHY instance ID. |
| 40 | * |
| 41 | * This function setups the catalog information in the dsi_phy_hw object. |
| 42 | * |
| 43 | * return: error code for failure and 0 for success. |
| 44 | */ |
| 45 | int dsi_catalog_phy_setup(struct dsi_phy_hw *phy, |
| 46 | enum dsi_phy_version version, |
| 47 | u32 index); |
| 48 | |
Padmanabhan Komanduru | 56611ef | 2016-12-19 12:21:11 +0530 | [diff] [blame] | 49 | /** |
| 50 | * dsi_phy_timing_calc_init() - initialize info for DSI PHY timing calculations |
| 51 | * @phy: Pointer to DSI PHY hw object. |
| 52 | * @version: DSI PHY version. |
| 53 | * |
| 54 | * This function setups the catalog information in the dsi_phy_hw object. |
| 55 | * |
| 56 | * return: error code for failure and 0 for success. |
| 57 | */ |
| 58 | int dsi_phy_timing_calc_init(struct dsi_phy_hw *phy, |
| 59 | enum dsi_phy_version version); |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 60 | |
Padmanabhan Komanduru | 56611ef | 2016-12-19 12:21:11 +0530 | [diff] [blame] | 61 | /** |
| 62 | * dsi_phy_hw_calculate_timing_params() - DSI PHY timing parameter calculations |
| 63 | * @phy: Pointer to DSI PHY hw object. |
| 64 | * @mode: DSI mode information. |
| 65 | * @host: DSI host configuration. |
| 66 | * @timing: DSI phy lane configurations. |
| 67 | * |
| 68 | * This function setups the catalog information in the dsi_phy_hw object. |
| 69 | * |
| 70 | * return: error code for failure and 0 for success. |
| 71 | */ |
| 72 | int dsi_phy_hw_calculate_timing_params(struct dsi_phy_hw *phy, |
| 73 | struct dsi_mode_info *mode, |
| 74 | struct dsi_host_common_cfg *host, |
| 75 | struct dsi_phy_per_lane_cfgs *timing); |
| 76 | |
| 77 | /* Definitions for 14nm PHY hardware driver */ |
| 78 | void dsi_phy_hw_v2_0_regulator_enable(struct dsi_phy_hw *phy, |
| 79 | struct dsi_phy_per_lane_cfgs *cfg); |
| 80 | void dsi_phy_hw_v2_0_regulator_disable(struct dsi_phy_hw *phy); |
| 81 | void dsi_phy_hw_v2_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg); |
| 82 | void dsi_phy_hw_v2_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg); |
| 83 | void dsi_phy_hw_v2_0_idle_on(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg); |
| 84 | void dsi_phy_hw_v2_0_idle_off(struct dsi_phy_hw *phy); |
Padmanabhan Komanduru | ee89d21 | 2016-12-19 12:51:31 +0530 | [diff] [blame] | 85 | int dsi_phy_hw_timing_val_v2_0(struct dsi_phy_per_lane_cfgs *timing_cfg, |
| 86 | u32 *timing_val, u32 size); |
Padmanabhan Komanduru | 56611ef | 2016-12-19 12:21:11 +0530 | [diff] [blame] | 87 | |
| 88 | /* Definitions for 10nm PHY hardware driver */ |
| 89 | void dsi_phy_hw_v3_0_regulator_enable(struct dsi_phy_hw *phy, |
| 90 | struct dsi_phy_per_lane_cfgs *cfg); |
| 91 | void dsi_phy_hw_v3_0_regulator_disable(struct dsi_phy_hw *phy); |
| 92 | void dsi_phy_hw_v3_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg); |
| 93 | void dsi_phy_hw_v3_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg); |
| 94 | int dsi_phy_hw_v3_0_wait_for_lane_idle(struct dsi_phy_hw *phy, u32 lanes); |
| 95 | void dsi_phy_hw_v3_0_ulps_request(struct dsi_phy_hw *phy, |
| 96 | struct dsi_phy_cfg *cfg, u32 lanes); |
| 97 | void dsi_phy_hw_v3_0_ulps_exit(struct dsi_phy_hw *phy, |
| 98 | struct dsi_phy_cfg *cfg, u32 lanes); |
| 99 | u32 dsi_phy_hw_v3_0_get_lanes_in_ulps(struct dsi_phy_hw *phy); |
Veera Sundaram Sankaran | bb3680f | 2017-04-21 13:20:46 -0700 | [diff] [blame] | 100 | bool dsi_phy_hw_v3_0_is_lanes_in_ulps(u32 lanes, u32 ulps_lanes); |
Padmanabhan Komanduru | ee89d21 | 2016-12-19 12:51:31 +0530 | [diff] [blame] | 101 | int dsi_phy_hw_timing_val_v3_0(struct dsi_phy_per_lane_cfgs *timing_cfg, |
| 102 | u32 *timing_val, u32 size); |
| 103 | |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 104 | /* DSI controller common ops */ |
| 105 | u32 dsi_ctrl_hw_cmn_get_interrupt_status(struct dsi_ctrl_hw *ctrl); |
| 106 | void dsi_ctrl_hw_cmn_clear_interrupt_status(struct dsi_ctrl_hw *ctrl, u32 ints); |
| 107 | void dsi_ctrl_hw_cmn_enable_status_interrupts(struct dsi_ctrl_hw *ctrl, |
| 108 | u32 ints); |
| 109 | |
| 110 | u64 dsi_ctrl_hw_cmn_get_error_status(struct dsi_ctrl_hw *ctrl); |
| 111 | void dsi_ctrl_hw_cmn_clear_error_status(struct dsi_ctrl_hw *ctrl, u64 errors); |
| 112 | void dsi_ctrl_hw_cmn_enable_error_interrupts(struct dsi_ctrl_hw *ctrl, |
| 113 | u64 errors); |
| 114 | |
| 115 | void dsi_ctrl_hw_cmn_video_test_pattern_setup(struct dsi_ctrl_hw *ctrl, |
| 116 | enum dsi_test_pattern type, |
| 117 | u32 init_val); |
| 118 | void dsi_ctrl_hw_cmn_cmd_test_pattern_setup(struct dsi_ctrl_hw *ctrl, |
| 119 | enum dsi_test_pattern type, |
| 120 | u32 init_val, |
| 121 | u32 stream_id); |
| 122 | void dsi_ctrl_hw_cmn_test_pattern_enable(struct dsi_ctrl_hw *ctrl, bool enable); |
| 123 | void dsi_ctrl_hw_cmn_trigger_cmd_test_pattern(struct dsi_ctrl_hw *ctrl, |
| 124 | u32 stream_id); |
| 125 | |
| 126 | void dsi_ctrl_hw_cmn_host_setup(struct dsi_ctrl_hw *ctrl, |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 127 | struct dsi_host_common_cfg *config); |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 128 | void dsi_ctrl_hw_cmn_video_engine_en(struct dsi_ctrl_hw *ctrl, bool on); |
| 129 | void dsi_ctrl_hw_cmn_video_engine_setup(struct dsi_ctrl_hw *ctrl, |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 130 | struct dsi_host_common_cfg *common_cfg, |
| 131 | struct dsi_video_engine_cfg *cfg); |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 132 | void dsi_ctrl_hw_cmn_set_video_timing(struct dsi_ctrl_hw *ctrl, |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 133 | struct dsi_mode_info *mode); |
| 134 | |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 135 | void dsi_ctrl_hw_cmn_cmd_engine_setup(struct dsi_ctrl_hw *ctrl, |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 136 | struct dsi_host_common_cfg *common_cfg, |
| 137 | struct dsi_cmd_engine_cfg *cfg); |
| 138 | |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 139 | void dsi_ctrl_hw_cmn_ctrl_en(struct dsi_ctrl_hw *ctrl, bool on); |
| 140 | void dsi_ctrl_hw_cmn_cmd_engine_en(struct dsi_ctrl_hw *ctrl, bool on); |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 141 | |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 142 | void dsi_ctrl_hw_cmn_setup_cmd_stream(struct dsi_ctrl_hw *ctrl, |
Alexander Beykun | ac18235 | 2017-02-27 17:46:51 -0500 | [diff] [blame] | 143 | struct dsi_mode_info *mode, |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 144 | u32 h_stride, |
Lloyd Atkinson | 16e96de | 2017-04-19 11:18:14 -0400 | [diff] [blame] | 145 | u32 vc_id, |
| 146 | struct dsi_rect *roi); |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 147 | void dsi_ctrl_hw_cmn_phy_sw_reset(struct dsi_ctrl_hw *ctrl); |
| 148 | void dsi_ctrl_hw_cmn_soft_reset(struct dsi_ctrl_hw *ctrl); |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 149 | |
Rajkumar Subbiah | 01e6dd64 | 2017-07-05 14:47:47 -0400 | [diff] [blame^] | 150 | void dsi_ctrl_hw_cmn_setup_misr(struct dsi_ctrl_hw *ctrl, |
| 151 | enum dsi_op_mode panel_mode, |
| 152 | bool enable, u32 frame_count); |
| 153 | u32 dsi_ctrl_hw_cmn_collect_misr(struct dsi_ctrl_hw *ctrl, |
| 154 | enum dsi_op_mode panel_mode); |
| 155 | |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 156 | void dsi_ctrl_hw_cmn_kickoff_command(struct dsi_ctrl_hw *ctrl, |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 157 | struct dsi_ctrl_cmd_dma_info *cmd, |
| 158 | u32 flags); |
| 159 | |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 160 | void dsi_ctrl_hw_cmn_kickoff_fifo_command(struct dsi_ctrl_hw *ctrl, |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 161 | struct dsi_ctrl_cmd_dma_fifo_info *cmd, |
| 162 | u32 flags); |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 163 | void dsi_ctrl_hw_cmn_reset_cmd_fifo(struct dsi_ctrl_hw *ctrl); |
| 164 | void dsi_ctrl_hw_cmn_trigger_command_dma(struct dsi_ctrl_hw *ctrl); |
| 165 | void dsi_ctrl_hw_dln0_phy_err(struct dsi_ctrl_hw *ctrl); |
| 166 | void dsi_ctrl_hw_cmn_phy_reset_config(struct dsi_ctrl_hw *ctrl, |
| 167 | bool enable); |
Shashank Babu Chinta Venkata | afef820 | 2017-04-21 13:49:56 -0700 | [diff] [blame] | 168 | void dsi_ctrl_hw_22_phy_reset_config(struct dsi_ctrl_hw *ctrl, |
| 169 | bool enable); |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 170 | |
| 171 | /* Definitions specific to 1.4 DSI controller hardware */ |
| 172 | int dsi_ctrl_hw_14_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes); |
| 173 | void dsi_ctrl_hw_14_setup_lane_map(struct dsi_ctrl_hw *ctrl, |
| 174 | struct dsi_lane_map *lane_map); |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 175 | void dsi_ctrl_hw_14_ulps_request(struct dsi_ctrl_hw *ctrl, u32 lanes); |
| 176 | void dsi_ctrl_hw_14_ulps_exit(struct dsi_ctrl_hw *ctrl, u32 lanes); |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 177 | u32 dsi_ctrl_hw_14_get_lanes_in_ulps(struct dsi_ctrl_hw *ctrl); |
| 178 | |
| 179 | void dsi_ctrl_hw_14_clamp_enable(struct dsi_ctrl_hw *ctrl, |
| 180 | u32 lanes, |
| 181 | bool enable_ulps); |
| 182 | |
| 183 | void dsi_ctrl_hw_14_clamp_disable(struct dsi_ctrl_hw *ctrl, |
| 184 | u32 lanes, |
| 185 | bool disable_ulps); |
Ajay Singh Parmar | 48ea427 | 2016-06-27 11:44:34 -0700 | [diff] [blame] | 186 | ssize_t dsi_ctrl_hw_14_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl, |
| 187 | char *buf, |
| 188 | u32 size); |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 189 | |
| 190 | /* Definitions specific to 2.0 DSI controller hardware */ |
| 191 | void dsi_ctrl_hw_20_setup_lane_map(struct dsi_ctrl_hw *ctrl, |
| 192 | struct dsi_lane_map *lane_map); |
| 193 | int dsi_ctrl_hw_20_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes); |
| 194 | ssize_t dsi_ctrl_hw_20_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl, |
| 195 | char *buf, |
| 196 | u32 size); |
| 197 | |
Ajay Singh Parmar | 0e18781 | 2016-05-16 17:45:31 -0700 | [diff] [blame] | 198 | #endif /* _DSI_CATALOG_H_ */ |