intel_drv.h 42 KB

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