intel_drv.h 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216
  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/async.h>
  28. #include <linux/i2c.h>
  29. #include <linux/hdmi.h>
  30. #include <drm/i915_drm.h>
  31. #include "i915_drv.h"
  32. #include <drm/drm_crtc.h>
  33. #include <drm/drm_crtc_helper.h>
  34. #include <drm/drm_fb_helper.h>
  35. #include <drm/drm_dp_mst_helper.h>
  36. #include <drm/drm_rect.h>
  37. #define DIV_ROUND_CLOSEST_ULL(ll, d) \
  38. ({ unsigned long long _tmp = (ll)+(d)/2; do_div(_tmp, d); _tmp; })
  39. /**
  40. * _wait_for - magic (register) wait macro
  41. *
  42. * Does the right thing for modeset paths when run under kdgb or similar atomic
  43. * contexts. Note that it's important that we check the condition again after
  44. * having timed out, since the timeout could be due to preemption or similar and
  45. * we've never had a chance to check the condition before the timeout.
  46. */
  47. #define _wait_for(COND, MS, W) ({ \
  48. unsigned long timeout__ = jiffies + msecs_to_jiffies(MS) + 1; \
  49. int ret__ = 0; \
  50. while (!(COND)) { \
  51. if (time_after(jiffies, timeout__)) { \
  52. if (!(COND)) \
  53. ret__ = -ETIMEDOUT; \
  54. break; \
  55. } \
  56. if (W && drm_can_sleep()) { \
  57. msleep(W); \
  58. } else { \
  59. cpu_relax(); \
  60. } \
  61. } \
  62. ret__; \
  63. })
  64. #define wait_for(COND, MS) _wait_for(COND, MS, 1)
  65. #define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0)
  66. #define wait_for_atomic_us(COND, US) _wait_for((COND), \
  67. DIV_ROUND_UP((US), 1000), 0)
  68. #define KHz(x) (1000 * (x))
  69. #define MHz(x) KHz(1000 * (x))
  70. /*
  71. * Display related stuff
  72. */
  73. /* store information about an Ixxx DVO */
  74. /* The i830->i865 use multiple DVOs with multiple i2cs */
  75. /* the i915, i945 have a single sDVO i2c bus - which is different */
  76. #define MAX_OUTPUTS 6
  77. /* maximum connectors per crtcs in the mode set */
  78. /* Maximum cursor sizes */
  79. #define GEN2_CURSOR_WIDTH 64
  80. #define GEN2_CURSOR_HEIGHT 64
  81. #define MAX_CURSOR_WIDTH 256
  82. #define MAX_CURSOR_HEIGHT 256
  83. #define INTEL_I2C_BUS_DVO 1
  84. #define INTEL_I2C_BUS_SDVO 2
  85. /* these are outputs from the chip - integrated only
  86. external chips are via DVO or SDVO output */
  87. enum intel_output_type {
  88. INTEL_OUTPUT_UNUSED = 0,
  89. INTEL_OUTPUT_ANALOG = 1,
  90. INTEL_OUTPUT_DVO = 2,
  91. INTEL_OUTPUT_SDVO = 3,
  92. INTEL_OUTPUT_LVDS = 4,
  93. INTEL_OUTPUT_TVOUT = 5,
  94. INTEL_OUTPUT_HDMI = 6,
  95. INTEL_OUTPUT_DISPLAYPORT = 7,
  96. INTEL_OUTPUT_EDP = 8,
  97. INTEL_OUTPUT_DSI = 9,
  98. INTEL_OUTPUT_UNKNOWN = 10,
  99. INTEL_OUTPUT_DP_MST = 11,
  100. };
  101. #define INTEL_DVO_CHIP_NONE 0
  102. #define INTEL_DVO_CHIP_LVDS 1
  103. #define INTEL_DVO_CHIP_TMDS 2
  104. #define INTEL_DVO_CHIP_TVOUT 4
  105. #define INTEL_DSI_VIDEO_MODE 0
  106. #define INTEL_DSI_COMMAND_MODE 1
  107. struct intel_framebuffer {
  108. struct drm_framebuffer base;
  109. struct drm_i915_gem_object *obj;
  110. };
  111. struct intel_fbdev {
  112. struct drm_fb_helper helper;
  113. struct intel_framebuffer *fb;
  114. struct list_head fbdev_list;
  115. struct drm_display_mode *our_mode;
  116. int preferred_bpp;
  117. };
  118. struct intel_encoder {
  119. struct drm_encoder base;
  120. /*
  121. * The new crtc this encoder will be driven from. Only differs from
  122. * base->crtc while a modeset is in progress.
  123. */
  124. struct intel_crtc *new_crtc;
  125. enum intel_output_type type;
  126. unsigned int cloneable;
  127. bool connectors_active;
  128. void (*hot_plug)(struct intel_encoder *);
  129. bool (*compute_config)(struct intel_encoder *,
  130. struct intel_crtc_config *);
  131. void (*pre_pll_enable)(struct intel_encoder *);
  132. void (*pre_enable)(struct intel_encoder *);
  133. void (*enable)(struct intel_encoder *);
  134. void (*mode_set)(struct intel_encoder *intel_encoder);
  135. void (*disable)(struct intel_encoder *);
  136. void (*post_disable)(struct intel_encoder *);
  137. /* Read out the current hw state of this connector, returning true if
  138. * the encoder is active. If the encoder is enabled it also set the pipe
  139. * it is connected to in the pipe parameter. */
  140. bool (*get_hw_state)(struct intel_encoder *, enum pipe *pipe);
  141. /* Reconstructs the equivalent mode flags for the current hardware
  142. * state. This must be called _after_ display->get_pipe_config has
  143. * pre-filled the pipe config. Note that intel_encoder->base.crtc must
  144. * be set correctly before calling this function. */
  145. void (*get_config)(struct intel_encoder *,
  146. struct intel_crtc_config *pipe_config);
  147. /*
  148. * Called during system suspend after all pending requests for the
  149. * encoder are flushed (for example for DP AUX transactions) and
  150. * device interrupts are disabled.
  151. */
  152. void (*suspend)(struct intel_encoder *);
  153. int crtc_mask;
  154. enum hpd_pin hpd_pin;
  155. };
  156. struct intel_panel {
  157. struct drm_display_mode *fixed_mode;
  158. struct drm_display_mode *downclock_mode;
  159. int fitting_mode;
  160. /* backlight */
  161. struct {
  162. bool present;
  163. u32 level;
  164. u32 min;
  165. u32 max;
  166. bool enabled;
  167. bool combination_mode; /* gen 2/4 only */
  168. bool active_low_pwm;
  169. struct backlight_device *device;
  170. } backlight;
  171. void (*backlight_power)(struct intel_connector *, bool enable);
  172. };
  173. struct intel_connector {
  174. struct drm_connector base;
  175. /*
  176. * The fixed encoder this connector is connected to.
  177. */
  178. struct intel_encoder *encoder;
  179. /*
  180. * The new encoder this connector will be driven. Only differs from
  181. * encoder while a modeset is in progress.
  182. */
  183. struct intel_encoder *new_encoder;
  184. /* Reads out the current hw, returning true if the connector is enabled
  185. * and active (i.e. dpms ON state). */
  186. bool (*get_hw_state)(struct intel_connector *);
  187. /*
  188. * Removes all interfaces through which the connector is accessible
  189. * - like sysfs, debugfs entries -, so that no new operations can be
  190. * started on the connector. Also makes sure all currently pending
  191. * operations finish before returing.
  192. */
  193. void (*unregister)(struct intel_connector *);
  194. /* Panel info for eDP and LVDS */
  195. struct intel_panel panel;
  196. /* Cached EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */
  197. struct edid *edid;
  198. struct edid *detect_edid;
  199. /* since POLL and HPD connectors may use the same HPD line keep the native
  200. state of connector->polled in case hotplug storm detection changes it */
  201. u8 polled;
  202. void *port; /* store this opaque as its illegal to dereference it */
  203. struct intel_dp *mst_port;
  204. };
  205. typedef struct dpll {
  206. /* given values */
  207. int n;
  208. int m1, m2;
  209. int p1, p2;
  210. /* derived values */
  211. int dot;
  212. int vco;
  213. int m;
  214. int p;
  215. } intel_clock_t;
  216. struct intel_plane_state {
  217. struct drm_plane_state base;
  218. struct drm_rect src;
  219. struct drm_rect dst;
  220. struct drm_rect clip;
  221. struct drm_rect orig_src;
  222. struct drm_rect orig_dst;
  223. bool visible;
  224. };
  225. struct intel_plane_config {
  226. bool tiled;
  227. int size;
  228. u32 base;
  229. };
  230. struct intel_crtc_config {
  231. /**
  232. * quirks - bitfield with hw state readout quirks
  233. *
  234. * For various reasons the hw state readout code might not be able to
  235. * completely faithfully read out the current state. These cases are
  236. * tracked with quirk flags so that fastboot and state checker can act
  237. * accordingly.
  238. */
  239. #define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
  240. #define PIPE_CONFIG_QUIRK_INHERITED_MODE (1<<1) /* mode inherited from firmware */
  241. unsigned long quirks;
  242. /* User requested mode, only valid as a starting point to
  243. * compute adjusted_mode, except in the case of (S)DVO where
  244. * it's also for the output timings of the (S)DVO chip.
  245. * adjusted_mode will then correspond to the S(DVO) chip's
  246. * preferred input timings. */
  247. struct drm_display_mode requested_mode;
  248. /* Actual pipe timings ie. what we program into the pipe timing
  249. * registers. adjusted_mode.crtc_clock is the pipe pixel clock. */
  250. struct drm_display_mode adjusted_mode;
  251. /* Pipe source size (ie. panel fitter input size)
  252. * All planes will be positioned inside this space,
  253. * and get clipped at the edges. */
  254. int pipe_src_w, pipe_src_h;
  255. /* Whether to set up the PCH/FDI. Note that we never allow sharing
  256. * between pch encoders and cpu encoders. */
  257. bool has_pch_encoder;
  258. /* Are we sending infoframes on the attached port */
  259. bool has_infoframe;
  260. /* CPU Transcoder for the pipe. Currently this can only differ from the
  261. * pipe on Haswell (where we have a special eDP transcoder). */
  262. enum transcoder cpu_transcoder;
  263. /*
  264. * Use reduced/limited/broadcast rbg range, compressing from the full
  265. * range fed into the crtcs.
  266. */
  267. bool limited_color_range;
  268. /* DP has a bunch of special case unfortunately, so mark the pipe
  269. * accordingly. */
  270. bool has_dp_encoder;
  271. /* Whether we should send NULL infoframes. Required for audio. */
  272. bool has_hdmi_sink;
  273. /* Audio enabled on this pipe. Only valid if either has_hdmi_sink or
  274. * has_dp_encoder is set. */
  275. bool has_audio;
  276. /*
  277. * Enable dithering, used when the selected pipe bpp doesn't match the
  278. * plane bpp.
  279. */
  280. bool dither;
  281. /* Controls for the clock computation, to override various stages. */
  282. bool clock_set;
  283. /* SDVO TV has a bunch of special case. To make multifunction encoders
  284. * work correctly, we need to track this at runtime.*/
  285. bool sdvo_tv_clock;
  286. /*
  287. * crtc bandwidth limit, don't increase pipe bpp or clock if not really
  288. * required. This is set in the 2nd loop of calling encoder's
  289. * ->compute_config if the first pick doesn't work out.
  290. */
  291. bool bw_constrained;
  292. /* Settings for the intel dpll used on pretty much everything but
  293. * haswell. */
  294. struct dpll dpll;
  295. /* Selected dpll when shared or DPLL_ID_PRIVATE. */
  296. enum intel_dpll_id shared_dpll;
  297. /*
  298. * - PORT_CLK_SEL for DDI ports on HSW/BDW.
  299. * - enum skl_dpll on SKL
  300. */
  301. uint32_t ddi_pll_sel;
  302. /* Actual register state of the dpll, for shared dpll cross-checking. */
  303. struct intel_dpll_hw_state dpll_hw_state;
  304. int pipe_bpp;
  305. struct intel_link_m_n dp_m_n;
  306. /* m2_n2 for eDP downclock */
  307. struct intel_link_m_n dp_m2_n2;
  308. bool has_drrs;
  309. /*
  310. * Frequence the dpll for the port should run at. Differs from the
  311. * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also
  312. * already multiplied by pixel_multiplier.
  313. */
  314. int port_clock;
  315. /* Used by SDVO (and if we ever fix it, HDMI). */
  316. unsigned pixel_multiplier;
  317. /* Panel fitter controls for gen2-gen4 + VLV */
  318. struct {
  319. u32 control;
  320. u32 pgm_ratios;
  321. u32 lvds_border_bits;
  322. } gmch_pfit;
  323. /* Panel fitter placement and size for Ironlake+ */
  324. struct {
  325. u32 pos;
  326. u32 size;
  327. bool enabled;
  328. bool force_thru;
  329. } pch_pfit;
  330. /* FDI configuration, only valid if has_pch_encoder is set. */
  331. int fdi_lanes;
  332. struct intel_link_m_n fdi_m_n;
  333. bool ips_enabled;
  334. bool double_wide;
  335. bool dp_encoder_is_mst;
  336. int pbn;
  337. };
  338. struct intel_pipe_wm {
  339. struct intel_wm_level wm[5];
  340. uint32_t linetime;
  341. bool fbc_wm_enabled;
  342. bool pipe_enabled;
  343. bool sprites_enabled;
  344. bool sprites_scaled;
  345. };
  346. struct intel_mmio_flip {
  347. struct drm_i915_gem_request *req;
  348. struct work_struct work;
  349. };
  350. struct skl_pipe_wm {
  351. struct skl_wm_level wm[8];
  352. struct skl_wm_level trans_wm;
  353. uint32_t linetime;
  354. };
  355. struct intel_crtc {
  356. struct drm_crtc base;
  357. enum pipe pipe;
  358. enum plane plane;
  359. u8 lut_r[256], lut_g[256], lut_b[256];
  360. /*
  361. * Whether the crtc and the connected output pipeline is active. Implies
  362. * that crtc->enabled is set, i.e. the current mode configuration has
  363. * some outputs connected to this crtc.
  364. */
  365. bool active;
  366. unsigned long enabled_power_domains;
  367. bool primary_enabled; /* is the primary plane (partially) visible? */
  368. bool lowfreq_avail;
  369. struct intel_overlay *overlay;
  370. struct intel_unpin_work *unpin_work;
  371. atomic_t unpin_work_count;
  372. /* Display surface base address adjustement for pageflips. Note that on
  373. * gen4+ this only adjusts up to a tile, offsets within a tile are
  374. * handled in the hw itself (with the TILEOFF register). */
  375. unsigned long dspaddr_offset;
  376. struct drm_i915_gem_object *cursor_bo;
  377. uint32_t cursor_addr;
  378. int16_t cursor_width, cursor_height;
  379. uint32_t cursor_cntl;
  380. uint32_t cursor_size;
  381. uint32_t cursor_base;
  382. struct intel_plane_config plane_config;
  383. struct intel_crtc_config config;
  384. struct intel_crtc_config *new_config;
  385. bool new_enabled;
  386. /* reset counter value when the last flip was submitted */
  387. unsigned int reset_counter;
  388. /* Access to these should be protected by dev_priv->irq_lock. */
  389. bool cpu_fifo_underrun_disabled;
  390. bool pch_fifo_underrun_disabled;
  391. /* per-pipe watermark state */
  392. struct {
  393. /* watermarks currently being used */
  394. struct intel_pipe_wm active;
  395. /* SKL wm values currently in use */
  396. struct skl_pipe_wm skl_active;
  397. } wm;
  398. int scanline_offset;
  399. struct intel_mmio_flip mmio_flip;
  400. };
  401. struct intel_plane_wm_parameters {
  402. uint32_t horiz_pixels;
  403. uint32_t vert_pixels;
  404. uint8_t bytes_per_pixel;
  405. bool enabled;
  406. bool scaled;
  407. };
  408. struct intel_plane {
  409. struct drm_plane base;
  410. int plane;
  411. enum pipe pipe;
  412. struct drm_i915_gem_object *obj;
  413. bool can_scale;
  414. int max_downscale;
  415. int crtc_x, crtc_y;
  416. unsigned int crtc_w, crtc_h;
  417. uint32_t src_x, src_y;
  418. uint32_t src_w, src_h;
  419. unsigned int rotation;
  420. /* Since we need to change the watermarks before/after
  421. * enabling/disabling the planes, we need to store the parameters here
  422. * as the other pieces of the struct may not reflect the values we want
  423. * for the watermark calculations. Currently only Haswell uses this.
  424. */
  425. struct intel_plane_wm_parameters wm;
  426. void (*update_plane)(struct drm_plane *plane,
  427. struct drm_crtc *crtc,
  428. struct drm_framebuffer *fb,
  429. struct drm_i915_gem_object *obj,
  430. int crtc_x, int crtc_y,
  431. unsigned int crtc_w, unsigned int crtc_h,
  432. uint32_t x, uint32_t y,
  433. uint32_t src_w, uint32_t src_h);
  434. void (*disable_plane)(struct drm_plane *plane,
  435. struct drm_crtc *crtc);
  436. int (*check_plane)(struct drm_plane *plane,
  437. struct intel_plane_state *state);
  438. void (*commit_plane)(struct drm_plane *plane,
  439. struct intel_plane_state *state);
  440. int (*update_colorkey)(struct drm_plane *plane,
  441. struct drm_intel_sprite_colorkey *key);
  442. void (*get_colorkey)(struct drm_plane *plane,
  443. struct drm_intel_sprite_colorkey *key);
  444. };
  445. struct intel_watermark_params {
  446. unsigned long fifo_size;
  447. unsigned long max_wm;
  448. unsigned long default_wm;
  449. unsigned long guard_size;
  450. unsigned long cacheline_size;
  451. };
  452. struct cxsr_latency {
  453. int is_desktop;
  454. int is_ddr3;
  455. unsigned long fsb_freq;
  456. unsigned long mem_freq;
  457. unsigned long display_sr;
  458. unsigned long display_hpll_disable;
  459. unsigned long cursor_sr;
  460. unsigned long cursor_hpll_disable;
  461. };
  462. #define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
  463. #define to_intel_connector(x) container_of(x, struct intel_connector, base)
  464. #define to_intel_encoder(x) container_of(x, struct intel_encoder, base)
  465. #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
  466. #define to_intel_plane(x) container_of(x, struct intel_plane, base)
  467. #define intel_fb_obj(x) (x ? to_intel_framebuffer(x)->obj : NULL)
  468. struct intel_hdmi {
  469. u32 hdmi_reg;
  470. int ddc_bus;
  471. uint32_t color_range;
  472. bool color_range_auto;
  473. bool has_hdmi_sink;
  474. bool has_audio;
  475. enum hdmi_force_audio force_audio;
  476. bool rgb_quant_range_selectable;
  477. enum hdmi_picture_aspect aspect_ratio;
  478. void (*write_infoframe)(struct drm_encoder *encoder,
  479. enum hdmi_infoframe_type type,
  480. const void *frame, ssize_t len);
  481. void (*set_infoframes)(struct drm_encoder *encoder,
  482. bool enable,
  483. struct drm_display_mode *adjusted_mode);
  484. bool (*infoframe_enabled)(struct drm_encoder *encoder);
  485. };
  486. struct intel_dp_mst_encoder;
  487. #define DP_MAX_DOWNSTREAM_PORTS 0x10
  488. /**
  489. * HIGH_RR is the highest eDP panel refresh rate read from EDID
  490. * LOW_RR is the lowest eDP panel refresh rate found from EDID
  491. * parsing for same resolution.
  492. */
  493. enum edp_drrs_refresh_rate_type {
  494. DRRS_HIGH_RR,
  495. DRRS_LOW_RR,
  496. DRRS_MAX_RR, /* RR count */
  497. };
  498. struct intel_dp {
  499. uint32_t output_reg;
  500. uint32_t aux_ch_ctl_reg;
  501. uint32_t DP;
  502. bool has_audio;
  503. enum hdmi_force_audio force_audio;
  504. uint32_t color_range;
  505. bool color_range_auto;
  506. uint8_t link_bw;
  507. uint8_t lane_count;
  508. uint8_t dpcd[DP_RECEIVER_CAP_SIZE];
  509. uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE];
  510. uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
  511. struct drm_dp_aux aux;
  512. uint8_t train_set[4];
  513. int panel_power_up_delay;
  514. int panel_power_down_delay;
  515. int panel_power_cycle_delay;
  516. int backlight_on_delay;
  517. int backlight_off_delay;
  518. struct delayed_work panel_vdd_work;
  519. bool want_panel_vdd;
  520. unsigned long last_power_cycle;
  521. unsigned long last_power_on;
  522. unsigned long last_backlight_off;
  523. struct notifier_block edp_notifier;
  524. /*
  525. * Pipe whose power sequencer is currently locked into
  526. * this port. Only relevant on VLV/CHV.
  527. */
  528. enum pipe pps_pipe;
  529. struct edp_power_seq pps_delays;
  530. bool use_tps3;
  531. bool can_mst; /* this port supports mst */
  532. bool is_mst;
  533. int active_mst_links;
  534. /* connector directly attached - won't be use for modeset in mst world */
  535. struct intel_connector *attached_connector;
  536. /* mst connector list */
  537. struct intel_dp_mst_encoder *mst_encoders[I915_MAX_PIPES];
  538. struct drm_dp_mst_topology_mgr mst_mgr;
  539. uint32_t (*get_aux_clock_divider)(struct intel_dp *dp, int index);
  540. /*
  541. * This function returns the value we have to program the AUX_CTL
  542. * register with to kick off an AUX transaction.
  543. */
  544. uint32_t (*get_aux_send_ctl)(struct intel_dp *dp,
  545. bool has_aux_irq,
  546. int send_bytes,
  547. uint32_t aux_clock_divider);
  548. struct {
  549. enum drrs_support_type type;
  550. enum edp_drrs_refresh_rate_type refresh_rate_type;
  551. struct mutex mutex;
  552. } drrs_state;
  553. };
  554. struct intel_digital_port {
  555. struct intel_encoder base;
  556. enum port port;
  557. u32 saved_port_bits;
  558. struct intel_dp dp;
  559. struct intel_hdmi hdmi;
  560. bool (*hpd_pulse)(struct intel_digital_port *, bool);
  561. };
  562. struct intel_dp_mst_encoder {
  563. struct intel_encoder base;
  564. enum pipe pipe;
  565. struct intel_digital_port *primary;
  566. void *port; /* store this opaque as its illegal to dereference it */
  567. };
  568. static inline int
  569. vlv_dport_to_channel(struct intel_digital_port *dport)
  570. {
  571. switch (dport->port) {
  572. case PORT_B:
  573. case PORT_D:
  574. return DPIO_CH0;
  575. case PORT_C:
  576. return DPIO_CH1;
  577. default:
  578. BUG();
  579. }
  580. }
  581. static inline int
  582. vlv_pipe_to_channel(enum pipe pipe)
  583. {
  584. switch (pipe) {
  585. case PIPE_A:
  586. case PIPE_C:
  587. return DPIO_CH0;
  588. case PIPE_B:
  589. return DPIO_CH1;
  590. default:
  591. BUG();
  592. }
  593. }
  594. static inline struct drm_crtc *
  595. intel_get_crtc_for_pipe(struct drm_device *dev, int pipe)
  596. {
  597. struct drm_i915_private *dev_priv = dev->dev_private;
  598. return dev_priv->pipe_to_crtc_mapping[pipe];
  599. }
  600. static inline struct drm_crtc *
  601. intel_get_crtc_for_plane(struct drm_device *dev, int plane)
  602. {
  603. struct drm_i915_private *dev_priv = dev->dev_private;
  604. return dev_priv->plane_to_crtc_mapping[plane];
  605. }
  606. struct intel_unpin_work {
  607. struct work_struct work;
  608. struct drm_crtc *crtc;
  609. struct drm_i915_gem_object *old_fb_obj;
  610. struct drm_i915_gem_object *pending_flip_obj;
  611. struct drm_pending_vblank_event *event;
  612. atomic_t pending;
  613. #define INTEL_FLIP_INACTIVE 0
  614. #define INTEL_FLIP_PENDING 1
  615. #define INTEL_FLIP_COMPLETE 2
  616. u32 flip_count;
  617. u32 gtt_offset;
  618. struct drm_i915_gem_request *flip_queued_req;
  619. int flip_queued_vblank;
  620. int flip_ready_vblank;
  621. bool enable_stall_check;
  622. };
  623. struct intel_set_config {
  624. struct drm_encoder **save_connector_encoders;
  625. struct drm_crtc **save_encoder_crtcs;
  626. bool *save_crtc_enabled;
  627. bool fb_changed;
  628. bool mode_changed;
  629. };
  630. struct intel_load_detect_pipe {
  631. struct drm_framebuffer *release_fb;
  632. bool load_detect_temp;
  633. int dpms_mode;
  634. };
  635. static inline struct intel_encoder *
  636. intel_attached_encoder(struct drm_connector *connector)
  637. {
  638. return to_intel_connector(connector)->encoder;
  639. }
  640. static inline struct intel_digital_port *
  641. enc_to_dig_port(struct drm_encoder *encoder)
  642. {
  643. return container_of(encoder, struct intel_digital_port, base.base);
  644. }
  645. static inline struct intel_dp_mst_encoder *
  646. enc_to_mst(struct drm_encoder *encoder)
  647. {
  648. return container_of(encoder, struct intel_dp_mst_encoder, base.base);
  649. }
  650. static inline struct intel_dp *enc_to_intel_dp(struct drm_encoder *encoder)
  651. {
  652. return &enc_to_dig_port(encoder)->dp;
  653. }
  654. static inline struct intel_digital_port *
  655. dp_to_dig_port(struct intel_dp *intel_dp)
  656. {
  657. return container_of(intel_dp, struct intel_digital_port, dp);
  658. }
  659. static inline struct intel_digital_port *
  660. hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
  661. {
  662. return container_of(intel_hdmi, struct intel_digital_port, hdmi);
  663. }
  664. /*
  665. * Returns the number of planes for this pipe, ie the number of sprites + 1
  666. * (primary plane). This doesn't count the cursor plane then.
  667. */
  668. static inline unsigned int intel_num_planes(struct intel_crtc *crtc)
  669. {
  670. return INTEL_INFO(crtc->base.dev)->num_sprites[crtc->pipe] + 1;
  671. }
  672. /* intel_fifo_underrun.c */
  673. bool intel_set_cpu_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
  674. enum pipe pipe, bool enable);
  675. bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
  676. enum transcoder pch_transcoder,
  677. bool enable);
  678. void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
  679. enum pipe pipe);
  680. void intel_pch_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
  681. enum transcoder pch_transcoder);
  682. void i9xx_check_fifo_underruns(struct drm_i915_private *dev_priv);
  683. /* i915_irq.c */
  684. void gen5_enable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask);
  685. void gen5_disable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask);
  686. void gen6_enable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
  687. void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
  688. void gen6_reset_rps_interrupts(struct drm_device *dev);
  689. void gen6_enable_rps_interrupts(struct drm_device *dev);
  690. void gen6_disable_rps_interrupts(struct drm_device *dev);
  691. void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv);
  692. void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv);
  693. static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv)
  694. {
  695. /*
  696. * We only use drm_irq_uninstall() at unload and VT switch, so
  697. * this is the only thing we need to check.
  698. */
  699. return dev_priv->pm.irqs_enabled;
  700. }
  701. int intel_get_crtc_scanline(struct intel_crtc *crtc);
  702. void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv);
  703. /* intel_crt.c */
  704. void intel_crt_init(struct drm_device *dev);
  705. /* intel_ddi.c */
  706. void intel_prepare_ddi(struct drm_device *dev);
  707. void hsw_fdi_link_train(struct drm_crtc *crtc);
  708. void intel_ddi_init(struct drm_device *dev, enum port port);
  709. enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder);
  710. bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
  711. int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv);
  712. void intel_ddi_pll_init(struct drm_device *dev);
  713. void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc);
  714. void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,
  715. enum transcoder cpu_transcoder);
  716. void intel_ddi_enable_pipe_clock(struct intel_crtc *intel_crtc);
  717. void intel_ddi_disable_pipe_clock(struct intel_crtc *intel_crtc);
  718. bool intel_ddi_pll_select(struct intel_crtc *crtc);
  719. void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
  720. void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder);
  721. bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
  722. void intel_ddi_fdi_disable(struct drm_crtc *crtc);
  723. void intel_ddi_get_config(struct intel_encoder *encoder,
  724. struct intel_crtc_config *pipe_config);
  725. void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder);
  726. void intel_ddi_clock_get(struct intel_encoder *encoder,
  727. struct intel_crtc_config *pipe_config);
  728. void intel_ddi_set_vc_payload_alloc(struct drm_crtc *crtc, bool state);
  729. /* intel_frontbuffer.c */
  730. void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
  731. struct intel_engine_cs *ring);
  732. void intel_frontbuffer_flip_prepare(struct drm_device *dev,
  733. unsigned frontbuffer_bits);
  734. void intel_frontbuffer_flip_complete(struct drm_device *dev,
  735. unsigned frontbuffer_bits);
  736. void intel_frontbuffer_flush(struct drm_device *dev,
  737. unsigned frontbuffer_bits);
  738. /**
  739. * intel_frontbuffer_flip - synchronous frontbuffer flip
  740. * @dev: DRM device
  741. * @frontbuffer_bits: frontbuffer plane tracking bits
  742. *
  743. * This function gets called after scheduling a flip on @obj. This is for
  744. * synchronous plane updates which will happen on the next vblank and which will
  745. * not get delayed by pending gpu rendering.
  746. *
  747. * Can be called without any locks held.
  748. */
  749. static inline
  750. void intel_frontbuffer_flip(struct drm_device *dev,
  751. unsigned frontbuffer_bits)
  752. {
  753. intel_frontbuffer_flush(dev, frontbuffer_bits);
  754. }
  755. void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire);
  756. /* intel_audio.c */
  757. void intel_init_audio(struct drm_device *dev);
  758. void intel_audio_codec_enable(struct intel_encoder *encoder);
  759. void intel_audio_codec_disable(struct intel_encoder *encoder);
  760. /* intel_display.c */
  761. const char *intel_output_name(int output);
  762. bool intel_has_pending_fb_unpin(struct drm_device *dev);
  763. int intel_pch_rawclk(struct drm_device *dev);
  764. void intel_mark_busy(struct drm_device *dev);
  765. void intel_mark_idle(struct drm_device *dev);
  766. void intel_crtc_restore_mode(struct drm_crtc *crtc);
  767. void intel_crtc_control(struct drm_crtc *crtc, bool enable);
  768. void intel_crtc_update_dpms(struct drm_crtc *crtc);
  769. void intel_encoder_destroy(struct drm_encoder *encoder);
  770. void intel_connector_dpms(struct drm_connector *, int mode);
  771. bool intel_connector_get_hw_state(struct intel_connector *connector);
  772. void intel_modeset_check_state(struct drm_device *dev);
  773. bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
  774. struct intel_digital_port *port);
  775. void intel_connector_attach_encoder(struct intel_connector *connector,
  776. struct intel_encoder *encoder);
  777. struct drm_encoder *intel_best_encoder(struct drm_connector *connector);
  778. struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
  779. struct drm_crtc *crtc);
  780. enum pipe intel_get_pipe_from_connector(struct intel_connector *connector);
  781. int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
  782. struct drm_file *file_priv);
  783. enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
  784. enum pipe pipe);
  785. bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type);
  786. static inline void
  787. intel_wait_for_vblank(struct drm_device *dev, int pipe)
  788. {
  789. drm_wait_one_vblank(dev, pipe);
  790. }
  791. int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
  792. void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
  793. struct intel_digital_port *dport);
  794. bool intel_get_load_detect_pipe(struct drm_connector *connector,
  795. struct drm_display_mode *mode,
  796. struct intel_load_detect_pipe *old,
  797. struct drm_modeset_acquire_ctx *ctx);
  798. void intel_release_load_detect_pipe(struct drm_connector *connector,
  799. struct intel_load_detect_pipe *old);
  800. int intel_pin_and_fence_fb_obj(struct drm_plane *plane,
  801. struct drm_framebuffer *fb,
  802. struct intel_engine_cs *pipelined);
  803. void intel_unpin_fb_obj(struct drm_i915_gem_object *obj);
  804. struct drm_framebuffer *
  805. __intel_framebuffer_create(struct drm_device *dev,
  806. struct drm_mode_fb_cmd2 *mode_cmd,
  807. struct drm_i915_gem_object *obj);
  808. void intel_prepare_page_flip(struct drm_device *dev, int plane);
  809. void intel_finish_page_flip(struct drm_device *dev, int pipe);
  810. void intel_finish_page_flip_plane(struct drm_device *dev, int plane);
  811. void intel_check_page_flip(struct drm_device *dev, int pipe);
  812. int intel_prepare_plane_fb(struct drm_plane *plane,
  813. struct drm_framebuffer *fb);
  814. void intel_cleanup_plane_fb(struct drm_plane *plane,
  815. struct drm_framebuffer *fb);
  816. /* shared dpll functions */
  817. struct intel_shared_dpll *intel_crtc_to_shared_dpll(struct intel_crtc *crtc);
  818. void assert_shared_dpll(struct drm_i915_private *dev_priv,
  819. struct intel_shared_dpll *pll,
  820. bool state);
  821. #define assert_shared_dpll_enabled(d, p) assert_shared_dpll(d, p, true)
  822. #define assert_shared_dpll_disabled(d, p) assert_shared_dpll(d, p, false)
  823. struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc);
  824. void intel_put_shared_dpll(struct intel_crtc *crtc);
  825. void vlv_force_pll_on(struct drm_device *dev, enum pipe pipe,
  826. const struct dpll *dpll);
  827. void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe);
  828. /* modesetting asserts */
  829. void assert_panel_unlocked(struct drm_i915_private *dev_priv,
  830. enum pipe pipe);
  831. void assert_pll(struct drm_i915_private *dev_priv,
  832. enum pipe pipe, bool state);
  833. #define assert_pll_enabled(d, p) assert_pll(d, p, true)
  834. #define assert_pll_disabled(d, p) assert_pll(d, p, false)
  835. void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,
  836. enum pipe pipe, bool state);
  837. #define assert_fdi_rx_pll_enabled(d, p) assert_fdi_rx_pll(d, p, true)
  838. #define assert_fdi_rx_pll_disabled(d, p) assert_fdi_rx_pll(d, p, false)
  839. void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state);
  840. #define assert_pipe_enabled(d, p) assert_pipe(d, p, true)
  841. #define assert_pipe_disabled(d, p) assert_pipe(d, p, false)
  842. unsigned long intel_gen4_compute_page_offset(int *x, int *y,
  843. unsigned int tiling_mode,
  844. unsigned int bpp,
  845. unsigned int pitch);
  846. void intel_prepare_reset(struct drm_device *dev);
  847. void intel_finish_reset(struct drm_device *dev);
  848. void hsw_enable_pc8(struct drm_i915_private *dev_priv);
  849. void hsw_disable_pc8(struct drm_i915_private *dev_priv);
  850. void intel_dp_get_m_n(struct intel_crtc *crtc,
  851. struct intel_crtc_config *pipe_config);
  852. void intel_dp_set_m_n(struct intel_crtc *crtc);
  853. int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
  854. void
  855. ironlake_check_encoder_dotclock(const struct intel_crtc_config *pipe_config,
  856. int dotclock);
  857. bool intel_crtc_active(struct drm_crtc *crtc);
  858. void hsw_enable_ips(struct intel_crtc *crtc);
  859. void hsw_disable_ips(struct intel_crtc *crtc);
  860. enum intel_display_power_domain
  861. intel_display_port_power_domain(struct intel_encoder *intel_encoder);
  862. void intel_mode_from_pipe_config(struct drm_display_mode *mode,
  863. struct intel_crtc_config *pipe_config);
  864. int intel_format_to_fourcc(int format);
  865. void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc);
  866. void intel_modeset_preclose(struct drm_device *dev, struct drm_file *file);
  867. /* intel_dp.c */
  868. void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);
  869. bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
  870. struct intel_connector *intel_connector);
  871. void intel_dp_start_link_train(struct intel_dp *intel_dp);
  872. void intel_dp_complete_link_train(struct intel_dp *intel_dp);
  873. void intel_dp_stop_link_train(struct intel_dp *intel_dp);
  874. void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
  875. void intel_dp_encoder_destroy(struct drm_encoder *encoder);
  876. void intel_dp_check_link_status(struct intel_dp *intel_dp);
  877. int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
  878. bool intel_dp_compute_config(struct intel_encoder *encoder,
  879. struct intel_crtc_config *pipe_config);
  880. bool intel_dp_is_edp(struct drm_device *dev, enum port port);
  881. bool intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port,
  882. bool long_hpd);
  883. void intel_edp_backlight_on(struct intel_dp *intel_dp);
  884. void intel_edp_backlight_off(struct intel_dp *intel_dp);
  885. void intel_edp_panel_vdd_on(struct intel_dp *intel_dp);
  886. void intel_edp_panel_on(struct intel_dp *intel_dp);
  887. void intel_edp_panel_off(struct intel_dp *intel_dp);
  888. void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate);
  889. void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector);
  890. void intel_dp_mst_suspend(struct drm_device *dev);
  891. void intel_dp_mst_resume(struct drm_device *dev);
  892. int intel_dp_max_link_bw(struct intel_dp *intel_dp);
  893. void intel_dp_hot_plug(struct intel_encoder *intel_encoder);
  894. void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv);
  895. uint32_t intel_dp_pack_aux(const uint8_t *src, int src_bytes);
  896. void intel_dp_unpack_aux(uint32_t src, uint8_t *dst, int dst_bytes);
  897. int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
  898. struct drm_framebuffer *fb, int crtc_x, int crtc_y,
  899. unsigned int crtc_w, unsigned int crtc_h,
  900. uint32_t src_x, uint32_t src_y,
  901. uint32_t src_w, uint32_t src_h);
  902. /* intel_dp_mst.c */
  903. int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
  904. void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port);
  905. /* intel_dsi.c */
  906. void intel_dsi_init(struct drm_device *dev);
  907. /* intel_dvo.c */
  908. void intel_dvo_init(struct drm_device *dev);
  909. /* legacy fbdev emulation in intel_fbdev.c */
  910. #ifdef CONFIG_DRM_I915_FBDEV
  911. extern int intel_fbdev_init(struct drm_device *dev);
  912. extern void intel_fbdev_initial_config(void *data, async_cookie_t cookie);
  913. extern void intel_fbdev_fini(struct drm_device *dev);
  914. extern void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
  915. extern void intel_fbdev_output_poll_changed(struct drm_device *dev);
  916. extern void intel_fbdev_restore_mode(struct drm_device *dev);
  917. #else
  918. static inline int intel_fbdev_init(struct drm_device *dev)
  919. {
  920. return 0;
  921. }
  922. static inline void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
  923. {
  924. }
  925. static inline void intel_fbdev_fini(struct drm_device *dev)
  926. {
  927. }
  928. static inline void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous)
  929. {
  930. }
  931. static inline void intel_fbdev_restore_mode(struct drm_device *dev)
  932. {
  933. }
  934. #endif
  935. /* intel_hdmi.c */
  936. void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port);
  937. void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
  938. struct intel_connector *intel_connector);
  939. struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
  940. bool intel_hdmi_compute_config(struct intel_encoder *encoder,
  941. struct intel_crtc_config *pipe_config);
  942. /* intel_lvds.c */
  943. void intel_lvds_init(struct drm_device *dev);
  944. bool intel_is_dual_link_lvds(struct drm_device *dev);
  945. /* intel_modes.c */
  946. int intel_connector_update_modes(struct drm_connector *connector,
  947. struct edid *edid);
  948. int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
  949. void intel_attach_force_audio_property(struct drm_connector *connector);
  950. void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
  951. /* intel_overlay.c */
  952. void intel_setup_overlay(struct drm_device *dev);
  953. void intel_cleanup_overlay(struct drm_device *dev);
  954. int intel_overlay_switch_off(struct intel_overlay *overlay);
  955. int intel_overlay_put_image(struct drm_device *dev, void *data,
  956. struct drm_file *file_priv);
  957. int intel_overlay_attrs(struct drm_device *dev, void *data,
  958. struct drm_file *file_priv);
  959. void intel_overlay_reset(struct drm_i915_private *dev_priv);
  960. /* intel_panel.c */
  961. int intel_panel_init(struct intel_panel *panel,
  962. struct drm_display_mode *fixed_mode,
  963. struct drm_display_mode *downclock_mode);
  964. void intel_panel_fini(struct intel_panel *panel);
  965. void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
  966. struct drm_display_mode *adjusted_mode);
  967. void intel_pch_panel_fitting(struct intel_crtc *crtc,
  968. struct intel_crtc_config *pipe_config,
  969. int fitting_mode);
  970. void intel_gmch_panel_fitting(struct intel_crtc *crtc,
  971. struct intel_crtc_config *pipe_config,
  972. int fitting_mode);
  973. void intel_panel_set_backlight_acpi(struct intel_connector *connector,
  974. u32 level, u32 max);
  975. int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe);
  976. void intel_panel_enable_backlight(struct intel_connector *connector);
  977. void intel_panel_disable_backlight(struct intel_connector *connector);
  978. void intel_panel_destroy_backlight(struct drm_connector *connector);
  979. void intel_panel_init_backlight_funcs(struct drm_device *dev);
  980. enum drm_connector_status intel_panel_detect(struct drm_device *dev);
  981. extern struct drm_display_mode *intel_find_panel_downclock(
  982. struct drm_device *dev,
  983. struct drm_display_mode *fixed_mode,
  984. struct drm_connector *connector);
  985. void intel_backlight_register(struct drm_device *dev);
  986. void intel_backlight_unregister(struct drm_device *dev);
  987. /* intel_psr.c */
  988. void intel_psr_enable(struct intel_dp *intel_dp);
  989. void intel_psr_disable(struct intel_dp *intel_dp);
  990. void intel_psr_invalidate(struct drm_device *dev,
  991. unsigned frontbuffer_bits);
  992. void intel_psr_flush(struct drm_device *dev,
  993. unsigned frontbuffer_bits);
  994. void intel_psr_init(struct drm_device *dev);
  995. /* intel_runtime_pm.c */
  996. int intel_power_domains_init(struct drm_i915_private *);
  997. void intel_power_domains_fini(struct drm_i915_private *);
  998. void intel_power_domains_init_hw(struct drm_i915_private *dev_priv);
  999. void intel_runtime_pm_enable(struct drm_i915_private *dev_priv);
  1000. bool intel_display_power_is_enabled(struct drm_i915_private *dev_priv,
  1001. enum intel_display_power_domain domain);
  1002. bool __intel_display_power_is_enabled(struct drm_i915_private *dev_priv,
  1003. enum intel_display_power_domain domain);
  1004. void intel_display_power_get(struct drm_i915_private *dev_priv,
  1005. enum intel_display_power_domain domain);
  1006. void intel_display_power_put(struct drm_i915_private *dev_priv,
  1007. enum intel_display_power_domain domain);
  1008. void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv);
  1009. void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv);
  1010. void intel_runtime_pm_get(struct drm_i915_private *dev_priv);
  1011. void intel_runtime_pm_get_noresume(struct drm_i915_private *dev_priv);
  1012. void intel_runtime_pm_put(struct drm_i915_private *dev_priv);
  1013. void intel_display_set_init_power(struct drm_i915_private *dev, bool enable);
  1014. /* intel_pm.c */
  1015. void intel_init_clock_gating(struct drm_device *dev);
  1016. void intel_suspend_hw(struct drm_device *dev);
  1017. int ilk_wm_max_level(const struct drm_device *dev);
  1018. void intel_update_watermarks(struct drm_crtc *crtc);
  1019. void intel_update_sprite_watermarks(struct drm_plane *plane,
  1020. struct drm_crtc *crtc,
  1021. uint32_t sprite_width,
  1022. uint32_t sprite_height,
  1023. int pixel_size,
  1024. bool enabled, bool scaled);
  1025. void intel_init_pm(struct drm_device *dev);
  1026. void intel_pm_setup(struct drm_device *dev);
  1027. bool intel_fbc_enabled(struct drm_device *dev);
  1028. void intel_update_fbc(struct drm_device *dev);
  1029. void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
  1030. void intel_gpu_ips_teardown(void);
  1031. void intel_init_gt_powersave(struct drm_device *dev);
  1032. void intel_cleanup_gt_powersave(struct drm_device *dev);
  1033. void intel_enable_gt_powersave(struct drm_device *dev);
  1034. void intel_disable_gt_powersave(struct drm_device *dev);
  1035. void intel_suspend_gt_powersave(struct drm_device *dev);
  1036. void intel_reset_gt_powersave(struct drm_device *dev);
  1037. void ironlake_teardown_rc6(struct drm_device *dev);
  1038. void gen6_update_ring_freq(struct drm_device *dev);
  1039. void gen6_rps_idle(struct drm_i915_private *dev_priv);
  1040. void gen6_rps_boost(struct drm_i915_private *dev_priv);
  1041. void ilk_wm_get_hw_state(struct drm_device *dev);
  1042. void skl_wm_get_hw_state(struct drm_device *dev);
  1043. void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv,
  1044. struct skl_ddb_allocation *ddb /* out */);
  1045. /* intel_sdvo.c */
  1046. bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob);
  1047. /* intel_sprite.c */
  1048. int intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane);
  1049. void intel_flush_primary_plane(struct drm_i915_private *dev_priv,
  1050. enum plane plane);
  1051. int intel_plane_set_property(struct drm_plane *plane,
  1052. struct drm_property *prop,
  1053. uint64_t val);
  1054. int intel_plane_restore(struct drm_plane *plane);
  1055. void intel_plane_disable(struct drm_plane *plane);
  1056. int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
  1057. struct drm_file *file_priv);
  1058. int intel_sprite_get_colorkey(struct drm_device *dev, void *data,
  1059. struct drm_file *file_priv);
  1060. bool intel_pipe_update_start(struct intel_crtc *crtc,
  1061. uint32_t *start_vbl_count);
  1062. void intel_pipe_update_end(struct intel_crtc *crtc, u32 start_vbl_count);
  1063. /* intel_tv.c */
  1064. void intel_tv_init(struct drm_device *dev);
  1065. #endif /* __INTEL_DRV_H__ */