Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 1 | /* |
Shashank Babu Chinta Venkata | 7d60873 | 2017-05-31 14:10:26 -0700 | [diff] [blame] | 2 | * Copyright (c) 2015-2017, The Linux Foundation.All rights reserved. |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -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_DISPLAY_H_ |
| 16 | #define _DSI_DISPLAY_H_ |
| 17 | |
| 18 | #include <linux/types.h> |
| 19 | #include <linux/bitops.h> |
Ajay Singh Parmar | 48ea427 | 2016-06-27 11:44:34 -0700 | [diff] [blame] | 20 | #include <linux/debugfs.h> |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 21 | #include <linux/of_device.h> |
| 22 | #include <drm/drmP.h> |
| 23 | #include <drm/drm_crtc.h> |
| 24 | |
Clarence Ip | a403932 | 2016-07-15 16:23:59 -0400 | [diff] [blame] | 25 | #include "msm_drv.h" |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 26 | #include "dsi_defs.h" |
| 27 | #include "dsi_ctrl.h" |
| 28 | #include "dsi_phy.h" |
| 29 | #include "dsi_panel.h" |
| 30 | |
| 31 | #define MAX_DSI_CTRLS_PER_DISPLAY 2 |
Shashank Babu Chinta Venkata | 74a03f1 | 2017-02-28 11:24:51 -0800 | [diff] [blame] | 32 | #define DSI_CLIENT_NAME_SIZE 20 |
Chandan Uddaraju | 7e9613a | 2017-06-01 13:10:55 -0700 | [diff] [blame] | 33 | #define MAX_CMDLINE_PARAM_LEN 512 |
Ajay Singh Parmar | 62f795b | 2016-06-10 23:20:23 -0700 | [diff] [blame] | 34 | /* |
| 35 | * DSI Validate Mode modifiers |
| 36 | * @DSI_VALIDATE_FLAG_ALLOW_ADJUST: Allow mode validation to also do fixup |
| 37 | */ |
| 38 | #define DSI_VALIDATE_FLAG_ALLOW_ADJUST 0x1 |
| 39 | |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 40 | /** |
Shashank Babu Chinta Venkata | ded9c56 | 2017-03-15 14:43:46 -0700 | [diff] [blame] | 41 | * enum dsi_display_selection_type - enumerates DSI display selection types |
| 42 | * @DSI_PRIMARY: primary DSI display selected from module parameter |
| 43 | * @DSI_SECONDARY: Secondary DSI display selected from module parameter |
| 44 | * @MAX_DSI_ACTIVE_DISPLAY: Maximum acive displays that can be selected |
| 45 | */ |
| 46 | enum dsi_display_selection_type { |
| 47 | DSI_PRIMARY = 0, |
| 48 | DSI_SECONDARY, |
| 49 | MAX_DSI_ACTIVE_DISPLAY, |
| 50 | }; |
| 51 | |
| 52 | /** |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 53 | * enum dsi_display_type - enumerates DSI display types |
| 54 | * @DSI_DISPLAY_SINGLE: A panel connected on a single DSI interface. |
| 55 | * @DSI_DISPLAY_EXT_BRIDGE: A bridge is connected between panel and DSI host. |
| 56 | * It utilizes a single DSI interface. |
| 57 | * @DSI_DISPLAY_SPLIT: A panel that utilizes more than one DSI |
| 58 | * interfaces. |
| 59 | * @DSI_DISPLAY_SPLIT_EXT_BRIDGE: A bridge is present between panel and DSI |
| 60 | * host. It utilizes more than one DSI interface. |
| 61 | */ |
| 62 | enum dsi_display_type { |
| 63 | DSI_DISPLAY_SINGLE = 0, |
| 64 | DSI_DISPLAY_EXT_BRIDGE, |
| 65 | DSI_DISPLAY_SPLIT, |
| 66 | DSI_DISPLAY_SPLIT_EXT_BRIDGE, |
| 67 | DSI_DISPLAY_MAX, |
| 68 | }; |
| 69 | |
| 70 | /** |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 71 | * struct dsi_display_ctrl - dsi ctrl/phy information for the display |
| 72 | * @ctrl: Handle to the DSI controller device. |
| 73 | * @ctrl_of_node: pHandle to the DSI controller device. |
| 74 | * @dsi_ctrl_idx: DSI controller instance id. |
| 75 | * @power_state: Current power state of the DSI controller. |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 76 | * @phy: Handle to the DSI PHY device. |
| 77 | * @phy_of_node: pHandle to the DSI PHY device. |
| 78 | * @phy_enabled: PHY power status. |
| 79 | */ |
| 80 | struct dsi_display_ctrl { |
| 81 | /* controller info */ |
| 82 | struct dsi_ctrl *ctrl; |
| 83 | struct device_node *ctrl_of_node; |
| 84 | u32 dsi_ctrl_idx; |
| 85 | |
| 86 | enum dsi_power_state power_state; |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 87 | |
| 88 | /* phy info */ |
| 89 | struct msm_dsi_phy *phy; |
| 90 | struct device_node *phy_of_node; |
| 91 | |
| 92 | bool phy_enabled; |
| 93 | }; |
Shashank Babu Chinta Venkata | ded9c56 | 2017-03-15 14:43:46 -0700 | [diff] [blame] | 94 | /** |
| 95 | * struct dsi_display_boot_param - defines DSI boot display selection |
| 96 | * @name:Name of DSI display selected as a boot param. |
| 97 | * @boot_disp_en:bool to indicate dtsi availability of display node |
| 98 | * @is_primary:bool to indicate whether current display is primary display |
| 99 | * @length:length of DSI display. |
Chandan Uddaraju | 7e9613a | 2017-06-01 13:10:55 -0700 | [diff] [blame] | 100 | * @cmdline_topology: Display topology shared from kernel command line. |
Shashank Babu Chinta Venkata | ded9c56 | 2017-03-15 14:43:46 -0700 | [diff] [blame] | 101 | */ |
| 102 | struct dsi_display_boot_param { |
Chandan Uddaraju | 7e9613a | 2017-06-01 13:10:55 -0700 | [diff] [blame] | 103 | char name[MAX_CMDLINE_PARAM_LEN]; |
Shashank Babu Chinta Venkata | ded9c56 | 2017-03-15 14:43:46 -0700 | [diff] [blame] | 104 | bool boot_disp_en; |
| 105 | bool is_primary; |
| 106 | int length; |
| 107 | struct device_node *node; |
Chandan Uddaraju | 7e9613a | 2017-06-01 13:10:55 -0700 | [diff] [blame] | 108 | int cmdline_topology; |
Shashank Babu Chinta Venkata | ded9c56 | 2017-03-15 14:43:46 -0700 | [diff] [blame] | 109 | }; |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 110 | |
| 111 | /** |
| 112 | * struct dsi_display_clk_info - dsi display clock source information |
| 113 | * @src_clks: Source clocks for DSI display. |
| 114 | * @mux_clks: Mux clocks used for DFPS. |
| 115 | * @shadow_clks: Used for DFPS. |
| 116 | */ |
| 117 | struct dsi_display_clk_info { |
| 118 | struct dsi_clk_link_set src_clks; |
| 119 | struct dsi_clk_link_set mux_clks; |
| 120 | struct dsi_clk_link_set shadow_clks; |
| 121 | }; |
| 122 | |
| 123 | /** |
| 124 | * struct dsi_display - dsi display information |
| 125 | * @pdev: Pointer to platform device. |
| 126 | * @drm_dev: DRM device associated with the display. |
Clarence Ip | 458a5d0 | 2017-11-27 18:15:16 -0500 | [diff] [blame] | 127 | * @drm_conn: Pointer to DRM connector associated with the display |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 128 | * @name: Name of the display. |
| 129 | * @display_type: Display type as defined in device tree. |
| 130 | * @list: List pointer. |
| 131 | * @is_active: Is display active. |
Shashank Babu Chinta Venkata | 7d60873 | 2017-05-31 14:10:26 -0700 | [diff] [blame] | 132 | * @is_cont_splash_enabled: Is continuous splash enabled |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 133 | * @display_lock: Mutex for dsi_display interface. |
| 134 | * @ctrl_count: Number of DSI interfaces required by panel. |
| 135 | * @ctrl: Controller information for DSI display. |
| 136 | * @panel: Handle to DSI panel. |
| 137 | * @panel_of: pHandle to DSI panel. |
Lloyd Atkinson | 560785e | 2017-11-16 14:04:15 -0500 | [diff] [blame] | 138 | * @modes: Array of probed DSI modes |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 139 | * @type: DSI display type. |
| 140 | * @clk_master_idx: The master controller for controlling clocks. This is an |
| 141 | * index into the ctrl[MAX_DSI_CTRLS_PER_DISPLAY] array. |
| 142 | * @cmd_master_idx: The master controller for sending DSI commands to panel. |
| 143 | * @video_master_idx: The master controller for enabling video engine. |
| 144 | * @clock_info: Clock sourcing for DSI display. |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 145 | * @config: DSI host configuration information. |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 146 | * @lane_map: Lane mapping between DSI host and Panel. |
Chandan Uddaraju | 7e9613a | 2017-06-01 13:10:55 -0700 | [diff] [blame] | 147 | * @cmdline_topology: Display topology shared from kernel command line. |
Jeykumar Sankaran | 446a5f1 | 2017-05-09 20:30:39 -0700 | [diff] [blame] | 148 | * @cmdline_timing: Display timing shared from kernel command line. |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 149 | * @is_tpg_enabled: TPG state. |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 150 | * @ulps_enabled: ulps state. |
| 151 | * @clamp_enabled: clamp state. |
| 152 | * @phy_idle_power_off: PHY power state. |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 153 | * @host: DRM MIPI DSI Host. |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 154 | * @bridge: Pointer to DRM bridge object. |
Lloyd Atkinson | e404caf | 2016-07-13 17:26:45 -0400 | [diff] [blame] | 155 | * @cmd_engine_refcount: Reference count enforcing single instance of cmd eng |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 156 | * @clk_mngr: DSI clock manager. |
| 157 | * @dsi_clk_handle: DSI clock handle. |
| 158 | * @mdp_clk_handle: MDP clock handle. |
| 159 | * @root: Debugfs root directory |
Rajkumar Subbiah | 01e6dd64 | 2017-07-05 14:47:47 -0400 | [diff] [blame] | 160 | * @misr_enable Frame MISR enable/disable |
| 161 | * @misr_frame_count Number of frames to accumulate the MISR value |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 162 | */ |
| 163 | struct dsi_display { |
| 164 | struct platform_device *pdev; |
| 165 | struct drm_device *drm_dev; |
Clarence Ip | 458a5d0 | 2017-11-27 18:15:16 -0500 | [diff] [blame] | 166 | struct drm_connector *drm_conn; |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 167 | |
| 168 | const char *name; |
| 169 | const char *display_type; |
| 170 | struct list_head list; |
| 171 | bool is_active; |
Shashank Babu Chinta Venkata | 7d60873 | 2017-05-31 14:10:26 -0700 | [diff] [blame] | 172 | bool is_cont_splash_enabled; |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 173 | struct mutex display_lock; |
| 174 | |
| 175 | u32 ctrl_count; |
| 176 | struct dsi_display_ctrl ctrl[MAX_DSI_CTRLS_PER_DISPLAY]; |
| 177 | |
| 178 | /* panel info */ |
| 179 | struct dsi_panel *panel; |
| 180 | struct device_node *panel_of; |
| 181 | |
Lloyd Atkinson | 560785e | 2017-11-16 14:04:15 -0500 | [diff] [blame] | 182 | struct dsi_display_mode *modes; |
| 183 | |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 184 | enum dsi_display_type type; |
| 185 | u32 clk_master_idx; |
| 186 | u32 cmd_master_idx; |
| 187 | u32 video_master_idx; |
| 188 | |
| 189 | struct dsi_display_clk_info clock_info; |
| 190 | struct dsi_host_config config; |
Padmanabhan Komanduru | 8ee8ee5 | 2016-12-19 12:10:51 +0530 | [diff] [blame] | 191 | struct dsi_lane_map lane_map; |
Chandan Uddaraju | 7e9613a | 2017-06-01 13:10:55 -0700 | [diff] [blame] | 192 | int cmdline_topology; |
Jeykumar Sankaran | 446a5f1 | 2017-05-09 20:30:39 -0700 | [diff] [blame] | 193 | int cmdline_timing; |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 194 | bool is_tpg_enabled; |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 195 | bool ulps_enabled; |
| 196 | bool clamp_enabled; |
| 197 | bool phy_idle_power_off; |
Shashank Babu Chinta Venkata | 8210952 | 2017-05-09 18:59:21 -0700 | [diff] [blame] | 198 | struct drm_gem_object *tx_cmd_buf; |
| 199 | u32 cmd_buffer_size; |
| 200 | u32 cmd_buffer_iova; |
| 201 | void *vaddr; |
Veera Sundaram Sankaran | a2d5058 | 2017-10-19 17:49:48 -0700 | [diff] [blame] | 202 | struct msm_gem_address_space *aspace; |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 203 | |
| 204 | struct mipi_dsi_host host; |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 205 | struct dsi_bridge *bridge; |
Ajay Singh Parmar | aa9152d | 2016-05-16 18:02:07 -0700 | [diff] [blame] | 206 | u32 cmd_engine_refcount; |
Ajay Singh Parmar | 48ea427 | 2016-06-27 11:44:34 -0700 | [diff] [blame] | 207 | |
Shashank Babu Chinta Venkata | 7d60873 | 2017-05-31 14:10:26 -0700 | [diff] [blame] | 208 | struct sde_power_handle *phandle; |
| 209 | struct sde_power_client *cont_splash_client; |
| 210 | |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 211 | void *clk_mngr; |
| 212 | void *dsi_clk_handle; |
| 213 | void *mdp_clk_handle; |
| 214 | |
Ajay Singh Parmar | 48ea427 | 2016-06-27 11:44:34 -0700 | [diff] [blame] | 215 | /* DEBUG FS */ |
| 216 | struct dentry *root; |
Rajkumar Subbiah | 01e6dd64 | 2017-07-05 14:47:47 -0400 | [diff] [blame] | 217 | |
| 218 | bool misr_enable; |
| 219 | u32 misr_frame_count; |
Sandeep Panda | 11b20d8 | 2017-06-19 12:57:27 +0530 | [diff] [blame] | 220 | /* multiple dsi error handlers */ |
| 221 | struct workqueue_struct *err_workq; |
| 222 | struct work_struct fifo_underflow_work; |
| 223 | struct work_struct fifo_overflow_work; |
| 224 | struct work_struct lp_rx_timeout_work; |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 225 | }; |
| 226 | |
| 227 | int dsi_display_dev_probe(struct platform_device *pdev); |
| 228 | int dsi_display_dev_remove(struct platform_device *pdev); |
| 229 | |
| 230 | /** |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 231 | * dsi_display_get_num_of_displays() - returns number of display devices |
| 232 | * supported. |
| 233 | * |
| 234 | * Return: number of displays. |
| 235 | */ |
Clarence Ip | 3649f8b | 2016-10-31 09:59:44 -0400 | [diff] [blame] | 236 | int dsi_display_get_num_of_displays(void); |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 237 | |
| 238 | /** |
Clarence Ip | a36c92e | 2016-07-26 14:33:46 -0400 | [diff] [blame] | 239 | * dsi_display_get_active_displays - returns pointers for active display devices |
| 240 | * @display_array: Pointer to display array to be filled |
| 241 | * @max_display_count: Size of display_array |
| 242 | * @Returns: Number of display entries filled |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 243 | */ |
Clarence Ip | a36c92e | 2016-07-26 14:33:46 -0400 | [diff] [blame] | 244 | int dsi_display_get_active_displays(void **display_array, |
| 245 | u32 max_display_count); |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 246 | |
| 247 | /** |
Shashank Babu Chinta Venkata | ded9c56 | 2017-03-15 14:43:46 -0700 | [diff] [blame] | 248 | * dsi_display_get_boot_display()- get DSI boot display name |
| 249 | * @index: index of display selection |
| 250 | * |
| 251 | * Return: returns the display node pointer |
| 252 | */ |
| 253 | struct device_node *dsi_display_get_boot_display(int index); |
| 254 | |
| 255 | /** |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 256 | * dsi_display_get_display_by_name()- finds display by name |
Shashank Babu Chinta Venkata | ded9c56 | 2017-03-15 14:43:46 -0700 | [diff] [blame] | 257 | * @name: name of the display. |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 258 | * |
| 259 | * Return: handle to the display or error code. |
| 260 | */ |
| 261 | struct dsi_display *dsi_display_get_display_by_name(const char *name); |
| 262 | |
| 263 | /** |
| 264 | * dsi_display_set_active_state() - sets the state of the display |
| 265 | * @display: Handle to display. |
| 266 | * @is_active: state |
| 267 | */ |
| 268 | void dsi_display_set_active_state(struct dsi_display *display, bool is_active); |
| 269 | |
| 270 | /** |
Clarence Ip | 40d7d59 | 2016-07-15 16:02:26 -0400 | [diff] [blame] | 271 | * dsi_display_drm_bridge_init() - initializes DRM bridge object for DSI |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 272 | * @display: Handle to the display. |
| 273 | * @encoder: Pointer to the encoder object which is connected to the |
| 274 | * display. |
| 275 | * |
| 276 | * Return: error code. |
| 277 | */ |
Clarence Ip | 40d7d59 | 2016-07-15 16:02:26 -0400 | [diff] [blame] | 278 | int dsi_display_drm_bridge_init(struct dsi_display *display, |
| 279 | struct drm_encoder *enc); |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 280 | |
| 281 | /** |
Clarence Ip | 40d7d59 | 2016-07-15 16:02:26 -0400 | [diff] [blame] | 282 | * dsi_display_drm_bridge_deinit() - destroys DRM bridge for the display |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 283 | * @display: Handle to the display. |
| 284 | * |
| 285 | * Return: error code. |
| 286 | */ |
Clarence Ip | 40d7d59 | 2016-07-15 16:02:26 -0400 | [diff] [blame] | 287 | int dsi_display_drm_bridge_deinit(struct dsi_display *display); |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 288 | |
| 289 | /** |
| 290 | * dsi_display_get_info() - returns the display properties |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 291 | * @info: Pointer to the structure where info is stored. |
Clarence Ip | a403932 | 2016-07-15 16:23:59 -0400 | [diff] [blame] | 292 | * @disp: Handle to the display. |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 293 | * |
| 294 | * Return: error code. |
| 295 | */ |
Clarence Ip | a403932 | 2016-07-15 16:23:59 -0400 | [diff] [blame] | 296 | int dsi_display_get_info(struct msm_display_info *info, void *disp); |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 297 | |
| 298 | /** |
Jeykumar Sankaran | 446a5f1 | 2017-05-09 20:30:39 -0700 | [diff] [blame] | 299 | * dsi_display_get_mode_count() - get number of modes supported by the display |
| 300 | * @display: Handle to display. |
| 301 | * @count: Number of modes supported |
| 302 | * |
| 303 | * Return: error code. |
| 304 | */ |
| 305 | int dsi_display_get_mode_count(struct dsi_display *display, u32 *count); |
| 306 | |
| 307 | /** |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 308 | * dsi_display_get_modes() - get modes supported by display |
| 309 | * @display: Handle to display. |
Lloyd Atkinson | 560785e | 2017-11-16 14:04:15 -0500 | [diff] [blame] | 310 | * @modes; Output param, list of DSI modes. Number of modes matches |
| 311 | * count returned by dsi_display_get_mode_count |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 312 | * |
| 313 | * Return: error code. |
| 314 | */ |
| 315 | int dsi_display_get_modes(struct dsi_display *display, |
Lloyd Atkinson | 560785e | 2017-11-16 14:04:15 -0500 | [diff] [blame] | 316 | struct dsi_display_mode **modes); |
Jeykumar Sankaran | 446a5f1 | 2017-05-09 20:30:39 -0700 | [diff] [blame] | 317 | |
| 318 | /** |
| 319 | * dsi_display_put_mode() - free up mode created for the display |
| 320 | * @display: Handle to display. |
| 321 | * @mode: Display mode to be freed up |
| 322 | * |
| 323 | * Return: error code. |
| 324 | */ |
| 325 | void dsi_display_put_mode(struct dsi_display *display, |
| 326 | struct dsi_display_mode *mode); |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 327 | |
| 328 | /** |
Lloyd Atkinson | 560785e | 2017-11-16 14:04:15 -0500 | [diff] [blame] | 329 | * dsi_display_find_mode() - retrieve cached DSI mode given relevant params |
| 330 | * @display: Handle to display. |
| 331 | * @cmp: Mode to use as comparison to find original |
| 332 | * @out_mode: Output parameter, pointer to retrieved mode |
| 333 | * |
| 334 | * Return: error code. |
| 335 | */ |
| 336 | int dsi_display_find_mode(struct dsi_display *display, |
| 337 | const struct dsi_display_mode *cmp, |
| 338 | struct dsi_display_mode **out_mode); |
| 339 | /** |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 340 | * dsi_display_validate_mode() - validates if mode is supported by display |
| 341 | * @display: Handle to display. |
| 342 | * @mode: Mode to be validated. |
Ajay Singh Parmar | 62f795b | 2016-06-10 23:20:23 -0700 | [diff] [blame] | 343 | * @flags: Modifier flags. |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 344 | * |
| 345 | * Return: 0 if supported or error code. |
| 346 | */ |
| 347 | int dsi_display_validate_mode(struct dsi_display *display, |
Ajay Singh Parmar | 62f795b | 2016-06-10 23:20:23 -0700 | [diff] [blame] | 348 | struct dsi_display_mode *mode, |
| 349 | u32 flags); |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 350 | |
| 351 | /** |
Raviteja Tamatam | 68892de | 2017-06-20 04:47:19 +0530 | [diff] [blame] | 352 | * dsi_display_validate_mode_vrr() - validates mode if variable refresh case |
| 353 | * @display: Handle to display. |
| 354 | * @mode: Mode to be validated.. |
| 355 | * |
| 356 | * Return: 0 if error code. |
| 357 | */ |
| 358 | int dsi_display_validate_mode_vrr(struct dsi_display *display, |
| 359 | struct dsi_display_mode *cur_dsi_mode, |
| 360 | struct dsi_display_mode *mode); |
| 361 | |
| 362 | /** |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 363 | * dsi_display_set_mode() - Set mode on the display. |
| 364 | * @display: Handle to display. |
| 365 | * @mode: mode to be set. |
| 366 | * @flags: Modifier flags. |
| 367 | * |
| 368 | * Return: error code. |
| 369 | */ |
| 370 | int dsi_display_set_mode(struct dsi_display *display, |
| 371 | struct dsi_display_mode *mode, |
| 372 | u32 flags); |
| 373 | |
| 374 | /** |
| 375 | * dsi_display_prepare() - prepare display |
| 376 | * @display: Handle to display. |
| 377 | * |
| 378 | * Prepare will perform power up sequences for the host and panel hardware. |
| 379 | * Power and clock resources might be turned on (depending on the panel mode). |
| 380 | * The video engine is not enabled. |
| 381 | * |
| 382 | * Return: error code. |
| 383 | */ |
| 384 | int dsi_display_prepare(struct dsi_display *display); |
| 385 | |
| 386 | /** |
Shashank Babu Chinta Venkata | 7d60873 | 2017-05-31 14:10:26 -0700 | [diff] [blame] | 387 | * dsi_display_splash_res_cleanup() - cleanup for continuous splash |
| 388 | * @display: Pointer to dsi display |
| 389 | * Returns: Zero on success |
| 390 | */ |
| 391 | int dsi_display_splash_res_cleanup(struct dsi_display *display); |
| 392 | |
| 393 | /** |
| 394 | * dsi_display_config_ctrl_for_cont_splash()- Enable engine modes for DSI |
| 395 | * controller during continuous splash |
| 396 | * @display: Handle to DSI display |
| 397 | * |
| 398 | * Return: returns error code |
| 399 | */ |
| 400 | int dsi_display_config_ctrl_for_cont_splash(struct dsi_display *display); |
| 401 | |
| 402 | /** |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 403 | * dsi_display_enable() - enable display |
| 404 | * @display: Handle to display. |
| 405 | * |
| 406 | * Enable will turn on the host engine and the panel. At the end of the enable |
| 407 | * function, Host and panel hardware are ready to accept pixel data from |
| 408 | * upstream. |
| 409 | * |
| 410 | * Return: error code. |
| 411 | */ |
| 412 | int dsi_display_enable(struct dsi_display *display); |
| 413 | |
| 414 | /** |
| 415 | * dsi_display_post_enable() - perform post enable operations. |
| 416 | * @display: Handle to display. |
| 417 | * |
| 418 | * Some panels might require some commands to be sent after pixel data |
| 419 | * transmission has started. Such commands are sent as part of the post_enable |
| 420 | * function. |
| 421 | * |
| 422 | * Return: error code. |
| 423 | */ |
| 424 | int dsi_display_post_enable(struct dsi_display *display); |
| 425 | |
| 426 | /** |
| 427 | * dsi_display_pre_disable() - perform pre disable operations. |
| 428 | * @display: Handle to display. |
| 429 | * |
| 430 | * If a panel requires commands to be sent before pixel data transmission is |
| 431 | * stopped, those can be sent as part of pre_disable. |
| 432 | * |
| 433 | * Return: error code. |
| 434 | */ |
| 435 | int dsi_display_pre_disable(struct dsi_display *display); |
| 436 | |
| 437 | /** |
| 438 | * dsi_display_disable() - disable panel and host hardware. |
| 439 | * @display: Handle to display. |
| 440 | * |
| 441 | * Disable host and panel hardware and pixel data transmission can not continue. |
| 442 | * |
| 443 | * Return: error code. |
| 444 | */ |
| 445 | int dsi_display_disable(struct dsi_display *display); |
| 446 | |
| 447 | /** |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 448 | * dsi_pre_clkoff_cb() - Callback before clock is turned off |
| 449 | * @priv: private data pointer. |
| 450 | * @clk_type: clock which is being turned on. |
| 451 | * @new_state: next state for the clock. |
| 452 | * |
| 453 | * @return: error code. |
| 454 | */ |
| 455 | int dsi_pre_clkoff_cb(void *priv, enum dsi_clk_type clk_type, |
| 456 | enum dsi_clk_state new_state); |
| 457 | |
| 458 | /** |
Alexander Beykun | ac18235 | 2017-02-27 17:46:51 -0500 | [diff] [blame] | 459 | * dsi_display_update_pps() - update PPS buffer. |
| 460 | * @pps_cmd: PPS buffer. |
| 461 | * @display: Handle to display. |
| 462 | * |
| 463 | * Copies new PPS buffer into display structure. |
| 464 | * |
| 465 | * Return: error code. |
| 466 | */ |
| 467 | int dsi_display_update_pps(char *pps_cmd, void *display); |
| 468 | |
| 469 | /** |
Padmanabhan Komanduru | dbd2fb0 | 2016-12-02 15:18:49 +0530 | [diff] [blame] | 470 | * dsi_post_clkoff_cb() - Callback after clock is turned off |
| 471 | * @priv: private data pointer. |
| 472 | * @clk_type: clock which is being turned on. |
| 473 | * @curr_state: current state for the clock. |
| 474 | * |
| 475 | * @return: error code. |
| 476 | */ |
| 477 | int dsi_post_clkoff_cb(void *priv, enum dsi_clk_type clk_type, |
| 478 | enum dsi_clk_state curr_state); |
| 479 | |
| 480 | /** |
| 481 | * dsi_post_clkon_cb() - Callback after clock is turned on |
| 482 | * @priv: private data pointer. |
| 483 | * @clk_type: clock which is being turned on. |
| 484 | * @curr_state: current state for the clock. |
| 485 | * |
| 486 | * @return: error code. |
| 487 | */ |
| 488 | int dsi_post_clkon_cb(void *priv, enum dsi_clk_type clk_type, |
| 489 | enum dsi_clk_state curr_state); |
| 490 | |
| 491 | |
| 492 | /** |
| 493 | * dsi_pre_clkon_cb() - Callback before clock is turned on |
| 494 | * @priv: private data pointer. |
| 495 | * @clk_type: clock which is being turned on. |
| 496 | * @new_state: next state for the clock. |
| 497 | * |
| 498 | * @return: error code. |
| 499 | */ |
| 500 | int dsi_pre_clkon_cb(void *priv, enum dsi_clk_type clk_type, |
| 501 | enum dsi_clk_state new_state); |
| 502 | |
| 503 | /** |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 504 | * dsi_display_unprepare() - power off display hardware. |
| 505 | * @display: Handle to display. |
| 506 | * |
| 507 | * Host and panel hardware is turned off. Panel will be in reset state at the |
| 508 | * end of the function. |
| 509 | * |
| 510 | * Return: error code. |
| 511 | */ |
| 512 | int dsi_display_unprepare(struct dsi_display *display); |
| 513 | |
| 514 | int dsi_display_set_tpg_state(struct dsi_display *display, bool enable); |
| 515 | |
| 516 | int dsi_display_clock_gate(struct dsi_display *display, bool enable); |
| 517 | int dsi_dispaly_static_frame(struct dsi_display *display, bool enable); |
| 518 | |
Clarence Ip | 80ada7f | 2017-05-04 09:55:21 -0700 | [diff] [blame] | 519 | /** |
| 520 | * dsi_display_enable_event() - enable interrupt based connector event |
| 521 | * @display: Handle to display. |
| 522 | * @event_idx: Event index. |
| 523 | * @event_info: Event callback definition. |
| 524 | * @enable: Whether to enable/disable the event interrupt. |
| 525 | */ |
| 526 | void dsi_display_enable_event(struct dsi_display *display, |
| 527 | uint32_t event_idx, struct dsi_event_cb_info *event_info, |
| 528 | bool enable); |
| 529 | |
Vishnuvardhan Prodduturi | 75b9680 | 2016-10-17 18:45:55 +0530 | [diff] [blame] | 530 | int dsi_display_set_backlight(void *display, u32 bl_lvl); |
Lloyd Atkinson | 8c49c58 | 2016-11-18 14:23:54 -0500 | [diff] [blame] | 531 | |
| 532 | /** |
Sandeep Panda | 7945000 | 2017-05-08 17:14:24 +0530 | [diff] [blame] | 533 | * dsi_display_check_status() - check if panel is dead or alive |
| 534 | * @display: Handle to display. |
| 535 | */ |
| 536 | int dsi_display_check_status(void *display); |
| 537 | |
| 538 | /** |
Lloyd Atkinson | 8c49c58 | 2016-11-18 14:23:54 -0500 | [diff] [blame] | 539 | * dsi_display_soft_reset() - perform a soft reset on DSI controller |
| 540 | * @display: Handle to display |
| 541 | * |
| 542 | * The video, command and controller engines will be disabled before the |
| 543 | * reset is triggered. After, the engines will be re-enabled to the same state |
| 544 | * as before the reset. |
| 545 | * |
| 546 | * If the reset is done while MDP timing engine is turned on, the video |
| 547 | * engine should be re-enabled only during the vertical blanking time. |
| 548 | * |
| 549 | * Return: error code |
| 550 | */ |
| 551 | int dsi_display_soft_reset(void *display); |
Lloyd Atkinson | 05d7551 | 2017-01-17 14:45:51 -0500 | [diff] [blame] | 552 | |
Clarence Ip | 5f00c060 | 2017-08-02 14:26:31 -0400 | [diff] [blame] | 553 | /** |
| 554 | * dsi_display_set_power - update power/dpms setting |
| 555 | * @connector: Pointer to drm connector structure |
| 556 | * @power_mode: One of the following, |
| 557 | * SDE_MODE_DPMS_ON |
| 558 | * SDE_MODE_DPMS_LP1 |
| 559 | * SDE_MODE_DPMS_LP2 |
| 560 | * SDE_MODE_DPMS_STANDBY |
| 561 | * SDE_MODE_DPMS_SUSPEND |
| 562 | * SDE_MODE_DPMS_OFF |
| 563 | * @display: Pointer to private display structure |
| 564 | * Returns: Zero on success |
| 565 | */ |
| 566 | int dsi_display_set_power(struct drm_connector *connector, |
| 567 | int power_mode, void *display); |
| 568 | |
Lloyd Atkinson | 05d7551 | 2017-01-17 14:45:51 -0500 | [diff] [blame] | 569 | /* |
| 570 | * dsi_display_pre_kickoff - program kickoff-time features |
| 571 | * @display: Pointer to private display structure |
| 572 | * @params: Parameters for kickoff-time programming |
| 573 | * Returns: Zero on success |
| 574 | */ |
| 575 | int dsi_display_pre_kickoff(struct dsi_display *display, |
| 576 | struct msm_display_kickoff_params *params); |
Ping Li | 8430ee1 | 2017-02-24 14:14:44 -0800 | [diff] [blame] | 577 | /** |
| 578 | * dsi_display_get_dst_format() - get dst_format from DSI display |
| 579 | * @display: Handle to display |
| 580 | * |
| 581 | * Return: enum dsi_pixel_format type |
| 582 | */ |
| 583 | enum dsi_pixel_format dsi_display_get_dst_format(void *display); |
Lloyd Atkinson | 05d7551 | 2017-01-17 14:45:51 -0500 | [diff] [blame] | 584 | |
Ajay Singh Parmar | 571e301 | 2016-05-16 17:55:52 -0700 | [diff] [blame] | 585 | #endif /* _DSI_DISPLAY_H_ */ |