sde_encoder.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. /*
  2. * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
  3. * Copyright (C) 2013 Red Hat
  4. * Author: Rob Clark <[email protected]>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published by
  8. * the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along with
  16. * this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __SDE_ENCODER_H__
  19. #define __SDE_ENCODER_H__
  20. #include <drm/drm_crtc.h>
  21. #include <linux/sde_rsc.h>
  22. #include "msm_prop.h"
  23. #include "sde_hw_mdss.h"
  24. #include "sde_kms.h"
  25. #include "sde_connector.h"
  26. #include "sde_power_handle.h"
  27. /*
  28. * Two to anticipate panels that can do cmd/vid dynamic switching
  29. * plan is to create all possible physical encoder types, and switch between
  30. * them at runtime
  31. */
  32. #define NUM_PHYS_ENCODER_TYPES 2
  33. #define MAX_PHYS_ENCODERS_PER_VIRTUAL \
  34. (MAX_H_TILES_PER_DISPLAY * NUM_PHYS_ENCODER_TYPES)
  35. #define MAX_CHANNELS_PER_ENC 4
  36. #define SDE_ENCODER_FRAME_EVENT_DONE BIT(0)
  37. #define SDE_ENCODER_FRAME_EVENT_ERROR BIT(1)
  38. #define SDE_ENCODER_FRAME_EVENT_PANEL_DEAD BIT(2)
  39. #define SDE_ENCODER_FRAME_EVENT_SIGNAL_RELEASE_FENCE BIT(3)
  40. #define SDE_ENCODER_FRAME_EVENT_SIGNAL_RETIRE_FENCE BIT(4)
  41. #define SDE_ENCODER_FRAME_EVENT_CWB_DONE BIT(5)
  42. #define IDLE_POWERCOLLAPSE_DURATION (66 - 16/2)
  43. #define IDLE_POWERCOLLAPSE_IN_EARLY_WAKEUP (200 - 16/2)
  44. /**
  45. * Encoder functions and data types
  46. * @intfs: Interfaces this encoder is using, INTF_MODE_NONE if unused
  47. * @wbs: Writebacks this encoder is using, INTF_MODE_NONE if unused
  48. * @needs_cdm: Encoder requests a CDM based on pixel format conversion needs
  49. * @display_num_of_h_tiles: Number of horizontal tiles in case of split
  50. * interface
  51. * @display_type: Type of the display
  52. * @topology: Topology of the display
  53. * @comp_info: Compression parameters information
  54. */
  55. struct sde_encoder_hw_resources {
  56. enum sde_intf_mode intfs[INTF_MAX];
  57. enum sde_intf_mode wbs[WB_MAX];
  58. bool needs_cdm;
  59. u32 display_num_of_h_tiles;
  60. enum sde_connector_display display_type;
  61. struct msm_display_topology topology;
  62. struct msm_compression_info *comp_info;
  63. };
  64. /**
  65. * sde_encoder_kickoff_params - info encoder requires at kickoff
  66. * @affected_displays: bitmask, bit set means the ROI of the commit lies within
  67. * the bounds of the physical display at the bit index
  68. * @recovery_events_enabled: indicates status of client for recoovery events
  69. * @frame_trigger_mode: indicates frame trigger mode
  70. */
  71. struct sde_encoder_kickoff_params {
  72. unsigned long affected_displays;
  73. bool recovery_events_enabled;
  74. enum frame_trigger_mode_type frame_trigger_mode;
  75. };
  76. /*
  77. * enum sde_enc_rc_states - states that the resource control maintains
  78. * @SDE_ENC_RC_STATE_OFF: Resource is in OFF state
  79. * @SDE_ENC_RC_STATE_PRE_OFF: Resource is transitioning to OFF state
  80. * @SDE_ENC_RC_STATE_ON: Resource is in ON state
  81. * @SDE_ENC_RC_STATE_MODESET: Resource is in modeset state
  82. * @SDE_ENC_RC_STATE_IDLE: Resource is in IDLE state
  83. */
  84. enum sde_enc_rc_states {
  85. SDE_ENC_RC_STATE_OFF,
  86. SDE_ENC_RC_STATE_PRE_OFF,
  87. SDE_ENC_RC_STATE_ON,
  88. SDE_ENC_RC_STATE_MODESET,
  89. SDE_ENC_RC_STATE_IDLE
  90. };
  91. /**
  92. * struct sde_encoder_ops - callback functions for generic sde encoder
  93. * Individual callbacks documented below.
  94. */
  95. struct sde_encoder_ops {
  96. /**
  97. * phys_init - phys initialization function
  98. * @type: controller type
  99. * @controller_id: controller id
  100. * @phys_init_params: Pointer of structure sde_enc_phys_init_params
  101. * Returns: Pointer of sde_encoder_phys, NULL if failed
  102. */
  103. void *(*phys_init)(enum sde_intf_type type,
  104. u32 controller_id, void *phys_init_params);
  105. };
  106. /**
  107. * struct sde_encoder_virt - virtual encoder. Container of one or more physical
  108. * encoders. Virtual encoder manages one "logical" display. Physical
  109. * encoders manage one intf block, tied to a specific panel/sub-panel.
  110. * Virtual encoder defers as much as possible to the physical encoders.
  111. * Virtual encoder registers itself with the DRM Framework as the encoder.
  112. * @base: drm_encoder base class for registration with DRM
  113. * @enc_spin_lock: Virtual-Encoder-Wide Spin Lock for IRQ purposes
  114. * @bus_scaling_client: Client handle to the bus scaling interface
  115. * @te_source: vsync source pin information
  116. * @ops: Encoder ops from init function
  117. * @num_phys_encs: Actual number of physical encoders contained.
  118. * @phys_encs: Container of physical encoders managed.
  119. * @phys_vid_encs: Video physical encoders for panel mode switch.
  120. * @phys_cmd_encs: Command physical encoders for panel mode switch.
  121. * @cur_master: Pointer to the current master in this mode. Optimization
  122. * Only valid after enable. Cleared as disable.
  123. * @hw_pp Handle to the pingpong blocks used for the display. No.
  124. * pingpong blocks can be different than num_phys_encs.
  125. * @hw_dsc: Array of DSC block handles used for the display.
  126. * @hw_vdc: Array of VDC block handles used for the display.
  127. * @dirty_dsc_ids: Cached dsc indexes for dirty DSC blocks needing flush
  128. * @intfs_swapped Whether or not the phys_enc interfaces have been swapped
  129. * for partial update right-only cases, such as pingpong
  130. * split where virtual pingpong does not generate IRQs
  131. * @qdss_status: indicate if qdss is modified since last update
  132. * @crtc_vblank_cb: Callback into the upper layer / CRTC for
  133. * notification of the VBLANK
  134. * @crtc_vblank_cb_data: Data from upper layer for VBLANK notification
  135. * @crtc_kickoff_cb: Callback into CRTC that will flush & start
  136. * all CTL paths
  137. * @crtc_kickoff_cb_data: Opaque user data given to crtc_kickoff_cb
  138. * @debugfs_root: Debug file system root file node
  139. * @enc_lock: Lock around physical encoder create/destroy and
  140. access.
  141. * @frame_done_cnt: Atomic counter for tracking which phys_enc is
  142. * done with frame processing
  143. * @crtc_frame_event_cb: callback handler for frame event
  144. * @crtc_frame_event_cb_data: callback handler private data
  145. * @rsc_client: rsc client pointer
  146. * @rsc_state_init: boolean to indicate rsc config init
  147. * @disp_info: local copy of msm_display_info struct
  148. * @misr_enable: misr enable/disable status
  149. * @misr_frame_count: misr frame count before start capturing the data
  150. * @idle_pc_enabled: indicate if idle power collapse is enabled
  151. * currently. This can be controlled by user-mode
  152. * @rc_lock: resource control mutex lock to protect
  153. * virt encoder over various state changes
  154. * @rc_state: resource controller state
  155. * @delayed_off_work: delayed worker to schedule disabling of
  156. * clks and resources after IDLE_TIMEOUT time.
  157. * @input_event_work: worker to handle input device touch events
  158. * @esd_trigger_work: worker to handle esd trigger events
  159. * @input_handler: handler for input device events
  160. * @topology: topology of the display
  161. * @vblank_enabled: boolean to track userspace vblank vote
  162. * @idle_pc_restore: flag to indicate idle_pc_restore happened
  163. * @frame_trigger_mode: frame trigger mode indication for command mode
  164. * display
  165. * @dynamic_hdr_updated: flag to indicate if mempool was unchanged
  166. * @rsc_config: rsc configuration for display vtotal, fps, etc.
  167. * @cur_conn_roi: current connector roi
  168. * @prv_conn_roi: previous connector roi to optimize if unchanged
  169. * @crtc pointer to drm_crtc
  170. * @recovery_events_enabled: status of hw recovery feature enable by client
  171. * @elevated_ahb_vote: increase AHB bus speed for the first frame
  172. * after power collapse
  173. * @pm_qos_cpu_req: qos request for all cpu core frequency
  174. * @valid_cpu_mask: actual voted cpu core mask
  175. * @mode_info: stores the current mode and should be used
  176. * only in commit phase
  177. */
  178. struct sde_encoder_virt {
  179. struct drm_encoder base;
  180. spinlock_t enc_spinlock;
  181. struct mutex vblank_ctl_lock;
  182. uint32_t bus_scaling_client;
  183. uint32_t display_num_of_h_tiles;
  184. uint32_t te_source;
  185. struct sde_encoder_ops ops;
  186. unsigned int num_phys_encs;
  187. struct sde_encoder_phys *phys_encs[MAX_PHYS_ENCODERS_PER_VIRTUAL];
  188. struct sde_encoder_phys *phys_vid_encs[MAX_PHYS_ENCODERS_PER_VIRTUAL];
  189. struct sde_encoder_phys *phys_cmd_encs[MAX_PHYS_ENCODERS_PER_VIRTUAL];
  190. struct sde_encoder_phys *cur_master;
  191. struct sde_hw_pingpong *hw_pp[MAX_CHANNELS_PER_ENC];
  192. struct sde_hw_dsc *hw_dsc[MAX_CHANNELS_PER_ENC];
  193. struct sde_hw_vdc *hw_vdc[MAX_CHANNELS_PER_ENC];
  194. struct sde_hw_pingpong *hw_dsc_pp[MAX_CHANNELS_PER_ENC];
  195. enum sde_dsc dirty_dsc_ids[MAX_CHANNELS_PER_ENC];
  196. enum sde_vdc dirty_vdc_ids[MAX_CHANNELS_PER_ENC];
  197. bool intfs_swapped;
  198. bool qdss_status;
  199. void (*crtc_vblank_cb)(void *data);
  200. void *crtc_vblank_cb_data;
  201. struct dentry *debugfs_root;
  202. struct mutex enc_lock;
  203. atomic_t frame_done_cnt[MAX_PHYS_ENCODERS_PER_VIRTUAL];
  204. void (*crtc_frame_event_cb)(void *data, u32 event);
  205. struct sde_kms_frame_event_cb_data crtc_frame_event_cb_data;
  206. struct sde_rsc_client *rsc_client;
  207. bool rsc_state_init;
  208. struct msm_display_info disp_info;
  209. bool misr_enable;
  210. u32 misr_frame_count;
  211. bool idle_pc_enabled;
  212. struct mutex rc_lock;
  213. enum sde_enc_rc_states rc_state;
  214. struct kthread_delayed_work delayed_off_work;
  215. struct kthread_work input_event_work;
  216. struct kthread_work esd_trigger_work;
  217. struct input_handler *input_handler;
  218. struct msm_display_topology topology;
  219. bool vblank_enabled;
  220. bool idle_pc_restore;
  221. enum frame_trigger_mode_type frame_trigger_mode;
  222. bool dynamic_hdr_updated;
  223. struct sde_rsc_cmd_config rsc_config;
  224. struct sde_rect cur_conn_roi;
  225. struct sde_rect prv_conn_roi;
  226. struct drm_crtc *crtc;
  227. bool recovery_events_enabled;
  228. bool elevated_ahb_vote;
  229. struct dev_pm_qos_request pm_qos_cpu_req[NR_CPUS];
  230. struct cpumask valid_cpu_mask;
  231. struct msm_mode_info mode_info;
  232. };
  233. #define to_sde_encoder_virt(x) container_of(x, struct sde_encoder_virt, base)
  234. /**
  235. * sde_encoder_get_hw_resources - Populate table of required hardware resources
  236. * @encoder: encoder pointer
  237. * @hw_res: resource table to populate with encoder required resources
  238. * @conn_state: report hw reqs based on this proposed connector state
  239. */
  240. void sde_encoder_get_hw_resources(struct drm_encoder *encoder,
  241. struct sde_encoder_hw_resources *hw_res,
  242. struct drm_connector_state *conn_state);
  243. /**
  244. * sde_encoder_register_vblank_callback - provide callback to encoder that
  245. * will be called on the next vblank.
  246. * @encoder: encoder pointer
  247. * @cb: callback pointer, provide NULL to deregister and disable IRQs
  248. * @data: user data provided to callback
  249. */
  250. void sde_encoder_register_vblank_callback(struct drm_encoder *encoder,
  251. void (*cb)(void *), void *data);
  252. /**
  253. * sde_encoder_register_frame_event_callback - provide callback to encoder that
  254. * will be called after the request is complete, or other events.
  255. * @encoder: encoder pointer
  256. * @cb: callback pointer, provide NULL to deregister
  257. * @crtc: pointer to drm_crtc object interested in frame events
  258. */
  259. void sde_encoder_register_frame_event_callback(struct drm_encoder *encoder,
  260. void (*cb)(void *, u32), struct drm_crtc *crtc);
  261. /**
  262. * sde_encoder_get_rsc_client - gets the rsc client state for primary
  263. * for primary display.
  264. * @encoder: encoder pointer
  265. */
  266. struct sde_rsc_client *sde_encoder_get_rsc_client(struct drm_encoder *encoder);
  267. /**
  268. * sde_encoder_poll_line_counts - poll encoder line counts for start of frame
  269. * @encoder: encoder pointer
  270. * @Returns: zero on success
  271. */
  272. int sde_encoder_poll_line_counts(struct drm_encoder *encoder);
  273. /**
  274. * sde_encoder_prepare_for_kickoff - schedule double buffer flip of the ctl
  275. * path (i.e. ctl flush and start) at next appropriate time.
  276. * Immediately: if no previous commit is outstanding.
  277. * Delayed: Block until next trigger can be issued.
  278. * @encoder: encoder pointer
  279. * @params: kickoff time parameters
  280. * @Returns: Zero on success, last detected error otherwise
  281. */
  282. int sde_encoder_prepare_for_kickoff(struct drm_encoder *encoder,
  283. struct sde_encoder_kickoff_params *params);
  284. /**
  285. * sde_encoder_trigger_kickoff_pending - Clear the flush bits from previous
  286. * kickoff and trigger the ctl prepare progress for command mode display.
  287. * @encoder: encoder pointer
  288. */
  289. void sde_encoder_trigger_kickoff_pending(struct drm_encoder *encoder);
  290. /**
  291. * sde_encoder_kickoff - trigger a double buffer flip of the ctl path
  292. * (i.e. ctl flush and start) immediately.
  293. * @encoder: encoder pointer
  294. * @is_error: whether the current commit needs to be aborted and replaced
  295. * with a 'safe' commit
  296. */
  297. void sde_encoder_kickoff(struct drm_encoder *encoder, bool is_error);
  298. /**
  299. * sde_encoder_wait_for_event - Waits for encoder events
  300. * @encoder: encoder pointer
  301. * @event: event to wait for
  302. * MSM_ENC_COMMIT_DONE - Wait for hardware to have flushed the current pending
  303. * frames to hardware at a vblank or wr_ptr_start
  304. * Encoders will map this differently depending on the
  305. * panel type.
  306. * vid mode -> vsync_irq
  307. * cmd mode -> wr_ptr_start_irq
  308. * MSM_ENC_TX_COMPLETE - Wait for the hardware to transfer all the pixels to
  309. * the panel. Encoders will map this differently
  310. * depending on the panel type.
  311. * vid mode -> vsync_irq
  312. * cmd mode -> pp_done
  313. * Returns: 0 on success, -EWOULDBLOCK if already signaled, error otherwise
  314. */
  315. int sde_encoder_wait_for_event(struct drm_encoder *drm_encoder,
  316. enum msm_event_wait event);
  317. /**
  318. * sde_encoder_idle_request - request for idle request to avoid 4 vsync cycle
  319. * to turn off the clocks.
  320. * @encoder: encoder pointer
  321. * Returns: 0 on success, errorcode otherwise
  322. */
  323. int sde_encoder_idle_request(struct drm_encoder *drm_enc);
  324. /*
  325. * sde_encoder_get_fps - get interface frame rate of the given encoder
  326. * @encoder: Pointer to drm encoder object
  327. */
  328. u32 sde_encoder_get_fps(struct drm_encoder *encoder);
  329. /*
  330. * sde_encoder_get_intf_mode - get interface mode of the given encoder
  331. * @encoder: Pointer to drm encoder object
  332. */
  333. enum sde_intf_mode sde_encoder_get_intf_mode(struct drm_encoder *encoder);
  334. /**
  335. * sde_encoder_control_te - control enabling/disabling VSYNC_IN_EN
  336. * @encoder: encoder pointer
  337. * @enable: boolean to indicate enable/disable
  338. */
  339. void sde_encoder_control_te(struct drm_encoder *encoder, bool enable);
  340. /**
  341. * sde_encoder_virt_restore - restore the encoder configs
  342. * @encoder: encoder pointer
  343. */
  344. void sde_encoder_virt_restore(struct drm_encoder *encoder);
  345. /**
  346. * sde_encoder_is_dsc_merge - check if encoder is in DSC merge mode
  347. * @drm_enc: Pointer to drm encoder object
  348. * @Return: true if encoder is in DSC merge mode
  349. */
  350. bool sde_encoder_is_dsc_merge(struct drm_encoder *drm_enc);
  351. /**
  352. * sde_encoder_check_curr_mode - check if given mode is supported or not
  353. * @drm_enc: Pointer to drm encoder object
  354. * @mode: Mode to be checked
  355. * @Return: true if it is cmd mode
  356. */
  357. bool sde_encoder_check_curr_mode(struct drm_encoder *drm_enc, u32 mode);
  358. /**
  359. * sde_encoder_init - initialize virtual encoder object
  360. * @dev: Pointer to drm device structure
  361. * @disp_info: Pointer to display information structure
  362. * Returns: Pointer to newly created drm encoder
  363. */
  364. struct drm_encoder *sde_encoder_init(
  365. struct drm_device *dev,
  366. struct msm_display_info *disp_info);
  367. /**
  368. * sde_encoder_init_with_ops - initialize virtual encoder object with init ops
  369. * @dev: Pointer to drm device structure
  370. * @disp_info: Pointer to display information structure
  371. * @ops: Pointer to encoder ops structure
  372. * Returns: Pointer to newly created drm encoder
  373. */
  374. struct drm_encoder *sde_encoder_init_with_ops(
  375. struct drm_device *dev,
  376. struct msm_display_info *disp_info,
  377. const struct sde_encoder_ops *ops);
  378. /**
  379. * sde_encoder_destroy - destroy previously initialized virtual encoder
  380. * @drm_enc: Pointer to previously created drm encoder structure
  381. */
  382. void sde_encoder_destroy(struct drm_encoder *drm_enc);
  383. /**
  384. * sde_encoder_prepare_commit - prepare encoder at the very beginning of an
  385. * atomic commit, before any registers are written
  386. * @drm_enc: Pointer to previously created drm encoder structure
  387. */
  388. int sde_encoder_prepare_commit(struct drm_encoder *drm_enc);
  389. /**
  390. * sde_encoder_update_caps_for_cont_splash - update encoder settings during
  391. * device bootup when cont_splash is enabled
  392. * @drm_enc: Pointer to drm encoder structure
  393. * @splash_display: Pointer to sde_splash_display corresponding to this encoder
  394. * @enable: boolean indicates enable or displae state of splash
  395. * @Return: true if successful in updating the encoder structure
  396. */
  397. int sde_encoder_update_caps_for_cont_splash(struct drm_encoder *encoder,
  398. struct sde_splash_display *splash_display, bool enable);
  399. /**
  400. * sde_encoder_display_failure_notification - update sde encoder state for
  401. * esd timeout or other display failure notification. This event flows from
  402. * dsi, sde_connector to sde_encoder.
  403. *
  404. * This api must not be called from crtc_commit (display) thread because it
  405. * requests the flush work on same thread. It is called from esd check thread
  406. * based on current design.
  407. *
  408. * TODO: manage the event at sde_kms level for forward processing.
  409. * @drm_enc: Pointer to drm encoder structure
  410. * @skip_pre_kickoff: Caller can avoid pre_kickoff if it is triggering this
  411. * event only to switch the panel TE to watchdog mode.
  412. * @Return: true if successful in updating the encoder structure
  413. */
  414. int sde_encoder_display_failure_notification(struct drm_encoder *enc,
  415. bool skip_pre_kickoff);
  416. /**
  417. * sde_encoder_recovery_events_enabled - checks if client has enabled
  418. * sw recovery mechanism for this connector
  419. * @drm_enc: Pointer to drm encoder structure
  420. * @Return: true if enabled
  421. */
  422. bool sde_encoder_recovery_events_enabled(struct drm_encoder *encoder);
  423. /**
  424. * sde_encoder_recovery_events_handler - handler to enable/disable the
  425. * sw recovery for this connector
  426. * @drm_enc: Pointer to drm encoder structure
  427. */
  428. void sde_encoder_recovery_events_handler(struct drm_encoder *encoder,
  429. bool val);
  430. /**
  431. * sde_encoder_in_clone_mode - checks if underlying phys encoder is in clone
  432. * mode or independent display mode. ref@ WB in Concurrent writeback mode.
  433. * @drm_enc: Pointer to drm encoder structure
  434. * @Return: true if successful in updating the encoder structure
  435. */
  436. bool sde_encoder_in_clone_mode(struct drm_encoder *enc);
  437. /**
  438. * sde_encoder_is_primary_display - checks if underlying display is primary
  439. * display or not.
  440. * @drm_enc: Pointer to drm encoder structure
  441. * @Return: true if it is primary display. false if secondary display
  442. */
  443. bool sde_encoder_is_primary_display(struct drm_encoder *enc);
  444. /**
  445. * sde_encoder_is_dsi_display - checks if underlying display is DSI
  446. * display or not.
  447. * @drm_enc: Pointer to drm encoder structure
  448. * @Return: true if it is primary display. false if secondary display
  449. */
  450. bool sde_encoder_is_dsi_display(struct drm_encoder *enc);
  451. /**
  452. * sde_encoder_control_idle_pc - control enable/disable of idle power collapse
  453. * @drm_enc: Pointer to drm encoder structure
  454. * @enable: enable/disable flag
  455. */
  456. void sde_encoder_control_idle_pc(struct drm_encoder *enc, bool enable);
  457. /**
  458. * sde_encoder_in_cont_splash - checks if display is in continuous splash
  459. * @drm_enc: Pointer to drm encoder structure
  460. * @Return: true if display in continuous splash
  461. */
  462. int sde_encoder_in_cont_splash(struct drm_encoder *enc);
  463. /**
  464. * sde_encoder_helper_hw_reset - hw reset helper function
  465. * @drm_enc: Pointer to drm encoder structure
  466. */
  467. void sde_encoder_needs_hw_reset(struct drm_encoder *enc);
  468. /**
  469. * sde_encoder_uidle_enable - control enable/disable of uidle
  470. * @drm_enc: Pointer to drm encoder structure
  471. * @enable: enable/disable flag
  472. */
  473. void sde_encoder_uidle_enable(struct drm_encoder *drm_enc, bool enable);
  474. /**
  475. * sde_encoder_irq_control - control enable/disable of IRQ's
  476. * @drm_enc: Pointer to drm encoder structure
  477. * @enable: enable/disable flag
  478. */
  479. void sde_encoder_irq_control(struct drm_encoder *drm_enc, bool enable);
  480. /**
  481. * sde_encoder_get_kms - retrieve the kms from encoder
  482. * @drm_enc: Pointer to drm encoder structure
  483. */
  484. static inline struct sde_kms *sde_encoder_get_kms(struct drm_encoder *drm_enc)
  485. {
  486. struct msm_drm_private *priv;
  487. if (!drm_enc || !drm_enc->dev) {
  488. SDE_ERROR("invalid encoder\n");
  489. return NULL;
  490. }
  491. priv = drm_enc->dev->dev_private;
  492. if (!priv || !priv->kms) {
  493. SDE_ERROR("invalid kms\n");
  494. return NULL;
  495. }
  496. return to_sde_kms(priv->kms);
  497. }
  498. /*
  499. * sde_encoder_is_widebus_enabled - check if widebus is enabled for current mode
  500. * @drm_enc: Pointer to drm encoder structure
  501. * @Return: true if widebus is enabled for current mode
  502. */
  503. static inline bool sde_encoder_is_widebus_enabled(struct drm_encoder *drm_enc)
  504. {
  505. struct sde_encoder_virt *sde_enc;
  506. if (!drm_enc)
  507. return false;
  508. sde_enc = to_sde_encoder_virt(drm_enc);
  509. return sde_enc->mode_info.wide_bus_en;
  510. }
  511. #endif /* __SDE_ENCODER_H__ */