blob: 87b9fd51b54b15ef70b88bef7ae277460146237d [file] [log] [blame]
Ajay Singh Parmar571e3012016-05-16 17:55:52 -07001/*
Shashank Babu Chinta Venkata7d608732017-05-31 14:10:26 -07002 * Copyright (c) 2015-2017, The Linux Foundation.All rights reserved.
Ajay Singh Parmar571e3012016-05-16 17:55:52 -07003 *
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 Parmar48ea4272016-06-27 11:44:34 -070020#include <linux/debugfs.h>
Ajay Singh Parmar571e3012016-05-16 17:55:52 -070021#include <linux/of_device.h>
22#include <drm/drmP.h>
23#include <drm/drm_crtc.h>
24
Clarence Ipa4039322016-07-15 16:23:59 -040025#include "msm_drv.h"
Ajay Singh Parmar571e3012016-05-16 17:55:52 -070026#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 Venkata74a03f12017-02-28 11:24:51 -080032#define DSI_CLIENT_NAME_SIZE 20
Chandan Uddaraju7e9613a2017-06-01 13:10:55 -070033#define MAX_CMDLINE_PARAM_LEN 512
Ajay Singh Parmar62f795b2016-06-10 23:20:23 -070034/*
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 Parmar571e3012016-05-16 17:55:52 -070040/**
Shashank Babu Chinta Venkataded9c562017-03-15 14:43:46 -070041 * 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 */
46enum dsi_display_selection_type {
47 DSI_PRIMARY = 0,
48 DSI_SECONDARY,
49 MAX_DSI_ACTIVE_DISPLAY,
50};
51
52/**
Ajay Singh Parmar571e3012016-05-16 17:55:52 -070053 * 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 */
62enum 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 Parmar571e3012016-05-16 17:55:52 -070071 * 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 Parmar571e3012016-05-16 17:55:52 -070076 * @phy: Handle to the DSI PHY device.
77 * @phy_of_node: pHandle to the DSI PHY device.
78 * @phy_enabled: PHY power status.
79 */
80struct 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 Parmar571e3012016-05-16 17:55:52 -070087
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 Venkataded9c562017-03-15 14:43:46 -070094/**
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 Uddaraju7e9613a2017-06-01 13:10:55 -0700100 * @cmdline_topology: Display topology shared from kernel command line.
Shashank Babu Chinta Venkataded9c562017-03-15 14:43:46 -0700101 */
102struct dsi_display_boot_param {
Chandan Uddaraju7e9613a2017-06-01 13:10:55 -0700103 char name[MAX_CMDLINE_PARAM_LEN];
Shashank Babu Chinta Venkataded9c562017-03-15 14:43:46 -0700104 bool boot_disp_en;
105 bool is_primary;
106 int length;
107 struct device_node *node;
Chandan Uddaraju7e9613a2017-06-01 13:10:55 -0700108 int cmdline_topology;
Shashank Babu Chinta Venkataded9c562017-03-15 14:43:46 -0700109};
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700110
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 */
117struct 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 Ip458a5d02017-11-27 18:15:16 -0500127 * @drm_conn: Pointer to DRM connector associated with the display
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700128 * @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 Venkata7d608732017-05-31 14:10:26 -0700132 * @is_cont_splash_enabled: Is continuous splash enabled
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700133 * @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 Atkinson560785e2017-11-16 14:04:15 -0500138 * @modes: Array of probed DSI modes
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700139 * @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 Komandurudbd2fb02016-12-02 15:18:49 +0530145 * @config: DSI host configuration information.
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700146 * @lane_map: Lane mapping between DSI host and Panel.
Chandan Uddaraju7e9613a2017-06-01 13:10:55 -0700147 * @cmdline_topology: Display topology shared from kernel command line.
Jeykumar Sankaran446a5f12017-05-09 20:30:39 -0700148 * @cmdline_timing: Display timing shared from kernel command line.
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700149 * @is_tpg_enabled: TPG state.
Padmanabhan Komandurudbd2fb02016-12-02 15:18:49 +0530150 * @ulps_enabled: ulps state.
151 * @clamp_enabled: clamp state.
152 * @phy_idle_power_off: PHY power state.
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700153 * @host: DRM MIPI DSI Host.
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700154 * @bridge: Pointer to DRM bridge object.
Lloyd Atkinsone404caf2016-07-13 17:26:45 -0400155 * @cmd_engine_refcount: Reference count enforcing single instance of cmd eng
Padmanabhan Komandurudbd2fb02016-12-02 15:18:49 +0530156 * @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 Subbiah01e6dd642017-07-05 14:47:47 -0400160 * @misr_enable Frame MISR enable/disable
161 * @misr_frame_count Number of frames to accumulate the MISR value
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700162 */
163struct dsi_display {
164 struct platform_device *pdev;
165 struct drm_device *drm_dev;
Clarence Ip458a5d02017-11-27 18:15:16 -0500166 struct drm_connector *drm_conn;
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700167
168 const char *name;
169 const char *display_type;
170 struct list_head list;
171 bool is_active;
Shashank Babu Chinta Venkata7d608732017-05-31 14:10:26 -0700172 bool is_cont_splash_enabled;
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700173 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 Atkinson560785e2017-11-16 14:04:15 -0500182 struct dsi_display_mode *modes;
183
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700184 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 Komanduru8ee8ee52016-12-19 12:10:51 +0530191 struct dsi_lane_map lane_map;
Chandan Uddaraju7e9613a2017-06-01 13:10:55 -0700192 int cmdline_topology;
Jeykumar Sankaran446a5f12017-05-09 20:30:39 -0700193 int cmdline_timing;
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700194 bool is_tpg_enabled;
Padmanabhan Komandurudbd2fb02016-12-02 15:18:49 +0530195 bool ulps_enabled;
196 bool clamp_enabled;
197 bool phy_idle_power_off;
Shashank Babu Chinta Venkata82109522017-05-09 18:59:21 -0700198 struct drm_gem_object *tx_cmd_buf;
199 u32 cmd_buffer_size;
200 u32 cmd_buffer_iova;
201 void *vaddr;
Veera Sundaram Sankarana2d50582017-10-19 17:49:48 -0700202 struct msm_gem_address_space *aspace;
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700203
204 struct mipi_dsi_host host;
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700205 struct dsi_bridge *bridge;
Ajay Singh Parmaraa9152d2016-05-16 18:02:07 -0700206 u32 cmd_engine_refcount;
Ajay Singh Parmar48ea4272016-06-27 11:44:34 -0700207
Shashank Babu Chinta Venkata7d608732017-05-31 14:10:26 -0700208 struct sde_power_handle *phandle;
209 struct sde_power_client *cont_splash_client;
210
Padmanabhan Komandurudbd2fb02016-12-02 15:18:49 +0530211 void *clk_mngr;
212 void *dsi_clk_handle;
213 void *mdp_clk_handle;
214
Ajay Singh Parmar48ea4272016-06-27 11:44:34 -0700215 /* DEBUG FS */
216 struct dentry *root;
Rajkumar Subbiah01e6dd642017-07-05 14:47:47 -0400217
218 bool misr_enable;
219 u32 misr_frame_count;
Sandeep Panda11b20d82017-06-19 12:57:27 +0530220 /* 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 Parmar571e3012016-05-16 17:55:52 -0700225};
226
227int dsi_display_dev_probe(struct platform_device *pdev);
228int dsi_display_dev_remove(struct platform_device *pdev);
229
230/**
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700231 * dsi_display_get_num_of_displays() - returns number of display devices
232 * supported.
233 *
234 * Return: number of displays.
235 */
Clarence Ip3649f8b2016-10-31 09:59:44 -0400236int dsi_display_get_num_of_displays(void);
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700237
238/**
Clarence Ipa36c92e2016-07-26 14:33:46 -0400239 * 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 Parmar571e3012016-05-16 17:55:52 -0700243 */
Clarence Ipa36c92e2016-07-26 14:33:46 -0400244int dsi_display_get_active_displays(void **display_array,
245 u32 max_display_count);
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700246
247/**
Shashank Babu Chinta Venkataded9c562017-03-15 14:43:46 -0700248 * 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 */
253struct device_node *dsi_display_get_boot_display(int index);
254
255/**
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700256 * dsi_display_get_display_by_name()- finds display by name
Shashank Babu Chinta Venkataded9c562017-03-15 14:43:46 -0700257 * @name: name of the display.
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700258 *
259 * Return: handle to the display or error code.
260 */
261struct 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 */
268void dsi_display_set_active_state(struct dsi_display *display, bool is_active);
269
270/**
Clarence Ip40d7d592016-07-15 16:02:26 -0400271 * dsi_display_drm_bridge_init() - initializes DRM bridge object for DSI
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700272 * @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 Ip40d7d592016-07-15 16:02:26 -0400278int dsi_display_drm_bridge_init(struct dsi_display *display,
279 struct drm_encoder *enc);
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700280
281/**
Clarence Ip40d7d592016-07-15 16:02:26 -0400282 * dsi_display_drm_bridge_deinit() - destroys DRM bridge for the display
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700283 * @display: Handle to the display.
284 *
285 * Return: error code.
286 */
Clarence Ip40d7d592016-07-15 16:02:26 -0400287int dsi_display_drm_bridge_deinit(struct dsi_display *display);
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700288
289/**
290 * dsi_display_get_info() - returns the display properties
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700291 * @info: Pointer to the structure where info is stored.
Clarence Ipa4039322016-07-15 16:23:59 -0400292 * @disp: Handle to the display.
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700293 *
294 * Return: error code.
295 */
Clarence Ipa4039322016-07-15 16:23:59 -0400296int dsi_display_get_info(struct msm_display_info *info, void *disp);
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700297
298/**
Jeykumar Sankaran446a5f12017-05-09 20:30:39 -0700299 * 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 */
305int dsi_display_get_mode_count(struct dsi_display *display, u32 *count);
306
307/**
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700308 * dsi_display_get_modes() - get modes supported by display
309 * @display: Handle to display.
Lloyd Atkinson560785e2017-11-16 14:04:15 -0500310 * @modes; Output param, list of DSI modes. Number of modes matches
311 * count returned by dsi_display_get_mode_count
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700312 *
313 * Return: error code.
314 */
315int dsi_display_get_modes(struct dsi_display *display,
Lloyd Atkinson560785e2017-11-16 14:04:15 -0500316 struct dsi_display_mode **modes);
Jeykumar Sankaran446a5f12017-05-09 20:30:39 -0700317
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 */
325void dsi_display_put_mode(struct dsi_display *display,
326 struct dsi_display_mode *mode);
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700327
328/**
Lloyd Atkinson560785e2017-11-16 14:04:15 -0500329 * 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 */
336int 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 Parmar571e3012016-05-16 17:55:52 -0700340 * dsi_display_validate_mode() - validates if mode is supported by display
341 * @display: Handle to display.
342 * @mode: Mode to be validated.
Ajay Singh Parmar62f795b2016-06-10 23:20:23 -0700343 * @flags: Modifier flags.
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700344 *
345 * Return: 0 if supported or error code.
346 */
347int dsi_display_validate_mode(struct dsi_display *display,
Ajay Singh Parmar62f795b2016-06-10 23:20:23 -0700348 struct dsi_display_mode *mode,
349 u32 flags);
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700350
351/**
Raviteja Tamatam68892de2017-06-20 04:47:19 +0530352 * 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 */
358int 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 Parmar571e3012016-05-16 17:55:52 -0700363 * 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 */
370int 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 */
384int dsi_display_prepare(struct dsi_display *display);
385
386/**
Shashank Babu Chinta Venkata7d608732017-05-31 14:10:26 -0700387 * dsi_display_splash_res_cleanup() - cleanup for continuous splash
388 * @display: Pointer to dsi display
389 * Returns: Zero on success
390 */
391int 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 */
400int dsi_display_config_ctrl_for_cont_splash(struct dsi_display *display);
401
402/**
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700403 * 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 */
412int 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 */
424int 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 */
435int 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 */
445int dsi_display_disable(struct dsi_display *display);
446
447/**
Padmanabhan Komandurudbd2fb02016-12-02 15:18:49 +0530448 * 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 */
455int dsi_pre_clkoff_cb(void *priv, enum dsi_clk_type clk_type,
456 enum dsi_clk_state new_state);
457
458/**
Alexander Beykunac182352017-02-27 17:46:51 -0500459 * 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 */
467int dsi_display_update_pps(char *pps_cmd, void *display);
468
469/**
Padmanabhan Komandurudbd2fb02016-12-02 15:18:49 +0530470 * 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 */
477int 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 */
488int 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 */
500int dsi_pre_clkon_cb(void *priv, enum dsi_clk_type clk_type,
501 enum dsi_clk_state new_state);
502
503/**
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700504 * 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 */
512int dsi_display_unprepare(struct dsi_display *display);
513
514int dsi_display_set_tpg_state(struct dsi_display *display, bool enable);
515
516int dsi_display_clock_gate(struct dsi_display *display, bool enable);
517int dsi_dispaly_static_frame(struct dsi_display *display, bool enable);
518
Clarence Ip80ada7f2017-05-04 09:55:21 -0700519/**
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 */
526void 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 Prodduturi75b96802016-10-17 18:45:55 +0530530int dsi_display_set_backlight(void *display, u32 bl_lvl);
Lloyd Atkinson8c49c582016-11-18 14:23:54 -0500531
532/**
Sandeep Panda79450002017-05-08 17:14:24 +0530533 * dsi_display_check_status() - check if panel is dead or alive
534 * @display: Handle to display.
535 */
536int dsi_display_check_status(void *display);
537
538/**
Lloyd Atkinson8c49c582016-11-18 14:23:54 -0500539 * 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 */
551int dsi_display_soft_reset(void *display);
Lloyd Atkinson05d75512017-01-17 14:45:51 -0500552
Clarence Ip5f00c0602017-08-02 14:26:31 -0400553/**
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 */
566int dsi_display_set_power(struct drm_connector *connector,
567 int power_mode, void *display);
568
Lloyd Atkinson05d75512017-01-17 14:45:51 -0500569/*
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 */
575int dsi_display_pre_kickoff(struct dsi_display *display,
576 struct msm_display_kickoff_params *params);
Ping Li8430ee12017-02-24 14:14:44 -0800577/**
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 */
583enum dsi_pixel_format dsi_display_get_dst_format(void *display);
Lloyd Atkinson05d75512017-01-17 14:45:51 -0500584
Ajay Singh Parmar571e3012016-05-16 17:55:52 -0700585#endif /* _DSI_DISPLAY_H_ */