intel_drv.h 40 KB

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