intel_drv.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. /*
  2. * Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
  3. * Copyright (c) 2007-2008 Intel Corporation
  4. * Jesse Barnes <jesse.barnes@intel.com>
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the "Software"),
  8. * to deal in the Software without restriction, including without limitation
  9. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the
  11. * Software is furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice (including the next
  14. * paragraph) shall be included in all copies or substantial portions of the
  15. * Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  20. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  22. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  23. * IN THE SOFTWARE.
  24. */
  25. #ifndef __INTEL_DRV_H__
  26. #define __INTEL_DRV_H__
  27. #include <linux/i2c.h>
  28. #include "i915_drm.h"
  29. #include "i915_drv.h"
  30. #include "drm_crtc.h"
  31. #include "drm_crtc_helper.h"
  32. #include "drm_fb_helper.h"
  33. #include "drm_dp_helper.h"
  34. #define _wait_for(COND, MS, W) ({ \
  35. unsigned long timeout__ = jiffies + msecs_to_jiffies(MS); \
  36. int ret__ = 0; \
  37. while (!(COND)) { \
  38. if (time_after(jiffies, timeout__)) { \
  39. ret__ = -ETIMEDOUT; \
  40. break; \
  41. } \
  42. if (W && drm_can_sleep()) msleep(W); \
  43. } \
  44. ret__; \
  45. })
  46. #define wait_for_atomic_us(COND, US) ({ \
  47. unsigned long timeout__ = jiffies + usecs_to_jiffies(US); \
  48. int ret__ = 0; \
  49. while (!(COND)) { \
  50. if (time_after(jiffies, timeout__)) { \
  51. ret__ = -ETIMEDOUT; \
  52. break; \
  53. } \
  54. cpu_relax(); \
  55. } \
  56. ret__; \
  57. })
  58. #define wait_for(COND, MS) _wait_for(COND, MS, 1)
  59. #define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0)
  60. #define KHz(x) (1000*x)
  61. #define MHz(x) KHz(1000*x)
  62. /*
  63. * Display related stuff
  64. */
  65. /* store information about an Ixxx DVO */
  66. /* The i830->i865 use multiple DVOs with multiple i2cs */
  67. /* the i915, i945 have a single sDVO i2c bus - which is different */
  68. #define MAX_OUTPUTS 6
  69. /* maximum connectors per crtcs in the mode set */
  70. #define INTELFB_CONN_LIMIT 4
  71. #define INTEL_I2C_BUS_DVO 1
  72. #define INTEL_I2C_BUS_SDVO 2
  73. /* these are outputs from the chip - integrated only
  74. external chips are via DVO or SDVO output */
  75. #define INTEL_OUTPUT_UNUSED 0
  76. #define INTEL_OUTPUT_ANALOG 1
  77. #define INTEL_OUTPUT_DVO 2
  78. #define INTEL_OUTPUT_SDVO 3
  79. #define INTEL_OUTPUT_LVDS 4
  80. #define INTEL_OUTPUT_TVOUT 5
  81. #define INTEL_OUTPUT_HDMI 6
  82. #define INTEL_OUTPUT_DISPLAYPORT 7
  83. #define INTEL_OUTPUT_EDP 8
  84. #define INTEL_DVO_CHIP_NONE 0
  85. #define INTEL_DVO_CHIP_LVDS 1
  86. #define INTEL_DVO_CHIP_TMDS 2
  87. #define INTEL_DVO_CHIP_TVOUT 4
  88. /* drm_display_mode->private_flags */
  89. #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0)
  90. #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT)
  91. #define INTEL_MODE_DP_FORCE_6BPC (0x10)
  92. /* This flag must be set by the encoder's mode_fixup if it changes the crtc
  93. * timings in the mode to prevent the crtc fixup from overwriting them.
  94. * Currently only lvds needs that. */
  95. #define INTEL_MODE_CRTC_TIMINGS_SET (0x20)
  96. static inline void
  97. intel_mode_set_pixel_multiplier(struct drm_display_mode *mode,
  98. int multiplier)
  99. {
  100. mode->clock *= multiplier;
  101. mode->private_flags |= multiplier;
  102. }
  103. static inline int
  104. intel_mode_get_pixel_multiplier(const struct drm_display_mode *mode)
  105. {
  106. return (mode->private_flags & INTEL_MODE_PIXEL_MULTIPLIER_MASK) >> INTEL_MODE_PIXEL_MULTIPLIER_SHIFT;
  107. }
  108. struct intel_framebuffer {
  109. struct drm_framebuffer base;
  110. struct drm_i915_gem_object *obj;
  111. };
  112. struct intel_fbdev {
  113. struct drm_fb_helper helper;
  114. struct intel_framebuffer ifb;
  115. struct list_head fbdev_list;
  116. struct drm_display_mode *our_mode;
  117. };
  118. struct intel_encoder {
  119. struct drm_encoder base;
  120. int type;
  121. bool needs_tv_clock;
  122. /*
  123. * Intel hw has only one MUX where encoders could be clone, hence a
  124. * simple flag is enough to compute the possible_clones mask.
  125. */
  126. bool cloneable;
  127. bool connectors_active;
  128. void (*hot_plug)(struct intel_encoder *);
  129. void (*enable)(struct intel_encoder *);
  130. void (*disable)(struct intel_encoder *);
  131. /* Read out the current hw state of this connector, returning true if
  132. * the encoder is active. If the encoder is enabled it also set the pipe
  133. * it is connected to in the pipe parameter. */
  134. bool (*get_hw_state)(struct intel_encoder *, enum pipe *pipe);
  135. int crtc_mask;
  136. };
  137. struct intel_connector {
  138. struct drm_connector base;
  139. struct intel_encoder *encoder;
  140. /* Reads out the current hw, returning true if the connector is enabled
  141. * and active (i.e. dpms ON state). */
  142. bool (*get_hw_state)(struct intel_connector *);
  143. };
  144. struct intel_crtc {
  145. struct drm_crtc base;
  146. enum pipe pipe;
  147. enum plane plane;
  148. u8 lut_r[256], lut_g[256], lut_b[256];
  149. /*
  150. * Whether the crtc and the connected output pipeline is active. Implies
  151. * that crtc->enabled is set, i.e. the current mode configuration has
  152. * some outputs connected to this crtc.
  153. *
  154. * Atm crtc->enabled is unconditionally updated _before_ the hw state is
  155. * changed, hence we can only check this when enabling the crtc.
  156. */
  157. bool active;
  158. bool primary_disabled; /* is the crtc obscured by a plane? */
  159. bool lowfreq_avail;
  160. struct intel_overlay *overlay;
  161. struct intel_unpin_work *unpin_work;
  162. int fdi_lanes;
  163. /* Display surface base address adjustement for pageflips. Note that on
  164. * gen4+ this only adjusts up to a tile, offsets within a tile are
  165. * handled in the hw itself (with the TILEOFF register). */
  166. unsigned long dspaddr_offset;
  167. struct drm_i915_gem_object *cursor_bo;
  168. uint32_t cursor_addr;
  169. int16_t cursor_x, cursor_y;
  170. int16_t cursor_width, cursor_height;
  171. bool cursor_visible;
  172. unsigned int bpp;
  173. /* We can share PLLs across outputs if the timings match */
  174. struct intel_pch_pll *pch_pll;
  175. };
  176. struct intel_plane {
  177. struct drm_plane base;
  178. enum pipe pipe;
  179. struct drm_i915_gem_object *obj;
  180. int max_downscale;
  181. u32 lut_r[1024], lut_g[1024], lut_b[1024];
  182. void (*update_plane)(struct drm_plane *plane,
  183. struct drm_framebuffer *fb,
  184. struct drm_i915_gem_object *obj,
  185. int crtc_x, int crtc_y,
  186. unsigned int crtc_w, unsigned int crtc_h,
  187. uint32_t x, uint32_t y,
  188. uint32_t src_w, uint32_t src_h);
  189. void (*disable_plane)(struct drm_plane *plane);
  190. int (*update_colorkey)(struct drm_plane *plane,
  191. struct drm_intel_sprite_colorkey *key);
  192. void (*get_colorkey)(struct drm_plane *plane,
  193. struct drm_intel_sprite_colorkey *key);
  194. };
  195. struct intel_watermark_params {
  196. unsigned long fifo_size;
  197. unsigned long max_wm;
  198. unsigned long default_wm;
  199. unsigned long guard_size;
  200. unsigned long cacheline_size;
  201. };
  202. struct cxsr_latency {
  203. int is_desktop;
  204. int is_ddr3;
  205. unsigned long fsb_freq;
  206. unsigned long mem_freq;
  207. unsigned long display_sr;
  208. unsigned long display_hpll_disable;
  209. unsigned long cursor_sr;
  210. unsigned long cursor_hpll_disable;
  211. };
  212. #define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
  213. #define to_intel_connector(x) container_of(x, struct intel_connector, base)
  214. #define to_intel_encoder(x) container_of(x, struct intel_encoder, base)
  215. #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
  216. #define to_intel_plane(x) container_of(x, struct intel_plane, base)
  217. #define DIP_HEADER_SIZE 5
  218. #define DIP_TYPE_AVI 0x82
  219. #define DIP_VERSION_AVI 0x2
  220. #define DIP_LEN_AVI 13
  221. #define DIP_AVI_PR_1 0
  222. #define DIP_AVI_PR_2 1
  223. #define DIP_TYPE_SPD 0x83
  224. #define DIP_VERSION_SPD 0x1
  225. #define DIP_LEN_SPD 25
  226. #define DIP_SPD_UNKNOWN 0
  227. #define DIP_SPD_DSTB 0x1
  228. #define DIP_SPD_DVDP 0x2
  229. #define DIP_SPD_DVHS 0x3
  230. #define DIP_SPD_HDDVR 0x4
  231. #define DIP_SPD_DVC 0x5
  232. #define DIP_SPD_DSC 0x6
  233. #define DIP_SPD_VCD 0x7
  234. #define DIP_SPD_GAME 0x8
  235. #define DIP_SPD_PC 0x9
  236. #define DIP_SPD_BD 0xa
  237. #define DIP_SPD_SCD 0xb
  238. struct dip_infoframe {
  239. uint8_t type; /* HB0 */
  240. uint8_t ver; /* HB1 */
  241. uint8_t len; /* HB2 - body len, not including checksum */
  242. uint8_t ecc; /* Header ECC */
  243. uint8_t checksum; /* PB0 */
  244. union {
  245. struct {
  246. /* PB1 - Y 6:5, A 4:4, B 3:2, S 1:0 */
  247. uint8_t Y_A_B_S;
  248. /* PB2 - C 7:6, M 5:4, R 3:0 */
  249. uint8_t C_M_R;
  250. /* PB3 - ITC 7:7, EC 6:4, Q 3:2, SC 1:0 */
  251. uint8_t ITC_EC_Q_SC;
  252. /* PB4 - VIC 6:0 */
  253. uint8_t VIC;
  254. /* PB5 - YQ 7:6, CN 5:4, PR 3:0 */
  255. uint8_t YQ_CN_PR;
  256. /* PB6 to PB13 */
  257. uint16_t top_bar_end;
  258. uint16_t bottom_bar_start;
  259. uint16_t left_bar_end;
  260. uint16_t right_bar_start;
  261. } __attribute__ ((packed)) avi;
  262. struct {
  263. uint8_t vn[8];
  264. uint8_t pd[16];
  265. uint8_t sdi;
  266. } __attribute__ ((packed)) spd;
  267. uint8_t payload[27];
  268. } __attribute__ ((packed)) body;
  269. } __attribute__((packed));
  270. struct intel_hdmi {
  271. struct intel_encoder base;
  272. u32 sdvox_reg;
  273. int ddc_bus;
  274. int ddi_port;
  275. uint32_t color_range;
  276. bool has_hdmi_sink;
  277. bool has_audio;
  278. enum hdmi_force_audio force_audio;
  279. void (*write_infoframe)(struct drm_encoder *encoder,
  280. struct dip_infoframe *frame);
  281. void (*set_infoframes)(struct drm_encoder *encoder,
  282. struct drm_display_mode *adjusted_mode);
  283. };
  284. #define DP_RECEIVER_CAP_SIZE 0xf
  285. #define DP_LINK_CONFIGURATION_SIZE 9
  286. struct intel_dp {
  287. struct intel_encoder base;
  288. uint32_t output_reg;
  289. uint32_t DP;
  290. uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE];
  291. bool has_audio;
  292. enum hdmi_force_audio force_audio;
  293. enum port port;
  294. uint32_t color_range;
  295. uint8_t link_bw;
  296. uint8_t lane_count;
  297. uint8_t dpcd[DP_RECEIVER_CAP_SIZE];
  298. struct i2c_adapter adapter;
  299. struct i2c_algo_dp_aux_data algo;
  300. bool is_pch_edp;
  301. uint8_t train_set[4];
  302. int panel_power_up_delay;
  303. int panel_power_down_delay;
  304. int panel_power_cycle_delay;
  305. int backlight_on_delay;
  306. int backlight_off_delay;
  307. struct drm_display_mode *panel_fixed_mode; /* for eDP */
  308. struct delayed_work panel_vdd_work;
  309. bool want_panel_vdd;
  310. struct edid *edid; /* cached EDID for eDP */
  311. int edid_mode_count;
  312. };
  313. static inline struct drm_crtc *
  314. intel_get_crtc_for_pipe(struct drm_device *dev, int pipe)
  315. {
  316. struct drm_i915_private *dev_priv = dev->dev_private;
  317. return dev_priv->pipe_to_crtc_mapping[pipe];
  318. }
  319. static inline struct drm_crtc *
  320. intel_get_crtc_for_plane(struct drm_device *dev, int plane)
  321. {
  322. struct drm_i915_private *dev_priv = dev->dev_private;
  323. return dev_priv->plane_to_crtc_mapping[plane];
  324. }
  325. struct intel_unpin_work {
  326. struct work_struct work;
  327. struct drm_device *dev;
  328. struct drm_i915_gem_object *old_fb_obj;
  329. struct drm_i915_gem_object *pending_flip_obj;
  330. struct drm_pending_vblank_event *event;
  331. int pending;
  332. bool enable_stall_check;
  333. };
  334. struct intel_fbc_work {
  335. struct delayed_work work;
  336. struct drm_crtc *crtc;
  337. struct drm_framebuffer *fb;
  338. int interval;
  339. };
  340. int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
  341. extern void intel_attach_force_audio_property(struct drm_connector *connector);
  342. extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
  343. extern void intel_crt_init(struct drm_device *dev);
  344. extern void intel_hdmi_init(struct drm_device *dev,
  345. int sdvox_reg, enum port port);
  346. extern struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
  347. extern void intel_dip_infoframe_csum(struct dip_infoframe *avi_if);
  348. extern bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg,
  349. bool is_sdvob);
  350. extern void intel_dvo_init(struct drm_device *dev);
  351. extern void intel_tv_init(struct drm_device *dev);
  352. extern void intel_mark_busy(struct drm_device *dev);
  353. extern void intel_mark_idle(struct drm_device *dev);
  354. extern void intel_mark_fb_busy(struct drm_i915_gem_object *obj);
  355. extern void intel_mark_fb_idle(struct drm_i915_gem_object *obj);
  356. extern bool intel_lvds_init(struct drm_device *dev);
  357. extern void intel_dp_init(struct drm_device *dev, int output_reg,
  358. enum port port);
  359. void
  360. intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
  361. struct drm_display_mode *adjusted_mode);
  362. extern bool intel_dpd_is_edp(struct drm_device *dev);
  363. extern void intel_edp_link_config(struct intel_encoder *, int *, int *);
  364. extern int intel_edp_target_clock(struct intel_encoder *,
  365. struct drm_display_mode *mode);
  366. extern bool intel_encoder_is_pch_edp(struct drm_encoder *encoder);
  367. extern int intel_plane_init(struct drm_device *dev, enum pipe pipe);
  368. extern void intel_flush_display_plane(struct drm_i915_private *dev_priv,
  369. enum plane plane);
  370. /* intel_panel.c */
  371. extern void intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
  372. struct drm_display_mode *adjusted_mode);
  373. extern void intel_pch_panel_fitting(struct drm_device *dev,
  374. int fitting_mode,
  375. const struct drm_display_mode *mode,
  376. struct drm_display_mode *adjusted_mode);
  377. extern u32 intel_panel_get_max_backlight(struct drm_device *dev);
  378. extern void intel_panel_set_backlight(struct drm_device *dev, u32 level);
  379. extern int intel_panel_setup_backlight(struct drm_device *dev);
  380. extern void intel_panel_enable_backlight(struct drm_device *dev,
  381. enum pipe pipe);
  382. extern void intel_panel_disable_backlight(struct drm_device *dev);
  383. extern void intel_panel_destroy_backlight(struct drm_device *dev);
  384. extern enum drm_connector_status intel_panel_detect(struct drm_device *dev);
  385. struct intel_set_config {
  386. struct drm_connector *save_connectors;
  387. struct drm_encoder *save_encoders;
  388. struct drm_crtc *save_crtcs;
  389. };
  390. extern bool intel_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
  391. int x, int y, struct drm_framebuffer *old_fb);
  392. extern void intel_crtc_load_lut(struct drm_crtc *crtc);
  393. extern void intel_crtc_update_dpms(struct drm_crtc *crtc);
  394. extern void intel_encoder_disable(struct drm_encoder *encoder);
  395. extern void intel_encoder_destroy(struct drm_encoder *encoder);
  396. extern void intel_encoder_dpms(struct intel_encoder *encoder, int mode);
  397. extern void intel_connector_dpms(struct drm_connector *, int mode);
  398. extern bool intel_connector_get_hw_state(struct intel_connector *connector);
  399. extern void intel_connector_check_state(struct intel_connector *);
  400. static inline struct intel_encoder *intel_attached_encoder(struct drm_connector *connector)
  401. {
  402. return to_intel_connector(connector)->encoder;
  403. }
  404. extern void intel_connector_attach_encoder(struct intel_connector *connector,
  405. struct intel_encoder *encoder);
  406. extern struct drm_encoder *intel_best_encoder(struct drm_connector *connector);
  407. extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
  408. struct drm_crtc *crtc);
  409. int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
  410. struct drm_file *file_priv);
  411. extern void intel_wait_for_vblank(struct drm_device *dev, int pipe);
  412. extern void intel_wait_for_pipe_off(struct drm_device *dev, int pipe);
  413. struct intel_load_detect_pipe {
  414. struct drm_framebuffer *release_fb;
  415. bool load_detect_temp;
  416. int dpms_mode;
  417. };
  418. extern bool intel_get_load_detect_pipe(struct drm_connector *connector,
  419. struct drm_display_mode *mode,
  420. struct intel_load_detect_pipe *old);
  421. extern void intel_release_load_detect_pipe(struct drm_connector *connector,
  422. struct intel_load_detect_pipe *old);
  423. extern void intelfb_restore(void);
  424. extern void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
  425. u16 blue, int regno);
  426. extern void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
  427. u16 *blue, int regno);
  428. extern void intel_enable_clock_gating(struct drm_device *dev);
  429. extern int intel_pin_and_fence_fb_obj(struct drm_device *dev,
  430. struct drm_i915_gem_object *obj,
  431. struct intel_ring_buffer *pipelined);
  432. extern void intel_unpin_fb_obj(struct drm_i915_gem_object *obj);
  433. extern int intel_framebuffer_init(struct drm_device *dev,
  434. struct intel_framebuffer *ifb,
  435. struct drm_mode_fb_cmd2 *mode_cmd,
  436. struct drm_i915_gem_object *obj);
  437. extern int intel_fbdev_init(struct drm_device *dev);
  438. extern void intel_fbdev_fini(struct drm_device *dev);
  439. extern void intel_fbdev_set_suspend(struct drm_device *dev, int state);
  440. extern void intel_prepare_page_flip(struct drm_device *dev, int plane);
  441. extern void intel_finish_page_flip(struct drm_device *dev, int pipe);
  442. extern void intel_finish_page_flip_plane(struct drm_device *dev, int plane);
  443. extern void intel_setup_overlay(struct drm_device *dev);
  444. extern void intel_cleanup_overlay(struct drm_device *dev);
  445. extern int intel_overlay_switch_off(struct intel_overlay *overlay);
  446. extern int intel_overlay_put_image(struct drm_device *dev, void *data,
  447. struct drm_file *file_priv);
  448. extern int intel_overlay_attrs(struct drm_device *dev, void *data,
  449. struct drm_file *file_priv);
  450. extern void intel_fb_output_poll_changed(struct drm_device *dev);
  451. extern void intel_fb_restore_mode(struct drm_device *dev);
  452. extern void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,
  453. bool state);
  454. #define assert_pipe_enabled(d, p) assert_pipe(d, p, true)
  455. #define assert_pipe_disabled(d, p) assert_pipe(d, p, false)
  456. extern void intel_init_clock_gating(struct drm_device *dev);
  457. extern void intel_write_eld(struct drm_encoder *encoder,
  458. struct drm_display_mode *mode);
  459. extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe);
  460. extern void intel_prepare_ddi(struct drm_device *dev);
  461. extern void hsw_fdi_link_train(struct drm_crtc *crtc);
  462. extern void intel_ddi_init(struct drm_device *dev, enum port port);
  463. /* For use by IVB LP watermark workaround in intel_sprite.c */
  464. extern void intel_update_watermarks(struct drm_device *dev);
  465. extern void intel_update_sprite_watermarks(struct drm_device *dev, int pipe,
  466. uint32_t sprite_width,
  467. int pixel_size);
  468. extern void intel_update_linetime_watermarks(struct drm_device *dev, int pipe,
  469. struct drm_display_mode *mode);
  470. extern int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
  471. struct drm_file *file_priv);
  472. extern int intel_sprite_get_colorkey(struct drm_device *dev, void *data,
  473. struct drm_file *file_priv);
  474. extern u32 intel_dpio_read(struct drm_i915_private *dev_priv, int reg);
  475. /* Power-related functions, located in intel_pm.c */
  476. extern void intel_init_pm(struct drm_device *dev);
  477. /* FBC */
  478. extern bool intel_fbc_enabled(struct drm_device *dev);
  479. extern void intel_enable_fbc(struct drm_crtc *crtc, unsigned long interval);
  480. extern void intel_update_fbc(struct drm_device *dev);
  481. /* IPS */
  482. extern void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
  483. extern void intel_gpu_ips_teardown(void);
  484. extern void intel_init_power_wells(struct drm_device *dev);
  485. extern void intel_enable_gt_powersave(struct drm_device *dev);
  486. extern void intel_disable_gt_powersave(struct drm_device *dev);
  487. extern void gen6_gt_check_fifodbg(struct drm_i915_private *dev_priv);
  488. extern void ironlake_teardown_rc6(struct drm_device *dev);
  489. extern void intel_enable_ddi(struct intel_encoder *encoder);
  490. extern void intel_disable_ddi(struct intel_encoder *encoder);
  491. extern bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
  492. enum pipe *pipe);
  493. extern void intel_ddi_mode_set(struct drm_encoder *encoder,
  494. struct drm_display_mode *mode,
  495. struct drm_display_mode *adjusted_mode);
  496. #endif /* __INTEL_DRV_H__ */