dsi_display.h 22 KB

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