History

Merge tag 'sound-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai: "We've had quite busy weeks in this cycle. Looking at ALSA core, the significant changes are a few fixes wrt timer and sequencer ioctls that have been revealed by fuzzer recently. Other than that, ASoC core got a few updates about DAI link handling, but these are rather straightforward refactoring. In drivers scene, ASoC received quite lots of new drivers in addition to bunch of updates for still ongoing Intel Skylake support and topology API. HD-audio gained a new HDMI/DP hotplug notification via component. FireWire got a pile of code refactoring/updates with SCS.1x driver integration. More highlights are shown below. [ NOTE: this contains also many commits for DRM. This is due to the pull of drm stable branch into sound tree, as the base of i915 audio component work for HD-audio. The highlights below don't contain these DRM changes, as these are supposed to be pulled via drm tree in anyway sooner or later. ] Core: - Handful fixes to harden ALSA timer and sequencer ioctls against races reported by syzkaller fuzzer - Irq description string can be unique to each card; only for HD-audio for now ASoC: - Conversion of the array of DAI links to a list for supporting dynamically adding and removing DAI links - Topology API enhancements to make everything more component based and being able to specify PCM links via topology - Some more fixes for the topology code, though it is still not final and ready for enabling in production; we really need to get to the point where that can be done - A pile of changes for Intel SkyLake drivers which hopefully deliver some useful initial functionality for systems with this chipset, though there is more work still to come - Lots of new features and cleanups for the Renesas drivers - ANC support for WM5110 - New drivers: Imagination Technologies IPs, Atmel class D speaker, Cirrus CS47L24 and WM1831, Dialog DA7128, Realtek RT5659 and RT56156, Rockchip RK3036, TI PC3168A, and AMD ACP - Rename PCM1792a driver to be generic pcm179x HD-Audio: - Use audio component for i915 HDMI/DP hotplug handling - On-demand binding with i915 driver - bdl_pos_adj parameter adjustment for Baytrail controllers - Enable power_save_node for CX20722; this shouldn't lead to regression, hopefully - Kabylake HDMI/DP codec support - Quirks for Lenovo E50-80, Dell Latitude E-series, and other Dell machines - A few code refactoring FireWire: - Lots of code cleanup and refactoring - Integrate the support of SCS.1x devices into snd-oxfw driver; snd-scs1x driver is obsoleted USB-audio: - Fix possible NULL dereference at disconnection - A regression fix for Native Instruments devices Misc: - A few code cleanups of fm801 driver" * tag 'sound-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (722 commits) ALSA: timer: Code cleanup ALSA: timer: Harden slave timer list handling ALSA: hda - Add fixup for Dell Latitidue E6540 ALSA: timer: Fix race among timer ioctls ALSA: hda - add codec support for Kabylake display audio codec ALSA: timer: Fix double unlink of active_list ALSA: usb-audio: Fix mixer ctl regression of Native Instrument devices ALSA: hda - fix the headset mic detection problem for a Dell laptop ALSA: hda - Fix white noise on Dell Latitude E5550 ALSA: hda_intel: add card number to irq description ALSA: seq: Fix race at timer setup and close ALSA: seq: Fix missing NULL check at remove_events ioctl ALSA: usb-audio: Avoid calling usb_autopm_put_interface() at disconnect ASoC: hdac_hdmi: remove unused hdac_hdmi_query_pin_connlist ASoC: AMD: Add missing include file ALSA: hda - Fixup inverted internal mic for Lenovo E50-80 ALSA: usb: Add native DSD support for Oppo HA-1 ASoC: Make aux_dev more like a generic component ASoC: bcm2835: cleanup includes by ordering them alphabetically ASoC: AMD: Manage ACP 2.x SRAM banks power ...

Linus Torvalds committed 10 years ago

Commit a016af22 parents e535d74 c3b1681430 files · +45195 −10422Browse files

Unified · Split

430 files
  1. Documentation/DocBook/gpu.tmpl +20 −40
  2. Documentation/devicetree/bindings/sound/ak4613.txt +10 −0
  3. Documentation/devicetree/bindings/sound/atmel-pdmic.txt +55 −0
  4. Documentation/devicetree/bindings/sound/da7218.txt +104 −0
  5. Documentation/devicetree/bindings/sound/da7219.txt +5 −3
  6. Documentation/devicetree/bindings/sound/fsl,asrc.txt +5 −0
  7. Documentation/devicetree/bindings/sound/fsl,esai.txt +5 −0
  8. Documentation/devicetree/bindings/sound/fsl,spdif.txt +5 −0
  9. Documentation/devicetree/bindings/sound/img,i2s-in.txt +47 −0
  10. Documentation/devicetree/bindings/sound/img,i2s-out.txt +51 −0
  11. Documentation/devicetree/bindings/sound/img,parallel-out.txt +44 −0
  12. Documentation/devicetree/bindings/sound/img,pistachio-internal-dac.txt +18 −0
  13. Documentation/devicetree/bindings/sound/img,spdif-in.txt +41 −0
  14. Documentation/devicetree/bindings/sound/img,spdif-out.txt +44 −0
  15. Documentation/devicetree/bindings/sound/inno-rk3036.txt +20 −0
  16. Documentation/devicetree/bindings/sound/pcm179x.txt +1 −1
  17. Documentation/devicetree/bindings/sound/renesas,rsnd.txt +82 −0
  18. Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt +2 −2
  19. Documentation/devicetree/bindings/sound/rockchip-i2s.txt +2 −0
  20. Documentation/devicetree/bindings/sound/rt5616.txt +26 −0
  21. Documentation/devicetree/bindings/sound/rt5651.txt +41 −0
  22. Documentation/devicetree/bindings/sound/rt5659.txt +75 −0
  23. Documentation/devicetree/bindings/sound/rt5677.txt +1 −1
  24. Documentation/devicetree/bindings/sound/sun4i-codec.txt +3 −0
  25. Documentation/devicetree/bindings/sound/ti,pcm3168a.txt +48 −0
  26. Documentation/devicetree/bindings/sound/wlf,wm8974.txt +15 −0
  27. Documentation/sound/alsa/img,spdif-in.txt +49 −0
  28. arch/arm/mach-s3c64xx/dev-audio.c +29 −18
  29. arch/arm/mach-s3c64xx/include/mach/dma.h +26 −26
  30. arch/arm/plat-samsung/devs.c +20 −3
  31. arch/x86/include/asm/platform_sst_audio.h +1 −0
  32. arch/x86/kernel/early-quirks.c +1 −0
  33. drivers/dma/Kconfig +1 −1
  34. drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 −2
  35. drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 −1
  36. drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +1 −1
  37. drivers/gpu/drm/armada/armada_fb.c +2 −2
  38. drivers/gpu/drm/armada/armada_fb.h +1 −1
  39. drivers/gpu/drm/ast/ast_drv.h +1 −2
  40. drivers/gpu/drm/ast/ast_fb.c +1 −1
  41. drivers/gpu/drm/ast/ast_main.c +2 −2
  42. drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +1 −1
  43. drivers/gpu/drm/bochs/bochs.h +1 −1
  44. drivers/gpu/drm/bochs/bochs_fbdev.c +1 −1
  45. drivers/gpu/drm/bochs/bochs_mm.c +2 −2
  46. drivers/gpu/drm/cirrus/cirrus_drv.h +1 −2
  47. drivers/gpu/drm/cirrus/cirrus_fbdev.c +1 −1
  48. drivers/gpu/drm/cirrus/cirrus_main.c +2 −2
  49. drivers/gpu/drm/drm_atomic.c +5 −13
  50. drivers/gpu/drm/drm_atomic_helper.c +241 −11
  51. drivers/gpu/drm/drm_crtc.c +2 −2
  52. drivers/gpu/drm/drm_crtc_helper.c +7 −1
  53. drivers/gpu/drm/drm_edid.c +60 −2
  54. drivers/gpu/drm/drm_fb_cma_helper.c +2 −2
  55. drivers/gpu/drm/drm_fops.c +37 −21
  56. drivers/gpu/drm/drm_gem.c +32 −3
  57. drivers/gpu/drm/drm_modes.c +29 −6
  58. drivers/gpu/drm/drm_modeset_lock.c +60 −29
  59. drivers/gpu/drm/drm_plane_helper.c +4 −0
  60. drivers/gpu/drm/drm_probe_helper.c +24 −23
  61. drivers/gpu/drm/drm_rect.c +4 −3
  62. drivers/gpu/drm/drm_sysfs.c +25 −29
  63. drivers/gpu/drm/exynos/exynos_drm_fb.c +2 −2
  64. drivers/gpu/drm/exynos/exynos_drm_fb.h +1 −1
  65. drivers/gpu/drm/gma500/framebuffer.c +5 −13
  66. drivers/gpu/drm/gma500/gem.c +6 −13
  67. drivers/gpu/drm/gma500/gma_display.c +3 −10
  68. drivers/gpu/drm/gma500/gtt.c +1 −0
  69. drivers/gpu/drm/gma500/psb_drv.h +2 −0
  70. drivers/gpu/drm/i915/Kconfig +1 −0
  71. drivers/gpu/drm/i915/Makefile +1 −0
  72. drivers/gpu/drm/i915/dvo.h +2 −1
  73. drivers/gpu/drm/i915/i915_cmd_parser.c +21 −16
  74. drivers/gpu/drm/i915/i915_debugfs.c +201 −43
  75. drivers/gpu/drm/i915/i915_dma.c +11 −15
  76. drivers/gpu/drm/i915/i915_drv.c +82 −88
  77. drivers/gpu/drm/i915/i915_drv.h +108 −80
  78. drivers/gpu/drm/i915/i915_gem.c +37 −36
  79. drivers/gpu/drm/i915/i915_gem_context.c +10 −2
  80. drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 −2
  81. drivers/gpu/drm/i915/i915_gem_fence.c +1 −1
  82. drivers/gpu/drm/i915/i915_gem_gtt.c +42 −16
  83. drivers/gpu/drm/i915/i915_gem_gtt.h +2 −5
  84. drivers/gpu/drm/i915/i915_gem_stolen.c +2 −1
  85. drivers/gpu/drm/i915/i915_gem_tiling.c +4 −0
  86. drivers/gpu/drm/i915/i915_gpu_error.c +35 −5
  87. drivers/gpu/drm/i915/i915_guc_reg.h +27 −26
  88. drivers/gpu/drm/i915/i915_guc_submission.c +8 −8
  89. drivers/gpu/drm/i915/i915_irq.c +59 −58
  90. drivers/gpu/drm/i915/i915_params.c +8 −2
  91. drivers/gpu/drm/i915/i915_reg.h +1370 −1372
  92. drivers/gpu/drm/i915/i915_sysfs.c +2 −1
  93. drivers/gpu/drm/i915/i915_trace.h +2 −2
  94. drivers/gpu/drm/i915/i915_vgpu.c +3 −3
  95. drivers/gpu/drm/i915/i915_vgpu.h +5 −9
  96. drivers/gpu/drm/i915/intel_atomic.c +1 −2
  97. drivers/gpu/drm/i915/intel_atomic_plane.c +2 −0
  98. drivers/gpu/drm/i915/intel_audio.c +65 −37
  99. drivers/gpu/drm/i915/intel_crt.c +5 −9
  100. drivers/gpu/drm/i915/intel_csr.c +123 −161
  101. drivers/gpu/drm/i915/intel_ddi.c +83 −59
  102. drivers/gpu/drm/i915/intel_display.c +511 −287
  103. drivers/gpu/drm/i915/intel_dp.c +431 −609
  104. drivers/gpu/drm/i915/intel_dp_link_training.c +323 −0
  105. drivers/gpu/drm/i915/intel_dp_mst.c +9 −9
  106. drivers/gpu/drm/i915/intel_drv.h +98 −61
  107. drivers/gpu/drm/i915/intel_dsi.c +23 −22
  108. drivers/gpu/drm/i915/intel_dsi.h +1 −1
  109. drivers/gpu/drm/i915/intel_dvo.c +11 −16
  110. drivers/gpu/drm/i915/intel_fbc.c +73 −123
  111. drivers/gpu/drm/i915/intel_fbdev.c +32 −18
  112. drivers/gpu/drm/i915/intel_fifo_underrun.c +99 −28
  113. drivers/gpu/drm/i915/intel_guc.h +7 −1
  114. drivers/gpu/drm/i915/intel_guc_fwif.h +72 −0
  115. drivers/gpu/drm/i915/intel_guc_loader.c +67 −38
  116. drivers/gpu/drm/i915/intel_hdmi.c +47 −30
  117. drivers/gpu/drm/i915/intel_i2c.c +16 −15
  118. drivers/gpu/drm/i915/intel_lrc.c +67 −81
  119. drivers/gpu/drm/i915/intel_lrc.h +12 −7
  120. drivers/gpu/drm/i915/intel_lvds.c +5 −6
  121. drivers/gpu/drm/i915/intel_mocs.c +35 −26
  122. drivers/gpu/drm/i915/intel_opregion.c +1 −1
  123. drivers/gpu/drm/i915/intel_overlay.c +1 −1
  124. drivers/gpu/drm/i915/intel_pm.c +256 −374
  125. drivers/gpu/drm/i915/intel_psr.c +52 −25
  126. drivers/gpu/drm/i915/intel_ringbuffer.c +100 −56
  127. drivers/gpu/drm/i915/intel_ringbuffer.h +8 −1
  128. drivers/gpu/drm/i915/intel_runtime_pm.c +283 −209
  129. drivers/gpu/drm/i915/intel_sdvo.c +41 −20
  130. drivers/gpu/drm/i915/intel_sprite.c +5 −23
  131. drivers/gpu/drm/i915/intel_uncore.c +147 −114
  132. drivers/gpu/drm/imx/Kconfig +0 −9
  133. drivers/gpu/drm/imx/imx-drm-core.c +3 −9
  134. drivers/gpu/drm/mgag200/mgag200_drv.h +1 −1
  135. drivers/gpu/drm/mgag200/mgag200_fb.c +1 −1
  136. drivers/gpu/drm/mgag200/mgag200_main.c +2 −2
  137. drivers/gpu/drm/msm/msm_drv.h +2 −2
  138. drivers/gpu/drm/msm/msm_fb.c +2 −2
  139. drivers/gpu/drm/nouveau/nouveau_display.c +2 −2
  140. drivers/gpu/drm/nouveau/nouveau_display.h +1 −1
  141. drivers/gpu/drm/nouveau/nouveau_fbcon.h +0 −1
  142. drivers/gpu/drm/omapdrm/omap_drv.h +3 −3
  143. drivers/gpu/drm/omapdrm/omap_fb.c +2 −2
  144. drivers/gpu/drm/qxl/qxl_display.c +2 −2
  145. drivers/gpu/drm/qxl/qxl_drv.h +1 −1
  146. drivers/gpu/drm/qxl/qxl_fb.c +1 −2
  147. drivers/gpu/drm/radeon/radeon_display.c +2 −2
  148. drivers/gpu/drm/radeon/radeon_fb.c +0 −1
  149. drivers/gpu/drm/radeon/radeon_mode.h +1 −1
  150. drivers/gpu/drm/rcar-du/rcar_du_kms.c +1 −1
  151. drivers/gpu/drm/rockchip/rockchip_drm_fb.c +3 −3
  152. drivers/gpu/drm/rockchip/rockchip_drm_fb.h +1 −1
  153. drivers/gpu/drm/shmobile/shmob_drm_kms.c +1 −1
  154. drivers/gpu/drm/tegra/Kconfig +0 −12
  155. drivers/gpu/drm/tegra/drm.c +2 −2
  156. drivers/gpu/drm/tegra/drm.h +4 −4
  157. drivers/gpu/drm/tegra/fb.c +8 −8
  158. drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 −1
  159. drivers/gpu/drm/udl/udl_drv.h +1 −1
  160. drivers/gpu/drm/udl/udl_fb.c +2 −3
  161. drivers/gpu/drm/virtio/virtgpu_display.c +2 −2
  162. drivers/gpu/drm/virtio/virtgpu_drv.h +1 −1
  163. drivers/gpu/drm/virtio/virtgpu_fb.c +0 −1
  164. drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 −1
  165. drivers/pci/quirks.c +3 −1
  166. include/drm/drmP.h +5 −0
  167. include/drm/drm_atomic.h +3 −3
  168. include/drm/drm_atomic_helper.h +8 −0
  169. include/drm/drm_crtc.h +8 −4
  170. include/drm/drm_crtc_helper.h +1 −1
  171. include/drm/drm_dp_helper.h +36 −0
  172. include/drm/drm_fb_cma_helper.h +1 −1
  173. include/drm/drm_gem.h +92 −14
  174. include/drm/drm_mm.h +10 −16
  175. include/drm/drm_modes.h +2 −0
  176. include/drm/drm_modeset_lock.h +2 −2
  177. include/drm/drm_rect.h +2 −1
  178. include/drm/i915_component.h +65 −18
  179. include/drm/i915_pciids.h +36 −0
  180. include/linux/platform_data/asoc-s3c.h +8 −0
  181. include/sound/ac97_codec.h +3 −0
  182. include/sound/compress_driver.h +6 −1
  183. include/sound/core.h +1 −0
  184. include/sound/da7218.h +109 −0
  185. include/sound/da7219.h +2 −12
  186. include/sound/designware_i2s.h +6 −0
  187. include/sound/hda_i915.h +14 −0
  188. include/sound/hda_register.h +9 −0
  189. include/sound/hdaudio_ext.h +21 −0
  190. include/sound/i2c.h +1 −1
  191. include/sound/rawmidi.h +1 −1
  192. include/sound/rt5659.h +49 −0
  193. include/sound/soc-dai.h +1 −0
  194. include/sound/soc-dapm.h +4 −0
  195. include/sound/soc-topology.h +4 −2
  196. include/sound/soc.h +46 −7
  197. include/uapi/drm/i915_drm.h +9 −2
  198. include/uapi/sound/asoc.h +1 −1
  199. include/uapi/sound/compress_params.h +3 −2
  200. kernel/async.c +1 −0
  201. sound/core/compress_offload.c +97 −2
  202. sound/core/init.c +3 −0
  203. sound/core/oss/mixer_oss.c +7 −1
  204. sound/core/oss/pcm_oss.c +7 −3
  205. sound/core/pcm_native.c +13 −13
  206. sound/core/seq/oss/seq_oss.c +6 −1
  207. sound/core/seq/seq_clientmgr.c +1 −1
  208. sound/core/seq/seq_queue.c +2 −0
  209. sound/core/seq/seq_virmidi.c +1 −1
  210. sound/core/timer.c +43 −33
  211. sound/drivers/dummy.c +2 −2
  212. sound/firewire/Kconfig +1 −11
  213. sound/firewire/Makefile +0 −2
  214. sound/firewire/dice/dice-transaction.c +79 −44
  215. sound/firewire/dice/dice.c +120 −107
  216. sound/firewire/dice/dice.h +3 −0
  217. sound/firewire/fireworks/fireworks.h +2 −2
  218. sound/firewire/fireworks/fireworks_midi.c +12 −4
  219. sound/firewire/fireworks/fireworks_pcm.c +20 −8
  220. sound/firewire/fireworks/fireworks_stream.c +12 −20
  221. sound/firewire/oxfw/Makefile +2 −2
  222. sound/firewire/oxfw/oxfw-scs1x.c +406 −0
  223. sound/firewire/oxfw/oxfw-spkr.c +89 −53
  224. sound/firewire/oxfw/oxfw.c +78 −32
  225. sound/firewire/oxfw/oxfw.h +7 −16
  226. sound/firewire/scs1x.c +0 −530
  227. sound/hda/ext/hdac_ext_controller.c +28 −1
  228. sound/hda/ext/hdac_ext_stream.c +72 −0
  229. sound/hda/hdac_i915.c +66 −0
  230. sound/i2c/i2c.c +1 −1
  231. sound/oss/Kconfig +1 −1
  232. sound/pci/atiixp.c +3 −3
  233. sound/pci/atiixp_modem.c +2 −2
  234. sound/pci/azt3328.c +0 −2
  235. sound/pci/cs5535audio/cs5535audio_pcm.c +2 −2
  236. sound/pci/fm801.c +95 −50
  237. sound/pci/hda/hda_controller.c +2 −8
  238. sound/pci/hda/hda_controller.h +9 −5
  239. sound/pci/hda/hda_eld.c +1 −0
  240. sound/pci/hda/hda_generic.c +70 −38
  241. sound/pci/hda/hda_generic.h +0 −5
  242. sound/pci/hda/hda_intel.c +49 −29
  243. sound/pci/hda/hda_tegra.c +3 −2
  244. sound/pci/hda/patch_conexant.c +3 −0
  245. sound/pci/hda/patch_hdmi.c +168 −77
  246. sound/pci/hda/patch_realtek.c +14 −0
  247. sound/pci/ice1712/delta.c +1 −1
  248. sound/soc/Kconfig +2 −0
  249. sound/soc/Makefile +2 −0
  250. sound/soc/amd/Kconfig +4 −0
  251. sound/soc/amd/Makefile +3 −0
  252. sound/soc/amd/acp-pcm-dma.c +1043 −0
  253. sound/soc/amd/acp.h +118 −0
  254. sound/soc/amd/include/acp_2_2_d.h +609 −0
  255. sound/soc/amd/include/acp_2_2_enum.h +1068 −0
  256. sound/soc/amd/include/acp_2_2_sh_mask.h +2292 −0
  257. sound/soc/atmel/Kconfig +9 −0
  258. sound/soc/atmel/Makefile +2 −0
  259. sound/soc/atmel/atmel-classd.c +18 −8
  260. sound/soc/atmel/atmel-pdmic.c +738 −0
  261. sound/soc/atmel/atmel-pdmic.h +80 −0
  262. sound/soc/atmel/atmel_wm8904.c +1 −0
  263. sound/soc/bcm/bcm2835-i2s.c +6 −6
  264. sound/soc/codecs/Kconfig +58 −4
  265. sound/soc/codecs/Makefile +20 −2
  266. sound/soc/codecs/ak4613.c +83 −35
  267. sound/soc/codecs/arizona.c +134 −12
  268. sound/soc/codecs/arizona.h +12 −5
  269. sound/soc/codecs/cs47l24.c +1148 −0
  270. sound/soc/codecs/cs47l24.h +23 −0
  271. sound/soc/codecs/da7218.c +3341 −0
  272. sound/soc/codecs/da7218.h +1414 −0
  273. sound/soc/codecs/da7219.c +88 −75
  274. sound/soc/codecs/da7219.h +0 −9
  275. sound/soc/codecs/hdac_hdmi.c +697 −0
  276. sound/soc/codecs/inno_rk3036.c +490 −0
  277. sound/soc/codecs/inno_rk3036.h +123 −0
  278. sound/soc/codecs/max98357a.c +10 −0
  279. sound/soc/codecs/pcm1792a.c +0 −271
  280. sound/soc/codecs/pcm179x.c +271 −0
  281. sound/soc/codecs/pcm179x.h +3 −3
  282. sound/soc/codecs/pcm3168a-i2c.c +66 −0
  283. sound/soc/codecs/pcm3168a-spi.c +65 −0
  284. sound/soc/codecs/pcm3168a.c +767 −0
  285. sound/soc/codecs/pcm3168a.h +100 −0
  286. sound/soc/codecs/rt286.c +6 −0
  287. sound/soc/codecs/rt298.c +0 −2
  288. sound/soc/codecs/rt5616.c +1381 −0
  289. sound/soc/codecs/rt5616.h +1819 −0
  290. sound/soc/codecs/rt5640.c +103 −0
  291. sound/soc/codecs/rt5640.h +17 −0
  292. sound/soc/codecs/rt5645.c +245 −77
  293. sound/soc/codecs/rt5651.c +31 −0
  294. sound/soc/codecs/rt5659.c +4223 −0
  295. sound/soc/codecs/rt5659.h +1819 −0
  296. sound/soc/codecs/rt5677.c +7 −6
  297. sound/soc/codecs/ssm2518.c +1 −1
  298. sound/soc/codecs/twl6040.c +1 −2
  299. sound/soc/codecs/wm5110.c +240 −12
  300. sound/soc/codecs/wm8903.c +1 −1
  301. sound/soc/codecs/wm8904.c +1 −1
  302. sound/soc/codecs/wm8960.c +18 −6
  303. sound/soc/codecs/wm8962.c +1 −2
  304. sound/soc/codecs/wm8974.c +7 −0
  305. sound/soc/codecs/wm8998.c +23 −23
  306. sound/soc/codecs/wm9713.c +150 −146
  307. sound/soc/codecs/wm_adsp.c +1008 −87
  308. sound/soc/codecs/wm_adsp.h +25 −3
  309. sound/soc/dwc/designware_i2s.c +86 −31
  310. sound/soc/fsl/fsl-asoc-card.c +17 −4
  311. sound/soc/fsl/fsl_asrc.c +45 −17
  312. sound/soc/fsl/fsl_asrc.h +9 −0
  313. sound/soc/fsl/fsl_esai.c +40 −23
  314. sound/soc/fsl/fsl_sai.c +87 −11
  315. sound/soc/fsl/fsl_sai.h +3 −0
  316. sound/soc/fsl/fsl_spdif.c +27 −8
  317. sound/soc/fsl/fsl_ssi.c +35 −14
  318. sound/soc/fsl/imx-pcm-dma.c +2 −0
  319. sound/soc/fsl/imx-pcm-fiq.c +2 −2
  320. sound/soc/fsl/imx-wm8962.c +8 −2
  321. sound/soc/fsl/mpc8610_hpcd.c +1 −2
  322. sound/soc/fsl/p1022_ds.c +1 −2
  323. sound/soc/fsl/p1022_rdk.c +1 −2
  324. sound/soc/generic/simple-card.c +5 −7
  325. sound/soc/img/Kconfig +52 −0
  326. sound/soc/img/Makefile +7 −0
  327. sound/soc/img/img-i2s-in.c +516 −0
  328. sound/soc/img/img-i2s-out.c +565 −0
  329. sound/soc/img/img-parallel-out.c +327 −0
  330. sound/soc/img/img-spdif-in.c +806 −0
  331. sound/soc/img/img-spdif-out.c +441 −0
  332. sound/soc/img/pistachio-internal-dac.c +287 −0
  333. sound/soc/intel/Kconfig +50 −8
  334. sound/soc/intel/atom/sst-atom-controls.c +3 −2
  335. sound/soc/intel/atom/sst-atom-controls.h +1 −0
  336. sound/soc/intel/atom/sst-mfld-platform-pcm.c +20 −12
  337. sound/soc/intel/atom/sst/sst_acpi.c +33 −49
  338. sound/soc/intel/atom/sst/sst_stream.c +1 −1
  339. sound/soc/intel/baytrail/sst-baytrail-pcm.c +2 −0
  340. sound/soc/intel/boards/Makefile +6 −0
  341. sound/soc/intel/boards/bytcr_rt5640.c +213 −53
  342. sound/soc/intel/boards/bytcr_rt5651.c +332 −0
  343. sound/soc/intel/boards/cht_bsw_max98090_ti.c +14 −5
  344. sound/soc/intel/boards/cht_bsw_rt5645.c +14 −5
  345. sound/soc/intel/boards/cht_bsw_rt5672.c +14 −5
  346. sound/soc/intel/boards/skl_nau88l25_max98357a.c +485 −0
  347. sound/soc/intel/boards/skl_nau88l25_ssm4567.c +536 −0
  348. sound/soc/intel/boards/skl_rt286.c +124 −4
  349. sound/soc/intel/common/Makefile +7 −5
  350. sound/soc/intel/common/sst-acpi.c +5 −36
  351. sound/soc/intel/common/sst-acpi.h +33 −0
  352. sound/soc/intel/common/sst-dsp-priv.h +5 −3
  353. sound/soc/intel/common/sst-dsp.c +1 −1
  354. sound/soc/intel/common/sst-dsp.h +1 −1
  355. sound/soc/intel/common/sst-firmware.c +17 −3
  356. sound/soc/intel/common/sst-match-acpi.c +43 −0
  357. sound/soc/intel/haswell/sst-haswell-dsp.c +1 −1
  358. sound/soc/intel/haswell/sst-haswell-ipc.c +13 −18
  359. sound/soc/intel/skylake/skl-messages.c +153 −127
  360. sound/soc/intel/skylake/skl-nhlt.c +13 −6
  361. sound/soc/intel/skylake/skl-pcm.c +200 −110
  362. sound/soc/intel/skylake/skl-sst-cldma.c +69 −28
  363. sound/soc/intel/skylake/skl-sst-dsp.h +18 −3
  364. sound/soc/intel/skylake/skl-sst-ipc.c +122 −1
  365. sound/soc/intel/skylake/skl-sst-ipc.h +14 −0
  366. sound/soc/intel/skylake/skl-sst.c +197 −20
  367. sound/soc/intel/skylake/skl-topology.c +463 −195
  368. sound/soc/intel/skylake/skl-topology.h +47 −16
  369. sound/soc/intel/skylake/skl-tplg-interface.h +82 −23
  370. sound/soc/intel/skylake/skl.c +172 −41
  371. sound/soc/intel/skylake/skl.h +7 −1
  372. sound/soc/mediatek/mtk-afe-common.h +0 −1
  373. sound/soc/mediatek/mtk-afe-pcm.c +23 −36
  374. sound/soc/omap/omap-hdmi-audio.c +2 −0
  375. sound/soc/pxa/brownstone.c +1 −2
  376. sound/soc/pxa/mioa701_wm9713.c +5 −1
  377. sound/soc/qcom/lpass-cpu.c +1 −0
  378. sound/soc/rockchip/rockchip_i2s.c +77 −62
  379. sound/soc/rockchip/rockchip_max98090.c +6 −0
  380. sound/soc/rockchip/rockchip_rt5645.c +6 −0
  381. sound/soc/samsung/Kconfig +0 −2
  382. sound/soc/samsung/ac97.c +6 −23
  383. sound/soc/samsung/bells.c +30 −10
  384. sound/soc/samsung/dma.h +4 −2
  385. sound/soc/samsung/dmaengine.c +7 −13
  386. sound/soc/samsung/i2s.c +10 −21
  387. sound/soc/samsung/littlemill.c +26 −6
  388. sound/soc/samsung/odroidx2_max98090.c +7 −2
  389. sound/soc/samsung/pcm.c +9 −16
  390. sound/soc/samsung/s3c2412-i2s.c +12 −4
  391. sound/soc/samsung/s3c24xx-i2s.c +12 −4
  392. sound/soc/samsung/snow.c +7 −2
  393. sound/soc/samsung/spdif.c +8 −9
  394. sound/soc/samsung/speyside.c +10 −2
  395. sound/soc/samsung/tobermory.c +17 −4
  396. sound/soc/sh/Kconfig +0 −1
  397. sound/soc/sh/fsi.c +7 −4
  398. sound/soc/sh/rcar/Makefile +1 −1
  399. sound/soc/sh/rcar/adg.c +31 −87
  400. sound/soc/sh/rcar/cmd.c +171 −0
  401. sound/soc/sh/rcar/core.c +216 −370
  402. sound/soc/sh/rcar/ctu.c +42 −57
  403. sound/soc/sh/rcar/dma.c +149 −96
  404. sound/soc/sh/rcar/dvc.c +145 −128
  405. sound/soc/sh/rcar/gen.c +52 −81
  406. sound/soc/sh/rcar/mix.c +78 −80
  407. sound/soc/sh/rcar/rcar_snd.h +0 −117
  408. sound/soc/sh/rcar/rsnd.h +167 −168
  409. sound/soc/sh/rcar/rsrc-card.c +89 −40
  410. sound/soc/sh/rcar/src.c +223 −675
  411. sound/soc/sh/rcar/ssi.c +442 −313
  412. sound/soc/sh/rcar/ssiu.c +225 −0
  413. sound/soc/soc-ac97.c +125 −0
  414. sound/soc/soc-compress.c +27 −4
  415. sound/soc/soc-core.c +559 −307
  416. sound/soc/soc-dapm.c +8 −6
  417. sound/soc/soc-ops.c +2 −2
  418. sound/soc/soc-pcm.c +89 −21
  419. sound/soc/sti/uniperif_player.c +1 −2
  420. sound/soc/sunxi/sun4i-codec.c +230 −49
  421. sound/soc/tegra/tegra_alc5632.c +8 −4
  422. sound/soc/tegra/tegra_wm8903.c +2 −1
  423. sound/synth/emux/emux_nrpn.c +5 −4
  424. sound/usb/card.c +2 −0
  425. sound/usb/midi.c +14 −13
  426. sound/usb/misc/ua101.c +2 −2
  427. sound/usb/mixer_quirks.c +1 −1
  428. sound/usb/quirks.c +1 −0
  429. sound/usb/stream.c +2 −4
  430. sound/usb/usx2y/usbusx2yaudio.c +1 −1
Documentation/DocBook/gpu.tmpl+20−40
@@ -615,18 +615,6 @@ char *date;</synopsis> · 614 unmodified lines
615615 <function>drm_gem_object_init</function>. Storage for private GEM
616616 objects must be managed by drivers.
617617 </para>
618− <para>
619− Drivers that do not need to extend GEM objects with private information
620− can call the <function>drm_gem_object_alloc</function> function to
621− allocate and initialize a struct <structname>drm_gem_object</structname>
622− instance. The GEM core will call the optional driver
623− <methodname>gem_init_object</methodname> operation after initializing
624− the GEM object with <function>drm_gem_object_init</function>.
625− <synopsis>int (*gem_init_object) (struct drm_gem_object *obj);</synopsis>
626− </para>
627− <para>
628− No alloc-and-init function exists for private GEM objects.
629− </para>
630618 </sect3>
631619 <sect3>
632620 <title>GEM Objects Lifetime</title>
@@ -635,10 +623,10 @@ char *date;</synopsis> · 2 unmodified lines
635623 acquired and release by <function>calling drm_gem_object_reference</function>
636624 and <function>drm_gem_object_unreference</function> respectively. The
637625 caller must hold the <structname>drm_device</structname>
638− <structfield>struct_mutex</structfield> lock. As a convenience, GEM
639− provides the <function>drm_gem_object_reference_unlocked</function> and
640− <function>drm_gem_object_unreference_unlocked</function> functions that
641− can be called without holding the lock.
626+ <structfield>struct_mutex</structfield> lock when calling
627+ <function>drm_gem_object_reference</function>. As a convenience, GEM
628+ provides <function>drm_gem_object_unreference_unlocked</function>
629+ functions that can be called without holding the lock.
642630 </para>
643631 <para>
644632 When the last reference to a GEM object is released the GEM core calls
@@ -649,15 +637,9 @@ char *date;</synopsis> · 4 unmodified lines
649637 </para>
650638 <para>
651639 <synopsis>void (*gem_free_object) (struct drm_gem_object *obj);</synopsis>
652− Drivers are responsible for freeing all GEM object resources, including
653− the resources created by the GEM core. If an mmap offset has been
654− created for the object (in which case
655− <structname>drm_gem_object</structname>::<structfield>map_list</structfield>::<structfield>map</structfield>
656− is not NULL) it must be freed by a call to
657− <function>drm_gem_free_mmap_offset</function>. The shmfs backing store
658− must be released by calling <function>drm_gem_object_release</function>
659− (that function can safely be called if no shmfs backing store has been
660− created).
640+ Drivers are responsible for freeing all GEM object resources. This includes
641+ the resources created by the GEM core, which need to be released with
642+ <function>drm_gem_object_release</function>.
661643 </para>
662644 </sect3>
663645 <sect3>
@@ -740,17 +722,10 @@ char *date;</synopsis> · 76 unmodified lines
740722 DRM identifies the GEM object to be mapped by a fake offset passed
741723 through the mmap offset argument. Prior to being mapped, a GEM object
742724 must thus be associated with a fake offset. To do so, drivers must call
743− <function>drm_gem_create_mmap_offset</function> on the object. The
744− function allocates a fake offset range from a pool and stores the
745− offset divided by PAGE_SIZE in
746− <literal>obj-&gt;map_list.hash.key</literal>. Care must be taken not to
747− call <function>drm_gem_create_mmap_offset</function> if a fake offset
748− has already been allocated for the object. This can be tested by
749− <literal>obj-&gt;map_list.map</literal> being non-NULL.
725+ <function>drm_gem_create_mmap_offset</function> on the object.
750726 </para>
751727 <para>
752728 Once allocated, the fake offset value
753− (<literal>obj-&gt;map_list.hash.key &lt;&lt; PAGE_SHIFT</literal>)
754729 must be passed to the application in a driver-specific way and can then
755730 be used as the mmap offset argument.
756731 </para>
@@ -836,10 +811,11 @@ char *date;</synopsis> · 79 unmodified lines
836811 abstracted from the client in libdrm.
837812 </para>
838813 </sect3>
839− <sect3>
840− <title>GEM Function Reference</title>
814+ </sect2>
815+ <sect2>
816+ <title>GEM Function Reference</title>
841817 !Edrivers/gpu/drm/drm_gem.c
842− </sect3>
818+!Iinclude/drm/drm_gem.h
843819 </sect2>
844820 <sect2>
845821 <title>VMA Offset Manager</title>
@@ -4201,17 +4177,21 @@ int num_ioctls;</synopsis> · 3355 unmodified lines
42014177 </sect2>
42024178 </sect1>
42034179 <sect1>
4204− <title>GuC-based Command Submission</title>
4180+ <title>GuC</title>
42054181 <sect2>
4206− <title>GuC</title>
4182+ <title>GuC-specific firmware loader</title>
42074183 !Pdrivers/gpu/drm/i915/intel_guc_loader.c GuC-specific firmware loader
42084184 !Idrivers/gpu/drm/i915/intel_guc_loader.c
42094185 </sect2>
42104186 <sect2>
4211− <title>GuC Client</title>
4212−!Pdrivers/gpu/drm/i915/i915_guc_submission.c GuC-based command submissison
4187+ <title>GuC-based command submission</title>
4188+!Pdrivers/gpu/drm/i915/i915_guc_submission.c GuC-based command submission
42134189 !Idrivers/gpu/drm/i915/i915_guc_submission.c
42144190 </sect2>
4191+ <sect2>
4192+ <title>GuC Firmware Layout</title>
4193+!Pdrivers/gpu/drm/i915/intel_guc_fwif.h GuC Firmware Layout
4194+ </sect2>
42154195 </sect1>
42164196
42174197 <sect1>
Documentation/devicetree/bindings/sound/ak4613.txt+10−0
@@ -7,6 +7,16 @@ Required properties: · 6 unmodified lines
77 - compatible : "asahi-kasei,ak4613"
88 - reg : The chip select number on the I2C bus
99
10+Optional properties:
11+- asahi-kasei,in1-single-end : Boolean. Indicate input / output pins are single-ended.
12+- asahi-kasei,in2-single-end rather than differential.
13+- asahi-kasei,out1-single-end
14+- asahi-kasei,out2-single-end
15+- asahi-kasei,out3-single-end
16+- asahi-kasei,out4-single-end
17+- asahi-kasei,out5-single-end
18+- asahi-kasei,out6-single-end
19+
1020 Example:
1121
1222 &i2c {
Documentation/devicetree/bindings/sound/atmel-pdmic.txt+55−0
@@ -0,0 +1,55 @@
1+* Atmel PDMIC driver under ALSA SoC architecture
2+
3+Required properties:
4+- compatible
5+ Should be "atmel,sama5d2-pdmic".
6+- reg
7+ Should contain PDMIC registers location and length.
8+- interrupts
9+ Should contain the IRQ line for the PDMIC.
10+- dmas
11+ One DMA specifiers as described in atmel-dma.txt and dma.txt files.
12+- dma-names
13+ Must be "rx".
14+- clock-names
15+ Required elements:
16+ - "pclk" peripheral clock
17+ - "gclk" generated clock
18+- clocks
19+ Must contain an entry for each required entry in clock-names.
20+ Please refer to clock-bindings.txt.
21+- atmel,mic-min-freq
22+ The minimal frequency that the micphone supports.
23+- atmel,mic-max-freq
24+ The maximal frequency that the micphone supports.
25+
26+Optional properties:
27+- pinctrl-names, pinctrl-0
28+ Please refer to pinctrl-bindings.txt.
29+- atmel,model
30+ The user-visible name of this sound card.
31+ The default value is "PDMIC".
32+- atmel,mic-offset
33+ The offset that should be added.
34+ The range is from -32768 to 32767.
35+ The default value is 0.
36+
37+Example:
38+ pdmic@f8018000 {
39+ compatible = "atmel,sama5d2-pdmic";
40+ reg = <0xf8018000 0x124>;
41+ interrupts = <48 IRQ_TYPE_LEVEL_HIGH 7>;
42+ dmas = <&dma0
43+ (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)
44+ | AT91_XDMAC_DT_PERID(50))>;
45+ dma-names = "rx";
46+ clocks = <&pdmic_clk>, <&pdmic_gclk>;
47+ clock-names = "pclk", "gclk";
48+
49+ pinctrl-names = "default";
50+ pinctrl-0 = <&pinctrl_pdmic_default>;
51+ atmel,model = "PDMIC @ sama5d2_xplained";
52+ atmel,mic-min-freq = <1000000>;
53+ atmel,mic-max-freq = <3246000>;
54+ atmel,mic-offset = <0x0>;
55+ };
Documentation/devicetree/bindings/sound/da7218.txt+104−0
@@ -0,0 +1,104 @@
1+Dialog Semiconductor DA7218 Audio Codec bindings
2+
3+DA7218 is an audio codec with HP detect feature.
4+
5+======
6+
7+Required properties:
8+- compatible : Should be "dlg,da7217" or "dlg,da7218"
9+- reg: Specifies the I2C slave address
10+
11+- VDD-supply: VDD power supply for the device
12+- VDDMIC-supply: VDDMIC power supply for the device
13+- VDDIO-supply: VDDIO power supply for the device
14+ (See Documentation/devicetree/bindings/regulator/regulator.txt for further
15+ information relating to regulators)
16+
17+Optional properties:
18+- interrupt-parent: Specifies the phandle of the interrupt controller to which
19+ the IRQs from DA7218 are delivered to.
20+- interrupts: IRQ line info for DA7218 chip.
21+ (See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for
22+ further information relating to interrupt properties)
23+- interrupt-names : Name associated with interrupt line. Should be "wakeup" if
24+ interrupt is to be used to wake system, otherwise "irq" should be used.
25+- wakeup-source: Flag to indicate this device can wake system (suspend/resume).
26+
27+- clocks : phandle and clock specifier for codec MCLK.
28+- clock-names : Clock name string for 'clocks' attribute, should be "mclk".
29+
30+- dlg,micbias1-lvl-millivolt : Voltage (mV) for Mic Bias 1
31+ [<1200>, <1600>, <1800>, <2000>, <2200>, <2400>, <2600>, <2800>, <3000>]
32+- dlg,micbias2-lvl-millivolt : Voltage (mV) for Mic Bias 2
33+ [<1200>, <1600>, <1800>, <2000>, <2200>, <2400>, <2600>, <2800>, <3000>]
34+- dlg,mic1-amp-in-sel : Mic1 input source type
35+ ["diff", "se_p", "se_n"]
36+- dlg,mic2-amp-in-sel : Mic2 input source type
37+ ["diff", "se_p", "se_n"]
38+- dlg,dmic1-data-sel : DMIC1 channel select based on clock edge.
39+ ["lrise_rfall", "lfall_rrise"]
40+- dlg,dmic1-samplephase : When to sample audio from DMIC1.
41+ ["on_clkedge", "between_clkedge"]
42+- dlg,dmic1-clkrate-hz : DMic1 clock frequency (Hz).
43+ [<1500000>, <3000000>]
44+- dlg,dmic2-data-sel : DMic2 channel select based on clock edge.
45+ ["lrise_rfall", "lfall_rrise"]
46+- dlg,dmic2-samplephase : When to sample audio from DMic2.
47+ ["on_clkedge", "between_clkedge"]
48+- dlg,dmic2-clkrate-hz : DMic2 clock frequency (Hz).
49+ [<1500000>, <3000000>]
50+- dlg,hp-diff-single-supply : Boolean flag, use single supply for HP
51+ (DA7217 only)
52+
53+======
54+
55+Optional Child node - 'da7218_hpldet' (DA7218 only):
56+
57+Optional properties:
58+- dlg,jack-rate-us : Time between jack detect measurements (us)
59+ [<5>, <10>, <20>, <40>, <80>, <160>, <320>, <640>]
60+- dlg,jack-debounce : Number of debounce measurements taken for jack detect
61+ [<0>, <2>, <3>, <4>]
62+- dlg,jack-threshold-pct : Threshold level for jack detection (% of VDD)
63+ [<84>, <88>, <92>, <96>]
64+- dlg,comp-inv : Boolean flag, invert comparator output
65+- dlg,hyst : Boolean flag, enable hysteresis
66+- dlg,discharge : Boolean flag, auto discharge of Mic Bias on jack removal
67+
68+======
69+
70+Example:
71+
72+ codec: da7218@1a {
73+ compatible = "dlg,da7218";
74+ reg = <0x1a>;
75+ interrupt-parent = <&gpio6>;
76+ interrupts = <11 IRQ_TYPE_LEVEL_HIGH>;
77+ wakeup-source;
78+
79+ VDD-supply = <&reg_audio>;
80+ VDDMIC-supply = <&reg_audio>;
81+ VDDIO-supply = <&reg_audio>;
82+
83+ clocks = <&clks 201>;
84+ clock-names = "mclk";
85+
86+ dlg,micbias1-lvl-millivolt = <2600>;
87+ dlg,micbias2-lvl-millivolt = <2600>;
88+ dlg,mic1-amp-in-sel = "diff";
89+ dlg,mic2-amp-in-sel = "diff";
90+
91+ dlg,dmic1-data-sel = "lrise_rfall";
92+ dlg,dmic1-samplephase = "on_clkedge";
93+ dlg,dmic1-clkrate-hz = <3000000>;
94+ dlg,dmic2-data-sel = "lrise_rfall";
95+ dlg,dmic2-samplephase = "on_clkedge";
96+ dlg,dmic2-clkrate-hz = <3000000>;
97+
98+ da7218_hpldet {
99+ dlg,jack-rate-us = <40>;
100+ dlg,jack-debounce = <2>;
101+ dlg,jack-threshold-pct = <84>;
102+ dlg,hyst;
103+ };
104+ };
Documentation/devicetree/bindings/sound/da7219.txt+5−3
@@ -28,13 +28,15 @@ Optional properties: · 27 unmodified lines
2828 - clocks : phandle and clock specifier for codec MCLK.
2929 - clock-names : Clock name string for 'clocks' attribute, should be "mclk".
3030
31−- dlg,ldo-lvl : Required internal LDO voltage (mV) level for digital engine
32− [<1050>, <1100>, <1200>, <1400>]
3331 - dlg,micbias-lvl : Voltage (mV) for Mic Bias
34− [<1800>, <2000>, <2200>, <2400>, <2600>]
32+ [<1600>, <1800>, <2000>, <2200>, <2400>, <2600>]
3533 - dlg,mic-amp-in-sel : Mic input source type
3634 ["diff", "se_p", "se_n"]
3735
36+Deprecated properties:
37+- dlg,ldo-lvl : Required internal LDO voltage (mV) level for digital engine
38+ (LDO unavailable in production HW so property no longer required).
39+
3840 ======
3941
4042 Child node - 'da7219_aad':
Documentation/devicetree/bindings/sound/fsl,asrc.txt+5−0
@@ -25,6 +25,11 @@ Required properties: · 24 unmodified lines
2525 "mem" Peripheral access clock to access registers.
2626 "ipg" Peripheral clock to driver module.
2727 "asrck_<0-f>" Clock sources for input and output clock.
28+ "spba" The spba clock is required when ASRC is placed as a
29+ bus slave of the Shared Peripheral Bus and when two
30+ or more bus masters (CPU, DMA or DSP) try to access
31+ it. This property is optional depending on the SoC
32+ design.
2833
2934 - big-endian : If this property is absent, the little endian mode
3035 will be in use as default. Otherwise, the big endian
Documentation/devicetree/bindings/sound/fsl,esai.txt+5−0
@@ -27,6 +27,11 @@ Required properties: · 26 unmodified lines
2727 derive HCK, SCK and FS.
2828 "fsys" The system clock derived from ahb clock used to
2929 derive HCK, SCK and FS.
30+ "spba" The spba clock is required when ESAI is placed as a
31+ bus slave of the Shared Peripheral Bus and when two
32+ or more bus masters (CPU, DMA or DSP) try to access
33+ it. This property is optional depending on the SoC
34+ design.
3035
3136 - fsl,fifo-depth : The number of elements in the transmit and receive
3237 FIFOs. This number is the maximum allowed value for
Documentation/devicetree/bindings/sound/fsl,spdif.txt+5−0
@@ -27,6 +27,11 @@ Required properties: · 26 unmodified lines
2727 Transceiver Clock Diagram" of SoC reference manual.
2828 It can also be referred to TxClk_Source bit of
2929 register SPDIF_STC.
30+ "spba" The spba clock is required when SPDIF is placed as a
31+ bus slave of the Shared Peripheral Bus and when two
32+ or more bus masters (CPU, DMA or DSP) try to access
33+ it. This property is optional depending on the SoC
34+ design.
3035
3136 - big-endian : If this property is absent, the native endian mode
3237 will be in use as default, or the big endian mode
Documentation/devicetree/bindings/sound/img,i2s-in.txt+47−0
@@ -0,0 +1,47 @@
1+Imagination Technologies I2S Input Controller
2+
3+Required Properties:
4+
5+ - compatible : Compatible list, must contain "img,i2s-in"
6+
7+ - #sound-dai-cells : Must be equal to 0
8+
9+ - reg : Offset and length of the register set for the device
10+
11+ - clocks : Contains an entry for each entry in clock-names
12+
13+ - clock-names : Must include the following entry:
14+ "sys" The system clock
15+
16+ - dmas: Contains an entry for each entry in dma-names.
17+
18+ - dma-names: Must include the following entry:
19+ "rx" Single DMA channel used by all active I2S channels
20+
21+ - img,i2s-channels : Number of I2S channels instantiated in the I2S in block
22+
23+Optional Properties:
24+
25+ - interrupts : Contains the I2S in interrupts. Depending on
26+ the configuration, there may be no interrupts, one interrupt,
27+ or an interrupt per I2S channel. For the case where there is
28+ one interrupt per channel, the interrupts should be listed
29+ in ascending channel order
30+
31+ - resets: Contains a phandle to the I2S in reset signal
32+
33+ - reset-names: Contains the reset signal name "rst"
34+
35+Example:
36+
37+i2s_in: i2s-in@18100800 {
38+ compatible = "img,i2s-in";
39+ reg = <0x18100800 0x200>;
40+ interrupts = <GIC_SHARED 7 IRQ_TYPE_LEVEL_HIGH>;
41+ dmas = <&mdc 30 0xffffffff 0>;
42+ dma-names = "rx";
43+ clocks = <&cr_periph SYS_CLK_I2S_IN>;
44+ clock-names = "sys";
45+ img,i2s-channels = <6>;
46+ #sound-dai-cells = <0>;
47+};
Documentation/devicetree/bindings/sound/img,i2s-out.txt+51−0
@@ -0,0 +1,51 @@
1+Imagination Technologies I2S Output Controller
2+
3+Required Properties:
4+
5+ - compatible : Compatible list, must contain "img,i2s-out"
6+
7+ - #sound-dai-cells : Must be equal to 0
8+
9+ - reg : Offset and length of the register set for the device
10+
11+ - clocks : Contains an entry for each entry in clock-names
12+
13+ - clock-names : Must include the following entries:
14+ "sys" The system clock
15+ "ref" The reference clock
16+
17+ - dmas: Contains an entry for each entry in dma-names.
18+
19+ - dma-names: Must include the following entry:
20+ "tx" Single DMA channel used by all active I2S channels
21+
22+ - img,i2s-channels : Number of I2S channels instantiated in the I2S out block
23+
24+ - resets: Contains a phandle to the I2S out reset signal
25+
26+ - reset-names: Contains the reset signal name "rst"
27+
28+Optional Properties:
29+
30+ - interrupts : Contains the I2S out interrupts. Depending on
31+ the configuration, there may be no interrupts, one interrupt,
32+ or an interrupt per I2S channel. For the case where there is
33+ one interrupt per channel, the interrupts should be listed
34+ in ascending channel order
35+
36+Example:
37+
38+i2s_out: i2s-out@18100A00 {
39+ compatible = "img,i2s-out";
40+ reg = <0x18100A00 0x200>;
41+ interrupts = <GIC_SHARED 13 IRQ_TYPE_LEVEL_HIGH>;
42+ dmas = <&mdc 23 0xffffffff 0>;
43+ dma-names = "tx";
44+ clocks = <&cr_periph SYS_CLK_I2S_OUT>,
45+ <&clk_core CLK_I2S>;
46+ clock-names = "sys", "ref";
47+ img,i2s-channels = <6>;
48+ resets = <&pistachio_reset PISTACHIO_RESET_I2S_OUT>;
49+ reset-names = "rst";
50+ #sound-dai-cells = <0>;
51+};
Documentation/devicetree/bindings/sound/img,parallel-out.txt+44−0
@@ -0,0 +1,44 @@
1+Imagination Technologies Parallel Output Controller
2+
3+Required Properties:
4+
5+ - compatible : Compatible list, must contain "img,parallel-out".
6+
7+ - #sound-dai-cells : Must be equal to 0
8+
9+ - reg : Offset and length of the register set for the device.
10+
11+ - dmas: Contains an entry for each entry in dma-names.
12+
13+ - dma-names: Must include the following entry:
14+ "tx"
15+
16+ - clocks : Contains an entry for each entry in clock-names.
17+
18+ - clock-names : Includes the following entries:
19+ "sys" The system clock
20+ "ref" The reference clock
21+
22+ - resets: Contains a phandle to the parallel out reset signal
23+
24+ - reset-names: Contains the reset signal name "rst"
25+
26+Optional Properties:
27+
28+ - interrupts : Contains the parallel out interrupt, if present
29+
30+Example:
31+
32+parallel_out: parallel-out@18100C00 {
33+ compatible = "img,parallel-out";
34+ reg = <0x18100C00 0x100>;
35+ interrupts = <GIC_SHARED 19 IRQ_TYPE_LEVEL_HIGH>;
36+ dmas = <&mdc 16 0xffffffff 0>;
37+ dma-names = "tx";
38+ clocks = <&cr_periph SYS_CLK_PAUD_OUT>,
39+ <&clk_core CLK_AUDIO_DAC>;
40+ clock-names = "sys", "ref";
41+ resets = <&pistachio_reset PISTACHIO_RESET_PRL_OUT>;
42+ reset-names = "rst";
43+ #sound-dai-cells = <0>;
44+};
Documentation/devicetree/bindings/sound/img,pistachio-internal-dac.txt+18−0
@@ -0,0 +1,18 @@
1+Pistachio internal DAC DT bindings
2+
3+Required properties:
4+
5+ - compatible: "img,pistachio-internal-dac"
6+
7+ - img,cr-top : Must contain a phandle to the top level control syscon
8+ node which contains the internal dac control registers
9+
10+ - VDD-supply : Digital power supply regulator (+1.8V or +3.3V)
11+
12+Examples:
13+
14+internal_dac: internal-dac {
15+ compatible = "img,pistachio-internal-dac";
16+ img,cr-top = <&cr_top>;
17+ VDD-supply = <&supply3v3>;
18+};
Documentation/devicetree/bindings/sound/img,spdif-in.txt+41−0
@@ -0,0 +1,41 @@
1+Imagination Technologies SPDIF Input Controller
2+
3+Required Properties:
4+
5+ - compatible : Compatible list, must contain "img,spdif-in"
6+
7+ - #sound-dai-cells : Must be equal to 0
8+
9+ - reg : Offset and length of the register set for the device
10+
11+ - dmas: Contains an entry for each entry in dma-names.
12+
13+ - dma-names: Must include the following entry:
14+ "rx"
15+
16+ - clocks : Contains an entry for each entry in clock-names
17+
18+ - clock-names : Includes the following entries:
19+ "sys" The system clock
20+
21+Optional Properties:
22+
23+ - resets: Should contain a phandle to the spdif in reset signal, if any
24+
25+ - reset-names: Should contain the reset signal name "rst", if a
26+ reset phandle is given
27+
28+ - interrupts : Contains the spdif in interrupt, if present
29+
30+Example:
31+
32+spdif_in: spdif-in@18100E00 {
33+ compatible = "img,spdif-in";
34+ reg = <0x18100E00 0x100>;
35+ interrupts = <GIC_SHARED 20 IRQ_TYPE_LEVEL_HIGH>;
36+ dmas = <&mdc 15 0xffffffff 0>;
37+ dma-names = "rx";
38+ clocks = <&cr_periph SYS_CLK_SPDIF_IN>;
39+ clock-names = "sys";
40+ #sound-dai-cells = <0>;
41+};
Documentation/devicetree/bindings/sound/img,spdif-out.txt+44−0
@@ -0,0 +1,44 @@
1+Imagination Technologies SPDIF Output Controller
2+
3+Required Properties:
4+
5+ - compatible : Compatible list, must contain "img,spdif-out"
6+
7+ - #sound-dai-cells : Must be equal to 0
8+
9+ - reg : Offset and length of the register set for the device
10+
11+ - dmas: Contains an entry for each entry in dma-names.
12+
13+ - dma-names: Must include the following entry:
14+ "tx"
15+
16+ - clocks : Contains an entry for each entry in clock-names.
17+
18+ - clock-names : Includes the following entries:
19+ "sys" The system clock
20+ "ref" The reference clock
21+
22+ - resets: Contains a phandle to the spdif out reset signal
23+
24+ - reset-names: Contains the reset signal name "rst"
25+
26+Optional Properties:
27+
28+ - interrupts : Contains the parallel out interrupt, if present
29+
30+Example:
31+
32+spdif_out: spdif-out@18100D00 {
33+ compatible = "img,spdif-out";
34+ reg = <0x18100D00 0x100>;
35+ interrupts = <GIC_SHARED 21 IRQ_TYPE_LEVEL_HIGH>;
36+ dmas = <&mdc 14 0xffffffff 0>;
37+ dma-names = "tx";
38+ clocks = <&cr_periph SYS_CLK_SPDIF_OUT>,
39+ <&clk_core CLK_SPDIF>;
40+ clock-names = "sys", "ref";
41+ resets = <&pistachio_reset PISTACHIO_RESET_SPDIF_OUT>;
42+ reset-names = "rst";
43+ #sound-dai-cells = <0>;
44+};
Documentation/devicetree/bindings/sound/inno-rk3036.txt+20−0
@@ -0,0 +1,20 @@
1+Inno audio codec for RK3036
2+
3+Inno audio codec is integrated inside RK3036 SoC.
4+
5+Required properties:
6+- compatible : Should be "rockchip,rk3036-codec".
7+- reg : The registers of codec.
8+- clock-names : Should be "acodec_pclk".
9+- clocks : The clock of codec.
10+- rockchip,grf : The phandle of grf device node.
11+
12+Example:
13+
14+ acodec: acodec-ana@20030000 {
15+ compatible = "rk3036-codec";
16+ reg = <0x20030000 0x4000>;
17+ rockchip,grf = <&grf>;
18+ clock-names = "acodec_pclk";
19+ clocks = <&cru ACLK_VCODEC>;
20+ };
Documentation/devicetree/bindings/sound/pcm179x.txtrenamed from Documentation/devicetree/bindings/sound/pcm1792a.txt+1−1
@@ -1,4 +1,4 @@
1−Texas Instruments pcm1792a DT bindings
1+Texas Instruments pcm179x DT bindings
22
33 This driver supports the SPI bus.
44
Documentation/devicetree/bindings/sound/renesas,rsnd.txt+82−0
@@ -7,8 +7,11 @@ Required properties: · 6 unmodified lines
77 "renesas,rcar_sound-gen3" if generation3
88 Examples with soctypes are:
99 - "renesas,rcar_sound-r8a7778" (R-Car M1A)
10+ - "renesas,rcar_sound-r8a7779" (R-Car H1)
1011 - "renesas,rcar_sound-r8a7790" (R-Car H2)
1112 - "renesas,rcar_sound-r8a7791" (R-Car M2-W)
13+ - "renesas,rcar_sound-r8a7793" (R-Car M2-N)
14+ - "renesas,rcar_sound-r8a7794" (R-Car E2)
1215 - "renesas,rcar_sound-r8a7795" (R-Car H3)
1316 - reg : Should contain the register physical address.
1417 required register is
@@ -34,6 +37,8 @@ Required properties: · 19 unmodified lines
3437 see below for detail.
3538 - #sound-dai-cells : it must be 0 if your system is using single DAI
3639 it must be 1 if your system is using multi DAI
40+
41+Optional properties:
3742 - #clock-cells : it must be 0 if your system has audio_clkout
3843 it must be 1 if your system has audio_clkout0/1/2/3
3944 - clock-frequency : for all audio_clkout0/1/2/3
@@ -244,3 +249,80 @@ rcar_sound: sound@ec500000 { · 204 unmodified lines
244249 };
245250 };
246251 };
252+
253+Example: simple sound card
254+
255+ rsnd_ak4643: sound {
256+ compatible = "simple-audio-card";
257+
258+ simple-audio-card,format = "left_j";
259+ simple-audio-card,bitclock-master = <&sndcodec>;
260+ simple-audio-card,frame-master = <&sndcodec>;
261+
262+ sndcpu: simple-audio-card,cpu {
263+ sound-dai = <&rcar_sound>;
264+ };
265+
266+ sndcodec: simple-audio-card,codec {
267+ sound-dai = <&ak4643>;
268+ clocks = <&audio_clock>;
269+ };
270+ };
271+
272+&rcar_sound {
273+ pinctrl-0 = <&sound_pins &sound_clk_pins>;
274+ pinctrl-names = "default";
275+
276+ /* Single DAI */
277+ #sound-dai-cells = <0>;
278+
279+ status = "okay";
280+
281+ rcar_sound,dai {
282+ dai0 {
283+ playback = <&ssi0 &src2 &dvc0>;
284+ capture = <&ssi1 &src3 &dvc1>;
285+ };
286+ };
287+};
288+
289+&ssi1 {
290+ shared-pin;
291+};
292+
293+Example: simple sound card for TDM
294+
295+ rsnd_tdm: sound {
296+ compatible = "simple-audio-card";
297+
298+ simple-audio-card,format = "left_j";
299+ simple-audio-card,bitclock-master = <&sndcodec>;
300+ simple-audio-card,frame-master = <&sndcodec>;
301+
302+ sndcpu: simple-audio-card,cpu {
303+ sound-dai = <&rcar_sound>;
304+ dai-tdm-slot-num = <6>;
305+ };
306+
307+ sndcodec: simple-audio-card,codec {
308+ sound-dai = <&xxx>;
309+ };
310+ };
311+
312+Example: simple sound card for Multi channel
313+
314+&rcar_sound {
315+ pinctrl-0 = <&sound_pins &sound_clk_pins>;
316+ pinctrl-names = "default";
317+
318+ /* Single DAI */
319+ #sound-dai-cells = <0>;
320+
321+ status = "okay";
322+
323+ rcar_sound,dai {
324+ dai0 {
325+ playback = <&ssi0 &ssi1 &ssi2 &src0 &dvc0>;
326+ };
327+ };
328+};
Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt+2−2
@@ -4,8 +4,8 @@ Renesas Sampling Rate Convert Sound Card specifies audio DAI connections of SoC · 3 unmodified lines
44
55 Required properties:
66
7−- compatible : "renesas,rsrc-card,<board>"
8− Examples with soctypes are:
7+- compatible : "renesas,rsrc-card{,<board>}"
8+ Examples with boards are:
99 - "renesas,rsrc-card"
1010 - "renesas,rsrc-card,lager"
1111 - "renesas,rsrc-card,koelsch"
Documentation/devicetree/bindings/sound/rockchip-i2s.txt+2−0
@@ -19,6 +19,7 @@ Required properties: · 18 unmodified lines
1919 - clock-names: should contain followings:
2020 - "i2s_hclk": clock for I2S BUS
2121 - "i2s_clk" : clock for I2S controller
22+- rockchip,playback-channels: max playback channels, if not set, 8 channels default.
2223 - rockchip,capture-channels: max capture channels, if not set, 2 channels default.
2324
2425 Example for rk3288 I2S controller:
@@ -31,5 +32,6 @@ i2s@ff890000 { · 6 unmodified lines
3132 dma-names = "tx", "rx";
3233 clock-names = "i2s_hclk", "i2s_clk";
3334 clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>;
35+ rockchip,playback-channels = <8>;
3436 rockchip,capture-channels = <2>;
3537 };
Documentation/devicetree/bindings/sound/rt5616.txt+26−0
@@ -0,0 +1,26 @@
1+RT5616 audio CODEC
2+
3+This device supports I2C only.
4+
5+Required properties:
6+
7+- compatible : "realtek,rt5616".
8+
9+- reg : The I2C address of the device.
10+
11+Pins on the device (for linking into audio routes) for RT5616:
12+
13+ * IN1P
14+ * IN2P
15+ * IN2N
16+ * LOUTL
17+ * LOUTR
18+ * HPOL
19+ * HPOR
20+
21+Example:
22+
23+codec: rt5616@1b {
24+ compatible = "realtek,rt5616";
25+ reg = <0x1b>;
26+};
Documentation/devicetree/bindings/sound/rt5651.txt+41−0
@@ -0,0 +1,41 @@
1+RT5651 audio CODEC
2+
3+This device supports I2C only.
4+
5+Required properties:
6+
7+- compatible : "realtek,rt5651".
8+
9+- reg : The I2C address of the device.
10+
11+Optional properties:
12+
13+- realtek,in2-differential
14+ Boolean. Indicate MIC2 input are differential, rather than single-ended.
15+
16+- realtek,dmic-en
17+ Boolean. true if dmic is used.
18+
19+Pins on the device (for linking into audio routes) for RT5651:
20+
21+ * DMIC L1
22+ * DMIC R1
23+ * IN1P
24+ * IN2P
25+ * IN2N
26+ * IN3P
27+ * HPOL
28+ * HPOR
29+ * LOUTL
30+ * LOUTR
31+ * PDML
32+ * PDMR
33+
34+Example:
35+
36+codec: rt5651@1a {
37+ compatible = "realtek,rt5651";
38+ reg = <0x1a>;
39+ realtek,dmic-en = "true";
40+ realtek,in2-diff = "false";
41+};
Documentation/devicetree/bindings/sound/rt5659.txt+75−0
@@ -0,0 +1,75 @@
1+RT5659/RT5658 audio CODEC
2+
3+This device supports I2C only.
4+
5+Required properties:
6+
7+- compatible : One of "realtek,rt5659" or "realtek,rt5658".
8+
9+- reg : The I2C address of the device.
10+
11+- interrupts : The CODEC's interrupt output.
12+
13+Optional properties:
14+
15+- realtek,in1-differential
16+- realtek,in3-differential
17+- realtek,in4-differential
18+ Boolean. Indicate MIC1/3/4 input are differential, rather than single-ended.
19+
20+- realtek,dmic1-data-pin
21+ 0: dmic1 is not used
22+ 1: using IN2N pin as dmic1 data pin
23+ 2: using GPIO5 pin as dmic1 data pin
24+ 3: using GPIO9 pin as dmic1 data pin
25+ 4: using GPIO11 pin as dmic1 data pin
26+
27+- realtek,dmic2-data-pin
28+ 0: dmic2 is not used
29+ 1: using IN2P pin as dmic2 data pin
30+ 2: using GPIO6 pin as dmic2 data pin
31+ 3: using GPIO10 pin as dmic2 data pin
32+ 4: using GPIO12 pin as dmic2 data pin
33+
34+- realtek,jd-src
35+ 0: No JD is used
36+ 1: using JD3 as JD source
37+
38+- realtek,ldo1-en-gpios : The GPIO that controls the CODEC's LDO1_EN pin.
39+- realtek,reset-gpios : The GPIO that controls the CODEC's RESET pin.
40+
41+Pins on the device (for linking into audio routes) for RT5659/RT5658:
42+
43+ * DMIC L1
44+ * DMIC R1
45+ * DMIC L2
46+ * DMIC R2
47+ * IN1P
48+ * IN1N
49+ * IN2P
50+ * IN2N
51+ * IN3P
52+ * IN3N
53+ * IN4P
54+ * IN4N
55+ * HPOL
56+ * HPOR
57+ * SPOL
58+ * SPOR
59+ * LOUTL
60+ * LOUTR
61+ * MONOOUT
62+ * PDML
63+ * PDMR
64+ * SPDIF
65+
66+Example:
67+
68+rt5659 {
69+ compatible = "realtek,rt5659";
70+ reg = <0x1b>;
71+ interrupt-parent = <&gpio>;
72+ interrupts = <TEGRA_GPIO(W, 3) GPIO_ACTIVE_HIGH>;
73+ realtek,ldo1-en-gpios =
74+ <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>;
75+};
Documentation/devicetree/bindings/sound/rt5677.txt+1−1
@@ -18,7 +18,7 @@ Required properties: · 17 unmodified lines
1818 Optional properties:
1919
2020 - realtek,pow-ldo2-gpio : The GPIO that controls the CODEC's POW_LDO2 pin.
21−- realtek,reset-gpio : The GPIO that controls the CODEC's RESET pin.
21+- realtek,reset-gpio : The GPIO that controls the CODEC's RESET pin. Active low.
2222
2323 - realtek,in1-differential
2424 - realtek,in2-differential
Documentation/devicetree/bindings/sound/sun4i-codec.txt+3−0
@@ -14,6 +14,9 @@ Required properties: · 13 unmodified lines
1414 - "apb": the parent APB clock for this controller
1515 - "codec": the parent module clock
1616
17+Optional properties:
18+- allwinner,pa-gpios: gpio to enable external amplifier
19+
1720 Example:
1821 codec: codec@01c22c00 {
1922 #sound-dai-cells = <0>;
Documentation/devicetree/bindings/sound/ti,pcm3168a.txt+48−0
@@ -0,0 +1,48 @@
1+Texas Instruments pcm3168a DT bindings
2+
3+This driver supports both SPI and I2C bus access for this codec
4+
5+Required properties:
6+
7+ - compatible: "ti,pcm3168a"
8+
9+ - clocks : Contains an entry for each entry in clock-names
10+
11+ - clock-names : Includes the following entries:
12+ "scki" The system clock
13+
14+ - VDD1-supply : Digital power supply regulator 1 (+3.3V)
15+
16+ - VDD2-supply : Digital power supply regulator 2 (+3.3V)
17+
18+ - VCCAD1-supply : ADC power supply regulator 1 (+5V)
19+
20+ - VCCAD2-supply : ADC power supply regulator 2 (+5V)
21+
22+ - VCCDA1-supply : DAC power supply regulator 1 (+5V)
23+
24+ - VCCDA2-supply : DAC power supply regulator 2 (+5V)
25+
26+For required properties on SPI/I2C, consult SPI/I2C device tree documentation
27+
28+Examples:
29+
30+i2c0: i2c0@0 {
31+
32+ ...
33+
34+ pcm3168a: audio-codec@44 {
35+ compatible = "ti,pcm3168a";
36+ reg = <0x44>;
37+ clocks = <&clk_core CLK_AUDIO>;
38+ clock-names = "scki";
39+ VDD1-supply = <&supply3v3>;
40+ VDD2-supply = <&supply3v3>;
41+ VCCAD1-supply = <&supply5v0>;
42+ VCCAD2-supply = <&supply5v0>;
43+ VCCDA1-supply = <&supply5v0>;
44+ VCCDA2-supply = <&supply5v0>;
45+ pinctrl-names = "default";
46+ pinctrl-0 = <&dac_clk_pin>;
47+ };
48+};
Documentation/devicetree/bindings/sound/wlf,wm8974.txt+15−0
@@ -0,0 +1,15 @@
1+WM8974 audio CODEC
2+
3+This device supports both I2C and SPI (configured with pin strapping
4+on the board).
5+
6+Required properties:
7+ - compatible: "wlf,wm8974"
8+ - reg: the I2C address or SPI chip select number of the device
9+
10+Examples:
11+
12+codec: wm8974@1a {
13+ compatible = "wlf,wm8974";
14+ reg = <0x1a>;
15+};
Documentation/sound/alsa/img,spdif-in.txt+49−0
@@ -0,0 +1,49 @@
1+The Imagination Technologies SPDIF Input controller contains the following
2+controls:
3+
4+name='IEC958 Capture Mask',index=0
5+
6+This control returns a mask that shows which of the IEC958 status bits
7+can be read using the 'IEC958 Capture Default' control.
8+
9+name='IEC958 Capture Default',index=0
10+
11+This control returns the status bits contained within the SPDIF stream that
12+is being received. The 'IEC958 Capture Mask' shows which bits can be read
13+from this control.
14+
15+name='SPDIF In Multi Frequency Acquire',index=0
16+name='SPDIF In Multi Frequency Acquire',index=1
17+name='SPDIF In Multi Frequency Acquire',index=2
18+name='SPDIF In Multi Frequency Acquire',index=3
19+
20+This control is used to attempt acquisition of up to four different sample
21+rates. The active rate can be obtained by reading the 'SPDIF In Lock Frequency'
22+control.
23+
24+When the value of this control is set to {0,0,0,0}, the rate given to hw_params
25+will determine the single rate the block will capture. Else, the rate given to
26+hw_params will be ignored, and the block will attempt capture for each of the
27+four sample rates set here.
28+
29+If less than four rates are required, the same rate can be specified more than
30+once
31+
32+name='SPDIF In Lock Frequency',index=0
33+
34+This control returns the active capture rate, or 0 if a lock has not been
35+acquired
36+
37+name='SPDIF In Lock TRK',index=0
38+
39+This control is used to modify the locking/jitter rejection characteristics
40+of the block. Larger values increase the locking range, but reduce jitter
41+rejection.
42+
43+name='SPDIF In Lock Acquire Threshold',index=0
44+
45+This control is used to change the threshold at which a lock is acquired.
46+
47+name='SPDIF In Lock Release Threshold',index=0
48+
49+This control is used to change the threshold at which a lock is released.
arch/arm/mach-s3c64xx/dev-audio.c+29−18
@@ -54,12 +54,13 @@ static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev) · 53 unmodified lines
5454
5555 static struct resource s3c64xx_iis0_resource[] = {
5656 [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS0, SZ_256),
57− [1] = DEFINE_RES_DMA(DMACH_I2S0_OUT),
58− [2] = DEFINE_RES_DMA(DMACH_I2S0_IN),
5957 };
6058
61−static struct s3c_audio_pdata i2sv3_pdata = {
59+static struct s3c_audio_pdata i2s0_pdata = {
6260 .cfg_gpio = s3c64xx_i2s_cfg_gpio,
61+ .dma_filter = pl08x_filter_id,
62+ .dma_playback = DMACH_I2S0_OUT,
63+ .dma_capture = DMACH_I2S0_IN,
6364 };
6465
6566 struct platform_device s3c64xx_device_iis0 = {
@@ -68,15 +69,20 @@ struct platform_device s3c64xx_device_iis0 = { · 2 unmodified lines
6869 .num_resources = ARRAY_SIZE(s3c64xx_iis0_resource),
6970 .resource = s3c64xx_iis0_resource,
7071 .dev = {
71− .platform_data = &i2sv3_pdata,
72+ .platform_data = &i2s0_pdata,
7273 },
7374 };
7475 EXPORT_SYMBOL(s3c64xx_device_iis0);
7576
7677 static struct resource s3c64xx_iis1_resource[] = {
7778 [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS1, SZ_256),
78− [1] = DEFINE_RES_DMA(DMACH_I2S1_OUT),
79− [2] = DEFINE_RES_DMA(DMACH_I2S1_IN),
79+};
80+
81+static struct s3c_audio_pdata i2s1_pdata = {
82+ .cfg_gpio = s3c64xx_i2s_cfg_gpio,
83+ .dma_filter = pl08x_filter_id,
84+ .dma_playback = DMACH_I2S1_OUT,
85+ .dma_capture = DMACH_I2S1_IN,
8086 };
8187
8288 struct platform_device s3c64xx_device_iis1 = {
@@ -85,19 +91,20 @@ struct platform_device s3c64xx_device_iis1 = { · 2 unmodified lines
8591 .num_resources = ARRAY_SIZE(s3c64xx_iis1_resource),
8692 .resource = s3c64xx_iis1_resource,
8793 .dev = {
88− .platform_data = &i2sv3_pdata,
94+ .platform_data = &i2s1_pdata,
8995 },
9096 };
9197 EXPORT_SYMBOL(s3c64xx_device_iis1);
9298
9399 static struct resource s3c64xx_iisv4_resource[] = {
94100 [0] = DEFINE_RES_MEM(S3C64XX_PA_IISV4, SZ_256),
95− [1] = DEFINE_RES_DMA(DMACH_HSI_I2SV40_TX),
96− [2] = DEFINE_RES_DMA(DMACH_HSI_I2SV40_RX),
97101 };
98102
99103 static struct s3c_audio_pdata i2sv4_pdata = {
100104 .cfg_gpio = s3c64xx_i2s_cfg_gpio,
105+ .dma_filter = pl08x_filter_id,
106+ .dma_playback = DMACH_HSI_I2SV40_TX,
107+ .dma_capture = DMACH_HSI_I2SV40_RX,
101108 .type = {
102109 .i2s = {
103110 .quirks = QUIRK_PRI_6CHAN,
@@ -142,12 +149,13 @@ static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev) · 38 unmodified lines
142149
143150 static struct resource s3c64xx_pcm0_resource[] = {
144151 [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM0, SZ_256),
145− [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
146− [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
147152 };
148153
149154 static struct s3c_audio_pdata s3c_pcm0_pdata = {
150155 .cfg_gpio = s3c64xx_pcm_cfg_gpio,
156+ .dma_filter = pl08x_filter_id,
157+ .dma_capture = DMACH_PCM0_RX,
158+ .dma_playback = DMACH_PCM0_TX,
151159 };
152160
153161 struct platform_device s3c64xx_device_pcm0 = {
@@ -163,12 +171,13 @@ EXPORT_SYMBOL(s3c64xx_device_pcm0); · 9 unmodified lines
163171
164172 static struct resource s3c64xx_pcm1_resource[] = {
165173 [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM1, SZ_256),
166− [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
167− [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
168174 };
169175
170176 static struct s3c_audio_pdata s3c_pcm1_pdata = {
171177 .cfg_gpio = s3c64xx_pcm_cfg_gpio,
178+ .dma_filter = pl08x_filter_id,
179+ .dma_playback = DMACH_PCM1_TX,
180+ .dma_capture = DMACH_PCM1_RX,
172181 };
173182
174183 struct platform_device s3c64xx_device_pcm1 = {
@@ -196,13 +205,15 @@ static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev) · 21 unmodified lines
196205
197206 static struct resource s3c64xx_ac97_resource[] = {
198207 [0] = DEFINE_RES_MEM(S3C64XX_PA_AC97, SZ_256),
199− [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
200− [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
201− [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
202− [4] = DEFINE_RES_IRQ(IRQ_AC97),
208+ [1] = DEFINE_RES_IRQ(IRQ_AC97),
203209 };
204210
205−static struct s3c_audio_pdata s3c_ac97_pdata;
211+static struct s3c_audio_pdata s3c_ac97_pdata = {
212+ .dma_playback = DMACH_AC97_PCMOUT,
213+ .dma_filter = pl08x_filter_id,
214+ .dma_capture = DMACH_AC97_PCMIN,
215+ .dma_capture_mic = DMACH_AC97_MICIN,
216+};
206217
207218 static u64 s3c64xx_ac97_dmamask = DMA_BIT_MASK(32);
208219
arch/arm/mach-s3c64xx/include/mach/dma.h+26−26
@@ -14,38 +14,38 @@ · 13 unmodified lines
1414 #define S3C64XX_DMA_CHAN(name) ((unsigned long)(name))
1515
1616 /* DMA0/SDMA0 */
17−#define DMACH_UART0 S3C64XX_DMA_CHAN("uart0_tx")
18−#define DMACH_UART0_SRC2 S3C64XX_DMA_CHAN("uart0_rx")
19−#define DMACH_UART1 S3C64XX_DMA_CHAN("uart1_tx")
20−#define DMACH_UART1_SRC2 S3C64XX_DMA_CHAN("uart1_rx")
21−#define DMACH_UART2 S3C64XX_DMA_CHAN("uart2_tx")
22−#define DMACH_UART2_SRC2 S3C64XX_DMA_CHAN("uart2_rx")
23−#define DMACH_UART3 S3C64XX_DMA_CHAN("uart3_tx")
24−#define DMACH_UART3_SRC2 S3C64XX_DMA_CHAN("uart3_rx")
25−#define DMACH_PCM0_TX S3C64XX_DMA_CHAN("pcm0_tx")
26−#define DMACH_PCM0_RX S3C64XX_DMA_CHAN("pcm0_rx")
27−#define DMACH_I2S0_OUT S3C64XX_DMA_CHAN("i2s0_tx")
28−#define DMACH_I2S0_IN S3C64XX_DMA_CHAN("i2s0_rx")
17+#define DMACH_UART0 "uart0_tx"
18+#define DMACH_UART0_SRC2 "uart0_rx"
19+#define DMACH_UART1 "uart1_tx"
20+#define DMACH_UART1_SRC2 "uart1_rx"
21+#define DMACH_UART2 "uart2_tx"
22+#define DMACH_UART2_SRC2 "uart2_rx"
23+#define DMACH_UART3 "uart3_tx"
24+#define DMACH_UART3_SRC2 "uart3_rx"
25+#define DMACH_PCM0_TX "pcm0_tx"
26+#define DMACH_PCM0_RX "pcm0_rx"
27+#define DMACH_I2S0_OUT "i2s0_tx"
28+#define DMACH_I2S0_IN "i2s0_rx"
2929 #define DMACH_SPI0_TX S3C64XX_DMA_CHAN("spi0_tx")
3030 #define DMACH_SPI0_RX S3C64XX_DMA_CHAN("spi0_rx")
31−#define DMACH_HSI_I2SV40_TX S3C64XX_DMA_CHAN("i2s2_tx")
32−#define DMACH_HSI_I2SV40_RX S3C64XX_DMA_CHAN("i2s2_rx")
31+#define DMACH_HSI_I2SV40_TX "i2s2_tx"
32+#define DMACH_HSI_I2SV40_RX "i2s2_rx"
3333
3434 /* DMA1/SDMA1 */
35−#define DMACH_PCM1_TX S3C64XX_DMA_CHAN("pcm1_tx")
36−#define DMACH_PCM1_RX S3C64XX_DMA_CHAN("pcm1_rx")
37−#define DMACH_I2S1_OUT S3C64XX_DMA_CHAN("i2s1_tx")
38−#define DMACH_I2S1_IN S3C64XX_DMA_CHAN("i2s1_rx")
35+#define DMACH_PCM1_TX "pcm1_tx"
36+#define DMACH_PCM1_RX "pcm1_rx"
37+#define DMACH_I2S1_OUT "i2s1_tx"
38+#define DMACH_I2S1_IN "i2s1_rx"
3939 #define DMACH_SPI1_TX S3C64XX_DMA_CHAN("spi1_tx")
4040 #define DMACH_SPI1_RX S3C64XX_DMA_CHAN("spi1_rx")
41−#define DMACH_AC97_PCMOUT S3C64XX_DMA_CHAN("ac97_out")
42−#define DMACH_AC97_PCMIN S3C64XX_DMA_CHAN("ac97_in")
43−#define DMACH_AC97_MICIN S3C64XX_DMA_CHAN("ac97_mic")
44−#define DMACH_PWM S3C64XX_DMA_CHAN("pwm")
45−#define DMACH_IRDA S3C64XX_DMA_CHAN("irda")
46−#define DMACH_EXTERNAL S3C64XX_DMA_CHAN("external")
47−#define DMACH_SECURITY_RX S3C64XX_DMA_CHAN("sec_rx")
48−#define DMACH_SECURITY_TX S3C64XX_DMA_CHAN("sec_tx")
41+#define DMACH_AC97_PCMOUT "ac97_out"
42+#define DMACH_AC97_PCMIN "ac97_in"
43+#define DMACH_AC97_MICIN "ac97_mic"
44+#define DMACH_PWM "pwm"
45+#define DMACH_IRDA "irda"
46+#define DMACH_EXTERNAL "external"
47+#define DMACH_SECURITY_RX "sec_rx"
48+#define DMACH_SECURITY_TX "sec_tx"
4949
5050 enum dma_ch {
5151 DMACH_MAX = 32
arch/arm/plat-samsung/devs.c+20−3
@@ -65,6 +65,7 @@ · 64 unmodified lines
6565 #include <linux/platform_data/usb-ohci-s3c2410.h>
6666 #include <plat/usb-phy.h>
6767 #include <plat/regs-spi.h>
68+#include <linux/platform_data/asoc-s3c.h>
6869 #include <linux/platform_data/spi-s3c64xx.h>
6970
7071 static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);
@@ -74,9 +75,15 @@ static u64 samsung_device_dma_mask = DMA_BIT_MASK(32); · 3 unmodified lines
7475 static struct resource s3c_ac97_resource[] = {
7576 [0] = DEFINE_RES_MEM(S3C2440_PA_AC97, S3C2440_SZ_AC97),
7677 [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97),
77− [2] = DEFINE_RES_DMA_NAMED(DMACH_PCM_OUT, "PCM out"),
78− [3] = DEFINE_RES_DMA_NAMED(DMACH_PCM_IN, "PCM in"),
79− [4] = DEFINE_RES_DMA_NAMED(DMACH_MIC_IN, "Mic in"),
78+};
79+
80+static struct s3c_audio_pdata s3c_ac97_pdata = {
81+#ifdef CONFIG_S3C24XX_DMAC
82+ .dma_filter = s3c24xx_dma_filter,
83+#endif
84+ .dma_playback = (void *)DMACH_PCM_OUT,
85+ .dma_capture = (void *)DMACH_PCM_IN,
86+ .dma_capture_mic = (void *)DMACH_MIC_IN,
8087 };
8188
8289 struct platform_device s3c_device_ac97 = {
@@ -87,6 +94,7 @@ struct platform_device s3c_device_ac97 = { · 4 unmodified lines
8794 .dev = {
8895 .dma_mask = &samsung_device_dma_mask,
8996 .coherent_dma_mask = DMA_BIT_MASK(32),
97+ .platform_data = &s3c_ac97_pdata,
9098 }
9199 };
92100 #endif /* CONFIG_CPU_S3C2440 */
@@ -566,6 +574,14 @@ static struct resource s3c_iis_resource[] = { · 473 unmodified lines
566574 [0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS),
567575 };
568576
577+static struct s3c_audio_pdata s3c_iis_platdata = {
578+#ifdef CONFIG_S3C24XX_DMAC
579+ .dma_filter = s3c24xx_dma_filter,
580+#endif
581+ .dma_playback = (void *)DMACH_I2S_OUT,
582+ .dma_capture = (void *)DMACH_I2S_IN,
583+};
584+
569585 struct platform_device s3c_device_iis = {
570586 .name = "s3c24xx-iis",
571587 .id = -1,
@@ -574,6 +590,7 @@ struct platform_device s3c_device_iis = { · 2 unmodified lines
574590 .dev = {
575591 .dma_mask = &samsung_device_dma_mask,
576592 .coherent_dma_mask = DMA_BIT_MASK(32),
593+ .platform_data = &s3c_iis_platdata,
577594 }
578595 };
579596 #endif /* CONFIG_PLAT_S3C24XX */
arch/x86/include/asm/platform_sst_audio.h+1−0
@@ -55,6 +55,7 @@ enum sst_audio_device_id_mrfld { · 54 unmodified lines
5555 PIPE_MEDIA0_IN = 0x8F,
5656 PIPE_MEDIA1_IN = 0x90,
5757 PIPE_MEDIA2_IN = 0x91,
58+ PIPE_MEDIA3_IN = 0x9C,
5859 PIPE_RSVD = 0xFF,
5960 };
6061
arch/x86/kernel/early-quirks.c+1−0
@@ -547,6 +547,7 @@ static const struct pci_device_id intel_stolen_ids[] __initconst = { · 546 unmodified lines
547547 INTEL_CHV_IDS(&chv_stolen_funcs),
548548 INTEL_SKL_IDS(&gen9_stolen_funcs),
549549 INTEL_BXT_IDS(&gen9_stolen_funcs),
550+ INTEL_KBL_IDS(&gen9_stolen_funcs),
550551 };
551552
552553 static void __init intel_graphics_stolen(int num, int slot, int func)
drivers/dma/Kconfig+1−1
@@ -444,7 +444,7 @@ config STM32_DMA · 443 unmodified lines
444444 here.
445445
446446 config S3C24XX_DMAC
447− tristate "Samsung S3C24XX DMA support"
447+ bool "Samsung S3C24XX DMA support"
448448 depends on ARCH_S3C24XX
449449 select DMA_ENGINE
450450 select DMA_VIRTUAL_CHANNELS
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c+2−2
@@ -518,7 +518,7 @@ static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { · 517 unmodified lines
518518 int
519519 amdgpu_framebuffer_init(struct drm_device *dev,
520520 struct amdgpu_framebuffer *rfb,
521− struct drm_mode_fb_cmd2 *mode_cmd,
521+ const struct drm_mode_fb_cmd2 *mode_cmd,
522522 struct drm_gem_object *obj)
523523 {
524524 int ret;
@@ -535,7 +535,7 @@ amdgpu_framebuffer_init(struct drm_device *dev, · 10 unmodified lines
535535 static struct drm_framebuffer *
536536 amdgpu_user_framebuffer_create(struct drm_device *dev,
537537 struct drm_file *file_priv,
538− struct drm_mode_fb_cmd2 *mode_cmd)
538+ const struct drm_mode_fb_cmd2 *mode_cmd)
539539 {
540540 struct drm_gem_object *obj;
541541 struct amdgpu_framebuffer *amdgpu_fb;
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c+0−1
@@ -45,7 +45,6 @@ · 44 unmodified lines
4545 struct amdgpu_fbdev {
4646 struct drm_fb_helper helper;
4747 struct amdgpu_framebuffer rfb;
48− struct list_head fbdev_list;
4948 struct amdgpu_device *adev;
5049 };
5150
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h+1−1
@@ -556,7 +556,7 @@ int amdgpu_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, · 555 unmodified lines
556556
557557 int amdgpu_framebuffer_init(struct drm_device *dev,
558558 struct amdgpu_framebuffer *rfb,
559− struct drm_mode_fb_cmd2 *mode_cmd,
559+ const struct drm_mode_fb_cmd2 *mode_cmd,
560560 struct drm_gem_object *obj);
561561
562562 int amdgpufb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
drivers/gpu/drm/armada/armada_fb.c+2−2
@@ -35,7 +35,7 @@ static const struct drm_framebuffer_funcs armada_fb_funcs = { · 34 unmodified lines
3535 };
3636
3737 struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
38− struct drm_mode_fb_cmd2 *mode, struct armada_gem_object *obj)
38+ const struct drm_mode_fb_cmd2 *mode, struct armada_gem_object *obj)
3939 {
4040 struct armada_framebuffer *dfb;
4141 uint8_t format, config;
@@ -101,7 +101,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev, · 59 unmodified lines
101101 }
102102
103103 static struct drm_framebuffer *armada_fb_create(struct drm_device *dev,
104− struct drm_file *dfile, struct drm_mode_fb_cmd2 *mode)
104+ struct drm_file *dfile, const struct drm_mode_fb_cmd2 *mode)
105105 {
106106 struct armada_gem_object *obj;
107107 struct armada_framebuffer *dfb;
drivers/gpu/drm/armada/armada_fb.h+1−1
@@ -19,6 +19,6 @@ struct armada_framebuffer { · 18 unmodified lines
1919 #define drm_fb_obj(fb) drm_fb_to_armada_fb(fb)->obj
2020
2121 struct armada_framebuffer *armada_framebuffer_create(struct drm_device *,
22− struct drm_mode_fb_cmd2 *, struct armada_gem_object *);
22+ const struct drm_mode_fb_cmd2 *, struct armada_gem_object *);
2323
2424 #endif
drivers/gpu/drm/ast/ast_drv.h+1−2
@@ -256,7 +256,6 @@ struct ast_framebuffer { · 255 unmodified lines
256256 struct ast_fbdev {
257257 struct drm_fb_helper helper;
258258 struct ast_framebuffer afb;
259− struct list_head fbdev_list;
260259 void *sysram;
261260 int size;
262261 struct ttm_bo_kmap_obj mapping;
@@ -309,7 +308,7 @@ extern void ast_mode_fini(struct drm_device *dev); · 46 unmodified lines
309308
310309 int ast_framebuffer_init(struct drm_device *dev,
311310 struct ast_framebuffer *ast_fb,
312− struct drm_mode_fb_cmd2 *mode_cmd,
311+ const struct drm_mode_fb_cmd2 *mode_cmd,
313312 struct drm_gem_object *obj);
314313
315314 int ast_fbdev_init(struct drm_device *dev);
drivers/gpu/drm/ast/ast_fb.c+1−1
@@ -163,7 +163,7 @@ static struct fb_ops astfb_ops = { · 162 unmodified lines
163163 };
164164
165165 static int astfb_create_object(struct ast_fbdev *afbdev,
166− struct drm_mode_fb_cmd2 *mode_cmd,
166+ const struct drm_mode_fb_cmd2 *mode_cmd,
167167 struct drm_gem_object **gobj_p)
168168 {
169169 struct drm_device *dev = afbdev->helper.dev;
drivers/gpu/drm/ast/ast_main.c+2−2
@@ -309,7 +309,7 @@ static const struct drm_framebuffer_funcs ast_fb_funcs = { · 308 unmodified lines
309309
310310 int ast_framebuffer_init(struct drm_device *dev,
311311 struct ast_framebuffer *ast_fb,
312− struct drm_mode_fb_cmd2 *mode_cmd,
312+ const struct drm_mode_fb_cmd2 *mode_cmd,
313313 struct drm_gem_object *obj)
314314 {
315315 int ret;
@@ -327,7 +327,7 @@ int ast_framebuffer_init(struct drm_device *dev, · 11 unmodified lines
327327 static struct drm_framebuffer *
328328 ast_user_framebuffer_create(struct drm_device *dev,
329329 struct drm_file *filp,
330− struct drm_mode_fb_cmd2 *mode_cmd)
330+ const struct drm_mode_fb_cmd2 *mode_cmd)
331331 {
332332 struct drm_gem_object *obj;
333333 struct ast_framebuffer *ast_fb;
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c+1−1
@@ -402,7 +402,7 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data) · 401 unmodified lines
402402 }
403403
404404 static struct drm_framebuffer *atmel_hlcdc_fb_create(struct drm_device *dev,
405− struct drm_file *file_priv, struct drm_mode_fb_cmd2 *mode_cmd)
405+ struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd)
406406 {
407407 return drm_fb_cma_create(dev, file_priv, mode_cmd);
408408 }
drivers/gpu/drm/bochs/bochs.h+1−1
@@ -149,7 +149,7 @@ int bochs_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev, · 148 unmodified lines
149149
150150 int bochs_framebuffer_init(struct drm_device *dev,
151151 struct bochs_framebuffer *gfb,
152− struct drm_mode_fb_cmd2 *mode_cmd,
152+ const struct drm_mode_fb_cmd2 *mode_cmd,
153153 struct drm_gem_object *obj);
154154 int bochs_bo_pin(struct bochs_bo *bo, u32 pl_flag, u64 *gpu_addr);
155155 int bochs_bo_unpin(struct bochs_bo *bo);
drivers/gpu/drm/bochs/bochs_fbdev.c+1−1
@@ -34,7 +34,7 @@ static struct fb_ops bochsfb_ops = { · 33 unmodified lines
3434 };
3535
3636 static int bochsfb_create_object(struct bochs_device *bochs,
37− struct drm_mode_fb_cmd2 *mode_cmd,
37+ const struct drm_mode_fb_cmd2 *mode_cmd,
3838 struct drm_gem_object **gobj_p)
3939 {
4040 struct drm_device *dev = bochs->dev;
drivers/gpu/drm/bochs/bochs_mm.c+2−2
@@ -484,7 +484,7 @@ static const struct drm_framebuffer_funcs bochs_fb_funcs = { · 483 unmodified lines
484484
485485 int bochs_framebuffer_init(struct drm_device *dev,
486486 struct bochs_framebuffer *gfb,
487− struct drm_mode_fb_cmd2 *mode_cmd,
487+ const struct drm_mode_fb_cmd2 *mode_cmd,
488488 struct drm_gem_object *obj)
489489 {
490490 int ret;
@@ -502,7 +502,7 @@ int bochs_framebuffer_init(struct drm_device *dev, · 11 unmodified lines
502502 static struct drm_framebuffer *
503503 bochs_user_framebuffer_create(struct drm_device *dev,
504504 struct drm_file *filp,
505− struct drm_mode_fb_cmd2 *mode_cmd)
505+ const struct drm_mode_fb_cmd2 *mode_cmd)
506506 {
507507 struct drm_gem_object *obj;
508508 struct bochs_framebuffer *bochs_fb;
drivers/gpu/drm/cirrus/cirrus_drv.h+1−2
@@ -153,7 +153,6 @@ struct cirrus_device { · 152 unmodified lines
153153 struct cirrus_fbdev {
154154 struct drm_fb_helper helper;
155155 struct cirrus_framebuffer gfb;
156− struct list_head fbdev_list;
157156 void *sysram;
158157 int size;
159158 int x1, y1, x2, y2; /* dirty rect */
@@ -207,7 +206,7 @@ int cirrus_dumb_create(struct drm_file *file, · 47 unmodified lines
207206
208207 int cirrus_framebuffer_init(struct drm_device *dev,
209208 struct cirrus_framebuffer *gfb,
210− struct drm_mode_fb_cmd2 *mode_cmd,
209+ const struct drm_mode_fb_cmd2 *mode_cmd,
211210 struct drm_gem_object *obj);
212211
213212 bool cirrus_check_framebuffer(struct cirrus_device *cdev, int width, int height,
drivers/gpu/drm/cirrus/cirrus_fbdev.c+1−1
@@ -135,7 +135,7 @@ static struct fb_ops cirrusfb_ops = { · 134 unmodified lines
135135 };
136136
137137 static int cirrusfb_create_object(struct cirrus_fbdev *afbdev,
138− struct drm_mode_fb_cmd2 *mode_cmd,
138+ const struct drm_mode_fb_cmd2 *mode_cmd,
139139 struct drm_gem_object **gobj_p)
140140 {
141141 struct drm_device *dev = afbdev->helper.dev;
drivers/gpu/drm/cirrus/cirrus_main.c+2−2
@@ -29,7 +29,7 @@ static const struct drm_framebuffer_funcs cirrus_fb_funcs = { · 28 unmodified lines
2929
3030 int cirrus_framebuffer_init(struct drm_device *dev,
3131 struct cirrus_framebuffer *gfb,
32− struct drm_mode_fb_cmd2 *mode_cmd,
32+ const struct drm_mode_fb_cmd2 *mode_cmd,
3333 struct drm_gem_object *obj)
3434 {
3535 int ret;
@@ -47,7 +47,7 @@ int cirrus_framebuffer_init(struct drm_device *dev, · 11 unmodified lines
4747 static struct drm_framebuffer *
4848 cirrus_user_framebuffer_create(struct drm_device *dev,
4949 struct drm_file *filp,
50− struct drm_mode_fb_cmd2 *mode_cmd)
50+ const struct drm_mode_fb_cmd2 *mode_cmd)
5151 {
5252 struct cirrus_device *cdev = dev->dev_private;
5353 struct drm_gem_object *obj;
drivers/gpu/drm/drm_atomic.c+5−13
@@ -316,8 +316,7 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, · 315 unmodified lines
316316 if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
317317 return 0;
318318
319− if (state->mode_blob)
320− drm_property_unreference_blob(state->mode_blob);
319+ drm_property_unreference_blob(state->mode_blob);
321320 state->mode_blob = NULL;
322321
323322 if (mode) {
@@ -363,8 +362,7 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, · 39 unmodified lines
363362 if (blob == state->mode_blob)
364363 return 0;
365364
366− if (state->mode_blob)
367− drm_property_unreference_blob(state->mode_blob);
365+ drm_property_unreference_blob(state->mode_blob);
368366 state->mode_blob = NULL;
369367
370368 if (blob) {
@@ -419,8 +417,7 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, · 48 unmodified lines
419417 struct drm_property_blob *mode =
420418 drm_property_lookup_blob(dev, val);
421419 ret = drm_atomic_set_mode_prop_for_crtc(state, mode);
422− if (mode)
423− drm_property_unreference_blob(mode);
420+ drm_property_unreference_blob(mode);
424421 return ret;
425422 }
426423 else if (crtc->funcs->atomic_set_property)
@@ -1191,12 +1188,7 @@ void drm_atomic_legacy_backoff(struct drm_atomic_state *state) · 764 unmodified lines
11911188 retry:
11921189 drm_modeset_backoff(state->acquire_ctx);
11931190
1194− ret = drm_modeset_lock(&state->dev->mode_config.connection_mutex,
1195− state->acquire_ctx);
1196− if (ret)
1197− goto retry;
1198− ret = drm_modeset_lock_all_crtcs(state->dev,
1199− state->acquire_ctx);
1191+ ret = drm_modeset_lock_all_ctx(state->dev, state->acquire_ctx);
12001192 if (ret)
12011193 goto retry;
12021194 }
@@ -1433,7 +1425,7 @@ static int atomic_set_prop(struct drm_atomic_state *state, · 230 unmodified lines
14331425 }
14341426
14351427 /**
1436− * drm_atomic_update_old_fb -- Unset old_fb pointers and set plane->fb pointers.
1428+ * drm_atomic_clean_old_fb -- Unset old_fb pointers and set plane->fb pointers.
14371429 *
14381430 * @dev: drm device to check.
14391431 * @plane_mask: plane mask for planes that were updated.
drivers/gpu/drm/drm_atomic_helper.c+241−11
@@ -80,6 +80,27 @@ drm_atomic_helper_plane_changed(struct drm_atomic_state *state, · 79 unmodified lines
8080 }
8181 }
8282
83+static bool
84+check_pending_encoder_assignment(struct drm_atomic_state *state,
85+ struct drm_encoder *new_encoder,
86+ struct drm_connector *new_connector)
87+{
88+ struct drm_connector *connector;
89+ struct drm_connector_state *conn_state;
90+ int i;
91+
92+ for_each_connector_in_state(state, connector, conn_state, i) {
93+ if (conn_state->best_encoder != new_encoder)
94+ continue;
95+
96+ /* encoder already assigned and we're trying to re-steal it! */
97+ if (connector->state->best_encoder != conn_state->best_encoder)
98+ return false;
99+ }
100+
101+ return true;
102+}
103+
83104 static struct drm_crtc *
84105 get_current_crtc_for_encoder(struct drm_device *dev,
85106 struct drm_encoder *encoder)
@@ -229,6 +250,13 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx) · 143 unmodified lines
229250 return 0;
230251 }
231252
253+ if (!check_pending_encoder_assignment(state, new_encoder, connector)) {
254+ DRM_DEBUG_ATOMIC("Encoder for [CONNECTOR:%d:%s] already assigned\n",
255+ connector->base.id,
256+ connector->name);
257+ return -EINVAL;
258+ }
259+
232260 encoder_crtc = get_current_crtc_for_encoder(state->dev,
233261 new_encoder);
234262
@@ -1341,6 +1369,49 @@ drm_atomic_helper_commit_planes_on_crtc(struct drm_crtc_state *old_crtc_state) · 1106 unmodified lines
13411369 }
13421370 EXPORT_SYMBOL(drm_atomic_helper_commit_planes_on_crtc);
13431371
1372+/**
1373+ * drm_atomic_helper_disable_planes_on_crtc - helper to disable CRTC's planes
1374+ * @crtc: CRTC
1375+ * @atomic: if set, synchronize with CRTC's atomic_begin/flush hooks
1376+ *
1377+ * Disables all planes associated with the given CRTC. This can be
1378+ * used for instance in the CRTC helper disable callback to disable
1379+ * all planes before shutting down the display pipeline.
1380+ *
1381+ * If the atomic-parameter is set the function calls the CRTC's
1382+ * atomic_begin hook before and atomic_flush hook after disabling the
1383+ * planes.
1384+ *
1385+ * It is a bug to call this function without having implemented the
1386+ * ->atomic_disable() plane hook.
1387+ */
1388+void drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc *crtc,
1389+ bool atomic)
1390+{
1391+ const struct drm_crtc_helper_funcs *crtc_funcs =
1392+ crtc->helper_private;
1393+ struct drm_plane *plane;
1394+
1395+ if (atomic && crtc_funcs && crtc_funcs->atomic_begin)
1396+ crtc_funcs->atomic_begin(crtc, NULL);
1397+
1398+ drm_for_each_plane(plane, crtc->dev) {
1399+ const struct drm_plane_helper_funcs *plane_funcs =
1400+ plane->helper_private;
1401+
1402+ if (plane->state->crtc != crtc || !plane_funcs)
1403+ continue;
1404+
1405+ WARN_ON(!plane_funcs->atomic_disable);
1406+ if (plane_funcs->atomic_disable)
1407+ plane_funcs->atomic_disable(plane, NULL);
1408+ }
1409+
1410+ if (atomic && crtc_funcs && crtc_funcs->atomic_flush)
1411+ crtc_funcs->atomic_flush(crtc, NULL);
1412+}
1413+EXPORT_SYMBOL(drm_atomic_helper_disable_planes_on_crtc);
1414+
13441415 /**
13451416 * drm_atomic_helper_cleanup_planes - cleanup plane resources after commit
13461417 * @dev: DRM device
@@ -1485,12 +1556,12 @@ retry: · 138 unmodified lines
14851556 drm_atomic_set_fb_for_plane(plane_state, fb);
14861557 plane_state->crtc_x = crtc_x;
14871558 plane_state->crtc_y = crtc_y;
1488− plane_state->crtc_h = crtc_h;
14891559 plane_state->crtc_w = crtc_w;
1560+ plane_state->crtc_h = crtc_h;
14901561 plane_state->src_x = src_x;
14911562 plane_state->src_y = src_y;
1492− plane_state->src_h = src_h;
14931563 plane_state->src_w = src_w;
1564+ plane_state->src_h = src_h;
14941565
14951566 if (plane == crtc->cursor)
14961567 state->legacy_cursor_update = true;
@@ -1609,12 +1680,12 @@ int __drm_atomic_helper_disable_plane(struct drm_plane *plane, · 112 unmodified lines
16091680 drm_atomic_set_fb_for_plane(plane_state, NULL);
16101681 plane_state->crtc_x = 0;
16111682 plane_state->crtc_y = 0;
1612− plane_state->crtc_h = 0;
16131683 plane_state->crtc_w = 0;
1684+ plane_state->crtc_h = 0;
16141685 plane_state->src_x = 0;
16151686 plane_state->src_y = 0;
1616− plane_state->src_h = 0;
16171687 plane_state->src_w = 0;
1688+ plane_state->src_h = 0;
16181689
16191690 return 0;
16201691 }
@@ -1797,16 +1868,16 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set, · 176 unmodified lines
17971868 drm_atomic_set_fb_for_plane(primary_state, set->fb);
17981869 primary_state->crtc_x = 0;
17991870 primary_state->crtc_y = 0;
1800− primary_state->crtc_h = vdisplay;
18011871 primary_state->crtc_w = hdisplay;
1872+ primary_state->crtc_h = vdisplay;
18021873 primary_state->src_x = set->x << 16;
18031874 primary_state->src_y = set->y << 16;
18041875 if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
1805− primary_state->src_h = hdisplay << 16;
18061876 primary_state->src_w = vdisplay << 16;
1877+ primary_state->src_h = hdisplay << 16;
18071878 } else {
1808− primary_state->src_h = vdisplay << 16;
18091879 primary_state->src_w = hdisplay << 16;
1880+ primary_state->src_h = vdisplay << 16;
18101881 }
18111882
18121883 commit:
@@ -1817,6 +1888,161 @@ commit: · 4 unmodified lines
18171888 return 0;
18181889 }
18191890
1891+/**
1892+ * drm_atomic_helper_disable_all - disable all currently active outputs
1893+ * @dev: DRM device
1894+ * @ctx: lock acquisition context
1895+ *
1896+ * Loops through all connectors, finding those that aren't turned off and then
1897+ * turns them off by setting their DPMS mode to OFF and deactivating the CRTC
1898+ * that they are connected to.
1899+ *
1900+ * This is used for example in suspend/resume to disable all currently active
1901+ * functions when suspending.
1902+ *
1903+ * Note that if callers haven't already acquired all modeset locks this might
1904+ * return -EDEADLK, which must be handled by calling drm_modeset_backoff().
1905+ *
1906+ * Returns:
1907+ * 0 on success or a negative error code on failure.
1908+ *
1909+ * See also:
1910+ * drm_atomic_helper_suspend(), drm_atomic_helper_resume()
1911+ */
1912+int drm_atomic_helper_disable_all(struct drm_device *dev,
1913+ struct drm_modeset_acquire_ctx *ctx)
1914+{
1915+ struct drm_atomic_state *state;
1916+ struct drm_connector *conn;
1917+ int err;
1918+
1919+ state = drm_atomic_state_alloc(dev);
1920+ if (!state)
1921+ return -ENOMEM;
1922+
1923+ state->acquire_ctx = ctx;
1924+
1925+ drm_for_each_connector(conn, dev) {
1926+ struct drm_crtc *crtc = conn->state->crtc;
1927+ struct drm_crtc_state *crtc_state;
1928+
1929+ if (!crtc || conn->dpms != DRM_MODE_DPMS_ON)
1930+ continue;
1931+
1932+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
1933+ if (IS_ERR(crtc_state)) {
1934+ err = PTR_ERR(crtc_state);
1935+ goto free;
1936+ }
1937+
1938+ crtc_state->active = false;
1939+ }
1940+
1941+ err = drm_atomic_commit(state);
1942+
1943+free:
1944+ if (err < 0)
1945+ drm_atomic_state_free(state);
1946+
1947+ return err;
1948+}
1949+EXPORT_SYMBOL(drm_atomic_helper_disable_all);
1950+
1951+/**
1952+ * drm_atomic_helper_suspend - subsystem-level suspend helper
1953+ * @dev: DRM device
1954+ *
1955+ * Duplicates the current atomic state, disables all active outputs and then
1956+ * returns a pointer to the original atomic state to the caller. Drivers can
1957+ * pass this pointer to the drm_atomic_helper_resume() helper upon resume to
1958+ * restore the output configuration that was active at the time the system
1959+ * entered suspend.
1960+ *
1961+ * Note that it is potentially unsafe to use this. The atomic state object
1962+ * returned by this function is assumed to be persistent. Drivers must ensure
1963+ * that this holds true. Before calling this function, drivers must make sure
1964+ * to suspend fbdev emulation so that nothing can be using the device.
1965+ *
1966+ * Returns:
1967+ * A pointer to a copy of the state before suspend on success or an ERR_PTR()-
1968+ * encoded error code on failure. Drivers should store the returned atomic
1969+ * state object and pass it to the drm_atomic_helper_resume() helper upon
1970+ * resume.
1971+ *
1972+ * See also:
1973+ * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(),
1974+ * drm_atomic_helper_resume()
1975+ */
1976+struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev)
1977+{
1978+ struct drm_modeset_acquire_ctx ctx;
1979+ struct drm_atomic_state *state;
1980+ int err;
1981+
1982+ drm_modeset_acquire_init(&ctx, 0);
1983+
1984+retry:
1985+ err = drm_modeset_lock_all_ctx(dev, &ctx);
1986+ if (err < 0) {
1987+ state = ERR_PTR(err);
1988+ goto unlock;
1989+ }
1990+
1991+ state = drm_atomic_helper_duplicate_state(dev, &ctx);
1992+ if (IS_ERR(state))
1993+ goto unlock;
1994+
1995+ err = drm_atomic_helper_disable_all(dev, &ctx);
1996+ if (err < 0) {
1997+ drm_atomic_state_free(state);
1998+ state = ERR_PTR(err);
1999+ goto unlock;
2000+ }
2001+
2002+unlock:
2003+ if (PTR_ERR(state) == -EDEADLK) {
2004+ drm_modeset_backoff(&ctx);
2005+ goto retry;
2006+ }
2007+
2008+ drm_modeset_drop_locks(&ctx);
2009+ drm_modeset_acquire_fini(&ctx);
2010+ return state;
2011+}
2012+EXPORT_SYMBOL(drm_atomic_helper_suspend);
2013+
2014+/**
2015+ * drm_atomic_helper_resume - subsystem-level resume helper
2016+ * @dev: DRM device
2017+ * @state: atomic state to resume to
2018+ *
2019+ * Calls drm_mode_config_reset() to synchronize hardware and software states,
2020+ * grabs all modeset locks and commits the atomic state object. This can be
2021+ * used in conjunction with the drm_atomic_helper_suspend() helper to
2022+ * implement suspend/resume for drivers that support atomic mode-setting.
2023+ *
2024+ * Returns:
2025+ * 0 on success or a negative error code on failure.
2026+ *
2027+ * See also:
2028+ * drm_atomic_helper_suspend()
2029+ */
2030+int drm_atomic_helper_resume(struct drm_device *dev,
2031+ struct drm_atomic_state *state)
2032+{
2033+ struct drm_mode_config *config = &dev->mode_config;
2034+ int err;
2035+
2036+ drm_mode_config_reset(dev);
2037+ drm_modeset_lock_all(dev);
2038+ state->acquire_ctx = config->acquire_ctx;
2039+ err = drm_atomic_commit(state);
2040+ drm_modeset_unlock_all(dev);
2041+
2042+ return err;
2043+}
2044+EXPORT_SYMBOL(drm_atomic_helper_resume);
2045+
18202046 /**
18212047 * drm_atomic_helper_crtc_set_property - helper for crtc properties
18222048 * @crtc: DRM crtc
@@ -2184,7 +2410,7 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_dpms); · 361 unmodified lines
21842410 */
21852411 void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc)
21862412 {
2187− if (crtc->state && crtc->state->mode_blob)
2413+ if (crtc->state)
21882414 drm_property_unreference_blob(crtc->state->mode_blob);
21892415 kfree(crtc->state);
21902416 crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL);
@@ -2252,8 +2478,7 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state); · 61 unmodified lines
22522478 void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
22532479 struct drm_crtc_state *state)
22542480 {
2255− if (state->mode_blob)
2256− drm_property_unreference_blob(state->mode_blob);
2481+ drm_property_unreference_blob(state->mode_blob);
22572482 }
22582483 EXPORT_SYMBOL(__drm_atomic_helper_crtc_destroy_state);
22592484
@@ -2430,7 +2655,9 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_duplicate_state); · 170 unmodified lines
24302655 * @ctx: lock acquisition context
24312656 *
24322657 * Makes a copy of the current atomic state by looping over all objects and
2433− * duplicating their respective states.
2658+ * duplicating their respective states. This is used for example by suspend/
2659+ * resume support code to save the state prior to suspend such that it can
2660+ * be restored upon resume.
24342661 *
24352662 * Note that this treats atomic state as persistent between save and restore.
24362663 * Drivers must make sure that this is possible and won't result in confusion
@@ -2442,6 +2669,9 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_duplicate_state); · 5 unmodified lines
24422669 * Returns:
24432670 * A pointer to the copy of the atomic state object on success or an
24442671 * ERR_PTR()-encoded error code on failure.
2672+ *
2673+ * See also:
2674+ * drm_atomic_helper_suspend(), drm_atomic_helper_resume()
24452675 */
24462676 struct drm_atomic_state *
24472677 drm_atomic_helper_duplicate_state(struct drm_device *dev,
drivers/gpu/drm/drm_crtc.c+2−2
@@ -45,7 +45,7 @@ · 44 unmodified lines
4545
4646 static struct drm_framebuffer *
4747 internal_framebuffer_create(struct drm_device *dev,
48− struct drm_mode_fb_cmd2 *r,
48+ const struct drm_mode_fb_cmd2 *r,
4949 struct drm_file *file_priv);
5050
5151 /* Avoid boilerplate. I'm tired of typing. */
@@ -3235,7 +3235,7 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 *r) · 3183 unmodified lines
32353235
32363236 static struct drm_framebuffer *
32373237 internal_framebuffer_create(struct drm_device *dev,
3238− struct drm_mode_fb_cmd2 *r,
3238+ const struct drm_mode_fb_cmd2 *r,
32393239 struct drm_file *file_priv)
32403240 {
32413241 struct drm_mode_config *config = &dev->mode_config;
drivers/gpu/drm/drm_crtc_helper.c+7−1
@@ -818,7 +818,7 @@ EXPORT_SYMBOL(drm_helper_connector_dpms); · 817 unmodified lines
818818 * metadata fields.
819819 */
820820 void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
821− struct drm_mode_fb_cmd2 *mode_cmd)
821+ const struct drm_mode_fb_cmd2 *mode_cmd)
822822 {
823823 int i;
824824
@@ -855,6 +855,12 @@ EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct); · 30 unmodified lines
855855 * due to slight differences in allocating shared resources when the
856856 * configuration is restored in a different order than when userspace set it up)
857857 * need to use their own restore logic.
858+ *
859+ * This function is deprecated. New drivers should implement atomic mode-
860+ * setting and use the atomic suspend/resume helpers.
861+ *
862+ * See also:
863+ * drm_atomic_helper_suspend(), drm_atomic_helper_resume()
858864 */
859865 void drm_helper_resume_force_mode(struct drm_device *dev)
860866 {
drivers/gpu/drm/drm_edid.c+60−2
@@ -2545,6 +2545,33 @@ cea_mode_alternate_clock(const struct drm_display_mode *cea_mode) · 2544 unmodified lines
25452545 return clock;
25462546 }
25472547
2548+static u8 drm_match_cea_mode_clock_tolerance(const struct drm_display_mode *to_match,
2549+ unsigned int clock_tolerance)
2550+{
2551+ u8 mode;
2552+
2553+ if (!to_match->clock)
2554+ return 0;
2555+
2556+ for (mode = 0; mode < ARRAY_SIZE(edid_cea_modes); mode++) {
2557+ const struct drm_display_mode *cea_mode = &edid_cea_modes[mode];
2558+ unsigned int clock1, clock2;
2559+
2560+ /* Check both 60Hz and 59.94Hz */
2561+ clock1 = cea_mode->clock;
2562+ clock2 = cea_mode_alternate_clock(cea_mode);
2563+
2564+ if (abs(to_match->clock - clock1) > clock_tolerance &&
2565+ abs(to_match->clock - clock2) > clock_tolerance)
2566+ continue;
2567+
2568+ if (drm_mode_equal_no_clocks(to_match, cea_mode))
2569+ return mode + 1;
2570+ }
2571+
2572+ return 0;
2573+}
2574+
25482575 /**
25492576 * drm_match_cea_mode - look for a CEA mode matching given mode
25502577 * @to_match: display mode
@@ -2609,6 +2636,33 @@ hdmi_mode_alternate_clock(const struct drm_display_mode *hdmi_mode) · 58 unmodified lines
26092636 return cea_mode_alternate_clock(hdmi_mode);
26102637 }
26112638
2639+static u8 drm_match_hdmi_mode_clock_tolerance(const struct drm_display_mode *to_match,
2640+ unsigned int clock_tolerance)
2641+{
2642+ u8 mode;
2643+
2644+ if (!to_match->clock)
2645+ return 0;
2646+
2647+ for (mode = 0; mode < ARRAY_SIZE(edid_4k_modes); mode++) {
2648+ const struct drm_display_mode *hdmi_mode = &edid_4k_modes[mode];
2649+ unsigned int clock1, clock2;
2650+
2651+ /* Make sure to also match alternate clocks */
2652+ clock1 = hdmi_mode->clock;
2653+ clock2 = hdmi_mode_alternate_clock(hdmi_mode);
2654+
2655+ if (abs(to_match->clock - clock1) > clock_tolerance &&
2656+ abs(to_match->clock - clock2) > clock_tolerance)
2657+ continue;
2658+
2659+ if (drm_mode_equal_no_clocks(to_match, hdmi_mode))
2660+ return mode + 1;
2661+ }
2662+
2663+ return 0;
2664+}
2665+
26122666 /*
26132667 * drm_match_hdmi_mode - look for a HDMI mode matching given mode
26142668 * @to_match: display mode
@@ -3119,14 +3173,18 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) · 504 unmodified lines
31193173 u8 mode_idx;
31203174 const char *type;
31213175
3122− mode_idx = drm_match_cea_mode(mode) - 1;
3176+ /*
3177+ * allow 5kHz clock difference either way to account for
3178+ * the 10kHz clock resolution limit of detailed timings.
3179+ */
3180+ mode_idx = drm_match_cea_mode_clock_tolerance(mode, 5) - 1;
31233181 if (mode_idx < ARRAY_SIZE(edid_cea_modes)) {
31243182 type = "CEA";
31253183 cea_mode = &edid_cea_modes[mode_idx];
31263184 clock1 = cea_mode->clock;
31273185 clock2 = cea_mode_alternate_clock(cea_mode);
31283186 } else {
3129− mode_idx = drm_match_hdmi_mode(mode) - 1;
3187+ mode_idx = drm_match_hdmi_mode_clock_tolerance(mode, 5) - 1;
31303188 if (mode_idx < ARRAY_SIZE(edid_4k_modes)) {
31313189 type = "HDMI";
31323190 cea_mode = &edid_4k_modes[mode_idx];
drivers/gpu/drm/drm_fb_cma_helper.c+2−2
@@ -74,7 +74,7 @@ static struct drm_framebuffer_funcs drm_fb_cma_funcs = { · 73 unmodified lines
7474 };
7575
7676 static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev,
77− struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_cma_object **obj,
77+ const const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_cma_object **obj,
7878 unsigned int num_planes)
7979 {
8080 struct drm_fb_cma *fb_cma;
@@ -107,7 +107,7 @@ static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev, · 26 unmodified lines
107107 * checked before calling this function.
108108 */
109109 struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
110− struct drm_file *file_priv, struct drm_mode_fb_cmd2 *mode_cmd)
110+ struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd)
111111 {
112112 struct drm_fb_cma *fb_cma;
113113 struct drm_gem_cma_object *objs[4];
drivers/gpu/drm/drm_fops.c+37−21
@@ -226,6 +226,8 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) · 225 unmodified lines
226226 init_waitqueue_head(&priv->event_wait);
227227 priv->event_space = 4096; /* set aside 4k for event buffer */
228228
229+ mutex_init(&priv->event_read_lock);
230+
229231 if (drm_core_check_feature(dev, DRIVER_GEM))
230232 drm_gem_open(dev, priv);
231233
@@ -511,14 +513,28 @@ ssize_t drm_read(struct file *filp, char __user *buffer, · 279 unmodified lines
511513 {
512514 struct drm_file *file_priv = filp->private_data;
513515 struct drm_device *dev = file_priv->minor->dev;
514− ssize_t ret = 0;
516+ ssize_t ret;
515517
516518 if (!access_ok(VERIFY_WRITE, buffer, count))
517519 return -EFAULT;
518520
519− spin_lock_irq(&dev->event_lock);
521+ ret = mutex_lock_interruptible(&file_priv->event_read_lock);
522+ if (ret)
523+ return ret;
524+
520525 for (;;) {
521− if (list_empty(&file_priv->event_list)) {
526+ struct drm_pending_event *e = NULL;
527+
528+ spin_lock_irq(&dev->event_lock);
529+ if (!list_empty(&file_priv->event_list)) {
530+ e = list_first_entry(&file_priv->event_list,
531+ struct drm_pending_event, link);
532+ file_priv->event_space += e->event->length;
533+ list_del(&e->link);
534+ }
535+ spin_unlock_irq(&dev->event_lock);
536+
537+ if (e == NULL) {
522538 if (ret)
523539 break;
524540
@@ -527,36 +543,36 @@ ssize_t drm_read(struct file *filp, char __user *buffer, · 2 unmodified lines
527543 break;
528544 }
529545
530− spin_unlock_irq(&dev->event_lock);
546+ mutex_unlock(&file_priv->event_read_lock);
531547 ret = wait_event_interruptible(file_priv->event_wait,
532548 !list_empty(&file_priv->event_list));
533− spin_lock_irq(&dev->event_lock);
534− if (ret < 0)
535− break;
536−
537− ret = 0;
549+ if (ret >= 0)
550+ ret = mutex_lock_interruptible(&file_priv->event_read_lock);
551+ if (ret)
552+ return ret;
538553 } else {
539− struct drm_pending_event *e;
540−
541− e = list_first_entry(&file_priv->event_list,
542− struct drm_pending_event, link);
543− if (e->event->length + ret > count)
554+ unsigned length = e->event->length;
555+
556+ if (length > count - ret) {
557+put_back_event:
558+ spin_lock_irq(&dev->event_lock);
559+ file_priv->event_space -= length;
560+ list_add(&e->link, &file_priv->event_list);
561+ spin_unlock_irq(&dev->event_lock);
544562 break;
563+ }
545564
546− if (__copy_to_user_inatomic(buffer + ret,
547− e->event, e->event->length)) {
565+ if (copy_to_user(buffer + ret, e->event, length)) {
548566 if (ret == 0)
549567 ret = -EFAULT;
550− break;
568+ goto put_back_event;
551569 }
552570
553− file_priv->event_space += e->event->length;
554− ret += e->event->length;
555− list_del(&e->link);
571+ ret += length;
556572 e->destroy(e);
557573 }
558574 }
559− spin_unlock_irq(&dev->event_lock);
575+ mutex_unlock(&file_priv->event_read_lock);
560576
561577 return ret;
562578 }
drivers/gpu/drm/drm_gem.c+32−3
@@ -244,8 +244,9 @@ drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj) · 243 unmodified lines
244244 * @filp: drm file-private structure to use for the handle look up
245245 * @handle: userspace handle to delete
246246 *
247− * Removes the GEM handle from the @filp lookup table and if this is the last
248− * handle also cleans up linked resources like GEM names.
247+ * Removes the GEM handle from the @filp lookup table which has been added with
248+ * drm_gem_handle_create(). If this is the last handle also cleans up linked
249+ * resources like GEM names.
249250 */
250251 int
251252 drm_gem_handle_delete(struct drm_file *filp, u32 handle)
@@ -314,6 +315,10 @@ EXPORT_SYMBOL(drm_gem_dumb_destroy); · 62 unmodified lines
314315 * This expects the dev->object_name_lock to be held already and will drop it
315316 * before returning. Used to avoid races in establishing new handles when
316317 * importing an object from either an flink name or a dma-buf.
318+ *
319+ * Handles must be release again through drm_gem_handle_delete(). This is done
320+ * when userspace closes @file_priv for all attached handles, or through the
321+ * GEM_CLOSE ioctl for individual handles.
317322 */
318323 int
319324 drm_gem_handle_create_tail(struct drm_file *file_priv,
@@ -541,7 +546,17 @@ void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, · 221 unmodified lines
541546 }
542547 EXPORT_SYMBOL(drm_gem_put_pages);
543548
544−/** Returns a reference to the object named by the handle. */
549+/**
550+ * drm_gem_object_lookup - look up a GEM object from it's handle
551+ * @dev: DRM device
552+ * @filp: DRM file private date
553+ * @handle: userspace handle
554+ *
555+ * Returns:
556+ *
557+ * A reference to the object named by the handle if such exists on @filp, NULL
558+ * otherwise.
559+ */
545560 struct drm_gem_object *
546561 drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp,
547562 u32 handle)
@@ -774,6 +789,13 @@ drm_gem_object_free(struct kref *kref) · 226 unmodified lines
774789 }
775790 EXPORT_SYMBOL(drm_gem_object_free);
776791
792+/**
793+ * drm_gem_vm_open - vma->ops->open implementation for GEM
794+ * @vma: VM area structure
795+ *
796+ * This function implements the #vm_operations_struct open() callback for GEM
797+ * drivers. This must be used together with drm_gem_vm_close().
798+ */
777799 void drm_gem_vm_open(struct vm_area_struct *vma)
778800 {
779801 struct drm_gem_object *obj = vma->vm_private_data;
@@ -782,6 +804,13 @@ void drm_gem_vm_open(struct vm_area_struct *vma) · 2 unmodified lines
782804 }
783805 EXPORT_SYMBOL(drm_gem_vm_open);
784806
807+/**
808+ * drm_gem_vm_close - vma->ops->close implementation for GEM
809+ * @vma: VM area structure
810+ *
811+ * This function implements the #vm_operations_struct close() callback for GEM
812+ * drivers. This must be used together with drm_gem_vm_open().
813+ */
785814 void drm_gem_vm_close(struct vm_area_struct *vma)
786815 {
787816 struct drm_gem_object *obj = vma->vm_private_data;
drivers/gpu/drm/drm_modes.c+29−6
@@ -917,13 +917,30 @@ bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_displ · 916 unmodified lines
917917 } else if (mode1->clock != mode2->clock)
918918 return false;
919919
920+ return drm_mode_equal_no_clocks(mode1, mode2);
921+}
922+EXPORT_SYMBOL(drm_mode_equal);
923+
924+/**
925+ * drm_mode_equal_no_clocks - test modes for equality
926+ * @mode1: first mode
927+ * @mode2: second mode
928+ *
929+ * Check to see if @mode1 and @mode2 are equivalent, but
930+ * don't check the pixel clocks.
931+ *
932+ * Returns:
933+ * True if the modes are equal, false otherwise.
934+ */
935+bool drm_mode_equal_no_clocks(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2)
936+{
920937 if ((mode1->flags & DRM_MODE_FLAG_3D_MASK) !=
921938 (mode2->flags & DRM_MODE_FLAG_3D_MASK))
922939 return false;
923940
924941 return drm_mode_equal_no_clocks_no_stereo(mode1, mode2);
925942 }
926−EXPORT_SYMBOL(drm_mode_equal);
943+EXPORT_SYMBOL(drm_mode_equal_no_clocks);
927944
928945 /**
929946 * drm_mode_equal_no_clocks_no_stereo - test modes for equality
@@ -1230,7 +1247,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, · 300 unmodified lines
12301247 unsigned int xres = 0, yres = 0, bpp = 32, refresh = 0;
12311248 bool yres_specified = false, cvt = false, rb = false;
12321249 bool interlace = false, margins = false, was_digit = false;
1233− int i;
1250+ int i, err;
12341251 enum drm_connector_force force = DRM_FORCE_UNSPECIFIED;
12351252
12361253 #ifdef CONFIG_FB
@@ -1250,7 +1267,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, · 13 unmodified lines
12501267 case '@':
12511268 if (!refresh_specified && !bpp_specified &&
12521269 !yres_specified && !cvt && !rb && was_digit) {
1253− refresh = simple_strtol(&name[i+1], NULL, 10);
1270+ err = kstrtouint(&name[i + 1], 10, &refresh);
1271+ if (err)
1272+ return false;
12541273 refresh_specified = true;
12551274 was_digit = false;
12561275 } else
@@ -1259,7 +1278,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, · 2 unmodified lines
12591278 case '-':
12601279 if (!bpp_specified && !yres_specified && !cvt &&
12611280 !rb && was_digit) {
1262− bpp = simple_strtol(&name[i+1], NULL, 10);
1281+ err = kstrtouint(&name[i + 1], 10, &bpp);
1282+ if (err)
1283+ return false;
12631284 bpp_specified = true;
12641285 was_digit = false;
12651286 } else
@@ -1267,7 +1288,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, · 1 unmodified line
12671288 break;
12681289 case 'x':
12691290 if (!yres_specified && was_digit) {
1270− yres = simple_strtol(&name[i+1], NULL, 10);
1291+ err = kstrtouint(&name[i + 1], 10, &yres);
1292+ if (err)
1293+ return false;
12711294 yres_specified = true;
12721295 was_digit = false;
12731296 } else
@@ -1491,4 +1514,4 @@ int drm_mode_convert_umode(struct drm_display_mode *out, · 217 unmodified lines
14911514
14921515 out:
14931516 return ret;
1494−}
1517+}
drivers/gpu/drm/drm_modeset_lock.c+60−29
@@ -57,11 +57,18 @@ · 56 unmodified lines
5757
5858 /**
5959 * drm_modeset_lock_all - take all modeset locks
60− * @dev: drm device
60+ * @dev: DRM device
6161 *
6262 * This function takes all modeset locks, suitable where a more fine-grained
63− * scheme isn't (yet) implemented. Locks must be dropped with
64− * drm_modeset_unlock_all.
63+ * scheme isn't (yet) implemented. Locks must be dropped by calling the
64+ * drm_modeset_unlock_all() function.
65+ *
66+ * This function is deprecated. It allocates a lock acquisition context and
67+ * stores it in the DRM device's ->mode_config. This facilitate conversion of
68+ * existing code because it removes the need to manually deal with the
69+ * acquisition context, but it is also brittle because the context is global
70+ * and care must be taken not to nest calls. New code should use the
71+ * drm_modeset_lock_all_ctx() function and pass in the context explicitly.
6572 */
6673 void drm_modeset_lock_all(struct drm_device *dev)
6774 {
@@ -78,39 +85,43 @@ void drm_modeset_lock_all(struct drm_device *dev) · 10 unmodified lines
7885 drm_modeset_acquire_init(ctx, 0);
7986
8087 retry:
81− ret = drm_modeset_lock(&config->connection_mutex, ctx);
82− if (ret)
83− goto fail;
84− ret = drm_modeset_lock_all_crtcs(dev, ctx);
85− if (ret)
86− goto fail;
88+ ret = drm_modeset_lock_all_ctx(dev, ctx);
89+ if (ret < 0) {
90+ if (ret == -EDEADLK) {
91+ drm_modeset_backoff(ctx);
92+ goto retry;
93+ }
94+
95+ drm_modeset_acquire_fini(ctx);
96+ kfree(ctx);
97+ return;
98+ }
8799
88100 WARN_ON(config->acquire_ctx);
89101
90− /* now we hold the locks, so now that it is safe, stash the
91− * ctx for drm_modeset_unlock_all():
102+ /*
103+ * We hold the locks now, so it is safe to stash the acquisition
104+ * context for drm_modeset_unlock_all().
92105 */
93106 config->acquire_ctx = ctx;
94107
95108 drm_warn_on_modeset_not_all_locked(dev);
96−
97− return;
98−
99−fail:
100− if (ret == -EDEADLK) {
101− drm_modeset_backoff(ctx);
102− goto retry;
103− }
104−
105− kfree(ctx);
106109 }
107110 EXPORT_SYMBOL(drm_modeset_lock_all);
108111
109112 /**
110113 * drm_modeset_unlock_all - drop all modeset locks
111− * @dev: device
114+ * @dev: DRM device
112115 *
113− * This function drop all modeset locks taken by drm_modeset_lock_all.
116+ * This function drops all modeset locks taken by a previous call to the
117+ * drm_modeset_lock_all() function.
118+ *
119+ * This function is deprecated. It uses the lock acquisition context stored
120+ * in the DRM device's ->mode_config. This facilitates conversion of existing
121+ * code because it removes the need to manually deal with the acquisition
122+ * context, but it is also brittle because the context is global and care must
123+ * be taken not to nest calls. New code should pass the acquisition context
124+ * directly to the drm_modeset_drop_locks() function.
114125 */
115126 void drm_modeset_unlock_all(struct drm_device *dev)
116127 {
@@ -431,14 +442,34 @@ void drm_modeset_unlock(struct drm_modeset_lock *lock) · 314 unmodified lines
431442 }
432443 EXPORT_SYMBOL(drm_modeset_unlock);
433444
434−/* In some legacy codepaths it's convenient to just grab all the crtc and plane
435− * related locks. */
436−int drm_modeset_lock_all_crtcs(struct drm_device *dev,
437− struct drm_modeset_acquire_ctx *ctx)
445+/**
446+ * drm_modeset_lock_all_ctx - take all modeset locks
447+ * @dev: DRM device
448+ * @ctx: lock acquisition context
449+ *
450+ * This function takes all modeset locks, suitable where a more fine-grained
451+ * scheme isn't (yet) implemented.
452+ *
453+ * Unlike drm_modeset_lock_all(), it doesn't take the dev->mode_config.mutex
454+ * since that lock isn't required for modeset state changes. Callers which
455+ * need to grab that lock too need to do so outside of the acquire context
456+ * @ctx.
457+ *
458+ * Locks acquired with this function should be released by calling the
459+ * drm_modeset_drop_locks() function on @ctx.
460+ *
461+ * Returns: 0 on success or a negative error-code on failure.
462+ */
463+int drm_modeset_lock_all_ctx(struct drm_device *dev,
464+ struct drm_modeset_acquire_ctx *ctx)
438465 {
439466 struct drm_crtc *crtc;
440467 struct drm_plane *plane;
441− int ret = 0;
468+ int ret;
469+
470+ ret = drm_modeset_lock(&dev->mode_config.connection_mutex, ctx);
471+ if (ret)
472+ return ret;
442473
443474 drm_for_each_crtc(crtc, dev) {
444475 ret = drm_modeset_lock(&crtc->mutex, ctx);
@@ -454,4 +485,4 @@ int drm_modeset_lock_all_crtcs(struct drm_device *dev, · 9 unmodified lines
454485
455486 return 0;
456487 }
457−EXPORT_SYMBOL(drm_modeset_lock_all_crtcs);
488+EXPORT_SYMBOL(drm_modeset_lock_all_ctx);
drivers/gpu/drm/drm_plane_helper.c+4−0
@@ -164,6 +164,8 @@ int drm_plane_helper_check_update(struct drm_plane *plane, · 163 unmodified lines
164164 vscale = drm_rect_calc_vscale(src, dest, min_scale, max_scale);
165165 if (hscale < 0 || vscale < 0) {
166166 DRM_DEBUG_KMS("Invalid scaling of plane\n");
167+ drm_rect_debug_print("src: ", src, true);
168+ drm_rect_debug_print("dst: ", dest, false);
167169 return -ERANGE;
168170 }
169171
@@ -180,6 +182,8 @@ int drm_plane_helper_check_update(struct drm_plane *plane, · 10 unmodified lines
180182
181183 if (!can_position && !drm_rect_equals(dest, clip)) {
182184 DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
185+ drm_rect_debug_print("dst: ", dest, false);
186+ drm_rect_debug_print("clip: ", clip, false);
183187 return -EINVAL;
184188 }
185189
drivers/gpu/drm/drm_probe_helper.c+24−23
@@ -147,6 +147,8 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect · 146 unmodified lines
147147 list_for_each_entry(mode, &connector->modes, head)
148148 mode->status = MODE_UNVERIFIED;
149149
150+ old_status = connector->status;
151+
150152 if (connector->force) {
151153 if (connector->force == DRM_FORCE_ON ||
152154 connector->force == DRM_FORCE_ON_DIGITAL)
@@ -156,33 +158,32 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect · 3 unmodified lines
156158 if (connector->funcs->force)
157159 connector->funcs->force(connector);
158160 } else {
159− old_status = connector->status;
160−
161161 connector->status = connector->funcs->detect(connector, true);
162+ }
163+
164+ /*
165+ * Normally either the driver's hpd code or the poll loop should
166+ * pick up any changes and fire the hotplug event. But if
167+ * userspace sneaks in a probe, we might miss a change. Hence
168+ * check here, and if anything changed start the hotplug code.
169+ */
170+ if (old_status != connector->status) {
171+ DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
172+ connector->base.id,
173+ connector->name,
174+ drm_get_connector_status_name(old_status),
175+ drm_get_connector_status_name(connector->status));
162176
163177 /*
164− * Normally either the driver's hpd code or the poll loop should
165− * pick up any changes and fire the hotplug event. But if
166− * userspace sneaks in a probe, we might miss a change. Hence
167− * check here, and if anything changed start the hotplug code.
178+ * The hotplug event code might call into the fb
179+ * helpers, and so expects that we do not hold any
180+ * locks. Fire up the poll struct instead, it will
181+ * disable itself again.
168182 */
169− if (old_status != connector->status) {
170− DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
171− connector->base.id,
172− connector->name,
173− old_status, connector->status);
174−
175− /*
176− * The hotplug event code might call into the fb
177− * helpers, and so expects that we do not hold any
178− * locks. Fire up the poll struct instead, it will
179− * disable itself again.
180− */
181− dev->mode_config.delayed_event = true;
182− if (dev->mode_config.poll_enabled)
183− schedule_delayed_work(&dev->mode_config.output_poll_work,
184− 0);
185− }
183+ dev->mode_config.delayed_event = true;
184+ if (dev->mode_config.poll_enabled)
185+ schedule_delayed_work(&dev->mode_config.output_poll_work,
186+ 0);
186187 }
187188
188189 /* Re-enable polling in case the global poll config changed. */
drivers/gpu/drm/drm_rect.c+4−3
@@ -275,22 +275,23 @@ EXPORT_SYMBOL(drm_rect_calc_vscale_relaxed); · 274 unmodified lines
275275
276276 /**
277277 * drm_rect_debug_print - print the rectangle information
278+ * @prefix: prefix string
278279 * @r: rectangle to print
279280 * @fixed_point: rectangle is in 16.16 fixed point format
280281 */
281−void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point)
282+void drm_rect_debug_print(const char *prefix, const struct drm_rect *r, bool fixed_point)
282283 {
283284 int w = drm_rect_width(r);
284285 int h = drm_rect_height(r);
285286
286287 if (fixed_point)
287− DRM_DEBUG_KMS("%d.%06ux%d.%06u%+d.%06u%+d.%06u\n",
288+ DRM_DEBUG_KMS("%s%d.%06ux%d.%06u%+d.%06u%+d.%06u\n", prefix,
288289 w >> 16, ((w & 0xffff) * 15625) >> 10,
289290 h >> 16, ((h & 0xffff) * 15625) >> 10,
290291 r->x1 >> 16, ((r->x1 & 0xffff) * 15625) >> 10,
291292 r->y1 >> 16, ((r->y1 & 0xffff) * 15625) >> 10);
292293 else
293− DRM_DEBUG_KMS("%dx%d%+d%+d\n", w, h, r->x1, r->y1);
294+ DRM_DEBUG_KMS("%s%dx%d%+d%+d\n", prefix, w, h, r->x1, r->y1);
294295 }
295296 EXPORT_SYMBOL(drm_rect_debug_print);
296297
drivers/gpu/drm/drm_sysfs.c+25−29
@@ -167,47 +167,35 @@ static ssize_t status_store(struct device *device, · 166 unmodified lines
167167 {
168168 struct drm_connector *connector = to_drm_connector(device);
169169 struct drm_device *dev = connector->dev;
170− enum drm_connector_status old_status;
170+ enum drm_connector_force old_force;
171171 int ret;
172172
173173 ret = mutex_lock_interruptible(&dev->mode_config.mutex);
174174 if (ret)
175175 return ret;
176176
177− old_status = connector->status;
177+ old_force = connector->force;
178178
179− if (sysfs_streq(buf, "detect")) {
179+ if (sysfs_streq(buf, "detect"))
180180 connector->force = 0;
181− connector->status = connector->funcs->detect(connector, true);
182− } else if (sysfs_streq(buf, "on")) {
181+ else if (sysfs_streq(buf, "on"))
183182 connector->force = DRM_FORCE_ON;
184− } else if (sysfs_streq(buf, "on-digital")) {
183+ else if (sysfs_streq(buf, "on-digital"))
185184 connector->force = DRM_FORCE_ON_DIGITAL;
186− } else if (sysfs_streq(buf, "off")) {
185+ else if (sysfs_streq(buf, "off"))
187186 connector->force = DRM_FORCE_OFF;
188− } else
187+ else
189188 ret = -EINVAL;
190189
191− if (ret == 0 && connector->force) {
192− if (connector->force == DRM_FORCE_ON ||
193− connector->force == DRM_FORCE_ON_DIGITAL)
194− connector->status = connector_status_connected;
195− else
196− connector->status = connector_status_disconnected;
197− if (connector->funcs->force)
198− connector->funcs->force(connector);
199− }
200−
201− if (old_status != connector->status) {
202− DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
190+ if (old_force != connector->force || !connector->force) {
191+ DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force updated from %d to %d or reprobing\n",
203192 connector->base.id,
204193 connector->name,
205− old_status, connector->status);
194+ old_force, connector->force);
206195
207− dev->mode_config.delayed_event = true;
208− if (dev->mode_config.poll_enabled)
209− schedule_delayed_work(&dev->mode_config.output_poll_work,
210− 0);
196+ connector->funcs->fill_modes(connector,
197+ dev->mode_config.max_width,
198+ dev->mode_config.max_height);
211199 }
212200
213201 mutex_unlock(&dev->mode_config.mutex);
@@ -256,23 +244,29 @@ static ssize_t edid_show(struct file *filp, struct kobject *kobj, · 42 unmodified lines
256244 struct drm_connector *connector = to_drm_connector(connector_dev);
257245 unsigned char *edid;
258246 size_t size;
247+ ssize_t ret = 0;
259248
249+ mutex_lock(&connector->dev->mode_config.mutex);
260250 if (!connector->edid_blob_ptr)
261− return 0;
251+ goto unlock;
262252
263253 edid = connector->edid_blob_ptr->data;
264254 size = connector->edid_blob_ptr->length;
265255 if (!edid)
266− return 0;
256+ goto unlock;
267257
268258 if (off >= size)
269− return 0;
259+ goto unlock;
270260
271261 if (off + count > size)
272262 count = size - off;
273263 memcpy(buf, edid + off, count);
274264
275− return count;
265+ ret = count;
266+unlock:
267+ mutex_unlock(&connector->dev->mode_config.mutex);
268+
269+ return ret;
276270 }
277271
278272 static ssize_t modes_show(struct device *device,
@@ -283,10 +277,12 @@ static ssize_t modes_show(struct device *device, · 4 unmodified lines
283277 struct drm_display_mode *mode;
284278 int written = 0;
285279
280+ mutex_lock(&connector->dev->mode_config.mutex);
286281 list_for_each_entry(mode, &connector->modes, head) {
287282 written += snprintf(buf + written, PAGE_SIZE - written, "%s\n",
288283 mode->name);
289284 }
285+ mutex_unlock(&connector->dev->mode_config.mutex);
290286
291287 return written;
292288 }
drivers/gpu/drm/exynos/exynos_drm_fb.c+2−2
@@ -117,7 +117,7 @@ static struct drm_framebuffer_funcs exynos_drm_fb_funcs = { · 116 unmodified lines
117117
118118 struct drm_framebuffer *
119119 exynos_drm_framebuffer_init(struct drm_device *dev,
120− struct drm_mode_fb_cmd2 *mode_cmd,
120+ const struct drm_mode_fb_cmd2 *mode_cmd,
121121 struct exynos_drm_gem **exynos_gem,
122122 int count)
123123 {
@@ -154,7 +154,7 @@ err: · 30 unmodified lines
154154
155155 static struct drm_framebuffer *
156156 exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
157− struct drm_mode_fb_cmd2 *mode_cmd)
157+ const struct drm_mode_fb_cmd2 *mode_cmd)
158158 {
159159 struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER];
160160 struct drm_gem_object *obj;
drivers/gpu/drm/exynos/exynos_drm_fb.h+1−1
@@ -18,7 +18,7 @@ · 17 unmodified lines
1818
1919 struct drm_framebuffer *
2020 exynos_drm_framebuffer_init(struct drm_device *dev,
21− struct drm_mode_fb_cmd2 *mode_cmd,
21+ const struct drm_mode_fb_cmd2 *mode_cmd,
2222 struct exynos_drm_gem **exynos_gem,
2323 int count);
2424
drivers/gpu/drm/gma500/framebuffer.c+5−13
@@ -241,7 +241,7 @@ static struct fb_ops psbfb_unaccel_ops = { · 240 unmodified lines
241241 */
242242 static int psb_framebuffer_init(struct drm_device *dev,
243243 struct psb_framebuffer *fb,
244− struct drm_mode_fb_cmd2 *mode_cmd,
244+ const struct drm_mode_fb_cmd2 *mode_cmd,
245245 struct gtt_range *gt)
246246 {
247247 u32 bpp, depth;
@@ -284,7 +284,7 @@ static int psb_framebuffer_init(struct drm_device *dev, · 36 unmodified lines
284284
285285 static struct drm_framebuffer *psb_framebuffer_create
286286 (struct drm_device *dev,
287− struct drm_mode_fb_cmd2 *mode_cmd,
287+ const struct drm_mode_fb_cmd2 *mode_cmd,
288288 struct gtt_range *gt)
289289 {
290290 struct psb_framebuffer *fb;
@@ -406,8 +406,6 @@ static int psbfb_create(struct psb_fbdev *fbdev, · 115 unmodified lines
406406
407407 memset(dev_priv->vram_addr + backing->offset, 0, size);
408408
409− mutex_lock(&dev->struct_mutex);
410−
411409 info = drm_fb_helper_alloc_fbi(&fbdev->psb_fb_helper);
412410 if (IS_ERR(info)) {
413411 ret = PTR_ERR(info);
@@ -463,17 +461,15 @@ static int psbfb_create(struct psb_fbdev *fbdev, · 49 unmodified lines
463461 dev_dbg(dev->dev, "allocated %dx%d fb\n",
464462 psbfb->base.width, psbfb->base.height);
465463
466− mutex_unlock(&dev->struct_mutex);
467464 return 0;
468465 out_unref:
469466 if (backing->stolen)
470467 psb_gtt_free_range(dev, backing);
471468 else
472− drm_gem_object_unreference(&backing->gem);
469+ drm_gem_object_unreference_unlocked(&backing->gem);
473470
474471 drm_fb_helper_release_fbi(&fbdev->psb_fb_helper);
475472 out_err1:
476− mutex_unlock(&dev->struct_mutex);
477473 psb_gtt_free_range(dev, backing);
478474 return ret;
479475 }
@@ -488,7 +484,7 @@ out_err1: · 8 unmodified lines
488484 */
489485 static struct drm_framebuffer *psb_user_framebuffer_create
490486 (struct drm_device *dev, struct drm_file *filp,
491− struct drm_mode_fb_cmd2 *cmd)
487+ const struct drm_mode_fb_cmd2 *cmd)
492488 {
493489 struct gtt_range *r;
494490 struct drm_gem_object *obj;
@@ -569,7 +565,7 @@ static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev) · 74 unmodified lines
569565 drm_framebuffer_cleanup(&psbfb->base);
570566
571567 if (psbfb->gtt)
572− drm_gem_object_unreference(&psbfb->gtt->gem);
568+ drm_gem_object_unreference_unlocked(&psbfb->gtt->gem);
573569 return 0;
574570 }
575571
@@ -784,12 +780,8 @@ void psb_modeset_cleanup(struct drm_device *dev) · 208 unmodified lines
784780 {
785781 struct drm_psb_private *dev_priv = dev->dev_private;
786782 if (dev_priv->modeset) {
787− mutex_lock(&dev->struct_mutex);
788−
789783 drm_kms_helper_poll_fini(dev);
790784 psb_fbdev_fini(dev);
791785 drm_mode_config_cleanup(dev);
792−
793− mutex_unlock(&dev->struct_mutex);
794786 }
795787 }
drivers/gpu/drm/gma500/gem.c+6−13
@@ -62,15 +62,10 @@ int psb_gem_dumb_map_gtt(struct drm_file *file, struct drm_device *dev, · 61 unmodified lines
6262 int ret = 0;
6363 struct drm_gem_object *obj;
6464
65− mutex_lock(&dev->struct_mutex);
66−
6765 /* GEM does all our handle to object mapping */
6866 obj = drm_gem_object_lookup(dev, file, handle);
69− if (obj == NULL) {
70− ret = -ENOENT;
71− goto unlock;
72− }
73− /* What validation is needed here ? */
67+ if (obj == NULL)
68+ return -ENOENT;
7469
7570 /* Make it mmapable */
7671 ret = drm_gem_create_mmap_offset(obj);
@@ -78,9 +73,7 @@ int psb_gem_dumb_map_gtt(struct drm_file *file, struct drm_device *dev, · 1 unmodified line
7873 goto out;
7974 *offset = drm_vma_node_offset_addr(&obj->vma_node);
8075 out:
81− drm_gem_object_unreference(obj);
82−unlock:
83− mutex_unlock(&dev->struct_mutex);
76+ drm_gem_object_unreference_unlocked(obj);
8477 return ret;
8578 }
8679
@@ -130,7 +123,7 @@ int psb_gem_create(struct drm_file *file, struct drm_device *dev, u64 size, · 43 unmodified lines
130123 return ret;
131124 }
132125 /* We have the initial and handle reference but need only one now */
133− drm_gem_object_unreference(&r->gem);
126+ drm_gem_object_unreference_unlocked(&r->gem);
134127 *handlep = handle;
135128 return 0;
136129 }
@@ -189,7 +182,7 @@ int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) · 52 unmodified lines
189182
190183 /* Make sure we don't parallel update on a fault, nor move or remove
191184 something from beneath our feet */
192− mutex_lock(&dev->struct_mutex);
185+ mutex_lock(&dev_priv->mmap_mutex);
193186
194187 /* For now the mmap pins the object and it stays pinned. As things
195188 stand that will do us no harm */
@@ -215,7 +208,7 @@ int psb_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) · 19 unmodified lines
215208 ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
216209
217210 fail:
218− mutex_unlock(&dev->struct_mutex);
211+ mutex_unlock(&dev_priv->mmap_mutex);
219212 switch (ret) {
220213 case 0:
221214 case -ERESTARTSYS:
drivers/gpu/drm/gma500/gma_display.c+3−10
@@ -349,8 +349,6 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, · 348 unmodified lines
349349 /* If we didn't get a handle then turn the cursor off */
350350 if (!handle) {
351351 temp = CURSOR_MODE_DISABLE;
352− mutex_lock(&dev->struct_mutex);
353−
354352 if (gma_power_begin(dev, false)) {
355353 REG_WRITE(control, temp);
356354 REG_WRITE(base, 0);
@@ -362,11 +360,9 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, · 5 unmodified lines
362360 gt = container_of(gma_crtc->cursor_obj,
363361 struct gtt_range, gem);
364362 psb_gtt_unpin(gt);
365− drm_gem_object_unreference(gma_crtc->cursor_obj);
363+ drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj);
366364 gma_crtc->cursor_obj = NULL;
367365 }
368−
369− mutex_unlock(&dev->struct_mutex);
370366 return 0;
371367 }
372368
@@ -376,7 +372,6 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, · 3 unmodified lines
376372 return -EINVAL;
377373 }
378374
379− mutex_lock(&dev->struct_mutex);
380375 obj = drm_gem_object_lookup(dev, file_priv, handle);
381376 if (!obj) {
382377 ret = -ENOENT;
@@ -441,17 +436,15 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, · 58 unmodified lines
441436 if (gma_crtc->cursor_obj) {
442437 gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem);
443438 psb_gtt_unpin(gt);
444− drm_gem_object_unreference(gma_crtc->cursor_obj);
439+ drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj);
445440 }
446441
447442 gma_crtc->cursor_obj = obj;
448443 unlock:
449− mutex_unlock(&dev->struct_mutex);
450444 return ret;
451445
452446 unref_cursor:
453− drm_gem_object_unreference(obj);
454− mutex_unlock(&dev->struct_mutex);
447+ drm_gem_object_unreference_unlocked(obj);
455448 return ret;
456449 }
457450
drivers/gpu/drm/gma500/gtt.c+1−0
@@ -425,6 +425,7 @@ int psb_gtt_init(struct drm_device *dev, int resume) · 424 unmodified lines
425425
426426 if (!resume) {
427427 mutex_init(&dev_priv->gtt_mutex);
428+ mutex_init(&dev_priv->mmap_mutex);
428429 psb_gtt_alloc(dev);
429430 }
430431
drivers/gpu/drm/gma500/psb_drv.h+2−0
@@ -465,6 +465,8 @@ struct drm_psb_private { · 464 unmodified lines
465465 struct mutex gtt_mutex;
466466 struct resource *gtt_mem; /* Our PCI resource */
467467
468+ struct mutex mmap_mutex;
469+
468470 struct psb_mmu_driver *mmu;
469471 struct psb_mmu_pd *pf_pd;
470472
drivers/gpu/drm/i915/Kconfig+1−0
@@ -10,6 +10,7 @@ config DRM_I915 · 9 unmodified lines
1010 # the shmem_readpage() which depends upon tmpfs
1111 select SHMEM
1212 select TMPFS
13+ select STOP_MACHINE
1314 select DRM_KMS_HELPER
1415 select DRM_PANEL
1516 select DRM_MIPI_DSI
drivers/gpu/drm/i915/Makefile+1−0
@@ -77,6 +77,7 @@ i915-y += dvo_ch7017.o \ · 76 unmodified lines
7777 dvo_tfp410.o \
7878 intel_crt.o \
7979 intel_ddi.o \
80+ intel_dp_link_training.o \
8081 intel_dp_mst.o \
8182 intel_dp.o \
8283 intel_dsi.o \
drivers/gpu/drm/i915/dvo.h+2−1
@@ -32,7 +32,8 @@ struct intel_dvo_device { · 31 unmodified lines
3232 const char *name;
3333 int type;
3434 /* DVOA/B/C output register */
35− u32 dvo_reg;
35+ i915_reg_t dvo_reg;
36+ i915_reg_t dvo_srcdim_reg;
3637 /* GPIO register used for i2c bus to control this device */
3738 u32 gpio;
3839 int slave_addr;
drivers/gpu/drm/i915/i915_cmd_parser.c+21−16
@@ -407,14 +407,14 @@ static const struct drm_i915_cmd_table hsw_blt_ring_cmds[] = { · 406 unmodified lines
407407 * LRI.
408408 */
409409 struct drm_i915_reg_descriptor {
410− u32 addr;
410+ i915_reg_t addr;
411411 u32 mask;
412412 u32 value;
413413 };
414414
415415 /* Convenience macro for adding 32-bit registers. */
416−#define REG32(address, ...) \
417− { .addr = address, __VA_ARGS__ }
416+#define REG32(_reg, ...) \
417+ { .addr = (_reg), __VA_ARGS__ }
418418
419419 /*
420420 * Convenience macro for adding 64-bit registers.
@@ -423,8 +423,13 @@ struct drm_i915_reg_descriptor { · 2 unmodified lines
423423 * access commands only allow 32-bit accesses. Hence, we have to include
424424 * entries for both halves of the 64-bit registers.
425425 */
426−#define REG64(addr) \
427− REG32(addr), REG32(addr + sizeof(u32))
426+#define REG64(_reg) \
427+ { .addr = _reg }, \
428+ { .addr = _reg ## _UDW }
429+
430+#define REG64_IDX(_reg, idx) \
431+ { .addr = _reg(idx) }, \
432+ { .addr = _reg ## _UDW(idx) }
428433
429434 static const struct drm_i915_reg_descriptor gen7_render_regs[] = {
430435 REG64(GPGPU_THREADS_DISPATCHED),
@@ -451,14 +456,14 @@ static const struct drm_i915_reg_descriptor gen7_render_regs[] = { · 20 unmodified lines
451456 REG32(GEN7_GPGPU_DISPATCHDIMX),
452457 REG32(GEN7_GPGPU_DISPATCHDIMY),
453458 REG32(GEN7_GPGPU_DISPATCHDIMZ),
454− REG64(GEN7_SO_NUM_PRIMS_WRITTEN(0)),
455− REG64(GEN7_SO_NUM_PRIMS_WRITTEN(1)),
456− REG64(GEN7_SO_NUM_PRIMS_WRITTEN(2)),
457− REG64(GEN7_SO_NUM_PRIMS_WRITTEN(3)),
458− REG64(GEN7_SO_PRIM_STORAGE_NEEDED(0)),
459− REG64(GEN7_SO_PRIM_STORAGE_NEEDED(1)),
460− REG64(GEN7_SO_PRIM_STORAGE_NEEDED(2)),
461− REG64(GEN7_SO_PRIM_STORAGE_NEEDED(3)),
459+ REG64_IDX(GEN7_SO_NUM_PRIMS_WRITTEN, 0),
460+ REG64_IDX(GEN7_SO_NUM_PRIMS_WRITTEN, 1),
461+ REG64_IDX(GEN7_SO_NUM_PRIMS_WRITTEN, 2),
462+ REG64_IDX(GEN7_SO_NUM_PRIMS_WRITTEN, 3),
463+ REG64_IDX(GEN7_SO_PRIM_STORAGE_NEEDED, 0),
464+ REG64_IDX(GEN7_SO_PRIM_STORAGE_NEEDED, 1),
465+ REG64_IDX(GEN7_SO_PRIM_STORAGE_NEEDED, 2),
466+ REG64_IDX(GEN7_SO_PRIM_STORAGE_NEEDED, 3),
462467 REG32(GEN7_SO_WRITE_OFFSET(0)),
463468 REG32(GEN7_SO_WRITE_OFFSET(1)),
464469 REG32(GEN7_SO_WRITE_OFFSET(2)),
@@ -592,7 +597,7 @@ static bool check_sorted(int ring_id, · 127 unmodified lines
592597 bool ret = true;
593598
594599 for (i = 0; i < reg_count; i++) {
595− u32 curr = reg_table[i].addr;
600+ u32 curr = i915_mmio_reg_offset(reg_table[i].addr);
596601
597602 if (curr < previous) {
598603 DRM_ERROR("CMD: table not sorted ring=%d entry=%d reg=0x%08X prev=0x%08X\n",
@@ -847,7 +852,7 @@ find_reg(const struct drm_i915_reg_descriptor *table, · 248 unmodified lines
847852 int i;
848853
849854 for (i = 0; i < count; i++) {
850− if (table[i].addr == addr)
855+ if (i915_mmio_reg_offset(table[i].addr) == addr)
851856 return &table[i];
852857 }
853858 }
@@ -1023,7 +1028,7 @@ static bool check_cmd(const struct intel_engine_cs *ring, · 169 unmodified lines
10231028 * to the register. Hence, limit OACONTROL writes to
10241029 * only MI_LOAD_REGISTER_IMM commands.
10251030 */
1026− if (reg_addr == OACONTROL) {
1031+ if (reg_addr == i915_mmio_reg_offset(OACONTROL)) {
10271032 if (desc->cmd.value == MI_LOAD_REGISTER_MEM) {
10281033 DRM_DEBUG_DRIVER("CMD: Rejected LRM to OACONTROL\n");
10291034 return false;
drivers/gpu/drm/i915/i915_debugfs.c+201−43
@@ -1252,18 +1252,21 @@ static int i915_frequency_info(struct seq_file *m, void *unused) · 1251 unmodified lines
12521252
12531253 max_freq = (IS_BROXTON(dev) ? rp_state_cap >> 0 :
12541254 rp_state_cap >> 16) & 0xff;
1255− max_freq *= (IS_SKYLAKE(dev) ? GEN9_FREQ_SCALER : 1);
1255+ max_freq *= (IS_SKYLAKE(dev) || IS_KABYLAKE(dev) ?
1256+ GEN9_FREQ_SCALER : 1);
12561257 seq_printf(m, "Lowest (RPN) frequency: %dMHz\n",
12571258 intel_gpu_freq(dev_priv, max_freq));
12581259
12591260 max_freq = (rp_state_cap & 0xff00) >> 8;
1260− max_freq *= (IS_SKYLAKE(dev) ? GEN9_FREQ_SCALER : 1);
1261+ max_freq *= (IS_SKYLAKE(dev) || IS_KABYLAKE(dev) ?
1262+ GEN9_FREQ_SCALER : 1);
12611263 seq_printf(m, "Nominal (RP1) frequency: %dMHz\n",
12621264 intel_gpu_freq(dev_priv, max_freq));
12631265
12641266 max_freq = (IS_BROXTON(dev) ? rp_state_cap >> 16 :
12651267 rp_state_cap >> 0) & 0xff;
1266− max_freq *= (IS_SKYLAKE(dev) ? GEN9_FREQ_SCALER : 1);
1268+ max_freq *= (IS_SKYLAKE(dev) || IS_KABYLAKE(dev) ?
1269+ GEN9_FREQ_SCALER : 1);
12671270 seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n",
12681271 intel_gpu_freq(dev_priv, max_freq));
12691272 seq_printf(m, "Max overclocked frequency: %dMHz\n",
@@ -1523,7 +1526,7 @@ static int gen6_drpc_info(struct seq_file *m) · 253 unmodified lines
15231526 seq_printf(m, "RC information accurate: %s\n", yesno(count < 51));
15241527 }
15251528
1526− gt_core_status = readl(dev_priv->regs + GEN6_GT_CORE_STATUS);
1529+ gt_core_status = I915_READ_FW(GEN6_GT_CORE_STATUS);
15271530 trace_i915_reg_rw(false, GEN6_GT_CORE_STATUS, gt_core_status, 4, true);
15281531
15291532 rpmodectl1 = I915_READ(GEN6_RP_CONTROL);
@@ -1640,7 +1643,7 @@ static int i915_fbc_status(struct seq_file *m, void *unused) · 110 unmodified lines
16401643 seq_puts(m, "FBC enabled\n");
16411644 else
16421645 seq_printf(m, "FBC disabled: %s\n",
1643− intel_no_fbc_reason_str(dev_priv->fbc.no_fbc_reason));
1646+ dev_priv->fbc.no_fbc_reason);
16441647
16451648 if (INTEL_INFO(dev_priv)->gen >= 7)
16461649 seq_printf(m, "Compressing: %s\n",
@@ -1801,7 +1804,7 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused) · 154 unmodified lines
18011804 if (ret)
18021805 goto out;
18031806
1804− if (IS_SKYLAKE(dev)) {
1807+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
18051808 /* Convert GT frequency to 50 HZ units */
18061809 min_gpu_freq =
18071810 dev_priv->rps.min_freq_softlimit / GEN9_FREQ_SCALER;
@@ -1821,7 +1824,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused) · 13 unmodified lines
18211824 &ia_freq);
18221825 seq_printf(m, "%d\t\t%d\t\t\t\t%d\n",
18231826 intel_gpu_freq(dev_priv, (gpu_freq *
1824− (IS_SKYLAKE(dev) ? GEN9_FREQ_SCALER : 1))),
1827+ (IS_SKYLAKE(dev) || IS_KABYLAKE(dev) ?
1828+ GEN9_FREQ_SCALER : 1))),
18251829 ((ia_freq >> 0) & 0xff) * 100,
18261830 ((ia_freq >> 8) & 0xff) * 100);
18271831 }
@@ -1873,17 +1877,19 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data) · 45 unmodified lines
18731877 struct drm_i915_private *dev_priv = dev->dev_private;
18741878
18751879 ifbdev = dev_priv->fbdev;
1876− fb = to_intel_framebuffer(ifbdev->helper.fb);
1877−
1878− seq_printf(m, "fbcon size: %d x %d, depth %d, %d bpp, modifier 0x%llx, refcount %d, obj ",
1879− fb->base.width,
1880− fb->base.height,
1881− fb->base.depth,
1882− fb->base.bits_per_pixel,
1883− fb->base.modifier[0],
1884− atomic_read(&fb->base.refcount.refcount));
1885− describe_obj(m, fb->obj);
1886− seq_putc(m, '\n');
1880+ if (ifbdev) {
1881+ fb = to_intel_framebuffer(ifbdev->helper.fb);
1882+
1883+ seq_printf(m, "fbcon size: %d x %d, depth %d, %d bpp, modifier 0x%llx, refcount %d, obj ",
1884+ fb->base.width,
1885+ fb->base.height,
1886+ fb->base.depth,
1887+ fb->base.bits_per_pixel,
1888+ fb->base.modifier[0],
1889+ atomic_read(&fb->base.refcount.refcount));
1890+ describe_obj(m, fb->obj);
1891+ seq_putc(m, '\n');
1892+ }
18871893 #endif
18881894
18891895 mutex_lock(&dev->mode_config.fb_lock);
@@ -2402,6 +2408,12 @@ static int i915_guc_load_status_info(struct seq_file *m, void *data) · 512 unmodified lines
24022408 guc_fw->guc_fw_major_wanted, guc_fw->guc_fw_minor_wanted);
24032409 seq_printf(m, "\tversion found: %d.%d\n",
24042410 guc_fw->guc_fw_major_found, guc_fw->guc_fw_minor_found);
2411+ seq_printf(m, "\theader: offset is %d; size = %d\n",
2412+ guc_fw->header_offset, guc_fw->header_size);
2413+ seq_printf(m, "\tuCode: offset is %d; size = %d\n",
2414+ guc_fw->ucode_offset, guc_fw->ucode_size);
2415+ seq_printf(m, "\tRSA: offset is %d; size = %d\n",
2416+ guc_fw->rsa_offset, guc_fw->rsa_size);
24052417
24062418 tmp = I915_READ(GUC_STATUS);
24072419
@@ -2550,7 +2562,7 @@ static int i915_edp_psr_status(struct seq_file *m, void *data) · 142 unmodified lines
25502562 yesno(work_busy(&dev_priv->psr.work.work)));
25512563
25522564 if (HAS_DDI(dev))
2553− enabled = I915_READ(EDP_PSR_CTL(dev)) & EDP_PSR_ENABLE;
2565+ enabled = I915_READ(EDP_PSR_CTL) & EDP_PSR_ENABLE;
25542566 else {
25552567 for_each_pipe(dev_priv, pipe) {
25562568 stat[pipe] = I915_READ(VLV_PSRSTAT(pipe)) &
@@ -2572,7 +2584,7 @@ static int i915_edp_psr_status(struct seq_file *m, void *data) · 15 unmodified lines
25722584
25732585 /* CHV PSR has no kind of performance counter */
25742586 if (HAS_DDI(dev)) {
2575− psrperf = I915_READ(EDP_PSR_PERF_CNT(dev)) &
2587+ psrperf = I915_READ(EDP_PSR_PERF_CNT) &
25762588 EDP_PSR_PERF_CNT_MASK;
25772589
25782590 seq_printf(m, "Performance_Counter: %u\n", psrperf);
@@ -2696,24 +2708,16 @@ static const char *power_domain_str(enum intel_display_power_domain domain) · 117 unmodified lines
26962708 return "TRANSCODER_C";
26972709 case POWER_DOMAIN_TRANSCODER_EDP:
26982710 return "TRANSCODER_EDP";
2699− case POWER_DOMAIN_PORT_DDI_A_2_LANES:
2700− return "PORT_DDI_A_2_LANES";
2701− case POWER_DOMAIN_PORT_DDI_A_4_LANES:
2702− return "PORT_DDI_A_4_LANES";
2703− case POWER_DOMAIN_PORT_DDI_B_2_LANES:
2704− return "PORT_DDI_B_2_LANES";
2705− case POWER_DOMAIN_PORT_DDI_B_4_LANES:
2706− return "PORT_DDI_B_4_LANES";
2707− case POWER_DOMAIN_PORT_DDI_C_2_LANES:
2708− return "PORT_DDI_C_2_LANES";
2709− case POWER_DOMAIN_PORT_DDI_C_4_LANES:
2710− return "PORT_DDI_C_4_LANES";
2711− case POWER_DOMAIN_PORT_DDI_D_2_LANES:
2712− return "PORT_DDI_D_2_LANES";
2713− case POWER_DOMAIN_PORT_DDI_D_4_LANES:
2714− return "PORT_DDI_D_4_LANES";
2715− case POWER_DOMAIN_PORT_DDI_E_2_LANES:
2716− return "PORT_DDI_E_2_LANES";
2711+ case POWER_DOMAIN_PORT_DDI_A_LANES:
2712+ return "PORT_DDI_A_LANES";
2713+ case POWER_DOMAIN_PORT_DDI_B_LANES:
2714+ return "PORT_DDI_B_LANES";
2715+ case POWER_DOMAIN_PORT_DDI_C_LANES:
2716+ return "PORT_DDI_C_LANES";
2717+ case POWER_DOMAIN_PORT_DDI_D_LANES:
2718+ return "PORT_DDI_D_LANES";
2719+ case POWER_DOMAIN_PORT_DDI_E_LANES:
2720+ return "PORT_DDI_E_LANES";
27172721 case POWER_DOMAIN_PORT_DSI:
27182722 return "PORT_DSI";
27192723 case POWER_DOMAIN_PORT_CRT:
@@ -2736,6 +2740,8 @@ static const char *power_domain_str(enum intel_display_power_domain domain) · 16 unmodified lines
27362740 return "AUX_D";
27372741 case POWER_DOMAIN_GMBUS:
27382742 return "GMBUS";
2743+ case POWER_DOMAIN_MODESET:
2744+ return "MODESET";
27392745 case POWER_DOMAIN_INIT:
27402746 return "INIT";
27412747 default:
@@ -2779,6 +2785,51 @@ static int i915_power_domain_info(struct seq_file *m, void *unused) · 37 unmodified lines
27792785 return 0;
27802786 }
27812787
2788+static int i915_dmc_info(struct seq_file *m, void *unused)
2789+{
2790+ struct drm_info_node *node = m->private;
2791+ struct drm_device *dev = node->minor->dev;
2792+ struct drm_i915_private *dev_priv = dev->dev_private;
2793+ struct intel_csr *csr;
2794+
2795+ if (!HAS_CSR(dev)) {
2796+ seq_puts(m, "not supported\n");
2797+ return 0;
2798+ }
2799+
2800+ csr = &dev_priv->csr;
2801+
2802+ intel_runtime_pm_get(dev_priv);
2803+
2804+ seq_printf(m, "fw loaded: %s\n", yesno(csr->dmc_payload != NULL));
2805+ seq_printf(m, "path: %s\n", csr->fw_path);
2806+
2807+ if (!csr->dmc_payload)
2808+ goto out;
2809+
2810+ seq_printf(m, "version: %d.%d\n", CSR_VERSION_MAJOR(csr->version),
2811+ CSR_VERSION_MINOR(csr->version));
2812+
2813+ if (IS_SKYLAKE(dev) && csr->version >= CSR_VERSION(1, 6)) {
2814+ seq_printf(m, "DC3 -> DC5 count: %d\n",
2815+ I915_READ(SKL_CSR_DC3_DC5_COUNT));
2816+ seq_printf(m, "DC5 -> DC6 count: %d\n",
2817+ I915_READ(SKL_CSR_DC5_DC6_COUNT));
2818+ } else if (IS_BROXTON(dev) && csr->version >= CSR_VERSION(1, 4)) {
2819+ seq_printf(m, "DC3 -> DC5 count: %d\n",
2820+ I915_READ(BXT_CSR_DC3_DC5_COUNT));
2821+ }
2822+
2823+out:
2824+ seq_printf(m, "program base: 0x%08x\n", I915_READ(CSR_PROGRAM(0)));
2825+ seq_printf(m, "ssp base: 0x%08x\n", I915_READ(CSR_SSP_BASE));
2826+ seq_printf(m, "htp: 0x%08x\n", I915_READ(CSR_HTP_SKL));
2827+
2828+ intel_runtime_pm_put(dev_priv);
2829+
2830+ return 0;
2831+}
2832+
27822833 static void intel_seq_print_mode(struct seq_file *m, int tabs,
27832834 struct drm_display_mode *mode)
27842835 {
@@ -2946,6 +2997,107 @@ static bool cursor_position(struct drm_device *dev, int pipe, int *x, int *y) · 161 unmodified lines
29462997 return cursor_active(dev, pipe);
29472998 }
29482999
3000+static const char *plane_type(enum drm_plane_type type)
3001+{
3002+ switch (type) {
3003+ case DRM_PLANE_TYPE_OVERLAY:
3004+ return "OVL";
3005+ case DRM_PLANE_TYPE_PRIMARY:
3006+ return "PRI";
3007+ case DRM_PLANE_TYPE_CURSOR:
3008+ return "CUR";
3009+ /*
3010+ * Deliberately omitting default: to generate compiler warnings
3011+ * when a new drm_plane_type gets added.
3012+ */
3013+ }
3014+
3015+ return "unknown";
3016+}
3017+
3018+static const char *plane_rotation(unsigned int rotation)
3019+{
3020+ static char buf[48];
3021+ /*
3022+ * According to doc only one DRM_ROTATE_ is allowed but this
3023+ * will print them all to visualize if the values are misused
3024+ */
3025+ snprintf(buf, sizeof(buf),
3026+ "%s%s%s%s%s%s(0x%08x)",
3027+ (rotation & BIT(DRM_ROTATE_0)) ? "0 " : "",
3028+ (rotation & BIT(DRM_ROTATE_90)) ? "90 " : "",
3029+ (rotation & BIT(DRM_ROTATE_180)) ? "180 " : "",
3030+ (rotation & BIT(DRM_ROTATE_270)) ? "270 " : "",
3031+ (rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "",
3032+ (rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "",
3033+ rotation);
3034+
3035+ return buf;
3036+}
3037+
3038+static void intel_plane_info(struct seq_file *m, struct intel_crtc *intel_crtc)
3039+{
3040+ struct drm_info_node *node = m->private;
3041+ struct drm_device *dev = node->minor->dev;
3042+ struct intel_plane *intel_plane;
3043+
3044+ for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
3045+ struct drm_plane_state *state;
3046+ struct drm_plane *plane = &intel_plane->base;
3047+
3048+ if (!plane->state) {
3049+ seq_puts(m, "plane->state is NULL!\n");
3050+ continue;
3051+ }
3052+
3053+ state = plane->state;
3054+
3055+ seq_printf(m, "\t--Plane id %d: type=%s, crtc_pos=%4dx%4d, crtc_size=%4dx%4d, src_pos=%d.%04ux%d.%04u, src_size=%d.%04ux%d.%04u, format=%s, rotation=%s\n",
3056+ plane->base.id,
3057+ plane_type(intel_plane->base.type),
3058+ state->crtc_x, state->crtc_y,
3059+ state->crtc_w, state->crtc_h,
3060+ (state->src_x >> 16),
3061+ ((state->src_x & 0xffff) * 15625) >> 10,
3062+ (state->src_y >> 16),
3063+ ((state->src_y & 0xffff) * 15625) >> 10,
3064+ (state->src_w >> 16),
3065+ ((state->src_w & 0xffff) * 15625) >> 10,
3066+ (state->src_h >> 16),
3067+ ((state->src_h & 0xffff) * 15625) >> 10,
3068+ state->fb ? drm_get_format_name(state->fb->pixel_format) : "N/A",
3069+ plane_rotation(state->rotation));
3070+ }
3071+}
3072+
3073+static void intel_scaler_info(struct seq_file *m, struct intel_crtc *intel_crtc)
3074+{
3075+ struct intel_crtc_state *pipe_config;
3076+ int num_scalers = intel_crtc->num_scalers;
3077+ int i;
3078+
3079+ pipe_config = to_intel_crtc_state(intel_crtc->base.state);
3080+
3081+ /* Not all platformas have a scaler */
3082+ if (num_scalers) {
3083+ seq_printf(m, "\tnum_scalers=%d, scaler_users=%x scaler_id=%d",
3084+ num_scalers,
3085+ pipe_config->scaler_state.scaler_users,
3086+ pipe_config->scaler_state.scaler_id);
3087+
3088+ for (i = 0; i < SKL_NUM_SCALERS; i++) {
3089+ struct intel_scaler *sc =
3090+ &pipe_config->scaler_state.scalers[i];
3091+
3092+ seq_printf(m, ", scalers[%d]: use=%s, mode=%x",
3093+ i, yesno(sc->in_use), sc->mode);
3094+ }
3095+ seq_puts(m, "\n");
3096+ } else {
3097+ seq_puts(m, "\tNo scalers available on this platform\n");
3098+ }
3099+}
3100+
29493101 static int i915_display_info(struct seq_file *m, void *unused)
29503102 {
29513103 struct drm_info_node *node = m->private;
@@ -2965,10 +3117,12 @@ static int i915_display_info(struct seq_file *m, void *unused) · 13 unmodified lines
29653117
29663118 pipe_config = to_intel_crtc_state(crtc->base.state);
29673119
2968− seq_printf(m, "CRTC %d: pipe: %c, active=%s (size=%dx%d)\n",
3120+ seq_printf(m, "CRTC %d: pipe: %c, active=%s, (size=%dx%d), dither=%s, bpp=%d\n",
29693121 crtc->base.base.id, pipe_name(crtc->pipe),
29703122 yesno(pipe_config->base.active),
2971− pipe_config->pipe_src_w, pipe_config->pipe_src_h);
3123+ pipe_config->pipe_src_w, pipe_config->pipe_src_h,
3124+ yesno(pipe_config->dither), pipe_config->pipe_bpp);
3125+
29723126 if (pipe_config->base.active) {
29733127 intel_crtc_info(m, crtc);
29743128
@@ -2978,6 +3132,8 @@ static int i915_display_info(struct seq_file *m, void *unused) · 3 unmodified lines
29783132 x, y, crtc->base.cursor->state->crtc_w,
29793133 crtc->base.cursor->state->crtc_h,
29803134 crtc->cursor_addr, yesno(active));
3135+ intel_scaler_info(m, crtc);
3136+ intel_plane_info(m, crtc);
29813137 }
29823138
29833139 seq_printf(m, "\tunderrun reporting: cpu=%s pch=%s \n",
@@ -3112,7 +3268,8 @@ static int i915_wa_registers(struct seq_file *m, void *unused) · 128 unmodified lines
31123268
31133269 seq_printf(m, "Workarounds applied: %d\n", dev_priv->workarounds.count);
31143270 for (i = 0; i < dev_priv->workarounds.count; ++i) {
3115− u32 addr, mask, value, read;
3271+ i915_reg_t addr;
3272+ u32 mask, value, read;
31163273 bool ok;
31173274
31183275 addr = dev_priv->workarounds.reg[i].addr;
@@ -3121,7 +3278,7 @@ static int i915_wa_registers(struct seq_file *m, void *unused) · 2 unmodified lines
31213278 read = I915_READ(addr);
31223279 ok = (value & mask) == (read & mask);
31233280 seq_printf(m, "0x%X: 0x%08X, mask: 0x%08X, read: 0x%08x, status: %s\n",
3124− addr, value, mask, read, ok ? "OK" : "FAIL");
3281+ i915_mmio_reg_offset(addr), value, mask, read, ok ? "OK" : "FAIL");
31253282 }
31263283
31273284 intel_runtime_pm_put(dev_priv);
@@ -5025,7 +5182,7 @@ static void gen9_sseu_device_status(struct drm_device *dev, · 1897 unmodified lines
50255182
50265183 stat->slice_total++;
50275184
5028− if (IS_SKYLAKE(dev))
5185+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
50295186 ss_cnt = INTEL_INFO(dev)->subslice_per_slice;
50305187
50315188 for (ss = 0; ss < ss_max; ss++) {
@@ -5238,6 +5395,7 @@ static const struct drm_info_list i915_debugfs_list[] = { · 206 unmodified lines
52385395 {"i915_energy_uJ", i915_energy_uJ, 0},
52395396 {"i915_runtime_pm_status", i915_runtime_pm_status, 0},
52405397 {"i915_power_domain_info", i915_power_domain_info, 0},
5398+ {"i915_dmc_info", i915_dmc_info, 0},
52415399 {"i915_display_info", i915_display_info, 0},
52425400 {"i915_semaphore_status", i915_semaphore_status, 0},
52435401 {"i915_shared_dplls_info", i915_shared_dplls_info, 0},
drivers/gpu/drm/i915/i915_dma.c+11−15
@@ -28,7 +28,6 @@ · 27 unmodified lines
2828
2929 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
3030
31−#include <linux/async.h>
3231 #include <drm/drmP.h>
3332 #include <drm/drm_crtc_helper.h>
3433 #include <drm/drm_fb_helper.h>
@@ -338,7 +337,7 @@ static void i915_switcheroo_set_state(struct pci_dev *pdev, enum vga_switcheroo_ · 303 unmodified lines
338337 i915_resume_switcheroo(dev);
339338 dev->switch_power_state = DRM_SWITCH_POWER_ON;
340339 } else {
341− pr_err("switched off\n");
340+ pr_info("switched off\n");
342341 dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
343342 i915_suspend_switcheroo(dev, pmm);
344343 dev->switch_power_state = DRM_SWITCH_POWER_OFF;
@@ -396,7 +395,9 @@ static int i915_load_modeset_init(struct drm_device *dev) · 51 unmodified lines
396395 if (ret)
397396 goto cleanup_vga_switcheroo;
398397
399− intel_power_domains_init_hw(dev_priv);
398+ intel_power_domains_init_hw(dev_priv, false);
399+
400+ intel_csr_ucode_init(dev_priv);
400401
401402 ret = intel_irq_install(dev_priv);
402403 if (ret)
@@ -437,7 +438,7 @@ static int i915_load_modeset_init(struct drm_device *dev) · 34 unmodified lines
437438 * scanning against hotplug events. Hence do this first and ignore the
438439 * tiny window where we will loose hotplug notifactions.
439440 */
440− async_schedule(intel_fbdev_initial_config, dev_priv);
441+ intel_fbdev_initial_config_async(dev);
441442
442443 drm_kms_helper_poll_init(dev);
443444
@@ -663,7 +664,8 @@ static void gen9_sseu_info_init(struct drm_device *dev) · 219 unmodified lines
663664 * supports EU power gating on devices with more than one EU
664665 * pair per subslice.
665666 */
666− info->has_slice_pg = (IS_SKYLAKE(dev) && (info->slice_total > 1));
667+ info->has_slice_pg = ((IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) &&
668+ (info->slice_total > 1));
667669 info->has_subslice_pg = (IS_BROXTON(dev) && (info->subslice_total > 1));
668670 info->has_eu_pg = (info->eu_per_subslice > 2);
669671 }
@@ -890,7 +892,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) · 220 unmodified lines
890892 spin_lock_init(&dev_priv->mmio_flip_lock);
891893 mutex_init(&dev_priv->sb_lock);
892894 mutex_init(&dev_priv->modeset_restore_lock);
893− mutex_init(&dev_priv->csr_lock);
894895 mutex_init(&dev_priv->av_mutex);
895896
896897 intel_pm_setup(dev);
@@ -937,9 +938,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) · 40 unmodified lines
937938
938939 intel_uncore_init(dev);
939940
940− /* Load CSR Firmware for SKL */
941− intel_csr_ucode_init(dev);
942−
943941 ret = i915_gem_gtt_init(dev);
944942 if (ret)
945943 goto out_freecsr;
@@ -1113,7 +1111,7 @@ out_mtrrfree: · 167 unmodified lines
11131111 out_gtt:
11141112 i915_global_gtt_cleanup(dev);
11151113 out_freecsr:
1116− intel_csr_ucode_fini(dev);
1114+ intel_csr_ucode_fini(dev_priv);
11171115 intel_uncore_fini(dev);
11181116 pci_iounmap(dev->pdev, dev_priv->regs);
11191117 put_bridge:
@@ -1131,6 +1129,8 @@ int i915_driver_unload(struct drm_device *dev) · 11 unmodified lines
11311129 struct drm_i915_private *dev_priv = dev->dev_private;
11321130 int ret;
11331131
1132+ intel_fbdev_fini(dev);
1133+
11341134 i915_audio_component_cleanup(dev_priv);
11351135
11361136 ret = i915_gem_suspend(dev);
@@ -1153,8 +1153,6 @@ int i915_driver_unload(struct drm_device *dev) · 16 unmodified lines
11531153
11541154 acpi_video_unregister();
11551155
1156− intel_fbdev_fini(dev);
1157−
11581156 drm_vblank_cleanup(dev);
11591157
11601158 intel_modeset_cleanup(dev);
@@ -1196,7 +1194,7 @@ int i915_driver_unload(struct drm_device *dev) · 35 unmodified lines
11961194 intel_fbc_cleanup_cfb(dev_priv);
11971195 i915_gem_cleanup_stolen(dev);
11981196
1199− intel_csr_ucode_fini(dev);
1197+ intel_csr_ucode_fini(dev_priv);
12001198
12011199 intel_teardown_gmbus(dev);
12021200 intel_teardown_mchbar(dev);
@@ -1264,8 +1262,6 @@ void i915_driver_postclose(struct drm_device *dev, struct drm_file *file) · 61 unmodified lines
12641262 {
12651263 struct drm_i915_file_private *file_priv = file->driver_priv;
12661264
1267− if (file_priv && file_priv->bsd_ring)
1268− file_priv->bsd_ring = NULL;
12691265 kfree(file_priv);
12701266 }
12711267
drivers/gpu/drm/i915/i915_drv.c+82−88
@@ -383,6 +383,7 @@ static const struct intel_device_info intel_skylake_gt3_info = { · 382 unmodified lines
383383
384384 static const struct intel_device_info intel_broxton_info = {
385385 .is_preliminary = 1,
386+ .is_broxton = 1,
386387 .gen = 9,
387388 .need_gfx_hws = 1, .has_hotplug = 1,
388389 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
@@ -394,50 +395,81 @@ static const struct intel_device_info intel_broxton_info = { · 5 unmodified lines
394395 IVB_CURSOR_OFFSETS,
395396 };
396397
398+static const struct intel_device_info intel_kabylake_info = {
399+ .is_preliminary = 1,
400+ .is_kabylake = 1,
401+ .gen = 9,
402+ .num_pipes = 3,
403+ .need_gfx_hws = 1, .has_hotplug = 1,
404+ .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
405+ .has_llc = 1,
406+ .has_ddi = 1,
407+ .has_fpga_dbg = 1,
408+ .has_fbc = 1,
409+ GEN_DEFAULT_PIPEOFFSETS,
410+ IVB_CURSOR_OFFSETS,
411+};
412+
413+static const struct intel_device_info intel_kabylake_gt3_info = {
414+ .is_preliminary = 1,
415+ .is_kabylake = 1,
416+ .gen = 9,
417+ .num_pipes = 3,
418+ .need_gfx_hws = 1, .has_hotplug = 1,
419+ .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
420+ .has_llc = 1,
421+ .has_ddi = 1,
422+ .has_fpga_dbg = 1,
423+ .has_fbc = 1,
424+ GEN_DEFAULT_PIPEOFFSETS,
425+ IVB_CURSOR_OFFSETS,
426+};
427+
397428 /*
398429 * Make sure any device matches here are from most specific to most
399430 * general. For example, since the Quanta match is based on the subsystem
400431 * and subvendor IDs, we need it to come before the more general IVB
401432 * PCI ID matches, otherwise we'll use the wrong info struct above.
402433 */
403−#define INTEL_PCI_IDS \
404− INTEL_I830_IDS(&intel_i830_info), \
405− INTEL_I845G_IDS(&intel_845g_info), \
406− INTEL_I85X_IDS(&intel_i85x_info), \
407− INTEL_I865G_IDS(&intel_i865g_info), \
408− INTEL_I915G_IDS(&intel_i915g_info), \
409− INTEL_I915GM_IDS(&intel_i915gm_info), \
410− INTEL_I945G_IDS(&intel_i945g_info), \
411− INTEL_I945GM_IDS(&intel_i945gm_info), \
412− INTEL_I965G_IDS(&intel_i965g_info), \
413− INTEL_G33_IDS(&intel_g33_info), \
414− INTEL_I965GM_IDS(&intel_i965gm_info), \
415− INTEL_GM45_IDS(&intel_gm45_info), \
416− INTEL_G45_IDS(&intel_g45_info), \
417− INTEL_PINEVIEW_IDS(&intel_pineview_info), \
418− INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info), \
419− INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info), \
420− INTEL_SNB_D_IDS(&intel_sandybridge_d_info), \
421− INTEL_SNB_M_IDS(&intel_sandybridge_m_info), \
422− INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */ \
423− INTEL_IVB_M_IDS(&intel_ivybridge_m_info), \
424− INTEL_IVB_D_IDS(&intel_ivybridge_d_info), \
425− INTEL_HSW_D_IDS(&intel_haswell_d_info), \
426− INTEL_HSW_M_IDS(&intel_haswell_m_info), \
427− INTEL_VLV_M_IDS(&intel_valleyview_m_info), \
428− INTEL_VLV_D_IDS(&intel_valleyview_d_info), \
429− INTEL_BDW_GT12M_IDS(&intel_broadwell_m_info), \
430− INTEL_BDW_GT12D_IDS(&intel_broadwell_d_info), \
431− INTEL_BDW_GT3M_IDS(&intel_broadwell_gt3m_info), \
432− INTEL_BDW_GT3D_IDS(&intel_broadwell_gt3d_info), \
433− INTEL_CHV_IDS(&intel_cherryview_info), \
434− INTEL_SKL_GT1_IDS(&intel_skylake_info), \
435− INTEL_SKL_GT2_IDS(&intel_skylake_info), \
436− INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info), \
437− INTEL_BXT_IDS(&intel_broxton_info)
438−
439−static const struct pci_device_id pciidlist[] = { /* aka */
440− INTEL_PCI_IDS,
434+static const struct pci_device_id pciidlist[] = {
435+ INTEL_I830_IDS(&intel_i830_info),
436+ INTEL_I845G_IDS(&intel_845g_info),
437+ INTEL_I85X_IDS(&intel_i85x_info),
438+ INTEL_I865G_IDS(&intel_i865g_info),
439+ INTEL_I915G_IDS(&intel_i915g_info),
440+ INTEL_I915GM_IDS(&intel_i915gm_info),
441+ INTEL_I945G_IDS(&intel_i945g_info),
442+ INTEL_I945GM_IDS(&intel_i945gm_info),
443+ INTEL_I965G_IDS(&intel_i965g_info),
444+ INTEL_G33_IDS(&intel_g33_info),
445+ INTEL_I965GM_IDS(&intel_i965gm_info),
446+ INTEL_GM45_IDS(&intel_gm45_info),
447+ INTEL_G45_IDS(&intel_g45_info),
448+ INTEL_PINEVIEW_IDS(&intel_pineview_info),
449+ INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info),
450+ INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info),
451+ INTEL_SNB_D_IDS(&intel_sandybridge_d_info),
452+ INTEL_SNB_M_IDS(&intel_sandybridge_m_info),
453+ INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */
454+ INTEL_IVB_M_IDS(&intel_ivybridge_m_info),
455+ INTEL_IVB_D_IDS(&intel_ivybridge_d_info),
456+ INTEL_HSW_D_IDS(&intel_haswell_d_info),
457+ INTEL_HSW_M_IDS(&intel_haswell_m_info),
458+ INTEL_VLV_M_IDS(&intel_valleyview_m_info),
459+ INTEL_VLV_D_IDS(&intel_valleyview_d_info),
460+ INTEL_BDW_GT12M_IDS(&intel_broadwell_m_info),
461+ INTEL_BDW_GT12D_IDS(&intel_broadwell_d_info),
462+ INTEL_BDW_GT3M_IDS(&intel_broadwell_gt3m_info),
463+ INTEL_BDW_GT3D_IDS(&intel_broadwell_gt3d_info),
464+ INTEL_CHV_IDS(&intel_cherryview_info),
465+ INTEL_SKL_GT1_IDS(&intel_skylake_info),
466+ INTEL_SKL_GT2_IDS(&intel_skylake_info),
467+ INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),
468+ INTEL_BXT_IDS(&intel_broxton_info),
469+ INTEL_KBL_GT1_IDS(&intel_kabylake_info),
470+ INTEL_KBL_GT2_IDS(&intel_kabylake_info),
471+ INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info),
472+ INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info),
441473 {0, 0, 0}
442474 };
443475
@@ -463,7 +495,7 @@ static enum intel_pch intel_virt_detect_pch(struct drm_device *dev) · 19 unmodified lines
463495 } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
464496 ret = PCH_LPT;
465497 DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
466− } else if (IS_SKYLAKE(dev)) {
498+ } else if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
467499 ret = PCH_SPT;
468500 DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
469501 }
@@ -526,11 +558,13 @@ void intel_detect_pch(struct drm_device *dev) · 56 unmodified lines
526558 } else if (id == INTEL_PCH_SPT_DEVICE_ID_TYPE) {
527559 dev_priv->pch_type = PCH_SPT;
528560 DRM_DEBUG_KMS("Found SunrisePoint PCH\n");
529− WARN_ON(!IS_SKYLAKE(dev));
561+ WARN_ON(!IS_SKYLAKE(dev) &&
562+ !IS_KABYLAKE(dev));
530563 } else if (id == INTEL_PCH_SPT_LP_DEVICE_ID_TYPE) {
531564 dev_priv->pch_type = PCH_SPT;
532565 DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n");
533− WARN_ON(!IS_SKYLAKE(dev));
566+ WARN_ON(!IS_SKYLAKE(dev) &&
567+ !IS_KABYLAKE(dev));
534568 } else if (id == INTEL_PCH_P2X_DEVICE_ID_TYPE) {
535569 dev_priv->pch_type = intel_virt_detect_pch(dev);
536570 } else
@@ -570,26 +604,6 @@ bool i915_semaphore_is_enabled(struct drm_device *dev) · 33 unmodified lines
570604 return true;
571605 }
572606
573−void i915_firmware_load_error_print(const char *fw_path, int err)
574−{
575− DRM_ERROR("failed to load firmware %s (%d)\n", fw_path, err);
576−
577− /*
578− * If the reason is not known assume -ENOENT since that's the most
579− * usual failure mode.
580− */
581− if (!err)
582− err = -ENOENT;
583−
584− if (!(IS_BUILTIN(CONFIG_DRM_I915) && err == -ENOENT))
585− return;
586−
587− DRM_ERROR(
588− "The driver is built-in, so to load the firmware you need to\n"
589− "include it either in the kernel (see CONFIG_EXTRA_FIRMWARE) or\n"
590− "in your initrd/initramfs image.\n");
591−}
592−
593607 static void intel_suspend_encoders(struct drm_i915_private *dev_priv)
594608 {
595609 struct drm_device *dev = dev_priv->dev;
@@ -608,7 +622,6 @@ static void intel_suspend_encoders(struct drm_i915_private *dev_priv) · 12 unmodified lines
608622 static int intel_suspend_complete(struct drm_i915_private *dev_priv);
609623 static int vlv_resume_prepare(struct drm_i915_private *dev_priv,
610624 bool rpm_resume);
611−static int skl_resume_prepare(struct drm_i915_private *dev_priv);
612625 static int bxt_resume_prepare(struct drm_i915_private *dev_priv);
613626
614627
@@ -679,6 +692,9 @@ static int i915_drm_suspend(struct drm_device *dev) · 64 unmodified lines
679692
680693 intel_display_set_init_power(dev_priv, false);
681694
695+ if (HAS_CSR(dev_priv))
696+ flush_work(&dev_priv->csr.work);
697+
682698 return 0;
683699 }
684700
@@ -687,10 +703,13 @@ static int i915_drm_suspend_late(struct drm_device *drm_dev, bool hibernation) · 2 unmodified lines
687703 struct drm_i915_private *dev_priv = drm_dev->dev_private;
688704 int ret;
689705
706+ intel_power_domains_suspend(dev_priv);
707+
690708 ret = intel_suspend_complete(dev_priv);
691709
692710 if (ret) {
693711 DRM_ERROR("Suspend complete failed: %d\n", ret);
712+ intel_power_domains_init_hw(dev_priv, true);
694713
695714 return ret;
696715 }
@@ -838,13 +857,11 @@ static int i915_drm_resume_early(struct drm_device *dev) · 141 unmodified lines
838857
839858 if (IS_BROXTON(dev))
840859 ret = bxt_resume_prepare(dev_priv);
841− else if (IS_SKYLAKE(dev_priv))
842− ret = skl_resume_prepare(dev_priv);
843860 else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
844861 hsw_disable_pc8(dev_priv);
845862
846863 intel_uncore_sanitize(dev);
847− intel_power_domains_init_hw(dev_priv);
864+ intel_power_domains_init_hw(dev_priv, true);
848865
849866 return ret;
850867 }
@@ -1051,15 +1068,6 @@ static int i915_pm_resume(struct device *dev) · 200 unmodified lines
10511068 return i915_drm_resume(drm_dev);
10521069 }
10531070
1054−static int skl_suspend_complete(struct drm_i915_private *dev_priv)
1055−{
1056− /* Enabling DC6 is not a hard requirement to enter runtime D3 */
1057−
1058− skl_uninit_cdclk(dev_priv);
1059−
1060− return 0;
1061−}
1062−
10631071 static int hsw_suspend_complete(struct drm_i915_private *dev_priv)
10641072 {
10651073 hsw_enable_pc8(dev_priv);
@@ -1099,16 +1107,6 @@ static int bxt_resume_prepare(struct drm_i915_private *dev_priv) · 33 unmodified lines
10991107 return 0;
11001108 }
11011109
1102−static int skl_resume_prepare(struct drm_i915_private *dev_priv)
1103−{
1104− struct drm_device *dev = dev_priv->dev;
1105−
1106− skl_init_cdclk(dev_priv);
1107− intel_csr_load_program(dev);
1108−
1109− return 0;
1110−}
1111−
11121110 /*
11131111 * Save all Gunit registers that may be lost after a D3 and a subsequent
11141112 * S0i[R123] transition. The list of registers needing a save/restore is
@@ -1572,8 +1570,6 @@ static int intel_runtime_resume(struct device *device) · 457 unmodified lines
15721570
15731571 if (IS_BROXTON(dev))
15741572 ret = bxt_resume_prepare(dev_priv);
1575− else if (IS_SKYLAKE(dev))
1576− ret = skl_resume_prepare(dev_priv);
15771573 else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
15781574 hsw_disable_pc8(dev_priv);
15791575 else if (IS_VALLEYVIEW(dev_priv))
@@ -1616,8 +1612,6 @@ static int intel_suspend_complete(struct drm_i915_private *dev_priv) · 36 unmodified lines
16161612
16171613 if (IS_BROXTON(dev_priv))
16181614 ret = bxt_suspend_complete(dev_priv);
1619− else if (IS_SKYLAKE(dev_priv))
1620− ret = skl_suspend_complete(dev_priv);
16211615 else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
16221616 ret = hsw_suspend_complete(dev_priv);
16231617 else if (IS_VALLEYVIEW(dev_priv))
drivers/gpu/drm/i915/i915_drv.h+108−80
@@ -57,7 +57,7 @@ · 56 unmodified lines
5757
5858 #define DRIVER_NAME "i915"
5959 #define DRIVER_DESC "Intel Graphics"
60−#define DRIVER_DATE "20151010"
60+#define DRIVER_DATE "20151120"
6161
6262 #undef WARN_ON
6363 /* Many gcc seem to no see through this and fall over :( */
@@ -180,15 +180,11 @@ enum intel_display_power_domain { · 116 unmodified lines
180180 POWER_DOMAIN_TRANSCODER_B,
181181 POWER_DOMAIN_TRANSCODER_C,
182182 POWER_DOMAIN_TRANSCODER_EDP,
183− POWER_DOMAIN_PORT_DDI_A_2_LANES,
184− POWER_DOMAIN_PORT_DDI_A_4_LANES,
185− POWER_DOMAIN_PORT_DDI_B_2_LANES,
186− POWER_DOMAIN_PORT_DDI_B_4_LANES,
187− POWER_DOMAIN_PORT_DDI_C_2_LANES,
188− POWER_DOMAIN_PORT_DDI_C_4_LANES,
189− POWER_DOMAIN_PORT_DDI_D_2_LANES,
190− POWER_DOMAIN_PORT_DDI_D_4_LANES,
191− POWER_DOMAIN_PORT_DDI_E_2_LANES,
183+ POWER_DOMAIN_PORT_DDI_A_LANES,
184+ POWER_DOMAIN_PORT_DDI_B_LANES,
185+ POWER_DOMAIN_PORT_DDI_C_LANES,
186+ POWER_DOMAIN_PORT_DDI_D_LANES,
187+ POWER_DOMAIN_PORT_DDI_E_LANES,
192188 POWER_DOMAIN_PORT_DSI,
193189 POWER_DOMAIN_PORT_CRT,
194190 POWER_DOMAIN_PORT_OTHER,
@@ -200,6 +196,7 @@ enum intel_display_power_domain { · 5 unmodified lines
200196 POWER_DOMAIN_AUX_C,
201197 POWER_DOMAIN_AUX_D,
202198 POWER_DOMAIN_GMBUS,
199+ POWER_DOMAIN_MODESET,
203200 POWER_DOMAIN_INIT,
204201
205202 POWER_DOMAIN_NUM,
@@ -289,7 +286,7 @@ struct i915_hotplug { · 83 unmodified lines
289286 list_for_each_entry(intel_plane, \
290287 &(dev)->mode_config.plane_list, \
291288 base.head) \
292− if ((intel_plane)->pipe == (intel_crtc)->pipe)
289+ for_each_if ((intel_plane)->pipe == (intel_crtc)->pipe)
293290
294291 #define for_each_intel_crtc(dev, intel_crtc) \
295292 list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, base.head)
@@ -306,15 +303,15 @@ struct i915_hotplug { · 10 unmodified lines
306303
307304 #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
308305 list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
309− if ((intel_encoder)->base.crtc == (__crtc))
306+ for_each_if ((intel_encoder)->base.crtc == (__crtc))
310307
311308 #define for_each_connector_on_encoder(dev, __encoder, intel_connector) \
312309 list_for_each_entry((intel_connector), &(dev)->mode_config.connector_list, base.head) \
313− if ((intel_connector)->base.encoder == (__encoder))
310+ for_each_if ((intel_connector)->base.encoder == (__encoder))
314311
315312 #define for_each_power_domain(domain, mask) \
316313 for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++) \
317− if ((1 << (domain)) & (mask))
314+ for_each_if ((1 << (domain)) & (mask))
318315
319316 struct drm_i915_private;
320317 struct i915_mm_struct;
@@ -631,11 +628,9 @@ struct drm_i915_display_funcs { · 310 unmodified lines
631628 int target, int refclk,
632629 struct dpll *match_clock,
633630 struct dpll *best_clock);
631+ int (*compute_pipe_wm)(struct intel_crtc *crtc,
632+ struct drm_atomic_state *state);
634633 void (*update_wm)(struct drm_crtc *crtc);
635− void (*update_sprite_wm)(struct drm_plane *plane,
636− struct drm_crtc *crtc,
637− uint32_t sprite_width, uint32_t sprite_height,
638− int pixel_size, bool enable, bool scaled);
639634 int (*modeset_calc_cdclk)(struct drm_atomic_state *state);
640635 void (*modeset_commit_cdclk)(struct drm_atomic_state *state);
641636 /* Returns the active state of the crtc, and if the crtc is active,
@@ -693,18 +688,18 @@ struct intel_uncore_funcs { · 51 unmodified lines
693688 void (*force_wake_put)(struct drm_i915_private *dev_priv,
694689 enum forcewake_domains domains);
695690
696− uint8_t (*mmio_readb)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
697− uint16_t (*mmio_readw)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
698− uint32_t (*mmio_readl)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
699− uint64_t (*mmio_readq)(struct drm_i915_private *dev_priv, off_t offset, bool trace);
691+ uint8_t (*mmio_readb)(struct drm_i915_private *dev_priv, i915_reg_t r, bool trace);
692+ uint16_t (*mmio_readw)(struct drm_i915_private *dev_priv, i915_reg_t r, bool trace);
693+ uint32_t (*mmio_readl)(struct drm_i915_private *dev_priv, i915_reg_t r, bool trace);
694+ uint64_t (*mmio_readq)(struct drm_i915_private *dev_priv, i915_reg_t r, bool trace);
700695
701− void (*mmio_writeb)(struct drm_i915_private *dev_priv, off_t offset,
696+ void (*mmio_writeb)(struct drm_i915_private *dev_priv, i915_reg_t r,
702697 uint8_t val, bool trace);
703− void (*mmio_writew)(struct drm_i915_private *dev_priv, off_t offset,
698+ void (*mmio_writew)(struct drm_i915_private *dev_priv, i915_reg_t r,
704699 uint16_t val, bool trace);
705− void (*mmio_writel)(struct drm_i915_private *dev_priv, off_t offset,
700+ void (*mmio_writel)(struct drm_i915_private *dev_priv, i915_reg_t r,
706701 uint32_t val, bool trace);
707− void (*mmio_writeq)(struct drm_i915_private *dev_priv, off_t offset,
702+ void (*mmio_writeq)(struct drm_i915_private *dev_priv, i915_reg_t r,
708703 uint64_t val, bool trace);
709704 };
710705
@@ -721,11 +716,11 @@ struct intel_uncore { · 10 unmodified lines
721716 enum forcewake_domain_id id;
722717 unsigned wake_count;
723718 struct timer_list timer;
724− u32 reg_set;
719+ i915_reg_t reg_set;
725720 u32 val_set;
726721 u32 val_clear;
727− u32 reg_ack;
728− u32 reg_post;
722+ i915_reg_t reg_ack;
723+ i915_reg_t reg_post;
729724 u32 val_reset;
730725 } fw_domain[FW_DOMAIN_ID_COUNT];
731726 };
@@ -735,25 +730,24 @@ struct intel_uncore { · 3 unmodified lines
735730 for ((i__) = 0, (domain__) = &(dev_priv__)->uncore.fw_domain[0]; \
736731 (i__) < FW_DOMAIN_ID_COUNT; \
737732 (i__)++, (domain__) = &(dev_priv__)->uncore.fw_domain[i__]) \
738− if (((mask__) & (dev_priv__)->uncore.fw_domains) & (1 << (i__)))
733+ for_each_if (((mask__) & (dev_priv__)->uncore.fw_domains) & (1 << (i__)))
739734
740735 #define for_each_fw_domain(domain__, dev_priv__, i__) \
741736 for_each_fw_domain_mask(domain__, FORCEWAKE_ALL, dev_priv__, i__)
742737
743−enum csr_state {
744− FW_UNINITIALIZED = 0,
745− FW_LOADED,
746− FW_FAILED
747−};
738+#define CSR_VERSION(major, minor) ((major) << 16 | (minor))
739+#define CSR_VERSION_MAJOR(version) ((version) >> 16)
740+#define CSR_VERSION_MINOR(version) ((version) & 0xffff)
748741
749742 struct intel_csr {
743+ struct work_struct work;
750744 const char *fw_path;
751745 uint32_t *dmc_payload;
752746 uint32_t dmc_fw_size;
747+ uint32_t version;
753748 uint32_t mmio_count;
754− uint32_t mmioaddr[8];
749+ i915_reg_t mmioaddr[8];
755750 uint32_t mmiodata[8];
756− enum csr_state state;
757751 };
758752
759753 #define DEV_INFO_FOR_EACH_FLAG(func, sep) \
@@ -771,6 +765,8 @@ struct intel_csr { · 11 unmodified lines
771765 func(is_valleyview) sep \
772766 func(is_haswell) sep \
773767 func(is_skylake) sep \
768+ func(is_broxton) sep \
769+ func(is_kabylake) sep \
774770 func(is_preliminary) sep \
775771 func(has_fbc) sep \
776772 func(has_pipe_cxsr) sep \
@@ -929,24 +925,7 @@ struct i915_fbc { · 152 unmodified lines
929925 struct drm_framebuffer *fb;
930926 } *fbc_work;
931927
932− enum no_fbc_reason {
933− FBC_OK, /* FBC is enabled */
934− FBC_UNSUPPORTED, /* FBC is not supported by this chipset */
935− FBC_NO_OUTPUT, /* no outputs enabled to compress */
936− FBC_STOLEN_TOO_SMALL, /* not enough space for buffers */
937− FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */
938− FBC_MODE_TOO_LARGE, /* mode too large for compression */
939− FBC_BAD_PLANE, /* fbc not supported on plane */
940− FBC_NOT_TILED, /* buffer not tiled */
941− FBC_MULTIPLE_PIPES, /* more than one pipe active */
942− FBC_MODULE_PARAM,
943− FBC_CHIP_DEFAULT, /* disabled by default on this chip */
944− FBC_ROTATION, /* rotation is not supported */
945− FBC_IN_DBG_MASTER, /* kernel debugger is active */
946− FBC_BAD_STRIDE, /* stride is not supported */
947− FBC_PIXEL_RATE, /* pixel rate is too big */
948− FBC_PIXEL_FORMAT /* pixel format is invalid */
949− } no_fbc_reason;
928+ const char *no_fbc_reason;
950929
951930 bool (*fbc_enabled)(struct drm_i915_private *dev_priv);
952931 void (*enable_fbc)(struct intel_crtc *crtc);
@@ -1020,7 +999,7 @@ struct intel_gmbus { · 67 unmodified lines
1020999 struct i2c_adapter adapter;
10211000 u32 force_bit;
10221001 u32 reg0;
1023− u32 gpio_reg;
1002+ i915_reg_t gpio_reg;
10241003 struct i2c_algo_bit_data bit_algo;
10251004 struct drm_i915_private *dev_priv;
10261005 };
@@ -1669,7 +1648,7 @@ struct i915_frontbuffer_tracking { · 642 unmodified lines
16691648 };
16701649
16711650 struct i915_wa_reg {
1672− u32 addr;
1651+ i915_reg_t addr;
16731652 u32 value;
16741653 /* bitmask representing WA bits */
16751654 u32 mask;
@@ -1698,6 +1677,13 @@ struct i915_execbuffer_params { · 22 unmodified lines
16981677 struct drm_i915_gem_request *request;
16991678 };
17001679
1680+/* used in computing the new watermarks state */
1681+struct intel_wm_config {
1682+ unsigned int num_pipes_active;
1683+ bool sprites_enabled;
1684+ bool sprites_scaled;
1685+};
1686+
17011687 struct drm_i915_private {
17021688 struct drm_device *dev;
17031689 struct kmem_cache *objects;
@@ -1718,9 +1704,6 @@ struct drm_i915_private { · 14 unmodified lines
17181704
17191705 struct intel_csr csr;
17201706
1721− /* Display CSR-related protection */
1722− struct mutex csr_lock;
1723−
17241707 struct intel_gmbus gmbus[GMBUS_NUM_PINS];
17251708
17261709 /** gmbus_mutex protects against concurrent usage of the single hw gmbus
@@ -1735,6 +1718,8 @@ struct drm_i915_private { · 8 unmodified lines
17351718 /* MMIO base address for MIPI regs */
17361719 uint32_t mipi_mmio_base;
17371720
1721+ uint32_t psr_mmio_base;
1722+
17381723 wait_queue_head_t gmbus_wait_queue;
17391724
17401725 struct pci_dev *bridge_dev;
@@ -1922,6 +1907,9 @@ struct drm_i915_private { · 181 unmodified lines
19221907 */
19231908 uint16_t skl_latency[8];
19241909
1910+ /* Committed wm config */
1911+ struct intel_wm_config config;
1912+
19251913 /*
19261914 * The skl_wm_values structure is a bit too big for stack
19271915 * allocation, so we keep the staging struct where we store
@@ -1956,6 +1944,8 @@ struct drm_i915_private { · 28 unmodified lines
19561944 /* perform PHY state sanity checks? */
19571945 bool chv_phy_assert[2];
19581946
1947+ struct intel_encoder *dig_port_map[I915_MAX_PORTS];
1948+
19591949 /*
19601950 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
19611951 * will be rejected. Instead look for a better place.
@@ -1980,7 +1970,7 @@ static inline struct drm_i915_private *guc_to_i915(struct intel_guc *guc) · 18 unmodified lines
19801970 /* Iterate over initialised rings */
19811971 #define for_each_ring(ring__, dev_priv__, i__) \
19821972 for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \
1983− if (((ring__) = &(dev_priv__)->ring[(i__)]), intel_ring_initialized((ring__)))
1973+ for_each_if ((((ring__) = &(dev_priv__)->ring[(i__)]), intel_ring_initialized((ring__))))
19841974
19851975 enum hdmi_force_audio {
19861976 HDMI_AUDIO_OFF_DVI = -2, /* no aux data for HDMI-DVI converter */
@@ -2445,6 +2435,15 @@ struct drm_i915_cmd_table { · 458 unmodified lines
24452435 #define INTEL_DEVID(p) (INTEL_INFO(p)->device_id)
24462436 #define INTEL_REVID(p) (__I915__(p)->dev->pdev->revision)
24472437
2438+#define REVID_FOREVER 0xff
2439+/*
2440+ * Return true if revision is in range [since,until] inclusive.
2441+ *
2442+ * Use 0 for open-ended since, and REVID_FOREVER for open-ended until.
2443+ */
2444+#define IS_REVID(p, since, until) \
2445+ (INTEL_REVID(p) >= (since) && INTEL_REVID(p) <= (until))
2446+
24482447 #define IS_I830(dev) (INTEL_DEVID(dev) == 0x3577)
24492448 #define IS_845G(dev) (INTEL_DEVID(dev) == 0x2562)
24502449 #define IS_I85X(dev) (INTEL_INFO(dev)->is_i85x)
@@ -2471,7 +2470,8 @@ struct drm_i915_cmd_table { · 20 unmodified lines
24712470 #define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell)
24722471 #define IS_BROADWELL(dev) (!INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
24732472 #define IS_SKYLAKE(dev) (INTEL_INFO(dev)->is_skylake)
2474−#define IS_BROXTON(dev) (!INTEL_INFO(dev)->is_skylake && IS_GEN9(dev))
2473+#define IS_BROXTON(dev) (INTEL_INFO(dev)->is_broxton)
2474+#define IS_KABYLAKE(dev) (INTEL_INFO(dev)->is_kabylake)
24752475 #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
24762476 #define IS_HSW_EARLY_SDV(dev) (IS_HASWELL(dev) && \
24772477 (INTEL_DEVID(dev) & 0xFF00) == 0x0C00)
@@ -2506,16 +2506,21 @@ struct drm_i915_cmd_table { · 28 unmodified lines
25062506
25072507 #define IS_PRELIMINARY_HW(intel_info) ((intel_info)->is_preliminary)
25082508
2509−#define SKL_REVID_A0 (0x0)
2510−#define SKL_REVID_B0 (0x1)
2511−#define SKL_REVID_C0 (0x2)
2512−#define SKL_REVID_D0 (0x3)
2513−#define SKL_REVID_E0 (0x4)
2514−#define SKL_REVID_F0 (0x5)
2509+#define SKL_REVID_A0 0x0
2510+#define SKL_REVID_B0 0x1
2511+#define SKL_REVID_C0 0x2
2512+#define SKL_REVID_D0 0x3
2513+#define SKL_REVID_E0 0x4
2514+#define SKL_REVID_F0 0x5
2515+
2516+#define IS_SKL_REVID(p, since, until) (IS_SKYLAKE(p) && IS_REVID(p, since, until))
25152517
2516−#define BXT_REVID_A0 (0x0)
2517−#define BXT_REVID_B0 (0x3)
2518−#define BXT_REVID_C0 (0x9)
2518+#define BXT_REVID_A0 0x0
2519+#define BXT_REVID_A1 0x1
2520+#define BXT_REVID_B0 0x3
2521+#define BXT_REVID_C0 0x9
2522+
2523+#define IS_BXT_REVID(p, since, until) (IS_BROXTON(p) && IS_REVID(p, since, until))
25192524
25202525 /*
25212526 * The genX designation typically refers to the render engine, so render
@@ -2587,10 +2592,10 @@ struct drm_i915_cmd_table { · 65 unmodified lines
25872592 #define HAS_FPGA_DBG_UNCLAIMED(dev) (INTEL_INFO(dev)->has_fpga_dbg)
25882593 #define HAS_PSR(dev) (IS_HASWELL(dev) || IS_BROADWELL(dev) || \
25892594 IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev) || \
2590− IS_SKYLAKE(dev))
2595+ IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
25912596 #define HAS_RUNTIME_PM(dev) (IS_GEN6(dev) || IS_HASWELL(dev) || \
25922597 IS_BROADWELL(dev) || IS_VALLEYVIEW(dev) || \
2593− IS_SKYLAKE(dev))
2598+ IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
25942599 #define HAS_RC6(dev) (INTEL_INFO(dev)->gen >= 6)
25952600 #define HAS_RC6p(dev) (INTEL_INFO(dev)->gen == 6 || IS_IVYBRIDGE(dev))
25962601
@@ -2650,6 +2655,7 @@ struct i915_params { · 53 unmodified lines
26502655 int panel_use_ssc;
26512656 int vbt_sdvo_panel_type;
26522657 int enable_rc6;
2658+ int enable_dc;
26532659 int enable_fbc;
26542660 int enable_ppgtt;
26552661 int enable_execlists;
@@ -2698,7 +2704,6 @@ extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv); · 42 unmodified lines
26982704 extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv);
26992705 extern void i915_update_gfx_val(struct drm_i915_private *dev_priv);
27002706 int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool on);
2701−void i915_firmware_load_error_print(const char *fw_path, int err);
27022707
27032708 /* intel_hotplug.c */
27042709 void intel_hpd_irq_handler(struct drm_device *dev, u32 pin_mask, u32 long_mask);
@@ -3008,8 +3013,6 @@ i915_gem_object_set_to_cpu_domain(struct drm_i915_gem_object *obj, bool write); · 303 unmodified lines
30083013 int __must_check
30093014 i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
30103015 u32 alignment,
3011− struct intel_engine_cs *pipelined,
3012− struct drm_i915_gem_request **pipelined_request,
30133016 const struct i915_ggtt_view *view);
30143017 void i915_gem_object_unpin_from_display_plane(struct drm_i915_gem_object *obj,
30153018 const struct i915_ggtt_view *view);
@@ -3364,7 +3367,6 @@ extern void intel_set_rps(struct drm_device *dev, u8 val); · 348 unmodified lines
33643367 extern void intel_set_memory_cxsr(struct drm_i915_private *dev_priv,
33653368 bool enable);
33663369 extern void intel_detect_pch(struct drm_device *dev);
3367−extern int intel_trans_dp_port_sel(struct drm_crtc *crtc);
33683370 extern int intel_enable_rc6(const struct drm_device *dev);
33693371
33703372 extern bool i915_semaphore_is_enabled(struct drm_device *dev);
@@ -3447,6 +3449,32 @@ int intel_freq_opcode(struct drm_i915_private *dev_priv, int val); · 76 unmodified lines
34473449 #define POSTING_READ(reg) (void)I915_READ_NOTRACE(reg)
34483450 #define POSTING_READ16(reg) (void)I915_READ16_NOTRACE(reg)
34493451
3452+#define __raw_read(x, s) \
3453+static inline uint##x##_t __raw_i915_read##x(struct drm_i915_private *dev_priv, \
3454+ i915_reg_t reg) \
3455+{ \
3456+ return read##s(dev_priv->regs + i915_mmio_reg_offset(reg)); \
3457+}
3458+
3459+#define __raw_write(x, s) \
3460+static inline void __raw_i915_write##x(struct drm_i915_private *dev_priv, \
3461+ i915_reg_t reg, uint##x##_t val) \
3462+{ \
3463+ write##s(val, dev_priv->regs + i915_mmio_reg_offset(reg)); \
3464+}
3465+__raw_read(8, b)
3466+__raw_read(16, w)
3467+__raw_read(32, l)
3468+__raw_read(64, q)
3469+
3470+__raw_write(8, b)
3471+__raw_write(16, w)
3472+__raw_write(32, l)
3473+__raw_write(64, q)
3474+
3475+#undef __raw_read
3476+#undef __raw_write
3477+
34503478 /* These are untraced mmio-accessors that are only valid to be used inside
34513479 * criticial sections inside IRQ handlers where forcewake is explicitly
34523480 * controlled.
@@ -3454,8 +3482,8 @@ int intel_freq_opcode(struct drm_i915_private *dev_priv, int val); · 1 unmodified line
34543482 * Note: Should only be used between intel_uncore_forcewake_irqlock() and
34553483 * intel_uncore_forcewake_irqunlock().
34563484 */
3457−#define I915_READ_FW(reg__) readl(dev_priv->regs + (reg__))
3458−#define I915_WRITE_FW(reg__, val__) writel(val__, dev_priv->regs + (reg__))
3485+#define I915_READ_FW(reg__) __raw_i915_read32(dev_priv, (reg__))
3486+#define I915_WRITE_FW(reg__, val__) __raw_i915_write32(dev_priv, (reg__), (val__))
34593487 #define POSTING_READ_FW(reg__) (void)I915_READ_FW(reg__)
34603488
34613489 /* "Broadcast RGB" property */
@@ -3463,7 +3491,7 @@ int intel_freq_opcode(struct drm_i915_private *dev_priv, int val); · 1 unmodified line
34633491 #define INTEL_BROADCAST_RGB_FULL 1
34643492 #define INTEL_BROADCAST_RGB_LIMITED 2
34653493
3466−static inline uint32_t i915_vgacntrl_reg(struct drm_device *dev)
3494+static inline i915_reg_t i915_vgacntrl_reg(struct drm_device *dev)
34673495 {
34683496 if (IS_VALLEYVIEW(dev))
34693497 return VLV_VGACNTRL;
drivers/gpu/drm/i915/i915_gem.c+37−36
@@ -2797,6 +2797,8 @@ static void i915_gem_reset_ring_status(struct drm_i915_private *dev_priv, · 2796 unmodified lines
27972797 static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv,
27982798 struct intel_engine_cs *ring)
27992799 {
2800+ struct intel_ringbuffer *buffer;
2801+
28002802 while (!list_empty(&ring->active_list)) {
28012803 struct drm_i915_gem_object *obj;
28022804
@@ -2812,18 +2814,23 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv, · 9 unmodified lines
28122814 * are the ones that keep the context and ringbuffer backing objects
28132815 * pinned in place.
28142816 */
2815− while (!list_empty(&ring->execlist_queue)) {
2816− struct drm_i915_gem_request *submit_req;
28172817
2818− submit_req = list_first_entry(&ring->execlist_queue,
2819− struct drm_i915_gem_request,
2820− execlist_link);
2821− list_del(&submit_req->execlist_link);
2818+ if (i915.enable_execlists) {
2819+ spin_lock_irq(&ring->execlist_lock);
2820+ while (!list_empty(&ring->execlist_queue)) {
2821+ struct drm_i915_gem_request *submit_req;
2822+
2823+ submit_req = list_first_entry(&ring->execlist_queue,
2824+ struct drm_i915_gem_request,
2825+ execlist_link);
2826+ list_del(&submit_req->execlist_link);
28222827
2823− if (submit_req->ctx != ring->default_context)
2824− intel_lr_context_unpin(submit_req);
2828+ if (submit_req->ctx != ring->default_context)
2829+ intel_lr_context_unpin(submit_req);
28252830
2826− i915_gem_request_unreference(submit_req);
2831+ i915_gem_request_unreference(submit_req);
2832+ }
2833+ spin_unlock_irq(&ring->execlist_lock);
28272834 }
28282835
28292836 /*
@@ -2842,6 +2849,18 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv, · 12 unmodified lines
28422849
28432850 i915_gem_request_retire(request);
28442851 }
2852+
2853+ /* Having flushed all requests from all queues, we know that all
2854+ * ringbuffers must now be empty. However, since we do not reclaim
2855+ * all space when retiring the request (to prevent HEADs colliding
2856+ * with rapid ringbuffer wraparound) the amount of available space
2857+ * upon reset is less than when we start. Do one more pass over
2858+ * all the ringbuffers to reset last_retired_head.
2859+ */
2860+ list_for_each_entry(buffer, &ring->buffers, link) {
2861+ buffer->last_retired_head = buffer->tail;
2862+ intel_ring_update_space(buffer);
2863+ }
28452864 }
28462865
28472866 void i915_gem_reset(struct drm_device *dev)
@@ -3886,7 +3905,7 @@ int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, · 1038 unmodified lines
38863905 * cacheline, whereas normally such cachelines would get
38873906 * invalidated.
38883907 */
3889− if (IS_BROXTON(dev) && INTEL_REVID(dev) < BXT_REVID_B0)
3908+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1))
38903909 return -ENODEV;
38913910
38923911 level = I915_CACHE_LLC;
@@ -3929,17 +3948,11 @@ rpm_put: · 36 unmodified lines
39293948 int
39303949 i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
39313950 u32 alignment,
3932− struct intel_engine_cs *pipelined,
3933− struct drm_i915_gem_request **pipelined_request,
39343951 const struct i915_ggtt_view *view)
39353952 {
39363953 u32 old_read_domains, old_write_domain;
39373954 int ret;
39383955
3939− ret = i915_gem_object_sync(obj, pipelined, pipelined_request);
3940− if (ret)
3941− return ret;
3942−
39433956 /* Mark the pin_display early so that we account for the
39443957 * display coherency whilst setting up the cache domains.
39453958 */
@@ -4541,10 +4554,8 @@ struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj, · 595 unmodified lines
45414554 {
45424555 struct i915_vma *vma;
45434556 list_for_each_entry(vma, &obj->vma_list, vma_link) {
4544− if (i915_is_ggtt(vma->vm) &&
4545− vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL)
4546− continue;
4547− if (vma->vm == vm)
4557+ if (vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL &&
4558+ vma->vm == vm)
45484559 return vma;
45494560 }
45504561 return NULL;
@@ -4633,7 +4644,6 @@ int i915_gem_l3_remap(struct drm_i915_gem_request *req, int slice) · 82 unmodified lines
46334644 struct intel_engine_cs *ring = req->ring;
46344645 struct drm_device *dev = ring->dev;
46354646 struct drm_i915_private *dev_priv = dev->dev_private;
4636− u32 reg_base = GEN7_L3LOG_BASE + (slice * 0x200);
46374647 u32 *remap_info = dev_priv->l3_parity.remap_info[slice];
46384648 int i, ret;
46394649
@@ -4649,10 +4659,10 @@ int i915_gem_l3_remap(struct drm_i915_gem_request *req, int slice) · 9 unmodified lines
46494659 * here because no other code should access these registers other than
46504660 * at initialization time.
46514661 */
4652− for (i = 0; i < GEN7_L3LOG_SIZE; i += 4) {
4662+ for (i = 0; i < GEN7_L3LOG_SIZE / 4; i++) {
46534663 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
4654− intel_ring_emit(ring, reg_base + i);
4655− intel_ring_emit(ring, remap_info[i/4]);
4664+ intel_ring_emit_reg(ring, GEN7_L3LOG(slice, i));
4665+ intel_ring_emit(ring, remap_info[i]);
46564666 }
46574667
46584668 intel_ring_advance(ring);
@@ -4820,18 +4830,9 @@ i915_gem_init_hw(struct drm_device *dev) · 161 unmodified lines
48204830 if (HAS_GUC_UCODE(dev)) {
48214831 ret = intel_guc_ucode_load(dev);
48224832 if (ret) {
4823− /*
4824− * If we got an error and GuC submission is enabled, map
4825− * the error to -EIO so the GPU will be declared wedged.
4826− * OTOH, if we didn't intend to use the GuC anyway, just
4827− * discard the error and carry on.
4828− */
4829− DRM_ERROR("Failed to initialize GuC, error %d%s\n", ret,
4830− i915.enable_guc_submission ? "" :
4831− " (ignored)");
4832− ret = i915.enable_guc_submission ? -EIO : 0;
4833− if (ret)
4834− goto out;
4833+ DRM_ERROR("Failed to initialize GuC, error %d\n", ret);
4834+ ret = -EIO;
4835+ goto out;
48354836 }
48364837 }
48374838
drivers/gpu/drm/i915/i915_gem_context.c+10−2
@@ -554,7 +554,7 @@ mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) · 553 unmodified lines
554554 if (signaller == ring)
555555 continue;
556556
557− intel_ring_emit(ring, RING_PSMI_CTL(signaller->mmio_base));
557+ intel_ring_emit_reg(ring, RING_PSMI_CTL(signaller->mmio_base));
558558 intel_ring_emit(ring, _MASKED_BIT_ENABLE(GEN6_PSMI_SLEEP_MSG_DISABLE));
559559 }
560560 }
@@ -579,7 +579,7 @@ mi_set_context(struct drm_i915_gem_request *req, u32 hw_flags) · 18 unmodified lines
579579 if (signaller == ring)
580580 continue;
581581
582− intel_ring_emit(ring, RING_PSMI_CTL(signaller->mmio_base));
582+ intel_ring_emit_reg(ring, RING_PSMI_CTL(signaller->mmio_base));
583583 intel_ring_emit(ring, _MASKED_BIT_DISABLE(GEN6_PSMI_SLEEP_MSG_DISABLE));
584584 }
585585 }
@@ -923,6 +923,14 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data, · 337 unmodified lines
923923 case I915_CONTEXT_PARAM_NO_ZEROMAP:
924924 args->value = ctx->flags & CONTEXT_NO_ZEROMAP;
925925 break;
926+ case I915_CONTEXT_PARAM_GTT_SIZE:
927+ if (ctx->ppgtt)
928+ args->value = ctx->ppgtt->base.total;
929+ else if (to_i915(dev)->mm.aliasing_ppgtt)
930+ args->value = to_i915(dev)->mm.aliasing_ppgtt->base.total;
931+ else
932+ args->value = to_i915(dev)->gtt.base.total;
933+ break;
926934 default:
927935 ret = -EINVAL;
928936 break;
drivers/gpu/drm/i915/i915_gem_execbuffer.c+2−2
@@ -1114,7 +1114,7 @@ i915_reset_gen7_sol_offsets(struct drm_device *dev, · 1113 unmodified lines
11141114
11151115 for (i = 0; i < 4; i++) {
11161116 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
1117− intel_ring_emit(ring, GEN7_SO_WRITE_OFFSET(i));
1117+ intel_ring_emit_reg(ring, GEN7_SO_WRITE_OFFSET(i));
11181118 intel_ring_emit(ring, 0);
11191119 }
11201120
@@ -1241,7 +1241,7 @@ i915_gem_ringbuffer_submission(struct i915_execbuffer_params *params, · 120 unmodified lines
12411241
12421242 intel_ring_emit(ring, MI_NOOP);
12431243 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
1244− intel_ring_emit(ring, INSTPM);
1244+ intel_ring_emit_reg(ring, INSTPM);
12451245 intel_ring_emit(ring, instp_mask << 16 | instp_mode);
12461246 intel_ring_advance(ring);
12471247
drivers/gpu/drm/i915/i915_gem_fence.c+1−1
@@ -59,7 +59,7 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg, · 58 unmodified lines
5959 struct drm_i915_gem_object *obj)
6060 {
6161 struct drm_i915_private *dev_priv = dev->dev_private;
62− int fence_reg_lo, fence_reg_hi;
62+ i915_reg_t fence_reg_lo, fence_reg_hi;
6363 int fence_pitch_shift;
6464
6565 if (INTEL_INFO(dev)->gen >= 6) {
drivers/gpu/drm/i915/i915_gem_gtt.c+42−16
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 */
2525
2626 #include <linux/seq_file.h>
27+#include <linux/stop_machine.h>
2728 #include <drm/drmP.h>
2829 #include <drm/i915_drm.h>
2930 #include "i915_drv.h"
@@ -104,9 +105,11 @@ static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt) · 74 unmodified lines
104105 {
105106 bool has_aliasing_ppgtt;
106107 bool has_full_ppgtt;
108+ bool has_full_48bit_ppgtt;
107109
108110 has_aliasing_ppgtt = INTEL_INFO(dev)->gen >= 6;
109111 has_full_ppgtt = INTEL_INFO(dev)->gen >= 7;
112+ has_full_48bit_ppgtt = IS_BROADWELL(dev) || INTEL_INFO(dev)->gen >= 9;
110113
111114 if (intel_vgpu_active(dev))
112115 has_full_ppgtt = false; /* emulation is too hard */
@@ -125,6 +128,9 @@ static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt) · 12 unmodified lines
125128 if (enable_ppgtt == 2 && has_full_ppgtt)
126129 return 2;
127130
131+ if (enable_ppgtt == 3 && has_full_48bit_ppgtt)
132+ return 3;
133+
128134 #ifdef CONFIG_INTEL_IOMMU
129135 /* Disable ppgtt on SNB if VT-d is on. */
130136 if (INTEL_INFO(dev)->gen == 6 && intel_iommu_gfx_mapped) {
@@ -141,7 +147,7 @@ static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt) · 10 unmodified lines
141147 }
142148
143149 if (INTEL_INFO(dev)->gen >= 8 && i915.enable_execlists)
144− return 2;
150+ return has_full_48bit_ppgtt ? 3 : 2;
145151 else
146152 return has_aliasing_ppgtt ? 1 : 0;
147153 }
@@ -661,10 +667,10 @@ static int gen8_write_pdp(struct drm_i915_gem_request *req, · 513 unmodified lines
661667 return ret;
662668
663669 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
664− intel_ring_emit(ring, GEN8_RING_PDP_UDW(ring, entry));
670+ intel_ring_emit_reg(ring, GEN8_RING_PDP_UDW(ring, entry));
665671 intel_ring_emit(ring, upper_32_bits(addr));
666672 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
667− intel_ring_emit(ring, GEN8_RING_PDP_LDW(ring, entry));
673+ intel_ring_emit_reg(ring, GEN8_RING_PDP_LDW(ring, entry));
668674 intel_ring_emit(ring, lower_32_bits(addr));
669675 intel_ring_advance(ring);
670676
@@ -904,14 +910,13 @@ static int gen8_ppgtt_notify_vgt(struct i915_hw_ppgtt *ppgtt, bool create) · 233 unmodified lines
904910 enum vgt_g2v_type msg;
905911 struct drm_device *dev = ppgtt->base.dev;
906912 struct drm_i915_private *dev_priv = dev->dev_private;
907− unsigned int offset = vgtif_reg(pdp0_lo);
908913 int i;
909914
910915 if (USES_FULL_48BIT_PPGTT(dev)) {
911916 u64 daddr = px_dma(&ppgtt->pml4);
912917
913− I915_WRITE(offset, lower_32_bits(daddr));
914− I915_WRITE(offset + 4, upper_32_bits(daddr));
918+ I915_WRITE(vgtif_reg(pdp[0].lo), lower_32_bits(daddr));
919+ I915_WRITE(vgtif_reg(pdp[0].hi), upper_32_bits(daddr));
915920
916921 msg = (create ? VGT_G2V_PPGTT_L4_PAGE_TABLE_CREATE :
917922 VGT_G2V_PPGTT_L4_PAGE_TABLE_DESTROY);
@@ -919,10 +924,8 @@ static int gen8_ppgtt_notify_vgt(struct i915_hw_ppgtt *ppgtt, bool create) · 1 unmodified line
919924 for (i = 0; i < GEN8_LEGACY_PDPES; i++) {
920925 u64 daddr = i915_page_dir_dma_addr(ppgtt, i);
921926
922− I915_WRITE(offset, lower_32_bits(daddr));
923− I915_WRITE(offset + 4, upper_32_bits(daddr));
924−
925− offset += 8;
927+ I915_WRITE(vgtif_reg(pdp[i].lo), lower_32_bits(daddr));
928+ I915_WRITE(vgtif_reg(pdp[i].hi), upper_32_bits(daddr));
926929 }
927930
928931 msg = (create ? VGT_G2V_PPGTT_L3_PAGE_TABLE_CREATE :
@@ -1662,9 +1665,9 @@ static int hsw_mm_switch(struct i915_hw_ppgtt *ppgtt, · 733 unmodified lines
16621665 return ret;
16631666
16641667 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(2));
1665− intel_ring_emit(ring, RING_PP_DIR_DCLV(ring));
1668+ intel_ring_emit_reg(ring, RING_PP_DIR_DCLV(ring));
16661669 intel_ring_emit(ring, PP_DIR_DCLV_2G);
1667− intel_ring_emit(ring, RING_PP_DIR_BASE(ring));
1670+ intel_ring_emit_reg(ring, RING_PP_DIR_BASE(ring));
16681671 intel_ring_emit(ring, get_pd_offset(ppgtt));
16691672 intel_ring_emit(ring, MI_NOOP);
16701673 intel_ring_advance(ring);
@@ -1699,9 +1702,9 @@ static int gen7_mm_switch(struct i915_hw_ppgtt *ppgtt, · 28 unmodified lines
16991702 return ret;
17001703
17011704 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(2));
1702− intel_ring_emit(ring, RING_PP_DIR_DCLV(ring));
1705+ intel_ring_emit_reg(ring, RING_PP_DIR_DCLV(ring));
17031706 intel_ring_emit(ring, PP_DIR_DCLV_2G);
1704− intel_ring_emit(ring, RING_PP_DIR_BASE(ring));
1707+ intel_ring_emit_reg(ring, RING_PP_DIR_BASE(ring));
17051708 intel_ring_emit(ring, get_pd_offset(ppgtt));
17061709 intel_ring_emit(ring, MI_NOOP);
17071710 intel_ring_advance(ring);
@@ -2528,6 +2531,26 @@ static int ggtt_bind_vma(struct i915_vma *vma, · 820 unmodified lines
25282531 return 0;
25292532 }
25302533
2534+struct ggtt_bind_vma__cb {
2535+ struct i915_vma *vma;
2536+ enum i915_cache_level cache_level;
2537+ u32 flags;
2538+};
2539+
2540+static int ggtt_bind_vma__cb(void *_arg)
2541+{
2542+ struct ggtt_bind_vma__cb *arg = _arg;
2543+ return ggtt_bind_vma(arg->vma, arg->cache_level, arg->flags);
2544+}
2545+
2546+static int ggtt_bind_vma__BKL(struct i915_vma *vma,
2547+ enum i915_cache_level cache_level,
2548+ u32 flags)
2549+{
2550+ struct ggtt_bind_vma__cb arg = { vma, cache_level, flags };
2551+ return stop_machine(ggtt_bind_vma__cb, &arg, NULL);
2552+}
2553+
25312554 static int aliasing_gtt_bind_vma(struct i915_vma *vma,
25322555 enum i915_cache_level cache_level,
25332556 u32 flags)
@@ -2996,6 +3019,9 @@ static int gen8_gmch_probe(struct drm_device *dev, · 462 unmodified lines
29963019 dev_priv->gtt.base.bind_vma = ggtt_bind_vma;
29973020 dev_priv->gtt.base.unbind_vma = ggtt_unbind_vma;
29983021
3022+ if (IS_CHERRYVIEW(dev))
3023+ dev_priv->gtt.base.bind_vma = ggtt_bind_vma__BKL;
3024+
29993025 return ret;
30003026 }
30013027
@@ -3303,7 +3329,7 @@ static struct sg_table * · 301 unmodified lines
33033329 intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
33043330 struct drm_i915_gem_object *obj)
33053331 {
3306− struct intel_rotation_info *rot_info = &ggtt_view->rotation_info;
3332+ struct intel_rotation_info *rot_info = &ggtt_view->params.rotation_info;
33073333 unsigned int size_pages = rot_info->size >> PAGE_SHIFT;
33083334 unsigned int size_pages_uv;
33093335 struct sg_page_iter sg_iter;
@@ -3535,7 +3561,7 @@ i915_ggtt_view_size(struct drm_i915_gem_object *obj, · 225 unmodified lines
35353561 if (view->type == I915_GGTT_VIEW_NORMAL) {
35363562 return obj->base.size;
35373563 } else if (view->type == I915_GGTT_VIEW_ROTATED) {
3538− return view->rotation_info.size;
3564+ return view->params.rotation_info.size;
35393565 } else if (view->type == I915_GGTT_VIEW_PARTIAL) {
35403566 return view->params.partial.size << PAGE_SHIFT;
35413567 } else {
drivers/gpu/drm/i915/i915_gem_gtt.h+2−5
@@ -156,13 +156,10 @@ struct i915_ggtt_view { · 155 unmodified lines
156156 u64 offset;
157157 unsigned int size;
158158 } partial;
159+ struct intel_rotation_info rotation_info;
159160 } params;
160161
161162 struct sg_table *pages;
162−
163− union {
164− struct intel_rotation_info rotation_info;
165− };
166163 };
167164
168165 extern const struct i915_ggtt_view i915_ggtt_view_normal;
@@ -556,7 +553,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a, · 387 unmodified lines
556553
557554 if (a->type != b->type)
558555 return false;
559− if (a->type == I915_GGTT_VIEW_PARTIAL)
556+ if (a->type != I915_GGTT_VIEW_NORMAL)
560557 return !memcmp(&a->params, &b->params, sizeof(a->params));
561558 return true;
562559 }
drivers/gpu/drm/i915/i915_gem_stolen.c+2−1
@@ -433,7 +433,8 @@ int i915_gem_init_stolen(struct drm_device *dev) · 432 unmodified lines
433433 &reserved_size);
434434 break;
435435 default:
436− if (IS_BROADWELL(dev_priv) || IS_SKYLAKE(dev_priv))
436+ if (IS_BROADWELL(dev_priv) ||
437+ IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev))
437438 bdw_get_stolen_reserved(dev_priv, &reserved_base,
438439 &reserved_size);
439440 else
drivers/gpu/drm/i915/i915_gem_tiling.c+4−0
@@ -176,6 +176,8 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, · 175 unmodified lines
176176 return -EINVAL;
177177 }
178178
179+ intel_runtime_pm_get(dev_priv);
180+
179181 mutex_lock(&dev->struct_mutex);
180182 if (obj->pin_display || obj->framebuffer_references) {
181183 ret = -EBUSY;
@@ -269,6 +271,8 @@ err: · 87 unmodified lines
269271 drm_gem_object_unreference(&obj->base);
270272 mutex_unlock(&dev->struct_mutex);
271273
274+ intel_runtime_pm_put(dev_priv);
275+
272276 return ret;
273277 }
274278
drivers/gpu/drm/i915/i915_gpu_error.c+35−5
@@ -366,6 +366,17 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m, · 365 unmodified lines
366366 err_printf(m, "Suspend count: %u\n", error->suspend_count);
367367 err_printf(m, "PCI ID: 0x%04x\n", dev->pdev->device);
368368 err_printf(m, "IOMMU enabled?: %d\n", error->iommu);
369+
370+ if (HAS_CSR(dev)) {
371+ struct intel_csr *csr = &dev_priv->csr;
372+
373+ err_printf(m, "DMC loaded: %s\n",
374+ yesno(csr->dmc_payload != NULL));
375+ err_printf(m, "DMC fw version: %d.%d\n",
376+ CSR_VERSION_MAJOR(csr->version),
377+ CSR_VERSION_MINOR(csr->version));
378+ }
379+
369380 err_printf(m, "EIR: 0x%08x\n", error->eir);
370381 err_printf(m, "IER: 0x%08x\n", error->ier);
371382 if (INTEL_INFO(dev)->gen >= 8) {
@@ -862,7 +873,7 @@ static void i915_record_ring_state(struct drm_device *dev, · 490 unmodified lines
862873 struct drm_i915_private *dev_priv = dev->dev_private;
863874
864875 if (INTEL_INFO(dev)->gen >= 6) {
865− ering->rc_psmi = I915_READ(ring->mmio_base + 0x50);
876+ ering->rc_psmi = I915_READ(RING_PSMI_CTL(ring->mmio_base));
866877 ering->fault_reg = I915_READ(RING_FAULT_REG(ring));
867878 if (INTEL_INFO(dev)->gen >= 8)
868879 gen8_record_semaphore_state(dev_priv, error, ring, ering);
@@ -899,7 +910,7 @@ static void i915_record_ring_state(struct drm_device *dev, · 30 unmodified lines
899910 ering->ctl = I915_READ_CTL(ring);
900911
901912 if (I915_NEED_GFX_HWS(dev)) {
902− int mmio;
913+ i915_reg_t mmio;
903914
904915 if (IS_GEN7(dev)) {
905916 switch (ring->id) {
@@ -1071,6 +1082,25 @@ static void i915_gem_record_rings(struct drm_device *dev, · 165 unmodified lines
10711082 list_for_each_entry(request, &ring->request_list, list) {
10721083 struct drm_i915_error_request *erq;
10731084
1085+ if (count >= error->ring[i].num_requests) {
1086+ /*
1087+ * If the ring request list was changed in
1088+ * between the point where the error request
1089+ * list was created and dimensioned and this
1090+ * point then just exit early to avoid crashes.
1091+ *
1092+ * We don't need to communicate that the
1093+ * request list changed state during error
1094+ * state capture and that the error state is
1095+ * slightly incorrect as a consequence since we
1096+ * are typically only interested in the request
1097+ * list state at the point of error state
1098+ * capture, not in any changes happening during
1099+ * the capture.
1100+ */
1101+ break;
1102+ }
1103+
10741104 erq = &error->ring[i].requests[count++];
10751105 erq->seqno = request->seqno;
10761106 erq->jiffies = request->emitted_jiffies;
@@ -1181,7 +1211,7 @@ static void i915_capture_reg_state(struct drm_i915_private *dev_priv, · 104 unmodified lines
11811211 if (IS_VALLEYVIEW(dev)) {
11821212 error->gtier[0] = I915_READ(GTIER);
11831213 error->ier = I915_READ(VLV_IER);
1184− error->forcewake = I915_READ(FORCEWAKE_VLV);
1214+ error->forcewake = I915_READ_FW(FORCEWAKE_VLV);
11851215 }
11861216
11871217 if (IS_GEN7(dev))
@@ -1193,14 +1223,14 @@ static void i915_capture_reg_state(struct drm_i915_private *dev_priv, · 5 unmodified lines
11931223 }
11941224
11951225 if (IS_GEN6(dev)) {
1196− error->forcewake = I915_READ(FORCEWAKE);
1226+ error->forcewake = I915_READ_FW(FORCEWAKE);
11971227 error->gab_ctl = I915_READ(GAB_CTL);
11981228 error->gfx_mode = I915_READ(GFX_MODE);
11991229 }
12001230
12011231 /* 2: Registers which belong to multiple generations */
12021232 if (INTEL_INFO(dev)->gen >= 7)
1203− error->forcewake = I915_READ(FORCEWAKE_MT);
1233+ error->forcewake = I915_READ_FW(FORCEWAKE_MT);
12041234
12051235 if (INTEL_INFO(dev)->gen >= 6) {
12061236 error->derrmr = I915_READ(DERRMR);
drivers/gpu/drm/i915/i915_guc_reg.h+27−26
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626
2727 /* Definitions of GuC H/W registers, bits, etc */
2828
29−#define GUC_STATUS 0xc000
29+#define GUC_STATUS _MMIO(0xc000)
3030 #define GS_BOOTROM_SHIFT 1
3131 #define GS_BOOTROM_MASK (0x7F << GS_BOOTROM_SHIFT)
3232 #define GS_BOOTROM_RSA_FAILED (0x50 << GS_BOOTROM_SHIFT)
@@ -39,40 +39,41 @@ · 6 unmodified lines
3939 #define GS_MIA_MASK (0x07 << GS_MIA_SHIFT)
4040 #define GS_MIA_CORE_STATE (1 << GS_MIA_SHIFT)
4141
42−#define SOFT_SCRATCH(n) (0xc180 + ((n) * 4))
42+#define SOFT_SCRATCH(n) _MMIO(0xc180 + (n) * 4)
4343
44−#define UOS_RSA_SCRATCH(i) (0xc200 + (i) * 4)
45−#define DMA_ADDR_0_LOW 0xc300
46−#define DMA_ADDR_0_HIGH 0xc304
47−#define DMA_ADDR_1_LOW 0xc308
48−#define DMA_ADDR_1_HIGH 0xc30c
44+#define UOS_RSA_SCRATCH(i) _MMIO(0xc200 + (i) * 4)
45+#define UOS_RSA_SCRATCH_MAX_COUNT 64
46+#define DMA_ADDR_0_LOW _MMIO(0xc300)
47+#define DMA_ADDR_0_HIGH _MMIO(0xc304)
48+#define DMA_ADDR_1_LOW _MMIO(0xc308)
49+#define DMA_ADDR_1_HIGH _MMIO(0xc30c)
4950 #define DMA_ADDRESS_SPACE_WOPCM (7 << 16)
5051 #define DMA_ADDRESS_SPACE_GTT (8 << 16)
51−#define DMA_COPY_SIZE 0xc310
52−#define DMA_CTRL 0xc314
52+#define DMA_COPY_SIZE _MMIO(0xc310)
53+#define DMA_CTRL _MMIO(0xc314)
5354 #define UOS_MOVE (1<<4)
5455 #define START_DMA (1<<0)
55−#define DMA_GUC_WOPCM_OFFSET 0xc340
56+#define DMA_GUC_WOPCM_OFFSET _MMIO(0xc340)
5657 #define GUC_WOPCM_OFFSET_VALUE 0x80000 /* 512KB */
57−#define GUC_MAX_IDLE_COUNT 0xC3E4
58+#define GUC_MAX_IDLE_COUNT _MMIO(0xC3E4)
5859
59−#define GUC_WOPCM_SIZE 0xc050
60+#define GUC_WOPCM_SIZE _MMIO(0xc050)
6061 #define GUC_WOPCM_SIZE_VALUE (0x80 << 12) /* 512KB */
6162
6263 /* GuC addresses below GUC_WOPCM_TOP don't map through the GTT */
6364 #define GUC_WOPCM_TOP (GUC_WOPCM_SIZE_VALUE)
6465
65−#define GEN8_GT_PM_CONFIG 0x138140
66−#define GEN9LP_GT_PM_CONFIG 0x138140
67−#define GEN9_GT_PM_CONFIG 0x13816c
66+#define GEN8_GT_PM_CONFIG _MMIO(0x138140)
67+#define GEN9LP_GT_PM_CONFIG _MMIO(0x138140)
68+#define GEN9_GT_PM_CONFIG _MMIO(0x13816c)
6869 #define GT_DOORBELL_ENABLE (1<<0)
6970
70−#define GEN8_GTCR 0x4274
71+#define GEN8_GTCR _MMIO(0x4274)
7172 #define GEN8_GTCR_INVALIDATE (1<<0)
7273
73−#define GUC_ARAT_C6DIS 0xA178
74+#define GUC_ARAT_C6DIS _MMIO(0xA178)
7475
75−#define GUC_SHIM_CONTROL 0xc064
76+#define GUC_SHIM_CONTROL _MMIO(0xc064)
7677 #define GUC_DISABLE_SRAM_INIT_TO_ZEROES (1<<0)
7778 #define GUC_ENABLE_READ_CACHE_LOGIC (1<<1)
7879 #define GUC_ENABLE_MIA_CACHING (1<<2)
@@ -89,21 +90,21 @@ · 10 unmodified lines
8990 GUC_ENABLE_READ_CACHE_FOR_WOPCM_DATA | \
9091 GUC_ENABLE_MIA_CLOCK_GATING)
9192
92−#define HOST2GUC_INTERRUPT 0xc4c8
93+#define HOST2GUC_INTERRUPT _MMIO(0xc4c8)
9394 #define HOST2GUC_TRIGGER (1<<0)
9495
9596 #define DRBMISC1 0x1984
9697 #define DOORBELL_ENABLE (1<<0)
9798
98−#define GEN8_DRBREGL(x) (0x1000 + (x) * 8)
99+#define GEN8_DRBREGL(x) _MMIO(0x1000 + (x) * 8)
99100 #define GEN8_DRB_VALID (1<<0)
100−#define GEN8_DRBREGU(x) (GEN8_DRBREGL(x) + 4)
101+#define GEN8_DRBREGU(x) _MMIO(0x1000 + (x) * 8 + 4)
101102
102−#define DE_GUCRMR 0x44054
103+#define DE_GUCRMR _MMIO(0x44054)
103104
104−#define GUC_BCS_RCS_IER 0xC550
105−#define GUC_VCS2_VCS1_IER 0xC554
106−#define GUC_WD_VECS_IER 0xC558
107−#define GUC_PM_P24C_IER 0xC55C
105+#define GUC_BCS_RCS_IER _MMIO(0xC550)
106+#define GUC_VCS2_VCS1_IER _MMIO(0xC554)
107+#define GUC_WD_VECS_IER _MMIO(0xC558)
108+#define GUC_PM_P24C_IER _MMIO(0xC55C)
108109
109110 #endif
drivers/gpu/drm/i915/i915_guc_submission.c+8−8
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727 #include "intel_guc.h"
2828
2929 /**
30− * DOC: GuC Client
30+ * DOC: GuC-based command submission
3131 *
3232 * i915_guc_client:
3333 * We use the term client to avoid confusion with contexts. A i915_guc_client is
@@ -161,9 +161,9 @@ static int host2guc_sample_forcewake(struct intel_guc *guc, · 127 unmodified lines
161161 data[0] = HOST2GUC_ACTION_SAMPLE_FORCEWAKE;
162162 /* WaRsDisableCoarsePowerGating:skl,bxt */
163163 if (!intel_enable_rc6(dev_priv->dev) ||
164− (IS_BROXTON(dev) && (INTEL_REVID(dev) < BXT_REVID_B0)) ||
165− (IS_SKL_GT3(dev) && (INTEL_REVID(dev) <= SKL_REVID_E0)) ||
166− (IS_SKL_GT4(dev) && (INTEL_REVID(dev) <= SKL_REVID_E0)))
164+ IS_BXT_REVID(dev, 0, BXT_REVID_A1) ||
165+ (IS_SKL_GT3(dev) && IS_SKL_REVID(dev, 0, SKL_REVID_E0)) ||
166+ (IS_SKL_GT4(dev) && IS_SKL_REVID(dev, 0, SKL_REVID_E0)))
167167 data[1] = 0;
168168 else
169169 /* bit 0 and 1 are for Render and Media domain separately */
@@ -258,7 +258,7 @@ static void guc_disable_doorbell(struct intel_guc *guc, · 88 unmodified lines
258258 struct drm_i915_private *dev_priv = guc_to_i915(guc);
259259 struct guc_doorbell_info *doorbell;
260260 void *base;
261− int drbreg = GEN8_DRBREGL(client->doorbell_id);
261+ i915_reg_t drbreg = GEN8_DRBREGL(client->doorbell_id);
262262 int value;
263263
264264 base = kmap_atomic(i915_gem_object_get_page(client->client_obj, 0));
@@ -588,8 +588,7 @@ static void lr_context_update(struct drm_i915_gem_request *rq) · 323 unmodified lines
588588 /**
589589 * i915_guc_submit() - Submit commands through GuC
590590 * @client: the guc client where commands will go through
591− * @ctx: LRC where commands come from
592− * @ring: HW engine that will excute the commands
591+ * @rq: request associated with the commands
593592 *
594593 * Return: 0 if succeed
595594 */
@@ -731,7 +730,8 @@ static void guc_client_free(struct drm_device *dev, · 135 unmodified lines
731730 * The kernel client to replace ExecList submission is created with
732731 * NORMAL priority. Priority of a client for scheduler can be HIGH,
733732 * while a preemption context can use CRITICAL.
734− * @ctx the context to own the client (we use the default render context)
733+ * @ctx: the context that owns the client (we use the default render
734+ * context)
735735 *
736736 * Return: An i915_guc_client object if success.
737737 */
drivers/gpu/drm/i915/i915_irq.c+59−58
@@ -139,7 +139,8 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = { · 138 unmodified lines
139139 /*
140140 * We should clear IMR at preinstall/uninstall, and just check at postinstall.
141141 */
142−static void gen5_assert_iir_is_zero(struct drm_i915_private *dev_priv, u32 reg)
142+static void gen5_assert_iir_is_zero(struct drm_i915_private *dev_priv,
143+ i915_reg_t reg)
143144 {
144145 u32 val = I915_READ(reg);
145146
@@ -147,7 +148,7 @@ static void gen5_assert_iir_is_zero(struct drm_i915_private *dev_priv, u32 reg) · 1 unmodified line
147148 return;
148149
149150 WARN(1, "Interrupt register 0x%x is not zero: 0x%08x\n",
150− reg, val);
151+ i915_mmio_reg_offset(reg), val);
151152 I915_WRITE(reg, 0xffffffff);
152153 POSTING_READ(reg);
153154 I915_WRITE(reg, 0xffffffff);
@@ -283,17 +284,17 @@ void gen5_disable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask) · 129 unmodified lines
283284 ilk_update_gt_irq(dev_priv, mask, 0);
284285 }
285286
286−static u32 gen6_pm_iir(struct drm_i915_private *dev_priv)
287+static i915_reg_t gen6_pm_iir(struct drm_i915_private *dev_priv)
287288 {
288289 return INTEL_INFO(dev_priv)->gen >= 8 ? GEN8_GT_IIR(2) : GEN6_PMIIR;
289290 }
290291
291−static u32 gen6_pm_imr(struct drm_i915_private *dev_priv)
292+static i915_reg_t gen6_pm_imr(struct drm_i915_private *dev_priv)
292293 {
293294 return INTEL_INFO(dev_priv)->gen >= 8 ? GEN8_GT_IMR(2) : GEN6_PMIMR;
294295 }
295296
296−static u32 gen6_pm_ier(struct drm_i915_private *dev_priv)
297+static i915_reg_t gen6_pm_ier(struct drm_i915_private *dev_priv)
297298 {
298299 return INTEL_INFO(dev_priv)->gen >= 8 ? GEN8_GT_IER(2) : GEN6_PMIER;
299300 }
@@ -350,7 +351,7 @@ void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask) · 50 unmodified lines
350351 void gen6_reset_rps_interrupts(struct drm_device *dev)
351352 {
352353 struct drm_i915_private *dev_priv = dev->dev_private;
353− uint32_t reg = gen6_pm_iir(dev_priv);
354+ i915_reg_t reg = gen6_pm_iir(dev_priv);
354355
355356 spin_lock_irq(&dev_priv->irq_lock);
356357 I915_WRITE(reg, dev_priv->pm_rps_events);
@@ -477,7 +478,7 @@ static void · 120 unmodified lines
477478 __i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
478479 u32 enable_mask, u32 status_mask)
479480 {
480− u32 reg = PIPESTAT(pipe);
481+ i915_reg_t reg = PIPESTAT(pipe);
481482 u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
482483
483484 assert_spin_locked(&dev_priv->irq_lock);
@@ -504,7 +505,7 @@ static void · 20 unmodified lines
504505 __i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
505506 u32 enable_mask, u32 status_mask)
506507 {
507− u32 reg = PIPESTAT(pipe);
508+ i915_reg_t reg = PIPESTAT(pipe);
508509 u32 pipestat = I915_READ(reg) & PIPESTAT_INT_ENABLE_MASK;
509510
510511 assert_spin_locked(&dev_priv->irq_lock);
@@ -665,8 +666,7 @@ static u32 i8xx_get_vblank_counter(struct drm_device *dev, unsigned int pipe) · 154 unmodified lines
665666 static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
666667 {
667668 struct drm_i915_private *dev_priv = dev->dev_private;
668− unsigned long high_frame;
669− unsigned long low_frame;
669+ i915_reg_t high_frame, low_frame;
670670 u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal;
671671 struct intel_crtc *intel_crtc =
672672 to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
@@ -717,9 +717,7 @@ static u32 g4x_get_vblank_counter(struct drm_device *dev, unsigned int pipe) · 44 unmodified lines
717717 return I915_READ(PIPE_FRMCOUNT_G4X(pipe));
718718 }
719719
720−/* raw reads, only for fast reads of display block, no need for forcewake etc. */
721−#define __raw_i915_read32(dev_priv__, reg__) readl((dev_priv__)->regs + (reg__))
722−
720+/* I915_READ_FW, only for fast reads of display block, no need for forcewake etc. */
723721 static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
724722 {
725723 struct drm_device *dev = crtc->base.dev;
@@ -733,9 +731,9 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc) · 7 unmodified lines
733731 vtotal /= 2;
734732
735733 if (IS_GEN2(dev))
736− position = __raw_i915_read32(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN2;
734+ position = I915_READ_FW(PIPEDSL(pipe)) & DSL_LINEMASK_GEN2;
737735 else
738− position = __raw_i915_read32(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN3;
736+ position = I915_READ_FW(PIPEDSL(pipe)) & DSL_LINEMASK_GEN3;
739737
740738 /*
741739 * On HSW, the DSL reg (0x70000) appears to return 0 if we
@@ -827,7 +825,7 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, · 85 unmodified lines
827825 * We can split this into vertical and horizontal
828826 * scanout position.
829827 */
830− position = (__raw_i915_read32(dev_priv, PIPEFRAMEPIXEL(pipe)) & PIPE_PIXEL_MASK) >> PIPE_PIXEL_SHIFT;
828+ position = (I915_READ_FW(PIPEFRAMEPIXEL(pipe)) & PIPE_PIXEL_MASK) >> PIPE_PIXEL_SHIFT;
831829
832830 /* convert to pixel counts */
833831 vbl_start *= htotal;
@@ -1188,7 +1186,7 @@ static void ivybridge_parity_work(struct work_struct *work) · 354 unmodified lines
11881186 POSTING_READ(GEN7_MISCCPCTL);
11891187
11901188 while ((slice = ffs(dev_priv->l3_parity.which_slice)) != 0) {
1191− u32 reg;
1189+ i915_reg_t reg;
11921190
11931191 slice--;
11941192 if (WARN_ON_ONCE(slice >= NUM_L3_SLICES(dev_priv->dev)))
@@ -1196,7 +1194,7 @@ static void ivybridge_parity_work(struct work_struct *work) · 1 unmodified line
11961194
11971195 dev_priv->l3_parity.which_slice &= ~(1<<slice);
11981196
1199− reg = GEN7_L3CDERRST1 + (slice * 0x200);
1197+ reg = GEN7_L3CDERRST1(slice);
12001198
12011199 error_status = I915_READ(reg);
12021200 row = GEN7_PARITY_ERROR_ROW(error_status);
@@ -1290,70 +1288,69 @@ static void snb_gt_irq_handler(struct drm_device *dev, · 87 unmodified lines
12901288 ivybridge_parity_error_irq_handler(dev, gt_iir);
12911289 }
12921290
1291+static __always_inline void
1292+gen8_cs_irq_handler(struct intel_engine_cs *ring, u32 iir, int test_shift)
1293+{
1294+ if (iir & (GT_RENDER_USER_INTERRUPT << test_shift))
1295+ notify_ring(ring);
1296+ if (iir & (GT_CONTEXT_SWITCH_INTERRUPT << test_shift))
1297+ intel_lrc_irq_handler(ring);
1298+}
1299+
12931300 static irqreturn_t gen8_gt_irq_handler(struct drm_i915_private *dev_priv,
12941301 u32 master_ctl)
12951302 {
12961303 irqreturn_t ret = IRQ_NONE;
12971304
12981305 if (master_ctl & (GEN8_GT_RCS_IRQ | GEN8_GT_BCS_IRQ)) {
1299− u32 tmp = I915_READ_FW(GEN8_GT_IIR(0));
1300− if (tmp) {
1301− I915_WRITE_FW(GEN8_GT_IIR(0), tmp);
1306+ u32 iir = I915_READ_FW(GEN8_GT_IIR(0));
1307+ if (iir) {
1308+ I915_WRITE_FW(GEN8_GT_IIR(0), iir);
13021309 ret = IRQ_HANDLED;
13031310
1304− if (tmp & (GT_CONTEXT_SWITCH_INTERRUPT << GEN8_RCS_IRQ_SHIFT))
1305− intel_lrc_irq_handler(&dev_priv->ring[RCS]);
1306− if (tmp & (GT_RENDER_USER_INTERRUPT << GEN8_RCS_IRQ_SHIFT))
1307− notify_ring(&dev_priv->ring[RCS]);
1311+ gen8_cs_irq_handler(&dev_priv->ring[RCS],
1312+ iir, GEN8_RCS_IRQ_SHIFT);
13081313
1309− if (tmp & (GT_CONTEXT_SWITCH_INTERRUPT << GEN8_BCS_IRQ_SHIFT))
1310− intel_lrc_irq_handler(&dev_priv->ring[BCS]);
1311− if (tmp & (GT_RENDER_USER_INTERRUPT << GEN8_BCS_IRQ_SHIFT))
1312− notify_ring(&dev_priv->ring[BCS]);
1314+ gen8_cs_irq_handler(&dev_priv->ring[BCS],
1315+ iir, GEN8_BCS_IRQ_SHIFT);
13131316 } else
13141317 DRM_ERROR("The master control interrupt lied (GT0)!\n");
13151318 }
13161319
13171320 if (master_ctl & (GEN8_GT_VCS1_IRQ | GEN8_GT_VCS2_IRQ)) {
1318− u32 tmp = I915_READ_FW(GEN8_GT_IIR(1));
1319− if (tmp) {
1320− I915_WRITE_FW(GEN8_GT_IIR(1), tmp);
1321+ u32 iir = I915_READ_FW(GEN8_GT_IIR(1));
1322+ if (iir) {
1323+ I915_WRITE_FW(GEN8_GT_IIR(1), iir);
13211324 ret = IRQ_HANDLED;
13221325
1323− if (tmp & (GT_CONTEXT_SWITCH_INTERRUPT << GEN8_VCS1_IRQ_SHIFT))
1324− intel_lrc_irq_handler(&dev_priv->ring[VCS]);
1325− if (tmp & (GT_RENDER_USER_INTERRUPT << GEN8_VCS1_IRQ_SHIFT))
1326− notify_ring(&dev_priv->ring[VCS]);
1326+ gen8_cs_irq_handler(&dev_priv->ring[VCS],
1327+ iir, GEN8_VCS1_IRQ_SHIFT);
13271328
1328− if (tmp & (GT_CONTEXT_SWITCH_INTERRUPT << GEN8_VCS2_IRQ_SHIFT))
1329− intel_lrc_irq_handler(&dev_priv->ring[VCS2]);
1330− if (tmp & (GT_RENDER_USER_INTERRUPT << GEN8_VCS2_IRQ_SHIFT))
1331− notify_ring(&dev_priv->ring[VCS2]);
1329+ gen8_cs_irq_handler(&dev_priv->ring[VCS2],
1330+ iir, GEN8_VCS2_IRQ_SHIFT);
13321331 } else
13331332 DRM_ERROR("The master control interrupt lied (GT1)!\n");
13341333 }
13351334
13361335 if (master_ctl & GEN8_GT_VECS_IRQ) {
1337− u32 tmp = I915_READ_FW(GEN8_GT_IIR(3));
1338− if (tmp) {
1339− I915_WRITE_FW(GEN8_GT_IIR(3), tmp);
1336+ u32 iir = I915_READ_FW(GEN8_GT_IIR(3));
1337+ if (iir) {
1338+ I915_WRITE_FW(GEN8_GT_IIR(3), iir);
13401339 ret = IRQ_HANDLED;
13411340
1342− if (tmp & (GT_CONTEXT_SWITCH_INTERRUPT << GEN8_VECS_IRQ_SHIFT))
1343− intel_lrc_irq_handler(&dev_priv->ring[VECS]);
1344− if (tmp & (GT_RENDER_USER_INTERRUPT << GEN8_VECS_IRQ_SHIFT))
1345− notify_ring(&dev_priv->ring[VECS]);
1341+ gen8_cs_irq_handler(&dev_priv->ring[VECS],
1342+ iir, GEN8_VECS_IRQ_SHIFT);
13461343 } else
13471344 DRM_ERROR("The master control interrupt lied (GT3)!\n");
13481345 }
13491346
13501347 if (master_ctl & GEN8_GT_PM_IRQ) {
1351− u32 tmp = I915_READ_FW(GEN8_GT_IIR(2));
1352− if (tmp & dev_priv->pm_rps_events) {
1348+ u32 iir = I915_READ_FW(GEN8_GT_IIR(2));
1349+ if (iir & dev_priv->pm_rps_events) {
13531350 I915_WRITE_FW(GEN8_GT_IIR(2),
1354− tmp & dev_priv->pm_rps_events);
1351+ iir & dev_priv->pm_rps_events);
13551352 ret = IRQ_HANDLED;
1356− gen6_rps_irq_handler(dev_priv, tmp);
1353+ gen6_rps_irq_handler(dev_priv, iir);
13571354 } else
13581355 DRM_ERROR("The master control interrupt lied (PM)!\n");
13591356 }
@@ -1625,7 +1622,7 @@ static void valleyview_pipestat_irq_handler(struct drm_device *dev, u32 iir) · 265 unmodified lines
16251622
16261623 spin_lock(&dev_priv->irq_lock);
16271624 for_each_pipe(dev_priv, pipe) {
1628− int reg;
1625+ i915_reg_t reg;
16291626 u32 mask, iir_bit = 0;
16301627
16311628 /*
@@ -2354,9 +2351,13 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg) · 722 unmodified lines
23542351 spt_irq_handler(dev, pch_iir);
23552352 else
23562353 cpt_irq_handler(dev, pch_iir);
2357− } else
2358− DRM_ERROR("The master control interrupt lied (SDE)!\n");
2359−
2354+ } else {
2355+ /*
2356+ * Like on previous PCH there seems to be something
2357+ * fishy going on with forwarding PCH interrupts.
2358+ */
2359+ DRM_DEBUG_DRIVER("The master control interrupt lied (SDE)!\n");
2360+ }
23602361 }
23612362
23622363 I915_WRITE_FW(GEN8_MASTER_IRQ, GEN8_MASTER_IRQ_CONTROL);
@@ -3869,7 +3870,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg) · 1506 unmodified lines
38693870 DRM_DEBUG("Command parser error, iir 0x%08x\n", iir);
38703871
38713872 for_each_pipe(dev_priv, pipe) {
3872− int reg = PIPESTAT(pipe);
3873+ i915_reg_t reg = PIPESTAT(pipe);
38733874 pipe_stats[pipe] = I915_READ(reg);
38743875
38753876 /*
@@ -4050,7 +4051,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg) · 174 unmodified lines
40504051 DRM_DEBUG("Command parser error, iir 0x%08x\n", iir);
40514052
40524053 for_each_pipe(dev_priv, pipe) {
4053− int reg = PIPESTAT(pipe);
4054+ i915_reg_t reg = PIPESTAT(pipe);
40544055 pipe_stats[pipe] = I915_READ(reg);
40554056
40564057 /* Clear the PIPE*STAT regs before the IIR */
@@ -4272,7 +4273,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg) · 215 unmodified lines
42724273 DRM_DEBUG("Command parser error, iir 0x%08x\n", iir);
42734274
42744275 for_each_pipe(dev_priv, pipe) {
4275− int reg = PIPESTAT(pipe);
4276+ i915_reg_t reg = PIPESTAT(pipe);
42764277 pipe_stats[pipe] = I915_READ(reg);
42774278
42784279 /*
drivers/gpu/drm/i915/i915_params.c+8−2
@@ -32,6 +32,7 @@ struct i915_params i915 __read_mostly = { · 31 unmodified lines
3232 .panel_use_ssc = -1,
3333 .vbt_sdvo_panel_type = -1,
3434 .enable_rc6 = -1,
35+ .enable_dc = -1,
3536 .enable_fbc = -1,
3637 .enable_execlists = -1,
3738 .enable_hangcheck = true,
@@ -80,6 +81,11 @@ MODULE_PARM_DESC(enable_rc6, · 42 unmodified lines
8081 "For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. "
8182 "default: -1 (use per-chip default)");
8283
84+module_param_named_unsafe(enable_dc, i915.enable_dc, int, 0400);
85+MODULE_PARM_DESC(enable_dc,
86+ "Enable power-saving display C-states. "
87+ "(-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6)");
88+
8389 module_param_named_unsafe(enable_fbc, i915.enable_fbc, int, 0600);
8490 MODULE_PARM_DESC(enable_fbc,
8591 "Enable frame buffer compression for power savings "
@@ -112,7 +118,7 @@ MODULE_PARM_DESC(enable_hangcheck, · 26 unmodified lines
112118 module_param_named_unsafe(enable_ppgtt, i915.enable_ppgtt, int, 0400);
113119 MODULE_PARM_DESC(enable_ppgtt,
114120 "Override PPGTT usage. "
115− "(-1=auto [default], 0=disabled, 1=aliasing, 2=full)");
121+ "(-1=auto [default], 0=disabled, 1=aliasing, 2=full, 3=full with extended address space)");
116122
117123 module_param_named_unsafe(enable_execlists, i915.enable_execlists, int, 0400);
118124 MODULE_PARM_DESC(enable_execlists,
@@ -126,7 +132,7 @@ module_param_named_unsafe(preliminary_hw_support, i915.preliminary_hw_support, i · 7 unmodified lines
126132 MODULE_PARM_DESC(preliminary_hw_support,
127133 "Enable preliminary hardware support.");
128134
129−module_param_named_unsafe(disable_power_well, i915.disable_power_well, int, 0600);
135+module_param_named_unsafe(disable_power_well, i915.disable_power_well, int, 0400);
130136 MODULE_PARM_DESC(disable_power_well,
131137 "Disable display power wells when possible "
132138 "(-1=auto [default], 0=power wells always on, 1=power wells disabled when possible)");
drivers/gpu/drm/i915/i915_reg.h+1370−1372
@@ -25,14 +25,43 @@ · 24 unmodified lines
2525 #ifndef _I915_REG_H_
2626 #define _I915_REG_H_
2727
28+typedef struct {
29+ uint32_t reg;
30+} i915_reg_t;
31+
32+#define _MMIO(r) ((const i915_reg_t){ .reg = (r) })
33+
34+#define INVALID_MMIO_REG _MMIO(0)
35+
36+static inline uint32_t i915_mmio_reg_offset(i915_reg_t reg)
37+{
38+ return reg.reg;
39+}
40+
41+static inline bool i915_mmio_reg_equal(i915_reg_t a, i915_reg_t b)
42+{
43+ return i915_mmio_reg_offset(a) == i915_mmio_reg_offset(b);
44+}
45+
46+static inline bool i915_mmio_reg_valid(i915_reg_t reg)
47+{
48+ return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
49+}
50+
2851 #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
52+#define _MMIO_PIPE(pipe, a, b) _MMIO(_PIPE(pipe, a, b))
2953 #define _PLANE(plane, a, b) _PIPE(plane, a, b)
30−#define _TRANSCODER(tran, a, b) ((a) + (tran)*((b)-(a)))
54+#define _MMIO_PLANE(plane, a, b) _MMIO_PIPE(plane, a, b)
55+#define _TRANS(tran, a, b) ((a) + (tran)*((b)-(a)))
56+#define _MMIO_TRANS(tran, a, b) _MMIO(_TRANS(tran, a, b))
3157 #define _PORT(port, a, b) ((a) + (port)*((b)-(a)))
58+#define _MMIO_PORT(port, a, b) _MMIO(_PORT(port, a, b))
3259 #define _PIPE3(pipe, a, b, c) ((pipe) == PIPE_A ? (a) : \
3360 (pipe) == PIPE_B ? (b) : (c))
61+#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PIPE3(pipe, a, b, c))
3462 #define _PORT3(port, a, b, c) ((port) == PORT_A ? (a) : \
3563 (port) == PORT_B ? (b) : (c))
64+#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PORT3(pipe, a, b, c))
3665
3766 #define _MASKED_FIELD(mask, value) ({ \
3867 if (__builtin_constant_p(mask)) \
@@ -105,14 +134,14 @@ · 66 unmodified lines
105134 #define GRDOM_RESET_STATUS (1<<1)
106135 #define GRDOM_RESET_ENABLE (1<<0)
107136
108−#define ILK_GDSR (MCHBAR_MIRROR_BASE + 0x2ca4)
137+#define ILK_GDSR _MMIO(MCHBAR_MIRROR_BASE + 0x2ca4)
109138 #define ILK_GRDOM_FULL (0<<1)
110139 #define ILK_GRDOM_RENDER (1<<1)
111140 #define ILK_GRDOM_MEDIA (3<<1)
112141 #define ILK_GRDOM_MASK (3<<1)
113142 #define ILK_GRDOM_RESET_ENABLE (1<<0)
114143
115−#define GEN6_MBCUNIT_SNPCR 0x900c /* for LLC config */
144+#define GEN6_MBCUNIT_SNPCR _MMIO(0x900c) /* for LLC config */
116145 #define GEN6_MBC_SNPCR_SHIFT 21
117146 #define GEN6_MBC_SNPCR_MASK (3<<21)
118147 #define GEN6_MBC_SNPCR_MAX (0<<21)
@@ -120,31 +149,31 @@ · 1 unmodified line
120149 #define GEN6_MBC_SNPCR_LOW (2<<21)
121150 #define GEN6_MBC_SNPCR_MIN (3<<21) /* only 1/16th of the cache is shared */
122151
123−#define VLV_G3DCTL 0x9024
124−#define VLV_GSCKGCTL 0x9028
152+#define VLV_G3DCTL _MMIO(0x9024)
153+#define VLV_GSCKGCTL _MMIO(0x9028)
125154
126−#define GEN6_MBCTL 0x0907c
155+#define GEN6_MBCTL _MMIO(0x0907c)
127156 #define GEN6_MBCTL_ENABLE_BOOT_FETCH (1 << 4)
128157 #define GEN6_MBCTL_CTX_FETCH_NEEDED (1 << 3)
129158 #define GEN6_MBCTL_BME_UPDATE_ENABLE (1 << 2)
130159 #define GEN6_MBCTL_MAE_UPDATE_ENABLE (1 << 1)
131160 #define GEN6_MBCTL_BOOT_FETCH_MECH (1 << 0)
132161
133−#define GEN6_GDRST 0x941c
162+#define GEN6_GDRST _MMIO(0x941c)
134163 #define GEN6_GRDOM_FULL (1 << 0)
135164 #define GEN6_GRDOM_RENDER (1 << 1)
136165 #define GEN6_GRDOM_MEDIA (1 << 2)
137166 #define GEN6_GRDOM_BLT (1 << 3)
138167
139−#define RING_PP_DIR_BASE(ring) ((ring)->mmio_base+0x228)
140−#define RING_PP_DIR_BASE_READ(ring) ((ring)->mmio_base+0x518)
141−#define RING_PP_DIR_DCLV(ring) ((ring)->mmio_base+0x220)
168+#define RING_PP_DIR_BASE(ring) _MMIO((ring)->mmio_base+0x228)
169+#define RING_PP_DIR_BASE_READ(ring) _MMIO((ring)->mmio_base+0x518)
170+#define RING_PP_DIR_DCLV(ring) _MMIO((ring)->mmio_base+0x220)
142171 #define PP_DIR_DCLV_2G 0xffffffff
143172
144−#define GEN8_RING_PDP_UDW(ring, n) ((ring)->mmio_base+0x270 + ((n) * 8 + 4))
145−#define GEN8_RING_PDP_LDW(ring, n) ((ring)->mmio_base+0x270 + (n) * 8)
173+#define GEN8_RING_PDP_UDW(ring, n) _MMIO((ring)->mmio_base+0x270 + (n) * 8 + 4)
174+#define GEN8_RING_PDP_LDW(ring, n) _MMIO((ring)->mmio_base+0x270 + (n) * 8)
146175
147−#define GEN8_R_PWR_CLK_STATE 0x20C8
176+#define GEN8_R_PWR_CLK_STATE _MMIO(0x20C8)
148177 #define GEN8_RPCS_ENABLE (1 << 31)
149178 #define GEN8_RPCS_S_CNT_ENABLE (1 << 18)
150179 #define GEN8_RPCS_S_CNT_SHIFT 15
@@ -157,7 +186,7 @@ · 6 unmodified lines
157186 #define GEN8_RPCS_EU_MIN_SHIFT 0
158187 #define GEN8_RPCS_EU_MIN_MASK (0xf << GEN8_RPCS_EU_MIN_SHIFT)
159188
160−#define GAM_ECOCHK 0x4090
189+#define GAM_ECOCHK _MMIO(0x4090)
161190 #define BDW_DISABLE_HDC_INVALIDATION (1<<25)
162191 #define ECOCHK_SNB_BIT (1<<10)
163192 #define ECOCHK_DIS_TLB (1<<8)
@@ -170,15 +199,15 @@ · 6 unmodified lines
170199 #define ECOCHK_PPGTT_WT_HSW (0x2<<3)
171200 #define ECOCHK_PPGTT_WB_HSW (0x3<<3)
172201
173−#define GAC_ECO_BITS 0x14090
202+#define GAC_ECO_BITS _MMIO(0x14090)
174203 #define ECOBITS_SNB_BIT (1<<13)
175204 #define ECOBITS_PPGTT_CACHE64B (3<<8)
176205 #define ECOBITS_PPGTT_CACHE4B (0<<8)
177206
178−#define GAB_CTL 0x24000
207+#define GAB_CTL _MMIO(0x24000)
179208 #define GAB_CTL_CONT_AFTER_PAGEFAULT (1<<8)
180209
181−#define GEN6_STOLEN_RESERVED 0x1082C0
210+#define GEN6_STOLEN_RESERVED _MMIO(0x1082C0)
182211 #define GEN6_STOLEN_RESERVED_ADDR_MASK (0xFFF << 20)
183212 #define GEN7_STOLEN_RESERVED_ADDR_MASK (0x3FFF << 18)
184213 #define GEN6_STOLEN_RESERVED_SIZE_MASK (3 << 4)
@@ -200,6 +229,7 @@ · 15 unmodified lines
200229 #define VGA_ST01_MDA 0x3ba
201230 #define VGA_ST01_CGA 0x3da
202231
232+#define _VGA_MSR_WRITE _MMIO(0x3c2)
203233 #define VGA_MSR_WRITE 0x3c2
204234 #define VGA_MSR_READ 0x3cc
205235 #define VGA_MSR_MEM_EN (1<<1)
@@ -377,10 +407,12 @@ · 171 unmodified lines
377407 #define MI_BATCH_BUFFER_START_GEN8 MI_INSTR(0x31, 1)
378408 #define MI_BATCH_RESOURCE_STREAMER (1<<10)
379409
380−#define MI_PREDICATE_SRC0 (0x2400)
381−#define MI_PREDICATE_SRC1 (0x2408)
410+#define MI_PREDICATE_SRC0 _MMIO(0x2400)
411+#define MI_PREDICATE_SRC0_UDW _MMIO(0x2400 + 4)
412+#define MI_PREDICATE_SRC1 _MMIO(0x2408)
413+#define MI_PREDICATE_SRC1_UDW _MMIO(0x2408 + 4)
382414
383−#define MI_PREDICATE_RESULT_2 (0x2214)
415+#define MI_PREDICATE_RESULT_2 _MMIO(0x2214)
384416 #define LOWER_SLICE_ENABLED (1<<0)
385417 #define LOWER_SLICE_DISABLED (0<<0)
386418
@@ -509,49 +541,61 @@ · 122 unmodified lines
509541 /*
510542 * Registers used only by the command parser
511543 */
512−#define BCS_SWCTRL 0x22200
513−
514−#define GPGPU_THREADS_DISPATCHED 0x2290
515−#define HS_INVOCATION_COUNT 0x2300
516−#define DS_INVOCATION_COUNT 0x2308
517−#define IA_VERTICES_COUNT 0x2310
518−#define IA_PRIMITIVES_COUNT 0x2318
519−#define VS_INVOCATION_COUNT 0x2320
520−#define GS_INVOCATION_COUNT 0x2328
521−#define GS_PRIMITIVES_COUNT 0x2330
522−#define CL_INVOCATION_COUNT 0x2338
523−#define CL_PRIMITIVES_COUNT 0x2340
524−#define PS_INVOCATION_COUNT 0x2348
525−#define PS_DEPTH_COUNT 0x2350
544+#define BCS_SWCTRL _MMIO(0x22200)
545+
546+#define GPGPU_THREADS_DISPATCHED _MMIO(0x2290)
547+#define GPGPU_THREADS_DISPATCHED_UDW _MMIO(0x2290 + 4)
548+#define HS_INVOCATION_COUNT _MMIO(0x2300)
549+#define HS_INVOCATION_COUNT_UDW _MMIO(0x2300 + 4)
550+#define DS_INVOCATION_COUNT _MMIO(0x2308)
551+#define DS_INVOCATION_COUNT_UDW _MMIO(0x2308 + 4)
552+#define IA_VERTICES_COUNT _MMIO(0x2310)
553+#define IA_VERTICES_COUNT_UDW _MMIO(0x2310 + 4)
554+#define IA_PRIMITIVES_COUNT _MMIO(0x2318)
555+#define IA_PRIMITIVES_COUNT_UDW _MMIO(0x2318 + 4)
556+#define VS_INVOCATION_COUNT _MMIO(0x2320)
557+#define VS_INVOCATION_COUNT_UDW _MMIO(0x2320 + 4)
558+#define GS_INVOCATION_COUNT _MMIO(0x2328)
559+#define GS_INVOCATION_COUNT_UDW _MMIO(0x2328 + 4)
560+#define GS_PRIMITIVES_COUNT _MMIO(0x2330)
561+#define GS_PRIMITIVES_COUNT_UDW _MMIO(0x2330 + 4)
562+#define CL_INVOCATION_COUNT _MMIO(0x2338)
563+#define CL_INVOCATION_COUNT_UDW _MMIO(0x2338 + 4)
564+#define CL_PRIMITIVES_COUNT _MMIO(0x2340)
565+#define CL_PRIMITIVES_COUNT_UDW _MMIO(0x2340 + 4)
566+#define PS_INVOCATION_COUNT _MMIO(0x2348)
567+#define PS_INVOCATION_COUNT_UDW _MMIO(0x2348 + 4)
568+#define PS_DEPTH_COUNT _MMIO(0x2350)
569+#define PS_DEPTH_COUNT_UDW _MMIO(0x2350 + 4)
526570
527571 /* There are the 4 64-bit counter registers, one for each stream output */
528−#define GEN7_SO_NUM_PRIMS_WRITTEN(n) (0x5200 + (n) * 8)
572+#define GEN7_SO_NUM_PRIMS_WRITTEN(n) _MMIO(0x5200 + (n) * 8)
573+#define GEN7_SO_NUM_PRIMS_WRITTEN_UDW(n) _MMIO(0x5200 + (n) * 8 + 4)
529574
530−#define GEN7_SO_PRIM_STORAGE_NEEDED(n) (0x5240 + (n) * 8)
575+#define GEN7_SO_PRIM_STORAGE_NEEDED(n) _MMIO(0x5240 + (n) * 8)
576+#define GEN7_SO_PRIM_STORAGE_NEEDED_UDW(n) _MMIO(0x5240 + (n) * 8 + 4)
531577
532−#define GEN7_3DPRIM_END_OFFSET 0x2420
533−#define GEN7_3DPRIM_START_VERTEX 0x2430
534−#define GEN7_3DPRIM_VERTEX_COUNT 0x2434
535−#define GEN7_3DPRIM_INSTANCE_COUNT 0x2438
536−#define GEN7_3DPRIM_START_INSTANCE 0x243C
537−#define GEN7_3DPRIM_BASE_VERTEX 0x2440
578+#define GEN7_3DPRIM_END_OFFSET _MMIO(0x2420)
579+#define GEN7_3DPRIM_START_VERTEX _MMIO(0x2430)
580+#define GEN7_3DPRIM_VERTEX_COUNT _MMIO(0x2434)
581+#define GEN7_3DPRIM_INSTANCE_COUNT _MMIO(0x2438)
582+#define GEN7_3DPRIM_START_INSTANCE _MMIO(0x243C)
583+#define GEN7_3DPRIM_BASE_VERTEX _MMIO(0x2440)
538584
539−#define GEN7_GPGPU_DISPATCHDIMX 0x2500
540−#define GEN7_GPGPU_DISPATCHDIMY 0x2504
541−#define GEN7_GPGPU_DISPATCHDIMZ 0x2508
585+#define GEN7_GPGPU_DISPATCHDIMX _MMIO(0x2500)
586+#define GEN7_GPGPU_DISPATCHDIMY _MMIO(0x2504)
587+#define GEN7_GPGPU_DISPATCHDIMZ _MMIO(0x2508)
542588
543−#define OACONTROL 0x2360
589+#define OACONTROL _MMIO(0x2360)
544590
545591 #define _GEN7_PIPEA_DE_LOAD_SL 0x70068
546592 #define _GEN7_PIPEB_DE_LOAD_SL 0x71068
547−#define GEN7_PIPE_DE_LOAD_SL(pipe) _PIPE(pipe, \
548− _GEN7_PIPEA_DE_LOAD_SL, \
549− _GEN7_PIPEB_DE_LOAD_SL)
593+#define GEN7_PIPE_DE_LOAD_SL(pipe) _MMIO_PIPE(pipe, _GEN7_PIPEA_DE_LOAD_SL, _GEN7_PIPEB_DE_LOAD_SL)
550594
551595 /*
552596 * Reset registers
553597 */
554−#define DEBUG_RESET_I830 0x6070
598+#define DEBUG_RESET_I830 _MMIO(0x6070)
555599 #define DEBUG_RESET_FULL (1<<7)
556600 #define DEBUG_RESET_RENDER (1<<8)
557601 #define DEBUG_RESET_DISPLAY (1<<9)
@@ -559,7 +603,7 @@ · 1 unmodified line
559603 /*
560604 * IOSF sideband
561605 */
562−#define VLV_IOSF_DOORBELL_REQ (VLV_DISPLAY_BASE + 0x2100)
606+#define VLV_IOSF_DOORBELL_REQ _MMIO(VLV_DISPLAY_BASE + 0x2100)
563607 #define IOSF_DEVFN_SHIFT 24
564608 #define IOSF_OPCODE_SHIFT 16
565609 #define IOSF_PORT_SHIFT 8
@@ -576,8 +620,8 @@ · 10 unmodified lines
576620 #define IOSF_PORT_CCU 0xA9
577621 #define IOSF_PORT_GPS_CORE 0x48
578622 #define IOSF_PORT_FLISDSI 0x1B
579−#define VLV_IOSF_DATA (VLV_DISPLAY_BASE + 0x2104)
580−#define VLV_IOSF_ADDR (VLV_DISPLAY_BASE + 0x2108)
623+#define VLV_IOSF_DATA _MMIO(VLV_DISPLAY_BASE + 0x2104)
624+#define VLV_IOSF_ADDR _MMIO(VLV_DISPLAY_BASE + 0x2108)
581625
582626 /* See configdb bunit SB addr map */
583627 #define BUNIT_REG_BISOC 0x11
@@ -609,6 +653,7 @@ · 25 unmodified lines
609653
610654 /* See the PUNIT HAS v0.8 for the below bits */
611655 enum punit_power_well {
656+ /* These numbers are fixed and must match the position of the pw bits */
612657 PUNIT_POWER_WELL_RENDER = 0,
613658 PUNIT_POWER_WELL_MEDIA = 1,
614659 PUNIT_POWER_WELL_DISP2D = 3,
@@ -621,10 +666,12 @@ enum punit_power_well { · 6 unmodified lines
621666 PUNIT_POWER_WELL_DPIO_RX1 = 11,
622667 PUNIT_POWER_WELL_DPIO_CMN_D = 12,
623668
624− PUNIT_POWER_WELL_NUM,
669+ /* Not actual bit groups. Used as IDs for lookup_power_well() */
670+ PUNIT_POWER_WELL_ALWAYS_ON,
625671 };
626672
627673 enum skl_disp_power_wells {
674+ /* These numbers are fixed and must match the position of the pw bits */
628675 SKL_DISP_PW_MISC_IO,
629676 SKL_DISP_PW_DDI_A_E,
630677 SKL_DISP_PW_DDI_B,
@@ -632,6 +679,10 @@ enum skl_disp_power_wells { · 1 unmodified line
632679 SKL_DISP_PW_DDI_D,
633680 SKL_DISP_PW_1 = 14,
634681 SKL_DISP_PW_2,
682+
683+ /* Not actual bit groups. Used as IDs for lookup_power_well() */
684+ SKL_DISP_PW_ALWAYS_ON,
685+ SKL_DISP_PW_DC_OFF,
635686 };
636687
637688 #define SKL_POWER_WELL_STATE(pw) (1 << ((pw) * 2))
@@ -832,7 +883,7 @@ enum skl_disp_power_wells { · 194 unmodified lines
832883 */
833884 #define DPIO_DEVFN 0
834885
835−#define DPIO_CTL (VLV_DISPLAY_BASE + 0x2110)
886+#define DPIO_CTL _MMIO(VLV_DISPLAY_BASE + 0x2110)
836887 #define DPIO_MODSEL1 (1<<3) /* if ref clk b == 27 */
837888 #define DPIO_MODSEL0 (1<<2) /* if ref clk a == 27 */
838889 #define DPIO_SFR_BYPASS (1<<1)
@@ -1185,9 +1236,9 @@ enum skl_disp_power_wells { · 346 unmodified lines
11851236 #define DPIO_UPAR_SHIFT 30
11861237
11871238 /* BXT PHY registers */
1188−#define _BXT_PHY(phy, a, b) _PIPE((phy), (a), (b))
1239+#define _BXT_PHY(phy, a, b) _MMIO_PIPE((phy), (a), (b))
11891240
1190−#define BXT_P_CR_GT_DISP_PWRON 0x138090
1241+#define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090)
11911242 #define GT_DISPLAY_POWER_ON(phy) (1 << (phy))
11921243
11931244 #define _PHY_CTL_FAMILY_EDP 0x64C80
@@ -1203,7 +1254,7 @@ enum skl_disp_power_wells { · 9 unmodified lines
12031254 #define PORT_PLL_ENABLE (1 << 31)
12041255 #define PORT_PLL_LOCK (1 << 30)
12051256 #define PORT_PLL_REF_SEL (1 << 27)
1206−#define BXT_PORT_PLL_ENABLE(port) _PORT(port, _PORT_PLL_A, _PORT_PLL_B)
1257+#define BXT_PORT_PLL_ENABLE(port) _MMIO_PORT(port, _PORT_PLL_A, _PORT_PLL_B)
12071258
12081259 #define _PORT_PLL_EBB_0_A 0x162034
12091260 #define _PORT_PLL_EBB_0_B 0x6C034
@@ -1214,7 +1265,7 @@ enum skl_disp_power_wells { · 4 unmodified lines
12141265 #define PORT_PLL_P2_SHIFT 8
12151266 #define PORT_PLL_P2_MASK (0x1f << PORT_PLL_P2_SHIFT)
12161267 #define PORT_PLL_P2(x) ((x) << PORT_PLL_P2_SHIFT)
1217−#define BXT_PORT_PLL_EBB_0(port) _PORT3(port, _PORT_PLL_EBB_0_A, \
1268+#define BXT_PORT_PLL_EBB_0(port) _MMIO_PORT3(port, _PORT_PLL_EBB_0_A, \
12181269 _PORT_PLL_EBB_0_B, \
12191270 _PORT_PLL_EBB_0_C)
12201271
@@ -1223,7 +1274,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
12231274 #define _PORT_PLL_EBB_4_C 0x6C344
12241275 #define PORT_PLL_10BIT_CLK_ENABLE (1 << 13)
12251276 #define PORT_PLL_RECALIBRATE (1 << 14)
1226−#define BXT_PORT_PLL_EBB_4(port) _PORT3(port, _PORT_PLL_EBB_4_A, \
1277+#define BXT_PORT_PLL_EBB_4(port) _MMIO_PORT3(port, _PORT_PLL_EBB_4_A, \
12271278 _PORT_PLL_EBB_4_B, \
12281279 _PORT_PLL_EBB_4_C)
12291280
@@ -1259,7 +1310,7 @@ enum skl_disp_power_wells { · 29 unmodified lines
12591310 #define _PORT_PLL_BASE(port) _PORT3(port, _PORT_PLL_0_A, \
12601311 _PORT_PLL_0_B, \
12611312 _PORT_PLL_0_C)
1262−#define BXT_PORT_PLL(port, idx) (_PORT_PLL_BASE(port) + (idx) * 4)
1313+#define BXT_PORT_PLL(port, idx) _MMIO(_PORT_PLL_BASE(port) + (idx) * 4)
12631314
12641315 /* BXT PHY common lane registers */
12651316 #define _PORT_CL1CM_DW0_A 0x162000
@@ -1297,7 +1348,7 @@ enum skl_disp_power_wells { · 31 unmodified lines
12971348 _PORT_CL1CM_DW30_A)
12981349
12991350 /* Defined for PHY0 only */
1300−#define BXT_PORT_CL2CM_DW6_BC 0x6C358
1351+#define BXT_PORT_CL2CM_DW6_BC _MMIO(0x6C358)
13011352 #define DW6_OLDO_DYN_PWR_DOWN_EN (1 << 28)
13021353
13031354 /* BXT PHY Ref registers */
@@ -1337,10 +1388,10 @@ enum skl_disp_power_wells { · 33 unmodified lines
13371388 #define _PORT_PCS_DW10_GRP_A 0x162C28
13381389 #define _PORT_PCS_DW10_GRP_B 0x6CC28
13391390 #define _PORT_PCS_DW10_GRP_C 0x6CE28
1340−#define BXT_PORT_PCS_DW10_LN01(port) _PORT3(port, _PORT_PCS_DW10_LN01_A, \
1391+#define BXT_PORT_PCS_DW10_LN01(port) _MMIO_PORT3(port, _PORT_PCS_DW10_LN01_A, \
13411392 _PORT_PCS_DW10_LN01_B, \
13421393 _PORT_PCS_DW10_LN01_C)
1343−#define BXT_PORT_PCS_DW10_GRP(port) _PORT3(port, _PORT_PCS_DW10_GRP_A, \
1394+#define BXT_PORT_PCS_DW10_GRP(port) _MMIO_PORT3(port, _PORT_PCS_DW10_GRP_A, \
13441395 _PORT_PCS_DW10_GRP_B, \
13451396 _PORT_PCS_DW10_GRP_C)
13461397 #define TX2_SWING_CALC_INIT (1 << 31)
@@ -1357,13 +1408,13 @@ enum skl_disp_power_wells { · 10 unmodified lines
13571408 #define _PORT_PCS_DW12_GRP_C 0x6CE30
13581409 #define LANESTAGGER_STRAP_OVRD (1 << 6)
13591410 #define LANE_STAGGER_MASK 0x1F
1360−#define BXT_PORT_PCS_DW12_LN01(port) _PORT3(port, _PORT_PCS_DW12_LN01_A, \
1411+#define BXT_PORT_PCS_DW12_LN01(port) _MMIO_PORT3(port, _PORT_PCS_DW12_LN01_A, \
13611412 _PORT_PCS_DW12_LN01_B, \
13621413 _PORT_PCS_DW12_LN01_C)
1363−#define BXT_PORT_PCS_DW12_LN23(port) _PORT3(port, _PORT_PCS_DW12_LN23_A, \
1414+#define BXT_PORT_PCS_DW12_LN23(port) _MMIO_PORT3(port, _PORT_PCS_DW12_LN23_A, \
13641415 _PORT_PCS_DW12_LN23_B, \
13651416 _PORT_PCS_DW12_LN23_C)
1366−#define BXT_PORT_PCS_DW12_GRP(port) _PORT3(port, _PORT_PCS_DW12_GRP_A, \
1417+#define BXT_PORT_PCS_DW12_GRP(port) _MMIO_PORT3(port, _PORT_PCS_DW12_GRP_A, \
13671418 _PORT_PCS_DW12_GRP_B, \
13681419 _PORT_PCS_DW12_GRP_C)
13691420
@@ -1377,10 +1428,10 @@ enum skl_disp_power_wells { · 7 unmodified lines
13771428 #define _PORT_TX_DW2_GRP_A 0x162D08
13781429 #define _PORT_TX_DW2_GRP_B 0x6CD08
13791430 #define _PORT_TX_DW2_GRP_C 0x6CF08
1380−#define BXT_PORT_TX_DW2_GRP(port) _PORT3(port, _PORT_TX_DW2_GRP_A, \
1431+#define BXT_PORT_TX_DW2_GRP(port) _MMIO_PORT3(port, _PORT_TX_DW2_GRP_A, \
13811432 _PORT_TX_DW2_GRP_B, \
13821433 _PORT_TX_DW2_GRP_C)
1383−#define BXT_PORT_TX_DW2_LN0(port) _PORT3(port, _PORT_TX_DW2_LN0_A, \
1434+#define BXT_PORT_TX_DW2_LN0(port) _MMIO_PORT3(port, _PORT_TX_DW2_LN0_A, \
13841435 _PORT_TX_DW2_LN0_B, \
13851436 _PORT_TX_DW2_LN0_C)
13861437 #define MARGIN_000_SHIFT 16
@@ -1394,10 +1445,10 @@ enum skl_disp_power_wells { · 7 unmodified lines
13941445 #define _PORT_TX_DW3_GRP_A 0x162D0C
13951446 #define _PORT_TX_DW3_GRP_B 0x6CD0C
13961447 #define _PORT_TX_DW3_GRP_C 0x6CF0C
1397−#define BXT_PORT_TX_DW3_GRP(port) _PORT3(port, _PORT_TX_DW3_GRP_A, \
1448+#define BXT_PORT_TX_DW3_GRP(port) _MMIO_PORT3(port, _PORT_TX_DW3_GRP_A, \
13981449 _PORT_TX_DW3_GRP_B, \
13991450 _PORT_TX_DW3_GRP_C)
1400−#define BXT_PORT_TX_DW3_LN0(port) _PORT3(port, _PORT_TX_DW3_LN0_A, \
1451+#define BXT_PORT_TX_DW3_LN0(port) _MMIO_PORT3(port, _PORT_TX_DW3_LN0_A, \
14011452 _PORT_TX_DW3_LN0_B, \
14021453 _PORT_TX_DW3_LN0_C)
14031454 #define SCALE_DCOMP_METHOD (1 << 26)
@@ -1409,10 +1460,10 @@ enum skl_disp_power_wells { · 5 unmodified lines
14091460 #define _PORT_TX_DW4_GRP_A 0x162D10
14101461 #define _PORT_TX_DW4_GRP_B 0x6CD10
14111462 #define _PORT_TX_DW4_GRP_C 0x6CF10
1412−#define BXT_PORT_TX_DW4_LN0(port) _PORT3(port, _PORT_TX_DW4_LN0_A, \
1463+#define BXT_PORT_TX_DW4_LN0(port) _MMIO_PORT3(port, _PORT_TX_DW4_LN0_A, \
14131464 _PORT_TX_DW4_LN0_B, \
14141465 _PORT_TX_DW4_LN0_C)
1415−#define BXT_PORT_TX_DW4_GRP(port) _PORT3(port, _PORT_TX_DW4_GRP_A, \
1466+#define BXT_PORT_TX_DW4_GRP(port) _MMIO_PORT3(port, _PORT_TX_DW4_GRP_A, \
14161467 _PORT_TX_DW4_GRP_B, \
14171468 _PORT_TX_DW4_GRP_C)
14181469 #define DEEMPH_SHIFT 24
@@ -1423,17 +1474,17 @@ enum skl_disp_power_wells { · 4 unmodified lines
14231474 #define _PORT_TX_DW14_LN0_C 0x6C938
14241475 #define LATENCY_OPTIM_SHIFT 30
14251476 #define LATENCY_OPTIM (1 << LATENCY_OPTIM_SHIFT)
1426−#define BXT_PORT_TX_DW14_LN(port, lane) (_PORT3((port), _PORT_TX_DW14_LN0_A, \
1477+#define BXT_PORT_TX_DW14_LN(port, lane) _MMIO(_PORT3((port), _PORT_TX_DW14_LN0_A, \
14271478 _PORT_TX_DW14_LN0_B, \
14281479 _PORT_TX_DW14_LN0_C) + \
14291480 _BXT_LANE_OFFSET(lane))
14301481
14311482 /* UAIMI scratch pad register 1 */
1432−#define UAIMI_SPR1 0x4F074
1483+#define UAIMI_SPR1 _MMIO(0x4F074)
14331484 /* SKL VccIO mask */
14341485 #define SKL_VCCIO_MASK 0x1
14351486 /* SKL balance leg register */
1436−#define DISPIO_CR_TX_BMU_CR0 0x6C00C
1487+#define DISPIO_CR_TX_BMU_CR0 _MMIO(0x6C00C)
14371488 /* I_boost values */
14381489 #define BALANCE_LEG_SHIFT(port) (8+3*(port))
14391490 #define BALANCE_LEG_MASK(port) (7<<(8+3*(port)))
@@ -1450,7 +1501,7 @@ enum skl_disp_power_wells { · 10 unmodified lines
14501501 * [0-15] @ 0x100000 gen6,vlv,chv
14511502 * [0-31] @ 0x100000 gen7+
14521503 */
1453−#define FENCE_REG(i) (0x2000 + (((i) & 8) << 9) + ((i) & 7) * 4)
1504+#define FENCE_REG(i) _MMIO(0x2000 + (((i) & 8) << 9) + ((i) & 7) * 4)
14541505 #define I830_FENCE_START_MASK 0x07f80000
14551506 #define I830_FENCE_TILING_Y_SHIFT 12
14561507 #define I830_FENCE_SIZE_BITS(size) ((ffs((size) >> 19) - 1) << 8)
@@ -1463,21 +1514,21 @@ enum skl_disp_power_wells { · 6 unmodified lines
14631514 #define I915_FENCE_START_MASK 0x0ff00000
14641515 #define I915_FENCE_SIZE_BITS(size) ((ffs((size) >> 20) - 1) << 8)
14651516
1466−#define FENCE_REG_965_LO(i) (0x03000 + (i) * 8)
1467−#define FENCE_REG_965_HI(i) (0x03000 + (i) * 8 + 4)
1517+#define FENCE_REG_965_LO(i) _MMIO(0x03000 + (i) * 8)
1518+#define FENCE_REG_965_HI(i) _MMIO(0x03000 + (i) * 8 + 4)
14681519 #define I965_FENCE_PITCH_SHIFT 2
14691520 #define I965_FENCE_TILING_Y_SHIFT 1
14701521 #define I965_FENCE_REG_VALID (1<<0)
14711522 #define I965_FENCE_MAX_PITCH_VAL 0x0400
14721523
1473−#define FENCE_REG_GEN6_LO(i) (0x100000 + (i) * 8)
1474−#define FENCE_REG_GEN6_HI(i) (0x100000 + (i) * 8 + 4)
1524+#define FENCE_REG_GEN6_LO(i) _MMIO(0x100000 + (i) * 8)
1525+#define FENCE_REG_GEN6_HI(i) _MMIO(0x100000 + (i) * 8 + 4)
14751526 #define GEN6_FENCE_PITCH_SHIFT 32
14761527 #define GEN7_FENCE_MAX_PITCH_VAL 0x0800
14771528
14781529
14791530 /* control register for cpu gtt access */
1480−#define TILECTL 0x101000
1531+#define TILECTL _MMIO(0x101000)
14811532 #define TILECTL_SWZCTL (1 << 0)
14821533 #define TILECTL_TLBPF (1 << 1)
14831534 #define TILECTL_TLB_PREFETCH_DIS (1 << 2)
@@ -1486,30 +1537,30 @@ enum skl_disp_power_wells { · 2 unmodified lines
14861537 /*
14871538 * Instruction and interrupt control regs
14881539 */
1489−#define PGTBL_CTL 0x02020
1540+#define PGTBL_CTL _MMIO(0x02020)
14901541 #define PGTBL_ADDRESS_LO_MASK 0xfffff000 /* bits [31:12] */
14911542 #define PGTBL_ADDRESS_HI_MASK 0x000000f0 /* bits [35:32] (gen4) */
1492−#define PGTBL_ER 0x02024
1493−#define PRB0_BASE (0x2030-0x30)
1494−#define PRB1_BASE (0x2040-0x30) /* 830,gen3 */
1495−#define PRB2_BASE (0x2050-0x30) /* gen3 */
1496−#define SRB0_BASE (0x2100-0x30) /* gen2 */
1497−#define SRB1_BASE (0x2110-0x30) /* gen2 */
1498−#define SRB2_BASE (0x2120-0x30) /* 830 */
1499−#define SRB3_BASE (0x2130-0x30) /* 830 */
1543+#define PGTBL_ER _MMIO(0x02024)
1544+#define PRB0_BASE (0x2030-0x30)
1545+#define PRB1_BASE (0x2040-0x30) /* 830,gen3 */
1546+#define PRB2_BASE (0x2050-0x30) /* gen3 */
1547+#define SRB0_BASE (0x2100-0x30) /* gen2 */
1548+#define SRB1_BASE (0x2110-0x30) /* gen2 */
1549+#define SRB2_BASE (0x2120-0x30) /* 830 */
1550+#define SRB3_BASE (0x2130-0x30) /* 830 */
15001551 #define RENDER_RING_BASE 0x02000
15011552 #define BSD_RING_BASE 0x04000
15021553 #define GEN6_BSD_RING_BASE 0x12000
15031554 #define GEN8_BSD2_RING_BASE 0x1c000
15041555 #define VEBOX_RING_BASE 0x1a000
15051556 #define BLT_RING_BASE 0x22000
1506−#define RING_TAIL(base) ((base)+0x30)
1507−#define RING_HEAD(base) ((base)+0x34)
1508−#define RING_START(base) ((base)+0x38)
1509−#define RING_CTL(base) ((base)+0x3c)
1510−#define RING_SYNC_0(base) ((base)+0x40)
1511−#define RING_SYNC_1(base) ((base)+0x44)
1512−#define RING_SYNC_2(base) ((base)+0x48)
1557+#define RING_TAIL(base) _MMIO((base)+0x30)
1558+#define RING_HEAD(base) _MMIO((base)+0x34)
1559+#define RING_START(base) _MMIO((base)+0x38)
1560+#define RING_CTL(base) _MMIO((base)+0x3c)
1561+#define RING_SYNC_0(base) _MMIO((base)+0x40)
1562+#define RING_SYNC_1(base) _MMIO((base)+0x44)
1563+#define RING_SYNC_2(base) _MMIO((base)+0x48)
15131564 #define GEN6_RVSYNC (RING_SYNC_0(RENDER_RING_BASE))
15141565 #define GEN6_RBSYNC (RING_SYNC_1(RENDER_RING_BASE))
15151566 #define GEN6_RVESYNC (RING_SYNC_2(RENDER_RING_BASE))
@@ -1522,51 +1573,52 @@ enum skl_disp_power_wells { · 6 unmodified lines
15221573 #define GEN6_VEBSYNC (RING_SYNC_0(VEBOX_RING_BASE))
15231574 #define GEN6_VERSYNC (RING_SYNC_1(VEBOX_RING_BASE))
15241575 #define GEN6_VEVSYNC (RING_SYNC_2(VEBOX_RING_BASE))
1525−#define GEN6_NOSYNC 0
1526−#define RING_PSMI_CTL(base) ((base)+0x50)
1527−#define RING_MAX_IDLE(base) ((base)+0x54)
1528−#define RING_HWS_PGA(base) ((base)+0x80)
1529−#define RING_HWS_PGA_GEN6(base) ((base)+0x2080)
1530−#define RING_RESET_CTL(base) ((base)+0xd0)
1576+#define GEN6_NOSYNC INVALID_MMIO_REG
1577+#define RING_PSMI_CTL(base) _MMIO((base)+0x50)
1578+#define RING_MAX_IDLE(base) _MMIO((base)+0x54)
1579+#define RING_HWS_PGA(base) _MMIO((base)+0x80)
1580+#define RING_HWS_PGA_GEN6(base) _MMIO((base)+0x2080)
1581+#define RING_RESET_CTL(base) _MMIO((base)+0xd0)
15311582 #define RESET_CTL_REQUEST_RESET (1 << 0)
15321583 #define RESET_CTL_READY_TO_RESET (1 << 1)
15331584
1534−#define HSW_GTT_CACHE_EN 0x4024
1585+#define HSW_GTT_CACHE_EN _MMIO(0x4024)
15351586 #define GTT_CACHE_EN_ALL 0xF0007FFF
1536−#define GEN7_WR_WATERMARK 0x4028
1537−#define GEN7_GFX_PRIO_CTRL 0x402C
1538−#define ARB_MODE 0x4030
1587+#define GEN7_WR_WATERMARK _MMIO(0x4028)
1588+#define GEN7_GFX_PRIO_CTRL _MMIO(0x402C)
1589+#define ARB_MODE _MMIO(0x4030)
15391590 #define ARB_MODE_SWIZZLE_SNB (1<<4)
15401591 #define ARB_MODE_SWIZZLE_IVB (1<<5)
1541−#define GEN7_GFX_PEND_TLB0 0x4034
1542−#define GEN7_GFX_PEND_TLB1 0x4038
1592+#define GEN7_GFX_PEND_TLB0 _MMIO(0x4034)
1593+#define GEN7_GFX_PEND_TLB1 _MMIO(0x4038)
15431594 /* L3, CVS, ZTLB, RCC, CASC LRA min, max values */
1544−#define GEN7_LRA_LIMITS(i) (0x403C + (i) * 4)
1595+#define GEN7_LRA_LIMITS(i) _MMIO(0x403C + (i) * 4)
15451596 #define GEN7_LRA_LIMITS_REG_NUM 13
1546−#define GEN7_MEDIA_MAX_REQ_COUNT 0x4070
1547−#define GEN7_GFX_MAX_REQ_COUNT 0x4074
1597+#define GEN7_MEDIA_MAX_REQ_COUNT _MMIO(0x4070)
1598+#define GEN7_GFX_MAX_REQ_COUNT _MMIO(0x4074)
15481599
1549−#define GAMTARBMODE 0x04a08
1600+#define GAMTARBMODE _MMIO(0x04a08)
15501601 #define ARB_MODE_BWGTLB_DISABLE (1<<9)
15511602 #define ARB_MODE_SWIZZLE_BDW (1<<1)
1552−#define RENDER_HWS_PGA_GEN7 (0x04080)
1553−#define RING_FAULT_REG(ring) (0x4094 + 0x100*(ring)->id)
1603+#define RENDER_HWS_PGA_GEN7 _MMIO(0x04080)
1604+#define RING_FAULT_REG(ring) _MMIO(0x4094 + 0x100*(ring)->id)
15541605 #define RING_FAULT_GTTSEL_MASK (1<<11)
15551606 #define RING_FAULT_SRCID(x) (((x) >> 3) & 0xff)
15561607 #define RING_FAULT_FAULT_TYPE(x) (((x) >> 1) & 0x3)
15571608 #define RING_FAULT_VALID (1<<0)
1558−#define DONE_REG 0x40b0
1559−#define GEN8_PRIVATE_PAT_LO 0x40e0
1560−#define GEN8_PRIVATE_PAT_HI (0x40e0 + 4)
1561−#define BSD_HWS_PGA_GEN7 (0x04180)
1562−#define BLT_HWS_PGA_GEN7 (0x04280)
1563−#define VEBOX_HWS_PGA_GEN7 (0x04380)
1564−#define RING_ACTHD(base) ((base)+0x74)
1565−#define RING_ACTHD_UDW(base) ((base)+0x5c)
1566−#define RING_NOPID(base) ((base)+0x94)
1567−#define RING_IMR(base) ((base)+0xa8)
1568−#define RING_HWSTAM(base) ((base)+0x98)
1569−#define RING_TIMESTAMP(base) ((base)+0x358)
1609+#define DONE_REG _MMIO(0x40b0)
1610+#define GEN8_PRIVATE_PAT_LO _MMIO(0x40e0)
1611+#define GEN8_PRIVATE_PAT_HI _MMIO(0x40e0 + 4)
1612+#define BSD_HWS_PGA_GEN7 _MMIO(0x04180)
1613+#define BLT_HWS_PGA_GEN7 _MMIO(0x04280)
1614+#define VEBOX_HWS_PGA_GEN7 _MMIO(0x04380)
1615+#define RING_ACTHD(base) _MMIO((base)+0x74)
1616+#define RING_ACTHD_UDW(base) _MMIO((base)+0x5c)
1617+#define RING_NOPID(base) _MMIO((base)+0x94)
1618+#define RING_IMR(base) _MMIO((base)+0xa8)
1619+#define RING_HWSTAM(base) _MMIO((base)+0x98)
1620+#define RING_TIMESTAMP(base) _MMIO((base)+0x358)
1621+#define RING_TIMESTAMP_UDW(base) _MMIO((base)+0x358 + 4)
15701622 #define TAIL_ADDR 0x001FFFF8
15711623 #define HEAD_WRAP_COUNT 0xFFE00000
15721624 #define HEAD_WRAP_ONE 0x00200000
@@ -1583,57 +1635,65 @@ enum skl_disp_power_wells { · 10 unmodified lines
15831635 #define RING_WAIT (1<<11) /* gen3+, PRBx_CTL */
15841636 #define RING_WAIT_SEMAPHORE (1<<10) /* gen6+ */
15851637
1586−#define GEN7_TLB_RD_ADDR 0x4700
1638+#define GEN7_TLB_RD_ADDR _MMIO(0x4700)
15871639
15881640 #if 0
1589−#define PRB0_TAIL 0x02030
1590−#define PRB0_HEAD 0x02034
1591−#define PRB0_START 0x02038
1592−#define PRB0_CTL 0x0203c
1593−#define PRB1_TAIL 0x02040 /* 915+ only */
1594−#define PRB1_HEAD 0x02044 /* 915+ only */
1595−#define PRB1_START 0x02048 /* 915+ only */
1596−#define PRB1_CTL 0x0204c /* 915+ only */
1641+#define PRB0_TAIL _MMIO(0x2030)
1642+#define PRB0_HEAD _MMIO(0x2034)
1643+#define PRB0_START _MMIO(0x2038)
1644+#define PRB0_CTL _MMIO(0x203c)
1645+#define PRB1_TAIL _MMIO(0x2040) /* 915+ only */
1646+#define PRB1_HEAD _MMIO(0x2044) /* 915+ only */
1647+#define PRB1_START _MMIO(0x2048) /* 915+ only */
1648+#define PRB1_CTL _MMIO(0x204c) /* 915+ only */
15971649 #endif
1598−#define IPEIR_I965 0x02064
1599−#define IPEHR_I965 0x02068
1600−#define GEN7_SC_INSTDONE 0x07100
1601−#define GEN7_SAMPLER_INSTDONE 0x0e160
1602−#define GEN7_ROW_INSTDONE 0x0e164
1650+#define IPEIR_I965 _MMIO(0x2064)
1651+#define IPEHR_I965 _MMIO(0x2068)
1652+#define GEN7_SC_INSTDONE _MMIO(0x7100)
1653+#define GEN7_SAMPLER_INSTDONE _MMIO(0xe160)
1654+#define GEN7_ROW_INSTDONE _MMIO(0xe164)
16031655 #define I915_NUM_INSTDONE_REG 4
1604−#define RING_IPEIR(base) ((base)+0x64)
1605−#define RING_IPEHR(base) ((base)+0x68)
1656+#define RING_IPEIR(base) _MMIO((base)+0x64)
1657+#define RING_IPEHR(base) _MMIO((base)+0x68)
16061658 /*
16071659 * On GEN4, only the render ring INSTDONE exists and has a different
16081660 * layout than the GEN7+ version.
16091661 * The GEN2 counterpart of this register is GEN2_INSTDONE.
16101662 */
1611−#define RING_INSTDONE(base) ((base)+0x6c)
1612−#define RING_INSTPS(base) ((base)+0x70)
1613−#define RING_DMA_FADD(base) ((base)+0x78)
1614−#define RING_DMA_FADD_UDW(base) ((base)+0x60) /* gen8+ */
1615−#define RING_INSTPM(base) ((base)+0xc0)
1616−#define RING_MI_MODE(base) ((base)+0x9c)
1617−#define INSTPS 0x02070 /* 965+ only */
1618−#define GEN4_INSTDONE1 0x0207c /* 965+ only, aka INSTDONE_2 on SNB */
1619−#define ACTHD_I965 0x02074
1620−#define HWS_PGA 0x02080
1663+#define RING_INSTDONE(base) _MMIO((base)+0x6c)
1664+#define RING_INSTPS(base) _MMIO((base)+0x70)
1665+#define RING_DMA_FADD(base) _MMIO((base)+0x78)
1666+#define RING_DMA_FADD_UDW(base) _MMIO((base)+0x60) /* gen8+ */
1667+#define RING_INSTPM(base) _MMIO((base)+0xc0)
1668+#define RING_MI_MODE(base) _MMIO((base)+0x9c)
1669+#define INSTPS _MMIO(0x2070) /* 965+ only */
1670+#define GEN4_INSTDONE1 _MMIO(0x207c) /* 965+ only, aka INSTDONE_2 on SNB */
1671+#define ACTHD_I965 _MMIO(0x2074)
1672+#define HWS_PGA _MMIO(0x2080)
16211673 #define HWS_ADDRESS_MASK 0xfffff000
16221674 #define HWS_START_ADDRESS_SHIFT 4
1623−#define PWRCTXA 0x2088 /* 965GM+ only */
1675+#define PWRCTXA _MMIO(0x2088) /* 965GM+ only */
16241676 #define PWRCTX_EN (1<<0)
1625−#define IPEIR 0x02088
1626−#define IPEHR 0x0208c
1627−#define GEN2_INSTDONE 0x02090
1628−#define NOPID 0x02094
1629−#define HWSTAM 0x02098
1630−#define DMA_FADD_I8XX 0x020d0
1631−#define RING_BBSTATE(base) ((base)+0x110)
1632−#define RING_BBADDR(base) ((base)+0x140)
1633−#define RING_BBADDR_UDW(base) ((base)+0x168) /* gen8+ */
1634−
1635−#define ERROR_GEN6 0x040a0
1636−#define GEN7_ERR_INT 0x44040
1677+#define IPEIR _MMIO(0x2088)
1678+#define IPEHR _MMIO(0x208c)
1679+#define GEN2_INSTDONE _MMIO(0x2090)
1680+#define NOPID _MMIO(0x2094)
1681+#define HWSTAM _MMIO(0x2098)
1682+#define DMA_FADD_I8XX _MMIO(0x20d0)
1683+#define RING_BBSTATE(base) _MMIO((base)+0x110)
1684+#define RING_BB_PPGTT (1 << 5)
1685+#define RING_SBBADDR(base) _MMIO((base)+0x114) /* hsw+ */
1686+#define RING_SBBSTATE(base) _MMIO((base)+0x118) /* hsw+ */
1687+#define RING_SBBADDR_UDW(base) _MMIO((base)+0x11c) /* gen8+ */
1688+#define RING_BBADDR(base) _MMIO((base)+0x140)
1689+#define RING_BBADDR_UDW(base) _MMIO((base)+0x168) /* gen8+ */
1690+#define RING_BB_PER_CTX_PTR(base) _MMIO((base)+0x1c0) /* gen8+ */
1691+#define RING_INDIRECT_CTX(base) _MMIO((base)+0x1c4) /* gen8+ */
1692+#define RING_INDIRECT_CTX_OFFSET(base) _MMIO((base)+0x1c8) /* gen8+ */
1693+#define RING_CTX_TIMESTAMP(base) _MMIO((base)+0x3a8) /* gen8+ */
1694+
1695+#define ERROR_GEN6 _MMIO(0x40a0)
1696+#define GEN7_ERR_INT _MMIO(0x44040)
16371697 #define ERR_INT_POISON (1<<31)
16381698 #define ERR_INT_MMIO_UNCLAIMED (1<<13)
16391699 #define ERR_INT_PIPE_CRC_DONE_C (1<<8)
@@ -1645,13 +1705,13 @@ enum skl_disp_power_wells { · 5 unmodified lines
16451705 #define ERR_INT_FIFO_UNDERRUN_A (1<<0)
16461706 #define ERR_INT_FIFO_UNDERRUN(pipe) (1<<((pipe)*3))
16471707
1648−#define GEN8_FAULT_TLB_DATA0 0x04b10
1649−#define GEN8_FAULT_TLB_DATA1 0x04b14
1708+#define GEN8_FAULT_TLB_DATA0 _MMIO(0x4b10)
1709+#define GEN8_FAULT_TLB_DATA1 _MMIO(0x4b14)
16501710
1651−#define FPGA_DBG 0x42300
1711+#define FPGA_DBG _MMIO(0x42300)
16521712 #define FPGA_DBG_RM_NOCLAIM (1<<31)
16531713
1654−#define DERRMR 0x44050
1714+#define DERRMR _MMIO(0x44050)
16551715 /* Note that HBLANK events are reserved on bdw+ */
16561716 #define DERRMR_PIPEA_SCANLINE (1<<0)
16571717 #define DERRMR_PIPEA_PRI_FLIP_DONE (1<<1)
@@ -1675,29 +1735,29 @@ enum skl_disp_power_wells { · 17 unmodified lines
16751735 * for various sorts of correct behavior. The top 16 bits of each are
16761736 * the enables for writing to the corresponding low bit.
16771737 */
1678−#define _3D_CHICKEN 0x02084
1738+#define _3D_CHICKEN _MMIO(0x2084)
16791739 #define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10)
1680−#define _3D_CHICKEN2 0x0208c
1740+#define _3D_CHICKEN2 _MMIO(0x208c)
16811741 /* Disables pipelining of read flushes past the SF-WIZ interface.
16821742 * Required on all Ironlake steppings according to the B-Spec, but the
16831743 * particular danger of not doing so is not specified.
16841744 */
16851745 # define _3D_CHICKEN2_WM_READ_PIPELINED (1 << 14)
1686−#define _3D_CHICKEN3 0x02090
1746+#define _3D_CHICKEN3 _MMIO(0x2090)
16871747 #define _3D_CHICKEN_SF_DISABLE_OBJEND_CULL (1 << 10)
16881748 #define _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL (1 << 5)
16891749 #define _3D_CHICKEN_SDE_LIMIT_FIFO_POLY_DEPTH(x) ((x)<<1) /* gen8+ */
16901750 #define _3D_CHICKEN3_SF_DISABLE_PIPELINED_ATTR_FETCH (1 << 1) /* gen6 */
16911751
1692−#define MI_MODE 0x0209c
1752+#define MI_MODE _MMIO(0x209c)
16931753 # define VS_TIMER_DISPATCH (1 << 6)
16941754 # define MI_FLUSH_ENABLE (1 << 12)
16951755 # define ASYNC_FLIP_PERF_DISABLE (1 << 14)
16961756 # define MODE_IDLE (1 << 9)
16971757 # define STOP_RING (1 << 8)
16981758
1699−#define GEN6_GT_MODE 0x20d0
1700−#define GEN7_GT_MODE 0x7008
1759+#define GEN6_GT_MODE _MMIO(0x20d0)
1760+#define GEN7_GT_MODE _MMIO(0x7008)
17011761 #define GEN6_WIZ_HASHING(hi, lo) (((hi) << 9) | ((lo) << 7))
17021762 #define GEN6_WIZ_HASHING_8x8 GEN6_WIZ_HASHING(0, 0)
17031763 #define GEN6_WIZ_HASHING_8x4 GEN6_WIZ_HASHING(0, 1)
@@ -1707,9 +1767,9 @@ enum skl_disp_power_wells { · 3 unmodified lines
17071767 #define GEN9_IZ_HASHING_MASK(slice) (0x3 << ((slice) * 2))
17081768 #define GEN9_IZ_HASHING(slice, val) ((val) << ((slice) * 2))
17091769
1710−#define GFX_MODE 0x02520
1711−#define GFX_MODE_GEN7 0x0229c
1712−#define RING_MODE_GEN7(ring) ((ring)->mmio_base+0x29c)
1770+#define GFX_MODE _MMIO(0x2520)
1771+#define GFX_MODE_GEN7 _MMIO(0x229c)
1772+#define RING_MODE_GEN7(ring) _MMIO((ring)->mmio_base+0x29c)
17131773 #define GFX_RUN_LIST_ENABLE (1<<15)
17141774 #define GFX_INTERRUPT_STEERING (1<<14)
17151775 #define GFX_TLB_INVALIDATE_EXPLICIT (1<<13)
@@ -1727,36 +1787,36 @@ enum skl_disp_power_wells { · 11 unmodified lines
17271787 #define VLV_DISPLAY_BASE 0x180000
17281788 #define VLV_MIPI_BASE VLV_DISPLAY_BASE
17291789
1730−#define VLV_GU_CTL0 (VLV_DISPLAY_BASE + 0x2030)
1731−#define VLV_GU_CTL1 (VLV_DISPLAY_BASE + 0x2034)
1732−#define SCPD0 0x0209c /* 915+ only */
1733−#define IER 0x020a0
1734−#define IIR 0x020a4
1735−#define IMR 0x020a8
1736−#define ISR 0x020ac
1737−#define VLV_GUNIT_CLOCK_GATE (VLV_DISPLAY_BASE + 0x2060)
1790+#define VLV_GU_CTL0 _MMIO(VLV_DISPLAY_BASE + 0x2030)
1791+#define VLV_GU_CTL1 _MMIO(VLV_DISPLAY_BASE + 0x2034)
1792+#define SCPD0 _MMIO(0x209c) /* 915+ only */
1793+#define IER _MMIO(0x20a0)
1794+#define IIR _MMIO(0x20a4)
1795+#define IMR _MMIO(0x20a8)
1796+#define ISR _MMIO(0x20ac)
1797+#define VLV_GUNIT_CLOCK_GATE _MMIO(VLV_DISPLAY_BASE + 0x2060)
17381798 #define GINT_DIS (1<<22)
17391799 #define GCFG_DIS (1<<8)
1740−#define VLV_GUNIT_CLOCK_GATE2 (VLV_DISPLAY_BASE + 0x2064)
1741−#define VLV_IIR_RW (VLV_DISPLAY_BASE + 0x2084)
1742−#define VLV_IER (VLV_DISPLAY_BASE + 0x20a0)
1743−#define VLV_IIR (VLV_DISPLAY_BASE + 0x20a4)
1744−#define VLV_IMR (VLV_DISPLAY_BASE + 0x20a8)
1745−#define VLV_ISR (VLV_DISPLAY_BASE + 0x20ac)
1746−#define VLV_PCBR (VLV_DISPLAY_BASE + 0x2120)
1800+#define VLV_GUNIT_CLOCK_GATE2 _MMIO(VLV_DISPLAY_BASE + 0x2064)
1801+#define VLV_IIR_RW _MMIO(VLV_DISPLAY_BASE + 0x2084)
1802+#define VLV_IER _MMIO(VLV_DISPLAY_BASE + 0x20a0)
1803+#define VLV_IIR _MMIO(VLV_DISPLAY_BASE + 0x20a4)
1804+#define VLV_IMR _MMIO(VLV_DISPLAY_BASE + 0x20a8)
1805+#define VLV_ISR _MMIO(VLV_DISPLAY_BASE + 0x20ac)
1806+#define VLV_PCBR _MMIO(VLV_DISPLAY_BASE + 0x2120)
17471807 #define VLV_PCBR_ADDR_SHIFT 12
17481808
17491809 #define DISPLAY_PLANE_FLIP_PENDING(plane) (1<<(11-(plane))) /* A and B only */
1750−#define EIR 0x020b0
1751−#define EMR 0x020b4
1752−#define ESR 0x020b8
1810+#define EIR _MMIO(0x20b0)
1811+#define EMR _MMIO(0x20b4)
1812+#define ESR _MMIO(0x20b8)
17531813 #define GM45_ERROR_PAGE_TABLE (1<<5)
17541814 #define GM45_ERROR_MEM_PRIV (1<<4)
17551815 #define I915_ERROR_PAGE_TABLE (1<<4)
17561816 #define GM45_ERROR_CP_PRIV (1<<3)
17571817 #define I915_ERROR_MEMORY_REFRESH (1<<1)
17581818 #define I915_ERROR_INSTRUCTION (1<<0)
1759−#define INSTPM 0x020c0
1819+#define INSTPM _MMIO(0x20c0)
17601820 #define INSTPM_SELF_EN (1<<12) /* 915GM only */
17611821 #define INSTPM_AGPBUSY_INT_EN (1<<11) /* gen3: when disabled, pending interrupts
17621822 will not assert AGPBUSY# and will only
@@ -1764,14 +1824,14 @@ enum skl_disp_power_wells { · 1 unmodified line
17641824 #define INSTPM_FORCE_ORDERING (1<<7) /* GEN6+ */
17651825 #define INSTPM_TLB_INVALIDATE (1<<9)
17661826 #define INSTPM_SYNC_FLUSH (1<<5)
1767−#define ACTHD 0x020c8
1768−#define MEM_MODE 0x020cc
1827+#define ACTHD _MMIO(0x20c8)
1828+#define MEM_MODE _MMIO(0x20cc)
17691829 #define MEM_DISPLAY_B_TRICKLE_FEED_DISABLE (1<<3) /* 830 only */
17701830 #define MEM_DISPLAY_A_TRICKLE_FEED_DISABLE (1<<2) /* 830/845 only */
17711831 #define MEM_DISPLAY_TRICKLE_FEED_DISABLE (1<<2) /* 85x only */
1772−#define FW_BLC 0x020d8
1773−#define FW_BLC2 0x020dc
1774−#define FW_BLC_SELF 0x020e0 /* 915+ only */
1832+#define FW_BLC _MMIO(0x20d8)
1833+#define FW_BLC2 _MMIO(0x20dc)
1834+#define FW_BLC_SELF _MMIO(0x20e0) /* 915+ only */
17751835 #define FW_BLC_SELF_EN_MASK (1<<31)
17761836 #define FW_BLC_SELF_FIFO_MASK (1<<16) /* 945 only */
17771837 #define FW_BLC_SELF_EN (1<<15) /* 945 only */
@@ -1779,7 +1839,7 @@ enum skl_disp_power_wells { · 1 unmodified line
17791839 #define MM_FIFO_WATERMARK 0x0001F000
17801840 #define LM_BURST_LENGTH 0x00000700
17811841 #define LM_FIFO_WATERMARK 0x0000001F
1782−#define MI_ARB_STATE 0x020e4 /* 915+ only */
1842+#define MI_ARB_STATE _MMIO(0x20e4) /* 915+ only */
17831843
17841844 /* Make render/texture TLB fetches lower priorty than associated data
17851845 * fetches. This is not turned on by default
@@ -1843,11 +1903,11 @@ enum skl_disp_power_wells { · 57 unmodified lines
18431903 #define MI_ARB_DISPLAY_PRIORITY_A_B (0 << 0) /* display A > display B */
18441904 #define MI_ARB_DISPLAY_PRIORITY_B_A (1 << 0) /* display B > display A */
18451905
1846−#define MI_STATE 0x020e4 /* gen2 only */
1906+#define MI_STATE _MMIO(0x20e4) /* gen2 only */
18471907 #define MI_AGPBUSY_INT_EN (1 << 1) /* 85x only */
18481908 #define MI_AGPBUSY_830_MODE (1 << 0) /* 85x only */
18491909
1850−#define CACHE_MODE_0 0x02120 /* 915+ only */
1910+#define CACHE_MODE_0 _MMIO(0x2120) /* 915+ only */
18511911 #define CM0_PIPELINED_RENDER_FLUSH_DISABLE (1<<8)
18521912 #define CM0_IZ_OPT_DISABLE (1<<6)
18531913 #define CM0_ZR_OPT_DISABLE (1<<5)
@@ -1856,32 +1916,32 @@ enum skl_disp_power_wells { · 2 unmodified lines
18561916 #define CM0_COLOR_EVICT_DISABLE (1<<3)
18571917 #define CM0_DEPTH_WRITE_DISABLE (1<<1)
18581918 #define CM0_RC_OP_FLUSH_DISABLE (1<<0)
1859−#define GFX_FLSH_CNTL 0x02170 /* 915+ only */
1860−#define GFX_FLSH_CNTL_GEN6 0x101008
1919+#define GFX_FLSH_CNTL _MMIO(0x2170) /* 915+ only */
1920+#define GFX_FLSH_CNTL_GEN6 _MMIO(0x101008)
18611921 #define GFX_FLSH_CNTL_EN (1<<0)
1862−#define ECOSKPD 0x021d0
1922+#define ECOSKPD _MMIO(0x21d0)
18631923 #define ECO_GATING_CX_ONLY (1<<3)
18641924 #define ECO_FLIP_DONE (1<<0)
18651925
1866−#define CACHE_MODE_0_GEN7 0x7000 /* IVB+ */
1926+#define CACHE_MODE_0_GEN7 _MMIO(0x7000) /* IVB+ */
18671927 #define RC_OP_FLUSH_ENABLE (1<<0)
18681928 #define HIZ_RAW_STALL_OPT_DISABLE (1<<2)
1869−#define CACHE_MODE_1 0x7004 /* IVB+ */
1929+#define CACHE_MODE_1 _MMIO(0x7004) /* IVB+ */
18701930 #define PIXEL_SUBSPAN_COLLECT_OPT_DISABLE (1<<6)
18711931 #define GEN8_4x4_STC_OPTIMIZATION_DISABLE (1<<6)
18721932 #define GEN9_PARTIAL_RESOLVE_IN_VC_DISABLE (1<<1)
18731933
1874−#define GEN6_BLITTER_ECOSKPD 0x221d0
1934+#define GEN6_BLITTER_ECOSKPD _MMIO(0x221d0)
18751935 #define GEN6_BLITTER_LOCK_SHIFT 16
18761936 #define GEN6_BLITTER_FBC_NOTIFY (1<<3)
18771937
1878−#define GEN6_RC_SLEEP_PSMI_CONTROL 0x2050
1938+#define GEN6_RC_SLEEP_PSMI_CONTROL _MMIO(0x2050)
18791939 #define GEN6_PSMI_SLEEP_MSG_DISABLE (1 << 0)
18801940 #define GEN8_RC_SEMA_IDLE_MSG_DISABLE (1 << 12)
18811941 #define GEN8_FF_DOP_CLOCK_GATE_DISABLE (1<<10)
18821942
18831943 /* Fuse readout registers for GT */
1884−#define CHV_FUSE_GT (VLV_DISPLAY_BASE + 0x2168)
1944+#define CHV_FUSE_GT _MMIO(VLV_DISPLAY_BASE + 0x2168)
18851945 #define CHV_FGT_DISABLE_SS0 (1 << 10)
18861946 #define CHV_FGT_DISABLE_SS1 (1 << 11)
18871947 #define CHV_FGT_EU_DIS_SS0_R0_SHIFT 16
@@ -1893,7 +1953,7 @@ enum skl_disp_power_wells { · 5 unmodified lines
18931953 #define CHV_FGT_EU_DIS_SS1_R1_SHIFT 28
18941954 #define CHV_FGT_EU_DIS_SS1_R1_MASK (0xf << CHV_FGT_EU_DIS_SS1_R1_SHIFT)
18951955
1896−#define GEN8_FUSE2 0x9120
1956+#define GEN8_FUSE2 _MMIO(0x9120)
18971957 #define GEN8_F2_SS_DIS_SHIFT 21
18981958 #define GEN8_F2_SS_DIS_MASK (0x7 << GEN8_F2_SS_DIS_SHIFT)
18991959 #define GEN8_F2_S_ENA_SHIFT 25
@@ -1902,22 +1962,22 @@ enum skl_disp_power_wells { · 2 unmodified lines
19021962 #define GEN9_F2_SS_DIS_SHIFT 20
19031963 #define GEN9_F2_SS_DIS_MASK (0xf << GEN9_F2_SS_DIS_SHIFT)
19041964
1905−#define GEN8_EU_DISABLE0 0x9134
1965+#define GEN8_EU_DISABLE0 _MMIO(0x9134)
19061966 #define GEN8_EU_DIS0_S0_MASK 0xffffff
19071967 #define GEN8_EU_DIS0_S1_SHIFT 24
19081968 #define GEN8_EU_DIS0_S1_MASK (0xff << GEN8_EU_DIS0_S1_SHIFT)
19091969
1910−#define GEN8_EU_DISABLE1 0x9138
1970+#define GEN8_EU_DISABLE1 _MMIO(0x9138)
19111971 #define GEN8_EU_DIS1_S1_MASK 0xffff
19121972 #define GEN8_EU_DIS1_S2_SHIFT 16
19131973 #define GEN8_EU_DIS1_S2_MASK (0xffff << GEN8_EU_DIS1_S2_SHIFT)
19141974
1915−#define GEN8_EU_DISABLE2 0x913c
1975+#define GEN8_EU_DISABLE2 _MMIO(0x913c)
19161976 #define GEN8_EU_DIS2_S2_MASK 0xff
19171977
1918−#define GEN9_EU_DISABLE(slice) (0x9134 + (slice)*0x4)
1978+#define GEN9_EU_DISABLE(slice) _MMIO(0x9134 + (slice)*0x4)
19191979
1920−#define GEN6_BSD_SLEEP_PSMI_CONTROL 0x12050
1980+#define GEN6_BSD_SLEEP_PSMI_CONTROL _MMIO(0x12050)
19211981 #define GEN6_BSD_SLEEP_MSG_DISABLE (1 << 0)
19221982 #define GEN6_BSD_SLEEP_FLUSH_DISABLE (1 << 2)
19231983 #define GEN6_BSD_SLEEP_INDICATOR (1 << 3)
@@ -1995,9 +2055,9 @@ enum skl_disp_power_wells { · 71 unmodified lines
19952055 #define I915_ASLE_INTERRUPT (1<<0)
19962056 #define I915_BSD_USER_INTERRUPT (1<<25)
19972057
1998−#define GEN6_BSD_RNCID 0x12198
2058+#define GEN6_BSD_RNCID _MMIO(0x12198)
19992059
2000−#define GEN7_FF_THREAD_MODE 0x20a0
2060+#define GEN7_FF_THREAD_MODE _MMIO(0x20a0)
20012061 #define GEN7_FF_SCHED_MASK 0x0077070
20022062 #define GEN8_FF_DS_REF_CNT_FFME (1 << 19)
20032063 #define GEN7_FF_TS_SCHED_HS1 (0x5<<16)
@@ -2018,9 +2078,9 @@ enum skl_disp_power_wells { · 14 unmodified lines
20182078 * Framebuffer compression (915+ only)
20192079 */
20202080
2021−#define FBC_CFB_BASE 0x03200 /* 4k page aligned */
2022−#define FBC_LL_BASE 0x03204 /* 4k page aligned */
2023−#define FBC_CONTROL 0x03208
2081+#define FBC_CFB_BASE _MMIO(0x3200) /* 4k page aligned */
2082+#define FBC_LL_BASE _MMIO(0x3204) /* 4k page aligned */
2083+#define FBC_CONTROL _MMIO(0x3208)
20242084 #define FBC_CTL_EN (1<<31)
20252085 #define FBC_CTL_PERIODIC (1<<30)
20262086 #define FBC_CTL_INTERVAL_SHIFT (16)
@@ -2028,14 +2088,14 @@ enum skl_disp_power_wells { · 1 unmodified line
20282088 #define FBC_CTL_C3_IDLE (1<<13)
20292089 #define FBC_CTL_STRIDE_SHIFT (5)
20302090 #define FBC_CTL_FENCENO_SHIFT (0)
2031−#define FBC_COMMAND 0x0320c
2091+#define FBC_COMMAND _MMIO(0x320c)
20322092 #define FBC_CMD_COMPRESS (1<<0)
2033−#define FBC_STATUS 0x03210
2093+#define FBC_STATUS _MMIO(0x3210)
20342094 #define FBC_STAT_COMPRESSING (1<<31)
20352095 #define FBC_STAT_COMPRESSED (1<<30)
20362096 #define FBC_STAT_MODIFIED (1<<29)
20372097 #define FBC_STAT_CURRENT_LINE_SHIFT (0)
2038−#define FBC_CONTROL2 0x03214
2098+#define FBC_CONTROL2 _MMIO(0x3214)
20392099 #define FBC_CTL_FENCE_DBL (0<<4)
20402100 #define FBC_CTL_IDLE_IMM (0<<2)
20412101 #define FBC_CTL_IDLE_FULL (1<<2)
@@ -2043,17 +2103,17 @@ enum skl_disp_power_wells { · 1 unmodified line
20432103 #define FBC_CTL_IDLE_DEBUG (3<<2)
20442104 #define FBC_CTL_CPU_FENCE (1<<1)
20452105 #define FBC_CTL_PLANE(plane) ((plane)<<0)
2046−#define FBC_FENCE_OFF 0x03218 /* BSpec typo has 321Bh */
2047−#define FBC_TAG(i) (0x03300 + (i) * 4)
2106+#define FBC_FENCE_OFF _MMIO(0x3218) /* BSpec typo has 321Bh */
2107+#define FBC_TAG(i) _MMIO(0x3300 + (i) * 4)
20482108
2049−#define FBC_STATUS2 0x43214
2109+#define FBC_STATUS2 _MMIO(0x43214)
20502110 #define FBC_COMPRESSION_MASK 0x7ff
20512111
20522112 #define FBC_LL_SIZE (1536)
20532113
20542114 /* Framebuffer compression for GM45+ */
2055−#define DPFC_CB_BASE 0x3200
2056−#define DPFC_CONTROL 0x3208
2115+#define DPFC_CB_BASE _MMIO(0x3200)
2116+#define DPFC_CONTROL _MMIO(0x3208)
20572117 #define DPFC_CTL_EN (1<<31)
20582118 #define DPFC_CTL_PLANE(plane) ((plane)<<30)
20592119 #define IVB_DPFC_CTL_PLANE(plane) ((plane)<<29)
@@ -2064,37 +2124,37 @@ enum skl_disp_power_wells { · 4 unmodified lines
20642124 #define DPFC_CTL_LIMIT_1X (0<<6)
20652125 #define DPFC_CTL_LIMIT_2X (1<<6)
20662126 #define DPFC_CTL_LIMIT_4X (2<<6)
2067−#define DPFC_RECOMP_CTL 0x320c
2127+#define DPFC_RECOMP_CTL _MMIO(0x320c)
20682128 #define DPFC_RECOMP_STALL_EN (1<<27)
20692129 #define DPFC_RECOMP_STALL_WM_SHIFT (16)
20702130 #define DPFC_RECOMP_STALL_WM_MASK (0x07ff0000)
20712131 #define DPFC_RECOMP_TIMER_COUNT_SHIFT (0)
20722132 #define DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f)
2073−#define DPFC_STATUS 0x3210
2133+#define DPFC_STATUS _MMIO(0x3210)
20742134 #define DPFC_INVAL_SEG_SHIFT (16)
20752135 #define DPFC_INVAL_SEG_MASK (0x07ff0000)
20762136 #define DPFC_COMP_SEG_SHIFT (0)
20772137 #define DPFC_COMP_SEG_MASK (0x000003ff)
2078−#define DPFC_STATUS2 0x3214
2079−#define DPFC_FENCE_YOFF 0x3218
2080−#define DPFC_CHICKEN 0x3224
2138+#define DPFC_STATUS2 _MMIO(0x3214)
2139+#define DPFC_FENCE_YOFF _MMIO(0x3218)
2140+#define DPFC_CHICKEN _MMIO(0x3224)
20812141 #define DPFC_HT_MODIFY (1<<31)
20822142
20832143 /* Framebuffer compression for Ironlake */
2084−#define ILK_DPFC_CB_BASE 0x43200
2085−#define ILK_DPFC_CONTROL 0x43208
2144+#define ILK_DPFC_CB_BASE _MMIO(0x43200)
2145+#define ILK_DPFC_CONTROL _MMIO(0x43208)
20862146 #define FBC_CTL_FALSE_COLOR (1<<10)
20872147 /* The bit 28-8 is reserved */
20882148 #define DPFC_RESERVED (0x1FFFFF00)
2089−#define ILK_DPFC_RECOMP_CTL 0x4320c
2090−#define ILK_DPFC_STATUS 0x43210
2091−#define ILK_DPFC_FENCE_YOFF 0x43218
2092−#define ILK_DPFC_CHICKEN 0x43224
2093−#define ILK_FBC_RT_BASE 0x2128
2149+#define ILK_DPFC_RECOMP_CTL _MMIO(0x4320c)
2150+#define ILK_DPFC_STATUS _MMIO(0x43210)
2151+#define ILK_DPFC_FENCE_YOFF _MMIO(0x43218)
2152+#define ILK_DPFC_CHICKEN _MMIO(0x43224)
2153+#define ILK_FBC_RT_BASE _MMIO(0x2128)
20942154 #define ILK_FBC_RT_VALID (1<<0)
20952155 #define SNB_FBC_FRONT_BUFFER (1<<1)
20962156
2097−#define ILK_DISPLAY_CHICKEN1 0x42000
2157+#define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000)
20982158 #define ILK_FBCQ_DIS (1<<22)
20992159 #define ILK_PABSTRETCH_DIS (1<<21)
21002160
@@ -2104,31 +2164,31 @@ enum skl_disp_power_wells { · 3 unmodified lines
21042164 *
21052165 * The following two registers are of type GTTMMADR
21062166 */
2107−#define SNB_DPFC_CTL_SA 0x100100
2167+#define SNB_DPFC_CTL_SA _MMIO(0x100100)
21082168 #define SNB_CPU_FENCE_ENABLE (1<<29)
2109−#define DPFC_CPU_FENCE_OFFSET 0x100104
2169+#define DPFC_CPU_FENCE_OFFSET _MMIO(0x100104)
21102170
21112171 /* Framebuffer compression for Ivybridge */
2112−#define IVB_FBC_RT_BASE 0x7020
2172+#define IVB_FBC_RT_BASE _MMIO(0x7020)
21132173
2114−#define IPS_CTL 0x43408
2174+#define IPS_CTL _MMIO(0x43408)
21152175 #define IPS_ENABLE (1 << 31)
21162176
2117−#define MSG_FBC_REND_STATE 0x50380
2177+#define MSG_FBC_REND_STATE _MMIO(0x50380)
21182178 #define FBC_REND_NUKE (1<<2)
21192179 #define FBC_REND_CACHE_CLEAN (1<<1)
21202180
21212181 /*
21222182 * GPIO regs
21232183 */
2124−#define GPIOA 0x5010
2125−#define GPIOB 0x5014
2126−#define GPIOC 0x5018
2127−#define GPIOD 0x501c
2128−#define GPIOE 0x5020
2129−#define GPIOF 0x5024
2130−#define GPIOG 0x5028
2131−#define GPIOH 0x502c
2184+#define GPIOA _MMIO(0x5010)
2185+#define GPIOB _MMIO(0x5014)
2186+#define GPIOC _MMIO(0x5018)
2187+#define GPIOD _MMIO(0x501c)
2188+#define GPIOE _MMIO(0x5020)
2189+#define GPIOF _MMIO(0x5024)
2190+#define GPIOG _MMIO(0x5028)
2191+#define GPIOH _MMIO(0x502c)
21322192 # define GPIO_CLOCK_DIR_MASK (1 << 0)
21332193 # define GPIO_CLOCK_DIR_IN (0 << 1)
21342194 # define GPIO_CLOCK_DIR_OUT (1 << 1)
@@ -2144,7 +2204,7 @@ enum skl_disp_power_wells { · 9 unmodified lines
21442204 # define GPIO_DATA_VAL_IN (1 << 12)
21452205 # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
21462206
2147−#define GMBUS0 (dev_priv->gpio_mmio_base + 0x5100) /* clock/port select */
2207+#define GMBUS0 _MMIO(dev_priv->gpio_mmio_base + 0x5100) /* clock/port select */
21482208 #define GMBUS_RATE_100KHZ (0<<8)
21492209 #define GMBUS_RATE_50KHZ (1<<8)
21502210 #define GMBUS_RATE_400KHZ (2<<8) /* reserved on Pineview */
@@ -2163,7 +2223,7 @@ enum skl_disp_power_wells { · 12 unmodified lines
21632223 #define GMBUS_PIN_2_BXT 2
21642224 #define GMBUS_PIN_3_BXT 3
21652225 #define GMBUS_NUM_PINS 7 /* including 0 */
2166−#define GMBUS1 (dev_priv->gpio_mmio_base + 0x5104) /* command/status */
2226+#define GMBUS1 _MMIO(dev_priv->gpio_mmio_base + 0x5104) /* command/status */
21672227 #define GMBUS_SW_CLR_INT (1<<31)
21682228 #define GMBUS_SW_RDY (1<<30)
21692229 #define GMBUS_ENT (1<<29) /* enable timeout */
@@ -2177,7 +2237,7 @@ enum skl_disp_power_wells { · 7 unmodified lines
21772237 #define GMBUS_SLAVE_ADDR_SHIFT 1
21782238 #define GMBUS_SLAVE_READ (1<<0)
21792239 #define GMBUS_SLAVE_WRITE (0<<0)
2180−#define GMBUS2 (dev_priv->gpio_mmio_base + 0x5108) /* status */
2240+#define GMBUS2 _MMIO(dev_priv->gpio_mmio_base + 0x5108) /* status */
21812241 #define GMBUS_INUSE (1<<15)
21822242 #define GMBUS_HW_WAIT_PHASE (1<<14)
21832243 #define GMBUS_STALL_TIMEOUT (1<<13)
@@ -2185,14 +2245,14 @@ enum skl_disp_power_wells { · 1 unmodified line
21852245 #define GMBUS_HW_RDY (1<<11)
21862246 #define GMBUS_SATOER (1<<10)
21872247 #define GMBUS_ACTIVE (1<<9)
2188−#define GMBUS3 (dev_priv->gpio_mmio_base + 0x510c) /* data buffer bytes 3-0 */
2189−#define GMBUS4 (dev_priv->gpio_mmio_base + 0x5110) /* interrupt mask (Pineview+) */
2248+#define GMBUS3 _MMIO(dev_priv->gpio_mmio_base + 0x510c) /* data buffer bytes 3-0 */
2249+#define GMBUS4 _MMIO(dev_priv->gpio_mmio_base + 0x5110) /* interrupt mask (Pineview+) */
21902250 #define GMBUS_SLAVE_TIMEOUT_EN (1<<4)
21912251 #define GMBUS_NAK_EN (1<<3)
21922252 #define GMBUS_IDLE_EN (1<<2)
21932253 #define GMBUS_HW_WAIT_EN (1<<1)
21942254 #define GMBUS_HW_RDY_EN (1<<0)
2195−#define GMBUS5 (dev_priv->gpio_mmio_base + 0x5120) /* byte index */
2255+#define GMBUS5 _MMIO(dev_priv->gpio_mmio_base + 0x5120) /* byte index */
21962256 #define GMBUS_2BYTE_INDEX_EN (1<<31)
21972257
21982258 /*
@@ -2201,11 +2261,11 @@ enum skl_disp_power_wells { · 2 unmodified lines
22012261 #define _DPLL_A (dev_priv->info.display_mmio_offset + 0x6014)
22022262 #define _DPLL_B (dev_priv->info.display_mmio_offset + 0x6018)
22032263 #define _CHV_DPLL_C (dev_priv->info.display_mmio_offset + 0x6030)
2204−#define DPLL(pipe) _PIPE3((pipe), _DPLL_A, _DPLL_B, _CHV_DPLL_C)
2264+#define DPLL(pipe) _MMIO_PIPE3((pipe), _DPLL_A, _DPLL_B, _CHV_DPLL_C)
22052265
2206−#define VGA0 0x6000
2207−#define VGA1 0x6004
2208−#define VGA_PD 0x6010
2266+#define VGA0 _MMIO(0x6000)
2267+#define VGA1 _MMIO(0x6004)
2268+#define VGA_PD _MMIO(0x6010)
22092269 #define VGA0_PD_P2_DIV_4 (1 << 7)
22102270 #define VGA0_PD_P1_DIV_2 (1 << 5)
22112271 #define VGA0_PD_P1_SHIFT 0
@@ -2241,9 +2301,9 @@ enum skl_disp_power_wells { · 29 unmodified lines
22412301 #define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
22422302
22432303 /* Additional CHV pll/phy registers */
2244−#define DPIO_PHY_STATUS (VLV_DISPLAY_BASE + 0x6240)
2304+#define DPIO_PHY_STATUS _MMIO(VLV_DISPLAY_BASE + 0x6240)
22452305 #define DPLL_PORTD_READY_MASK (0xf)
2246−#define DISPLAY_PHY_CONTROL (VLV_DISPLAY_BASE + 0x60100)
2306+#define DISPLAY_PHY_CONTROL _MMIO(VLV_DISPLAY_BASE + 0x60100)
22472307 #define PHY_CH_POWER_DOWN_OVRD_EN(phy, ch) (1 << (2*(phy)+(ch)+27))
22482308 #define PHY_LDO_DELAY_0NS 0x0
22492309 #define PHY_LDO_DELAY_200NS 0x1
@@ -2254,7 +2314,7 @@ enum skl_disp_power_wells { · 4 unmodified lines
22542314 #define PHY_CH_DEEP_PSR 0x7
22552315 #define PHY_CH_POWER_MODE(mode, phy, ch) ((mode) << (6*(phy)+3*(ch)+2))
22562316 #define PHY_COM_LANE_RESET_DEASSERT(phy) (1 << (phy))
2257−#define DISPLAY_PHY_STATUS (VLV_DISPLAY_BASE + 0x60104)
2317+#define DISPLAY_PHY_STATUS _MMIO(VLV_DISPLAY_BASE + 0x60104)
22582318 #define PHY_POWERGOOD(phy) (((phy) == DPIO_PHY0) ? (1<<31) : (1<<30))
22592319 #define PHY_STATUS_CMN_LDO(phy, ch) (1 << (6-(6*(phy)+3*(ch))))
22602320 #define PHY_STATUS_SPLINE_LDO(phy, ch, spline) (1 << (8-(6*(phy)+3*(ch)+(spline))))
@@ -2300,7 +2360,7 @@ enum skl_disp_power_wells { · 39 unmodified lines
23002360 #define _DPLL_A_MD (dev_priv->info.display_mmio_offset + 0x601c)
23012361 #define _DPLL_B_MD (dev_priv->info.display_mmio_offset + 0x6020)
23022362 #define _CHV_DPLL_C_MD (dev_priv->info.display_mmio_offset + 0x603c)
2303−#define DPLL_MD(pipe) _PIPE3((pipe), _DPLL_A_MD, _DPLL_B_MD, _CHV_DPLL_C_MD)
2363+#define DPLL_MD(pipe) _MMIO_PIPE3((pipe), _DPLL_A_MD, _DPLL_B_MD, _CHV_DPLL_C_MD)
23042364
23052365 /*
23062366 * UDI pixel divider, controlling how many pixels are stuffed into a packet.
@@ -2339,12 +2399,12 @@ enum skl_disp_power_wells { · 32 unmodified lines
23392399 #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
23402400 #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
23412401
2342−#define _FPA0 0x06040
2343−#define _FPA1 0x06044
2344−#define _FPB0 0x06048
2345−#define _FPB1 0x0604c
2346−#define FP0(pipe) _PIPE(pipe, _FPA0, _FPB0)
2347−#define FP1(pipe) _PIPE(pipe, _FPA1, _FPB1)
2402+#define _FPA0 0x6040
2403+#define _FPA1 0x6044
2404+#define _FPB0 0x6048
2405+#define _FPB1 0x604c
2406+#define FP0(pipe) _MMIO_PIPE(pipe, _FPA0, _FPB0)
2407+#define FP1(pipe) _MMIO_PIPE(pipe, _FPA1, _FPB1)
23482408 #define FP_N_DIV_MASK 0x003f0000
23492409 #define FP_N_PINEVIEW_DIV_MASK 0x00ff0000
23502410 #define FP_N_DIV_SHIFT 16
@@ -2353,7 +2413,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
23532413 #define FP_M2_DIV_MASK 0x0000003f
23542414 #define FP_M2_PINEVIEW_DIV_MASK 0x000000ff
23552415 #define FP_M2_DIV_SHIFT 0
2356−#define DPLL_TEST 0x606c
2416+#define DPLL_TEST _MMIO(0x606c)
23572417 #define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
23582418 #define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
23592419 #define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
@@ -2364,12 +2424,12 @@ enum skl_disp_power_wells { · 4 unmodified lines
23642424 #define DPLLA_TEST_N_BYPASS (1 << 3)
23652425 #define DPLLA_TEST_M_BYPASS (1 << 2)
23662426 #define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
2367−#define D_STATE 0x6104
2427+#define D_STATE _MMIO(0x6104)
23682428 #define DSTATE_GFX_RESET_I830 (1<<6)
23692429 #define DSTATE_PLL_D3_OFF (1<<3)
23702430 #define DSTATE_GFX_CLOCK_GATING (1<<1)
23712431 #define DSTATE_DOT_CLOCK_GATING (1<<0)
2372−#define DSPCLK_GATE_D (dev_priv->info.display_mmio_offset + 0x6200)
2432+#define DSPCLK_GATE_D _MMIO(dev_priv->info.display_mmio_offset + 0x6200)
23732433 # define DPUNIT_B_CLOCK_GATE_DISABLE (1 << 30) /* 965 */
23742434 # define VSUNIT_CLOCK_GATE_DISABLE (1 << 29) /* 965 */
23752435 # define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* 965 */
@@ -2408,7 +2468,7 @@ enum skl_disp_power_wells { · 32 unmodified lines
24082468 # define ZVUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 830 */
24092469 # define OVLUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 845,865 */
24102470
2411−#define RENCLK_GATE_D1 0x6204
2471+#define RENCLK_GATE_D1 _MMIO(0x6204)
24122472 # define BLITTER_CLOCK_GATE_DISABLE (1 << 13) /* 945GM only */
24132473 # define MPEG_CLOCK_GATE_DISABLE (1 << 12) /* 945GM only */
24142474 # define PC_FE_CLOCK_GATE_DISABLE (1 << 11)
@@ -2472,35 +2532,35 @@ enum skl_disp_power_wells { · 57 unmodified lines
24722532 # define I965_FT_CLOCK_GATE_DISABLE (1 << 1)
24732533 # define I965_DM_CLOCK_GATE_DISABLE (1 << 0)
24742534
2475−#define RENCLK_GATE_D2 0x6208
2535+#define RENCLK_GATE_D2 _MMIO(0x6208)
24762536 #define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)
24772537 #define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)
24782538 #define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6)
24792539
2480−#define VDECCLK_GATE_D 0x620C /* g4x only */
2540+#define VDECCLK_GATE_D _MMIO(0x620C) /* g4x only */
24812541 #define VCP_UNIT_CLOCK_GATE_DISABLE (1 << 4)
24822542
2483−#define RAMCLK_GATE_D 0x6210 /* CRL only */
2484−#define DEUC 0x6214 /* CRL only */
2543+#define RAMCLK_GATE_D _MMIO(0x6210) /* CRL only */
2544+#define DEUC _MMIO(0x6214) /* CRL only */
24852545
2486−#define FW_BLC_SELF_VLV (VLV_DISPLAY_BASE + 0x6500)
2546+#define FW_BLC_SELF_VLV _MMIO(VLV_DISPLAY_BASE + 0x6500)
24872547 #define FW_CSPWRDWNEN (1<<15)
24882548
2489−#define MI_ARB_VLV (VLV_DISPLAY_BASE + 0x6504)
2549+#define MI_ARB_VLV _MMIO(VLV_DISPLAY_BASE + 0x6504)
24902550
2491−#define CZCLK_CDCLK_FREQ_RATIO (VLV_DISPLAY_BASE + 0x6508)
2551+#define CZCLK_CDCLK_FREQ_RATIO _MMIO(VLV_DISPLAY_BASE + 0x6508)
24922552 #define CDCLK_FREQ_SHIFT 4
24932553 #define CDCLK_FREQ_MASK (0x1f << CDCLK_FREQ_SHIFT)
24942554 #define CZCLK_FREQ_MASK 0xf
24952555
2496−#define GCI_CONTROL (VLV_DISPLAY_BASE + 0x650C)
2556+#define GCI_CONTROL _MMIO(VLV_DISPLAY_BASE + 0x650C)
24972557 #define PFI_CREDIT_63 (9 << 28) /* chv only */
24982558 #define PFI_CREDIT_31 (8 << 28) /* chv only */
24992559 #define PFI_CREDIT(x) (((x) - 8) << 28) /* 8-15 */
25002560 #define PFI_CREDIT_RESEND (1 << 27)
25012561 #define VGA_FAST_MODE_DISABLE (1 << 14)
25022562
2503−#define GMBUSFREQ_VLV (VLV_DISPLAY_BASE + 0x6510)
2563+#define GMBUSFREQ_VLV _MMIO(VLV_DISPLAY_BASE + 0x6510)
25042564
25052565 /*
25062566 * Palette regs
@@ -2508,8 +2568,8 @@ enum skl_disp_power_wells { · 1 unmodified line
25082568 #define PALETTE_A_OFFSET 0xa000
25092569 #define PALETTE_B_OFFSET 0xa800
25102570 #define CHV_PALETTE_C_OFFSET 0xc000
2511−#define PALETTE(pipe, i) (dev_priv->info.palette_offsets[pipe] + \
2512− dev_priv->info.display_mmio_offset + (i) * 4)
2571+#define PALETTE(pipe, i) _MMIO(dev_priv->info.palette_offsets[pipe] + \
2572+ dev_priv->info.display_mmio_offset + (i) * 4)
25132573
25142574 /* MCH MMIO space */
25152575
@@ -2527,37 +2587,37 @@ enum skl_disp_power_wells { · 11 unmodified lines
25272587
25282588 #define MCHBAR_MIRROR_BASE_SNB 0x140000
25292589
2530−#define CTG_STOLEN_RESERVED (MCHBAR_MIRROR_BASE + 0x34)
2531−#define ELK_STOLEN_RESERVED (MCHBAR_MIRROR_BASE + 0x48)
2590+#define CTG_STOLEN_RESERVED _MMIO(MCHBAR_MIRROR_BASE + 0x34)
2591+#define ELK_STOLEN_RESERVED _MMIO(MCHBAR_MIRROR_BASE + 0x48)
25322592 #define G4X_STOLEN_RESERVED_ADDR1_MASK (0xFFFF << 16)
25332593 #define G4X_STOLEN_RESERVED_ADDR2_MASK (0xFFF << 4)
25342594
25352595 /* Memory controller frequency in MCHBAR for Haswell (possible SNB+) */
2536−#define DCLK (MCHBAR_MIRROR_BASE_SNB + 0x5e04)
2596+#define DCLK _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5e04)
25372597
25382598 /* 915-945 and GM965 MCH register controlling DRAM channel access */
2539−#define DCC 0x10200
2599+#define DCC _MMIO(MCHBAR_MIRROR_BASE + 0x200)
25402600 #define DCC_ADDRESSING_MODE_SINGLE_CHANNEL (0 << 0)
25412601 #define DCC_ADDRESSING_MODE_DUAL_CHANNEL_ASYMMETRIC (1 << 0)
25422602 #define DCC_ADDRESSING_MODE_DUAL_CHANNEL_INTERLEAVED (2 << 0)
25432603 #define DCC_ADDRESSING_MODE_MASK (3 << 0)
25442604 #define DCC_CHANNEL_XOR_DISABLE (1 << 10)
25452605 #define DCC_CHANNEL_XOR_BIT_17 (1 << 9)
2546−#define DCC2 0x10204
2606+#define DCC2 _MMIO(MCHBAR_MIRROR_BASE + 0x204)
25472607 #define DCC2_MODIFIED_ENHANCED_DISABLE (1 << 20)
25482608
25492609 /* Pineview MCH register contains DDR3 setting */
2550−#define CSHRDDR3CTL 0x101a8
2610+#define CSHRDDR3CTL _MMIO(MCHBAR_MIRROR_BASE + 0x1a8)
25512611 #define CSHRDDR3CTL_DDR3 (1 << 2)
25522612
25532613 /* 965 MCH register controlling DRAM channel configuration */
2554−#define C0DRB3 0x10206
2555−#define C1DRB3 0x10606
2614+#define C0DRB3 _MMIO(MCHBAR_MIRROR_BASE + 0x206)
2615+#define C1DRB3 _MMIO(MCHBAR_MIRROR_BASE + 0x606)
25562616
25572617 /* snb MCH registers for reading the DRAM channel configuration */
2558−#define MAD_DIMM_C0 (MCHBAR_MIRROR_BASE_SNB + 0x5004)
2559−#define MAD_DIMM_C1 (MCHBAR_MIRROR_BASE_SNB + 0x5008)
2560−#define MAD_DIMM_C2 (MCHBAR_MIRROR_BASE_SNB + 0x500C)
2618+#define MAD_DIMM_C0 _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5004)
2619+#define MAD_DIMM_C1 _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5008)
2620+#define MAD_DIMM_C2 _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x500C)
25612621 #define MAD_DIMM_ECC_MASK (0x3 << 24)
25622622 #define MAD_DIMM_ECC_OFF (0x0 << 24)
25632623 #define MAD_DIMM_ECC_IO_ON_LOGIC_OFF (0x1 << 24)
@@ -2577,14 +2637,14 @@ enum skl_disp_power_wells { · 13 unmodified lines
25772637 #define MAD_DIMM_A_SIZE_MASK (0xff << MAD_DIMM_A_SIZE_SHIFT)
25782638
25792639 /* snb MCH registers for priority tuning */
2580−#define MCH_SSKPD (MCHBAR_MIRROR_BASE_SNB + 0x5d10)
2640+#define MCH_SSKPD _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5d10)
25812641 #define MCH_SSKPD_WM0_MASK 0x3f
25822642 #define MCH_SSKPD_WM0_VAL 0xc
25832643
2584−#define MCH_SECP_NRG_STTS (MCHBAR_MIRROR_BASE_SNB + 0x592c)
2644+#define MCH_SECP_NRG_STTS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x592c)
25852645
25862646 /* Clocking configuration register */
2587−#define CLKCFG 0x10c00
2647+#define CLKCFG _MMIO(MCHBAR_MIRROR_BASE + 0xc00)
25882648 #define CLKCFG_FSB_400 (5 << 0) /* hrawclk 100 */
25892649 #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */
25902650 #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */
@@ -2600,26 +2660,26 @@ enum skl_disp_power_wells { · 9 unmodified lines
26002660 #define CLKCFG_MEM_800 (3 << 4)
26012661 #define CLKCFG_MEM_MASK (7 << 4)
26022662
2603−#define HPLLVCO (MCHBAR_MIRROR_BASE + 0xc38)
2604−#define HPLLVCO_MOBILE (MCHBAR_MIRROR_BASE + 0xc0f)
2663+#define HPLLVCO _MMIO(MCHBAR_MIRROR_BASE + 0xc38)
2664+#define HPLLVCO_MOBILE _MMIO(MCHBAR_MIRROR_BASE + 0xc0f)
26052665
2606−#define TSC1 0x11001
2666+#define TSC1 _MMIO(0x11001)
26072667 #define TSE (1<<0)
2608−#define TR1 0x11006
2609−#define TSFS 0x11020
2668+#define TR1 _MMIO(0x11006)
2669+#define TSFS _MMIO(0x11020)
26102670 #define TSFS_SLOPE_MASK 0x0000ff00
26112671 #define TSFS_SLOPE_SHIFT 8
26122672 #define TSFS_INTR_MASK 0x000000ff
26132673
2614−#define CRSTANDVID 0x11100
2615−#define PXVFREQ(i) (0x11110 + (i) * 4) /* P[0-15]VIDFREQ (0x1114c) (Ironlake) */
2674+#define CRSTANDVID _MMIO(0x11100)
2675+#define PXVFREQ(fstart) _MMIO(0x11110 + (fstart) * 4) /* P[0-15]VIDFREQ (0x1114c) (Ironlake) */
26162676 #define PXVFREQ_PX_MASK 0x7f000000
26172677 #define PXVFREQ_PX_SHIFT 24
2618−#define VIDFREQ_BASE 0x11110
2619−#define VIDFREQ1 0x11110 /* VIDFREQ1-4 (0x1111c) (Cantiga) */
2620−#define VIDFREQ2 0x11114
2621−#define VIDFREQ3 0x11118
2622−#define VIDFREQ4 0x1111c
2678+#define VIDFREQ_BASE _MMIO(0x11110)
2679+#define VIDFREQ1 _MMIO(0x11110) /* VIDFREQ1-4 (0x1111c) (Cantiga) */
2680+#define VIDFREQ2 _MMIO(0x11114)
2681+#define VIDFREQ3 _MMIO(0x11118)
2682+#define VIDFREQ4 _MMIO(0x1111c)
26232683 #define VIDFREQ_P0_MASK 0x1f000000
26242684 #define VIDFREQ_P0_SHIFT 24
26252685 #define VIDFREQ_P0_CSCLK_MASK 0x00f00000
@@ -2631,8 +2691,8 @@ enum skl_disp_power_wells { · 5 unmodified lines
26312691 #define VIDFREQ_P1_CSCLK_MASK 0x000000f0
26322692 #define VIDFREQ_P1_CSCLK_SHIFT 4
26332693 #define VIDFREQ_P1_CRCLK_MASK 0x0000000f
2634−#define INTTOEXT_BASE_ILK 0x11300
2635−#define INTTOEXT_BASE 0x11120 /* INTTOEXT1-8 (0x1113c) */
2694+#define INTTOEXT_BASE_ILK _MMIO(0x11300)
2695+#define INTTOEXT_BASE _MMIO(0x11120) /* INTTOEXT1-8 (0x1113c) */
26362696 #define INTTOEXT_MAP3_SHIFT 24
26372697 #define INTTOEXT_MAP3_MASK (0x1f << INTTOEXT_MAP3_SHIFT)
26382698 #define INTTOEXT_MAP2_SHIFT 16
@@ -2641,7 +2701,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
26412701 #define INTTOEXT_MAP1_MASK (0x1f << INTTOEXT_MAP1_SHIFT)
26422702 #define INTTOEXT_MAP0_SHIFT 0
26432703 #define INTTOEXT_MAP0_MASK (0x1f << INTTOEXT_MAP0_SHIFT)
2644−#define MEMSWCTL 0x11170 /* Ironlake only */
2704+#define MEMSWCTL _MMIO(0x11170) /* Ironlake only */
26452705 #define MEMCTL_CMD_MASK 0xe000
26462706 #define MEMCTL_CMD_SHIFT 13
26472707 #define MEMCTL_CMD_RCLK_OFF 0
@@ -2656,8 +2716,8 @@ enum skl_disp_power_wells { · 8 unmodified lines
26562716 #define MEMCTL_FREQ_SHIFT 8
26572717 #define MEMCTL_SFCAVM (1<<7)
26582718 #define MEMCTL_TGT_VID_MASK 0x007f
2659−#define MEMIHYST 0x1117c
2660−#define MEMINTREN 0x11180 /* 16 bits */
2719+#define MEMIHYST _MMIO(0x1117c)
2720+#define MEMINTREN _MMIO(0x11180) /* 16 bits */
26612721 #define MEMINT_RSEXIT_EN (1<<8)
26622722 #define MEMINT_CX_SUPR_EN (1<<7)
26632723 #define MEMINT_CONT_BUSY_EN (1<<6)
@@ -2667,7 +2727,7 @@ enum skl_disp_power_wells { · 3 unmodified lines
26672727 #define MEMINT_UP_EVAL_EN (1<<2)
26682728 #define MEMINT_DOWN_EVAL_EN (1<<1)
26692729 #define MEMINT_SW_CMD_EN (1<<0)
2670−#define MEMINTRSTR 0x11182 /* 16 bits */
2730+#define MEMINTRSTR _MMIO(0x11182) /* 16 bits */
26712731 #define MEM_RSEXIT_MASK 0xc000
26722732 #define MEM_RSEXIT_SHIFT 14
26732733 #define MEM_CONT_BUSY_MASK 0x3000
@@ -2687,7 +2747,7 @@ enum skl_disp_power_wells { · 13 unmodified lines
26872747 #define MEM_INT_STEER_CMR 1
26882748 #define MEM_INT_STEER_SMI 2
26892749 #define MEM_INT_STEER_SCI 3
2690−#define MEMINTRSTS 0x11184
2750+#define MEMINTRSTS _MMIO(0x11184)
26912751 #define MEMINT_RSEXIT (1<<7)
26922752 #define MEMINT_CONT_BUSY (1<<6)
26932753 #define MEMINT_AVG_BUSY (1<<5)
@@ -2696,7 +2756,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
26962756 #define MEMINT_UP_EVAL (1<<2)
26972757 #define MEMINT_DOWN_EVAL (1<<1)
26982758 #define MEMINT_SW_CMD (1<<0)
2699−#define MEMMODECTL 0x11190
2759+#define MEMMODECTL _MMIO(0x11190)
27002760 #define MEMMODE_BOOST_EN (1<<31)
27012761 #define MEMMODE_BOOST_FREQ_MASK 0x0f000000 /* jitter for boost, 0-15 */
27022762 #define MEMMODE_BOOST_FREQ_SHIFT 24
@@ -2713,8 +2773,8 @@ enum skl_disp_power_wells { · 10 unmodified lines
27132773 #define MEMMODE_FMAX_MASK 0x000000f0 /* max jitter, 0-15 */
27142774 #define MEMMODE_FMAX_SHIFT 4
27152775 #define MEMMODE_FMIN_MASK 0x0000000f /* min jitter, 0-15 */
2716−#define RCBMAXAVG 0x1119c
2717−#define MEMSWCTL2 0x1119e /* Cantiga only */
2776+#define RCBMAXAVG _MMIO(0x1119c)
2777+#define MEMSWCTL2 _MMIO(0x1119e) /* Cantiga only */
27182778 #define SWMEMCMD_RENDER_OFF (0 << 13)
27192779 #define SWMEMCMD_RENDER_ON (1 << 13)
27202780 #define SWMEMCMD_SWFREQ (2 << 13)
@@ -2726,11 +2786,11 @@ enum skl_disp_power_wells { · 5 unmodified lines
27262786 #define SWFREQ_MASK 0x0380 /* P0-7 */
27272787 #define SWFREQ_SHIFT 7
27282788 #define TARVID_MASK 0x001f
2729−#define MEMSTAT_CTG 0x111a0
2730−#define RCBMINAVG 0x111a0
2731−#define RCUPEI 0x111b0
2732−#define RCDNEI 0x111b4
2733−#define RSTDBYCTL 0x111b8
2789+#define MEMSTAT_CTG _MMIO(0x111a0)
2790+#define RCBMINAVG _MMIO(0x111a0)
2791+#define RCUPEI _MMIO(0x111b0)
2792+#define RCDNEI _MMIO(0x111b4)
2793+#define RSTDBYCTL _MMIO(0x111b8)
27342794 #define RS1EN (1<<31)
27352795 #define RS2EN (1<<30)
27362796 #define RS3EN (1<<29)
@@ -2774,10 +2834,10 @@ enum skl_disp_power_wells { · 37 unmodified lines
27742834 #define RS_CSTATE_C367_RS2 (3<<4)
27752835 #define REDSAVES (1<<3) /* no context save if was idle during rs0 */
27762836 #define REDRESTORES (1<<2) /* no restore if was idle during rs0 */
2777−#define VIDCTL 0x111c0
2778−#define VIDSTS 0x111c8
2779−#define VIDSTART 0x111cc /* 8 bits */
2780−#define MEMSTAT_ILK 0x111f8
2837+#define VIDCTL _MMIO(0x111c0)
2838+#define VIDSTS _MMIO(0x111c8)
2839+#define VIDSTART _MMIO(0x111cc) /* 8 bits */
2840+#define MEMSTAT_ILK _MMIO(0x111f8)
27812841 #define MEMSTAT_VID_MASK 0x7f00
27822842 #define MEMSTAT_VID_SHIFT 8
27832843 #define MEMSTAT_PSTATE_MASK 0x00f8
@@ -2788,55 +2848,55 @@ enum skl_disp_power_wells { · 4 unmodified lines
27882848 #define MEMSTAT_SRC_CTL_TRB 1
27892849 #define MEMSTAT_SRC_CTL_THM 2
27902850 #define MEMSTAT_SRC_CTL_STDBY 3
2791−#define RCPREVBSYTUPAVG 0x113b8
2792−#define RCPREVBSYTDNAVG 0x113bc
2793−#define PMMISC 0x11214
2851+#define RCPREVBSYTUPAVG _MMIO(0x113b8)
2852+#define RCPREVBSYTDNAVG _MMIO(0x113bc)
2853+#define PMMISC _MMIO(0x11214)
27942854 #define MCPPCE_EN (1<<0) /* enable PM_MSG from PCH->MPC */
2795−#define SDEW 0x1124c
2796−#define CSIEW0 0x11250
2797−#define CSIEW1 0x11254
2798−#define CSIEW2 0x11258
2799−#define PEW(i) (0x1125c + (i) * 4) /* 5 registers */
2800−#define DEW(i) (0x11270 + (i) * 4) /* 3 registers */
2801−#define MCHAFE 0x112c0
2802−#define CSIEC 0x112e0
2803−#define DMIEC 0x112e4
2804−#define DDREC 0x112e8
2805−#define PEG0EC 0x112ec
2806−#define PEG1EC 0x112f0
2807−#define GFXEC 0x112f4
2808−#define RPPREVBSYTUPAVG 0x113b8
2809−#define RPPREVBSYTDNAVG 0x113bc
2810−#define ECR 0x11600
2855+#define SDEW _MMIO(0x1124c)
2856+#define CSIEW0 _MMIO(0x11250)
2857+#define CSIEW1 _MMIO(0x11254)
2858+#define CSIEW2 _MMIO(0x11258)
2859+#define PEW(i) _MMIO(0x1125c + (i) * 4) /* 5 registers */
2860+#define DEW(i) _MMIO(0x11270 + (i) * 4) /* 3 registers */
2861+#define MCHAFE _MMIO(0x112c0)
2862+#define CSIEC _MMIO(0x112e0)
2863+#define DMIEC _MMIO(0x112e4)
2864+#define DDREC _MMIO(0x112e8)
2865+#define PEG0EC _MMIO(0x112ec)
2866+#define PEG1EC _MMIO(0x112f0)
2867+#define GFXEC _MMIO(0x112f4)
2868+#define RPPREVBSYTUPAVG _MMIO(0x113b8)
2869+#define RPPREVBSYTDNAVG _MMIO(0x113bc)
2870+#define ECR _MMIO(0x11600)
28112871 #define ECR_GPFE (1<<31)
28122872 #define ECR_IMONE (1<<30)
28132873 #define ECR_CAP_MASK 0x0000001f /* Event range, 0-31 */
2814−#define OGW0 0x11608
2815−#define OGW1 0x1160c
2816−#define EG0 0x11610
2817−#define EG1 0x11614
2818−#define EG2 0x11618
2819−#define EG3 0x1161c
2820−#define EG4 0x11620
2821−#define EG5 0x11624
2822−#define EG6 0x11628
2823−#define EG7 0x1162c
2824−#define PXW(i) (0x11664 + (i) * 4) /* 4 registers */
2825−#define PXWL(i) (0x11680 + (i) * 4) /* 8 registers */
2826−#define LCFUSE02 0x116c0
2874+#define OGW0 _MMIO(0x11608)
2875+#define OGW1 _MMIO(0x1160c)
2876+#define EG0 _MMIO(0x11610)
2877+#define EG1 _MMIO(0x11614)
2878+#define EG2 _MMIO(0x11618)
2879+#define EG3 _MMIO(0x1161c)
2880+#define EG4 _MMIO(0x11620)
2881+#define EG5 _MMIO(0x11624)
2882+#define EG6 _MMIO(0x11628)
2883+#define EG7 _MMIO(0x1162c)
2884+#define PXW(i) _MMIO(0x11664 + (i) * 4) /* 4 registers */
2885+#define PXWL(i) _MMIO(0x11680 + (i) * 8) /* 8 registers */
2886+#define LCFUSE02 _MMIO(0x116c0)
28272887 #define LCFUSE_HIV_MASK 0x000000ff
2828−#define CSIPLL0 0x12c10
2829−#define DDRMPLL1 0X12c20
2830−#define PEG_BAND_GAP_DATA 0x14d68
2888+#define CSIPLL0 _MMIO(0x12c10)
2889+#define DDRMPLL1 _MMIO(0X12c20)
2890+#define PEG_BAND_GAP_DATA _MMIO(0x14d68)
28312891
2832−#define GEN6_GT_THREAD_STATUS_REG 0x13805c
2892+#define GEN6_GT_THREAD_STATUS_REG _MMIO(0x13805c)
28332893 #define GEN6_GT_THREAD_STATUS_CORE_MASK 0x7
28342894
2835−#define GEN6_GT_PERF_STATUS (MCHBAR_MIRROR_BASE_SNB + 0x5948)
2836−#define BXT_GT_PERF_STATUS (MCHBAR_MIRROR_BASE_SNB + 0x7070)
2837−#define GEN6_RP_STATE_LIMITS (MCHBAR_MIRROR_BASE_SNB + 0x5994)
2838−#define GEN6_RP_STATE_CAP (MCHBAR_MIRROR_BASE_SNB + 0x5998)
2839−#define BXT_RP_STATE_CAP 0x138170
2895+#define GEN6_GT_PERF_STATUS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5948)
2896+#define BXT_GT_PERF_STATUS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x7070)
2897+#define GEN6_RP_STATE_LIMITS _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5994)
2898+#define GEN6_RP_STATE_CAP _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5998)
2899+#define BXT_RP_STATE_CAP _MMIO(0x138170)
28402900
28412901 #define INTERVAL_1_28_US(us) (((us) * 100) >> 7)
28422902 #define INTERVAL_1_33_US(us) (((us) * 3) >> 2)
@@ -2850,7 +2910,7 @@ enum skl_disp_power_wells { · 7 unmodified lines
28502910 /*
28512911 * Logical Context regs
28522912 */
2853−#define CCID 0x2180
2913+#define CCID _MMIO(0x2180)
28542914 #define CCID_EN (1<<0)
28552915 /*
28562916 * Notes on SNB/IVB/VLV context size:
@@ -2865,7 +2925,7 @@ enum skl_disp_power_wells { · 8 unmodified lines
28652925 * - GT1 size just indicates how much of render context
28662926 * doesn't need saving on GT1
28672927 */
2868−#define CXT_SIZE 0x21a0
2928+#define CXT_SIZE _MMIO(0x21a0)
28692929 #define GEN6_CXT_POWER_SIZE(cxt_reg) (((cxt_reg) >> 24) & 0x3f)
28702930 #define GEN6_CXT_RING_SIZE(cxt_reg) (((cxt_reg) >> 18) & 0x3f)
28712931 #define GEN6_CXT_RENDER_SIZE(cxt_reg) (((cxt_reg) >> 12) & 0x3f)
@@ -2874,7 +2934,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
28742934 #define GEN6_CXT_TOTAL_SIZE(cxt_reg) (GEN6_CXT_RING_SIZE(cxt_reg) + \
28752935 GEN6_CXT_EXTENDED_SIZE(cxt_reg) + \
28762936 GEN6_CXT_PIPELINE_SIZE(cxt_reg))
2877−#define GEN7_CXT_SIZE 0x21a8
2937+#define GEN7_CXT_SIZE _MMIO(0x21a8)
28782938 #define GEN7_CXT_POWER_SIZE(ctx_reg) (((ctx_reg) >> 25) & 0x7f)
28792939 #define GEN7_CXT_RING_SIZE(ctx_reg) (((ctx_reg) >> 22) & 0x7)
28802940 #define GEN7_CXT_RENDER_SIZE(ctx_reg) (((ctx_reg) >> 16) & 0x3f)
@@ -2894,23 +2954,23 @@ enum skl_disp_power_wells { · 13 unmodified lines
28942954 /* Same as Haswell, but 72064 bytes now. */
28952955 #define GEN8_CXT_TOTAL_SIZE (18 * PAGE_SIZE)
28962956
2897−#define CHV_CLK_CTL1 0x101100
2898−#define VLV_CLK_CTL2 0x101104
2957+#define CHV_CLK_CTL1 _MMIO(0x101100)
2958+#define VLV_CLK_CTL2 _MMIO(0x101104)
28992959 #define CLK_CTL2_CZCOUNT_30NS_SHIFT 28
29002960
29012961 /*
29022962 * Overlay regs
29032963 */
29042964
2905−#define OVADD 0x30000
2906−#define DOVSTA 0x30008
2965+#define OVADD _MMIO(0x30000)
2966+#define DOVSTA _MMIO(0x30008)
29072967 #define OC_BUF (0x3<<20)
2908−#define OGAMC5 0x30010
2909−#define OGAMC4 0x30014
2910−#define OGAMC3 0x30018
2911−#define OGAMC2 0x3001c
2912−#define OGAMC1 0x30020
2913−#define OGAMC0 0x30024
2968+#define OGAMC5 _MMIO(0x30010)
2969+#define OGAMC4 _MMIO(0x30014)
2970+#define OGAMC3 _MMIO(0x30018)
2971+#define OGAMC2 _MMIO(0x3001c)
2972+#define OGAMC1 _MMIO(0x30020)
2973+#define OGAMC0 _MMIO(0x30024)
29142974
29152975 /*
29162976 * Display engine regs
@@ -2970,28 +3030,18 @@ enum skl_disp_power_wells { · 53 unmodified lines
29703030 #define _PIPE_CRC_RES_4_B_IVB 0x61070
29713031 #define _PIPE_CRC_RES_5_B_IVB 0x61074
29723032
2973−#define PIPE_CRC_CTL(pipe) _TRANSCODER2(pipe, _PIPE_CRC_CTL_A)
2974−#define PIPE_CRC_RES_1_IVB(pipe) \
2975− _TRANSCODER2(pipe, _PIPE_CRC_RES_1_A_IVB)
2976−#define PIPE_CRC_RES_2_IVB(pipe) \
2977− _TRANSCODER2(pipe, _PIPE_CRC_RES_2_A_IVB)
2978−#define PIPE_CRC_RES_3_IVB(pipe) \
2979− _TRANSCODER2(pipe, _PIPE_CRC_RES_3_A_IVB)
2980−#define PIPE_CRC_RES_4_IVB(pipe) \
2981− _TRANSCODER2(pipe, _PIPE_CRC_RES_4_A_IVB)
2982−#define PIPE_CRC_RES_5_IVB(pipe) \
2983− _TRANSCODER2(pipe, _PIPE_CRC_RES_5_A_IVB)
2984−
2985−#define PIPE_CRC_RES_RED(pipe) \
2986− _TRANSCODER2(pipe, _PIPE_CRC_RES_RED_A)
2987−#define PIPE_CRC_RES_GREEN(pipe) \
2988− _TRANSCODER2(pipe, _PIPE_CRC_RES_GREEN_A)
2989−#define PIPE_CRC_RES_BLUE(pipe) \
2990− _TRANSCODER2(pipe, _PIPE_CRC_RES_BLUE_A)
2991−#define PIPE_CRC_RES_RES1_I915(pipe) \
2992− _TRANSCODER2(pipe, _PIPE_CRC_RES_RES1_A_I915)
2993−#define PIPE_CRC_RES_RES2_G4X(pipe) \
2994− _TRANSCODER2(pipe, _PIPE_CRC_RES_RES2_A_G4X)
3033+#define PIPE_CRC_CTL(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_CTL_A)
3034+#define PIPE_CRC_RES_1_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_1_A_IVB)
3035+#define PIPE_CRC_RES_2_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_2_A_IVB)
3036+#define PIPE_CRC_RES_3_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_3_A_IVB)
3037+#define PIPE_CRC_RES_4_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_4_A_IVB)
3038+#define PIPE_CRC_RES_5_IVB(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_5_A_IVB)
3039+
3040+#define PIPE_CRC_RES_RED(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RED_A)
3041+#define PIPE_CRC_RES_GREEN(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_GREEN_A)
3042+#define PIPE_CRC_RES_BLUE(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_BLUE_A)
3043+#define PIPE_CRC_RES_RES1_I915(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RES1_A_I915)
3044+#define PIPE_CRC_RES_RES2_G4X(pipe) _MMIO_TRANS2(pipe, _PIPE_CRC_RES_RES2_A_G4X)
29953045
29963046 /* Pipe A timing regs */
29973047 #define _HTOTAL_A 0x60000
@@ -3023,20 +3073,20 @@ enum skl_disp_power_wells { · 25 unmodified lines
30233073 #define CHV_TRANSCODER_C_OFFSET 0x63000
30243074 #define TRANSCODER_EDP_OFFSET 0x6f000
30253075
3026−#define _TRANSCODER2(pipe, reg) (dev_priv->info.trans_offsets[(pipe)] - \
3076+#define _MMIO_TRANS2(pipe, reg) _MMIO(dev_priv->info.trans_offsets[(pipe)] - \
30273077 dev_priv->info.trans_offsets[TRANSCODER_A] + (reg) + \
30283078 dev_priv->info.display_mmio_offset)
30293079
3030−#define HTOTAL(trans) _TRANSCODER2(trans, _HTOTAL_A)
3031−#define HBLANK(trans) _TRANSCODER2(trans, _HBLANK_A)
3032−#define HSYNC(trans) _TRANSCODER2(trans, _HSYNC_A)
3033−#define VTOTAL(trans) _TRANSCODER2(trans, _VTOTAL_A)
3034−#define VBLANK(trans) _TRANSCODER2(trans, _VBLANK_A)
3035−#define VSYNC(trans) _TRANSCODER2(trans, _VSYNC_A)
3036−#define BCLRPAT(trans) _TRANSCODER2(trans, _BCLRPAT_A)
3037−#define VSYNCSHIFT(trans) _TRANSCODER2(trans, _VSYNCSHIFT_A)
3038−#define PIPESRC(trans) _TRANSCODER2(trans, _PIPEASRC)
3039−#define PIPE_MULT(trans) _TRANSCODER2(trans, _PIPE_MULT_A)
3080+#define HTOTAL(trans) _MMIO_TRANS2(trans, _HTOTAL_A)
3081+#define HBLANK(trans) _MMIO_TRANS2(trans, _HBLANK_A)
3082+#define HSYNC(trans) _MMIO_TRANS2(trans, _HSYNC_A)
3083+#define VTOTAL(trans) _MMIO_TRANS2(trans, _VTOTAL_A)
3084+#define VBLANK(trans) _MMIO_TRANS2(trans, _VBLANK_A)
3085+#define VSYNC(trans) _MMIO_TRANS2(trans, _VSYNC_A)
3086+#define BCLRPAT(trans) _MMIO_TRANS2(trans, _BCLRPAT_A)
3087+#define VSYNCSHIFT(trans) _MMIO_TRANS2(trans, _VSYNCSHIFT_A)
3088+#define PIPESRC(trans) _MMIO_TRANS2(trans, _PIPEASRC)
3089+#define PIPE_MULT(trans) _MMIO_TRANS2(trans, _PIPE_MULT_A)
30403090
30413091 /* VLV eDP PSR registers */
30423092 #define _PSRCTLA (VLV_DISPLAY_BASE + 0x60090)
@@ -3052,14 +3102,14 @@ enum skl_disp_power_wells { · 9 unmodified lines
30523102 #define VLV_EDP_PSR_DBL_FRAME (1<<10)
30533103 #define VLV_EDP_PSR_FRAME_COUNT_MASK (0xff<<16)
30543104 #define VLV_EDP_PSR_IDLE_FRAME_SHIFT 16
3055−#define VLV_PSRCTL(pipe) _PIPE(pipe, _PSRCTLA, _PSRCTLB)
3105+#define VLV_PSRCTL(pipe) _MMIO_PIPE(pipe, _PSRCTLA, _PSRCTLB)
30563106
30573107 #define _VSCSDPA (VLV_DISPLAY_BASE + 0x600a0)
30583108 #define _VSCSDPB (VLV_DISPLAY_BASE + 0x610a0)
30593109 #define VLV_EDP_PSR_SDP_FREQ_MASK (3<<30)
30603110 #define VLV_EDP_PSR_SDP_FREQ_ONCE (1<<31)
30613111 #define VLV_EDP_PSR_SDP_FREQ_EVFRAME (1<<30)
3062−#define VLV_VSCSDP(pipe) _PIPE(pipe, _VSCSDPA, _VSCSDPB)
3112+#define VLV_VSCSDP(pipe) _MMIO_PIPE(pipe, _VSCSDPA, _VSCSDPB)
30633113
30643114 #define _PSRSTATA (VLV_DISPLAY_BASE + 0x60094)
30653115 #define _PSRSTATB (VLV_DISPLAY_BASE + 0x61094)
@@ -3072,11 +3122,12 @@ enum skl_disp_power_wells { · 6 unmodified lines
30723122 #define VLV_EDP_PSR_ACTIVE_SF_UPDATE (4<<0)
30733123 #define VLV_EDP_PSR_EXIT (5<<0)
30743124 #define VLV_EDP_PSR_IN_TRANS (1<<7)
3075−#define VLV_PSRSTAT(pipe) _PIPE(pipe, _PSRSTATA, _PSRSTATB)
3125+#define VLV_PSRSTAT(pipe) _MMIO_PIPE(pipe, _PSRSTATA, _PSRSTATB)
30763126
30773127 /* HSW+ eDP PSR registers */
3078−#define EDP_PSR_BASE(dev) (IS_HASWELL(dev) ? 0x64800 : 0x6f800)
3079−#define EDP_PSR_CTL(dev) (EDP_PSR_BASE(dev) + 0)
3128+#define HSW_EDP_PSR_BASE 0x64800
3129+#define BDW_EDP_PSR_BASE 0x6f800
3130+#define EDP_PSR_CTL _MMIO(dev_priv->psr_mmio_base + 0)
30803131 #define EDP_PSR_ENABLE (1<<31)
30813132 #define BDW_PSR_SINGLE_FRAME (1<<30)
30823133 #define EDP_PSR_LINK_STANDBY (1<<27)
@@ -3099,14 +3150,10 @@ enum skl_disp_power_wells { · 16 unmodified lines
30993150 #define EDP_PSR_TP1_TIME_0us (3<<4)
31003151 #define EDP_PSR_IDLE_FRAME_SHIFT 0
31013152
3102−#define EDP_PSR_AUX_CTL(dev) (EDP_PSR_BASE(dev) + 0x10)
3103−#define EDP_PSR_AUX_DATA1(dev) (EDP_PSR_BASE(dev) + 0x14)
3104−#define EDP_PSR_AUX_DATA2(dev) (EDP_PSR_BASE(dev) + 0x18)
3105−#define EDP_PSR_AUX_DATA3(dev) (EDP_PSR_BASE(dev) + 0x1c)
3106−#define EDP_PSR_AUX_DATA4(dev) (EDP_PSR_BASE(dev) + 0x20)
3107−#define EDP_PSR_AUX_DATA5(dev) (EDP_PSR_BASE(dev) + 0x24)
3153+#define EDP_PSR_AUX_CTL _MMIO(dev_priv->psr_mmio_base + 0x10)
3154+#define EDP_PSR_AUX_DATA(i) _MMIO(dev_priv->psr_mmio_base + 0x14 + (i) * 4) /* 5 registers */
31083155
3109−#define EDP_PSR_STATUS_CTL(dev) (EDP_PSR_BASE(dev) + 0x40)
3156+#define EDP_PSR_STATUS_CTL _MMIO(dev_priv->psr_mmio_base + 0x40)
31103157 #define EDP_PSR_STATUS_STATE_MASK (7<<29)
31113158 #define EDP_PSR_STATUS_STATE_IDLE (0<<29)
31123159 #define EDP_PSR_STATUS_STATE_SRDONACK (1<<29)
@@ -3130,15 +3177,15 @@ enum skl_disp_power_wells { · 17 unmodified lines
31303177 #define EDP_PSR_STATUS_SENDING_TP1 (1<<4)
31313178 #define EDP_PSR_STATUS_IDLE_MASK 0xf
31323179
3133−#define EDP_PSR_PERF_CNT(dev) (EDP_PSR_BASE(dev) + 0x44)
3180+#define EDP_PSR_PERF_CNT _MMIO(dev_priv->psr_mmio_base + 0x44)
31343181 #define EDP_PSR_PERF_CNT_MASK 0xffffff
31353182
3136−#define EDP_PSR_DEBUG_CTL(dev) (EDP_PSR_BASE(dev) + 0x60)
3183+#define EDP_PSR_DEBUG_CTL _MMIO(dev_priv->psr_mmio_base + 0x60)
31373184 #define EDP_PSR_DEBUG_MASK_LPSP (1<<27)
31383185 #define EDP_PSR_DEBUG_MASK_MEMUP (1<<26)
31393186 #define EDP_PSR_DEBUG_MASK_HPD (1<<25)
31403187
3141−#define EDP_PSR2_CTL 0x6f900
3188+#define EDP_PSR2_CTL _MMIO(0x6f900)
31423189 #define EDP_PSR2_ENABLE (1<<31)
31433190 #define EDP_SU_TRACK_ENABLE (1<<30)
31443191 #define EDP_MAX_SU_DISABLE_TIME(t) ((t)<<20)
@@ -3153,9 +3200,9 @@ enum skl_disp_power_wells { · 8 unmodified lines
31533200 #define EDP_PSR2_IDLE_MASK 0xf
31543201
31553202 /* VGA port control */
3156−#define ADPA 0x61100
3157−#define PCH_ADPA 0xe1100
3158−#define VLV_ADPA (VLV_DISPLAY_BASE + ADPA)
3203+#define ADPA _MMIO(0x61100)
3204+#define PCH_ADPA _MMIO(0xe1100)
3205+#define VLV_ADPA _MMIO(VLV_DISPLAY_BASE + 0x61100)
31593206
31603207 #define ADPA_DAC_ENABLE (1<<31)
31613208 #define ADPA_DAC_DISABLE 0
@@ -3201,7 +3248,7 @@ enum skl_disp_power_wells { · 39 unmodified lines
32013248
32023249
32033250 /* Hotplug control (945+ only) */
3204−#define PORT_HOTPLUG_EN (dev_priv->info.display_mmio_offset + 0x61110)
3251+#define PORT_HOTPLUG_EN _MMIO(dev_priv->info.display_mmio_offset + 0x61110)
32053252 #define PORTB_HOTPLUG_INT_EN (1 << 29)
32063253 #define PORTC_HOTPLUG_INT_EN (1 << 28)
32073254 #define PORTD_HOTPLUG_INT_EN (1 << 27)
@@ -3231,7 +3278,7 @@ enum skl_disp_power_wells { · 23 unmodified lines
32313278 #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2)
32323279 #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
32333280
3234−#define PORT_HOTPLUG_STAT (dev_priv->info.display_mmio_offset + 0x61114)
3281+#define PORT_HOTPLUG_STAT _MMIO(dev_priv->info.display_mmio_offset + 0x61114)
32353282 /*
32363283 * HDMI/DP bits are gen4+
32373284 *
@@ -3296,21 +3343,23 @@ enum skl_disp_power_wells { · 58 unmodified lines
32963343
32973344 /* SDVO and HDMI port control.
32983345 * The same register may be used for SDVO or HDMI */
3299−#define GEN3_SDVOB 0x61140
3300−#define GEN3_SDVOC 0x61160
3346+#define _GEN3_SDVOB 0x61140
3347+#define _GEN3_SDVOC 0x61160
3348+#define GEN3_SDVOB _MMIO(_GEN3_SDVOB)
3349+#define GEN3_SDVOC _MMIO(_GEN3_SDVOC)
33013350 #define GEN4_HDMIB GEN3_SDVOB
33023351 #define GEN4_HDMIC GEN3_SDVOC
3303−#define VLV_HDMIB (VLV_DISPLAY_BASE + GEN4_HDMIB)
3304−#define VLV_HDMIC (VLV_DISPLAY_BASE + GEN4_HDMIC)
3305−#define CHV_HDMID (VLV_DISPLAY_BASE + 0x6116C)
3306−#define PCH_SDVOB 0xe1140
3352+#define VLV_HDMIB _MMIO(VLV_DISPLAY_BASE + 0x61140)
3353+#define VLV_HDMIC _MMIO(VLV_DISPLAY_BASE + 0x61160)
3354+#define CHV_HDMID _MMIO(VLV_DISPLAY_BASE + 0x6116C)
3355+#define PCH_SDVOB _MMIO(0xe1140)
33073356 #define PCH_HDMIB PCH_SDVOB
3308−#define PCH_HDMIC 0xe1150
3309−#define PCH_HDMID 0xe1160
3357+#define PCH_HDMIC _MMIO(0xe1150)
3358+#define PCH_HDMID _MMIO(0xe1160)
33103359
3311−#define PORT_DFT_I9XX 0x61150
3360+#define PORT_DFT_I9XX _MMIO(0x61150)
33123361 #define DC_BALANCE_RESET (1 << 25)
3313−#define PORT_DFT2_G4X (dev_priv->info.display_mmio_offset + 0x61154)
3362+#define PORT_DFT2_G4X _MMIO(dev_priv->info.display_mmio_offset + 0x61154)
33143363 #define DC_BALANCE_RESET_VLV (1 << 31)
33153364 #define PIPE_SCRAMBLE_RESET_MASK ((1 << 14) | (0x3 << 0))
33163365 #define PIPE_C_SCRAMBLE_RESET (1 << 14) /* chv */
@@ -3370,9 +3419,12 @@ enum skl_disp_power_wells { · 53 unmodified lines
33703419
33713420
33723421 /* DVO port control */
3373−#define DVOA 0x61120
3374−#define DVOB 0x61140
3375−#define DVOC 0x61160
3422+#define _DVOA 0x61120
3423+#define DVOA _MMIO(_DVOA)
3424+#define _DVOB 0x61140
3425+#define DVOB _MMIO(_DVOB)
3426+#define _DVOC 0x61160
3427+#define DVOC _MMIO(_DVOC)
33763428 #define DVO_ENABLE (1 << 31)
33773429 #define DVO_PIPE_B_SELECT (1 << 30)
33783430 #define DVO_PIPE_STALL_UNUSED (0 << 28)
@@ -3397,14 +3449,14 @@ enum skl_disp_power_wells { · 18 unmodified lines
33973449 #define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */
33983450 #define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */
33993451 #define DVO_PRESERVE_MASK (0x7<<24)
3400−#define DVOA_SRCDIM 0x61124
3401−#define DVOB_SRCDIM 0x61144
3402−#define DVOC_SRCDIM 0x61164
3452+#define DVOA_SRCDIM _MMIO(0x61124)
3453+#define DVOB_SRCDIM _MMIO(0x61144)
3454+#define DVOC_SRCDIM _MMIO(0x61164)
34033455 #define DVO_SRCDIM_HORIZONTAL_SHIFT 12
34043456 #define DVO_SRCDIM_VERTICAL_SHIFT 0
34053457
34063458 /* LVDS port control */
3407−#define LVDS 0x61180
3459+#define LVDS _MMIO(0x61180)
34083460 /*
34093461 * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
34103462 * the DPLL semantics change when the LVDS is assigned to that pipe.
@@ -3454,13 +3506,13 @@ enum skl_disp_power_wells { · 43 unmodified lines
34543506 #define LVDS_B0B3_POWER_UP (3 << 2)
34553507
34563508 /* Video Data Island Packet control */
3457−#define VIDEO_DIP_DATA 0x61178
3509+#define VIDEO_DIP_DATA _MMIO(0x61178)
34583510 /* Read the description of VIDEO_DIP_DATA (before Haswell) or VIDEO_DIP_ECC
34593511 * (Haswell and newer) to see which VIDEO_DIP_DATA byte corresponds to each byte
34603512 * of the infoframe structure specified by CEA-861. */
34613513 #define VIDEO_DIP_DATA_SIZE 32
34623514 #define VIDEO_DIP_VSC_DATA_SIZE 36
3463−#define VIDEO_DIP_CTL 0x61170
3515+#define VIDEO_DIP_CTL _MMIO(0x61170)
34643516 /* Pre HSW: */
34653517 #define VIDEO_DIP_ENABLE (1 << 31)
34663518 #define VIDEO_DIP_PORT(port) ((port) << 29)
@@ -3487,7 +3539,7 @@ enum skl_disp_power_wells { · 20 unmodified lines
34873539 #define VIDEO_DIP_ENABLE_SPD_HSW (1 << 0)
34883540
34893541 /* Panel power sequencing */
3490−#define PP_STATUS 0x61200
3542+#define PP_STATUS _MMIO(0x61200)
34913543 #define PP_ON (1 << 31)
34923544 /*
34933545 * Indicates that all dependencies of the panel are on:
@@ -3513,14 +3565,14 @@ enum skl_disp_power_wells { · 19 unmodified lines
35133565 #define PP_SEQUENCE_STATE_ON_S1_2 (0xa << 0)
35143566 #define PP_SEQUENCE_STATE_ON_S1_3 (0xb << 0)
35153567 #define PP_SEQUENCE_STATE_RESET (0xf << 0)
3516−#define PP_CONTROL 0x61204
3568+#define PP_CONTROL _MMIO(0x61204)
35173569 #define POWER_TARGET_ON (1 << 0)
3518−#define PP_ON_DELAYS 0x61208
3519−#define PP_OFF_DELAYS 0x6120c
3520−#define PP_DIVISOR 0x61210
3570+#define PP_ON_DELAYS _MMIO(0x61208)
3571+#define PP_OFF_DELAYS _MMIO(0x6120c)
3572+#define PP_DIVISOR _MMIO(0x61210)
35213573
35223574 /* Panel fitting */
3523−#define PFIT_CONTROL (dev_priv->info.display_mmio_offset + 0x61230)
3575+#define PFIT_CONTROL _MMIO(dev_priv->info.display_mmio_offset + 0x61230)
35243576 #define PFIT_ENABLE (1 << 31)
35253577 #define PFIT_PIPE_MASK (3 << 29)
35263578 #define PFIT_PIPE_SHIFT 29
@@ -3538,7 +3590,7 @@ enum skl_disp_power_wells { · 11 unmodified lines
35383590 #define PFIT_SCALING_PROGRAMMED (1 << 26)
35393591 #define PFIT_SCALING_PILLAR (2 << 26)
35403592 #define PFIT_SCALING_LETTER (3 << 26)
3541−#define PFIT_PGM_RATIOS (dev_priv->info.display_mmio_offset + 0x61234)
3593+#define PFIT_PGM_RATIOS _MMIO(dev_priv->info.display_mmio_offset + 0x61234)
35423594 /* Pre-965 */
35433595 #define PFIT_VERT_SCALE_SHIFT 20
35443596 #define PFIT_VERT_SCALE_MASK 0xfff00000
@@ -3550,25 +3602,25 @@ enum skl_disp_power_wells { · 5 unmodified lines
35503602 #define PFIT_HORIZ_SCALE_SHIFT_965 0
35513603 #define PFIT_HORIZ_SCALE_MASK_965 0x00001fff
35523604
3553−#define PFIT_AUTO_RATIOS (dev_priv->info.display_mmio_offset + 0x61238)
3605+#define PFIT_AUTO_RATIOS _MMIO(dev_priv->info.display_mmio_offset + 0x61238)
35543606
35553607 #define _VLV_BLC_PWM_CTL2_A (dev_priv->info.display_mmio_offset + 0x61250)
35563608 #define _VLV_BLC_PWM_CTL2_B (dev_priv->info.display_mmio_offset + 0x61350)
3557−#define VLV_BLC_PWM_CTL2(pipe) _PIPE(pipe, _VLV_BLC_PWM_CTL2_A, \
3558− _VLV_BLC_PWM_CTL2_B)
3609+#define VLV_BLC_PWM_CTL2(pipe) _MMIO_PIPE(pipe, _VLV_BLC_PWM_CTL2_A, \
3610+ _VLV_BLC_PWM_CTL2_B)
35593611
35603612 #define _VLV_BLC_PWM_CTL_A (dev_priv->info.display_mmio_offset + 0x61254)
35613613 #define _VLV_BLC_PWM_CTL_B (dev_priv->info.display_mmio_offset + 0x61354)
3562−#define VLV_BLC_PWM_CTL(pipe) _PIPE(pipe, _VLV_BLC_PWM_CTL_A, \
3563− _VLV_BLC_PWM_CTL_B)
3614+#define VLV_BLC_PWM_CTL(pipe) _MMIO_PIPE(pipe, _VLV_BLC_PWM_CTL_A, \
3615+ _VLV_BLC_PWM_CTL_B)
35643616
35653617 #define _VLV_BLC_HIST_CTL_A (dev_priv->info.display_mmio_offset + 0x61260)
35663618 #define _VLV_BLC_HIST_CTL_B (dev_priv->info.display_mmio_offset + 0x61360)
3567−#define VLV_BLC_HIST_CTL(pipe) _PIPE(pipe, _VLV_BLC_HIST_CTL_A, \
3568− _VLV_BLC_HIST_CTL_B)
3619+#define VLV_BLC_HIST_CTL(pipe) _MMIO_PIPE(pipe, _VLV_BLC_HIST_CTL_A, \
3620+ _VLV_BLC_HIST_CTL_B)
35693621
35703622 /* Backlight control */
3571−#define BLC_PWM_CTL2 (dev_priv->info.display_mmio_offset + 0x61250) /* 965+ only */
3623+#define BLC_PWM_CTL2 _MMIO(dev_priv->info.display_mmio_offset + 0x61250) /* 965+ only */
35723624 #define BLM_PWM_ENABLE (1 << 31)
35733625 #define BLM_COMBINATION_MODE (1 << 30) /* gen4 only */
35743626 #define BLM_PIPE_SELECT (1 << 29)
@@ -3591,7 +3643,7 @@ enum skl_disp_power_wells { · 16 unmodified lines
35913643 #define BLM_PHASE_IN_COUNT_MASK (0xff << 8)
35923644 #define BLM_PHASE_IN_INCR_SHIFT (0)
35933645 #define BLM_PHASE_IN_INCR_MASK (0xff << 0)
3594−#define BLC_PWM_CTL (dev_priv->info.display_mmio_offset + 0x61254)
3646+#define BLC_PWM_CTL _MMIO(dev_priv->info.display_mmio_offset + 0x61254)
35953647 /*
35963648 * This is the most significant 15 bits of the number of backlight cycles in a
35973649 * complete cycle of the modulated backlight control.
@@ -3613,25 +3665,25 @@ enum skl_disp_power_wells { · 15 unmodified lines
36133665 #define BACKLIGHT_DUTY_CYCLE_MASK_PNV (0xfffe)
36143666 #define BLM_POLARITY_PNV (1 << 0) /* pnv only */
36153667
3616−#define BLC_HIST_CTL (dev_priv->info.display_mmio_offset + 0x61260)
3668+#define BLC_HIST_CTL _MMIO(dev_priv->info.display_mmio_offset + 0x61260)
36173669 #define BLM_HISTOGRAM_ENABLE (1 << 31)
36183670
36193671 /* New registers for PCH-split platforms. Safe where new bits show up, the
36203672 * register layout machtes with gen4 BLC_PWM_CTL[12]. */
3621−#define BLC_PWM_CPU_CTL2 0x48250
3622−#define BLC_PWM_CPU_CTL 0x48254
3673+#define BLC_PWM_CPU_CTL2 _MMIO(0x48250)
3674+#define BLC_PWM_CPU_CTL _MMIO(0x48254)
36233675
3624−#define HSW_BLC_PWM2_CTL 0x48350
3676+#define HSW_BLC_PWM2_CTL _MMIO(0x48350)
36253677
36263678 /* PCH CTL1 is totally different, all but the below bits are reserved. CTL2 is
36273679 * like the normal CTL from gen4 and earlier. Hooray for confusing naming. */
3628−#define BLC_PWM_PCH_CTL1 0xc8250
3680+#define BLC_PWM_PCH_CTL1 _MMIO(0xc8250)
36293681 #define BLM_PCH_PWM_ENABLE (1 << 31)
36303682 #define BLM_PCH_OVERRIDE_ENABLE (1 << 30)
36313683 #define BLM_PCH_POLARITY (1 << 29)
3632−#define BLC_PWM_PCH_CTL2 0xc8254
3684+#define BLC_PWM_PCH_CTL2 _MMIO(0xc8254)
36333685
3634−#define UTIL_PIN_CTL 0x48400
3686+#define UTIL_PIN_CTL _MMIO(0x48400)
36353687 #define UTIL_PIN_ENABLE (1 << 31)
36363688
36373689 #define UTIL_PIN_PIPE(x) ((x) << 29)
@@ -3651,18 +3703,18 @@ enum skl_disp_power_wells { · 13 unmodified lines
36513703 #define _BXT_BLC_PWM_FREQ2 0xC8354
36523704 #define _BXT_BLC_PWM_DUTY2 0xC8358
36533705
3654−#define BXT_BLC_PWM_CTL(controller) _PIPE(controller, \
3706+#define BXT_BLC_PWM_CTL(controller) _MMIO_PIPE(controller, \
36553707 _BXT_BLC_PWM_CTL1, _BXT_BLC_PWM_CTL2)
3656−#define BXT_BLC_PWM_FREQ(controller) _PIPE(controller, \
3708+#define BXT_BLC_PWM_FREQ(controller) _MMIO_PIPE(controller, \
36573709 _BXT_BLC_PWM_FREQ1, _BXT_BLC_PWM_FREQ2)
3658−#define BXT_BLC_PWM_DUTY(controller) _PIPE(controller, \
3710+#define BXT_BLC_PWM_DUTY(controller) _MMIO_PIPE(controller, \
36593711 _BXT_BLC_PWM_DUTY1, _BXT_BLC_PWM_DUTY2)
36603712
3661−#define PCH_GTC_CTL 0xe7000
3713+#define PCH_GTC_CTL _MMIO(0xe7000)
36623714 #define PCH_GTC_ENABLE (1 << 31)
36633715
36643716 /* TV port control */
3665−#define TV_CTL 0x68000
3717+#define TV_CTL _MMIO(0x68000)
36663718 /* Enables the TV encoder */
36673719 # define TV_ENC_ENABLE (1 << 31)
36683720 /* Sources the TV encoder input from pipe B instead of A. */
@@ -3729,7 +3781,7 @@ enum skl_disp_power_wells { · 60 unmodified lines
37293781 # define TV_TEST_MODE_MONITOR_DETECT (7 << 0)
37303782 # define TV_TEST_MODE_MASK (7 << 0)
37313783
3732−#define TV_DAC 0x68004
3784+#define TV_DAC _MMIO(0x68004)
37333785 # define TV_DAC_SAVE 0x00ffff00
37343786 /*
37353787 * Reports that DAC state change logic has reported change (RO).
@@ -3780,13 +3832,13 @@ enum skl_disp_power_wells { · 44 unmodified lines
37803832 * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
37813833 * -1 (0x3) being the only legal negative value.
37823834 */
3783−#define TV_CSC_Y 0x68010
3835+#define TV_CSC_Y _MMIO(0x68010)
37843836 # define TV_RY_MASK 0x07ff0000
37853837 # define TV_RY_SHIFT 16
37863838 # define TV_GY_MASK 0x00000fff
37873839 # define TV_GY_SHIFT 0
37883840
3789−#define TV_CSC_Y2 0x68014
3841+#define TV_CSC_Y2 _MMIO(0x68014)
37903842 # define TV_BY_MASK 0x07ff0000
37913843 # define TV_BY_SHIFT 16
37923844 /*
@@ -3797,13 +3849,13 @@ enum skl_disp_power_wells { · 4 unmodified lines
37973849 # define TV_AY_MASK 0x000003ff
37983850 # define TV_AY_SHIFT 0
37993851
3800−#define TV_CSC_U 0x68018
3852+#define TV_CSC_U _MMIO(0x68018)
38013853 # define TV_RU_MASK 0x07ff0000
38023854 # define TV_RU_SHIFT 16
38033855 # define TV_GU_MASK 0x000007ff
38043856 # define TV_GU_SHIFT 0
38053857
3806−#define TV_CSC_U2 0x6801c
3858+#define TV_CSC_U2 _MMIO(0x6801c)
38073859 # define TV_BU_MASK 0x07ff0000
38083860 # define TV_BU_SHIFT 16
38093861 /*
@@ -3814,13 +3866,13 @@ enum skl_disp_power_wells { · 4 unmodified lines
38143866 # define TV_AU_MASK 0x000003ff
38153867 # define TV_AU_SHIFT 0
38163868
3817−#define TV_CSC_V 0x68020
3869+#define TV_CSC_V _MMIO(0x68020)
38183870 # define TV_RV_MASK 0x0fff0000
38193871 # define TV_RV_SHIFT 16
38203872 # define TV_GV_MASK 0x000007ff
38213873 # define TV_GV_SHIFT 0
38223874
3823−#define TV_CSC_V2 0x68024
3875+#define TV_CSC_V2 _MMIO(0x68024)
38243876 # define TV_BV_MASK 0x07ff0000
38253877 # define TV_BV_SHIFT 16
38263878 /*
@@ -3831,7 +3883,7 @@ enum skl_disp_power_wells { · 4 unmodified lines
38313883 # define TV_AV_MASK 0x000007ff
38323884 # define TV_AV_SHIFT 0
38333885
3834−#define TV_CLR_KNOBS 0x68028
3886+#define TV_CLR_KNOBS _MMIO(0x68028)
38353887 /* 2s-complement brightness adjustment */
38363888 # define TV_BRIGHTNESS_MASK 0xff000000
38373889 # define TV_BRIGHTNESS_SHIFT 24
@@ -3845,7 +3897,7 @@ enum skl_disp_power_wells { · 7 unmodified lines
38453897 # define TV_HUE_MASK 0x000000ff
38463898 # define TV_HUE_SHIFT 0
38473899
3848−#define TV_CLR_LEVEL 0x6802c
3900+#define TV_CLR_LEVEL _MMIO(0x6802c)
38493901 /* Controls the DAC level for black */
38503902 # define TV_BLACK_LEVEL_MASK 0x01ff0000
38513903 # define TV_BLACK_LEVEL_SHIFT 16
@@ -3853,7 +3905,7 @@ enum skl_disp_power_wells { · 1 unmodified line
38533905 # define TV_BLANK_LEVEL_MASK 0x000001ff
38543906 # define TV_BLANK_LEVEL_SHIFT 0
38553907
3856−#define TV_H_CTL_1 0x68030
3908+#define TV_H_CTL_1 _MMIO(0x68030)
38573909 /* Number of pixels in the hsync. */
38583910 # define TV_HSYNC_END_MASK 0x1fff0000
38593911 # define TV_HSYNC_END_SHIFT 16
@@ -3861,7 +3913,7 @@ enum skl_disp_power_wells { · 1 unmodified line
38613913 # define TV_HTOTAL_MASK 0x00001fff
38623914 # define TV_HTOTAL_SHIFT 0
38633915
3864−#define TV_H_CTL_2 0x68034
3916+#define TV_H_CTL_2 _MMIO(0x68034)
38653917 /* Enables the colorburst (needed for non-component color) */
38663918 # define TV_BURST_ENA (1 << 31)
38673919 /* Offset of the colorburst from the start of hsync, in pixels minus one. */
@@ -3871,7 +3923,7 @@ enum skl_disp_power_wells { · 3 unmodified lines
38713923 # define TV_HBURST_LEN_SHIFT 0
38723924 # define TV_HBURST_LEN_MASK 0x0001fff
38733925
3874−#define TV_H_CTL_3 0x68038
3926+#define TV_H_CTL_3 _MMIO(0x68038)
38753927 /* End of hblank, measured in pixels minus one from start of hsync */
38763928 # define TV_HBLANK_END_SHIFT 16
38773929 # define TV_HBLANK_END_MASK 0x1fff0000
@@ -3879,7 +3931,7 @@ enum skl_disp_power_wells { · 1 unmodified line
38793931 # define TV_HBLANK_START_SHIFT 0
38803932 # define TV_HBLANK_START_MASK 0x0001fff
38813933
3882−#define TV_V_CTL_1 0x6803c
3934+#define TV_V_CTL_1 _MMIO(0x6803c)
38833935 /* XXX */
38843936 # define TV_NBR_END_SHIFT 16
38853937 # define TV_NBR_END_MASK 0x07ff0000
@@ -3890,7 +3942,7 @@ enum skl_disp_power_wells { · 4 unmodified lines
38903942 # define TV_VI_END_F2_SHIFT 0
38913943 # define TV_VI_END_F2_MASK 0x0000003f
38923944
3893−#define TV_V_CTL_2 0x68040
3945+#define TV_V_CTL_2 _MMIO(0x68040)
38943946 /* Length of vsync, in half lines */
38953947 # define TV_VSYNC_LEN_MASK 0x07ff0000
38963948 # define TV_VSYNC_LEN_SHIFT 16
@@ -3906,7 +3958,7 @@ enum skl_disp_power_wells { · 9 unmodified lines
39063958 # define TV_VSYNC_START_F2_MASK 0x0000007f
39073959 # define TV_VSYNC_START_F2_SHIFT 0
39083960
3909−#define TV_V_CTL_3 0x68044
3961+#define TV_V_CTL_3 _MMIO(0x68044)
39103962 /* Enables generation of the equalization signal */
39113963 # define TV_EQUAL_ENA (1 << 31)
39123964 /* Length of vsync, in half lines */
@@ -3924,7 +3976,7 @@ enum skl_disp_power_wells { · 11 unmodified lines
39243976 # define TV_VEQ_START_F2_MASK 0x000007f
39253977 # define TV_VEQ_START_F2_SHIFT 0
39263978
3927−#define TV_V_CTL_4 0x68048
3979+#define TV_V_CTL_4 _MMIO(0x68048)
39283980 /*
39293981 * Offset to start of vertical colorburst, measured in one less than the
39303982 * number of lines from vertical start.
@@ -3938,7 +3990,7 @@ enum skl_disp_power_wells { · 7 unmodified lines
39383990 # define TV_VBURST_END_F1_MASK 0x000000ff
39393991 # define TV_VBURST_END_F1_SHIFT 0
39403992
3941−#define TV_V_CTL_5 0x6804c
3993+#define TV_V_CTL_5 _MMIO(0x6804c)
39423994 /*
39433995 * Offset to start of vertical colorburst, measured in one less than the
39443996 * number of lines from vertical start.
@@ -3952,7 +4004,7 @@ enum skl_disp_power_wells { · 7 unmodified lines
39524004 # define TV_VBURST_END_F2_MASK 0x000000ff
39534005 # define TV_VBURST_END_F2_SHIFT 0
39544006
3955−#define TV_V_CTL_6 0x68050
4007+#define TV_V_CTL_6 _MMIO(0x68050)
39564008 /*
39574009 * Offset to start of vertical colorburst, measured in one less than the
39584010 * number of lines from vertical start.
@@ -3966,7 +4018,7 @@ enum skl_disp_power_wells { · 7 unmodified lines
39664018 # define TV_VBURST_END_F3_MASK 0x000000ff
39674019 # define TV_VBURST_END_F3_SHIFT 0
39684020
3969−#define TV_V_CTL_7 0x68054
4021+#define TV_V_CTL_7 _MMIO(0x68054)
39704022 /*
39714023 * Offset to start of vertical colorburst, measured in one less than the
39724024 * number of lines from vertical start.
@@ -3980,7 +4032,7 @@ enum skl_disp_power_wells { · 7 unmodified lines
39804032 # define TV_VBURST_END_F4_MASK 0x000000ff
39814033 # define TV_VBURST_END_F4_SHIFT 0
39824034
3983−#define TV_SC_CTL_1 0x68060
4035+#define TV_SC_CTL_1 _MMIO(0x68060)
39844036 /* Turns on the first subcarrier phase generation DDA */
39854037 # define TV_SC_DDA1_EN (1 << 31)
39864038 /* Turns on the first subcarrier phase generation DDA */
@@ -4002,7 +4054,7 @@ enum skl_disp_power_wells { · 15 unmodified lines
40024054 # define TV_SCDDA1_INC_MASK 0x00000fff
40034055 # define TV_SCDDA1_INC_SHIFT 0
40044056
4005−#define TV_SC_CTL_2 0x68064
4057+#define TV_SC_CTL_2 _MMIO(0x68064)
40064058 /* Sets the rollover for the second subcarrier phase generation DDA */
40074059 # define TV_SCDDA2_SIZE_MASK 0x7fff0000
40084060 # define TV_SCDDA2_SIZE_SHIFT 16
@@ -4010,7 +4062,7 @@ enum skl_disp_power_wells { · 1 unmodified line
40104062 # define TV_SCDDA2_INC_MASK 0x00007fff
40114063 # define TV_SCDDA2_INC_SHIFT 0
40124064
4013−#define TV_SC_CTL_3 0x68068
4065+#define TV_SC_CTL_3 _MMIO(0x68068)
40144066 /* Sets the rollover for the third subcarrier phase generation DDA */
40154067 # define TV_SCDDA3_SIZE_MASK 0x7fff0000
40164068 # define TV_SCDDA3_SIZE_SHIFT 16
@@ -4018,7 +4070,7 @@ enum skl_disp_power_wells { · 1 unmodified line
40184070 # define TV_SCDDA3_INC_MASK 0x00007fff
40194071 # define TV_SCDDA3_INC_SHIFT 0
40204072
4021−#define TV_WIN_POS 0x68070
4073+#define TV_WIN_POS _MMIO(0x68070)
40224074 /* X coordinate of the display from the start of horizontal active */
40234075 # define TV_XPOS_MASK 0x1fff0000
40244076 # define TV_XPOS_SHIFT 16
@@ -4026,7 +4078,7 @@ enum skl_disp_power_wells { · 1 unmodified line
40264078 # define TV_YPOS_MASK 0x00000fff
40274079 # define TV_YPOS_SHIFT 0
40284080
4029−#define TV_WIN_SIZE 0x68074
4081+#define TV_WIN_SIZE _MMIO(0x68074)
40304082 /* Horizontal size of the display window, measured in pixels*/
40314083 # define TV_XSIZE_MASK 0x1fff0000
40324084 # define TV_XSIZE_SHIFT 16
@@ -4038,7 +4090,7 @@ enum skl_disp_power_wells { · 5 unmodified lines
40384090 # define TV_YSIZE_MASK 0x00000fff
40394091 # define TV_YSIZE_SHIFT 0
40404092
4041−#define TV_FILTER_CTL_1 0x68080
4093+#define TV_FILTER_CTL_1 _MMIO(0x68080)
40424094 /*
40434095 * Enables automatic scaling calculation.
40444096 *
@@ -4071,7 +4123,7 @@ enum skl_disp_power_wells { · 26 unmodified lines
40714123 # define TV_HSCALE_FRAC_MASK 0x00003fff
40724124 # define TV_HSCALE_FRAC_SHIFT 0
40734125
4074−#define TV_FILTER_CTL_2 0x68084
4126+#define TV_FILTER_CTL_2 _MMIO(0x68084)
40754127 /*
40764128 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
40774129 *
@@ -4087,7 +4139,7 @@ enum skl_disp_power_wells { · 9 unmodified lines
40874139 # define TV_VSCALE_FRAC_MASK 0x00007fff
40884140 # define TV_VSCALE_FRAC_SHIFT 0
40894141
4090−#define TV_FILTER_CTL_3 0x68088
4142+#define TV_FILTER_CTL_3 _MMIO(0x68088)
40914143 /*
40924144 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
40934145 *
@@ -4107,7 +4159,7 @@ enum skl_disp_power_wells { · 13 unmodified lines
41074159 # define TV_VSCALE_IP_FRAC_MASK 0x00007fff
41084160 # define TV_VSCALE_IP_FRAC_SHIFT 0
41094161
4110−#define TV_CC_CONTROL 0x68090
4162+#define TV_CC_CONTROL _MMIO(0x68090)
41114163 # define TV_CC_ENABLE (1 << 31)
41124164 /*
41134165 * Specifies which field to send the CC data in.
@@ -4123,7 +4175,7 @@ enum skl_disp_power_wells { · 9 unmodified lines
41234175 # define TV_CC_LINE_MASK 0x0000003f
41244176 # define TV_CC_LINE_SHIFT 0
41254177
4126−#define TV_CC_DATA 0x68094
4178+#define TV_CC_DATA _MMIO(0x68094)
41274179 # define TV_CC_RDY (1 << 31)
41284180 /* Second word of CC data to be transmitted. */
41294181 # define TV_CC_DATA_2_MASK 0x007f0000
@@ -4132,20 +4184,20 @@ enum skl_disp_power_wells { · 2 unmodified lines
41324184 # define TV_CC_DATA_1_MASK 0x0000007f
41334185 # define TV_CC_DATA_1_SHIFT 0
41344186
4135−#define TV_H_LUMA(i) (0x68100 + (i) * 4) /* 60 registers */
4136−#define TV_H_CHROMA(i) (0x68200 + (i) * 4) /* 60 registers */
4137−#define TV_V_LUMA(i) (0x68300 + (i) * 4) /* 43 registers */
4138−#define TV_V_CHROMA(i) (0x68400 + (i) * 4) /* 43 registers */
4187+#define TV_H_LUMA(i) _MMIO(0x68100 + (i) * 4) /* 60 registers */
4188+#define TV_H_CHROMA(i) _MMIO(0x68200 + (i) * 4) /* 60 registers */
4189+#define TV_V_LUMA(i) _MMIO(0x68300 + (i) * 4) /* 43 registers */
4190+#define TV_V_CHROMA(i) _MMIO(0x68400 + (i) * 4) /* 43 registers */
41394191
41404192 /* Display Port */
4141−#define DP_A 0x64000 /* eDP */
4142−#define DP_B 0x64100
4143−#define DP_C 0x64200
4144−#define DP_D 0x64300
4193+#define DP_A _MMIO(0x64000) /* eDP */
4194+#define DP_B _MMIO(0x64100)
4195+#define DP_C _MMIO(0x64200)
4196+#define DP_D _MMIO(0x64300)
41454197
4146−#define VLV_DP_B (VLV_DISPLAY_BASE + DP_B)
4147−#define VLV_DP_C (VLV_DISPLAY_BASE + DP_C)
4148−#define CHV_DP_D (VLV_DISPLAY_BASE + DP_D)
4198+#define VLV_DP_B _MMIO(VLV_DISPLAY_BASE + 0x64100)
4199+#define VLV_DP_C _MMIO(VLV_DISPLAY_BASE + 0x64200)
4200+#define CHV_DP_D _MMIO(VLV_DISPLAY_BASE + 0x64300)
41494201
41504202 #define DP_PORT_EN (1 << 31)
41514203 #define DP_PIPEB_SELECT (1 << 30)
@@ -4199,7 +4251,7 @@ enum skl_disp_power_wells { · 47 unmodified lines
41994251
42004252 /* eDP */
42014253 #define DP_PLL_FREQ_270MHZ (0 << 16)
4202−#define DP_PLL_FREQ_160MHZ (1 << 16)
4254+#define DP_PLL_FREQ_162MHZ (1 << 16)
42034255 #define DP_PLL_FREQ_MASK (3 << 16)
42044256
42054257 /* locked once port is enabled */
@@ -4232,33 +4284,36 @@ enum skl_disp_power_wells { · 26 unmodified lines
42324284 * is 20 bytes in each direction, hence the 5 fixed
42334285 * data registers
42344286 */
4235−#define DPA_AUX_CH_CTL 0x64010
4236−#define DPA_AUX_CH_DATA1 0x64014
4237−#define DPA_AUX_CH_DATA2 0x64018
4238−#define DPA_AUX_CH_DATA3 0x6401c
4239−#define DPA_AUX_CH_DATA4 0x64020
4240−#define DPA_AUX_CH_DATA5 0x64024
4241−
4242−#define DPB_AUX_CH_CTL 0x64110
4243−#define DPB_AUX_CH_DATA1 0x64114
4244−#define DPB_AUX_CH_DATA2 0x64118
4245−#define DPB_AUX_CH_DATA3 0x6411c
4246−#define DPB_AUX_CH_DATA4 0x64120
4247−#define DPB_AUX_CH_DATA5 0x64124
4248−
4249−#define DPC_AUX_CH_CTL 0x64210
4250−#define DPC_AUX_CH_DATA1 0x64214
4251−#define DPC_AUX_CH_DATA2 0x64218
4252−#define DPC_AUX_CH_DATA3 0x6421c
4253−#define DPC_AUX_CH_DATA4 0x64220
4254−#define DPC_AUX_CH_DATA5 0x64224
4255−
4256−#define DPD_AUX_CH_CTL 0x64310
4257−#define DPD_AUX_CH_DATA1 0x64314
4258−#define DPD_AUX_CH_DATA2 0x64318
4259−#define DPD_AUX_CH_DATA3 0x6431c
4260−#define DPD_AUX_CH_DATA4 0x64320
4261−#define DPD_AUX_CH_DATA5 0x64324
4287+#define _DPA_AUX_CH_CTL (dev_priv->info.display_mmio_offset + 0x64010)
4288+#define _DPA_AUX_CH_DATA1 (dev_priv->info.display_mmio_offset + 0x64014)
4289+#define _DPA_AUX_CH_DATA2 (dev_priv->info.display_mmio_offset + 0x64018)
4290+#define _DPA_AUX_CH_DATA3 (dev_priv->info.display_mmio_offset + 0x6401c)
4291+#define _DPA_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64020)
4292+#define _DPA_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64024)
4293+
4294+#define _DPB_AUX_CH_CTL (dev_priv->info.display_mmio_offset + 0x64110)
4295+#define _DPB_AUX_CH_DATA1 (dev_priv->info.display_mmio_offset + 0x64114)
4296+#define _DPB_AUX_CH_DATA2 (dev_priv->info.display_mmio_offset + 0x64118)
4297+#define _DPB_AUX_CH_DATA3 (dev_priv->info.display_mmio_offset + 0x6411c)
4298+#define _DPB_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64120)
4299+#define _DPB_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64124)
4300+
4301+#define _DPC_AUX_CH_CTL (dev_priv->info.display_mmio_offset + 0x64210)
4302+#define _DPC_AUX_CH_DATA1 (dev_priv->info.display_mmio_offset + 0x64214)
4303+#define _DPC_AUX_CH_DATA2 (dev_priv->info.display_mmio_offset + 0x64218)
4304+#define _DPC_AUX_CH_DATA3 (dev_priv->info.display_mmio_offset + 0x6421c)
4305+#define _DPC_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64220)
4306+#define _DPC_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64224)
4307+
4308+#define _DPD_AUX_CH_CTL (dev_priv->info.display_mmio_offset + 0x64310)
4309+#define _DPD_AUX_CH_DATA1 (dev_priv->info.display_mmio_offset + 0x64314)
4310+#define _DPD_AUX_CH_DATA2 (dev_priv->info.display_mmio_offset + 0x64318)
4311+#define _DPD_AUX_CH_DATA3 (dev_priv->info.display_mmio_offset + 0x6431c)
4312+#define _DPD_AUX_CH_DATA4 (dev_priv->info.display_mmio_offset + 0x64320)
4313+#define _DPD_AUX_CH_DATA5 (dev_priv->info.display_mmio_offset + 0x64324)
4314+
4315+#define DP_AUX_CH_CTL(port) _MMIO_PORT(port, _DPA_AUX_CH_CTL, _DPB_AUX_CH_CTL)
4316+#define DP_AUX_CH_DATA(port, i) _MMIO(_PORT(port, _DPA_AUX_CH_DATA1, _DPB_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
42624317
42634318 #define DP_AUX_CH_CTL_SEND_BUSY (1 << 31)
42644319 #define DP_AUX_CH_CTL_DONE (1 << 30)
@@ -4335,10 +4390,10 @@ enum skl_disp_power_wells { · 70 unmodified lines
43354390 #define _PIPEB_LINK_N_G4X 0x71064
43364391 #define PIPEA_DP_LINK_N_MASK (0xffffff)
43374392
4338−#define PIPE_DATA_M_G4X(pipe) _PIPE(pipe, _PIPEA_DATA_M_G4X, _PIPEB_DATA_M_G4X)
4339−#define PIPE_DATA_N_G4X(pipe) _PIPE(pipe, _PIPEA_DATA_N_G4X, _PIPEB_DATA_N_G4X)
4340−#define PIPE_LINK_M_G4X(pipe) _PIPE(pipe, _PIPEA_LINK_M_G4X, _PIPEB_LINK_M_G4X)
4341−#define PIPE_LINK_N_G4X(pipe) _PIPE(pipe, _PIPEA_LINK_N_G4X, _PIPEB_LINK_N_G4X)
4393+#define PIPE_DATA_M_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_DATA_M_G4X, _PIPEB_DATA_M_G4X)
4394+#define PIPE_DATA_N_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_DATA_N_G4X, _PIPEB_DATA_N_G4X)
4395+#define PIPE_LINK_M_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_LINK_M_G4X, _PIPEB_LINK_M_G4X)
4396+#define PIPE_LINK_N_G4X(pipe) _MMIO_PIPE(pipe, _PIPEA_LINK_N_G4X, _PIPEB_LINK_N_G4X)
43424397
43434398 /* Display & cursor control */
43444399
@@ -4454,15 +4509,15 @@ enum skl_disp_power_wells { · 109 unmodified lines
44544509 */
44554510 #define PIPE_EDP_OFFSET 0x7f000
44564511
4457−#define _PIPE2(pipe, reg) (dev_priv->info.pipe_offsets[pipe] - \
4512+#define _MMIO_PIPE2(pipe, reg) _MMIO(dev_priv->info.pipe_offsets[pipe] - \
44584513 dev_priv->info.pipe_offsets[PIPE_A] + (reg) + \
44594514 dev_priv->info.display_mmio_offset)
44604515
4461−#define PIPECONF(pipe) _PIPE2(pipe, _PIPEACONF)
4462−#define PIPEDSL(pipe) _PIPE2(pipe, _PIPEADSL)
4463−#define PIPEFRAME(pipe) _PIPE2(pipe, _PIPEAFRAMEHIGH)
4464−#define PIPEFRAMEPIXEL(pipe) _PIPE2(pipe, _PIPEAFRAMEPIXEL)
4465−#define PIPESTAT(pipe) _PIPE2(pipe, _PIPEASTAT)
4516+#define PIPECONF(pipe) _MMIO_PIPE2(pipe, _PIPEACONF)
4517+#define PIPEDSL(pipe) _MMIO_PIPE2(pipe, _PIPEADSL)
4518+#define PIPEFRAME(pipe) _MMIO_PIPE2(pipe, _PIPEAFRAMEHIGH)
4519+#define PIPEFRAMEPIXEL(pipe) _MMIO_PIPE2(pipe, _PIPEAFRAMEPIXEL)
4520+#define PIPESTAT(pipe) _MMIO_PIPE2(pipe, _PIPEASTAT)
44664521
44674522 #define _PIPE_MISC_A 0x70030
44684523 #define _PIPE_MISC_B 0x71030
@@ -4474,9 +4529,9 @@ enum skl_disp_power_wells { · 5 unmodified lines
44744529 #define PIPEMISC_DITHER_ENABLE (1<<4)
44754530 #define PIPEMISC_DITHER_TYPE_MASK (3<<2)
44764531 #define PIPEMISC_DITHER_TYPE_SP (0<<2)
4477−#define PIPEMISC(pipe) _PIPE2(pipe, _PIPE_MISC_A)
4532+#define PIPEMISC(pipe) _MMIO_PIPE2(pipe, _PIPE_MISC_A)
44784533
4479−#define VLV_DPFLIPSTAT (VLV_DISPLAY_BASE + 0x70028)
4534+#define VLV_DPFLIPSTAT _MMIO(VLV_DISPLAY_BASE + 0x70028)
44804535 #define PIPEB_LINE_COMPARE_INT_EN (1<<29)
44814536 #define PIPEB_HLINE_INT_EN (1<<28)
44824537 #define PIPEB_VBLANK_INT_EN (1<<27)
@@ -4497,7 +4552,7 @@ enum skl_disp_power_wells { · 14 unmodified lines
44974552 #define SPRITEE_FLIPDONE_INT_EN (1<<9)
44984553 #define PLANEC_FLIPDONE_INT_EN (1<<8)
44994554
4500−#define DPINVGTT (VLV_DISPLAY_BASE + 0x7002c) /* VLV/CHV only */
4555+#define DPINVGTT _MMIO(VLV_DISPLAY_BASE + 0x7002c) /* VLV/CHV only */
45014556 #define SPRITEF_INVALID_GTT_INT_EN (1<<27)
45024557 #define SPRITEE_INVALID_GTT_INT_EN (1<<26)
45034558 #define PLANEC_INVALID_GTT_INT_EN (1<<25)
@@ -4527,7 +4582,7 @@ enum skl_disp_power_wells { · 23 unmodified lines
45274582 #define DPINVGTT_STATUS_MASK 0xff
45284583 #define DPINVGTT_STATUS_MASK_CHV 0xfff
45294584
4530−#define DSPARB (dev_priv->info.display_mmio_offset + 0x70030)
4585+#define DSPARB _MMIO(dev_priv->info.display_mmio_offset + 0x70030)
45314586 #define DSPARB_CSTART_MASK (0x7f << 7)
45324587 #define DSPARB_CSTART_SHIFT 7
45334588 #define DSPARB_BSTART_MASK (0x7f)
@@ -4542,7 +4597,7 @@ enum skl_disp_power_wells { · 8 unmodified lines
45424597 #define DSPARB_SPRITEC_MASK_VLV (0xff << 16)
45434598 #define DSPARB_SPRITED_SHIFT_VLV 24
45444599 #define DSPARB_SPRITED_MASK_VLV (0xff << 24)
4545−#define DSPARB2 (VLV_DISPLAY_BASE + 0x70060) /* vlv/chv */
4600+#define DSPARB2 _MMIO(VLV_DISPLAY_BASE + 0x70060) /* vlv/chv */
45464601 #define DSPARB_SPRITEA_HI_SHIFT_VLV 0
45474602 #define DSPARB_SPRITEA_HI_MASK_VLV (0x1 << 0)
45484603 #define DSPARB_SPRITEB_HI_SHIFT_VLV 4
@@ -4555,14 +4610,14 @@ enum skl_disp_power_wells { · 6 unmodified lines
45554610 #define DSPARB_SPRITEE_HI_MASK_VLV (0x1 << 16)
45564611 #define DSPARB_SPRITEF_HI_SHIFT_VLV 20
45574612 #define DSPARB_SPRITEF_HI_MASK_VLV (0x1 << 20)
4558−#define DSPARB3 (VLV_DISPLAY_BASE + 0x7006c) /* chv */
4613+#define DSPARB3 _MMIO(VLV_DISPLAY_BASE + 0x7006c) /* chv */
45594614 #define DSPARB_SPRITEE_SHIFT_VLV 0
45604615 #define DSPARB_SPRITEE_MASK_VLV (0xff << 0)
45614616 #define DSPARB_SPRITEF_SHIFT_VLV 8
45624617 #define DSPARB_SPRITEF_MASK_VLV (0xff << 8)
45634618
45644619 /* pnv/gen4/g4x/vlv/chv */
4565−#define DSPFW1 (dev_priv->info.display_mmio_offset + 0x70034)
4620+#define DSPFW1 _MMIO(dev_priv->info.display_mmio_offset + 0x70034)
45664621 #define DSPFW_SR_SHIFT 23
45674622 #define DSPFW_SR_MASK (0x1ff<<23)
45684623 #define DSPFW_CURSORB_SHIFT 16
@@ -4573,7 +4628,7 @@ enum skl_disp_power_wells { · 4 unmodified lines
45734628 #define DSPFW_PLANEA_SHIFT 0
45744629 #define DSPFW_PLANEA_MASK (0x7f<<0)
45754630 #define DSPFW_PLANEA_MASK_VLV (0xff<<0) /* vlv/chv */
4576−#define DSPFW2 (dev_priv->info.display_mmio_offset + 0x70038)
4631+#define DSPFW2 _MMIO(dev_priv->info.display_mmio_offset + 0x70038)
45774632 #define DSPFW_FBC_SR_EN (1<<31) /* g4x */
45784633 #define DSPFW_FBC_SR_SHIFT 28
45794634 #define DSPFW_FBC_SR_MASK (0x7<<28) /* g4x */
@@ -4589,7 +4644,7 @@ enum skl_disp_power_wells { · 9 unmodified lines
45894644 #define DSPFW_SPRITEA_SHIFT 0
45904645 #define DSPFW_SPRITEA_MASK (0x7f<<0) /* g4x */
45914646 #define DSPFW_SPRITEA_MASK_VLV (0xff<<0) /* vlv/chv */
4592−#define DSPFW3 (dev_priv->info.display_mmio_offset + 0x7003c)
4647+#define DSPFW3 _MMIO(dev_priv->info.display_mmio_offset + 0x7003c)
45934648 #define DSPFW_HPLL_SR_EN (1<<31)
45944649 #define PINEVIEW_SELF_REFRESH_EN (1<<30)
45954650 #define DSPFW_CURSOR_SR_SHIFT 24
@@ -4600,14 +4655,14 @@ enum skl_disp_power_wells { · 4 unmodified lines
46004655 #define DSPFW_HPLL_SR_MASK (0x1ff<<0)
46014656
46024657 /* vlv/chv */
4603−#define DSPFW4 (VLV_DISPLAY_BASE + 0x70070)
4658+#define DSPFW4 _MMIO(VLV_DISPLAY_BASE + 0x70070)
46044659 #define DSPFW_SPRITEB_WM1_SHIFT 16
46054660 #define DSPFW_SPRITEB_WM1_MASK (0xff<<16)
46064661 #define DSPFW_CURSORA_WM1_SHIFT 8
46074662 #define DSPFW_CURSORA_WM1_MASK (0x3f<<8)
46084663 #define DSPFW_SPRITEA_WM1_SHIFT 0
46094664 #define DSPFW_SPRITEA_WM1_MASK (0xff<<0)
4610−#define DSPFW5 (VLV_DISPLAY_BASE + 0x70074)
4665+#define DSPFW5 _MMIO(VLV_DISPLAY_BASE + 0x70074)
46114666 #define DSPFW_PLANEB_WM1_SHIFT 24
46124667 #define DSPFW_PLANEB_WM1_MASK (0xff<<24)
46134668 #define DSPFW_PLANEA_WM1_SHIFT 16
@@ -4616,11 +4671,11 @@ enum skl_disp_power_wells { · 2 unmodified lines
46164671 #define DSPFW_CURSORB_WM1_MASK (0x3f<<8)
46174672 #define DSPFW_CURSOR_SR_WM1_SHIFT 0
46184673 #define DSPFW_CURSOR_SR_WM1_MASK (0x3f<<0)
4619−#define DSPFW6 (VLV_DISPLAY_BASE + 0x70078)
4674+#define DSPFW6 _MMIO(VLV_DISPLAY_BASE + 0x70078)
46204675 #define DSPFW_SR_WM1_SHIFT 0
46214676 #define DSPFW_SR_WM1_MASK (0x1ff<<0)
4622−#define DSPFW7 (VLV_DISPLAY_BASE + 0x7007c)
4623−#define DSPFW7_CHV (VLV_DISPLAY_BASE + 0x700b4) /* wtf #1? */
4677+#define DSPFW7 _MMIO(VLV_DISPLAY_BASE + 0x7007c)
4678+#define DSPFW7_CHV _MMIO(VLV_DISPLAY_BASE + 0x700b4) /* wtf #1? */
46244679 #define DSPFW_SPRITED_WM1_SHIFT 24
46254680 #define DSPFW_SPRITED_WM1_MASK (0xff<<24)
46264681 #define DSPFW_SPRITED_SHIFT 16
@@ -4629,7 +4684,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
46294684 #define DSPFW_SPRITEC_WM1_MASK (0xff<<8)
46304685 #define DSPFW_SPRITEC_SHIFT 0
46314686 #define DSPFW_SPRITEC_MASK_VLV (0xff<<0)
4632−#define DSPFW8_CHV (VLV_DISPLAY_BASE + 0x700b8)
4687+#define DSPFW8_CHV _MMIO(VLV_DISPLAY_BASE + 0x700b8)
46334688 #define DSPFW_SPRITEF_WM1_SHIFT 24
46344689 #define DSPFW_SPRITEF_WM1_MASK (0xff<<24)
46354690 #define DSPFW_SPRITEF_SHIFT 16
@@ -4638,7 +4693,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
46384693 #define DSPFW_SPRITEE_WM1_MASK (0xff<<8)
46394694 #define DSPFW_SPRITEE_SHIFT 0
46404695 #define DSPFW_SPRITEE_MASK_VLV (0xff<<0)
4641−#define DSPFW9_CHV (VLV_DISPLAY_BASE + 0x7007c) /* wtf #2? */
4696+#define DSPFW9_CHV _MMIO(VLV_DISPLAY_BASE + 0x7007c) /* wtf #2? */
46424697 #define DSPFW_PLANEC_WM1_SHIFT 24
46434698 #define DSPFW_PLANEC_WM1_MASK (0xff<<24)
46444699 #define DSPFW_PLANEC_SHIFT 16
@@ -4649,7 +4704,7 @@ enum skl_disp_power_wells { · 4 unmodified lines
46494704 #define DSPFW_CURSORC_MASK (0x3f<<0)
46504705
46514706 /* vlv/chv high order bits */
4652−#define DSPHOWM (VLV_DISPLAY_BASE + 0x70064)
4707+#define DSPHOWM _MMIO(VLV_DISPLAY_BASE + 0x70064)
46534708 #define DSPFW_SR_HI_SHIFT 24
46544709 #define DSPFW_SR_HI_MASK (3<<24) /* 2 bits for chv, 1 for vlv */
46554710 #define DSPFW_SPRITEF_HI_SHIFT 23
@@ -4670,7 +4725,7 @@ enum skl_disp_power_wells { · 14 unmodified lines
46704725 #define DSPFW_SPRITEA_HI_MASK (1<<4)
46714726 #define DSPFW_PLANEA_HI_SHIFT 0
46724727 #define DSPFW_PLANEA_HI_MASK (1<<0)
4673−#define DSPHOWM1 (VLV_DISPLAY_BASE + 0x70068)
4728+#define DSPHOWM1 _MMIO(VLV_DISPLAY_BASE + 0x70068)
46744729 #define DSPFW_SR_WM1_HI_SHIFT 24
46754730 #define DSPFW_SR_WM1_HI_MASK (3<<24) /* 2 bits for chv, 1 for vlv */
46764731 #define DSPFW_SPRITEF_WM1_HI_SHIFT 23
@@ -4693,7 +4748,7 @@ enum skl_disp_power_wells { · 16 unmodified lines
46934748 #define DSPFW_PLANEA_WM1_HI_MASK (1<<0)
46944749
46954750 /* drain latency register values*/
4696−#define VLV_DDL(pipe) (VLV_DISPLAY_BASE + 0x70050 + 4 * (pipe))
4751+#define VLV_DDL(pipe) _MMIO(VLV_DISPLAY_BASE + 0x70050 + 4 * (pipe))
46974752 #define DDL_CURSOR_SHIFT 24
46984753 #define DDL_SPRITE_SHIFT(sprite) (8+8*(sprite))
46994754 #define DDL_PLANE_SHIFT 0
@@ -4701,7 +4756,7 @@ enum skl_disp_power_wells { · 1 unmodified line
47014756 #define DDL_PRECISION_LOW (0<<7)
47024757 #define DRAIN_LATENCY_MASK 0x7f
47034758
4704−#define CBR1_VLV (VLV_DISPLAY_BASE + 0x70400)
4759+#define CBR1_VLV _MMIO(VLV_DISPLAY_BASE + 0x70400)
47054760 #define CBR_PND_DEADLINE_DISABLE (1<<31)
47064761 #define CBR_PWM_CLOCK_MUX_SELECT (1<<30)
47074762
@@ -4739,51 +4794,51 @@ enum skl_disp_power_wells { · 31 unmodified lines
47394794 #define I965_CURSOR_DFT_WM 8
47404795
47414796 /* Watermark register definitions for SKL */
4742−#define CUR_WM_A_0 0x70140
4743−#define CUR_WM_B_0 0x71140
4744−#define PLANE_WM_1_A_0 0x70240
4745−#define PLANE_WM_1_B_0 0x71240
4746−#define PLANE_WM_2_A_0 0x70340
4747−#define PLANE_WM_2_B_0 0x71340
4748−#define PLANE_WM_TRANS_1_A_0 0x70268
4749−#define PLANE_WM_TRANS_1_B_0 0x71268
4750−#define PLANE_WM_TRANS_2_A_0 0x70368
4751−#define PLANE_WM_TRANS_2_B_0 0x71368
4752−#define CUR_WM_TRANS_A_0 0x70168
4753−#define CUR_WM_TRANS_B_0 0x71168
4797+#define _CUR_WM_A_0 0x70140
4798+#define _CUR_WM_B_0 0x71140
4799+#define _PLANE_WM_1_A_0 0x70240
4800+#define _PLANE_WM_1_B_0 0x71240
4801+#define _PLANE_WM_2_A_0 0x70340
4802+#define _PLANE_WM_2_B_0 0x71340
4803+#define _PLANE_WM_TRANS_1_A_0 0x70268
4804+#define _PLANE_WM_TRANS_1_B_0 0x71268
4805+#define _PLANE_WM_TRANS_2_A_0 0x70368
4806+#define _PLANE_WM_TRANS_2_B_0 0x71368
4807+#define _CUR_WM_TRANS_A_0 0x70168
4808+#define _CUR_WM_TRANS_B_0 0x71168
47544809 #define PLANE_WM_EN (1 << 31)
47554810 #define PLANE_WM_LINES_SHIFT 14
47564811 #define PLANE_WM_LINES_MASK 0x1f
47574812 #define PLANE_WM_BLOCKS_MASK 0x3ff
47584813
4759−#define CUR_WM_0(pipe) _PIPE(pipe, CUR_WM_A_0, CUR_WM_B_0)
4760−#define CUR_WM(pipe, level) (CUR_WM_0(pipe) + ((4) * (level)))
4761−#define CUR_WM_TRANS(pipe) _PIPE(pipe, CUR_WM_TRANS_A_0, CUR_WM_TRANS_B_0)
4814+#define _CUR_WM_0(pipe) _PIPE(pipe, _CUR_WM_A_0, _CUR_WM_B_0)
4815+#define CUR_WM(pipe, level) _MMIO(_CUR_WM_0(pipe) + ((4) * (level)))
4816+#define CUR_WM_TRANS(pipe) _MMIO_PIPE(pipe, _CUR_WM_TRANS_A_0, _CUR_WM_TRANS_B_0)
47624817
4763−#define _PLANE_WM_1(pipe) _PIPE(pipe, PLANE_WM_1_A_0, PLANE_WM_1_B_0)
4764−#define _PLANE_WM_2(pipe) _PIPE(pipe, PLANE_WM_2_A_0, PLANE_WM_2_B_0)
4818+#define _PLANE_WM_1(pipe) _PIPE(pipe, _PLANE_WM_1_A_0, _PLANE_WM_1_B_0)
4819+#define _PLANE_WM_2(pipe) _PIPE(pipe, _PLANE_WM_2_A_0, _PLANE_WM_2_B_0)
47654820 #define _PLANE_WM_BASE(pipe, plane) \
47664821 _PLANE(plane, _PLANE_WM_1(pipe), _PLANE_WM_2(pipe))
47674822 #define PLANE_WM(pipe, plane, level) \
4768− (_PLANE_WM_BASE(pipe, plane) + ((4) * (level)))
4823+ _MMIO(_PLANE_WM_BASE(pipe, plane) + ((4) * (level)))
47694824 #define _PLANE_WM_TRANS_1(pipe) \
4770− _PIPE(pipe, PLANE_WM_TRANS_1_A_0, PLANE_WM_TRANS_1_B_0)
4825+ _PIPE(pipe, _PLANE_WM_TRANS_1_A_0, _PLANE_WM_TRANS_1_B_0)
47714826 #define _PLANE_WM_TRANS_2(pipe) \
4772− _PIPE(pipe, PLANE_WM_TRANS_2_A_0, PLANE_WM_TRANS_2_B_0)
4827+ _PIPE(pipe, _PLANE_WM_TRANS_2_A_0, _PLANE_WM_TRANS_2_B_0)
47734828 #define PLANE_WM_TRANS(pipe, plane) \
4774− _PLANE(plane, _PLANE_WM_TRANS_1(pipe), _PLANE_WM_TRANS_2(pipe))
4829+ _MMIO(_PLANE(plane, _PLANE_WM_TRANS_1(pipe), _PLANE_WM_TRANS_2(pipe)))
47754830
47764831 /* define the Watermark register on Ironlake */
4777−#define WM0_PIPEA_ILK 0x45100
4832+#define WM0_PIPEA_ILK _MMIO(0x45100)
47784833 #define WM0_PIPE_PLANE_MASK (0xffff<<16)
47794834 #define WM0_PIPE_PLANE_SHIFT 16
47804835 #define WM0_PIPE_SPRITE_MASK (0xff<<8)
47814836 #define WM0_PIPE_SPRITE_SHIFT 8
47824837 #define WM0_PIPE_CURSOR_MASK (0xff)
47834838
4784−#define WM0_PIPEB_ILK 0x45104
4785−#define WM0_PIPEC_IVB 0x45200
4786−#define WM1_LP_ILK 0x45108
4839+#define WM0_PIPEB_ILK _MMIO(0x45104)
4840+#define WM0_PIPEC_IVB _MMIO(0x45200)
4841+#define WM1_LP_ILK _MMIO(0x45108)
47874842 #define WM1_LP_SR_EN (1<<31)
47884843 #define WM1_LP_LATENCY_SHIFT 24
47894844 #define WM1_LP_LATENCY_MASK (0x7f<<24)
@@ -4793,13 +4848,13 @@ enum skl_disp_power_wells { · 3 unmodified lines
47934848 #define WM1_LP_SR_MASK (0x7ff<<8)
47944849 #define WM1_LP_SR_SHIFT 8
47954850 #define WM1_LP_CURSOR_MASK (0xff)
4796−#define WM2_LP_ILK 0x4510c
4851+#define WM2_LP_ILK _MMIO(0x4510c)
47974852 #define WM2_LP_EN (1<<31)
4798−#define WM3_LP_ILK 0x45110
4853+#define WM3_LP_ILK _MMIO(0x45110)
47994854 #define WM3_LP_EN (1<<31)
4800−#define WM1S_LP_ILK 0x45120
4801−#define WM2S_LP_IVB 0x45124
4802−#define WM3S_LP_IVB 0x45128
4855+#define WM1S_LP_ILK _MMIO(0x45120)
4856+#define WM2S_LP_IVB _MMIO(0x45124)
4857+#define WM3S_LP_IVB _MMIO(0x45128)
48034858 #define WM1S_LP_EN (1<<31)
48044859
48054860 #define HSW_WM_LP_VAL(lat, fbc, pri, cur) \
@@ -4807,7 +4862,7 @@ enum skl_disp_power_wells { · 1 unmodified line
48074862 ((fbc) << WM1_LP_FBC_SHIFT) | ((pri) << WM1_LP_SR_SHIFT) | (cur))
48084863
48094864 /* Memory latency timer register */
4810−#define MLTR_ILK 0x11222
4865+#define MLTR_ILK _MMIO(0x11222)
48114866 #define MLTR_WM1_SHIFT 0
48124867 #define MLTR_WM2_SHIFT 8
48134868 /* the unit of memory self-refresh latency time is 0.5us */
@@ -4815,7 +4870,7 @@ enum skl_disp_power_wells { · 1 unmodified line
48154870
48164871
48174872 /* the address where we get all kinds of latency value */
4818−#define SSKPD 0x5d10
4873+#define SSKPD _MMIO(0x5d10)
48194874 #define SSKPD_WM_MASK 0x3f
48204875 #define SSKPD_WM0_SHIFT 0
48214876 #define SSKPD_WM1_SHIFT 8
@@ -4848,8 +4903,8 @@ enum skl_disp_power_wells { · 26 unmodified lines
48484903 /* GM45+ just has to be different */
48494904 #define _PIPEA_FRMCOUNT_G4X 0x70040
48504905 #define _PIPEA_FLIPCOUNT_G4X 0x70044
4851−#define PIPE_FRMCOUNT_G4X(pipe) _PIPE2(pipe, _PIPEA_FRMCOUNT_G4X)
4852−#define PIPE_FLIPCOUNT_G4X(pipe) _PIPE2(pipe, _PIPEA_FLIPCOUNT_G4X)
4906+#define PIPE_FRMCOUNT_G4X(pipe) _MMIO_PIPE2(pipe, _PIPEA_FRMCOUNT_G4X)
4907+#define PIPE_FLIPCOUNT_G4X(pipe) _MMIO_PIPE2(pipe, _PIPEA_FLIPCOUNT_G4X)
48534908
48544909 /* Cursor A & B regs */
48554910 #define _CURACNTR 0x70080
@@ -4887,7 +4942,7 @@ enum skl_disp_power_wells { · 31 unmodified lines
48874942 #define CURSOR_POS_SIGN 0x8000
48884943 #define CURSOR_X_SHIFT 0
48894944 #define CURSOR_Y_SHIFT 16
4890−#define CURSIZE 0x700a0
4945+#define CURSIZE _MMIO(0x700a0)
48914946 #define _CURBCNTR 0x700c0
48924947 #define _CURBBASE 0x700c4
48934948 #define _CURBPOS 0x700c8
@@ -4896,7 +4951,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
48964951 #define _CURBBASE_IVB 0x71084
48974952 #define _CURBPOS_IVB 0x71088
48984953
4899−#define _CURSOR2(pipe, reg) (dev_priv->info.cursor_offsets[(pipe)] - \
4954+#define _CURSOR2(pipe, reg) _MMIO(dev_priv->info.cursor_offsets[(pipe)] - \
49004955 dev_priv->info.cursor_offsets[PIPE_A] + (reg) + \
49014956 dev_priv->info.display_mmio_offset)
49024957
@@ -4957,16 +5012,16 @@ enum skl_disp_power_wells { · 54 unmodified lines
49575012 #define _DSPAOFFSET 0x701A4 /* HSW */
49585013 #define _DSPASURFLIVE 0x701AC
49595014
4960−#define DSPCNTR(plane) _PIPE2(plane, _DSPACNTR)
4961−#define DSPADDR(plane) _PIPE2(plane, _DSPAADDR)
4962−#define DSPSTRIDE(plane) _PIPE2(plane, _DSPASTRIDE)
4963−#define DSPPOS(plane) _PIPE2(plane, _DSPAPOS)
4964−#define DSPSIZE(plane) _PIPE2(plane, _DSPASIZE)
4965−#define DSPSURF(plane) _PIPE2(plane, _DSPASURF)
4966−#define DSPTILEOFF(plane) _PIPE2(plane, _DSPATILEOFF)
4967−#define DSPLINOFF(plane) DSPADDR(plane)
4968−#define DSPOFFSET(plane) _PIPE2(plane, _DSPAOFFSET)
4969−#define DSPSURFLIVE(plane) _PIPE2(plane, _DSPASURFLIVE)
5015+#define DSPCNTR(plane) _MMIO_PIPE2(plane, _DSPACNTR)
5016+#define DSPADDR(plane) _MMIO_PIPE2(plane, _DSPAADDR)
5017+#define DSPSTRIDE(plane) _MMIO_PIPE2(plane, _DSPASTRIDE)
5018+#define DSPPOS(plane) _MMIO_PIPE2(plane, _DSPAPOS)
5019+#define DSPSIZE(plane) _MMIO_PIPE2(plane, _DSPASIZE)
5020+#define DSPSURF(plane) _MMIO_PIPE2(plane, _DSPASURF)
5021+#define DSPTILEOFF(plane) _MMIO_PIPE2(plane, _DSPATILEOFF)
5022+#define DSPLINOFF(plane) DSPADDR(plane)
5023+#define DSPOFFSET(plane) _MMIO_PIPE2(plane, _DSPAOFFSET)
5024+#define DSPSURFLIVE(plane) _MMIO_PIPE2(plane, _DSPASURFLIVE)
49705025
49715026 /* CHV pipe B blender and primary plane */
49725027 #define _CHV_BLEND_A 0x60a00
@@ -4980,11 +5035,11 @@ enum skl_disp_power_wells { · 7 unmodified lines
49805035 #define _PRIMCNSTALPHA_A 0x60a10
49815036 #define PRIM_CONST_ALPHA_ENABLE (1<<31)
49825037
4983−#define CHV_BLEND(pipe) _TRANSCODER2(pipe, _CHV_BLEND_A)
4984−#define CHV_CANVAS(pipe) _TRANSCODER2(pipe, _CHV_CANVAS_A)
4985−#define PRIMPOS(plane) _TRANSCODER2(plane, _PRIMPOS_A)
4986−#define PRIMSIZE(plane) _TRANSCODER2(plane, _PRIMSIZE_A)
4987−#define PRIMCNSTALPHA(plane) _TRANSCODER2(plane, _PRIMCNSTALPHA_A)
5038+#define CHV_BLEND(pipe) _MMIO_TRANS2(pipe, _CHV_BLEND_A)
5039+#define CHV_CANVAS(pipe) _MMIO_TRANS2(pipe, _CHV_CANVAS_A)
5040+#define PRIMPOS(plane) _MMIO_TRANS2(plane, _PRIMPOS_A)
5041+#define PRIMSIZE(plane) _MMIO_TRANS2(plane, _PRIMSIZE_A)
5042+#define PRIMCNSTALPHA(plane) _MMIO_TRANS2(plane, _PRIMCNSTALPHA_A)
49885043
49895044 /* Display/Sprite base address macros */
49905045 #define DISP_BASEADDR_MASK (0xfffff000)
@@ -5002,9 +5057,10 @@ enum skl_disp_power_wells { · 11 unmodified lines
50025057 * [10:1f] all
50035058 * [30:32] all
50045059 */
5005−#define SWF0(i) (dev_priv->info.display_mmio_offset + 0x70410 + (i) * 4)
5006−#define SWF1(i) (dev_priv->info.display_mmio_offset + 0x71410 + (i) * 4)
5007−#define SWF3(i) (dev_priv->info.display_mmio_offset + 0x72414 + (i) * 4)
5060+#define SWF0(i) _MMIO(dev_priv->info.display_mmio_offset + 0x70410 + (i) * 4)
5061+#define SWF1(i) _MMIO(dev_priv->info.display_mmio_offset + 0x71410 + (i) * 4)
5062+#define SWF3(i) _MMIO(dev_priv->info.display_mmio_offset + 0x72414 + (i) * 4)
5063+#define SWF_ILK(i) _MMIO(0x4F000 + (i) * 4)
50085064
50095065 /* Pipe B */
50105066 #define _PIPEBDSL (dev_priv->info.display_mmio_offset + 0x71000)
@@ -5086,18 +5142,18 @@ enum skl_disp_power_wells { · 75 unmodified lines
50865142 #define _DVSBSCALE 0x73204
50875143 #define _DVSBGAMC 0x73300
50885144
5089−#define DVSCNTR(pipe) _PIPE(pipe, _DVSACNTR, _DVSBCNTR)
5090−#define DVSLINOFF(pipe) _PIPE(pipe, _DVSALINOFF, _DVSBLINOFF)
5091−#define DVSSTRIDE(pipe) _PIPE(pipe, _DVSASTRIDE, _DVSBSTRIDE)
5092−#define DVSPOS(pipe) _PIPE(pipe, _DVSAPOS, _DVSBPOS)
5093−#define DVSSURF(pipe) _PIPE(pipe, _DVSASURF, _DVSBSURF)
5094−#define DVSKEYMAX(pipe) _PIPE(pipe, _DVSAKEYMAXVAL, _DVSBKEYMAXVAL)
5095−#define DVSSIZE(pipe) _PIPE(pipe, _DVSASIZE, _DVSBSIZE)
5096−#define DVSSCALE(pipe) _PIPE(pipe, _DVSASCALE, _DVSBSCALE)
5097−#define DVSTILEOFF(pipe) _PIPE(pipe, _DVSATILEOFF, _DVSBTILEOFF)
5098−#define DVSKEYVAL(pipe) _PIPE(pipe, _DVSAKEYVAL, _DVSBKEYVAL)
5099−#define DVSKEYMSK(pipe) _PIPE(pipe, _DVSAKEYMSK, _DVSBKEYMSK)
5100−#define DVSSURFLIVE(pipe) _PIPE(pipe, _DVSASURFLIVE, _DVSBSURFLIVE)
5145+#define DVSCNTR(pipe) _MMIO_PIPE(pipe, _DVSACNTR, _DVSBCNTR)
5146+#define DVSLINOFF(pipe) _MMIO_PIPE(pipe, _DVSALINOFF, _DVSBLINOFF)
5147+#define DVSSTRIDE(pipe) _MMIO_PIPE(pipe, _DVSASTRIDE, _DVSBSTRIDE)
5148+#define DVSPOS(pipe) _MMIO_PIPE(pipe, _DVSAPOS, _DVSBPOS)
5149+#define DVSSURF(pipe) _MMIO_PIPE(pipe, _DVSASURF, _DVSBSURF)
5150+#define DVSKEYMAX(pipe) _MMIO_PIPE(pipe, _DVSAKEYMAXVAL, _DVSBKEYMAXVAL)
5151+#define DVSSIZE(pipe) _MMIO_PIPE(pipe, _DVSASIZE, _DVSBSIZE)
5152+#define DVSSCALE(pipe) _MMIO_PIPE(pipe, _DVSASCALE, _DVSBSCALE)
5153+#define DVSTILEOFF(pipe) _MMIO_PIPE(pipe, _DVSATILEOFF, _DVSBTILEOFF)
5154+#define DVSKEYVAL(pipe) _MMIO_PIPE(pipe, _DVSAKEYVAL, _DVSBKEYVAL)
5155+#define DVSKEYMSK(pipe) _MMIO_PIPE(pipe, _DVSAKEYMSK, _DVSBKEYMSK)
5156+#define DVSSURFLIVE(pipe) _MMIO_PIPE(pipe, _DVSASURFLIVE, _DVSBSURFLIVE)
51015157
51025158 #define _SPRA_CTL 0x70280
51035159 #define SPRITE_ENABLE (1<<31)
@@ -5160,20 +5216,20 @@ enum skl_disp_power_wells { · 56 unmodified lines
51605216 #define _SPRB_SCALE 0x71304
51615217 #define _SPRB_GAMC 0x71400
51625218
5163−#define SPRCTL(pipe) _PIPE(pipe, _SPRA_CTL, _SPRB_CTL)
5164−#define SPRLINOFF(pipe) _PIPE(pipe, _SPRA_LINOFF, _SPRB_LINOFF)
5165−#define SPRSTRIDE(pipe) _PIPE(pipe, _SPRA_STRIDE, _SPRB_STRIDE)
5166−#define SPRPOS(pipe) _PIPE(pipe, _SPRA_POS, _SPRB_POS)
5167−#define SPRSIZE(pipe) _PIPE(pipe, _SPRA_SIZE, _SPRB_SIZE)
5168−#define SPRKEYVAL(pipe) _PIPE(pipe, _SPRA_KEYVAL, _SPRB_KEYVAL)
5169−#define SPRKEYMSK(pipe) _PIPE(pipe, _SPRA_KEYMSK, _SPRB_KEYMSK)
5170−#define SPRSURF(pipe) _PIPE(pipe, _SPRA_SURF, _SPRB_SURF)
5171−#define SPRKEYMAX(pipe) _PIPE(pipe, _SPRA_KEYMAX, _SPRB_KEYMAX)
5172−#define SPRTILEOFF(pipe) _PIPE(pipe, _SPRA_TILEOFF, _SPRB_TILEOFF)
5173−#define SPROFFSET(pipe) _PIPE(pipe, _SPRA_OFFSET, _SPRB_OFFSET)
5174−#define SPRSCALE(pipe) _PIPE(pipe, _SPRA_SCALE, _SPRB_SCALE)
5175−#define SPRGAMC(pipe) _PIPE(pipe, _SPRA_GAMC, _SPRB_GAMC)
5176−#define SPRSURFLIVE(pipe) _PIPE(pipe, _SPRA_SURFLIVE, _SPRB_SURFLIVE)
5219+#define SPRCTL(pipe) _MMIO_PIPE(pipe, _SPRA_CTL, _SPRB_CTL)
5220+#define SPRLINOFF(pipe) _MMIO_PIPE(pipe, _SPRA_LINOFF, _SPRB_LINOFF)
5221+#define SPRSTRIDE(pipe) _MMIO_PIPE(pipe, _SPRA_STRIDE, _SPRB_STRIDE)
5222+#define SPRPOS(pipe) _MMIO_PIPE(pipe, _SPRA_POS, _SPRB_POS)
5223+#define SPRSIZE(pipe) _MMIO_PIPE(pipe, _SPRA_SIZE, _SPRB_SIZE)
5224+#define SPRKEYVAL(pipe) _MMIO_PIPE(pipe, _SPRA_KEYVAL, _SPRB_KEYVAL)
5225+#define SPRKEYMSK(pipe) _MMIO_PIPE(pipe, _SPRA_KEYMSK, _SPRB_KEYMSK)
5226+#define SPRSURF(pipe) _MMIO_PIPE(pipe, _SPRA_SURF, _SPRB_SURF)
5227+#define SPRKEYMAX(pipe) _MMIO_PIPE(pipe, _SPRA_KEYMAX, _SPRB_KEYMAX)
5228+#define SPRTILEOFF(pipe) _MMIO_PIPE(pipe, _SPRA_TILEOFF, _SPRB_TILEOFF)
5229+#define SPROFFSET(pipe) _MMIO_PIPE(pipe, _SPRA_OFFSET, _SPRB_OFFSET)
5230+#define SPRSCALE(pipe) _MMIO_PIPE(pipe, _SPRA_SCALE, _SPRB_SCALE)
5231+#define SPRGAMC(pipe) _MMIO_PIPE(pipe, _SPRA_GAMC, _SPRB_GAMC)
5232+#define SPRSURFLIVE(pipe) _MMIO_PIPE(pipe, _SPRA_SURFLIVE, _SPRB_SURFLIVE)
51775233
51785234 #define _SPACNTR (VLV_DISPLAY_BASE + 0x72180)
51795235 #define SP_ENABLE (1<<31)
@@ -5223,18 +5279,18 @@ enum skl_disp_power_wells { · 43 unmodified lines
52235279 #define _SPBCONSTALPHA (VLV_DISPLAY_BASE + 0x722a8)
52245280 #define _SPBGAMC (VLV_DISPLAY_BASE + 0x722f4)
52255281
5226−#define SPCNTR(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPACNTR, _SPBCNTR)
5227−#define SPLINOFF(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPALINOFF, _SPBLINOFF)
5228−#define SPSTRIDE(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPASTRIDE, _SPBSTRIDE)
5229−#define SPPOS(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPAPOS, _SPBPOS)
5230−#define SPSIZE(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPASIZE, _SPBSIZE)
5231−#define SPKEYMINVAL(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPAKEYMINVAL, _SPBKEYMINVAL)
5232−#define SPKEYMSK(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPAKEYMSK, _SPBKEYMSK)
5233−#define SPSURF(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPASURF, _SPBSURF)
5234−#define SPKEYMAXVAL(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPAKEYMAXVAL, _SPBKEYMAXVAL)
5235−#define SPTILEOFF(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPATILEOFF, _SPBTILEOFF)
5236−#define SPCONSTALPHA(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPACONSTALPHA, _SPBCONSTALPHA)
5237−#define SPGAMC(pipe, plane) _PIPE((pipe) * 2 + (plane), _SPAGAMC, _SPBGAMC)
5282+#define SPCNTR(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPACNTR, _SPBCNTR)
5283+#define SPLINOFF(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPALINOFF, _SPBLINOFF)
5284+#define SPSTRIDE(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPASTRIDE, _SPBSTRIDE)
5285+#define SPPOS(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPAPOS, _SPBPOS)
5286+#define SPSIZE(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPASIZE, _SPBSIZE)
5287+#define SPKEYMINVAL(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPAKEYMINVAL, _SPBKEYMINVAL)
5288+#define SPKEYMSK(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPAKEYMSK, _SPBKEYMSK)
5289+#define SPSURF(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPASURF, _SPBSURF)
5290+#define SPKEYMAXVAL(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPAKEYMAXVAL, _SPBKEYMAXVAL)
5291+#define SPTILEOFF(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPATILEOFF, _SPBTILEOFF)
5292+#define SPCONSTALPHA(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPACONSTALPHA, _SPBCONSTALPHA)
5293+#define SPGAMC(pipe, plane) _MMIO_PIPE((pipe) * 2 + (plane), _SPAGAMC, _SPBGAMC)
52385294
52395295 /*
52405296 * CHV pipe B sprite CSC
@@ -5243,29 +5299,29 @@ enum skl_disp_power_wells { · 2 unmodified lines
52435299 * |yg| = |c3 c4 c5| x |yg + yg_ioff| + |yg_ooff|
52445300 * |cb| |c6 c7 c8| |cb + cr_ioff| |cb_ooff|
52455301 */
5246−#define SPCSCYGOFF(sprite) (VLV_DISPLAY_BASE + 0x6d900 + (sprite) * 0x1000)
5247−#define SPCSCCBOFF(sprite) (VLV_DISPLAY_BASE + 0x6d904 + (sprite) * 0x1000)
5248−#define SPCSCCROFF(sprite) (VLV_DISPLAY_BASE + 0x6d908 + (sprite) * 0x1000)
5302+#define SPCSCYGOFF(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d900 + (sprite) * 0x1000)
5303+#define SPCSCCBOFF(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d904 + (sprite) * 0x1000)
5304+#define SPCSCCROFF(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d908 + (sprite) * 0x1000)
52495305 #define SPCSC_OOFF(x) (((x) & 0x7ff) << 16) /* s11 */
52505306 #define SPCSC_IOFF(x) (((x) & 0x7ff) << 0) /* s11 */
52515307
5252−#define SPCSCC01(sprite) (VLV_DISPLAY_BASE + 0x6d90c + (sprite) * 0x1000)
5253−#define SPCSCC23(sprite) (VLV_DISPLAY_BASE + 0x6d910 + (sprite) * 0x1000)
5254−#define SPCSCC45(sprite) (VLV_DISPLAY_BASE + 0x6d914 + (sprite) * 0x1000)
5255−#define SPCSCC67(sprite) (VLV_DISPLAY_BASE + 0x6d918 + (sprite) * 0x1000)
5256−#define SPCSCC8(sprite) (VLV_DISPLAY_BASE + 0x6d91c + (sprite) * 0x1000)
5308+#define SPCSCC01(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d90c + (sprite) * 0x1000)
5309+#define SPCSCC23(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d910 + (sprite) * 0x1000)
5310+#define SPCSCC45(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d914 + (sprite) * 0x1000)
5311+#define SPCSCC67(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d918 + (sprite) * 0x1000)
5312+#define SPCSCC8(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d91c + (sprite) * 0x1000)
52575313 #define SPCSC_C1(x) (((x) & 0x7fff) << 16) /* s3.12 */
52585314 #define SPCSC_C0(x) (((x) & 0x7fff) << 0) /* s3.12 */
52595315
5260−#define SPCSCYGICLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d920 + (sprite) * 0x1000)
5261−#define SPCSCCBICLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d924 + (sprite) * 0x1000)
5262−#define SPCSCCRICLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d928 + (sprite) * 0x1000)
5316+#define SPCSCYGICLAMP(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d920 + (sprite) * 0x1000)
5317+#define SPCSCCBICLAMP(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d924 + (sprite) * 0x1000)
5318+#define SPCSCCRICLAMP(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d928 + (sprite) * 0x1000)
52635319 #define SPCSC_IMAX(x) (((x) & 0x7ff) << 16) /* s11 */
52645320 #define SPCSC_IMIN(x) (((x) & 0x7ff) << 0) /* s11 */
52655321
5266−#define SPCSCYGOCLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d92c + (sprite) * 0x1000)
5267−#define SPCSCCBOCLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d930 + (sprite) * 0x1000)
5268−#define SPCSCCROCLAMP(sprite) (VLV_DISPLAY_BASE + 0x6d934 + (sprite) * 0x1000)
5322+#define SPCSCYGOCLAMP(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d92c + (sprite) * 0x1000)
5323+#define SPCSCCBOCLAMP(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d930 + (sprite) * 0x1000)
5324+#define SPCSCCROCLAMP(sprite) _MMIO(VLV_DISPLAY_BASE + 0x6d934 + (sprite) * 0x1000)
52695325 #define SPCSC_OMAX(x) ((x) << 16) /* u10 */
52705326 #define SPCSC_OMIN(x) ((x) << 0) /* u10 */
52715327
@@ -5346,7 +5402,7 @@ enum skl_disp_power_wells { · 74 unmodified lines
53465402 #define _PLANE_CTL_2(pipe) _PIPE(pipe, _PLANE_CTL_2_A, _PLANE_CTL_2_B)
53475403 #define _PLANE_CTL_3(pipe) _PIPE(pipe, _PLANE_CTL_3_A, _PLANE_CTL_3_B)
53485404 #define PLANE_CTL(pipe, plane) \
5349− _PLANE(plane, _PLANE_CTL_1(pipe), _PLANE_CTL_2(pipe))
5405+ _MMIO_PLANE(plane, _PLANE_CTL_1(pipe), _PLANE_CTL_2(pipe))
53505406
53515407 #define _PLANE_STRIDE_1_B 0x71188
53525408 #define _PLANE_STRIDE_2_B 0x71288
@@ -5358,7 +5414,7 @@ enum skl_disp_power_wells { · 5 unmodified lines
53585414 #define _PLANE_STRIDE_3(pipe) \
53595415 _PIPE(pipe, _PLANE_STRIDE_3_A, _PLANE_STRIDE_3_B)
53605416 #define PLANE_STRIDE(pipe, plane) \
5361− _PLANE(plane, _PLANE_STRIDE_1(pipe), _PLANE_STRIDE_2(pipe))
5417+ _MMIO_PLANE(plane, _PLANE_STRIDE_1(pipe), _PLANE_STRIDE_2(pipe))
53625418
53635419 #define _PLANE_POS_1_B 0x7118c
53645420 #define _PLANE_POS_2_B 0x7128c
@@ -5367,7 +5423,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
53675423 #define _PLANE_POS_2(pipe) _PIPE(pipe, _PLANE_POS_2_A, _PLANE_POS_2_B)
53685424 #define _PLANE_POS_3(pipe) _PIPE(pipe, _PLANE_POS_3_A, _PLANE_POS_3_B)
53695425 #define PLANE_POS(pipe, plane) \
5370− _PLANE(plane, _PLANE_POS_1(pipe), _PLANE_POS_2(pipe))
5426+ _MMIO_PLANE(plane, _PLANE_POS_1(pipe), _PLANE_POS_2(pipe))
53715427
53725428 #define _PLANE_SIZE_1_B 0x71190
53735429 #define _PLANE_SIZE_2_B 0x71290
@@ -5376,7 +5432,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
53765432 #define _PLANE_SIZE_2(pipe) _PIPE(pipe, _PLANE_SIZE_2_A, _PLANE_SIZE_2_B)
53775433 #define _PLANE_SIZE_3(pipe) _PIPE(pipe, _PLANE_SIZE_3_A, _PLANE_SIZE_3_B)
53785434 #define PLANE_SIZE(pipe, plane) \
5379− _PLANE(plane, _PLANE_SIZE_1(pipe), _PLANE_SIZE_2(pipe))
5435+ _MMIO_PLANE(plane, _PLANE_SIZE_1(pipe), _PLANE_SIZE_2(pipe))
53805436
53815437 #define _PLANE_SURF_1_B 0x7119c
53825438 #define _PLANE_SURF_2_B 0x7129c
@@ -5385,35 +5441,35 @@ enum skl_disp_power_wells { · 2 unmodified lines
53855441 #define _PLANE_SURF_2(pipe) _PIPE(pipe, _PLANE_SURF_2_A, _PLANE_SURF_2_B)
53865442 #define _PLANE_SURF_3(pipe) _PIPE(pipe, _PLANE_SURF_3_A, _PLANE_SURF_3_B)
53875443 #define PLANE_SURF(pipe, plane) \
5388− _PLANE(plane, _PLANE_SURF_1(pipe), _PLANE_SURF_2(pipe))
5444+ _MMIO_PLANE(plane, _PLANE_SURF_1(pipe), _PLANE_SURF_2(pipe))
53895445
53905446 #define _PLANE_OFFSET_1_B 0x711a4
53915447 #define _PLANE_OFFSET_2_B 0x712a4
53925448 #define _PLANE_OFFSET_1(pipe) _PIPE(pipe, _PLANE_OFFSET_1_A, _PLANE_OFFSET_1_B)
53935449 #define _PLANE_OFFSET_2(pipe) _PIPE(pipe, _PLANE_OFFSET_2_A, _PLANE_OFFSET_2_B)
53945450 #define PLANE_OFFSET(pipe, plane) \
5395− _PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe))
5451+ _MMIO_PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe))
53965452
53975453 #define _PLANE_KEYVAL_1_B 0x71194
53985454 #define _PLANE_KEYVAL_2_B 0x71294
53995455 #define _PLANE_KEYVAL_1(pipe) _PIPE(pipe, _PLANE_KEYVAL_1_A, _PLANE_KEYVAL_1_B)
54005456 #define _PLANE_KEYVAL_2(pipe) _PIPE(pipe, _PLANE_KEYVAL_2_A, _PLANE_KEYVAL_2_B)
54015457 #define PLANE_KEYVAL(pipe, plane) \
5402− _PLANE(plane, _PLANE_KEYVAL_1(pipe), _PLANE_KEYVAL_2(pipe))
5458+ _MMIO_PLANE(plane, _PLANE_KEYVAL_1(pipe), _PLANE_KEYVAL_2(pipe))
54035459
54045460 #define _PLANE_KEYMSK_1_B 0x71198
54055461 #define _PLANE_KEYMSK_2_B 0x71298
54065462 #define _PLANE_KEYMSK_1(pipe) _PIPE(pipe, _PLANE_KEYMSK_1_A, _PLANE_KEYMSK_1_B)
54075463 #define _PLANE_KEYMSK_2(pipe) _PIPE(pipe, _PLANE_KEYMSK_2_A, _PLANE_KEYMSK_2_B)
54085464 #define PLANE_KEYMSK(pipe, plane) \
5409− _PLANE(plane, _PLANE_KEYMSK_1(pipe), _PLANE_KEYMSK_2(pipe))
5465+ _MMIO_PLANE(plane, _PLANE_KEYMSK_1(pipe), _PLANE_KEYMSK_2(pipe))
54105466
54115467 #define _PLANE_KEYMAX_1_B 0x711a0
54125468 #define _PLANE_KEYMAX_2_B 0x712a0
54135469 #define _PLANE_KEYMAX_1(pipe) _PIPE(pipe, _PLANE_KEYMAX_1_A, _PLANE_KEYMAX_1_B)
54145470 #define _PLANE_KEYMAX_2(pipe) _PIPE(pipe, _PLANE_KEYMAX_2_A, _PLANE_KEYMAX_2_B)
54155471 #define PLANE_KEYMAX(pipe, plane) \
5416− _PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe))
5472+ _MMIO_PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe))
54175473
54185474 #define _PLANE_BUF_CFG_1_B 0x7127c
54195475 #define _PLANE_BUF_CFG_2_B 0x7137c
@@ -5422,7 +5478,7 @@ enum skl_disp_power_wells { · 2 unmodified lines
54225478 #define _PLANE_BUF_CFG_2(pipe) \
54235479 _PIPE(pipe, _PLANE_BUF_CFG_2_A, _PLANE_BUF_CFG_2_B)
54245480 #define PLANE_BUF_CFG(pipe, plane) \
5425− _PLANE(plane, _PLANE_BUF_CFG_1(pipe), _PLANE_BUF_CFG_2(pipe))
5481+ _MMIO_PLANE(plane, _PLANE_BUF_CFG_1(pipe), _PLANE_BUF_CFG_2(pipe))
54265482
54275483 #define _PLANE_NV12_BUF_CFG_1_B 0x71278
54285484 #define _PLANE_NV12_BUF_CFG_2_B 0x71378
@@ -5431,26 +5487,26 @@ enum skl_disp_power_wells { · 2 unmodified lines
54315487 #define _PLANE_NV12_BUF_CFG_2(pipe) \
54325488 _PIPE(pipe, _PLANE_NV12_BUF_CFG_2_A, _PLANE_NV12_BUF_CFG_2_B)
54335489 #define PLANE_NV12_BUF_CFG(pipe, plane) \
5434− _PLANE(plane, _PLANE_NV12_BUF_CFG_1(pipe), _PLANE_NV12_BUF_CFG_2(pipe))
5490+ _MMIO_PLANE(plane, _PLANE_NV12_BUF_CFG_1(pipe), _PLANE_NV12_BUF_CFG_2(pipe))
54355491
54365492 /* SKL new cursor registers */
54375493 #define _CUR_BUF_CFG_A 0x7017c
54385494 #define _CUR_BUF_CFG_B 0x7117c
5439−#define CUR_BUF_CFG(pipe) _PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B)
5495+#define CUR_BUF_CFG(pipe) _MMIO_PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B)
54405496
54415497 /* VBIOS regs */
5442−#define VGACNTRL 0x71400
5498+#define VGACNTRL _MMIO(0x71400)
54435499 # define VGA_DISP_DISABLE (1 << 31)
54445500 # define VGA_2X_MODE (1 << 30)
54455501 # define VGA_PIPE_B_SELECT (1 << 29)
54465502
5447−#define VLV_VGACNTRL (VLV_DISPLAY_BASE + 0x71400)
5503+#define VLV_VGACNTRL _MMIO(VLV_DISPLAY_BASE + 0x71400)
54485504
54495505 /* Ironlake */
54505506
5451−#define CPU_VGACNTRL 0x41000
5507+#define CPU_VGACNTRL _MMIO(0x41000)
54525508
5453−#define DIGITAL_PORT_HOTPLUG_CNTRL 0x44030
5509+#define DIGITAL_PORT_HOTPLUG_CNTRL _MMIO(0x44030)
54545510 #define DIGITAL_PORTA_HOTPLUG_ENABLE (1 << 4)
54555511 #define DIGITAL_PORTA_PULSE_DURATION_2ms (0 << 2) /* pre-HSW */
54565512 #define DIGITAL_PORTA_PULSE_DURATION_4_5ms (1 << 2) /* pre-HSW */
@@ -5463,26 +5519,26 @@ enum skl_disp_power_wells { · 6 unmodified lines
54635519 #define DIGITAL_PORTA_HOTPLUG_LONG_DETECT (2 << 0)
54645520
54655521 /* refresh rate hardware control */
5466−#define RR_HW_CTL 0x45300
5522+#define RR_HW_CTL _MMIO(0x45300)
54675523 #define RR_HW_LOW_POWER_FRAMES_MASK 0xff
54685524 #define RR_HW_HIGH_POWER_FRAMES_MASK 0xff00
54695525
5470−#define FDI_PLL_BIOS_0 0x46000
5526+#define FDI_PLL_BIOS_0 _MMIO(0x46000)
54715527 #define FDI_PLL_FB_CLOCK_MASK 0xff
5472−#define FDI_PLL_BIOS_1 0x46004
5473−#define FDI_PLL_BIOS_2 0x46008
5474−#define DISPLAY_PORT_PLL_BIOS_0 0x4600c
5475−#define DISPLAY_PORT_PLL_BIOS_1 0x46010
5476−#define DISPLAY_PORT_PLL_BIOS_2 0x46014
5528+#define FDI_PLL_BIOS_1 _MMIO(0x46004)
5529+#define FDI_PLL_BIOS_2 _MMIO(0x46008)
5530+#define DISPLAY_PORT_PLL_BIOS_0 _MMIO(0x4600c)
5531+#define DISPLAY_PORT_PLL_BIOS_1 _MMIO(0x46010)
5532+#define DISPLAY_PORT_PLL_BIOS_2 _MMIO(0x46014)
54775533
5478−#define PCH_3DCGDIS0 0x46020
5534+#define PCH_3DCGDIS0 _MMIO(0x46020)
54795535 # define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18)
54805536 # define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1)
54815537
5482−#define PCH_3DCGDIS1 0x46024
5538+#define PCH_3DCGDIS1 _MMIO(0x46024)
54835539 # define VFMUNIT_CLOCK_GATE_DISABLE (1 << 11)
54845540
5485−#define FDI_PLL_FREQ_CTL 0x46030
5541+#define FDI_PLL_FREQ_CTL _MMIO(0x46030)
54865542 #define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24)
54875543 #define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
54885544 #define FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK 0xff
@@ -5519,14 +5575,14 @@ enum skl_disp_power_wells { · 30 unmodified lines
55195575 #define _PIPEB_LINK_M2 0x61048
55205576 #define _PIPEB_LINK_N2 0x6104c
55215577
5522−#define PIPE_DATA_M1(tran) _TRANSCODER2(tran, _PIPEA_DATA_M1)
5523−#define PIPE_DATA_N1(tran) _TRANSCODER2(tran, _PIPEA_DATA_N1)
5524−#define PIPE_DATA_M2(tran) _TRANSCODER2(tran, _PIPEA_DATA_M2)
5525−#define PIPE_DATA_N2(tran) _TRANSCODER2(tran, _PIPEA_DATA_N2)
5526−#define PIPE_LINK_M1(tran) _TRANSCODER2(tran, _PIPEA_LINK_M1)
5527−#define PIPE_LINK_N1(tran) _TRANSCODER2(tran, _PIPEA_LINK_N1)
5528−#define PIPE_LINK_M2(tran) _TRANSCODER2(tran, _PIPEA_LINK_M2)
5529−#define PIPE_LINK_N2(tran) _TRANSCODER2(tran, _PIPEA_LINK_N2)
5578+#define PIPE_DATA_M1(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_M1)
5579+#define PIPE_DATA_N1(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_N1)
5580+#define PIPE_DATA_M2(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_M2)
5581+#define PIPE_DATA_N2(tran) _MMIO_TRANS2(tran, _PIPEA_DATA_N2)
5582+#define PIPE_LINK_M1(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_M1)
5583+#define PIPE_LINK_N1(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_N1)
5584+#define PIPE_LINK_M2(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_M2)
5585+#define PIPE_LINK_N2(tran) _MMIO_TRANS2(tran, _PIPEA_LINK_N2)
55305586
55315587 /* CPU panel fitter */
55325588 /* IVB+ has 3 fitters, 0 is 7x5 capable, the other two only 3x3 */
@@ -5549,11 +5605,11 @@ enum skl_disp_power_wells { · 16 unmodified lines
55495605 #define _PFA_HSCALE 0x68090
55505606 #define _PFB_HSCALE 0x68890
55515607
5552−#define PF_CTL(pipe) _PIPE(pipe, _PFA_CTL_1, _PFB_CTL_1)
5553−#define PF_WIN_SZ(pipe) _PIPE(pipe, _PFA_WIN_SZ, _PFB_WIN_SZ)
5554−#define PF_WIN_POS(pipe) _PIPE(pipe, _PFA_WIN_POS, _PFB_WIN_POS)
5555−#define PF_VSCALE(pipe) _PIPE(pipe, _PFA_VSCALE, _PFB_VSCALE)
5556−#define PF_HSCALE(pipe) _PIPE(pipe, _PFA_HSCALE, _PFB_HSCALE)
5608+#define PF_CTL(pipe) _MMIO_PIPE(pipe, _PFA_CTL_1, _PFB_CTL_1)
5609+#define PF_WIN_SZ(pipe) _MMIO_PIPE(pipe, _PFA_WIN_SZ, _PFB_WIN_SZ)
5610+#define PF_WIN_POS(pipe) _MMIO_PIPE(pipe, _PFA_WIN_POS, _PFB_WIN_POS)
5611+#define PF_VSCALE(pipe) _MMIO_PIPE(pipe, _PFA_VSCALE, _PFB_VSCALE)
5612+#define PF_HSCALE(pipe) _MMIO_PIPE(pipe, _PFA_HSCALE, _PFB_HSCALE)
55575613
55585614 #define _PSA_CTL 0x68180
55595615 #define _PSB_CTL 0x68980
@@ -5563,9 +5619,9 @@ enum skl_disp_power_wells { · 3 unmodified lines
55635619 #define _PSA_WIN_POS 0x68170
55645620 #define _PSB_WIN_POS 0x68970
55655621
5566−#define PS_CTL(pipe) _PIPE(pipe, _PSA_CTL, _PSB_CTL)
5567−#define PS_WIN_SZ(pipe) _PIPE(pipe, _PSA_WIN_SZ, _PSB_WIN_SZ)
5568−#define PS_WIN_POS(pipe) _PIPE(pipe, _PSA_WIN_POS, _PSB_WIN_POS)
5622+#define PS_CTL(pipe) _MMIO_PIPE(pipe, _PSA_CTL, _PSB_CTL)
5623+#define PS_WIN_SZ(pipe) _MMIO_PIPE(pipe, _PSA_WIN_SZ, _PSB_WIN_SZ)
5624+#define PS_WIN_POS(pipe) _MMIO_PIPE(pipe, _PSA_WIN_POS, _PSB_WIN_POS)
55695625
55705626 /*
55715627 * Skylake scalers
@@ -5654,48 +5710,63 @@ enum skl_disp_power_wells { · 82 unmodified lines
56545710 #define _PS_ECC_STAT_1C 0x691D0
56555711
56565712 #define _ID(id, a, b) ((a) + (id)*((b)-(a)))
5657−#define SKL_PS_CTRL(pipe, id) _PIPE(pipe, \
5713+#define SKL_PS_CTRL(pipe, id) _MMIO_PIPE(pipe, \
56585714 _ID(id, _PS_1A_CTRL, _PS_2A_CTRL), \
56595715 _ID(id, _PS_1B_CTRL, _PS_2B_CTRL))
5660−#define SKL_PS_PWR_GATE(pipe, id) _PIPE(pipe, \
5716+#define SKL_PS_PWR_GATE(pipe, id) _MMIO_PIPE(pipe, \
56615717 _ID(id, _PS_PWR_GATE_1A, _PS_PWR_GATE_2A), \
56625718 _ID(id, _PS_PWR_GATE_1B, _PS_PWR_GATE_2B))
5663−#define SKL_PS_WIN_POS(pipe, id) _PIPE(pipe, \
5719+#define SKL_PS_WIN_POS(pipe, id) _MMIO_PIPE(pipe, \
56645720 _ID(id, _PS_WIN_POS_1A, _PS_WIN_POS_2A), \
56655721 _ID(id, _PS_WIN_POS_1B, _PS_WIN_POS_2B))
5666−#define SKL_PS_WIN_SZ(pipe, id) _PIPE(pipe, \
5722+#define SKL_PS_WIN_SZ(pipe, id) _MMIO_PIPE(pipe, \
56675723 _ID(id, _PS_WIN_SZ_1A, _PS_WIN_SZ_2A), \
56685724 _ID(id, _PS_WIN_SZ_1B, _PS_WIN_SZ_2B))
5669−#define SKL_PS_VSCALE(pipe, id) _PIPE(pipe, \
5725+#define SKL_PS_VSCALE(pipe, id) _MMIO_PIPE(pipe, \
56705726 _ID(id, _PS_VSCALE_1A, _PS_VSCALE_2A), \
56715727 _ID(id, _PS_VSCALE_1B, _PS_VSCALE_2B))
5672−#define SKL_PS_HSCALE(pipe, id) _PIPE(pipe, \
5728+#define SKL_PS_HSCALE(pipe, id) _MMIO_PIPE(pipe, \
56735729 _ID(id, _PS_HSCALE_1A, _PS_HSCALE_2A), \
56745730 _ID(id, _PS_HSCALE_1B, _PS_HSCALE_2B))
5675−#define SKL_PS_VPHASE(pipe, id) _PIPE(pipe, \
5731+#define SKL_PS_VPHASE(pipe, id) _MMIO_PIPE(pipe, \
56765732 _ID(id, _PS_VPHASE_1A, _PS_VPHASE_2A), \
56775733 _ID(id, _PS_VPHASE_1B, _PS_VPHASE_2B))
5678−#define SKL_PS_HPHASE(pipe, id) _PIPE(pipe, \
5734+#define SKL_PS_HPHASE(pipe, id) _MMIO_PIPE(pipe, \
56795735 _ID(id, _PS_HPHASE_1A, _PS_HPHASE_2A), \
56805736 _ID(id, _PS_HPHASE_1B, _PS_HPHASE_2B))
5681−#define SKL_PS_ECC_STAT(pipe, id) _PIPE(pipe, \
5737+#define SKL_PS_ECC_STAT(pipe, id) _MMIO_PIPE(pipe, \
56825738 _ID(id, _PS_ECC_STAT_1A, _PS_ECC_STAT_2A), \
5683− _ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B)
5739+ _ID(id, _PS_ECC_STAT_1B, _PS_ECC_STAT_2B))
56845740
56855741 /* legacy palette */
56865742 #define _LGC_PALETTE_A 0x4a000
56875743 #define _LGC_PALETTE_B 0x4a800
5688−#define LGC_PALETTE(pipe, i) (_PIPE(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B) + (i) * 4)
5744+#define LGC_PALETTE(pipe, i) _MMIO(_PIPE(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B) + (i) * 4)
56895745
56905746 #define _GAMMA_MODE_A 0x4a480
56915747 #define _GAMMA_MODE_B 0x4ac80
5692−#define GAMMA_MODE(pipe) _PIPE(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B)
5748+#define GAMMA_MODE(pipe) _MMIO_PIPE(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B)
56935749 #define GAMMA_MODE_MODE_MASK (3 << 0)
56945750 #define GAMMA_MODE_MODE_8BIT (0 << 0)
56955751 #define GAMMA_MODE_MODE_10BIT (1 << 0)
56965752 #define GAMMA_MODE_MODE_12BIT (2 << 0)
56975753 #define GAMMA_MODE_MODE_SPLIT (3 << 0)
56985754
5755+/* DMC/CSR */
5756+#define CSR_PROGRAM(i) _MMIO(0x80000 + (i) * 4)
5757+#define CSR_SSP_BASE_ADDR_GEN9 0x00002FC0
5758+#define CSR_HTP_ADDR_SKL 0x00500034
5759+#define CSR_SSP_BASE _MMIO(0x8F074)
5760+#define CSR_HTP_SKL _MMIO(0x8F004)
5761+#define CSR_LAST_WRITE _MMIO(0x8F034)
5762+#define CSR_LAST_WRITE_VALUE 0xc003b400
5763+/* MMIO address range for CSR program (0x80000 - 0x82FFF) */
5764+#define CSR_MMIO_START_RANGE 0x80000
5765+#define CSR_MMIO_END_RANGE 0x8FFFF
5766+#define SKL_CSR_DC3_DC5_COUNT _MMIO(0x80030)
5767+#define SKL_CSR_DC5_DC6_COUNT _MMIO(0x8002C)
5768+#define BXT_CSR_DC3_DC5_COUNT _MMIO(0x80038)
5769+
56995770 /* interrupts */
57005771 #define DE_MASTER_IRQ_CONTROL (1 << 31)
57015772 #define DE_SPRITEB_FLIP_DONE (1 << 29)
@@ -5747,20 +5818,20 @@ enum skl_disp_power_wells { · 45 unmodified lines
57475818 #define DE_PIPEA_VBLANK_IVB (1<<0)
57485819 #define DE_PIPE_VBLANK_IVB(pipe) (1 << ((pipe) * 5))
57495820
5750−#define VLV_MASTER_IER 0x4400c /* Gunit master IER */
5821+#define VLV_MASTER_IER _MMIO(0x4400c) /* Gunit master IER */
57515822 #define MASTER_INTERRUPT_ENABLE (1<<31)
57525823
5753−#define DEISR 0x44000
5754−#define DEIMR 0x44004
5755−#define DEIIR 0x44008
5756−#define DEIER 0x4400c
5824+#define DEISR _MMIO(0x44000)
5825+#define DEIMR _MMIO(0x44004)
5826+#define DEIIR _MMIO(0x44008)
5827+#define DEIER _MMIO(0x4400c)
57575828
5758−#define GTISR 0x44010
5759−#define GTIMR 0x44014
5760−#define GTIIR 0x44018
5761−#define GTIER 0x4401c
5829+#define GTISR _MMIO(0x44010)
5830+#define GTIMR _MMIO(0x44014)
5831+#define GTIIR _MMIO(0x44018)
5832+#define GTIER _MMIO(0x4401c)
57625833
5763−#define GEN8_MASTER_IRQ 0x44200
5834+#define GEN8_MASTER_IRQ _MMIO(0x44200)
57645835 #define GEN8_MASTER_IRQ_CONTROL (1<<31)
57655836 #define GEN8_PCU_IRQ (1<<30)
57665837 #define GEN8_DE_PCH_IRQ (1<<23)
@@ -5777,10 +5848,10 @@ enum skl_disp_power_wells { · 10 unmodified lines
57775848 #define GEN8_GT_BCS_IRQ (1<<1)
57785849 #define GEN8_GT_RCS_IRQ (1<<0)
57795850
5780−#define GEN8_GT_ISR(which) (0x44300 + (0x10 * (which)))
5781−#define GEN8_GT_IMR(which) (0x44304 + (0x10 * (which)))
5782−#define GEN8_GT_IIR(which) (0x44308 + (0x10 * (which)))
5783−#define GEN8_GT_IER(which) (0x4430c + (0x10 * (which)))
5851+#define GEN8_GT_ISR(which) _MMIO(0x44300 + (0x10 * (which)))
5852+#define GEN8_GT_IMR(which) _MMIO(0x44304 + (0x10 * (which)))
5853+#define GEN8_GT_IIR(which) _MMIO(0x44308 + (0x10 * (which)))
5854+#define GEN8_GT_IER(which) _MMIO(0x4430c + (0x10 * (which)))
57845855
57855856 #define GEN8_RCS_IRQ_SHIFT 0
57865857 #define GEN8_BCS_IRQ_SHIFT 16
@@ -5789,10 +5860,10 @@ enum skl_disp_power_wells { · 2 unmodified lines
57895860 #define GEN8_VECS_IRQ_SHIFT 0
57905861 #define GEN8_WD_IRQ_SHIFT 16
57915862
5792−#define GEN8_DE_PIPE_ISR(pipe) (0x44400 + (0x10 * (pipe)))
5793−#define GEN8_DE_PIPE_IMR(pipe) (0x44404 + (0x10 * (pipe)))
5794−#define GEN8_DE_PIPE_IIR(pipe) (0x44408 + (0x10 * (pipe)))
5795−#define GEN8_DE_PIPE_IER(pipe) (0x4440c + (0x10 * (pipe)))
5863+#define GEN8_DE_PIPE_ISR(pipe) _MMIO(0x44400 + (0x10 * (pipe)))
5864+#define GEN8_DE_PIPE_IMR(pipe) _MMIO(0x44404 + (0x10 * (pipe)))
5865+#define GEN8_DE_PIPE_IIR(pipe) _MMIO(0x44408 + (0x10 * (pipe)))
5866+#define GEN8_DE_PIPE_IER(pipe) _MMIO(0x4440c + (0x10 * (pipe)))
57965867 #define GEN8_PIPE_FIFO_UNDERRUN (1 << 31)
57975868 #define GEN8_PIPE_CDCLK_CRC_ERROR (1 << 29)
57985869 #define GEN8_PIPE_CDCLK_CRC_DONE (1 << 28)
@@ -5825,10 +5896,10 @@ enum skl_disp_power_wells { · 26 unmodified lines
58255896 GEN9_PIPE_PLANE2_FAULT | \
58265897 GEN9_PIPE_PLANE1_FAULT)
58275898
5828−#define GEN8_DE_PORT_ISR 0x44440
5829−#define GEN8_DE_PORT_IMR 0x44444
5830−#define GEN8_DE_PORT_IIR 0x44448
5831−#define GEN8_DE_PORT_IER 0x4444c
5899+#define GEN8_DE_PORT_ISR _MMIO(0x44440)
5900+#define GEN8_DE_PORT_IMR _MMIO(0x44444)
5901+#define GEN8_DE_PORT_IIR _MMIO(0x44448)
5902+#define GEN8_DE_PORT_IER _MMIO(0x4444c)
58325903 #define GEN9_AUX_CHANNEL_D (1 << 27)
58335904 #define GEN9_AUX_CHANNEL_C (1 << 26)
58345905 #define GEN9_AUX_CHANNEL_B (1 << 25)
@@ -5842,23 +5913,23 @@ enum skl_disp_power_wells { · 7 unmodified lines
58425913 #define BXT_DE_PORT_GMBUS (1 << 1)
58435914 #define GEN8_AUX_CHANNEL_A (1 << 0)
58445915
5845−#define GEN8_DE_MISC_ISR 0x44460
5846−#define GEN8_DE_MISC_IMR 0x44464
5847−#define GEN8_DE_MISC_IIR 0x44468
5848−#define GEN8_DE_MISC_IER 0x4446c
5916+#define GEN8_DE_MISC_ISR _MMIO(0x44460)
5917+#define GEN8_DE_MISC_IMR _MMIO(0x44464)
5918+#define GEN8_DE_MISC_IIR _MMIO(0x44468)
5919+#define GEN8_DE_MISC_IER _MMIO(0x4446c)
58495920 #define GEN8_DE_MISC_GSE (1 << 27)
58505921
5851−#define GEN8_PCU_ISR 0x444e0
5852−#define GEN8_PCU_IMR 0x444e4
5853−#define GEN8_PCU_IIR 0x444e8
5854−#define GEN8_PCU_IER 0x444ec
5922+#define GEN8_PCU_ISR _MMIO(0x444e0)
5923+#define GEN8_PCU_IMR _MMIO(0x444e4)
5924+#define GEN8_PCU_IIR _MMIO(0x444e8)
5925+#define GEN8_PCU_IER _MMIO(0x444ec)
58555926
5856−#define ILK_DISPLAY_CHICKEN2 0x42004
5927+#define ILK_DISPLAY_CHICKEN2 _MMIO(0x42004)
58575928 /* Required on all Ironlake and Sandybridge according to the B-Spec. */
58585929 #define ILK_ELPIN_409_SELECT (1 << 25)
58595930 #define ILK_DPARB_GATE (1<<22)
58605931 #define ILK_VSDPFD_FULL (1<<21)
5861−#define FUSE_STRAP 0x42014
5932+#define FUSE_STRAP _MMIO(0x42014)
58625933 #define ILK_INTERNAL_GRAPHICS_DISABLE (1 << 31)
58635934 #define ILK_INTERNAL_DISPLAY_DISABLE (1 << 30)
58645935 #define ILK_DISPLAY_DEBUG_DISABLE (1 << 29)
@@ -5867,18 +5938,18 @@ enum skl_disp_power_wells { · 2 unmodified lines
58675938 #define HSW_CDCLK_LIMIT (1 << 24)
58685939 #define ILK_DESKTOP (1 << 23)
58695940
5870−#define ILK_DSPCLK_GATE_D 0x42020
5941+#define ILK_DSPCLK_GATE_D _MMIO(0x42020)
58715942 #define ILK_VRHUNIT_CLOCK_GATE_DISABLE (1 << 28)
58725943 #define ILK_DPFCUNIT_CLOCK_GATE_DISABLE (1 << 9)
58735944 #define ILK_DPFCRUNIT_CLOCK_GATE_DISABLE (1 << 8)
58745945 #define ILK_DPFDUNIT_CLOCK_GATE_ENABLE (1 << 7)
58755946 #define ILK_DPARBUNIT_CLOCK_GATE_ENABLE (1 << 5)
58765947
5877−#define IVB_CHICKEN3 0x4200c
5948+#define IVB_CHICKEN3 _MMIO(0x4200c)
58785949 # define CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE (1 << 5)
58795950 # define CHICKEN3_DGMG_DONE_FIX_DISABLE (1 << 2)
58805951
5881−#define CHICKEN_PAR1_1 0x42080
5952+#define CHICKEN_PAR1_1 _MMIO(0x42080)
58825953 #define DPA_MASK_VBLANK_SRD (1 << 15)
58835954 #define FORCE_ARB_IDLE_PLANES (1 << 14)
58845955
@@ -5886,70 +5957,70 @@ enum skl_disp_power_wells { · 1 unmodified line
58865957 #define _CHICKEN_PIPESL_1_B 0x420b4
58875958 #define HSW_FBCQ_DIS (1 << 22)
58885959 #define BDW_DPRS_MASK_VBLANK_SRD (1 << 0)
5889−#define CHICKEN_PIPESL_1(pipe) _PIPE(pipe, _CHICKEN_PIPESL_1_A, _CHICKEN_PIPESL_1_B)
5960+#define CHICKEN_PIPESL_1(pipe) _MMIO_PIPE(pipe, _CHICKEN_PIPESL_1_A, _CHICKEN_PIPESL_1_B)
58905961
5891−#define DISP_ARB_CTL 0x45000
5962+#define DISP_ARB_CTL _MMIO(0x45000)
58925963 #define DISP_TILE_SURFACE_SWIZZLING (1<<13)
58935964 #define DISP_FBC_WM_DIS (1<<15)
5894−#define DISP_ARB_CTL2 0x45004
5965+#define DISP_ARB_CTL2 _MMIO(0x45004)
58955966 #define DISP_DATA_PARTITION_5_6 (1<<6)
5896−#define DBUF_CTL 0x45008
5967+#define DBUF_CTL _MMIO(0x45008)
58975968 #define DBUF_POWER_REQUEST (1<<31)
58985969 #define DBUF_POWER_STATE (1<<30)
5899−#define GEN7_MSG_CTL 0x45010
5970+#define GEN7_MSG_CTL _MMIO(0x45010)
59005971 #define WAIT_FOR_PCH_RESET_ACK (1<<1)
59015972 #define WAIT_FOR_PCH_FLR_ACK (1<<0)
5902−#define HSW_NDE_RSTWRN_OPT 0x46408
5973+#define HSW_NDE_RSTWRN_OPT _MMIO(0x46408)
59035974 #define RESET_PCH_HANDSHAKE_ENABLE (1<<4)
59045975
5905−#define SKL_DFSM 0x51000
5976+#define SKL_DFSM _MMIO(0x51000)
59065977 #define SKL_DFSM_CDCLK_LIMIT_MASK (3 << 23)
59075978 #define SKL_DFSM_CDCLK_LIMIT_675 (0 << 23)
59085979 #define SKL_DFSM_CDCLK_LIMIT_540 (1 << 23)
59095980 #define SKL_DFSM_CDCLK_LIMIT_450 (2 << 23)
59105981 #define SKL_DFSM_CDCLK_LIMIT_337_5 (3 << 23)
59115982
5912−#define FF_SLICE_CS_CHICKEN2 0x20e4
5983+#define FF_SLICE_CS_CHICKEN2 _MMIO(0x20e4)
59135984 #define GEN9_TSG_BARRIER_ACK_DISABLE (1<<8)
59145985
59155986 /* GEN7 chicken */
5916−#define GEN7_COMMON_SLICE_CHICKEN1 0x7010
5987+#define GEN7_COMMON_SLICE_CHICKEN1 _MMIO(0x7010)
59175988 # define GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC ((1<<10) | (1<<26))
59185989 # define GEN9_RHWO_OPTIMIZATION_DISABLE (1<<14)
5919−#define COMMON_SLICE_CHICKEN2 0x7014
5990+#define COMMON_SLICE_CHICKEN2 _MMIO(0x7014)
59205991 # define GEN8_CSC2_SBE_VUE_CACHE_CONSERVATIVE (1<<0)
59215992
5922−#define HIZ_CHICKEN 0x7018
5993+#define HIZ_CHICKEN _MMIO(0x7018)
59235994 # define CHV_HZ_8X8_MODE_IN_1X (1<<15)
59245995 # define BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE (1<<3)
59255996
5926−#define GEN9_SLICE_COMMON_ECO_CHICKEN0 0x7308
5997+#define GEN9_SLICE_COMMON_ECO_CHICKEN0 _MMIO(0x7308)
59275998 #define DISABLE_PIXEL_MASK_CAMMING (1<<14)
59285999
5929−#define GEN7_L3SQCREG1 0xB010
6000+#define GEN7_L3SQCREG1 _MMIO(0xB010)
59306001 #define VLV_B0_WA_L3SQCREG1_VALUE 0x00D30000
59316002
5932−#define GEN8_L3SQCREG1 0xB100
6003+#define GEN8_L3SQCREG1 _MMIO(0xB100)
59336004 #define BDW_WA_L3SQCREG1_DEFAULT 0x784000
59346005
5935−#define GEN7_L3CNTLREG1 0xB01C
6006+#define GEN7_L3CNTLREG1 _MMIO(0xB01C)
59366007 #define GEN7_WA_FOR_GEN7_L3_CONTROL 0x3C47FF8C
59376008 #define GEN7_L3AGDIS (1<<19)
5938−#define GEN7_L3CNTLREG2 0xB020
5939−#define GEN7_L3CNTLREG3 0xB024
6009+#define GEN7_L3CNTLREG2 _MMIO(0xB020)
6010+#define GEN7_L3CNTLREG3 _MMIO(0xB024)
59406011
5941−#define GEN7_L3_CHICKEN_MODE_REGISTER 0xB030
6012+#define GEN7_L3_CHICKEN_MODE_REGISTER _MMIO(0xB030)
59426013 #define GEN7_WA_L3_CHICKEN_MODE 0x20000000
59436014
5944−#define GEN7_L3SQCREG4 0xb034
6015+#define GEN7_L3SQCREG4 _MMIO(0xb034)
59456016 #define L3SQ_URB_READ_CAM_MATCH_DISABLE (1<<27)
59466017
5947−#define GEN8_L3SQCREG4 0xb118
6018+#define GEN8_L3SQCREG4 _MMIO(0xb118)
59486019 #define GEN8_LQSC_RO_PERF_DIS (1<<27)
59496020 #define GEN8_LQSC_FLUSH_COHERENT_LINES (1<<21)
59506021
59516022 /* GEN8 chicken */
5952−#define HDC_CHICKEN0 0x7300
6023+#define HDC_CHICKEN0 _MMIO(0x7300)
59536024 #define HDC_FORCE_CSR_NON_COHERENT_OVR_DISABLE (1<<15)
59546025 #define HDC_FENCE_DEST_SLM_DISABLE (1<<14)
59556026 #define HDC_DONOT_FETCH_MEM_WHEN_MASKED (1<<11)
@@ -5958,17 +6029,17 @@ enum skl_disp_power_wells { · 2 unmodified lines
59586029 #define HDC_BARRIER_PERFORMANCE_DISABLE (1<<10)
59596030
59606031 /* GEN9 chicken */
5961−#define SLICE_ECO_CHICKEN0 0x7308
6032+#define SLICE_ECO_CHICKEN0 _MMIO(0x7308)
59626033 #define PIXEL_MASK_CAMMING_DISABLE (1 << 14)
59636034
59646035 /* WaCatErrorRejectionIssue */
5965−#define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG 0x9030
6036+#define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG _MMIO(0x9030)
59666037 #define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1<<11)
59676038
5968−#define HSW_SCRATCH1 0xb038
6039+#define HSW_SCRATCH1 _MMIO(0xb038)
59696040 #define HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE (1<<27)
59706041
5971−#define BDW_SCRATCH1 0xb11c
6042+#define BDW_SCRATCH1 _MMIO(0xb11c)
59726043 #define GEN9_LBS_SLA_RETRY_TIMER_DECREMENT_ENABLE (1<<2)
59736044
59746045 /* PCH */
@@ -6062,12 +6133,12 @@ enum skl_disp_power_wells { · 87 unmodified lines
60626133 SDE_FDI_RXB_CPT | \
60636134 SDE_FDI_RXA_CPT)
60646135
6065−#define SDEISR 0xc4000
6066−#define SDEIMR 0xc4004
6067−#define SDEIIR 0xc4008
6068−#define SDEIER 0xc400c
6136+#define SDEISR _MMIO(0xc4000)
6137+#define SDEIMR _MMIO(0xc4004)
6138+#define SDEIIR _MMIO(0xc4008)
6139+#define SDEIER _MMIO(0xc400c)
60696140
6070−#define SERR_INT 0xc4040
6141+#define SERR_INT _MMIO(0xc4040)
60716142 #define SERR_INT_POISON (1<<31)
60726143 #define SERR_INT_TRANS_C_FIFO_UNDERRUN (1<<6)
60736144 #define SERR_INT_TRANS_B_FIFO_UNDERRUN (1<<3)
@@ -6075,7 +6146,7 @@ enum skl_disp_power_wells { · 1 unmodified line
60756146 #define SERR_INT_TRANS_FIFO_UNDERRUN(pipe) (1<<((pipe)*3))
60766147
60776148 /* digital port hotplug */
6078−#define PCH_PORT_HOTPLUG 0xc4030 /* SHOTPLUG_CTL */
6149+#define PCH_PORT_HOTPLUG _MMIO(0xc4030) /* SHOTPLUG_CTL */
60796150 #define PORTA_HOTPLUG_ENABLE (1 << 28) /* LPT:LP+ & BXT */
60806151 #define PORTA_HOTPLUG_STATUS_MASK (3 << 24) /* SPT+ & BXT */
60816152 #define PORTA_HOTPLUG_NO_DETECT (0 << 24) /* SPT+ & BXT */
@@ -6112,42 +6183,42 @@ enum skl_disp_power_wells { · 30 unmodified lines
61126183 #define PORTB_HOTPLUG_SHORT_DETECT (1 << 0)
61136184 #define PORTB_HOTPLUG_LONG_DETECT (2 << 0)
61146185
6115−#define PCH_PORT_HOTPLUG2 0xc403C /* SHOTPLUG_CTL2 SPT+ */
6186+#define PCH_PORT_HOTPLUG2 _MMIO(0xc403C) /* SHOTPLUG_CTL2 SPT+ */
61166187 #define PORTE_HOTPLUG_ENABLE (1 << 4)
61176188 #define PORTE_HOTPLUG_STATUS_MASK (3 << 0)
61186189 #define PORTE_HOTPLUG_NO_DETECT (0 << 0)
61196190 #define PORTE_HOTPLUG_SHORT_DETECT (1 << 0)
61206191 #define PORTE_HOTPLUG_LONG_DETECT (2 << 0)
61216192
6122−#define PCH_GPIOA 0xc5010
6123−#define PCH_GPIOB 0xc5014
6124−#define PCH_GPIOC 0xc5018
6125−#define PCH_GPIOD 0xc501c
6126−#define PCH_GPIOE 0xc5020
6127−#define PCH_GPIOF 0xc5024
6193+#define PCH_GPIOA _MMIO(0xc5010)
6194+#define PCH_GPIOB _MMIO(0xc5014)
6195+#define PCH_GPIOC _MMIO(0xc5018)
6196+#define PCH_GPIOD _MMIO(0xc501c)
6197+#define PCH_GPIOE _MMIO(0xc5020)
6198+#define PCH_GPIOF _MMIO(0xc5024)
61286199
6129−#define PCH_GMBUS0 0xc5100
6130−#define PCH_GMBUS1 0xc5104
6131−#define PCH_GMBUS2 0xc5108
6132−#define PCH_GMBUS3 0xc510c
6133−#define PCH_GMBUS4 0xc5110
6134−#define PCH_GMBUS5 0xc5120
6200+#define PCH_GMBUS0 _MMIO(0xc5100)
6201+#define PCH_GMBUS1 _MMIO(0xc5104)
6202+#define PCH_GMBUS2 _MMIO(0xc5108)
6203+#define PCH_GMBUS3 _MMIO(0xc510c)
6204+#define PCH_GMBUS4 _MMIO(0xc5110)
6205+#define PCH_GMBUS5 _MMIO(0xc5120)
61356206
61366207 #define _PCH_DPLL_A 0xc6014
61376208 #define _PCH_DPLL_B 0xc6018
6138−#define PCH_DPLL(pll) (pll == 0 ? _PCH_DPLL_A : _PCH_DPLL_B)
6209+#define PCH_DPLL(pll) _MMIO(pll == 0 ? _PCH_DPLL_A : _PCH_DPLL_B)
61396210
61406211 #define _PCH_FPA0 0xc6040
61416212 #define FP_CB_TUNE (0x3<<22)
61426213 #define _PCH_FPA1 0xc6044
61436214 #define _PCH_FPB0 0xc6048
61446215 #define _PCH_FPB1 0xc604c
6145−#define PCH_FP0(pll) (pll == 0 ? _PCH_FPA0 : _PCH_FPB0)
6146−#define PCH_FP1(pll) (pll == 0 ? _PCH_FPA1 : _PCH_FPB1)
6216+#define PCH_FP0(pll) _MMIO(pll == 0 ? _PCH_FPA0 : _PCH_FPB0)
6217+#define PCH_FP1(pll) _MMIO(pll == 0 ? _PCH_FPA1 : _PCH_FPB1)
61476218
6148−#define PCH_DPLL_TEST 0xc606c
6219+#define PCH_DPLL_TEST _MMIO(0xc606c)
61496220
6150−#define PCH_DREF_CONTROL 0xC6200
6221+#define PCH_DREF_CONTROL _MMIO(0xC6200)
61516222 #define DREF_CONTROL_MASK 0x7fc3
61526223 #define DREF_CPU_SOURCE_OUTPUT_DISABLE (0<<13)
61536224 #define DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD (2<<13)
@@ -6170,19 +6241,19 @@ enum skl_disp_power_wells { · 16 unmodified lines
61706241 #define DREF_SSC4_DISABLE (0)
61716242 #define DREF_SSC4_ENABLE (1)
61726243
6173−#define PCH_RAWCLK_FREQ 0xc6204
6244+#define PCH_RAWCLK_FREQ _MMIO(0xc6204)
61746245 #define FDL_TP1_TIMER_SHIFT 12
61756246 #define FDL_TP1_TIMER_MASK (3<<12)
61766247 #define FDL_TP2_TIMER_SHIFT 10
61776248 #define FDL_TP2_TIMER_MASK (3<<10)
61786249 #define RAWCLK_FREQ_MASK 0x3ff
61796250
6180−#define PCH_DPLL_TMR_CFG 0xc6208
6251+#define PCH_DPLL_TMR_CFG _MMIO(0xc6208)
61816252
6182−#define PCH_SSC4_PARMS 0xc6210
6183−#define PCH_SSC4_AUX_PARMS 0xc6214
6253+#define PCH_SSC4_PARMS _MMIO(0xc6210)
6254+#define PCH_SSC4_AUX_PARMS _MMIO(0xc6214)
61846255
6185−#define PCH_DPLL_SEL 0xc7000
6256+#define PCH_DPLL_SEL _MMIO(0xc7000)
61866257 #define TRANS_DPLLB_SEL(pipe) (1 << ((pipe) * 4))
61876258 #define TRANS_DPLLA_SEL(pipe) 0
61886259 #define TRANS_DPLL_ENABLE(pipe) (1 << ((pipe) * 4 + 3))
@@ -6230,79 +6301,73 @@ enum skl_disp_power_wells { · 41 unmodified lines
62306301 #define _VIDEO_DIP_DATA_B 0xe1208
62316302 #define _VIDEO_DIP_GCP_B 0xe1210
62326303
6233−#define TVIDEO_DIP_CTL(pipe) _PIPE(pipe, _VIDEO_DIP_CTL_A, _VIDEO_DIP_CTL_B)
6234−#define TVIDEO_DIP_DATA(pipe) _PIPE(pipe, _VIDEO_DIP_DATA_A, _VIDEO_DIP_DATA_B)
6235−#define TVIDEO_DIP_GCP(pipe) _PIPE(pipe, _VIDEO_DIP_GCP_A, _VIDEO_DIP_GCP_B)
6304+#define TVIDEO_DIP_CTL(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_CTL_A, _VIDEO_DIP_CTL_B)
6305+#define TVIDEO_DIP_DATA(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_DATA_A, _VIDEO_DIP_DATA_B)
6306+#define TVIDEO_DIP_GCP(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_GCP_A, _VIDEO_DIP_GCP_B)
62366307
62376308 /* Per-transcoder DIP controls (VLV) */
6238−#define VLV_VIDEO_DIP_CTL_A (VLV_DISPLAY_BASE + 0x60200)
6239−#define VLV_VIDEO_DIP_DATA_A (VLV_DISPLAY_BASE + 0x60208)
6240−#define VLV_VIDEO_DIP_GDCP_PAYLOAD_A (VLV_DISPLAY_BASE + 0x60210)
6309+#define _VLV_VIDEO_DIP_CTL_A (VLV_DISPLAY_BASE + 0x60200)
6310+#define _VLV_VIDEO_DIP_DATA_A (VLV_DISPLAY_BASE + 0x60208)
6311+#define _VLV_VIDEO_DIP_GDCP_PAYLOAD_A (VLV_DISPLAY_BASE + 0x60210)
62416312
6242−#define VLV_VIDEO_DIP_CTL_B (VLV_DISPLAY_BASE + 0x61170)
6243−#define VLV_VIDEO_DIP_DATA_B (VLV_DISPLAY_BASE + 0x61174)
6244−#define VLV_VIDEO_DIP_GDCP_PAYLOAD_B (VLV_DISPLAY_BASE + 0x61178)
6313+#define _VLV_VIDEO_DIP_CTL_B (VLV_DISPLAY_BASE + 0x61170)
6314+#define _VLV_VIDEO_DIP_DATA_B (VLV_DISPLAY_BASE + 0x61174)
6315+#define _VLV_VIDEO_DIP_GDCP_PAYLOAD_B (VLV_DISPLAY_BASE + 0x61178)
62456316
6246−#define CHV_VIDEO_DIP_CTL_C (VLV_DISPLAY_BASE + 0x611f0)
6247−#define CHV_VIDEO_DIP_DATA_C (VLV_DISPLAY_BASE + 0x611f4)
6248−#define CHV_VIDEO_DIP_GDCP_PAYLOAD_C (VLV_DISPLAY_BASE + 0x611f8)
6317+#define _CHV_VIDEO_DIP_CTL_C (VLV_DISPLAY_BASE + 0x611f0)
6318+#define _CHV_VIDEO_DIP_DATA_C (VLV_DISPLAY_BASE + 0x611f4)
6319+#define _CHV_VIDEO_DIP_GDCP_PAYLOAD_C (VLV_DISPLAY_BASE + 0x611f8)
62496320
62506321 #define VLV_TVIDEO_DIP_CTL(pipe) \
6251− _PIPE3((pipe), VLV_VIDEO_DIP_CTL_A, \
6252− VLV_VIDEO_DIP_CTL_B, CHV_VIDEO_DIP_CTL_C)
6322+ _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_CTL_A, \
6323+ _VLV_VIDEO_DIP_CTL_B, _CHV_VIDEO_DIP_CTL_C)
62536324 #define VLV_TVIDEO_DIP_DATA(pipe) \
6254− _PIPE3((pipe), VLV_VIDEO_DIP_DATA_A, \
6255− VLV_VIDEO_DIP_DATA_B, CHV_VIDEO_DIP_DATA_C)
6325+ _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_DATA_A, \
6326+ _VLV_VIDEO_DIP_DATA_B, _CHV_VIDEO_DIP_DATA_C)
62566327 #define VLV_TVIDEO_DIP_GCP(pipe) \
6257− _PIPE3((pipe), VLV_VIDEO_DIP_GDCP_PAYLOAD_A, \
6258− VLV_VIDEO_DIP_GDCP_PAYLOAD_B, CHV_VIDEO_DIP_GDCP_PAYLOAD_C)
6328+ _MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_GDCP_PAYLOAD_A, \
6329+ _VLV_VIDEO_DIP_GDCP_PAYLOAD_B, _CHV_VIDEO_DIP_GDCP_PAYLOAD_C)
62596330
62606331 /* Haswell DIP controls */
6261−#define HSW_VIDEO_DIP_CTL_A 0x60200
6262−#define HSW_VIDEO_DIP_AVI_DATA_A 0x60220
6263−#define HSW_VIDEO_DIP_VS_DATA_A 0x60260
6264−#define HSW_VIDEO_DIP_SPD_DATA_A 0x602A0
6265−#define HSW_VIDEO_DIP_GMP_DATA_A 0x602E0
6266−#define HSW_VIDEO_DIP_VSC_DATA_A 0x60320
6267−#define HSW_VIDEO_DIP_AVI_ECC_A 0x60240
6268−#define HSW_VIDEO_DIP_VS_ECC_A 0x60280
6269−#define HSW_VIDEO_DIP_SPD_ECC_A 0x602C0
6270−#define HSW_VIDEO_DIP_GMP_ECC_A 0x60300
6271−#define HSW_VIDEO_DIP_VSC_ECC_A 0x60344
6272−#define HSW_VIDEO_DIP_GCP_A 0x60210
6273−
6274−#define HSW_VIDEO_DIP_CTL_B 0x61200
6275−#define HSW_VIDEO_DIP_AVI_DATA_B 0x61220
6276−#define HSW_VIDEO_DIP_VS_DATA_B 0x61260
6277−#define HSW_VIDEO_DIP_SPD_DATA_B 0x612A0
6278−#define HSW_VIDEO_DIP_GMP_DATA_B 0x612E0
6279−#define HSW_VIDEO_DIP_VSC_DATA_B 0x61320
6280−#define HSW_VIDEO_DIP_BVI_ECC_B 0x61240
6281−#define HSW_VIDEO_DIP_VS_ECC_B 0x61280
6282−#define HSW_VIDEO_DIP_SPD_ECC_B 0x612C0
6283−#define HSW_VIDEO_DIP_GMP_ECC_B 0x61300
6284−#define HSW_VIDEO_DIP_VSC_ECC_B 0x61344
6285−#define HSW_VIDEO_DIP_GCP_B 0x61210
6286−
6287−#define HSW_TVIDEO_DIP_CTL(trans) \
6288− _TRANSCODER2(trans, HSW_VIDEO_DIP_CTL_A)
6289−#define HSW_TVIDEO_DIP_AVI_DATA(trans, i) \
6290− (_TRANSCODER2(trans, HSW_VIDEO_DIP_AVI_DATA_A) + (i) * 4)
6291−#define HSW_TVIDEO_DIP_VS_DATA(trans, i) \
6292− (_TRANSCODER2(trans, HSW_VIDEO_DIP_VS_DATA_A) + (i) * 4)
6293−#define HSW_TVIDEO_DIP_SPD_DATA(trans, i) \
6294− (_TRANSCODER2(trans, HSW_VIDEO_DIP_SPD_DATA_A) + (i) * 4)
6295−#define HSW_TVIDEO_DIP_GCP(trans) \
6296− _TRANSCODER2(trans, HSW_VIDEO_DIP_GCP_A)
6297−#define HSW_TVIDEO_DIP_VSC_DATA(trans, i) \
6298− (_TRANSCODER2(trans, HSW_VIDEO_DIP_VSC_DATA_A) + (i) * 4)
6299−
6300−#define HSW_STEREO_3D_CTL_A 0x70020
6301−#define S3D_ENABLE (1<<31)
6302−#define HSW_STEREO_3D_CTL_B 0x71020
6303−
6304−#define HSW_STEREO_3D_CTL(trans) \
6305− _PIPE2(trans, HSW_STEREO_3D_CTL_A)
6332+
6333+#define _HSW_VIDEO_DIP_CTL_A 0x60200
6334+#define _HSW_VIDEO_DIP_AVI_DATA_A 0x60220
6335+#define _HSW_VIDEO_DIP_VS_DATA_A 0x60260
6336+#define _HSW_VIDEO_DIP_SPD_DATA_A 0x602A0
6337+#define _HSW_VIDEO_DIP_GMP_DATA_A 0x602E0
6338+#define _HSW_VIDEO_DIP_VSC_DATA_A 0x60320
6339+#define _HSW_VIDEO_DIP_AVI_ECC_A 0x60240
6340+#define _HSW_VIDEO_DIP_VS_ECC_A 0x60280
6341+#define _HSW_VIDEO_DIP_SPD_ECC_A 0x602C0
6342+#define _HSW_VIDEO_DIP_GMP_ECC_A 0x60300
6343+#define _HSW_VIDEO_DIP_VSC_ECC_A 0x60344
6344+#define _HSW_VIDEO_DIP_GCP_A 0x60210
6345+
6346+#define _HSW_VIDEO_DIP_CTL_B 0x61200
6347+#define _HSW_VIDEO_DIP_AVI_DATA_B 0x61220
6348+#define _HSW_VIDEO_DIP_VS_DATA_B 0x61260
6349+#define _HSW_VIDEO_DIP_SPD_DATA_B 0x612A0
6350+#define _HSW_VIDEO_DIP_GMP_DATA_B 0x612E0
6351+#define _HSW_VIDEO_DIP_VSC_DATA_B 0x61320
6352+#define _HSW_VIDEO_DIP_BVI_ECC_B 0x61240
6353+#define _HSW_VIDEO_DIP_VS_ECC_B 0x61280
6354+#define _HSW_VIDEO_DIP_SPD_ECC_B 0x612C0
6355+#define _HSW_VIDEO_DIP_GMP_ECC_B 0x61300
6356+#define _HSW_VIDEO_DIP_VSC_ECC_B 0x61344
6357+#define _HSW_VIDEO_DIP_GCP_B 0x61210
6358+
6359+#define HSW_TVIDEO_DIP_CTL(trans) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_CTL_A)
6360+#define HSW_TVIDEO_DIP_AVI_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_AVI_DATA_A + (i) * 4)
6361+#define HSW_TVIDEO_DIP_VS_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VS_DATA_A + (i) * 4)
6362+#define HSW_TVIDEO_DIP_SPD_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_SPD_DATA_A + (i) * 4)
6363+#define HSW_TVIDEO_DIP_GCP(trans) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_GCP_A)
6364+#define HSW_TVIDEO_DIP_VSC_DATA(trans, i) _MMIO_TRANS2(trans, _HSW_VIDEO_DIP_VSC_DATA_A + (i) * 4)
6365+
6366+#define _HSW_STEREO_3D_CTL_A 0x70020
6367+#define S3D_ENABLE (1<<31)
6368+#define _HSW_STEREO_3D_CTL_B 0x71020
6369+
6370+#define HSW_STEREO_3D_CTL(trans) _MMIO_PIPE2(trans, _HSW_STEREO_3D_CTL_A)
63066371
63076372 #define _PCH_TRANS_HTOTAL_B 0xe1000
63086373 #define _PCH_TRANS_HBLANK_B 0xe1004
@@ -6310,16 +6375,15 @@ enum skl_disp_power_wells { · 1 unmodified line
63106375 #define _PCH_TRANS_VTOTAL_B 0xe100c
63116376 #define _PCH_TRANS_VBLANK_B 0xe1010
63126377 #define _PCH_TRANS_VSYNC_B 0xe1014
6313−#define _PCH_TRANS_VSYNCSHIFT_B 0xe1028
6378+#define _PCH_TRANS_VSYNCSHIFT_B 0xe1028
63146379
6315−#define PCH_TRANS_HTOTAL(pipe) _PIPE(pipe, _PCH_TRANS_HTOTAL_A, _PCH_TRANS_HTOTAL_B)
6316−#define PCH_TRANS_HBLANK(pipe) _PIPE(pipe, _PCH_TRANS_HBLANK_A, _PCH_TRANS_HBLANK_B)
6317−#define PCH_TRANS_HSYNC(pipe) _PIPE(pipe, _PCH_TRANS_HSYNC_A, _PCH_TRANS_HSYNC_B)
6318−#define PCH_TRANS_VTOTAL(pipe) _PIPE(pipe, _PCH_TRANS_VTOTAL_A, _PCH_TRANS_VTOTAL_B)
6319−#define PCH_TRANS_VBLANK(pipe) _PIPE(pipe, _PCH_TRANS_VBLANK_A, _PCH_TRANS_VBLANK_B)
6320−#define PCH_TRANS_VSYNC(pipe) _PIPE(pipe, _PCH_TRANS_VSYNC_A, _PCH_TRANS_VSYNC_B)
6321−#define PCH_TRANS_VSYNCSHIFT(pipe) _PIPE(pipe, _PCH_TRANS_VSYNCSHIFT_A, \
6322− _PCH_TRANS_VSYNCSHIFT_B)
6380+#define PCH_TRANS_HTOTAL(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HTOTAL_A, _PCH_TRANS_HTOTAL_B)
6381+#define PCH_TRANS_HBLANK(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HBLANK_A, _PCH_TRANS_HBLANK_B)
6382+#define PCH_TRANS_HSYNC(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_HSYNC_A, _PCH_TRANS_HSYNC_B)
6383+#define PCH_TRANS_VTOTAL(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VTOTAL_A, _PCH_TRANS_VTOTAL_B)
6384+#define PCH_TRANS_VBLANK(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VBLANK_A, _PCH_TRANS_VBLANK_B)
6385+#define PCH_TRANS_VSYNC(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VSYNC_A, _PCH_TRANS_VSYNC_B)
6386+#define PCH_TRANS_VSYNCSHIFT(pipe) _MMIO_PIPE(pipe, _PCH_TRANS_VSYNCSHIFT_A, _PCH_TRANS_VSYNCSHIFT_B)
63236387
63246388 #define _PCH_TRANSB_DATA_M1 0xe1030
63256389 #define _PCH_TRANSB_DATA_N1 0xe1034
@@ -6330,19 +6394,19 @@ enum skl_disp_power_wells { · 4 unmodified lines
63306394 #define _PCH_TRANSB_LINK_M2 0xe1048
63316395 #define _PCH_TRANSB_LINK_N2 0xe104c
63326396
6333−#define PCH_TRANS_DATA_M1(pipe) _PIPE(pipe, _PCH_TRANSA_DATA_M1, _PCH_TRANSB_DATA_M1)
6334−#define PCH_TRANS_DATA_N1(pipe) _PIPE(pipe, _PCH_TRANSA_DATA_N1, _PCH_TRANSB_DATA_N1)
6335−#define PCH_TRANS_DATA_M2(pipe) _PIPE(pipe, _PCH_TRANSA_DATA_M2, _PCH_TRANSB_DATA_M2)
6336−#define PCH_TRANS_DATA_N2(pipe) _PIPE(pipe, _PCH_TRANSA_DATA_N2, _PCH_TRANSB_DATA_N2)
6337−#define PCH_TRANS_LINK_M1(pipe) _PIPE(pipe, _PCH_TRANSA_LINK_M1, _PCH_TRANSB_LINK_M1)
6338−#define PCH_TRANS_LINK_N1(pipe) _PIPE(pipe, _PCH_TRANSA_LINK_N1, _PCH_TRANSB_LINK_N1)
6339−#define PCH_TRANS_LINK_M2(pipe) _PIPE(pipe, _PCH_TRANSA_LINK_M2, _PCH_TRANSB_LINK_M2)
6340−#define PCH_TRANS_LINK_N2(pipe) _PIPE(pipe, _PCH_TRANSA_LINK_N2, _PCH_TRANSB_LINK_N2)
6397+#define PCH_TRANS_DATA_M1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_M1, _PCH_TRANSB_DATA_M1)
6398+#define PCH_TRANS_DATA_N1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_N1, _PCH_TRANSB_DATA_N1)
6399+#define PCH_TRANS_DATA_M2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_M2, _PCH_TRANSB_DATA_M2)
6400+#define PCH_TRANS_DATA_N2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_DATA_N2, _PCH_TRANSB_DATA_N2)
6401+#define PCH_TRANS_LINK_M1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_M1, _PCH_TRANSB_LINK_M1)
6402+#define PCH_TRANS_LINK_N1(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_N1, _PCH_TRANSB_LINK_N1)
6403+#define PCH_TRANS_LINK_M2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_M2, _PCH_TRANSB_LINK_M2)
6404+#define PCH_TRANS_LINK_N2(pipe) _MMIO_PIPE(pipe, _PCH_TRANSA_LINK_N2, _PCH_TRANSB_LINK_N2)
63416405
63426406 #define _PCH_TRANSACONF 0xf0008
63436407 #define _PCH_TRANSBCONF 0xf1008
6344−#define PCH_TRANSCONF(pipe) _PIPE(pipe, _PCH_TRANSACONF, _PCH_TRANSBCONF)
6345−#define LPT_TRANSCONF _PCH_TRANSACONF /* lpt has only one transcoder */
6408+#define PCH_TRANSCONF(pipe) _MMIO_PIPE(pipe, _PCH_TRANSACONF, _PCH_TRANSBCONF)
6409+#define LPT_TRANSCONF PCH_TRANSCONF(PIPE_A) /* lpt has only one transcoder */
63466410 #define TRANS_DISABLE (0<<31)
63476411 #define TRANS_ENABLE (1<<31)
63486412 #define TRANS_STATE_MASK (1<<30)
@@ -6363,47 +6427,47 @@ enum skl_disp_power_wells { · 14 unmodified lines
63636427
63646428 #define _TRANSA_CHICKEN1 0xf0060
63656429 #define _TRANSB_CHICKEN1 0xf1060
6366−#define TRANS_CHICKEN1(pipe) _PIPE(pipe, _TRANSA_CHICKEN1, _TRANSB_CHICKEN1)
6430+#define TRANS_CHICKEN1(pipe) _MMIO_PIPE(pipe, _TRANSA_CHICKEN1, _TRANSB_CHICKEN1)
63676431 #define TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE (1<<10)
63686432 #define TRANS_CHICKEN1_DP0UNIT_GC_DISABLE (1<<4)
63696433 #define _TRANSA_CHICKEN2 0xf0064
63706434 #define _TRANSB_CHICKEN2 0xf1064
6371−#define TRANS_CHICKEN2(pipe) _PIPE(pipe, _TRANSA_CHICKEN2, _TRANSB_CHICKEN2)
6435+#define TRANS_CHICKEN2(pipe) _MMIO_PIPE(pipe, _TRANSA_CHICKEN2, _TRANSB_CHICKEN2)
63726436 #define TRANS_CHICKEN2_TIMING_OVERRIDE (1<<31)
63736437 #define TRANS_CHICKEN2_FDI_POLARITY_REVERSED (1<<29)
63746438 #define TRANS_CHICKEN2_FRAME_START_DELAY_MASK (3<<27)
63756439 #define TRANS_CHICKEN2_DISABLE_DEEP_COLOR_COUNTER (1<<26)
63766440 #define TRANS_CHICKEN2_DISABLE_DEEP_COLOR_MODESWITCH (1<<25)
63776441
6378−#define SOUTH_CHICKEN1 0xc2000
6442+#define SOUTH_CHICKEN1 _MMIO(0xc2000)
63796443 #define FDIA_PHASE_SYNC_SHIFT_OVR 19
63806444 #define FDIA_PHASE_SYNC_SHIFT_EN 18
63816445 #define FDI_PHASE_SYNC_OVR(pipe) (1<<(FDIA_PHASE_SYNC_SHIFT_OVR - ((pipe) * 2)))
63826446 #define FDI_PHASE_SYNC_EN(pipe) (1<<(FDIA_PHASE_SYNC_SHIFT_EN - ((pipe) * 2)))
63836447 #define FDI_BC_BIFURCATION_SELECT (1 << 12)
63846448 #define SPT_PWM_GRANULARITY (1<<0)
6385−#define SOUTH_CHICKEN2 0xc2004
6449+#define SOUTH_CHICKEN2 _MMIO(0xc2004)
63866450 #define FDI_MPHY_IOSFSB_RESET_STATUS (1<<13)
63876451 #define FDI_MPHY_IOSFSB_RESET_CTL (1<<12)
63886452 #define LPT_PWM_GRANULARITY (1<<5)
63896453 #define DPLS_EDP_PPS_FIX_DIS (1<<0)
63906454
6391−#define _FDI_RXA_CHICKEN 0xc200c
6392−#define _FDI_RXB_CHICKEN 0xc2010
6455+#define _FDI_RXA_CHICKEN 0xc200c
6456+#define _FDI_RXB_CHICKEN 0xc2010
63936457 #define FDI_RX_PHASE_SYNC_POINTER_OVR (1<<1)
63946458 #define FDI_RX_PHASE_SYNC_POINTER_EN (1<<0)
6395−#define FDI_RX_CHICKEN(pipe) _PIPE(pipe, _FDI_RXA_CHICKEN, _FDI_RXB_CHICKEN)
6459+#define FDI_RX_CHICKEN(pipe) _MMIO_PIPE(pipe, _FDI_RXA_CHICKEN, _FDI_RXB_CHICKEN)
63966460
6397−#define SOUTH_DSPCLK_GATE_D 0xc2020
6461+#define SOUTH_DSPCLK_GATE_D _MMIO(0xc2020)
63986462 #define PCH_DPLUNIT_CLOCK_GATE_DISABLE (1<<30)
63996463 #define PCH_DPLSUNIT_CLOCK_GATE_DISABLE (1<<29)
64006464 #define PCH_CPUNIT_CLOCK_GATE_DISABLE (1<<14)
64016465 #define PCH_LP_PARTITION_LEVEL_DISABLE (1<<12)
64026466
64036467 /* CPU: FDI_TX */
6404−#define _FDI_TXA_CTL 0x60100
6405−#define _FDI_TXB_CTL 0x61100
6406−#define FDI_TX_CTL(pipe) _PIPE(pipe, _FDI_TXA_CTL, _FDI_TXB_CTL)
6468+#define _FDI_TXA_CTL 0x60100
6469+#define _FDI_TXB_CTL 0x61100
6470+#define FDI_TX_CTL(pipe) _MMIO_PIPE(pipe, _FDI_TXA_CTL, _FDI_TXB_CTL)
64076471 #define FDI_TX_DISABLE (0<<31)
64086472 #define FDI_TX_ENABLE (1<<31)
64096473 #define FDI_LINK_TRAIN_PATTERN_1 (0<<28)
@@ -6453,7 +6517,7 @@ enum skl_disp_power_wells { · 43 unmodified lines
64536517 /* FDI_RX, FDI_X is hard-wired to Transcoder_X */
64546518 #define _FDI_RXA_CTL 0xf000c
64556519 #define _FDI_RXB_CTL 0xf100c
6456−#define FDI_RX_CTL(pipe) _PIPE(pipe, _FDI_RXA_CTL, _FDI_RXB_CTL)
6520+#define FDI_RX_CTL(pipe) _MMIO_PIPE(pipe, _FDI_RXA_CTL, _FDI_RXB_CTL)
64576521 #define FDI_RX_ENABLE (1<<31)
64586522 /* train, dp width same as FDI_TX */
64596523 #define FDI_FS_ERRC_ENABLE (1<<27)
@@ -6489,14 +6553,14 @@ enum skl_disp_power_wells { · 29 unmodified lines
64896553 #define FDI_RX_TP1_TO_TP2_48 (2<<20)
64906554 #define FDI_RX_TP1_TO_TP2_64 (3<<20)
64916555 #define FDI_RX_FDI_DELAY_90 (0x90<<0)
6492−#define FDI_RX_MISC(pipe) _PIPE(pipe, _FDI_RXA_MISC, _FDI_RXB_MISC)
6556+#define FDI_RX_MISC(pipe) _MMIO_PIPE(pipe, _FDI_RXA_MISC, _FDI_RXB_MISC)
64936557
6494−#define _FDI_RXA_TUSIZE1 0xf0030
6495−#define _FDI_RXA_TUSIZE2 0xf0038
6496−#define _FDI_RXB_TUSIZE1 0xf1030
6497−#define _FDI_RXB_TUSIZE2 0xf1038
6498−#define FDI_RX_TUSIZE1(pipe) _PIPE(pipe, _FDI_RXA_TUSIZE1, _FDI_RXB_TUSIZE1)
6499−#define FDI_RX_TUSIZE2(pipe) _PIPE(pipe, _FDI_RXA_TUSIZE2, _FDI_RXB_TUSIZE2)
6558+#define _FDI_RXA_TUSIZE1 0xf0030
6559+#define _FDI_RXA_TUSIZE2 0xf0038
6560+#define _FDI_RXB_TUSIZE1 0xf1030
6561+#define _FDI_RXB_TUSIZE2 0xf1038
6562+#define FDI_RX_TUSIZE1(pipe) _MMIO_PIPE(pipe, _FDI_RXA_TUSIZE1, _FDI_RXB_TUSIZE1)
6563+#define FDI_RX_TUSIZE2(pipe) _MMIO_PIPE(pipe, _FDI_RXA_TUSIZE2, _FDI_RXB_TUSIZE2)
65006564
65016565 /* FDI_RX interrupt register format */
65026566 #define FDI_RX_INTER_LANE_ALIGN (1<<10)
@@ -6511,44 +6575,41 @@ enum skl_disp_power_wells { · 8 unmodified lines
65116575 #define FDI_RX_CROSS_CLOCK_OVERFLOW (1<<1)
65126576 #define FDI_RX_SYMBOL_QUEUE_OVERFLOW (1<<0)
65136577
6514−#define _FDI_RXA_IIR 0xf0014
6515−#define _FDI_RXA_IMR 0xf0018
6516−#define _FDI_RXB_IIR 0xf1014
6517−#define _FDI_RXB_IMR 0xf1018
6518−#define FDI_RX_IIR(pipe) _PIPE(pipe, _FDI_RXA_IIR, _FDI_RXB_IIR)
6519−#define FDI_RX_IMR(pipe) _PIPE(pipe, _FDI_RXA_IMR, _FDI_RXB_IMR)
6578+#define _FDI_RXA_IIR 0xf0014
6579+#define _FDI_RXA_IMR 0xf0018
6580+#define _FDI_RXB_IIR 0xf1014
6581+#define _FDI_RXB_IMR 0xf1018
6582+#define FDI_RX_IIR(pipe) _MMIO_PIPE(pipe, _FDI_RXA_IIR, _FDI_RXB_IIR)
6583+#define FDI_RX_IMR(pipe) _MMIO_PIPE(pipe, _FDI_RXA_IMR, _FDI_RXB_IMR)
65206584
6521−#define FDI_PLL_CTL_1 0xfe000
6522−#define FDI_PLL_CTL_2 0xfe004
6585+#define FDI_PLL_CTL_1 _MMIO(0xfe000)
6586+#define FDI_PLL_CTL_2 _MMIO(0xfe004)
65236587
6524−#define PCH_LVDS 0xe1180
6588+#define PCH_LVDS _MMIO(0xe1180)
65256589 #define LVDS_DETECTED (1 << 1)
65266590
65276591 /* vlv has 2 sets of panel control regs. */
6528−#define PIPEA_PP_STATUS (VLV_DISPLAY_BASE + 0x61200)
6529−#define PIPEA_PP_CONTROL (VLV_DISPLAY_BASE + 0x61204)
6530−#define PIPEA_PP_ON_DELAYS (VLV_DISPLAY_BASE + 0x61208)
6592+#define _PIPEA_PP_STATUS (VLV_DISPLAY_BASE + 0x61200)
6593+#define _PIPEA_PP_CONTROL (VLV_DISPLAY_BASE + 0x61204)
6594+#define _PIPEA_PP_ON_DELAYS (VLV_DISPLAY_BASE + 0x61208)
65316595 #define PANEL_PORT_SELECT_VLV(port) ((port) << 30)
6532−#define PIPEA_PP_OFF_DELAYS (VLV_DISPLAY_BASE + 0x6120c)
6533−#define PIPEA_PP_DIVISOR (VLV_DISPLAY_BASE + 0x61210)
6534−
6535−#define PIPEB_PP_STATUS (VLV_DISPLAY_BASE + 0x61300)
6536−#define PIPEB_PP_CONTROL (VLV_DISPLAY_BASE + 0x61304)
6537−#define PIPEB_PP_ON_DELAYS (VLV_DISPLAY_BASE + 0x61308)
6538−#define PIPEB_PP_OFF_DELAYS (VLV_DISPLAY_BASE + 0x6130c)
6539−#define PIPEB_PP_DIVISOR (VLV_DISPLAY_BASE + 0x61310)
6540−
6541−#define VLV_PIPE_PP_STATUS(pipe) _PIPE(pipe, PIPEA_PP_STATUS, PIPEB_PP_STATUS)
6542−#define VLV_PIPE_PP_CONTROL(pipe) _PIPE(pipe, PIPEA_PP_CONTROL, PIPEB_PP_CONTROL)
6543−#define VLV_PIPE_PP_ON_DELAYS(pipe) \
6544− _PIPE(pipe, PIPEA_PP_ON_DELAYS, PIPEB_PP_ON_DELAYS)
6545−#define VLV_PIPE_PP_OFF_DELAYS(pipe) \
6546− _PIPE(pipe, PIPEA_PP_OFF_DELAYS, PIPEB_PP_OFF_DELAYS)
6547−#define VLV_PIPE_PP_DIVISOR(pipe) \
6548− _PIPE(pipe, PIPEA_PP_DIVISOR, PIPEB_PP_DIVISOR)
6549−
6550−#define PCH_PP_STATUS 0xc7200
6551−#define PCH_PP_CONTROL 0xc7204
6596+#define _PIPEA_PP_OFF_DELAYS (VLV_DISPLAY_BASE + 0x6120c)
6597+#define _PIPEA_PP_DIVISOR (VLV_DISPLAY_BASE + 0x61210)
6598+
6599+#define _PIPEB_PP_STATUS (VLV_DISPLAY_BASE + 0x61300)
6600+#define _PIPEB_PP_CONTROL (VLV_DISPLAY_BASE + 0x61304)
6601+#define _PIPEB_PP_ON_DELAYS (VLV_DISPLAY_BASE + 0x61308)
6602+#define _PIPEB_PP_OFF_DELAYS (VLV_DISPLAY_BASE + 0x6130c)
6603+#define _PIPEB_PP_DIVISOR (VLV_DISPLAY_BASE + 0x61310)
6604+
6605+#define VLV_PIPE_PP_STATUS(pipe) _MMIO_PIPE(pipe, _PIPEA_PP_STATUS, _PIPEB_PP_STATUS)
6606+#define VLV_PIPE_PP_CONTROL(pipe) _MMIO_PIPE(pipe, _PIPEA_PP_CONTROL, _PIPEB_PP_CONTROL)
6607+#define VLV_PIPE_PP_ON_DELAYS(pipe) _MMIO_PIPE(pipe, _PIPEA_PP_ON_DELAYS, _PIPEB_PP_ON_DELAYS)
6608+#define VLV_PIPE_PP_OFF_DELAYS(pipe) _MMIO_PIPE(pipe, _PIPEA_PP_OFF_DELAYS, _PIPEB_PP_OFF_DELAYS)
6609+#define VLV_PIPE_PP_DIVISOR(pipe) _MMIO_PIPE(pipe, _PIPEA_PP_DIVISOR, _PIPEB_PP_DIVISOR)
6610+
6611+#define _PCH_PP_STATUS 0xc7200
6612+#define _PCH_PP_CONTROL 0xc7204
65526613 #define PANEL_UNLOCK_REGS (0xabcd << 16)
65536614 #define PANEL_UNLOCK_MASK (0xffff << 16)
65546615 #define BXT_POWER_CYCLE_DELAY_MASK (0x1f0)
@@ -6558,7 +6619,7 @@ enum skl_disp_power_wells { · 3 unmodified lines
65586619 #define PANEL_POWER_RESET (1 << 1)
65596620 #define PANEL_POWER_OFF (0 << 0)
65606621 #define PANEL_POWER_ON (1 << 0)
6561−#define PCH_PP_ON_DELAYS 0xc7208
6622+#define _PCH_PP_ON_DELAYS 0xc7208
65626623 #define PANEL_PORT_SELECT_MASK (3 << 30)
65636624 #define PANEL_PORT_SELECT_LVDS (0 << 30)
65646625 #define PANEL_PORT_SELECT_DPA (1 << 30)
@@ -6569,52 +6630,64 @@ enum skl_disp_power_wells { · 4 unmodified lines
65696630 #define PANEL_LIGHT_ON_DELAY_MASK (0x1fff)
65706631 #define PANEL_LIGHT_ON_DELAY_SHIFT 0
65716632
6572−#define PCH_PP_OFF_DELAYS 0xc720c
6633+#define _PCH_PP_OFF_DELAYS 0xc720c
65736634 #define PANEL_POWER_DOWN_DELAY_MASK (0x1fff0000)
65746635 #define PANEL_POWER_DOWN_DELAY_SHIFT 16
65756636 #define PANEL_LIGHT_OFF_DELAY_MASK (0x1fff)
65766637 #define PANEL_LIGHT_OFF_DELAY_SHIFT 0
65776638
6578−#define PCH_PP_DIVISOR 0xc7210
6639+#define _PCH_PP_DIVISOR 0xc7210
65796640 #define PP_REFERENCE_DIVIDER_MASK (0xffffff00)
65806641 #define PP_REFERENCE_DIVIDER_SHIFT 8
65816642 #define PANEL_POWER_CYCLE_DELAY_MASK (0x1f)
65826643 #define PANEL_POWER_CYCLE_DELAY_SHIFT 0
65836644
6645+#define PCH_PP_STATUS _MMIO(_PCH_PP_STATUS)
6646+#define PCH_PP_CONTROL _MMIO(_PCH_PP_CONTROL)
6647+#define PCH_PP_ON_DELAYS _MMIO(_PCH_PP_ON_DELAYS)
6648+#define PCH_PP_OFF_DELAYS _MMIO(_PCH_PP_OFF_DELAYS)
6649+#define PCH_PP_DIVISOR _MMIO(_PCH_PP_DIVISOR)
6650+
65846651 /* BXT PPS changes - 2nd set of PPS registers */
65856652 #define _BXT_PP_STATUS2 0xc7300
65866653 #define _BXT_PP_CONTROL2 0xc7304
65876654 #define _BXT_PP_ON_DELAYS2 0xc7308
65886655 #define _BXT_PP_OFF_DELAYS2 0xc730c
65896656
6590−#define BXT_PP_STATUS(n) _PIPE(n, PCH_PP_STATUS, _BXT_PP_STATUS2)
6591−#define BXT_PP_CONTROL(n) _PIPE(n, PCH_PP_CONTROL, _BXT_PP_CONTROL2)
6592−#define BXT_PP_ON_DELAYS(n) _PIPE(n, PCH_PP_ON_DELAYS, _BXT_PP_ON_DELAYS2)
6593−#define BXT_PP_OFF_DELAYS(n) _PIPE(n, PCH_PP_OFF_DELAYS, _BXT_PP_OFF_DELAYS2)
6594−
6595−#define PCH_DP_B 0xe4100
6596−#define PCH_DPB_AUX_CH_CTL 0xe4110
6597−#define PCH_DPB_AUX_CH_DATA1 0xe4114
6598−#define PCH_DPB_AUX_CH_DATA2 0xe4118
6599−#define PCH_DPB_AUX_CH_DATA3 0xe411c
6600−#define PCH_DPB_AUX_CH_DATA4 0xe4120
6601−#define PCH_DPB_AUX_CH_DATA5 0xe4124
6602−
6603−#define PCH_DP_C 0xe4200
6604−#define PCH_DPC_AUX_CH_CTL 0xe4210
6605−#define PCH_DPC_AUX_CH_DATA1 0xe4214
6606−#define PCH_DPC_AUX_CH_DATA2 0xe4218
6607−#define PCH_DPC_AUX_CH_DATA3 0xe421c
6608−#define PCH_DPC_AUX_CH_DATA4 0xe4220
6609−#define PCH_DPC_AUX_CH_DATA5 0xe4224
6610−
6611−#define PCH_DP_D 0xe4300
6612−#define PCH_DPD_AUX_CH_CTL 0xe4310
6613−#define PCH_DPD_AUX_CH_DATA1 0xe4314
6614−#define PCH_DPD_AUX_CH_DATA2 0xe4318
6615−#define PCH_DPD_AUX_CH_DATA3 0xe431c
6616−#define PCH_DPD_AUX_CH_DATA4 0xe4320
6617−#define PCH_DPD_AUX_CH_DATA5 0xe4324
6657+#define BXT_PP_STATUS(n) _MMIO_PIPE(n, _PCH_PP_STATUS, _BXT_PP_STATUS2)
6658+#define BXT_PP_CONTROL(n) _MMIO_PIPE(n, _PCH_PP_CONTROL, _BXT_PP_CONTROL2)
6659+#define BXT_PP_ON_DELAYS(n) _MMIO_PIPE(n, _PCH_PP_ON_DELAYS, _BXT_PP_ON_DELAYS2)
6660+#define BXT_PP_OFF_DELAYS(n) _MMIO_PIPE(n, _PCH_PP_OFF_DELAYS, _BXT_PP_OFF_DELAYS2)
6661+
6662+#define _PCH_DP_B 0xe4100
6663+#define PCH_DP_B _MMIO(_PCH_DP_B)
6664+#define _PCH_DPB_AUX_CH_CTL 0xe4110
6665+#define _PCH_DPB_AUX_CH_DATA1 0xe4114
6666+#define _PCH_DPB_AUX_CH_DATA2 0xe4118
6667+#define _PCH_DPB_AUX_CH_DATA3 0xe411c
6668+#define _PCH_DPB_AUX_CH_DATA4 0xe4120
6669+#define _PCH_DPB_AUX_CH_DATA5 0xe4124
6670+
6671+#define _PCH_DP_C 0xe4200
6672+#define PCH_DP_C _MMIO(_PCH_DP_C)
6673+#define _PCH_DPC_AUX_CH_CTL 0xe4210
6674+#define _PCH_DPC_AUX_CH_DATA1 0xe4214
6675+#define _PCH_DPC_AUX_CH_DATA2 0xe4218
6676+#define _PCH_DPC_AUX_CH_DATA3 0xe421c
6677+#define _PCH_DPC_AUX_CH_DATA4 0xe4220
6678+#define _PCH_DPC_AUX_CH_DATA5 0xe4224
6679+
6680+#define _PCH_DP_D 0xe4300
6681+#define PCH_DP_D _MMIO(_PCH_DP_D)
6682+#define _PCH_DPD_AUX_CH_CTL 0xe4310
6683+#define _PCH_DPD_AUX_CH_DATA1 0xe4314
6684+#define _PCH_DPD_AUX_CH_DATA2 0xe4318
6685+#define _PCH_DPD_AUX_CH_DATA3 0xe431c
6686+#define _PCH_DPD_AUX_CH_DATA4 0xe4320
6687+#define _PCH_DPD_AUX_CH_DATA5 0xe4324
6688+
6689+#define PCH_DP_AUX_CH_CTL(port) _MMIO_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_CTL, _PCH_DPC_AUX_CH_CTL)
6690+#define PCH_DP_AUX_CH_DATA(port, i) _MMIO(_PORT((port) - PORT_B, _PCH_DPB_AUX_CH_DATA1, _PCH_DPC_AUX_CH_DATA1) + (i) * 4) /* 5 registers */
66186691
66196692 /* CPT */
66206693 #define PORT_TRANS_A_SEL_CPT 0
@@ -6627,10 +6700,10 @@ enum skl_disp_power_wells { · 6 unmodified lines
66276700 #define SDVO_PORT_TO_PIPE_CHV(val) (((val) & (3<<24)) >> 24)
66286701 #define DP_PORT_TO_PIPE_CHV(val) (((val) & (3<<16)) >> 16)
66296702
6630−#define TRANS_DP_CTL_A 0xe0300
6631−#define TRANS_DP_CTL_B 0xe1300
6632−#define TRANS_DP_CTL_C 0xe2300
6633−#define TRANS_DP_CTL(pipe) _PIPE(pipe, TRANS_DP_CTL_A, TRANS_DP_CTL_B)
6703+#define _TRANS_DP_CTL_A 0xe0300
6704+#define _TRANS_DP_CTL_B 0xe1300
6705+#define _TRANS_DP_CTL_C 0xe2300
6706+#define TRANS_DP_CTL(pipe) _MMIO_PIPE(pipe, _TRANS_DP_CTL_A, _TRANS_DP_CTL_B)
66346707 #define TRANS_DP_OUTPUT_ENABLE (1<<31)
66356708 #define TRANS_DP_PORT_SEL_B (0<<29)
66366709 #define TRANS_DP_PORT_SEL_C (1<<29)
@@ -6683,40 +6756,40 @@ enum skl_disp_power_wells { · 46 unmodified lines
66836756
66846757 #define EDP_LINK_TRAIN_VOL_EMP_MASK_IVB (0x3f<<22)
66856758
6686−#define VLV_PMWGICZ 0x1300a4
6759+#define VLV_PMWGICZ _MMIO(0x1300a4)
66876760
6688−#define FORCEWAKE 0xA18C
6689−#define FORCEWAKE_VLV 0x1300b0
6690−#define FORCEWAKE_ACK_VLV 0x1300b4
6691−#define FORCEWAKE_MEDIA_VLV 0x1300b8
6692−#define FORCEWAKE_ACK_MEDIA_VLV 0x1300bc
6693−#define FORCEWAKE_ACK_HSW 0x130044
6694−#define FORCEWAKE_ACK 0x130090
6695−#define VLV_GTLC_WAKE_CTRL 0x130090
6761+#define FORCEWAKE _MMIO(0xA18C)
6762+#define FORCEWAKE_VLV _MMIO(0x1300b0)
6763+#define FORCEWAKE_ACK_VLV _MMIO(0x1300b4)
6764+#define FORCEWAKE_MEDIA_VLV _MMIO(0x1300b8)
6765+#define FORCEWAKE_ACK_MEDIA_VLV _MMIO(0x1300bc)
6766+#define FORCEWAKE_ACK_HSW _MMIO(0x130044)
6767+#define FORCEWAKE_ACK _MMIO(0x130090)
6768+#define VLV_GTLC_WAKE_CTRL _MMIO(0x130090)
66966769 #define VLV_GTLC_RENDER_CTX_EXISTS (1 << 25)
66976770 #define VLV_GTLC_MEDIA_CTX_EXISTS (1 << 24)
66986771 #define VLV_GTLC_ALLOWWAKEREQ (1 << 0)
66996772
6700−#define VLV_GTLC_PW_STATUS 0x130094
6773+#define VLV_GTLC_PW_STATUS _MMIO(0x130094)
67016774 #define VLV_GTLC_ALLOWWAKEACK (1 << 0)
67026775 #define VLV_GTLC_ALLOWWAKEERR (1 << 1)
67036776 #define VLV_GTLC_PW_MEDIA_STATUS_MASK (1 << 5)
67046777 #define VLV_GTLC_PW_RENDER_STATUS_MASK (1 << 7)
6705−#define FORCEWAKE_MT 0xa188 /* multi-threaded */
6706−#define FORCEWAKE_MEDIA_GEN9 0xa270
6707−#define FORCEWAKE_RENDER_GEN9 0xa278
6708−#define FORCEWAKE_BLITTER_GEN9 0xa188
6709−#define FORCEWAKE_ACK_MEDIA_GEN9 0x0D88
6710−#define FORCEWAKE_ACK_RENDER_GEN9 0x0D84
6711−#define FORCEWAKE_ACK_BLITTER_GEN9 0x130044
6778+#define FORCEWAKE_MT _MMIO(0xa188) /* multi-threaded */
6779+#define FORCEWAKE_MEDIA_GEN9 _MMIO(0xa270)
6780+#define FORCEWAKE_RENDER_GEN9 _MMIO(0xa278)
6781+#define FORCEWAKE_BLITTER_GEN9 _MMIO(0xa188)
6782+#define FORCEWAKE_ACK_MEDIA_GEN9 _MMIO(0x0D88)
6783+#define FORCEWAKE_ACK_RENDER_GEN9 _MMIO(0x0D84)
6784+#define FORCEWAKE_ACK_BLITTER_GEN9 _MMIO(0x130044)
67126785 #define FORCEWAKE_KERNEL 0x1
67136786 #define FORCEWAKE_USER 0x2
6714−#define FORCEWAKE_MT_ACK 0x130040
6715−#define ECOBUS 0xa180
6787+#define FORCEWAKE_MT_ACK _MMIO(0x130040)
6788+#define ECOBUS _MMIO(0xa180)
67166789 #define FORCEWAKE_MT_ENABLE (1<<5)
6717−#define VLV_SPAREG2H 0xA194
6790+#define VLV_SPAREG2H _MMIO(0xA194)
67186791
6719−#define GTFIFODBG 0x120000
6792+#define GTFIFODBG _MMIO(0x120000)
67206793 #define GT_FIFO_SBDROPERR (1<<6)
67216794 #define GT_FIFO_BLOBDROPERR (1<<5)
67226795 #define GT_FIFO_SB_READ_ABORTERR (1<<4)
@@ -6725,23 +6798,23 @@ enum skl_disp_power_wells { · 2 unmodified lines
67256798 #define GT_FIFO_IAWRERR (1<<1)
67266799 #define GT_FIFO_IARDERR (1<<0)
67276800
6728−#define GTFIFOCTL 0x120008
6801+#define GTFIFOCTL _MMIO(0x120008)
67296802 #define GT_FIFO_FREE_ENTRIES_MASK 0x7f
67306803 #define GT_FIFO_NUM_RESERVED_ENTRIES 20
67316804 #define GT_FIFO_CTL_BLOCK_ALL_POLICY_STALL (1 << 12)
67326805 #define GT_FIFO_CTL_RC6_POLICY_STALL (1 << 11)
67336806
6734−#define HSW_IDICR 0x9008
6807+#define HSW_IDICR _MMIO(0x9008)
67356808 #define IDIHASHMSK(x) (((x) & 0x3f) << 16)
6736−#define HSW_EDRAM_PRESENT 0x120010
6809+#define HSW_EDRAM_PRESENT _MMIO(0x120010)
67376810 #define EDRAM_ENABLED 0x1
67386811
6739−#define GEN6_UCGCTL1 0x9400
6812+#define GEN6_UCGCTL1 _MMIO(0x9400)
67406813 # define GEN6_EU_TCUNIT_CLOCK_GATE_DISABLE (1 << 16)
67416814 # define GEN6_BLBUNIT_CLOCK_GATE_DISABLE (1 << 5)
67426815 # define GEN6_CSUNIT_CLOCK_GATE_DISABLE (1 << 7)
67436816
6744−#define GEN6_UCGCTL2 0x9404
6817+#define GEN6_UCGCTL2 _MMIO(0x9404)
67456818 # define GEN6_VFUNIT_CLOCK_GATE_DISABLE (1 << 31)
67466819 # define GEN7_VDSUNIT_CLOCK_GATE_DISABLE (1 << 30)
67476820 # define GEN7_TDLUNIT_CLOCK_GATE_DISABLE (1 << 22)
@@ -6749,30 +6822,30 @@ enum skl_disp_power_wells { · 1 unmodified line
67496822 # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12)
67506823 # define GEN6_RCCUNIT_CLOCK_GATE_DISABLE (1 << 11)
67516824
6752−#define GEN6_UCGCTL3 0x9408
6825+#define GEN6_UCGCTL3 _MMIO(0x9408)
67536826
6754−#define GEN7_UCGCTL4 0x940c
6827+#define GEN7_UCGCTL4 _MMIO(0x940c)
67556828 #define GEN7_L3BANK2X_CLOCK_GATE_DISABLE (1<<25)
67566829
6757−#define GEN6_RCGCTL1 0x9410
6758−#define GEN6_RCGCTL2 0x9414
6759−#define GEN6_RSTCTL 0x9420
6830+#define GEN6_RCGCTL1 _MMIO(0x9410)
6831+#define GEN6_RCGCTL2 _MMIO(0x9414)
6832+#define GEN6_RSTCTL _MMIO(0x9420)
67606833
6761−#define GEN8_UCGCTL6 0x9430
6834+#define GEN8_UCGCTL6 _MMIO(0x9430)
67626835 #define GEN8_GAPSUNIT_CLOCK_GATE_DISABLE (1<<24)
67636836 #define GEN8_SDEUNIT_CLOCK_GATE_DISABLE (1<<14)
67646837 #define GEN8_HDCUNIT_CLOCK_GATE_DISABLE_HDCREQ (1<<28)
67656838
6766−#define GEN6_GFXPAUSE 0xA000
6767−#define GEN6_RPNSWREQ 0xA008
6839+#define GEN6_GFXPAUSE _MMIO(0xA000)
6840+#define GEN6_RPNSWREQ _MMIO(0xA008)
67686841 #define GEN6_TURBO_DISABLE (1<<31)
67696842 #define GEN6_FREQUENCY(x) ((x)<<25)
67706843 #define HSW_FREQUENCY(x) ((x)<<24)
67716844 #define GEN9_FREQUENCY(x) ((x)<<23)
67726845 #define GEN6_OFFSET(x) ((x)<<19)
67736846 #define GEN6_AGGRESSIVE_TURBO (0<<15)
6774−#define GEN6_RC_VIDEO_FREQ 0xA00C
6775−#define GEN6_RC_CONTROL 0xA090
6847+#define GEN6_RC_VIDEO_FREQ _MMIO(0xA00C)
6848+#define GEN6_RC_CONTROL _MMIO(0xA090)
67766849 #define GEN6_RC_CTL_RC6pp_ENABLE (1<<16)
67776850 #define GEN6_RC_CTL_RC6p_ENABLE (1<<17)
67786851 #define GEN6_RC_CTL_RC6_ENABLE (1<<18)
@@ -6782,16 +6855,16 @@ enum skl_disp_power_wells { · 3 unmodified lines
67826855 #define GEN7_RC_CTL_TO_MODE (1<<28)
67836856 #define GEN6_RC_CTL_EI_MODE(x) ((x)<<27)
67846857 #define GEN6_RC_CTL_HW_ENABLE (1<<31)
6785−#define GEN6_RP_DOWN_TIMEOUT 0xA010
6786−#define GEN6_RP_INTERRUPT_LIMITS 0xA014
6787−#define GEN6_RPSTAT1 0xA01C
6858+#define GEN6_RP_DOWN_TIMEOUT _MMIO(0xA010)
6859+#define GEN6_RP_INTERRUPT_LIMITS _MMIO(0xA014)
6860+#define GEN6_RPSTAT1 _MMIO(0xA01C)
67886861 #define GEN6_CAGF_SHIFT 8
67896862 #define HSW_CAGF_SHIFT 7
67906863 #define GEN9_CAGF_SHIFT 23
67916864 #define GEN6_CAGF_MASK (0x7f << GEN6_CAGF_SHIFT)
67926865 #define HSW_CAGF_MASK (0x7f << HSW_CAGF_SHIFT)
67936866 #define GEN9_CAGF_MASK (0x1ff << GEN9_CAGF_SHIFT)
6794−#define GEN6_RP_CONTROL 0xA024
6867+#define GEN6_RP_CONTROL _MMIO(0xA024)
67956868 #define GEN6_RP_MEDIA_TURBO (1<<11)
67966869 #define GEN6_RP_MEDIA_MODE_MASK (3<<9)
67976870 #define GEN6_RP_MEDIA_HW_TURBO_MODE (3<<9)
@@ -6805,53 +6878,53 @@ enum skl_disp_power_wells { · 7 unmodified lines
68056878 #define GEN6_RP_UP_BUSY_CONT (0x4<<3)
68066879 #define GEN6_RP_DOWN_IDLE_AVG (0x2<<0)
68076880 #define GEN6_RP_DOWN_IDLE_CONT (0x1<<0)
6808−#define GEN6_RP_UP_THRESHOLD 0xA02C
6809−#define GEN6_RP_DOWN_THRESHOLD 0xA030
6810−#define GEN6_RP_CUR_UP_EI 0xA050
6881+#define GEN6_RP_UP_THRESHOLD _MMIO(0xA02C)
6882+#define GEN6_RP_DOWN_THRESHOLD _MMIO(0xA030)
6883+#define GEN6_RP_CUR_UP_EI _MMIO(0xA050)
68116884 #define GEN6_CURICONT_MASK 0xffffff
6812−#define GEN6_RP_CUR_UP 0xA054
6885+#define GEN6_RP_CUR_UP _MMIO(0xA054)
68136886 #define GEN6_CURBSYTAVG_MASK 0xffffff
6814−#define GEN6_RP_PREV_UP 0xA058
6815−#define GEN6_RP_CUR_DOWN_EI 0xA05C
6887+#define GEN6_RP_PREV_UP _MMIO(0xA058)
6888+#define GEN6_RP_CUR_DOWN_EI _MMIO(0xA05C)
68166889 #define GEN6_CURIAVG_MASK 0xffffff
6817−#define GEN6_RP_CUR_DOWN 0xA060
6818−#define GEN6_RP_PREV_DOWN 0xA064
6819−#define GEN6_RP_UP_EI 0xA068
6820−#define GEN6_RP_DOWN_EI 0xA06C
6821−#define GEN6_RP_IDLE_HYSTERSIS 0xA070
6822−#define GEN6_RPDEUHWTC 0xA080
6823−#define GEN6_RPDEUC 0xA084
6824−#define GEN6_RPDEUCSW 0xA088
6825−#define GEN6_RC_STATE 0xA094
6826−#define GEN6_RC1_WAKE_RATE_LIMIT 0xA098
6827−#define GEN6_RC6_WAKE_RATE_LIMIT 0xA09C
6828−#define GEN6_RC6pp_WAKE_RATE_LIMIT 0xA0A0
6829−#define GEN6_RC_EVALUATION_INTERVAL 0xA0A8
6830−#define GEN6_RC_IDLE_HYSTERSIS 0xA0AC
6831−#define GEN6_RC_SLEEP 0xA0B0
6832−#define GEN6_RCUBMABDTMR 0xA0B0
6833−#define GEN6_RC1e_THRESHOLD 0xA0B4
6834−#define GEN6_RC6_THRESHOLD 0xA0B8
6835−#define GEN6_RC6p_THRESHOLD 0xA0BC
6836−#define VLV_RCEDATA 0xA0BC
6837−#define GEN6_RC6pp_THRESHOLD 0xA0C0
6838−#define GEN6_PMINTRMSK 0xA168
6890+#define GEN6_RP_CUR_DOWN _MMIO(0xA060)
6891+#define GEN6_RP_PREV_DOWN _MMIO(0xA064)
6892+#define GEN6_RP_UP_EI _MMIO(0xA068)
6893+#define GEN6_RP_DOWN_EI _MMIO(0xA06C)
6894+#define GEN6_RP_IDLE_HYSTERSIS _MMIO(0xA070)
6895+#define GEN6_RPDEUHWTC _MMIO(0xA080)
6896+#define GEN6_RPDEUC _MMIO(0xA084)
6897+#define GEN6_RPDEUCSW _MMIO(0xA088)
6898+#define GEN6_RC_STATE _MMIO(0xA094)
6899+#define GEN6_RC1_WAKE_RATE_LIMIT _MMIO(0xA098)
6900+#define GEN6_RC6_WAKE_RATE_LIMIT _MMIO(0xA09C)
6901+#define GEN6_RC6pp_WAKE_RATE_LIMIT _MMIO(0xA0A0)
6902+#define GEN6_RC_EVALUATION_INTERVAL _MMIO(0xA0A8)
6903+#define GEN6_RC_IDLE_HYSTERSIS _MMIO(0xA0AC)
6904+#define GEN6_RC_SLEEP _MMIO(0xA0B0)
6905+#define GEN6_RCUBMABDTMR _MMIO(0xA0B0)
6906+#define GEN6_RC1e_THRESHOLD _MMIO(0xA0B4)
6907+#define GEN6_RC6_THRESHOLD _MMIO(0xA0B8)
6908+#define GEN6_RC6p_THRESHOLD _MMIO(0xA0BC)
6909+#define VLV_RCEDATA _MMIO(0xA0BC)
6910+#define GEN6_RC6pp_THRESHOLD _MMIO(0xA0C0)
6911+#define GEN6_PMINTRMSK _MMIO(0xA168)
68396912 #define GEN8_PMINTR_REDIRECT_TO_NON_DISP (1<<31)
6840−#define VLV_PWRDWNUPCTL 0xA294
6841−#define GEN9_MEDIA_PG_IDLE_HYSTERESIS 0xA0C4
6842−#define GEN9_RENDER_PG_IDLE_HYSTERESIS 0xA0C8
6843−#define GEN9_PG_ENABLE 0xA210
6913+#define VLV_PWRDWNUPCTL _MMIO(0xA294)
6914+#define GEN9_MEDIA_PG_IDLE_HYSTERESIS _MMIO(0xA0C4)
6915+#define GEN9_RENDER_PG_IDLE_HYSTERESIS _MMIO(0xA0C8)
6916+#define GEN9_PG_ENABLE _MMIO(0xA210)
68446917 #define GEN9_RENDER_PG_ENABLE (1<<0)
68456918 #define GEN9_MEDIA_PG_ENABLE (1<<1)
68466919
6847−#define VLV_CHICKEN_3 (VLV_DISPLAY_BASE + 0x7040C)
6920+#define VLV_CHICKEN_3 _MMIO(VLV_DISPLAY_BASE + 0x7040C)
68486921 #define PIXEL_OVERLAP_CNT_MASK (3 << 30)
68496922 #define PIXEL_OVERLAP_CNT_SHIFT 30
68506923
6851−#define GEN6_PMISR 0x44020
6852−#define GEN6_PMIMR 0x44024 /* rps_lock */
6853−#define GEN6_PMIIR 0x44028
6854−#define GEN6_PMIER 0x4402C
6924+#define GEN6_PMISR _MMIO(0x44020)
6925+#define GEN6_PMIMR _MMIO(0x44024) /* rps_lock */
6926+#define GEN6_PMIIR _MMIO(0x44028)
6927+#define GEN6_PMIER _MMIO(0x4402C)
68556928 #define GEN6_PM_MBOX_EVENT (1<<25)
68566929 #define GEN6_PM_THERMAL_EVENT (1<<24)
68576930 #define GEN6_PM_RP_DOWN_TIMEOUT (1<<6)
@@ -6863,30 +6936,30 @@ enum skl_disp_power_wells { · 5 unmodified lines
68636936 GEN6_PM_RP_DOWN_THRESHOLD | \
68646937 GEN6_PM_RP_DOWN_TIMEOUT)
68656938
6866−#define GEN7_GT_SCRATCH(i) (0x4F100 + (i) * 4)
6939+#define GEN7_GT_SCRATCH(i) _MMIO(0x4F100 + (i) * 4)
68676940 #define GEN7_GT_SCRATCH_REG_NUM 8
68686941
6869−#define VLV_GTLC_SURVIVABILITY_REG 0x130098
6942+#define VLV_GTLC_SURVIVABILITY_REG _MMIO(0x130098)
68706943 #define VLV_GFX_CLK_STATUS_BIT (1<<3)
68716944 #define VLV_GFX_CLK_FORCE_ON_BIT (1<<2)
68726945
6873−#define GEN6_GT_GFX_RC6_LOCKED 0x138104
6874−#define VLV_COUNTER_CONTROL 0x138104
6946+#define GEN6_GT_GFX_RC6_LOCKED _MMIO(0x138104)
6947+#define VLV_COUNTER_CONTROL _MMIO(0x138104)
68756948 #define VLV_COUNT_RANGE_HIGH (1<<15)
68766949 #define VLV_MEDIA_RC0_COUNT_EN (1<<5)
68776950 #define VLV_RENDER_RC0_COUNT_EN (1<<4)
68786951 #define VLV_MEDIA_RC6_COUNT_EN (1<<1)
68796952 #define VLV_RENDER_RC6_COUNT_EN (1<<0)
6880−#define GEN6_GT_GFX_RC6 0x138108
6881−#define VLV_GT_RENDER_RC6 0x138108
6882−#define VLV_GT_MEDIA_RC6 0x13810C
6953+#define GEN6_GT_GFX_RC6 _MMIO(0x138108)
6954+#define VLV_GT_RENDER_RC6 _MMIO(0x138108)
6955+#define VLV_GT_MEDIA_RC6 _MMIO(0x13810C)
68836956
6884−#define GEN6_GT_GFX_RC6p 0x13810C
6885−#define GEN6_GT_GFX_RC6pp 0x138110
6886−#define VLV_RENDER_C0_COUNT 0x138118
6887−#define VLV_MEDIA_C0_COUNT 0x13811C
6957+#define GEN6_GT_GFX_RC6p _MMIO(0x13810C)
6958+#define GEN6_GT_GFX_RC6pp _MMIO(0x138110)
6959+#define VLV_RENDER_C0_COUNT _MMIO(0x138118)
6960+#define VLV_MEDIA_C0_COUNT _MMIO(0x13811C)
68886961
6889−#define GEN6_PCODE_MAILBOX 0x138124
6962+#define GEN6_PCODE_MAILBOX _MMIO(0x138124)
68906963 #define GEN6_PCODE_READY (1<<31)
68916964 #define GEN6_PCODE_WRITE_RC6VIDS 0x4
68926965 #define GEN6_PCODE_READ_RC6VIDS 0x5
@@ -6909,12 +6982,12 @@ enum skl_disp_power_wells { · 16 unmodified lines
69096982 #define HSW_PCODE_DE_WRITE_FREQ_REQ 0x17
69106983 #define DISPLAY_IPS_CONTROL 0x19
69116984 #define HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL 0x1A
6912−#define GEN6_PCODE_DATA 0x138128
6985+#define GEN6_PCODE_DATA _MMIO(0x138128)
69136986 #define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8
69146987 #define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16
6915−#define GEN6_PCODE_DATA1 0x13812C
6988+#define GEN6_PCODE_DATA1 _MMIO(0x13812C)
69166989
6917−#define GEN6_GT_CORE_STATUS 0x138060
6990+#define GEN6_GT_CORE_STATUS _MMIO(0x138060)
69186991 #define GEN6_CORE_CPD_STATE_MASK (7<<4)
69196992 #define GEN6_RCn_MASK 7
69206993 #define GEN6_RC0 0
@@ -6922,26 +6995,26 @@ enum skl_disp_power_wells { · 1 unmodified line
69226995 #define GEN6_RC6 3
69236996 #define GEN6_RC7 4
69246997
6925−#define GEN8_GT_SLICE_INFO 0x138064
6998+#define GEN8_GT_SLICE_INFO _MMIO(0x138064)
69266999 #define GEN8_LSLICESTAT_MASK 0x7
69277000
6928−#define CHV_POWER_SS0_SIG1 0xa720
6929−#define CHV_POWER_SS1_SIG1 0xa728
7001+#define CHV_POWER_SS0_SIG1 _MMIO(0xa720)
7002+#define CHV_POWER_SS1_SIG1 _MMIO(0xa728)
69307003 #define CHV_SS_PG_ENABLE (1<<1)
69317004 #define CHV_EU08_PG_ENABLE (1<<9)
69327005 #define CHV_EU19_PG_ENABLE (1<<17)
69337006 #define CHV_EU210_PG_ENABLE (1<<25)
69347007
6935−#define CHV_POWER_SS0_SIG2 0xa724
6936−#define CHV_POWER_SS1_SIG2 0xa72c
7008+#define CHV_POWER_SS0_SIG2 _MMIO(0xa724)
7009+#define CHV_POWER_SS1_SIG2 _MMIO(0xa72c)
69377010 #define CHV_EU311_PG_ENABLE (1<<1)
69387011
6939−#define GEN9_SLICE_PGCTL_ACK(slice) (0x804c + (slice)*0x4)
7012+#define GEN9_SLICE_PGCTL_ACK(slice) _MMIO(0x804c + (slice)*0x4)
69407013 #define GEN9_PGCTL_SLICE_ACK (1 << 0)
69417014 #define GEN9_PGCTL_SS_ACK(subslice) (1 << (2 + (subslice)*2))
69427015
6943−#define GEN9_SS01_EU_PGCTL_ACK(slice) (0x805c + (slice)*0x8)
6944−#define GEN9_SS23_EU_PGCTL_ACK(slice) (0x8060 + (slice)*0x8)
7016+#define GEN9_SS01_EU_PGCTL_ACK(slice) _MMIO(0x805c + (slice)*0x8)
7017+#define GEN9_SS23_EU_PGCTL_ACK(slice) _MMIO(0x8060 + (slice)*0x8)
69457018 #define GEN9_PGCTL_SSA_EU08_ACK (1 << 0)
69467019 #define GEN9_PGCTL_SSA_EU19_ACK (1 << 2)
69477020 #define GEN9_PGCTL_SSA_EU210_ACK (1 << 4)
@@ -6951,18 +7024,17 @@ enum skl_disp_power_wells { · 3 unmodified lines
69517024 #define GEN9_PGCTL_SSB_EU210_ACK (1 << 12)
69527025 #define GEN9_PGCTL_SSB_EU311_ACK (1 << 14)
69537026
6954−#define GEN7_MISCCPCTL (0x9424)
7027+#define GEN7_MISCCPCTL _MMIO(0x9424)
69557028 #define GEN7_DOP_CLOCK_GATE_ENABLE (1<<0)
69567029 #define GEN8_DOP_CLOCK_GATE_CFCLK_ENABLE (1<<2)
69577030 #define GEN8_DOP_CLOCK_GATE_GUC_ENABLE (1<<4)
69587031 #define GEN8_DOP_CLOCK_GATE_MEDIA_ENABLE (1<<6)
69597032
6960−#define GEN8_GARBCNTL 0xB004
7033+#define GEN8_GARBCNTL _MMIO(0xB004)
69617034 #define GEN9_GAPS_TSV_CREDIT_DISABLE (1<<7)
69627035
69637036 /* IVYBRIDGE DPF */
6964−#define GEN7_L3CDERRST1 0xB008 /* L3CD Error Status 1 */
6965−#define HSW_L3CDERRST11 0xB208 /* L3CD Error Status register 1 slice 1 */
7037+#define GEN7_L3CDERRST1(slice) _MMIO(0xB008 + (slice) * 0x200) /* L3CD Error Status 1 */
69667038 #define GEN7_L3CDERRST1_ROW_MASK (0x7ff<<14)
69677039 #define GEN7_PARITY_ERROR_VALID (1<<13)
69687040 #define GEN7_L3CDERRST1_BANK_MASK (3<<11)
@@ -6975,119 +7047,102 @@ enum skl_disp_power_wells { · 6 unmodified lines
69757047 ((reg & GEN7_L3CDERRST1_SUBBANK_MASK) >> 8)
69767048 #define GEN7_L3CDERRST1_ENABLE (1<<7)
69777049
6978−#define GEN7_L3LOG_BASE 0xB070
6979−#define HSW_L3LOG_BASE_SLICE1 0xB270
7050+#define GEN7_L3LOG(slice, i) _MMIO(0xB070 + (slice) * 0x200 + (i) * 4)
69807051 #define GEN7_L3LOG_SIZE 0x80
69817052
6982−#define GEN7_HALF_SLICE_CHICKEN1 0xe100 /* IVB GT1 + VLV */
6983−#define GEN7_HALF_SLICE_CHICKEN1_GT2 0xf100
7053+#define GEN7_HALF_SLICE_CHICKEN1 _MMIO(0xe100) /* IVB GT1 + VLV */
7054+#define GEN7_HALF_SLICE_CHICKEN1_GT2 _MMIO(0xf100)
69847055 #define GEN7_MAX_PS_THREAD_DEP (8<<12)
69857056 #define GEN7_SINGLE_SUBSCAN_DISPATCH_ENABLE (1<<10)
69867057 #define GEN7_SBE_SS_CACHE_DISPATCH_PORT_SHARING_DISABLE (1<<4)
69877058 #define GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE (1<<3)
69887059
6989−#define GEN9_HALF_SLICE_CHICKEN5 0xe188
7060+#define GEN9_HALF_SLICE_CHICKEN5 _MMIO(0xe188)
69907061 #define GEN9_DG_MIRROR_FIX_ENABLE (1<<5)
69917062 #define GEN9_CCS_TLB_PREFETCH_ENABLE (1<<3)
69927063
6993−#define GEN8_ROW_CHICKEN 0xe4f0
7064+#define GEN8_ROW_CHICKEN _MMIO(0xe4f0)
69947065 #define PARTIAL_INSTRUCTION_SHOOTDOWN_DISABLE (1<<8)
69957066 #define STALL_DOP_GATING_DISABLE (1<<5)
69967067
6997−#define GEN7_ROW_CHICKEN2 0xe4f4
6998−#define GEN7_ROW_CHICKEN2_GT2 0xf4f4
7068+#define GEN7_ROW_CHICKEN2 _MMIO(0xe4f4)
7069+#define GEN7_ROW_CHICKEN2_GT2 _MMIO(0xf4f4)
69997070 #define DOP_CLOCK_GATING_DISABLE (1<<0)
70007071
7001−#define HSW_ROW_CHICKEN3 0xe49c
7072+#define HSW_ROW_CHICKEN3 _MMIO(0xe49c)
70027073 #define HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE (1 << 6)
70037074
7004−#define HALF_SLICE_CHICKEN2 0xe180
7075+#define HALF_SLICE_CHICKEN2 _MMIO(0xe180)
70057076 #define GEN8_ST_PO_DISABLE (1<<13)
70067077
7007−#define HALF_SLICE_CHICKEN3 0xe184
7078+#define HALF_SLICE_CHICKEN3 _MMIO(0xe184)
70087079 #define HSW_SAMPLE_C_PERFORMANCE (1<<9)
70097080 #define GEN8_CENTROID_PIXEL_OPT_DIS (1<<8)
70107081 #define GEN9_DISABLE_OCL_OOB_SUPPRESS_LOGIC (1<<5)
70117082 #define GEN8_SAMPLER_POWER_BYPASS_DIS (1<<1)
70127083
7013−#define GEN9_HALF_SLICE_CHICKEN7 0xe194
7084+#define GEN9_HALF_SLICE_CHICKEN7 _MMIO(0xe194)
70147085 #define GEN9_ENABLE_YV12_BUGFIX (1<<4)
70157086
70167087 /* Audio */
7017−#define G4X_AUD_VID_DID (dev_priv->info.display_mmio_offset + 0x62020)
7088+#define G4X_AUD_VID_DID _MMIO(dev_priv->info.display_mmio_offset + 0x62020)
70187089 #define INTEL_AUDIO_DEVCL 0x808629FB
70197090 #define INTEL_AUDIO_DEVBLC 0x80862801
70207091 #define INTEL_AUDIO_DEVCTG 0x80862802
70217092
7022−#define G4X_AUD_CNTL_ST 0x620B4
7093+#define G4X_AUD_CNTL_ST _MMIO(0x620B4)
70237094 #define G4X_ELDV_DEVCL_DEVBLC (1 << 13)
70247095 #define G4X_ELDV_DEVCTG (1 << 14)
70257096 #define G4X_ELD_ADDR_MASK (0xf << 5)
70267097 #define G4X_ELD_ACK (1 << 4)
7027−#define G4X_HDMIW_HDMIEDID 0x6210C
7098+#define G4X_HDMIW_HDMIEDID _MMIO(0x6210C)
70287099
70297100 #define _IBX_HDMIW_HDMIEDID_A 0xE2050
70307101 #define _IBX_HDMIW_HDMIEDID_B 0xE2150
7031−#define IBX_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \
7032− _IBX_HDMIW_HDMIEDID_A, \
7033− _IBX_HDMIW_HDMIEDID_B)
7102+#define IBX_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _IBX_HDMIW_HDMIEDID_A, \
7103+ _IBX_HDMIW_HDMIEDID_B)
70347104 #define _IBX_AUD_CNTL_ST_A 0xE20B4
70357105 #define _IBX_AUD_CNTL_ST_B 0xE21B4
7036−#define IBX_AUD_CNTL_ST(pipe) _PIPE(pipe, \
7037− _IBX_AUD_CNTL_ST_A, \
7038− _IBX_AUD_CNTL_ST_B)
7106+#define IBX_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _IBX_AUD_CNTL_ST_A, \
7107+ _IBX_AUD_CNTL_ST_B)
70397108 #define IBX_ELD_BUFFER_SIZE_MASK (0x1f << 10)
70407109 #define IBX_ELD_ADDRESS_MASK (0x1f << 5)
70417110 #define IBX_ELD_ACK (1 << 4)
7042−#define IBX_AUD_CNTL_ST2 0xE20C0
7111+#define IBX_AUD_CNTL_ST2 _MMIO(0xE20C0)
70437112 #define IBX_CP_READY(port) ((1 << 1) << (((port) - 1) * 4))
70447113 #define IBX_ELD_VALID(port) ((1 << 0) << (((port) - 1) * 4))
70457114
70467115 #define _CPT_HDMIW_HDMIEDID_A 0xE5050
70477116 #define _CPT_HDMIW_HDMIEDID_B 0xE5150
7048−#define CPT_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \
7049− _CPT_HDMIW_HDMIEDID_A, \
7050− _CPT_HDMIW_HDMIEDID_B)
7117+#define CPT_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _CPT_HDMIW_HDMIEDID_A, _CPT_HDMIW_HDMIEDID_B)
70517118 #define _CPT_AUD_CNTL_ST_A 0xE50B4
70527119 #define _CPT_AUD_CNTL_ST_B 0xE51B4
7053−#define CPT_AUD_CNTL_ST(pipe) _PIPE(pipe, \
7054− _CPT_AUD_CNTL_ST_A, \
7055− _CPT_AUD_CNTL_ST_B)
7056−#define CPT_AUD_CNTRL_ST2 0xE50C0
7120+#define CPT_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _CPT_AUD_CNTL_ST_A, _CPT_AUD_CNTL_ST_B)
7121+#define CPT_AUD_CNTRL_ST2 _MMIO(0xE50C0)
70577122
70587123 #define _VLV_HDMIW_HDMIEDID_A (VLV_DISPLAY_BASE + 0x62050)
70597124 #define _VLV_HDMIW_HDMIEDID_B (VLV_DISPLAY_BASE + 0x62150)
7060−#define VLV_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \
7061− _VLV_HDMIW_HDMIEDID_A, \
7062− _VLV_HDMIW_HDMIEDID_B)
7125+#define VLV_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _VLV_HDMIW_HDMIEDID_A, _VLV_HDMIW_HDMIEDID_B)
70637126 #define _VLV_AUD_CNTL_ST_A (VLV_DISPLAY_BASE + 0x620B4)
70647127 #define _VLV_AUD_CNTL_ST_B (VLV_DISPLAY_BASE + 0x621B4)
7065−#define VLV_AUD_CNTL_ST(pipe) _PIPE(pipe, \
7066− _VLV_AUD_CNTL_ST_A, \
7067− _VLV_AUD_CNTL_ST_B)
7068−#define VLV_AUD_CNTL_ST2 (VLV_DISPLAY_BASE + 0x620C0)
7128+#define VLV_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _VLV_AUD_CNTL_ST_A, _VLV_AUD_CNTL_ST_B)
7129+#define VLV_AUD_CNTL_ST2 _MMIO(VLV_DISPLAY_BASE + 0x620C0)
70697130
70707131 /* These are the 4 32-bit write offset registers for each stream
70717132 * output buffer. It determines the offset from the
70727133 * 3DSTATE_SO_BUFFERs that the next streamed vertex output goes to.
70737134 */
7074−#define GEN7_SO_WRITE_OFFSET(n) (0x5280 + (n) * 4)
7135+#define GEN7_SO_WRITE_OFFSET(n) _MMIO(0x5280 + (n) * 4)
70757136
70767137 #define _IBX_AUD_CONFIG_A 0xe2000
70777138 #define _IBX_AUD_CONFIG_B 0xe2100
7078−#define IBX_AUD_CFG(pipe) _PIPE(pipe, \
7079− _IBX_AUD_CONFIG_A, \
7080− _IBX_AUD_CONFIG_B)
7139+#define IBX_AUD_CFG(pipe) _MMIO_PIPE(pipe, _IBX_AUD_CONFIG_A, _IBX_AUD_CONFIG_B)
70817140 #define _CPT_AUD_CONFIG_A 0xe5000
70827141 #define _CPT_AUD_CONFIG_B 0xe5100
7083−#define CPT_AUD_CFG(pipe) _PIPE(pipe, \
7084− _CPT_AUD_CONFIG_A, \
7085− _CPT_AUD_CONFIG_B)
7142+#define CPT_AUD_CFG(pipe) _MMIO_PIPE(pipe, _CPT_AUD_CONFIG_A, _CPT_AUD_CONFIG_B)
70867143 #define _VLV_AUD_CONFIG_A (VLV_DISPLAY_BASE + 0x62000)
70877144 #define _VLV_AUD_CONFIG_B (VLV_DISPLAY_BASE + 0x62100)
7088−#define VLV_AUD_CFG(pipe) _PIPE(pipe, \
7089− _VLV_AUD_CONFIG_A, \
7090− _VLV_AUD_CONFIG_B)
7145+#define VLV_AUD_CFG(pipe) _MMIO_PIPE(pipe, _VLV_AUD_CONFIG_A, _VLV_AUD_CONFIG_B)
70917146
70927147 #define AUD_CONFIG_N_VALUE_INDEX (1 << 29)
70937148 #define AUD_CONFIG_N_PROG_ENABLE (1 << 28)
@@ -7112,72 +7167,62 @@ enum skl_disp_power_wells { · 18 unmodified lines
71127167 /* HSW Audio */
71137168 #define _HSW_AUD_CONFIG_A 0x65000
71147169 #define _HSW_AUD_CONFIG_B 0x65100
7115−#define HSW_AUD_CFG(pipe) _PIPE(pipe, \
7116− _HSW_AUD_CONFIG_A, \
7117− _HSW_AUD_CONFIG_B)
7170+#define HSW_AUD_CFG(pipe) _MMIO_PIPE(pipe, _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B)
71187171
71197172 #define _HSW_AUD_MISC_CTRL_A 0x65010
71207173 #define _HSW_AUD_MISC_CTRL_B 0x65110
7121−#define HSW_AUD_MISC_CTRL(pipe) _PIPE(pipe, \
7122− _HSW_AUD_MISC_CTRL_A, \
7123− _HSW_AUD_MISC_CTRL_B)
7174+#define HSW_AUD_MISC_CTRL(pipe) _MMIO_PIPE(pipe, _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B)
71247175
71257176 #define _HSW_AUD_DIP_ELD_CTRL_ST_A 0x650b4
71267177 #define _HSW_AUD_DIP_ELD_CTRL_ST_B 0x651b4
7127−#define HSW_AUD_DIP_ELD_CTRL(pipe) _PIPE(pipe, \
7128− _HSW_AUD_DIP_ELD_CTRL_ST_A, \
7129− _HSW_AUD_DIP_ELD_CTRL_ST_B)
7178+#define HSW_AUD_DIP_ELD_CTRL(pipe) _MMIO_PIPE(pipe, _HSW_AUD_DIP_ELD_CTRL_ST_A, _HSW_AUD_DIP_ELD_CTRL_ST_B)
71307179
71317180 /* Audio Digital Converter */
71327181 #define _HSW_AUD_DIG_CNVT_1 0x65080
71337182 #define _HSW_AUD_DIG_CNVT_2 0x65180
7134−#define AUD_DIG_CNVT(pipe) _PIPE(pipe, \
7135− _HSW_AUD_DIG_CNVT_1, \
7136− _HSW_AUD_DIG_CNVT_2)
7183+#define AUD_DIG_CNVT(pipe) _MMIO_PIPE(pipe, _HSW_AUD_DIG_CNVT_1, _HSW_AUD_DIG_CNVT_2)
71377184 #define DIP_PORT_SEL_MASK 0x3
71387185
71397186 #define _HSW_AUD_EDID_DATA_A 0x65050
71407187 #define _HSW_AUD_EDID_DATA_B 0x65150
7141−#define HSW_AUD_EDID_DATA(pipe) _PIPE(pipe, \
7142− _HSW_AUD_EDID_DATA_A, \
7143− _HSW_AUD_EDID_DATA_B)
7188+#define HSW_AUD_EDID_DATA(pipe) _MMIO_PIPE(pipe, _HSW_AUD_EDID_DATA_A, _HSW_AUD_EDID_DATA_B)
71447189
7145−#define HSW_AUD_PIPE_CONV_CFG 0x6507c
7146−#define HSW_AUD_PIN_ELD_CP_VLD 0x650c0
7190+#define HSW_AUD_PIPE_CONV_CFG _MMIO(0x6507c)
7191+#define HSW_AUD_PIN_ELD_CP_VLD _MMIO(0x650c0)
71477192 #define AUDIO_INACTIVE(trans) ((1 << 3) << ((trans) * 4))
71487193 #define AUDIO_OUTPUT_ENABLE(trans) ((1 << 2) << ((trans) * 4))
71497194 #define AUDIO_CP_READY(trans) ((1 << 1) << ((trans) * 4))
71507195 #define AUDIO_ELD_VALID(trans) ((1 << 0) << ((trans) * 4))
71517196
7152−#define HSW_AUD_CHICKENBIT 0x65f10
7197+#define HSW_AUD_CHICKENBIT _MMIO(0x65f10)
71537198 #define SKL_AUD_CODEC_WAKE_SIGNAL (1 << 15)
71547199
71557200 /* HSW Power Wells */
7156−#define HSW_PWR_WELL_BIOS 0x45400 /* CTL1 */
7157−#define HSW_PWR_WELL_DRIVER 0x45404 /* CTL2 */
7158−#define HSW_PWR_WELL_KVMR 0x45408 /* CTL3 */
7159−#define HSW_PWR_WELL_DEBUG 0x4540C /* CTL4 */
7201+#define HSW_PWR_WELL_BIOS _MMIO(0x45400) /* CTL1 */
7202+#define HSW_PWR_WELL_DRIVER _MMIO(0x45404) /* CTL2 */
7203+#define HSW_PWR_WELL_KVMR _MMIO(0x45408) /* CTL3 */
7204+#define HSW_PWR_WELL_DEBUG _MMIO(0x4540C) /* CTL4 */
71607205 #define HSW_PWR_WELL_ENABLE_REQUEST (1<<31)
71617206 #define HSW_PWR_WELL_STATE_ENABLED (1<<30)
7162−#define HSW_PWR_WELL_CTL5 0x45410
7207+#define HSW_PWR_WELL_CTL5 _MMIO(0x45410)
71637208 #define HSW_PWR_WELL_ENABLE_SINGLE_STEP (1<<31)
71647209 #define HSW_PWR_WELL_PWR_GATE_OVERRIDE (1<<20)
71657210 #define HSW_PWR_WELL_FORCE_ON (1<<19)
7166−#define HSW_PWR_WELL_CTL6 0x45414
7211+#define HSW_PWR_WELL_CTL6 _MMIO(0x45414)
71677212
71687213 /* SKL Fuse Status */
7169−#define SKL_FUSE_STATUS 0x42000
7214+#define SKL_FUSE_STATUS _MMIO(0x42000)
71707215 #define SKL_FUSE_DOWNLOAD_STATUS (1<<31)
71717216 #define SKL_FUSE_PG0_DIST_STATUS (1<<27)
71727217 #define SKL_FUSE_PG1_DIST_STATUS (1<<26)
71737218 #define SKL_FUSE_PG2_DIST_STATUS (1<<25)
71747219
71757220 /* Per-pipe DDI Function Control */
7176−#define TRANS_DDI_FUNC_CTL_A 0x60400
7177−#define TRANS_DDI_FUNC_CTL_B 0x61400
7178−#define TRANS_DDI_FUNC_CTL_C 0x62400
7179−#define TRANS_DDI_FUNC_CTL_EDP 0x6F400
7180−#define TRANS_DDI_FUNC_CTL(tran) _TRANSCODER2(tran, TRANS_DDI_FUNC_CTL_A)
7221+#define _TRANS_DDI_FUNC_CTL_A 0x60400
7222+#define _TRANS_DDI_FUNC_CTL_B 0x61400
7223+#define _TRANS_DDI_FUNC_CTL_C 0x62400
7224+#define _TRANS_DDI_FUNC_CTL_EDP 0x6F400
7225+#define TRANS_DDI_FUNC_CTL(tran) _MMIO_TRANS2(tran, _TRANS_DDI_FUNC_CTL_A)
71817226
71827227 #define TRANS_DDI_FUNC_ENABLE (1<<31)
71837228 /* Those bits are ignored by pipe EDP since it can only connect to DDI A */
@@ -7207,9 +7252,9 @@ enum skl_disp_power_wells { · 23 unmodified lines
72077252 #define TRANS_DDI_BFI_ENABLE (1<<4)
72087253
72097254 /* DisplayPort Transport Control */
7210−#define DP_TP_CTL_A 0x64040
7211−#define DP_TP_CTL_B 0x64140
7212−#define DP_TP_CTL(port) _PORT(port, DP_TP_CTL_A, DP_TP_CTL_B)
7255+#define _DP_TP_CTL_A 0x64040
7256+#define _DP_TP_CTL_B 0x64140
7257+#define DP_TP_CTL(port) _MMIO_PORT(port, _DP_TP_CTL_A, _DP_TP_CTL_B)
72137258 #define DP_TP_CTL_ENABLE (1<<31)
72147259 #define DP_TP_CTL_MODE_SST (0<<27)
72157260 #define DP_TP_CTL_MODE_MST (1<<27)
@@ -7225,9 +7270,9 @@ enum skl_disp_power_wells { · 9 unmodified lines
72257270 #define DP_TP_CTL_SCRAMBLE_DISABLE (1<<7)
72267271
72277272 /* DisplayPort Transport Status */
7228−#define DP_TP_STATUS_A 0x64044
7229−#define DP_TP_STATUS_B 0x64144
7230−#define DP_TP_STATUS(port) _PORT(port, DP_TP_STATUS_A, DP_TP_STATUS_B)
7273+#define _DP_TP_STATUS_A 0x64044
7274+#define _DP_TP_STATUS_B 0x64144
7275+#define DP_TP_STATUS(port) _MMIO_PORT(port, _DP_TP_STATUS_A, _DP_TP_STATUS_B)
72317276 #define DP_TP_STATUS_IDLE_DONE (1<<25)
72327277 #define DP_TP_STATUS_ACT_SENT (1<<24)
72337278 #define DP_TP_STATUS_MODE_STATUS_MST (1<<23)
@@ -7237,9 +7282,9 @@ enum skl_disp_power_wells { · 3 unmodified lines
72377282 #define DP_TP_STATUS_PAYLOAD_MAPPING_VC0 (3 << 0)
72387283
72397284 /* DDI Buffer Control */
7240−#define DDI_BUF_CTL_A 0x64000
7241−#define DDI_BUF_CTL_B 0x64100
7242−#define DDI_BUF_CTL(port) _PORT(port, DDI_BUF_CTL_A, DDI_BUF_CTL_B)
7285+#define _DDI_BUF_CTL_A 0x64000
7286+#define _DDI_BUF_CTL_B 0x64100
7287+#define DDI_BUF_CTL(port) _MMIO_PORT(port, _DDI_BUF_CTL_A, _DDI_BUF_CTL_B)
72437288 #define DDI_BUF_CTL_ENABLE (1<<31)
72447289 #define DDI_BUF_TRANS_SELECT(n) ((n) << 24)
72457290 #define DDI_BUF_EMP_MASK (0xf<<24)
@@ -7252,17 +7297,17 @@ enum skl_disp_power_wells { · 6 unmodified lines
72527297 #define DDI_INIT_DISPLAY_DETECTED (1<<0)
72537298
72547299 /* DDI Buffer Translations */
7255−#define DDI_BUF_TRANS_A 0x64E00
7256−#define DDI_BUF_TRANS_B 0x64E60
7257−#define DDI_BUF_TRANS_LO(port, i) (_PORT(port, DDI_BUF_TRANS_A, DDI_BUF_TRANS_B) + (i) * 8)
7258−#define DDI_BUF_TRANS_HI(port, i) (_PORT(port, DDI_BUF_TRANS_A, DDI_BUF_TRANS_B) + (i) * 8 + 4)
7300+#define _DDI_BUF_TRANS_A 0x64E00
7301+#define _DDI_BUF_TRANS_B 0x64E60
7302+#define DDI_BUF_TRANS_LO(port, i) _MMIO(_PORT(port, _DDI_BUF_TRANS_A, _DDI_BUF_TRANS_B) + (i) * 8)
7303+#define DDI_BUF_TRANS_HI(port, i) _MMIO(_PORT(port, _DDI_BUF_TRANS_A, _DDI_BUF_TRANS_B) + (i) * 8 + 4)
72597304
72607305 /* Sideband Interface (SBI) is programmed indirectly, via
72617306 * SBI_ADDR, which contains the register offset; and SBI_DATA,
72627307 * which contains the payload */
7263−#define SBI_ADDR 0xC6000
7264−#define SBI_DATA 0xC6004
7265−#define SBI_CTL_STAT 0xC6008
7308+#define SBI_ADDR _MMIO(0xC6000)
7309+#define SBI_DATA _MMIO(0xC6004)
7310+#define SBI_CTL_STAT _MMIO(0xC6008)
72667311 #define SBI_CTL_DEST_ICLK (0x0<<16)
72677312 #define SBI_CTL_DEST_MPHY (0x1<<16)
72687313 #define SBI_CTL_OP_IORD (0x2<<8)
@@ -7293,12 +7338,12 @@ enum skl_disp_power_wells { · 24 unmodified lines
72937338 #define SBI_GEN0_CFG_BUFFENABLE_DISABLE (1<<0)
72947339
72957340 /* LPT PIXCLK_GATE */
7296−#define PIXCLK_GATE 0xC6020
7341+#define PIXCLK_GATE _MMIO(0xC6020)
72977342 #define PIXCLK_GATE_UNGATE (1<<0)
72987343 #define PIXCLK_GATE_GATE (0<<0)
72997344
73007345 /* SPLL */
7301−#define SPLL_CTL 0x46020
7346+#define SPLL_CTL _MMIO(0x46020)
73027347 #define SPLL_PLL_ENABLE (1<<31)
73037348 #define SPLL_PLL_SSC (1<<28)
73047349 #define SPLL_PLL_NON_SSC (2<<28)
@@ -7310,9 +7355,9 @@ enum skl_disp_power_wells { · 5 unmodified lines
73107355 #define SPLL_PLL_FREQ_MASK (3<<26)
73117356
73127357 /* WRPLL */
7313−#define WRPLL_CTL1 0x46040
7314−#define WRPLL_CTL2 0x46060
7315−#define WRPLL_CTL(pll) (pll == 0 ? WRPLL_CTL1 : WRPLL_CTL2)
7358+#define _WRPLL_CTL1 0x46040
7359+#define _WRPLL_CTL2 0x46060
7360+#define WRPLL_CTL(pll) _MMIO_PIPE(pll, _WRPLL_CTL1, _WRPLL_CTL2)
73167361 #define WRPLL_PLL_ENABLE (1<<31)
73177362 #define WRPLL_PLL_SSC (1<<28)
73187363 #define WRPLL_PLL_NON_SSC (2<<28)
@@ -7329,9 +7374,9 @@ enum skl_disp_power_wells { · 10 unmodified lines
73297374 #define WRPLL_DIVIDER_FB_MASK (0xff<<16)
73307375
73317376 /* Port clock selection */
7332−#define PORT_CLK_SEL_A 0x46100
7333−#define PORT_CLK_SEL_B 0x46104
7334−#define PORT_CLK_SEL(port) _PORT(port, PORT_CLK_SEL_A, PORT_CLK_SEL_B)
7377+#define _PORT_CLK_SEL_A 0x46100
7378+#define _PORT_CLK_SEL_B 0x46104
7379+#define PORT_CLK_SEL(port) _MMIO_PORT(port, _PORT_CLK_SEL_A, _PORT_CLK_SEL_B)
73357380 #define PORT_CLK_SEL_LCPLL_2700 (0<<29)
73367381 #define PORT_CLK_SEL_LCPLL_1350 (1<<29)
73377382 #define PORT_CLK_SEL_LCPLL_810 (2<<29)
@@ -7343,18 +7388,18 @@ enum skl_disp_power_wells { · 5 unmodified lines
73437388 #define PORT_CLK_SEL_MASK (7<<29)
73447389
73457390 /* Transcoder clock selection */
7346−#define TRANS_CLK_SEL_A 0x46140
7347−#define TRANS_CLK_SEL_B 0x46144
7348−#define TRANS_CLK_SEL(tran) _TRANSCODER(tran, TRANS_CLK_SEL_A, TRANS_CLK_SEL_B)
7391+#define _TRANS_CLK_SEL_A 0x46140
7392+#define _TRANS_CLK_SEL_B 0x46144
7393+#define TRANS_CLK_SEL(tran) _MMIO_TRANS(tran, _TRANS_CLK_SEL_A, _TRANS_CLK_SEL_B)
73497394 /* For each transcoder, we need to select the corresponding port clock */
73507395 #define TRANS_CLK_SEL_DISABLED (0x0<<29)
73517396 #define TRANS_CLK_SEL_PORT(x) (((x)+1)<<29)
73527397
7353−#define TRANSA_MSA_MISC 0x60410
7354−#define TRANSB_MSA_MISC 0x61410
7355−#define TRANSC_MSA_MISC 0x62410
7356−#define TRANS_EDP_MSA_MISC 0x6f410
7357−#define TRANS_MSA_MISC(tran) _TRANSCODER2(tran, TRANSA_MSA_MISC)
7398+#define _TRANSA_MSA_MISC 0x60410
7399+#define _TRANSB_MSA_MISC 0x61410
7400+#define _TRANSC_MSA_MISC 0x62410
7401+#define _TRANS_EDP_MSA_MISC 0x6f410
7402+#define TRANS_MSA_MISC(tran) _MMIO_TRANS2(tran, _TRANSA_MSA_MISC)
73587403
73597404 #define TRANS_MSA_SYNC_CLK (1<<0)
73607405 #define TRANS_MSA_6_BPC (0<<5)
@@ -7364,7 +7409,7 @@ enum skl_disp_power_wells { · 3 unmodified lines
73647409 #define TRANS_MSA_16_BPC (4<<5)
73657410
73667411 /* LCPLL Control */
7367−#define LCPLL_CTL 0x130040
7412+#define LCPLL_CTL _MMIO(0x130040)
73687413 #define LCPLL_PLL_DISABLE (1<<31)
73697414 #define LCPLL_PLL_LOCK (1<<30)
73707415 #define LCPLL_CLK_FREQ_MASK (3<<26)
@@ -7384,7 +7429,7 @@ enum skl_disp_power_wells { · 13 unmodified lines
73847429 */
73857430
73867431 /* CDCLK_CTL */
7387−#define CDCLK_CTL 0x46000
7432+#define CDCLK_CTL _MMIO(0x46000)
73887433 #define CDCLK_FREQ_SEL_MASK (3<<26)
73897434 #define CDCLK_FREQ_450_432 (0<<26)
73907435 #define CDCLK_FREQ_540 (1<<26)
@@ -7400,12 +7445,12 @@ enum skl_disp_power_wells { · 9 unmodified lines
74007445 #define BXT_CDCLK_SSA_PRECHARGE_ENABLE (1<<16)
74017446
74027447 /* LCPLL_CTL */
7403−#define LCPLL1_CTL 0x46010
7404−#define LCPLL2_CTL 0x46014
7448+#define LCPLL1_CTL _MMIO(0x46010)
7449+#define LCPLL2_CTL _MMIO(0x46014)
74057450 #define LCPLL_PLL_ENABLE (1<<31)
74067451
74077452 /* DPLL control1 */
7408−#define DPLL_CTRL1 0x6C058
7453+#define DPLL_CTRL1 _MMIO(0x6C058)
74097454 #define DPLL_CTRL1_HDMI_MODE(id) (1<<((id)*6+5))
74107455 #define DPLL_CTRL1_SSC(id) (1<<((id)*6+4))
74117456 #define DPLL_CTRL1_LINK_RATE_MASK(id) (7<<((id)*6+1))
@@ -7420,7 +7465,7 @@ enum skl_disp_power_wells { · 8 unmodified lines
74207465 #define DPLL_CTRL1_LINK_RATE_2160 5
74217466
74227467 /* DPLL control2 */
7423−#define DPLL_CTRL2 0x6C05C
7468+#define DPLL_CTRL2 _MMIO(0x6C05C)
74247469 #define DPLL_CTRL2_DDI_CLK_OFF(port) (1<<((port)+15))
74257470 #define DPLL_CTRL2_DDI_CLK_SEL_MASK(port) (3<<((port)*3+1))
74267471 #define DPLL_CTRL2_DDI_CLK_SEL_SHIFT(port) ((port)*3+1)
@@ -7428,21 +7473,21 @@ enum skl_disp_power_wells { · 1 unmodified line
74287473 #define DPLL_CTRL2_DDI_SEL_OVERRIDE(port) (1<<((port)*3))
74297474
74307475 /* DPLL Status */
7431−#define DPLL_STATUS 0x6C060
7476+#define DPLL_STATUS _MMIO(0x6C060)
74327477 #define DPLL_LOCK(id) (1<<((id)*8))
74337478
74347479 /* DPLL cfg */
7435−#define DPLL1_CFGCR1 0x6C040
7436−#define DPLL2_CFGCR1 0x6C048
7437−#define DPLL3_CFGCR1 0x6C050
7480+#define _DPLL1_CFGCR1 0x6C040
7481+#define _DPLL2_CFGCR1 0x6C048
7482+#define _DPLL3_CFGCR1 0x6C050
74387483 #define DPLL_CFGCR1_FREQ_ENABLE (1<<31)
74397484 #define DPLL_CFGCR1_DCO_FRACTION_MASK (0x7fff<<9)
74407485 #define DPLL_CFGCR1_DCO_FRACTION(x) ((x)<<9)
74417486 #define DPLL_CFGCR1_DCO_INTEGER_MASK (0x1ff)
74427487
7443−#define DPLL1_CFGCR2 0x6C044
7444−#define DPLL2_CFGCR2 0x6C04C
7445−#define DPLL3_CFGCR2 0x6C054
7488+#define _DPLL1_CFGCR2 0x6C044
7489+#define _DPLL2_CFGCR2 0x6C04C
7490+#define _DPLL3_CFGCR2 0x6C054
74467491 #define DPLL_CFGCR2_QDIV_RATIO_MASK (0xff<<8)
74477492 #define DPLL_CFGCR2_QDIV_RATIO(x) ((x)<<8)
74487493 #define DPLL_CFGCR2_QDIV_MODE(x) ((x)<<7)
@@ -7460,58 +7505,58 @@ enum skl_disp_power_wells { · 11 unmodified lines
74607505 #define DPLL_CFGCR2_PDIV_7 (4<<2)
74617506 #define DPLL_CFGCR2_CENTRAL_FREQ_MASK (3)
74627507
7463−#define DPLL_CFGCR1(id) (DPLL1_CFGCR1 + ((id) - SKL_DPLL1) * 8)
7464−#define DPLL_CFGCR2(id) (DPLL1_CFGCR2 + ((id) - SKL_DPLL1) * 8)
7508+#define DPLL_CFGCR1(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR1, _DPLL2_CFGCR2)
7509+#define DPLL_CFGCR2(id) _MMIO_PIPE((id) - SKL_DPLL1, _DPLL1_CFGCR2, _DPLL2_CFGCR2)
74657510
74667511 /* BXT display engine PLL */
7467−#define BXT_DE_PLL_CTL 0x6d000
7512+#define BXT_DE_PLL_CTL _MMIO(0x6d000)
74687513 #define BXT_DE_PLL_RATIO(x) (x) /* {60,65,100} * 19.2MHz */
74697514 #define BXT_DE_PLL_RATIO_MASK 0xff
74707515
7471−#define BXT_DE_PLL_ENABLE 0x46070
7516+#define BXT_DE_PLL_ENABLE _MMIO(0x46070)
74727517 #define BXT_DE_PLL_PLL_ENABLE (1 << 31)
74737518 #define BXT_DE_PLL_LOCK (1 << 30)
74747519
74757520 /* GEN9 DC */
7476−#define DC_STATE_EN 0x45504
7521+#define DC_STATE_EN _MMIO(0x45504)
7522+#define DC_STATE_DISABLE 0
74777523 #define DC_STATE_EN_UPTO_DC5 (1<<0)
74787524 #define DC_STATE_EN_DC9 (1<<3)
74797525 #define DC_STATE_EN_UPTO_DC6 (2<<0)
74807526 #define DC_STATE_EN_UPTO_DC5_DC6_MASK 0x3
74817527
7482−#define DC_STATE_DEBUG 0x45520
7528+#define DC_STATE_DEBUG _MMIO(0x45520)
74837529 #define DC_STATE_DEBUG_MASK_MEMORY_UP (1<<1)
74847530
74857531 /* Please see hsw_read_dcomp() and hsw_write_dcomp() before using this register,
74867532 * since on HSW we can't write to it using I915_WRITE. */
7487−#define D_COMP_HSW (MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
7488−#define D_COMP_BDW 0x138144
7533+#define D_COMP_HSW _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5F0C)
7534+#define D_COMP_BDW _MMIO(0x138144)
74897535 #define D_COMP_RCOMP_IN_PROGRESS (1<<9)
74907536 #define D_COMP_COMP_FORCE (1<<8)
74917537 #define D_COMP_COMP_DISABLE (1<<0)
74927538
74937539 /* Pipe WM_LINETIME - watermark line time */
7494−#define PIPE_WM_LINETIME_A 0x45270
7495−#define PIPE_WM_LINETIME_B 0x45274
7496−#define PIPE_WM_LINETIME(pipe) _PIPE(pipe, PIPE_WM_LINETIME_A, \
7497− PIPE_WM_LINETIME_B)
7540+#define _PIPE_WM_LINETIME_A 0x45270
7541+#define _PIPE_WM_LINETIME_B 0x45274
7542+#define PIPE_WM_LINETIME(pipe) _MMIO_PIPE(pipe, _PIPE_WM_LINETIME_A, _PIPE_WM_LINETIME_B)
74987543 #define PIPE_WM_LINETIME_MASK (0x1ff)
74997544 #define PIPE_WM_LINETIME_TIME(x) ((x))
75007545 #define PIPE_WM_LINETIME_IPS_LINETIME_MASK (0x1ff<<16)
75017546 #define PIPE_WM_LINETIME_IPS_LINETIME(x) ((x)<<16)
75027547
75037548 /* SFUSE_STRAP */
7504−#define SFUSE_STRAP 0xc2014
7549+#define SFUSE_STRAP _MMIO(0xc2014)
75057550 #define SFUSE_STRAP_FUSE_LOCK (1<<13)
75067551 #define SFUSE_STRAP_DISPLAY_DISABLED (1<<7)
75077552 #define SFUSE_STRAP_DDIB_DETECTED (1<<2)
75087553 #define SFUSE_STRAP_DDIC_DETECTED (1<<1)
75097554 #define SFUSE_STRAP_DDID_DETECTED (1<<0)
75107555
7511−#define WM_MISC 0x45260
7556+#define WM_MISC _MMIO(0x45260)
75127557 #define WM_MISC_DATA_PARTITION_5_6 (1 << 0)
75137558
7514−#define WM_DBG 0x45280
7559+#define WM_DBG _MMIO(0x45280)
75157560 #define WM_DBG_DISALLOW_MULTIPLE_LP (1<<0)
75167561 #define WM_DBG_DISALLOW_MAXFIFO (1<<1)
75177562 #define WM_DBG_DISALLOW_SPRITE (1<<2)
@@ -7548,28 +7593,29 @@ enum skl_disp_power_wells { · 30 unmodified lines
75487593 #define _PIPE_B_CSC_POSTOFF_ME 0x49144
75497594 #define _PIPE_B_CSC_POSTOFF_LO 0x49148
75507595
7551−#define PIPE_CSC_COEFF_RY_GY(pipe) _PIPE(pipe, _PIPE_A_CSC_COEFF_RY_GY, _PIPE_B_CSC_COEFF_RY_GY)
7552−#define PIPE_CSC_COEFF_BY(pipe) _PIPE(pipe, _PIPE_A_CSC_COEFF_BY, _PIPE_B_CSC_COEFF_BY)
7553−#define PIPE_CSC_COEFF_RU_GU(pipe) _PIPE(pipe, _PIPE_A_CSC_COEFF_RU_GU, _PIPE_B_CSC_COEFF_RU_GU)

473 more lines aren’t shown here.

drivers/gpu/drm/i915/i915_sysfs.c+2−1
@@ -35,7 +35,8 @@ · 34 unmodified lines
3535 #define dev_to_drm_minor(d) dev_get_drvdata((d))
3636
3737 #ifdef CONFIG_PM
38−static u32 calc_residency(struct drm_device *dev, const u32 reg)
38+static u32 calc_residency(struct drm_device *dev,
39+ i915_reg_t reg)
3940 {
4041 struct drm_i915_private *dev_priv = dev->dev_private;
4142 u64 raw_time; /* 32b value may overflow during fixed point math */
drivers/gpu/drm/i915/i915_trace.h+2−2
@@ -664,7 +664,7 @@ TRACE_EVENT(i915_flip_complete, · 663 unmodified lines
664664 );
665665
666666 TRACE_EVENT_CONDITION(i915_reg_rw,
667− TP_PROTO(bool write, u32 reg, u64 val, int len, bool trace),
667+ TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
668668
669669 TP_ARGS(write, reg, val, len, trace),
670670
@@ -679,7 +679,7 @@ TRACE_EVENT_CONDITION(i915_reg_rw, · 8 unmodified lines
679679
680680 TP_fast_assign(
681681 __entry->val = (u64)val;
682− __entry->reg = reg;
682+ __entry->reg = i915_mmio_reg_offset(reg);
683683 __entry->write = write;
684684 __entry->len = len;
685685 ),
drivers/gpu/drm/i915/i915_vgpu.c+3−3
@@ -69,13 +69,13 @@ void i915_check_vgpu(struct drm_device *dev) · 68 unmodified lines
6969 if (!IS_HASWELL(dev))
7070 return;
7171
72− magic = readq(dev_priv->regs + vgtif_reg(magic));
72+ magic = __raw_i915_read64(dev_priv, vgtif_reg(magic));
7373 if (magic != VGT_MAGIC)
7474 return;
7575
7676 version = INTEL_VGT_IF_VERSION_ENCODE(
77− readw(dev_priv->regs + vgtif_reg(version_major)),
78− readw(dev_priv->regs + vgtif_reg(version_minor)));
77+ __raw_i915_read16(dev_priv, vgtif_reg(version_major)),
78+ __raw_i915_read16(dev_priv, vgtif_reg(version_minor)));
7979 if (version != INTEL_VGT_IF_VERSION) {
8080 DRM_INFO("VGT interface version mismatch!\n");
8181 return;
drivers/gpu/drm/i915/i915_vgpu.h+5−9
@@ -92,14 +92,10 @@ struct vgt_if { · 91 unmodified lines
9292 uint32_t g2v_notify;
9393 uint32_t rsv6[7];
9494
95− uint32_t pdp0_lo;
96− uint32_t pdp0_hi;
97− uint32_t pdp1_lo;
98− uint32_t pdp1_hi;
99− uint32_t pdp2_lo;
100− uint32_t pdp2_hi;
101− uint32_t pdp3_lo;
102− uint32_t pdp3_hi;
95+ struct {
96+ uint32_t lo;
97+ uint32_t hi;
98+ } pdp[4];
10399
104100 uint32_t execlist_context_descriptor_lo;
105101 uint32_t execlist_context_descriptor_hi;
@@ -108,7 +104,7 @@ struct vgt_if { · 2 unmodified lines
108104 } __packed;
109105
110106 #define vgtif_reg(x) \
111− (VGT_PVINFO_PAGE + (long)&((struct vgt_if *)NULL)->x)
107+ _MMIO((VGT_PVINFO_PAGE + (long)&((struct vgt_if *)NULL)->x))
112108
113109 /* vGPU display status to be used by the host side */
114110 #define VGT_DRV_DISPLAY_NOT_READY 0
drivers/gpu/drm/i915/intel_atomic.c+1−2
@@ -94,6 +94,7 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc) · 93 unmodified lines
9494 __drm_atomic_helper_crtc_duplicate_state(crtc, &crtc_state->base);
9595
9696 crtc_state->update_pipe = false;
97+ crtc_state->disable_lp_wm = false;
9798
9899 return &crtc_state->base;
99100 }
@@ -205,8 +206,6 @@ int intel_atomic_setup_scalers(struct drm_device *dev, · 105 unmodified lines
205206 * but since this plane is unchanged just do the
206207 * minimum required validation.
207208 */
208− if (plane->type == DRM_PLANE_TYPE_PRIMARY)
209− intel_crtc->atomic.wait_for_flips = true;
210209 crtc_state->base.planes_changed = true;
211210 }
212211
drivers/gpu/drm/i915/intel_atomic_plane.c+2−0
@@ -84,6 +84,7 @@ intel_plane_duplicate_state(struct drm_plane *plane) · 83 unmodified lines
8484 state = &intel_state->base;
8585
8686 __drm_atomic_helper_plane_duplicate_state(plane, state);
87+ intel_state->wait_req = NULL;
8788
8889 return state;
8990 }
@@ -100,6 +101,7 @@ void · 10 unmodified lines
100101 intel_plane_destroy_state(struct drm_plane *plane,
101102 struct drm_plane_state *state)
102103 {
104+ WARN_ON(state && to_intel_plane_state(state)->wait_req);
103105 drm_atomic_helper_plane_destroy_state(plane, state);
104106 }
105107
drivers/gpu/drm/i915/intel_audio.c+65−37
@@ -161,9 +161,9 @@ static bool audio_rate_need_prog(struct intel_crtc *crtc, · 160 unmodified lines
161161 }
162162
163163 static bool intel_eld_uptodate(struct drm_connector *connector,
164− int reg_eldv, uint32_t bits_eldv,
165− int reg_elda, uint32_t bits_elda,
166− int reg_edid)
164+ i915_reg_t reg_eldv, uint32_t bits_eldv,
165+ i915_reg_t reg_elda, uint32_t bits_elda,
166+ i915_reg_t reg_edid)
167167 {
168168 struct drm_i915_private *dev_priv = connector->dev->dev_private;
169169 uint8_t *eld = connector->eld;
@@ -364,8 +364,7 @@ static void ilk_audio_codec_disable(struct intel_encoder *encoder) · 194 unmodified lines
364364 enum port port = intel_dig_port->port;
365365 enum pipe pipe = intel_crtc->pipe;
366366 uint32_t tmp, eldv;
367− int aud_config;
368− int aud_cntrl_st2;
367+ i915_reg_t aud_config, aud_cntrl_st2;
369368
370369 DRM_DEBUG_KMS("Disable audio codec on port %c, pipe %c\n",
371370 port_name(port), pipe_name(pipe));
@@ -416,10 +415,7 @@ static void ilk_audio_codec_enable(struct drm_connector *connector, · 44 unmodified lines
416415 uint32_t eldv;
417416 uint32_t tmp;
418417 int len, i;
419− int hdmiw_hdmiedid;
420− int aud_config;
421− int aud_cntl_st;
422− int aud_cntrl_st2;
418+ i915_reg_t hdmiw_hdmiedid, aud_config, aud_cntl_st, aud_cntrl_st2;
423419
424420 DRM_DEBUG_KMS("Enable audio codec on port %c, pipe %c, %u bytes ELD\n",
425421 port_name(port), pipe_name(pipe), drm_eld_size(eld));
@@ -525,6 +521,10 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) · 99 unmodified lines
525521 dev_priv->display.audio_codec_enable(connector, intel_encoder,
526522 adjusted_mode);
527523
524+ mutex_lock(&dev_priv->av_mutex);
525+ intel_dig_port->audio_connector = connector;
526+ mutex_unlock(&dev_priv->av_mutex);
527+
528528 if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
529529 acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port);
530530 }
@@ -548,6 +548,10 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder) · 17 unmodified lines
548548 if (dev_priv->display.audio_codec_disable)
549549 dev_priv->display.audio_codec_disable(intel_encoder);
550550
551+ mutex_lock(&dev_priv->av_mutex);
552+ intel_dig_port->audio_connector = NULL;
553+ mutex_unlock(&dev_priv->av_mutex);
554+
551555 if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
552556 acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port);
553557 }
@@ -591,7 +595,7 @@ static void i915_audio_component_codec_wake_override(struct device *dev, · 37 unmodified lines
591595 struct drm_i915_private *dev_priv = dev_to_i915(dev);
592596 u32 tmp;
593597
594− if (!IS_SKYLAKE(dev_priv))
598+ if (!IS_SKYLAKE(dev_priv) && !IS_KABYLAKE(dev_priv))
595599 return;
596600
597601 /*
@@ -632,44 +636,40 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, · 34 unmodified lines
632636 int port, int rate)
633637 {
634638 struct drm_i915_private *dev_priv = dev_to_i915(dev);
635− struct drm_device *drm_dev = dev_priv->dev;
636639 struct intel_encoder *intel_encoder;
637− struct intel_digital_port *intel_dig_port;
638640 struct intel_crtc *crtc;
639641 struct drm_display_mode *mode;
640642 struct i915_audio_component *acomp = dev_priv->audio_component;
641− enum pipe pipe = -1;
643+ enum pipe pipe = INVALID_PIPE;
642644 u32 tmp;
643645 int n;
646+ int err = 0;
644647
645− /* HSW, BDW SKL need this fix */
648+ /* HSW, BDW, SKL, KBL need this fix */
646649 if (!IS_SKYLAKE(dev_priv) &&
647− !IS_BROADWELL(dev_priv) &&
648− !IS_HASWELL(dev_priv))
650+ !IS_KABYLAKE(dev_priv) &&
651+ !IS_BROADWELL(dev_priv) &&
652+ !IS_HASWELL(dev_priv))
649653 return 0;
650654
651655 mutex_lock(&dev_priv->av_mutex);
652656 /* 1. get the pipe */
653− for_each_intel_encoder(drm_dev, intel_encoder) {
654− if (intel_encoder->type != INTEL_OUTPUT_HDMI)
655− continue;
656− intel_dig_port = enc_to_dig_port(&intel_encoder->base);
657− if (port == intel_dig_port->port) {
658− crtc = to_intel_crtc(intel_encoder->base.crtc);
659− if (!crtc) {
660− DRM_DEBUG_KMS("%s: crtc is NULL\n", __func__);
661− continue;
662− }
663− pipe = crtc->pipe;
664− break;
665− }
657+ intel_encoder = dev_priv->dig_port_map[port];
658+ /* intel_encoder might be NULL for DP MST */
659+ if (!intel_encoder || !intel_encoder->base.crtc ||
660+ intel_encoder->type != INTEL_OUTPUT_HDMI) {
661+ DRM_DEBUG_KMS("no valid port %c\n", port_name(port));
662+ err = -ENODEV;
663+ goto unlock;
666664 }
667−
665+ crtc = to_intel_crtc(intel_encoder->base.crtc);
666+ pipe = crtc->pipe;
668667 if (pipe == INVALID_PIPE) {
669668 DRM_DEBUG_KMS("no pipe for the port %c\n", port_name(port));
670− mutex_unlock(&dev_priv->av_mutex);
671− return -ENODEV;
669+ err = -ENODEV;
670+ goto unlock;
672671 }
672+
673673 DRM_DEBUG_KMS("pipe %c connects port %c\n",
674674 pipe_name(pipe), port_name(port));
675675 mode = &crtc->config->base.adjusted_mode;
@@ -682,8 +682,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, · 6 unmodified lines
682682 tmp = I915_READ(HSW_AUD_CFG(pipe));
683683 tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
684684 I915_WRITE(HSW_AUD_CFG(pipe), tmp);
685− mutex_unlock(&dev_priv->av_mutex);
686− return 0;
685+ goto unlock;
687686 }
688687
689688 n = audio_config_get_n(mode, rate);
@@ -693,8 +692,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, · 3 unmodified lines
693692 tmp = I915_READ(HSW_AUD_CFG(pipe));
694693 tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
695694 I915_WRITE(HSW_AUD_CFG(pipe), tmp);
696− mutex_unlock(&dev_priv->av_mutex);
697− return 0;
695+ goto unlock;
698696 }
699697
700698 /* 3. set the N/CTS/M */
@@ -702,8 +700,37 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, · 1 unmodified line
702700 tmp = audio_config_setup_n_reg(n, tmp);
703701 I915_WRITE(HSW_AUD_CFG(pipe), tmp);
704702
703+ unlock:
705704 mutex_unlock(&dev_priv->av_mutex);
706− return 0;
705+ return err;
706+}
707+
708+static int i915_audio_component_get_eld(struct device *dev, int port,
709+ bool *enabled,
710+ unsigned char *buf, int max_bytes)
711+{
712+ struct drm_i915_private *dev_priv = dev_to_i915(dev);
713+ struct intel_encoder *intel_encoder;
714+ struct intel_digital_port *intel_dig_port;
715+ const u8 *eld;
716+ int ret = -EINVAL;
717+
718+ mutex_lock(&dev_priv->av_mutex);
719+ intel_encoder = dev_priv->dig_port_map[port];
720+ /* intel_encoder might be NULL for DP MST */
721+ if (intel_encoder) {
722+ ret = 0;
723+ intel_dig_port = enc_to_dig_port(&intel_encoder->base);
724+ *enabled = intel_dig_port->audio_connector != NULL;
725+ if (*enabled) {
726+ eld = intel_dig_port->audio_connector->eld;
727+ ret = drm_eld_size(eld);
728+ memcpy(buf, eld, min(max_bytes, ret));
729+ }
730+ }
731+
732+ mutex_unlock(&dev_priv->av_mutex);
733+ return ret;
707734 }
708735
709736 static const struct i915_audio_component_ops i915_audio_component_ops = {
@@ -713,6 +740,7 @@ static const struct i915_audio_component_ops i915_audio_component_ops = { · 3 unmodified lines
713740 .codec_wake_override = i915_audio_component_codec_wake_override,
714741 .get_cdclk_freq = i915_audio_component_get_cdclk_freq,
715742 .sync_audio_rate = i915_audio_component_sync_audio_rate,
743+ .get_eld = i915_audio_component_get_eld,
716744 };
717745
718746 static int i915_audio_component_bind(struct device *i915_dev,
drivers/gpu/drm/i915/intel_crt.c+5−9
@@ -50,7 +50,7 @@ struct intel_crt { · 49 unmodified lines
5050 * encoder's enable/disable callbacks */
5151 struct intel_connector *connector;
5252 bool force_hotplug_required;
53− u32 adpa_reg;
53+ i915_reg_t adpa_reg;
5454 };
5555
5656 static struct intel_crt *intel_encoder_to_crt(struct intel_encoder *encoder)
@@ -480,12 +480,8 @@ intel_crt_load_detect(struct intel_crt *crt) · 423 unmodified lines
480480 uint32_t vsample;
481481 uint32_t vblank, vblank_start, vblank_end;
482482 uint32_t dsl;
483− uint32_t bclrpat_reg;
484− uint32_t vtotal_reg;
485− uint32_t vblank_reg;
486− uint32_t vsync_reg;
487− uint32_t pipeconf_reg;
488− uint32_t pipe_dsl_reg;
483+ i915_reg_t bclrpat_reg, vtotal_reg,
484+ vblank_reg, vsync_reg, pipeconf_reg, pipe_dsl_reg;
489485 uint8_t st00;
490486 enum drm_connector_status status;
491487
@@ -518,7 +514,7 @@ intel_crt_load_detect(struct intel_crt *crt) · 26 unmodified lines
518514 /* Wait for next Vblank to substitue
519515 * border color for Color info */
520516 intel_wait_for_vblank(dev, pipe);
521− st00 = I915_READ8(VGA_MSR_WRITE);
517+ st00 = I915_READ8(_VGA_MSR_WRITE);
522518 status = ((st00 & (1 << 4)) != 0) ?
523519 connector_status_connected :
524520 connector_status_disconnected;
@@ -563,7 +559,7 @@ intel_crt_load_detect(struct intel_crt *crt) · 38 unmodified lines
563559 do {
564560 count++;
565561 /* Read the ST00 VGA status register */
566− st00 = I915_READ8(VGA_MSR_WRITE);
562+ st00 = I915_READ8(_VGA_MSR_WRITE);
567563 if (st00 & (1 << 4))
568564 detect++;
569565 } while ((I915_READ(pipe_dsl_reg) == dsl));
drivers/gpu/drm/i915/intel_csr.c+123−161
@@ -47,21 +47,10 @@ · 46 unmodified lines
4747 MODULE_FIRMWARE(I915_CSR_SKL);
4848 MODULE_FIRMWARE(I915_CSR_BXT);
4949
50−/*
51−* SKL CSR registers for DC5 and DC6
52−*/
53−#define CSR_PROGRAM(i) (0x80000 + (i) * 4)
54−#define CSR_SSP_BASE_ADDR_GEN9 0x00002FC0
55−#define CSR_HTP_ADDR_SKL 0x00500034
56−#define CSR_SSP_BASE 0x8F074
57−#define CSR_HTP_SKL 0x8F004
58−#define CSR_LAST_WRITE 0x8F034
59−#define CSR_LAST_WRITE_VALUE 0xc003b400
60−/* MMIO address range for CSR program (0x80000 - 0x82FFF) */
50+#define SKL_CSR_VERSION_REQUIRED CSR_VERSION(1, 23)
51+
6152 #define CSR_MAX_FW_SIZE 0x2FFF
6253 #define CSR_DEFAULT_FW_OFFSET 0xFFFFFFFF
63−#define CSR_MMIO_START_RANGE 0x80000
64−#define CSR_MMIO_END_RANGE 0x8FFFF
6554
6655 struct intel_css_header {
6756 /* 0x09 for DMC */
@@ -178,166 +167,134 @@ struct stepping_info { · 110 unmodified lines
178167 };
179168
180169 static const struct stepping_info skl_stepping_info[] = {
181− {'A', '0'}, {'B', '0'}, {'C', '0'},
182− {'D', '0'}, {'E', '0'}, {'F', '0'},
183− {'G', '0'}, {'H', '0'}, {'I', '0'}
170+ {'A', '0'}, {'B', '0'}, {'C', '0'},
171+ {'D', '0'}, {'E', '0'}, {'F', '0'},
172+ {'G', '0'}, {'H', '0'}, {'I', '0'}
184173 };
185174
186−static struct stepping_info bxt_stepping_info[] = {
175+static const struct stepping_info bxt_stepping_info[] = {
187176 {'A', '0'}, {'A', '1'}, {'A', '2'},
188177 {'B', '0'}, {'B', '1'}, {'B', '2'}
189178 };
190179
191−static char intel_get_stepping(struct drm_device *dev)
192−{
193− if (IS_SKYLAKE(dev) && (dev->pdev->revision <
194− ARRAY_SIZE(skl_stepping_info)))
195− return skl_stepping_info[dev->pdev->revision].stepping;
196− else if (IS_BROXTON(dev) && (dev->pdev->revision <
197− ARRAY_SIZE(bxt_stepping_info)))
198− return bxt_stepping_info[dev->pdev->revision].stepping;
199− else
200− return -ENODATA;
201−}
202−
203−static char intel_get_substepping(struct drm_device *dev)
180+static const struct stepping_info *intel_get_stepping_info(struct drm_device *dev)
204181 {
205− if (IS_SKYLAKE(dev) && (dev->pdev->revision <
206− ARRAY_SIZE(skl_stepping_info)))
207− return skl_stepping_info[dev->pdev->revision].substepping;
208− else if (IS_BROXTON(dev) && (dev->pdev->revision <
209− ARRAY_SIZE(bxt_stepping_info)))
210− return bxt_stepping_info[dev->pdev->revision].substepping;
211− else
212− return -ENODATA;
213−}
214−
215−/**
216− * intel_csr_load_status_get() - to get firmware loading status.
217− * @dev_priv: i915 device.
218− *
219− * This function helps to get the firmware loading status.
220− *
221− * Return: Firmware loading status.
222− */
223−enum csr_state intel_csr_load_status_get(struct drm_i915_private *dev_priv)
224−{
225− enum csr_state state;
182+ const struct stepping_info *si;
183+ unsigned int size;
184+
185+ if (IS_SKYLAKE(dev)) {
186+ size = ARRAY_SIZE(skl_stepping_info);
187+ si = skl_stepping_info;
188+ } else if (IS_BROXTON(dev)) {
189+ size = ARRAY_SIZE(bxt_stepping_info);
190+ si = bxt_stepping_info;
191+ } else {
192+ return NULL;
193+ }
226194
227− mutex_lock(&dev_priv->csr_lock);
228− state = dev_priv->csr.state;
229− mutex_unlock(&dev_priv->csr_lock);
195+ if (INTEL_REVID(dev) < size)
196+ return si + INTEL_REVID(dev);
230197
231− return state;
232−}
233−
234−/**
235− * intel_csr_load_status_set() - help to set firmware loading status.
236− * @dev_priv: i915 device.
237− * @state: enumeration of firmware loading status.
238− *
239− * Set the firmware loading status.
240− */
241−void intel_csr_load_status_set(struct drm_i915_private *dev_priv,
242− enum csr_state state)
243−{
244− mutex_lock(&dev_priv->csr_lock);
245− dev_priv->csr.state = state;
246− mutex_unlock(&dev_priv->csr_lock);
198+ return NULL;
247199 }
248200
249201 /**
250202 * intel_csr_load_program() - write the firmware from memory to register.
251− * @dev: drm device.
203+ * @dev_priv: i915 drm device.
252204 *
253205 * CSR firmware is read from a .bin file and kept in internal memory one time.
254206 * Everytime display comes back from low power state this function is called to
255207 * copy the firmware from internal memory to registers.
256208 */
257−void intel_csr_load_program(struct drm_device *dev)
209+void intel_csr_load_program(struct drm_i915_private *dev_priv)
258210 {
259− struct drm_i915_private *dev_priv = dev->dev_private;
260211 u32 *payload = dev_priv->csr.dmc_payload;
261212 uint32_t i, fw_size;
262213
263− if (!IS_GEN9(dev)) {
214+ if (!IS_GEN9(dev_priv)) {
264215 DRM_ERROR("No CSR support available for this platform\n");
265216 return;
266217 }
267218
268− /*
269− * FIXME: Firmware gets lost on S3/S4, but not when entering system
270− * standby or suspend-to-idle (which is just like forced runtime pm).
271− * Unfortunately the ACPI subsystem doesn't yet give us a way to
272− * differentiate this, hence figure it out with this hack.
273− */
274− if (I915_READ(CSR_PROGRAM(0)))
219+ if (!dev_priv->csr.dmc_payload) {
220+ DRM_ERROR("Tried to program CSR with empty payload\n");
275221 return;
222+ }
276223
277− mutex_lock(&dev_priv->csr_lock);
278224 fw_size = dev_priv->csr.dmc_fw_size;
279225 for (i = 0; i < fw_size; i++)
280226 I915_WRITE(CSR_PROGRAM(i), payload[i]);
281227
282228 for (i = 0; i < dev_priv->csr.mmio_count; i++) {
283229 I915_WRITE(dev_priv->csr.mmioaddr[i],
284− dev_priv->csr.mmiodata[i]);
230+ dev_priv->csr.mmiodata[i]);
285231 }
286−
287− dev_priv->csr.state = FW_LOADED;
288− mutex_unlock(&dev_priv->csr_lock);
289232 }
290233
291−static void finish_csr_load(const struct firmware *fw, void *context)
234+static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv,
235+ const struct firmware *fw)
292236 {
293− struct drm_i915_private *dev_priv = context;
294237 struct drm_device *dev = dev_priv->dev;
295238 struct intel_css_header *css_header;
296239 struct intel_package_header *package_header;
297240 struct intel_dmc_header *dmc_header;
298241 struct intel_csr *csr = &dev_priv->csr;
299− char stepping = intel_get_stepping(dev);
300− char substepping = intel_get_substepping(dev);
242+ const struct stepping_info *stepping_info = intel_get_stepping_info(dev);
243+ char stepping, substepping;
301244 uint32_t dmc_offset = CSR_DEFAULT_FW_OFFSET, readcount = 0, nbytes;
302245 uint32_t i;
303246 uint32_t *dmc_payload;
304− bool fw_loaded = false;
305247
306− if (!fw) {
307− i915_firmware_load_error_print(csr->fw_path, 0);
308− goto out;
309− }
248+ if (!fw)
249+ return NULL;
310250
311− if ((stepping == -ENODATA) || (substepping == -ENODATA)) {
251+ if (!stepping_info) {
312252 DRM_ERROR("Unknown stepping info, firmware loading failed\n");
313− goto out;
253+ return NULL;
314254 }
315255
256+ stepping = stepping_info->stepping;
257+ substepping = stepping_info->substepping;
258+
316259 /* Extract CSS Header information*/
317260 css_header = (struct intel_css_header *)fw->data;
318261 if (sizeof(struct intel_css_header) !=
319− (css_header->header_len * 4)) {
262+ (css_header->header_len * 4)) {
320263 DRM_ERROR("Firmware has wrong CSS header length %u bytes\n",
321− (css_header->header_len * 4));
322− goto out;
264+ (css_header->header_len * 4));
265+ return NULL;
323266 }
267+
268+ csr->version = css_header->version;
269+
270+ if (IS_SKYLAKE(dev) && csr->version < SKL_CSR_VERSION_REQUIRED) {
271+ DRM_INFO("Refusing to load old Skylake DMC firmware v%u.%u,"
272+ " please upgrade to v%u.%u or later"
273+ " [https://01.org/linuxgraphics/intel-linux-graphics-firmwares].\n",
274+ CSR_VERSION_MAJOR(csr->version),
275+ CSR_VERSION_MINOR(csr->version),
276+ CSR_VERSION_MAJOR(SKL_CSR_VERSION_REQUIRED),
277+ CSR_VERSION_MINOR(SKL_CSR_VERSION_REQUIRED));
278+ return NULL;
279+ }
280+
324281 readcount += sizeof(struct intel_css_header);
325282
326283 /* Extract Package Header information*/
327284 package_header = (struct intel_package_header *)
328− &fw->data[readcount];
285+ &fw->data[readcount];
329286 if (sizeof(struct intel_package_header) !=
330− (package_header->header_len * 4)) {
287+ (package_header->header_len * 4)) {
331288 DRM_ERROR("Firmware has wrong package header length %u bytes\n",
332− (package_header->header_len * 4));
333− goto out;
289+ (package_header->header_len * 4));
290+ return NULL;
334291 }
335292 readcount += sizeof(struct intel_package_header);
336293
337294 /* Search for dmc_offset to find firware binary. */
338295 for (i = 0; i < package_header->num_entries; i++) {
339296 if (package_header->fw_info[i].substepping == '*' &&
340− stepping == package_header->fw_info[i].stepping) {
297+ stepping == package_header->fw_info[i].stepping) {
341298 dmc_offset = package_header->fw_info[i].offset;
342299 break;
343300 } else if (stepping == package_header->fw_info[i].stepping &&
@@ -345,12 +302,12 @@ static void finish_csr_load(const struct firmware *fw, void *context) · 1 unmodified line
345302 dmc_offset = package_header->fw_info[i].offset;
346303 break;
347304 } else if (package_header->fw_info[i].stepping == '*' &&
348− package_header->fw_info[i].substepping == '*')
305+ package_header->fw_info[i].substepping == '*')
349306 dmc_offset = package_header->fw_info[i].offset;
350307 }
351308 if (dmc_offset == CSR_DEFAULT_FW_OFFSET) {
352309 DRM_ERROR("Firmware not supported for %c stepping\n", stepping);
353− goto out;
310+ return NULL;
354311 }
355312 readcount += dmc_offset;
356313
@@ -358,26 +315,26 @@ static void finish_csr_load(const struct firmware *fw, void *context) · 1 unmodified line
358315 dmc_header = (struct intel_dmc_header *)&fw->data[readcount];
359316 if (sizeof(struct intel_dmc_header) != (dmc_header->header_len)) {
360317 DRM_ERROR("Firmware has wrong dmc header length %u bytes\n",
361− (dmc_header->header_len));
362− goto out;
318+ (dmc_header->header_len));
319+ return NULL;
363320 }
364321 readcount += sizeof(struct intel_dmc_header);
365322
366323 /* Cache the dmc header info. */
367324 if (dmc_header->mmio_count > ARRAY_SIZE(csr->mmioaddr)) {
368325 DRM_ERROR("Firmware has wrong mmio count %u\n",
369− dmc_header->mmio_count);
370− goto out;
326+ dmc_header->mmio_count);
327+ return NULL;
371328 }
372329 csr->mmio_count = dmc_header->mmio_count;
373330 for (i = 0; i < dmc_header->mmio_count; i++) {
374331 if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE ||
375− dmc_header->mmioaddr[i] > CSR_MMIO_END_RANGE) {
332+ dmc_header->mmioaddr[i] > CSR_MMIO_END_RANGE) {
376333 DRM_ERROR(" Firmware has wrong mmio address 0x%x\n",
377− dmc_header->mmioaddr[i]);
378− goto out;
334+ dmc_header->mmioaddr[i]);
335+ return NULL;
379336 }
380− csr->mmioaddr[i] = dmc_header->mmioaddr[i];
337+ csr->mmioaddr[i] = _MMIO(dmc_header->mmioaddr[i]);
381338 csr->mmiodata[i] = dmc_header->mmiodata[i];
382339 }
383340
@@ -385,56 +342,80 @@ static void finish_csr_load(const struct firmware *fw, void *context) · 1 unmodified line
385342 nbytes = dmc_header->fw_size * 4;
386343 if (nbytes > CSR_MAX_FW_SIZE) {
387344 DRM_ERROR("CSR firmware too big (%u) bytes\n", nbytes);
388− goto out;
345+ return NULL;
389346 }
390347 csr->dmc_fw_size = dmc_header->fw_size;
391348
392− csr->dmc_payload = kmalloc(nbytes, GFP_KERNEL);
393− if (!csr->dmc_payload) {
349+ dmc_payload = kmalloc(nbytes, GFP_KERNEL);
350+ if (!dmc_payload) {
394351 DRM_ERROR("Memory allocation failed for dmc payload\n");
395− goto out;
352+ return NULL;
396353 }
397354
398− dmc_payload = csr->dmc_payload;
399355 memcpy(dmc_payload, &fw->data[readcount], nbytes);
400356
357+ return dmc_payload;
358+}
359+
360+static void csr_load_work_fn(struct work_struct *work)
361+{
362+ struct drm_i915_private *dev_priv;
363+ struct intel_csr *csr;
364+ const struct firmware *fw;
365+ int ret;
366+
367+ dev_priv = container_of(work, typeof(*dev_priv), csr.work);
368+ csr = &dev_priv->csr;
369+
370+ ret = request_firmware(&fw, dev_priv->csr.fw_path,
371+ &dev_priv->dev->pdev->dev);
372+ if (!fw)
373+ goto out;
374+
375+ dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw);
376+ if (!dev_priv->csr.dmc_payload)
377+ goto out;
378+
401379 /* load csr program during system boot, as needed for DC states */
402− intel_csr_load_program(dev);
403− fw_loaded = true;
380+ intel_csr_load_program(dev_priv);
404381
405− DRM_DEBUG_KMS("Finished loading %s\n", dev_priv->csr.fw_path);
406382 out:
407− if (fw_loaded)
408− intel_runtime_pm_put(dev_priv);
409− else
410− intel_csr_load_status_set(dev_priv, FW_FAILED);
383+ if (dev_priv->csr.dmc_payload) {
384+ intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
385+
386+ DRM_INFO("Finished loading %s (v%u.%u)\n",
387+ dev_priv->csr.fw_path,
388+ CSR_VERSION_MAJOR(csr->version),
389+ CSR_VERSION_MINOR(csr->version));
390+ } else {
391+ DRM_ERROR("Failed to load DMC firmware, disabling rpm\n");
392+ }
411393
412394 release_firmware(fw);
413395 }
414396
415397 /**
416398 * intel_csr_ucode_init() - initialize the firmware loading.
417− * @dev: drm device.
399+ * @dev_priv: i915 drm device.
418400 *
419401 * This function is called at the time of loading the display driver to read
420402 * firmware from a .bin file and copied into a internal memory.
421403 */
422−void intel_csr_ucode_init(struct drm_device *dev)
404+void intel_csr_ucode_init(struct drm_i915_private *dev_priv)
423405 {
424− struct drm_i915_private *dev_priv = dev->dev_private;
425406 struct intel_csr *csr = &dev_priv->csr;
426− int ret;
427407
428− if (!HAS_CSR(dev))
408+ INIT_WORK(&dev_priv->csr.work, csr_load_work_fn);
409+
410+ if (!HAS_CSR(dev_priv))
429411 return;
430412
431− if (IS_SKYLAKE(dev))
413+ if (IS_SKYLAKE(dev_priv))
432414 csr->fw_path = I915_CSR_SKL;
433415 else if (IS_BROXTON(dev_priv))
434416 csr->fw_path = I915_CSR_BXT;
435417 else {
436418 DRM_ERROR("Unexpected: no known CSR firmware for platform\n");
437− intel_csr_load_status_set(dev_priv, FW_FAILED);
438419 return;
439420 }
440421
@@ -444,43 +425,24 @@ void intel_csr_ucode_init(struct drm_device *dev) · 3 unmodified lines
444425 * Obtain a runtime pm reference, until CSR is loaded,
445426 * to avoid entering runtime-suspend.
446427 */
447− intel_runtime_pm_get(dev_priv);
448−
449− /* CSR supported for platform, load firmware */
450− ret = request_firmware_nowait(THIS_MODULE, true, csr->fw_path,
451− &dev_priv->dev->pdev->dev,
452− GFP_KERNEL, dev_priv,
453− finish_csr_load);
454− if (ret) {
455− i915_firmware_load_error_print(csr->fw_path, ret);
456− intel_csr_load_status_set(dev_priv, FW_FAILED);
457− }
428+ intel_display_power_get(dev_priv, POWER_DOMAIN_INIT);
429+
430+ schedule_work(&dev_priv->csr.work);
458431 }
459432
460433 /**
461434 * intel_csr_ucode_fini() - unload the CSR firmware.
462− * @dev: drm device.
435+ * @dev_priv: i915 drm device.
463436 *
464437 * Firmmware unloading includes freeing the internal momory and reset the
465438 * firmware loading status.
466439 */
467−void intel_csr_ucode_fini(struct drm_device *dev)
440+void intel_csr_ucode_fini(struct drm_i915_private *dev_priv)
468441 {
469− struct drm_i915_private *dev_priv = dev->dev_private;
470−
471− if (!HAS_CSR(dev))
442+ if (!HAS_CSR(dev_priv))
472443 return;
473444
474− intel_csr_load_status_set(dev_priv, FW_FAILED);
475− kfree(dev_priv->csr.dmc_payload);
476−}
445+ flush_work(&dev_priv->csr.work);
477446
478−void assert_csr_loaded(struct drm_i915_private *dev_priv)
479−{
480− WARN_ONCE(intel_csr_load_status_get(dev_priv) != FW_LOADED,
481− "CSR is not loaded.\n");
482− WARN_ONCE(!I915_READ(CSR_PROGRAM(0)),
483− "CSR program storage start is NULL\n");
484− WARN_ONCE(!I915_READ(CSR_SSP_BASE), "CSR SSP Base Not fine\n");
485− WARN_ONCE(!I915_READ(CSR_HTP_SKL), "CSR HTP Not fine\n");
447+ kfree(dev_priv->csr.dmc_payload);
486448 }
drivers/gpu/drm/i915/intel_ddi.c+83−59
@@ -133,12 +133,12 @@ static const struct ddi_buf_trans skl_ddi_translations_dp[] = { · 132 unmodified lines
133133 { 0x00002016, 0x000000A0, 0x0 },
134134 { 0x00005012, 0x0000009B, 0x0 },
135135 { 0x00007011, 0x00000088, 0x0 },
136− { 0x00009010, 0x000000C7, 0x0 },
136+ { 0x80009010, 0x000000C0, 0x1 }, /* Uses I_boost level 0x1 */
137137 { 0x00002016, 0x0000009B, 0x0 },
138138 { 0x00005012, 0x00000088, 0x0 },
139− { 0x00007011, 0x000000C7, 0x0 },
139+ { 0x80007011, 0x000000C0, 0x1 }, /* Uses I_boost level 0x1 */
140140 { 0x00002016, 0x000000DF, 0x0 },
141− { 0x00005012, 0x000000C7, 0x0 },
141+ { 0x80005012, 0x000000C0, 0x1 }, /* Uses I_boost level 0x1 */
142142 };
143143
144144 /* Skylake U */
@@ -146,12 +146,12 @@ static const struct ddi_buf_trans skl_u_ddi_translations_dp[] = { · 1 unmodified line
146146 { 0x0000201B, 0x000000A2, 0x0 },
147147 { 0x00005012, 0x00000088, 0x0 },
148148 { 0x00007011, 0x00000087, 0x0 },
149− { 0x80009010, 0x000000C7, 0x1 }, /* Uses I_boost level 0x1 */
149+ { 0x80009010, 0x000000C0, 0x1 }, /* Uses I_boost level 0x1 */
150150 { 0x0000201B, 0x0000009D, 0x0 },
151− { 0x00005012, 0x000000C7, 0x0 },
152− { 0x00007011, 0x000000C7, 0x0 },
151+ { 0x80005012, 0x000000C0, 0x1 }, /* Uses I_boost level 0x1 */
152+ { 0x80007011, 0x000000C0, 0x1 }, /* Uses I_boost level 0x1 */
153153 { 0x00002016, 0x00000088, 0x0 },
154− { 0x00005012, 0x000000C7, 0x0 },
154+ { 0x80005012, 0x000000C0, 0x1 }, /* Uses I_boost level 0x1 */
155155 };
156156
157157 /* Skylake Y */
@@ -159,12 +159,12 @@ static const struct ddi_buf_trans skl_y_ddi_translations_dp[] = { · 1 unmodified line
159159 { 0x00000018, 0x000000A2, 0x0 },
160160 { 0x00005012, 0x00000088, 0x0 },
161161 { 0x00007011, 0x00000087, 0x0 },
162− { 0x80009010, 0x000000C7, 0x3 }, /* Uses I_boost level 0x3 */
162+ { 0x80009010, 0x000000C0, 0x3 }, /* Uses I_boost level 0x3 */
163163 { 0x00000018, 0x0000009D, 0x0 },
164− { 0x00005012, 0x000000C7, 0x0 },
165− { 0x00007011, 0x000000C7, 0x0 },
164+ { 0x80005012, 0x000000C0, 0x3 }, /* Uses I_boost level 0x3 */
165+ { 0x80007011, 0x000000C0, 0x3 }, /* Uses I_boost level 0x3 */
166166 { 0x00000018, 0x00000088, 0x0 },
167− { 0x00005012, 0x000000C7, 0x0 },
167+ { 0x80005012, 0x000000C0, 0x3 }, /* Uses I_boost level 0x3 */
168168 };
169169
170170 /*
@@ -345,7 +345,7 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder) · 174 unmodified lines
345345 static bool
346346 intel_dig_port_supports_hdmi(const struct intel_digital_port *intel_dig_port)
347347 {
348− return intel_dig_port->hdmi.hdmi_reg;
348+ return i915_mmio_reg_valid(intel_dig_port->hdmi.hdmi_reg);
349349 }
350350
351351 static const struct ddi_buf_trans *skl_get_buf_trans_dp(struct drm_device *dev,
@@ -448,7 +448,7 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port, · 96 unmodified lines
448448 bxt_ddi_vswing_sequence(dev, hdmi_level, port,
449449 INTEL_OUTPUT_HDMI);
450450 return;
451− } else if (IS_SKYLAKE(dev)) {
451+ } else if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
452452 ddi_translations_fdi = NULL;
453453 ddi_translations_dp =
454454 skl_get_buf_trans_dp(dev, &n_dp_entries);
@@ -576,7 +576,7 @@ void intel_prepare_ddi(struct drm_device *dev) · 121 unmodified lines
576576 static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
577577 enum port port)
578578 {
579− uint32_t reg = DDI_BUF_CTL(port);
579+ i915_reg_t reg = DDI_BUF_CTL(port);
580580 int i;
581581
582582 for (i = 0; i < 16; i++) {
@@ -931,7 +931,8 @@ static void hsw_wrpll_update_rnp(uint64_t freq2k, unsigned budget, · 348 unmodified lines
931931 /* Otherwise a < c && b >= d, do nothing */
932932 }
933933
934−static int hsw_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv, int reg)
934+static int hsw_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv,
935+ i915_reg_t reg)
935936 {
936937 int refclk = LC_FREQ;
937938 int n, p, r;
@@ -967,7 +968,7 @@ static int hsw_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv, int reg) · 29 unmodified lines
967968 static int skl_calc_wrpll_link(struct drm_i915_private *dev_priv,
968969 uint32_t dpll)
969970 {
970− uint32_t cfgcr1_reg, cfgcr2_reg;
971+ i915_reg_t cfgcr1_reg, cfgcr2_reg;
971972 uint32_t cfgcr1_val, cfgcr2_val;
972973 uint32_t p0, p1, p2, dco_freq;
973974
@@ -1112,10 +1113,10 @@ static void hsw_ddi_clock_get(struct intel_encoder *encoder, · 138 unmodified lines
11121113 link_clock = 270000;
11131114 break;
11141115 case PORT_CLK_SEL_WRPLL1:
1115− link_clock = hsw_ddi_calc_wrpll_link(dev_priv, WRPLL_CTL1);
1116+ link_clock = hsw_ddi_calc_wrpll_link(dev_priv, WRPLL_CTL(0));
11161117 break;
11171118 case PORT_CLK_SEL_WRPLL2:
1118− link_clock = hsw_ddi_calc_wrpll_link(dev_priv, WRPLL_CTL2);
1119+ link_clock = hsw_ddi_calc_wrpll_link(dev_priv, WRPLL_CTL(1));
11191120 break;
11201121 case PORT_CLK_SEL_SPLL:
11211122 pll = I915_READ(SPLL_CTL) & SPLL_PLL_FREQ_MASK;
@@ -1184,7 +1185,7 @@ void intel_ddi_clock_get(struct intel_encoder *encoder, · 62 unmodified lines
11841185
11851186 if (INTEL_INFO(dev)->gen <= 8)
11861187 hsw_ddi_clock_get(encoder, pipe_config);
1187− else if (IS_SKYLAKE(dev))
1188+ else if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
11881189 skl_ddi_clock_get(encoder, pipe_config);
11891190 else if (IS_BROXTON(dev))
11901191 bxt_ddi_clock_get(encoder, pipe_config);
@@ -1780,7 +1781,7 @@ bool intel_ddi_pll_select(struct intel_crtc *intel_crtc, · 589 unmodified lines
17801781 struct intel_encoder *intel_encoder =
17811782 intel_ddi_get_crtc_new_encoder(crtc_state);
17821783
1783− if (IS_SKYLAKE(dev))
1784+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
17841785 return skl_ddi_pll_select(intel_crtc, crtc_state,
17851786 intel_encoder);
17861787 else if (IS_BROXTON(dev))
@@ -1942,7 +1943,7 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) · 155 unmodified lines
19421943 void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv,
19431944 enum transcoder cpu_transcoder)
19441945 {
1945− uint32_t reg = TRANS_DDI_FUNC_CTL(cpu_transcoder);
1946+ i915_reg_t reg = TRANS_DDI_FUNC_CTL(cpu_transcoder);
19461947 uint32_t val = I915_READ(reg);
19471948
19481949 val &= ~(TRANS_DDI_FUNC_ENABLE | TRANS_DDI_PORT_MASK | TRANS_DDI_DP_VC_PAYLOAD_ALLOC);
@@ -2097,21 +2098,21 @@ static void skl_ddi_set_iboost(struct drm_device *dev, u32 level, · 148 unmodified lines
20972098 iboost = dp_iboost;
20982099 } else {
20992100 ddi_translations = skl_get_buf_trans_dp(dev, &n_entries);
2100− iboost = ddi_translations[port].i_boost;
2101+ iboost = ddi_translations[level].i_boost;
21012102 }
21022103 } else if (type == INTEL_OUTPUT_EDP) {
21032104 if (dp_iboost) {
21042105 iboost = dp_iboost;
21052106 } else {
21062107 ddi_translations = skl_get_buf_trans_edp(dev, &n_entries);
2107− iboost = ddi_translations[port].i_boost;
2108+ iboost = ddi_translations[level].i_boost;
21082109 }
21092110 } else if (type == INTEL_OUTPUT_HDMI) {
21102111 if (hdmi_iboost) {
21112112 iboost = hdmi_iboost;
21122113 } else {
21132114 ddi_translations = skl_get_buf_trans_hdmi(dev, &n_entries);
2114− iboost = ddi_translations[port].i_boost;
2115+ iboost = ddi_translations[level].i_boost;
21152116 }
21162117 } else {
21172118 return;
@@ -2263,7 +2264,7 @@ uint32_t ddi_signal_levels(struct intel_dp *intel_dp) · 145 unmodified lines
22632264
22642265 level = translate_signal_level(signal_levels);
22652266
2266− if (IS_SKYLAKE(dev))
2267+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
22672268 skl_ddi_set_iboost(dev, level, port, encoder->type);
22682269 else if (IS_BROXTON(dev))
22692270 bxt_ddi_vswing_sequence(dev, level, port, encoder->type);
@@ -2271,30 +2272,21 @@ uint32_t ddi_signal_levels(struct intel_dp *intel_dp) · 1 unmodified line
22712272 return DDI_BUF_TRANS_SELECT(level);
22722273 }
22732274
2274−static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
2275+void intel_ddi_clk_select(struct intel_encoder *encoder,
2276+ const struct intel_crtc_state *pipe_config)
22752277 {
2276− struct drm_encoder *encoder = &intel_encoder->base;
2277− struct drm_device *dev = encoder->dev;
2278− struct drm_i915_private *dev_priv = dev->dev_private;
2279− struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
2280− enum port port = intel_ddi_get_encoder_port(intel_encoder);
2281− int type = intel_encoder->type;
2282− int hdmi_level;
2283−
2284− if (type == INTEL_OUTPUT_EDP) {
2285− struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
2286− intel_edp_panel_on(intel_dp);
2287− }
2278+ struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
2279+ enum port port = intel_ddi_get_encoder_port(encoder);
22882280
2289− if (IS_SKYLAKE(dev)) {
2290− uint32_t dpll = crtc->config->ddi_pll_sel;
2281+ if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv)) {
2282+ uint32_t dpll = pipe_config->ddi_pll_sel;
22912283 uint32_t val;
22922284
22932285 /*
22942286 * DPLL0 is used for eDP and is the only "private" DPLL (as
22952287 * opposed to shared) on SKL
22962288 */
2297− if (type == INTEL_OUTPUT_EDP) {
2289+ if (encoder->type == INTEL_OUTPUT_EDP) {
22982290 WARN_ON(dpll != SKL_DPLL0);
22992291
23002292 val = I915_READ(DPLL_CTRL1);
@@ -2302,7 +2294,7 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder) · 1 unmodified line
23022294 val &= ~(DPLL_CTRL1_HDMI_MODE(dpll) |
23032295 DPLL_CTRL1_SSC(dpll) |
23042296 DPLL_CTRL1_LINK_RATE_MASK(dpll));
2305− val |= crtc->config->dpll_hw_state.ctrl1 << (dpll * 6);
2297+ val |= pipe_config->dpll_hw_state.ctrl1 << (dpll * 6);
23062298
23072299 I915_WRITE(DPLL_CTRL1, val);
23082300 POSTING_READ(DPLL_CTRL1);
@@ -2318,10 +2310,28 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder) · 9 unmodified lines
23182310
23192311 I915_WRITE(DPLL_CTRL2, val);
23202312
2321− } else if (INTEL_INFO(dev)->gen < 9) {
2322− WARN_ON(crtc->config->ddi_pll_sel == PORT_CLK_SEL_NONE);
2323− I915_WRITE(PORT_CLK_SEL(port), crtc->config->ddi_pll_sel);
2313+ } else if (INTEL_INFO(dev_priv)->gen < 9) {
2314+ WARN_ON(pipe_config->ddi_pll_sel == PORT_CLK_SEL_NONE);
2315+ I915_WRITE(PORT_CLK_SEL(port), pipe_config->ddi_pll_sel);
23242316 }
2317+}
2318+
2319+static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
2320+{
2321+ struct drm_encoder *encoder = &intel_encoder->base;
2322+ struct drm_device *dev = encoder->dev;
2323+ struct drm_i915_private *dev_priv = dev->dev_private;
2324+ struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
2325+ enum port port = intel_ddi_get_encoder_port(intel_encoder);
2326+ int type = intel_encoder->type;
2327+ int hdmi_level;
2328+
2329+ if (type == INTEL_OUTPUT_EDP) {
2330+ struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
2331+ intel_edp_panel_on(intel_dp);
2332+ }
2333+
2334+ intel_ddi_clk_select(intel_encoder, crtc->config);
23252335
23262336 if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
23272337 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
@@ -2381,7 +2391,7 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) · 53 unmodified lines
23812391 intel_edp_panel_off(intel_dp);
23822392 }
23832393
2384− if (IS_SKYLAKE(dev))
2394+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
23852395 I915_WRITE(DPLL_CTRL2, (I915_READ(DPLL_CTRL2) |
23862396 DPLL_CTRL2_DDI_CLK_OFF(port)));
23872397 else if (INTEL_INFO(dev)->gen < 9)
@@ -2553,7 +2563,7 @@ static const char * const skl_ddi_pll_names[] = { · 165 unmodified lines
25532563 };
25542564
25552565 struct skl_dpll_regs {
2556− u32 ctl, cfgcr1, cfgcr2;
2566+ i915_reg_t ctl, cfgcr1, cfgcr2;
25572567 };
25582568
25592569 /* this array is indexed by the *shared* pll id */
@@ -2566,13 +2576,13 @@ static const struct skl_dpll_regs skl_dpll_regs[3] = { · 6 unmodified lines
25662576 },
25672577 {
25682578 /* DPLL 2 */
2569− .ctl = WRPLL_CTL1,
2579+ .ctl = WRPLL_CTL(0),
25702580 .cfgcr1 = DPLL_CFGCR1(SKL_DPLL2),
25712581 .cfgcr2 = DPLL_CFGCR2(SKL_DPLL2),
25722582 },
25732583 {
25742584 /* DPLL 3 */
2575− .ctl = WRPLL_CTL2,
2585+ .ctl = WRPLL_CTL(1),
25762586 .cfgcr1 = DPLL_CFGCR1(SKL_DPLL3),
25772587 .cfgcr2 = DPLL_CFGCR2(SKL_DPLL3),
25782588 },
@@ -2992,22 +3002,22 @@ void intel_ddi_pll_init(struct drm_device *dev) · 413 unmodified lines
29923002 struct drm_i915_private *dev_priv = dev->dev_private;
29933003 uint32_t val = I915_READ(LCPLL_CTL);
29943004
2995− if (IS_SKYLAKE(dev))
3005+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
29963006 skl_shared_dplls_init(dev_priv);
29973007 else if (IS_BROXTON(dev))
29983008 bxt_shared_dplls_init(dev_priv);
29993009 else
30003010 hsw_shared_dplls_init(dev_priv);
30013011
3002− if (IS_SKYLAKE(dev)) {
3012+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
30033013 int cdclk_freq;
30043014
30053015 cdclk_freq = dev_priv->display.get_display_clock_speed(dev);
30063016 dev_priv->skl_boot_cdclk = cdclk_freq;
3017+ if (skl_sanitize_cdclk(dev_priv))
3018+ DRM_DEBUG_KMS("Sanitized cdclk programmed by pre-os\n");
30073019 if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE))
30083020 DRM_ERROR("LCPLL1 is disabled\n");
3009− else
3010− intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
30113021 } else if (IS_BROXTON(dev)) {
30123022 broxton_init_cdclk(dev);
30133023 broxton_ddi_phy_init(dev);
@@ -3026,11 +3036,11 @@ void intel_ddi_pll_init(struct drm_device *dev) · 12 unmodified lines
30263036 }
30273037 }
30283038
3029−void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder)
3039+void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp)
30303040 {
3031− struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
3032− struct intel_dp *intel_dp = &intel_dig_port->dp;
3033− struct drm_i915_private *dev_priv = encoder->dev->dev_private;
3041+ struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
3042+ struct drm_i915_private *dev_priv =
3043+ to_i915(intel_dig_port->base.base.dev);
30343044 enum port port = intel_dig_port->port;
30353045 uint32_t val;
30363046 bool wait = false;
@@ -3285,10 +3295,25 @@ void intel_ddi_init(struct drm_device *dev, enum port port) · 248 unmodified lines
32853295 intel_encoder->get_config = intel_ddi_get_config;
32863296
32873297 intel_dig_port->port = port;
3298+ dev_priv->dig_port_map[port] = intel_encoder;
32883299 intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
32893300 (DDI_BUF_PORT_REVERSAL |
32903301 DDI_A_4_LANES);
32913302
3303+ /*
3304+ * Bspec says that DDI_A_4_LANES is the only supported configuration
3305+ * for Broxton. Yet some BIOS fail to set this bit on port A if eDP
3306+ * wasn't lit up at boot. Force this bit on in our internal
3307+ * configuration so that we use the proper lane count for our
3308+ * calculations.
3309+ */
3310+ if (IS_BROXTON(dev) && port == PORT_A) {
3311+ if (!(intel_dig_port->saved_port_bits & DDI_A_4_LANES)) {
3312+ DRM_DEBUG_KMS("BXT BIOS forgot to set DDI_A_4_LANES for port A; fixing\n");
3313+ intel_dig_port->saved_port_bits |= DDI_A_4_LANES;
3314+ }
3315+ }
3316+
32923317 intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
32933318 intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
32943319 intel_encoder->cloneable = 0;
@@ -3302,8 +3327,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port) · 7 unmodified lines
33023327 * On BXT A0/A1, sw needs to activate DDIA HPD logic and
33033328 * interrupts to check the external panel connection.
33043329 */
3305− if (IS_BROXTON(dev_priv) && (INTEL_REVID(dev) < BXT_REVID_B0)
3306− && port == PORT_B)
3330+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1) && port == PORT_B)
33073331 dev_priv->hotplug.irq_port[PORT_A] = intel_dig_port;
33083332 else
33093333 dev_priv->hotplug.irq_port[port] = intel_dig_port;
drivers/gpu/drm/i915/intel_display.c+511−287
@@ -1096,7 +1096,7 @@ enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv, · 1095 unmodified lines
10961096 static bool pipe_dsl_stopped(struct drm_device *dev, enum pipe pipe)
10971097 {
10981098 struct drm_i915_private *dev_priv = dev->dev_private;
1099− u32 reg = PIPEDSL(pipe);
1099+ i915_reg_t reg = PIPEDSL(pipe);
11001100 u32 line1, line2;
11011101 u32 line_mask;
11021102
@@ -1136,7 +1136,7 @@ static void intel_wait_for_pipe_off(struct intel_crtc *crtc) · 33 unmodified lines
11361136 enum pipe pipe = crtc->pipe;
11371137
11381138 if (INTEL_INFO(dev)->gen >= 4) {
1139− int reg = PIPECONF(cpu_transcoder);
1139+ i915_reg_t reg = PIPECONF(cpu_transcoder);
11401140
11411141 /* Wait for the Pipe State to go off */
11421142 if (wait_for((I915_READ(reg) & I965_PIPECONF_ACTIVE) == 0,
@@ -1286,7 +1286,7 @@ void assert_panel_unlocked(struct drm_i915_private *dev_priv, · 143 unmodified lines
12861286 enum pipe pipe)
12871287 {
12881288 struct drm_device *dev = dev_priv->dev;
1289− int pp_reg;
1289+ i915_reg_t pp_reg;
12901290 u32 val;
12911291 enum pipe panel_pipe = PIPE_A;
12921292 bool locked = true;
@@ -1481,8 +1481,7 @@ static bool dp_pipe_enabled(struct drm_i915_private *dev_priv, · 188 unmodified lines
14811481 return false;
14821482
14831483 if (HAS_PCH_CPT(dev_priv->dev)) {
1484− u32 trans_dp_ctl_reg = TRANS_DP_CTL(pipe);
1485− u32 trans_dp_ctl = I915_READ(trans_dp_ctl_reg);
1484+ u32 trans_dp_ctl = I915_READ(TRANS_DP_CTL(pipe));
14861485 if ((trans_dp_ctl & TRANS_DP_PORT_SEL_MASK) != port_sel)
14871486 return false;
14881487 } else if (IS_CHERRYVIEW(dev_priv->dev)) {
@@ -1546,12 +1545,13 @@ static bool adpa_pipe_enabled(struct drm_i915_private *dev_priv, · 57 unmodified lines
15461545 }
15471546
15481547 static void assert_pch_dp_disabled(struct drm_i915_private *dev_priv,
1549− enum pipe pipe, int reg, u32 port_sel)
1548+ enum pipe pipe, i915_reg_t reg,
1549+ u32 port_sel)
15501550 {
15511551 u32 val = I915_READ(reg);
15521552 I915_STATE_WARN(dp_pipe_enabled(dev_priv, pipe, port_sel, val),
15531553 "PCH DP (0x%08x) enabled on transcoder %c, should be disabled\n",
1554− reg, pipe_name(pipe));
1554+ i915_mmio_reg_offset(reg), pipe_name(pipe));
15551555
15561556 I915_STATE_WARN(HAS_PCH_IBX(dev_priv->dev) && (val & DP_PORT_EN) == 0
15571557 && (val & DP_PIPEB_SELECT),
@@ -1559,12 +1559,12 @@ static void assert_pch_dp_disabled(struct drm_i915_private *dev_priv, · 1 unmodified line
15591559 }
15601560
15611561 static void assert_pch_hdmi_disabled(struct drm_i915_private *dev_priv,
1562− enum pipe pipe, int reg)
1562+ enum pipe pipe, i915_reg_t reg)
15631563 {
15641564 u32 val = I915_READ(reg);
15651565 I915_STATE_WARN(hdmi_pipe_enabled(dev_priv, pipe, val),
15661566 "PCH HDMI (0x%08x) enabled on transcoder %c, should be disabled\n",
1567− reg, pipe_name(pipe));
1567+ i915_mmio_reg_offset(reg), pipe_name(pipe));
15681568
15691569 I915_STATE_WARN(HAS_PCH_IBX(dev_priv->dev) && (val & SDVO_ENABLE) == 0
15701570 && (val & SDVO_PIPE_B_SELECT),
@@ -1600,7 +1600,7 @@ static void vlv_enable_pll(struct intel_crtc *crtc, · 29 unmodified lines
16001600 {
16011601 struct drm_device *dev = crtc->base.dev;
16021602 struct drm_i915_private *dev_priv = dev->dev_private;
1603− int reg = DPLL(crtc->pipe);
1603+ i915_reg_t reg = DPLL(crtc->pipe);
16041604 u32 dpll = pipe_config->dpll_hw_state.dpll;
16051605
16061606 assert_pipe_disabled(dev_priv, crtc->pipe);
@@ -1689,7 +1689,7 @@ static void i9xx_enable_pll(struct intel_crtc *crtc) · 82 unmodified lines
16891689 {
16901690 struct drm_device *dev = crtc->base.dev;
16911691 struct drm_i915_private *dev_priv = dev->dev_private;
1692− int reg = DPLL(crtc->pipe);
1692+ i915_reg_t reg = DPLL(crtc->pipe);
16931693 u32 dpll = crtc->config->dpll_hw_state.dpll;
16941694
16951695 assert_pipe_disabled(dev_priv, crtc->pipe);
@@ -1838,7 +1838,7 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, · 142 unmodified lines
18381838 unsigned int expected_mask)
18391839 {
18401840 u32 port_mask;
1841− int dpll_reg;
1841+ i915_reg_t dpll_reg;
18421842
18431843 switch (dport->port) {
18441844 case PORT_B:
@@ -1963,7 +1963,8 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv, · 118 unmodified lines
19631963 struct drm_device *dev = dev_priv->dev;
19641964 struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
19651965 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1966− uint32_t reg, val, pipeconf_val;
1966+ i915_reg_t reg;
1967+ uint32_t val, pipeconf_val;
19671968
19681969 /* PCH only available on ILK+ */
19691970 BUG_ON(!HAS_PCH_SPLIT(dev));
@@ -2052,7 +2053,8 @@ static void ironlake_disable_pch_transcoder(struct drm_i915_private *dev_priv, · 82 unmodified lines
20522053 enum pipe pipe)
20532054 {
20542055 struct drm_device *dev = dev_priv->dev;
2055− uint32_t reg, val;
2056+ i915_reg_t reg;
2057+ uint32_t val;
20562058
20572059 /* FDI relies on the transcoder */
20582060 assert_fdi_tx_disabled(dev_priv, pipe);
@@ -2069,7 +2071,7 @@ static void ironlake_disable_pch_transcoder(struct drm_i915_private *dev_priv, · 10 unmodified lines
20692071 if (wait_for((I915_READ(reg) & TRANS_STATE_ENABLE) == 0, 50))
20702072 DRM_ERROR("failed to disable transcoder %c\n", pipe_name(pipe));
20712073
2072− if (!HAS_PCH_IBX(dev)) {
2074+ if (HAS_PCH_CPT(dev)) {
20732075 /* Workaround: Clear the timing override chicken bit again. */
20742076 reg = TRANS_CHICKEN2(pipe);
20752077 val = I915_READ(reg);
@@ -2107,10 +2109,9 @@ static void intel_enable_pipe(struct intel_crtc *crtc) · 31 unmodified lines
21072109 struct drm_device *dev = crtc->base.dev;
21082110 struct drm_i915_private *dev_priv = dev->dev_private;
21092111 enum pipe pipe = crtc->pipe;
2110− enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv,
2111− pipe);
2112+ enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
21122113 enum pipe pch_transcoder;
2113− int reg;
2114+ i915_reg_t reg;
21142115 u32 val;
21152116
21162117 DRM_DEBUG_KMS("enabling pipe %c\n", pipe_name(pipe));
@@ -2171,7 +2172,7 @@ static void intel_disable_pipe(struct intel_crtc *crtc) · 54 unmodified lines
21712172 struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
21722173 enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
21732174 enum pipe pipe = crtc->pipe;
2174− int reg;
2175+ i915_reg_t reg;
21752176 u32 val;
21762177
21772178 DRM_DEBUG_KMS("disabling pipe %c\n", pipe_name(pipe));
@@ -2270,20 +2271,20 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height, · 92 unmodified lines
22702271 fb_format_modifier, 0));
22712272 }
22722273
2273−static int
2274+static void
22742275 intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb,
22752276 const struct drm_plane_state *plane_state)
22762277 {
2277− struct intel_rotation_info *info = &view->rotation_info;
2278+ struct intel_rotation_info *info = &view->params.rotation_info;
22782279 unsigned int tile_height, tile_pitch;
22792280
22802281 *view = i915_ggtt_view_normal;
22812282
22822283 if (!plane_state)
2283− return 0;
2284+ return;
22842285
22852286 if (!intel_rotation_90_or_270(plane_state->rotation))
2286− return 0;
2287+ return;
22872288
22882289 *view = i915_ggtt_view_rotated;
22892290
@@ -2310,8 +2311,6 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, · 20 unmodified lines
23102311 info->size_uv = info->width_pages_uv * info->height_pages_uv *
23112312 PAGE_SIZE;
23122313 }
2313−
2314− return 0;
23152314 }
23162315
23172316 static unsigned int intel_linear_alignment(struct drm_i915_private *dev_priv)
@@ -2330,9 +2329,7 @@ static unsigned int intel_linear_alignment(struct drm_i915_private *dev_priv) · 12 unmodified lines
23302329 int
23312330 intel_pin_and_fence_fb_obj(struct drm_plane *plane,
23322331 struct drm_framebuffer *fb,
2333− const struct drm_plane_state *plane_state,
2334− struct intel_engine_cs *pipelined,
2335− struct drm_i915_gem_request **pipelined_request)
2332+ const struct drm_plane_state *plane_state)
23362333 {
23372334 struct drm_device *dev = fb->dev;
23382335 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -2367,9 +2364,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane, · 28 unmodified lines
23672364 return -EINVAL;
23682365 }
23692366
2370− ret = intel_fill_fb_ggtt_view(&view, fb, plane_state);
2371− if (ret)
2372− return ret;
2367+ intel_fill_fb_ggtt_view(&view, fb, plane_state);
23732368
23742369 /* Note that the w/a also requires 64 PTE of padding following the
23752370 * bo. We currently fill all unused PTE with the shadow page and so
@@ -2388,11 +2383,10 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane, · 12 unmodified lines
23882383 */
23892384 intel_runtime_pm_get(dev_priv);
23902385
2391− dev_priv->mm.interruptible = false;
2392− ret = i915_gem_object_pin_to_display_plane(obj, alignment, pipelined,
2393− pipelined_request, &view);
2386+ ret = i915_gem_object_pin_to_display_plane(obj, alignment,
2387+ &view);
23942388 if (ret)
2395− goto err_interruptible;
2389+ goto err_pm;
23962390
23972391 /* Install a fence for tiled scan-out. Pre-i965 always needs a
23982392 * fence, whereas 965+ only requires a fence if using
@@ -2418,14 +2412,12 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane, · 19 unmodified lines
24182412 i915_gem_object_pin_fence(obj);
24192413 }
24202414
2421− dev_priv->mm.interruptible = true;
24222415 intel_runtime_pm_put(dev_priv);
24232416 return 0;
24242417
24252418 err_unpin:
24262419 i915_gem_object_unpin_from_display_plane(obj, &view);
2427−err_interruptible:
2428− dev_priv->mm.interruptible = true;
2420+err_pm:
24292421 intel_runtime_pm_put(dev_priv);
24302422 return ret;
24312423 }
@@ -2435,12 +2427,10 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb, · 3 unmodified lines
24352427 {
24362428 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
24372429 struct i915_ggtt_view view;
2438− int ret;
24392430
24402431 WARN_ON(!mutex_is_locked(&obj->base.dev->struct_mutex));
24412432
2442− ret = intel_fill_fb_ggtt_view(&view, fb, plane_state);
2443− WARN_ONCE(ret, "Couldn't get view from plane state!");
2433+ intel_fill_fb_ggtt_view(&view, fb, plane_state);
24442434
24452435 if (view.type == I915_GGTT_VIEW_NORMAL)
24462436 i915_gem_object_unpin_fence(obj);
@@ -2695,7 +2685,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc, · 248 unmodified lines
26952685 int plane = intel_crtc->plane;
26962686 unsigned long linear_offset;
26972687 u32 dspcntr;
2698− u32 reg = DSPCNTR(plane);
2688+ i915_reg_t reg = DSPCNTR(plane);
26992689 int pixel_size;
27002690
27012691 if (!visible || !fb) {
@@ -2825,7 +2815,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc, · 123 unmodified lines
28252815 int plane = intel_crtc->plane;
28262816 unsigned long linear_offset;
28272817 u32 dspcntr;
2828− u32 reg = DSPCNTR(plane);
2818+ i915_reg_t reg = DSPCNTR(plane);
28292819 int pixel_size;
28302820
28312821 if (!visible || !fb) {
@@ -2950,30 +2940,32 @@ u32 intel_fb_stride_alignment(struct drm_device *dev, uint64_t fb_modifier, · 118 unmodified lines
29502940 }
29512941 }
29522942
2953−unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
2954− struct drm_i915_gem_object *obj,
2955− unsigned int plane)
2943+u32 intel_plane_obj_offset(struct intel_plane *intel_plane,
2944+ struct drm_i915_gem_object *obj,
2945+ unsigned int plane)
29562946 {
2957− const struct i915_ggtt_view *view = &i915_ggtt_view_normal;
2947+ struct i915_ggtt_view view;
29582948 struct i915_vma *vma;
2959− unsigned char *offset;
2949+ u64 offset;
29602950
2961− if (intel_rotation_90_or_270(intel_plane->base.state->rotation))
2962− view = &i915_ggtt_view_rotated;
2951+ intel_fill_fb_ggtt_view(&view, intel_plane->base.fb,
2952+ intel_plane->base.state);
29632953
2964− vma = i915_gem_obj_to_ggtt_view(obj, view);
2954+ vma = i915_gem_obj_to_ggtt_view(obj, &view);
29652955 if (WARN(!vma, "ggtt vma for display object not found! (view=%u)\n",
2966− view->type))
2956+ view.type))
29672957 return -1;
29682958
2969− offset = (unsigned char *)vma->node.start;
2959+ offset = vma->node.start;
29702960
29712961 if (plane == 1) {
2972− offset += vma->ggtt_view.rotation_info.uv_start_page *
2962+ offset += vma->ggtt_view.params.rotation_info.uv_start_page *
29732963 PAGE_SIZE;
29742964 }
29752965
2976− return (unsigned long)offset;
2966+ WARN_ON(upper_32_bits(offset));
2967+
2968+ return lower_32_bits(offset);
29772969 }
29782970
29792971 static void skl_detach_scaler(struct intel_crtc *intel_crtc, int id)
@@ -3099,7 +3091,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc, · 119 unmodified lines
30993091 u32 tile_height, plane_offset, plane_size;
31003092 unsigned int rotation;
31013093 int x_offset, y_offset;
3102− unsigned long surf_addr;
3094+ u32 surf_addr;
31033095 struct intel_crtc_state *crtc_state = intel_crtc->config;
31043096 struct intel_plane_state *plane_state;
31053097 int src_x = 0, src_y = 0, src_w = 0, src_h = 0;
@@ -3227,10 +3219,9 @@ static void intel_update_primary_planes(struct drm_device *dev) · 121 unmodified lines
32273219 struct intel_plane_state *plane_state;
32283220
32293221 drm_modeset_lock_crtc(crtc, &plane->base);
3230−
32313222 plane_state = to_intel_plane_state(plane->base.state);
32323223
3233− if (plane_state->base.fb)
3224+ if (crtc->state->active && plane_state->base.fb)
32343225 plane->commit_plane(&plane->base, plane_state);
32353226
32363227 drm_modeset_unlock_crtc(crtc);
@@ -3306,32 +3297,6 @@ void intel_finish_reset(struct drm_device *dev) · 69 unmodified lines
33063297 drm_modeset_unlock_all(dev);
33073298 }
33083299
3309−static void
3310−intel_finish_fb(struct drm_framebuffer *old_fb)
3311−{
3312− struct drm_i915_gem_object *obj = intel_fb_obj(old_fb);
3313− struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
3314− bool was_interruptible = dev_priv->mm.interruptible;
3315− int ret;
3316−
3317− /* Big Hammer, we also need to ensure that any pending
3318− * MI_WAIT_FOR_EVENT inside a user batch buffer on the
3319− * current scanout is retired before unpinning the old
3320− * framebuffer. Note that we rely on userspace rendering
3321− * into the buffer attached to the pipe they are waiting
3322− * on. If not, userspace generates a GPU hang with IPEHR
3323− * point to the MI_WAIT_FOR_EVENT.
3324− *
3325− * This should only fail upon a hung GPU, in which case we
3326− * can safely continue.
3327− */
3328− dev_priv->mm.interruptible = false;
3329− ret = i915_gem_object_wait_rendering(obj, true);
3330− dev_priv->mm.interruptible = was_interruptible;
3331−
3332− WARN_ON(ret);
3333−}
3334−
33353300 static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc)
33363301 {
33373302 struct drm_device *dev = crtc->dev;
@@ -3401,7 +3366,8 @@ static void intel_fdi_normal_train(struct drm_crtc *crtc) · 63 unmodified lines
34013366 struct drm_i915_private *dev_priv = dev->dev_private;
34023367 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
34033368 int pipe = intel_crtc->pipe;
3404− u32 reg, temp;
3369+ i915_reg_t reg;
3370+ u32 temp;
34053371
34063372 /* enable normal train */
34073373 reg = FDI_TX_CTL(pipe);
@@ -3443,7 +3409,8 @@ static void ironlake_fdi_link_train(struct drm_crtc *crtc) · 35 unmodified lines
34433409 struct drm_i915_private *dev_priv = dev->dev_private;
34443410 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
34453411 int pipe = intel_crtc->pipe;
3446− u32 reg, temp, tries;
3412+ i915_reg_t reg;
3413+ u32 temp, tries;
34473414
34483415 /* FDI needs bits from pipe first */
34493416 assert_pipe_enabled(dev_priv, pipe);
@@ -3543,7 +3510,8 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc) · 93 unmodified lines
35433510 struct drm_i915_private *dev_priv = dev->dev_private;
35443511 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
35453512 int pipe = intel_crtc->pipe;
3546− u32 reg, temp, i, retry;
3513+ i915_reg_t reg;
3514+ u32 temp, i, retry;
35473515
35483516 /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
35493517 for train result */
@@ -3675,7 +3643,8 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc) · 125 unmodified lines
36753643 struct drm_i915_private *dev_priv = dev->dev_private;
36763644 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
36773645 int pipe = intel_crtc->pipe;
3678− u32 reg, temp, i, j;
3646+ i915_reg_t reg;
3647+ u32 temp, i, j;
36793648
36803649 /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
36813650 for train result */
@@ -3792,8 +3761,8 @@ static void ironlake_fdi_pll_enable(struct intel_crtc *intel_crtc) · 110 unmodified lines
37923761 struct drm_device *dev = intel_crtc->base.dev;
37933762 struct drm_i915_private *dev_priv = dev->dev_private;
37943763 int pipe = intel_crtc->pipe;
3795− u32 reg, temp;
3796−
3764+ i915_reg_t reg;
3765+ u32 temp;
37973766
37983767 /* enable PCH FDI RX PLL, wait warmup plus DMI latency */
37993768 reg = FDI_RX_CTL(pipe);
@@ -3829,7 +3798,8 @@ static void ironlake_fdi_pll_disable(struct intel_crtc *intel_crtc) · 29 unmodified lines
38293798 struct drm_device *dev = intel_crtc->base.dev;
38303799 struct drm_i915_private *dev_priv = dev->dev_private;
38313800 int pipe = intel_crtc->pipe;
3832− u32 reg, temp;
3801+ i915_reg_t reg;
3802+ u32 temp;
38333803
38343804 /* Switch from PCDclk to Rawclk */
38353805 reg = FDI_RX_CTL(pipe);
@@ -3859,7 +3829,8 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) · 23 unmodified lines
38593829 struct drm_i915_private *dev_priv = dev->dev_private;
38603830 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
38613831 int pipe = intel_crtc->pipe;
3862− u32 reg, temp;
3832+ i915_reg_t reg;
3833+ u32 temp;
38633834
38643835 /* disable CPU FDI tx and PCH FDI rx */
38653836 reg = FDI_TX_CTL(pipe);
@@ -3952,15 +3923,23 @@ static void page_flip_completed(struct intel_crtc *intel_crtc) · 86 unmodified lines
39523923 work->pending_flip_obj);
39533924 }
39543925
3955−void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
3926+static int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
39563927 {
39573928 struct drm_device *dev = crtc->dev;
39583929 struct drm_i915_private *dev_priv = dev->dev_private;
3930+ long ret;
39593931
39603932 WARN_ON(waitqueue_active(&dev_priv->pending_flip_queue));
3961− if (WARN_ON(wait_event_timeout(dev_priv->pending_flip_queue,
3962− !intel_crtc_has_pending_flip(crtc),
3963− 60*HZ) == 0)) {
3933+
3934+ ret = wait_event_interruptible_timeout(
3935+ dev_priv->pending_flip_queue,
3936+ !intel_crtc_has_pending_flip(crtc),
3937+ 60*HZ);
3938+
3939+ if (ret < 0)
3940+ return ret;
3941+
3942+ if (ret == 0) {
39643943 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
39653944
39663945 spin_lock_irq(&dev->event_lock);
@@ -3971,11 +3950,7 @@ void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) · 4 unmodified lines
39713950 spin_unlock_irq(&dev->event_lock);
39723951 }
39733952
3974− if (crtc->primary->fb) {
3975− mutex_lock(&dev->struct_mutex);
3976− intel_finish_fb(crtc->primary->fb);
3977− mutex_unlock(&dev->struct_mutex);
3978− }
3953+ return 0;
39793954 }
39803955
39813956 /* Program iCLKIP clock to the desired frequency */
@@ -4135,6 +4110,22 @@ static void ivybridge_update_fdi_bc_bifurcation(struct intel_crtc *intel_crtc) · 153 unmodified lines
41354110 }
41364111 }
41374112
4113+/* Return which DP Port should be selected for Transcoder DP control */
4114+static enum port
4115+intel_trans_dp_port_sel(struct drm_crtc *crtc)
4116+{
4117+ struct drm_device *dev = crtc->dev;
4118+ struct intel_encoder *encoder;
4119+
4120+ for_each_encoder_on_crtc(dev, crtc, encoder) {
4121+ if (encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
4122+ encoder->type == INTEL_OUTPUT_EDP)
4123+ return enc_to_dig_port(&encoder->base)->port;
4124+ }
4125+
4126+ return -1;
4127+}
4128+
41384129 /*
41394130 * Enable PCH resources required for PCH ports:
41404131 * - PCH PLLs
@@ -4149,7 +4140,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc) · 8 unmodified lines
41494140 struct drm_i915_private *dev_priv = dev->dev_private;
41504141 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
41514142 int pipe = intel_crtc->pipe;
4152− u32 reg, temp;
4143+ u32 temp;
41534144
41544145 assert_pch_transcoder_disabled(dev_priv, pipe);
41554146
@@ -4196,8 +4187,10 @@ static void ironlake_pch_enable(struct drm_crtc *crtc) · 40 unmodified lines
41964187
41974188 /* For PCH DP, enable TRANS_DP_CTL */
41984189 if (HAS_PCH_CPT(dev) && intel_crtc->config->has_dp_encoder) {
4190+ const struct drm_display_mode *adjusted_mode =
4191+ &intel_crtc->config->base.adjusted_mode;
41994192 u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5;
4200− reg = TRANS_DP_CTL(pipe);
4193+ i915_reg_t reg = TRANS_DP_CTL(pipe);
42014194 temp = I915_READ(reg);
42024195 temp &= ~(TRANS_DP_PORT_SEL_MASK |
42034196 TRANS_DP_SYNC_MASK |
@@ -4205,19 +4198,19 @@ static void ironlake_pch_enable(struct drm_crtc *crtc) · 1 unmodified line
42054198 temp |= TRANS_DP_OUTPUT_ENABLE;
42064199 temp |= bpc << 9; /* same format but at 11:9 */
42074200
4208− if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC)
4201+ if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
42094202 temp |= TRANS_DP_HSYNC_ACTIVE_HIGH;
4210− if (crtc->mode.flags & DRM_MODE_FLAG_PVSYNC)
4203+ if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
42114204 temp |= TRANS_DP_VSYNC_ACTIVE_HIGH;
42124205
42134206 switch (intel_trans_dp_port_sel(crtc)) {
4214− case PCH_DP_B:
4207+ case PORT_B:
42154208 temp |= TRANS_DP_PORT_SEL_B;
42164209 break;
4217− case PCH_DP_C:
4210+ case PORT_C:
42184211 temp |= TRANS_DP_PORT_SEL_C;
42194212 break;
4220− case PCH_DP_D:
4213+ case PORT_D:
42214214 temp |= TRANS_DP_PORT_SEL_D;
42224215 break;
42234216 default:
@@ -4357,7 +4350,7 @@ static void intel_shared_dpll_commit(struct drm_atomic_state *state) · 133 unmodified lines
43574350 static void cpt_verify_modeset(struct drm_device *dev, int pipe)
43584351 {
43594352 struct drm_i915_private *dev_priv = dev->dev_private;
4360− int dslreg = PIPEDSL(pipe);
4353+ i915_reg_t dslreg = PIPEDSL(pipe);
43614354 u32 temp;
43624355
43634356 temp = I915_READ(dslreg);
@@ -4667,7 +4660,7 @@ static void intel_crtc_load_lut(struct drm_crtc *crtc) · 303 unmodified lines
46674660 }
46684661
46694662 for (i = 0; i < 256; i++) {
4670− u32 palreg;
4663+ i915_reg_t palreg;
46714664
46724665 if (HAS_GMCH_DISPLAY(dev))
46734666 palreg = PALETTE(pipe, i);
@@ -4746,9 +4739,9 @@ intel_post_enable_primary(struct drm_crtc *crtc) · 72 unmodified lines
47464739 if (IS_GEN2(dev))
47474740 intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
47484741
4749− /* Underruns don't raise interrupts, so check manually. */
4750− if (HAS_GMCH_DISPLAY(dev))
4751− i9xx_check_fifo_underruns(dev_priv);
4742+ /* Underruns don't always raise interrupts, so check manually. */
4743+ intel_check_cpu_fifo_underruns(dev_priv);
4744+ intel_check_pch_fifo_underruns(dev_priv);
47524745 }
47534746
47544747 /**
@@ -4807,7 +4800,6 @@ static void intel_post_plane_update(struct intel_crtc *crtc) · 52 unmodified lines
48074800 struct intel_crtc_atomic_commit *atomic = &crtc->atomic;
48084801 struct drm_device *dev = crtc->base.dev;
48094802 struct drm_i915_private *dev_priv = dev->dev_private;
4810− struct drm_plane *plane;
48114803
48124804 if (atomic->wait_vblank)
48134805 intel_wait_for_vblank(dev, crtc->pipe);
@@ -4826,10 +4818,6 @@ static void intel_post_plane_update(struct intel_crtc *crtc) · 12 unmodified lines
48264818 if (atomic->post_enable_primary)
48274819 intel_post_enable_primary(&crtc->base);
48284820
4829− drm_for_each_plane_mask(plane, dev, atomic->update_sprite_watermarks)
4830− intel_update_sprite_watermarks(plane, &crtc->base,
4831− 0, 0, 0, false, false);
4832−
48334821 memset(atomic, 0, sizeof(*atomic));
48344822 }
48354823
@@ -4838,20 +4826,6 @@ static void intel_pre_plane_update(struct intel_crtc *crtc) · 2 unmodified lines
48384826 struct drm_device *dev = crtc->base.dev;
48394827 struct drm_i915_private *dev_priv = dev->dev_private;
48404828 struct intel_crtc_atomic_commit *atomic = &crtc->atomic;
4841− struct drm_plane *p;
4842−
4843− /* Track fb's for any planes being disabled */
4844− drm_for_each_plane_mask(p, dev, atomic->disabled_planes) {
4845− struct intel_plane *plane = to_intel_plane(p);
4846−
4847− mutex_lock(&dev->struct_mutex);
4848− i915_gem_track_fb(intel_fb_obj(plane->base.fb), NULL,
4849− plane->frontbuffer_bit);
4850− mutex_unlock(&dev->struct_mutex);
4851− }
4852−
4853− if (atomic->wait_for_flips)
4854− intel_crtc_wait_for_pending_flips(&crtc->base);
48554829
48564830 if (atomic->disable_fbc)
48574831 intel_fbc_disable_crtc(crtc);
@@ -4899,6 +4873,9 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) · 41 unmodified lines
48994873 if (WARN_ON(intel_crtc->active))
49004874 return;
49014875
4876+ if (intel_crtc->config->has_pch_encoder)
4877+ intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, false);
4878+
49024879 if (intel_crtc->config->has_pch_encoder)
49034880 intel_prepare_shared_dpll(intel_crtc);
49044881
@@ -4917,7 +4894,6 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) · 12 unmodified lines
49174894 intel_crtc->active = true;
49184895
49194896 intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
4920− intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, true);
49214897
49224898 for_each_encoder_on_crtc(dev, crtc, encoder)
49234899 if (encoder->pre_enable)
@@ -4955,6 +4931,11 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) · 31 unmodified lines
49554931
49564932 if (HAS_PCH_CPT(dev))
49574933 cpt_verify_modeset(dev, intel_crtc->pipe);
4934+
4935+ /* Must wait for vblank to avoid spurious PCH FIFO underruns */
4936+ if (intel_crtc->config->has_pch_encoder)
4937+ intel_wait_for_vblank(dev, pipe);
4938+ intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, true);
49584939 }
49594940
49604941 /* IPS only exists on ULT machines and is tied to pipe A. */
@@ -4977,6 +4958,10 @@ static void haswell_crtc_enable(struct drm_crtc *crtc) · 16 unmodified lines
49774958 if (WARN_ON(intel_crtc->active))
49784959 return;
49794960
4961+ if (intel_crtc->config->has_pch_encoder)
4962+ intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A,
4963+ false);
4964+
49804965 if (intel_crtc_to_shared_dpll(intel_crtc))
49814966 intel_enable_shared_dpll(intel_crtc);
49824967
@@ -5009,11 +4994,8 @@ static void haswell_crtc_enable(struct drm_crtc *crtc) · 26 unmodified lines
50094994 encoder->pre_enable(encoder);
50104995 }
50114996
5012− if (intel_crtc->config->has_pch_encoder) {
5013− intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A,
5014− true);
4997+ if (intel_crtc->config->has_pch_encoder)
50154998 dev_priv->display.fdi_link_train(crtc);
5016− }
50174999
50185000 if (!is_dsi)
50195001 intel_ddi_enable_pipe_clock(intel_crtc);
@@ -5050,6 +5032,10 @@ static void haswell_crtc_enable(struct drm_crtc *crtc) · 30 unmodified lines
50505032 intel_opregion_notify_encoder(encoder, true);
50515033 }
50525034
5035+ if (intel_crtc->config->has_pch_encoder)
5036+ intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A,
5037+ true);
5038+
50535039 /* If we change the relative order between pipe/planes enabling, we need
50545040 * to change the workaround. */
50555041 hsw_workaround_pipe = pipe_config->hsw_workaround_pipe;
@@ -5081,7 +5067,9 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) · 25 unmodified lines
50815067 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
50825068 struct intel_encoder *encoder;
50835069 int pipe = intel_crtc->pipe;
5084− u32 reg, temp;
5070+
5071+ if (intel_crtc->config->has_pch_encoder)
5072+ intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, false);
50855073
50865074 for_each_encoder_on_crtc(dev, crtc, encoder)
50875075 encoder->disable(encoder);
@@ -5089,9 +5077,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) · 1 unmodified line
50895077 drm_crtc_vblank_off(crtc);
50905078 assert_vblank_disabled(crtc);
50915079
5092− if (intel_crtc->config->has_pch_encoder)
5093− intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, false);
5094−
50955080 intel_disable_pipe(intel_crtc);
50965081
50975082 ironlake_pfit_disable(intel_crtc, false);
@@ -5107,6 +5092,9 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) · 9 unmodified lines
51075092 ironlake_disable_pch_transcoder(dev_priv, pipe);
51085093
51095094 if (HAS_PCH_CPT(dev)) {
5095+ i915_reg_t reg;
5096+ u32 temp;
5097+
51105098 /* disable TRANS_DP_CTL */
51115099 reg = TRANS_DP_CTL(pipe);
51125100 temp = I915_READ(reg);
@@ -5123,6 +5111,8 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) · 10 unmodified lines
51235111
51245112 ironlake_fdi_pll_disable(intel_crtc);
51255113 }
5114+
5115+ intel_set_pch_fifo_underrun_reporting(dev_priv, pipe, true);
51265116 }
51275117
51285118 static void haswell_crtc_disable(struct drm_crtc *crtc)
@@ -5134,6 +5124,10 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) · 5 unmodified lines
51345124 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
51355125 bool is_dsi = intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DSI);
51365126
5127+ if (intel_crtc->config->has_pch_encoder)
5128+ intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A,
5129+ false);
5130+
51375131 for_each_encoder_on_crtc(dev, crtc, encoder) {
51385132 intel_opregion_notify_encoder(encoder, false);
51395133 encoder->disable(encoder);
@@ -5142,9 +5136,6 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) · 2 unmodified lines
51425136 drm_crtc_vblank_off(crtc);
51435137 assert_vblank_disabled(crtc);
51445138
5145− if (intel_crtc->config->has_pch_encoder)
5146− intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A,
5147− false);
51485139 intel_disable_pipe(intel_crtc);
51495140
51505141 if (intel_crtc->config->dp_encoder_is_mst)
@@ -5169,6 +5160,10 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) · 18 unmodified lines
51695160 for_each_encoder_on_crtc(dev, crtc, encoder)
51705161 if (encoder->post_disable)
51715162 encoder->post_disable(encoder);
5163+
5164+ if (intel_crtc->config->has_pch_encoder)
5165+ intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A,
5166+ true);
51725167 }
51735168
51745169 static void i9xx_pfit_enable(struct intel_crtc *crtc)
@@ -5199,15 +5194,15 @@ static enum intel_display_power_domain port_to_power_domain(enum port port) · 24 unmodified lines
51995194 {
52005195 switch (port) {
52015196 case PORT_A:
5202− return POWER_DOMAIN_PORT_DDI_A_4_LANES;
5197+ return POWER_DOMAIN_PORT_DDI_A_LANES;
52035198 case PORT_B:
5204− return POWER_DOMAIN_PORT_DDI_B_4_LANES;
5199+ return POWER_DOMAIN_PORT_DDI_B_LANES;
52055200 case PORT_C:
5206− return POWER_DOMAIN_PORT_DDI_C_4_LANES;
5201+ return POWER_DOMAIN_PORT_DDI_C_LANES;
52075202 case PORT_D:
5208− return POWER_DOMAIN_PORT_DDI_D_4_LANES;
5203+ return POWER_DOMAIN_PORT_DDI_D_LANES;
52095204 case PORT_E:
5210− return POWER_DOMAIN_PORT_DDI_E_2_LANES;
5205+ return POWER_DOMAIN_PORT_DDI_E_LANES;
52115206 default:
52125207 MISSING_CASE(port);
52135208 return POWER_DOMAIN_PORT_OTHER;
@@ -5302,13 +5297,11 @@ static unsigned long get_crtc_power_domains(struct drm_crtc *crtc) · 88 unmodified lines
53025297 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
53035298 enum pipe pipe = intel_crtc->pipe;
53045299 unsigned long mask;
5305− enum transcoder transcoder;
5300+ enum transcoder transcoder = intel_crtc->config->cpu_transcoder;
53065301
53075302 if (!crtc->state->active)
53085303 return 0;
53095304
5310− transcoder = intel_pipe_to_cpu_transcoder(dev->dev_private, pipe);
5311−
53125305 mask = BIT(POWER_DOMAIN_PIPE(pipe));
53135306 mask |= BIT(POWER_DOMAIN_TRANSCODER(transcoder));
53145307 if (intel_crtc->config->pch_pfit.enabled ||
@@ -5395,7 +5388,7 @@ static void intel_update_max_cdclk(struct drm_device *dev) · 80 unmodified lines
53955388 {
53965389 struct drm_i915_private *dev_priv = dev->dev_private;
53975390
5398− if (IS_SKYLAKE(dev)) {
5391+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
53995392 u32 limit = I915_READ(SKL_DFSM) & SKL_DFSM_CDCLK_LIMIT_MASK;
54005393
54015394 if (limit == SKL_DFSM_CDCLK_LIMIT_675)
@@ -5812,32 +5805,16 @@ void skl_uninit_cdclk(struct drm_i915_private *dev_priv) · 410 unmodified lines
58125805 if (I915_READ(DBUF_CTL) & DBUF_POWER_STATE)
58135806 DRM_ERROR("DBuf power disable timeout\n");
58145807
5815− /*
5816− * DMC assumes ownership of LCPLL and will get confused if we touch it.
5817− */
5818− if (dev_priv->csr.dmc_payload) {
5819− /* disable DPLL0 */
5820− I915_WRITE(LCPLL1_CTL, I915_READ(LCPLL1_CTL) &
5821− ~LCPLL_PLL_ENABLE);
5822− if (wait_for(!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_LOCK), 1))
5823− DRM_ERROR("Couldn't disable DPLL0\n");
5824− }
5825−
5826− intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS);
5808+ /* disable DPLL0 */
5809+ I915_WRITE(LCPLL1_CTL, I915_READ(LCPLL1_CTL) & ~LCPLL_PLL_ENABLE);
5810+ if (wait_for(!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_LOCK), 1))
5811+ DRM_ERROR("Couldn't disable DPLL0\n");
58275812 }
58285813
58295814 void skl_init_cdclk(struct drm_i915_private *dev_priv)
58305815 {
5831− u32 val;
58325816 unsigned int required_vco;
58335817
5834− /* enable PCH reset handshake */
5835− val = I915_READ(HSW_NDE_RSTWRN_OPT);
5836− I915_WRITE(HSW_NDE_RSTWRN_OPT, val | RESET_PCH_HANDSHAKE_ENABLE);
5837−
5838− /* enable PG1 and Misc I/O */
5839− intel_display_power_get(dev_priv, POWER_DOMAIN_PLLS);
5840−
58415818 /* DPLL0 not enabled (happens on early BIOS versions) */
58425819 if (!(I915_READ(LCPLL1_CTL) & LCPLL_PLL_ENABLE)) {
58435820 /* enable DPLL0 */
@@ -5858,6 +5835,45 @@ void skl_init_cdclk(struct drm_i915_private *dev_priv) · 14 unmodified lines
58585835 DRM_ERROR("DBuf power enable timeout\n");
58595836 }
58605837
5838+int skl_sanitize_cdclk(struct drm_i915_private *dev_priv)
5839+{
5840+ uint32_t lcpll1 = I915_READ(LCPLL1_CTL);
5841+ uint32_t cdctl = I915_READ(CDCLK_CTL);
5842+ int freq = dev_priv->skl_boot_cdclk;
5843+
5844+ /*
5845+ * check if the pre-os intialized the display
5846+ * There is SWF18 scratchpad register defined which is set by the
5847+ * pre-os which can be used by the OS drivers to check the status
5848+ */
5849+ if ((I915_READ(SWF_ILK(0x18)) & 0x00FFFFFF) == 0)
5850+ goto sanitize;
5851+
5852+ /* Is PLL enabled and locked ? */
5853+ if (!((lcpll1 & LCPLL_PLL_ENABLE) && (lcpll1 & LCPLL_PLL_LOCK)))
5854+ goto sanitize;
5855+
5856+ /* DPLL okay; verify the cdclock
5857+ *
5858+ * Noticed in some instances that the freq selection is correct but
5859+ * decimal part is programmed wrong from BIOS where pre-os does not
5860+ * enable display. Verify the same as well.
5861+ */
5862+ if (cdctl == ((cdctl & CDCLK_FREQ_SEL_MASK) | skl_cdclk_decimal(freq)))
5863+ /* All well; nothing to sanitize */
5864+ return false;
5865+sanitize:
5866+ /*
5867+ * As of now initialize with max cdclk till
5868+ * we get dynamic cdclk support
5869+ * */
5870+ dev_priv->skl_boot_cdclk = dev_priv->max_cdclk_freq;
5871+ skl_init_cdclk(dev_priv);
5872+
5873+ /* we did have to sanitize */
5874+ return true;
5875+}
5876+
58615877 /* Adjust CDclk dividers to allow high res or save power if possible */
58625878 static void valleyview_set_cdclk(struct drm_device *dev, int cdclk)
58635879 {
@@ -6322,7 +6338,8 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc) · 458 unmodified lines
63226338 return;
63236339
63246340 if (to_intel_plane_state(crtc->primary->state)->visible) {
6325− intel_crtc_wait_for_pending_flips(crtc);
6341+ WARN_ON(intel_crtc->unpin_work);
6342+
63266343 intel_pre_disable_primary(crtc);
63276344
63286345 intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc->primary));
@@ -6642,6 +6659,15 @@ static void hsw_compute_ips_config(struct intel_crtc *crtc, · 313 unmodified lines
66426659 pipe_config_supports_ips(dev_priv, pipe_config);
66436660 }
66446661
6662+static bool intel_crtc_supports_double_wide(const struct intel_crtc *crtc)
6663+{
6664+ const struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
6665+
6666+ /* GDG double wide on either pipe, otherwise pipe A only */
6667+ return INTEL_INFO(dev_priv)->gen < 4 &&
6668+ (crtc->pipe == PIPE_A || IS_I915G(dev_priv));
6669+}
6670+
66456671 static int intel_crtc_compute_config(struct intel_crtc *crtc,
66466672 struct intel_crtc_state *pipe_config)
66476673 {
@@ -6651,23 +6677,24 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc, · 3 unmodified lines
66516677
66526678 /* FIXME should check pixel clock limits on all platforms */
66536679 if (INTEL_INFO(dev)->gen < 4) {
6654− int clock_limit = dev_priv->max_cdclk_freq;
6680+ int clock_limit = dev_priv->max_cdclk_freq * 9 / 10;
66556681
66566682 /*
6657− * Enable pixel doubling when the dot clock
6683+ * Enable double wide mode when the dot clock
66586684 * is > 90% of the (display) core speed.
6659− *
6660− * GDG double wide on either pipe,
6661− * otherwise pipe A only.
66626685 */
6663− if ((crtc->pipe == PIPE_A || IS_I915G(dev)) &&
6664− adjusted_mode->crtc_clock > clock_limit * 9 / 10) {
6686+ if (intel_crtc_supports_double_wide(crtc) &&
6687+ adjusted_mode->crtc_clock > clock_limit) {
66656688 clock_limit *= 2;
66666689 pipe_config->double_wide = true;
66676690 }
66686691
6669− if (adjusted_mode->crtc_clock > clock_limit * 9 / 10)
6692+ if (adjusted_mode->crtc_clock > clock_limit) {
6693+ DRM_DEBUG_KMS("requested pixel clock (%d kHz) too high (max: %d kHz, double wide: %s)\n",
6694+ adjusted_mode->crtc_clock, clock_limit,
6695+ yesno(pipe_config->double_wide));
66706696 return -EINVAL;
6697+ }
66716698 }
66726699
66736700 /*
@@ -7432,7 +7459,7 @@ static void chv_prepare_pll(struct intel_crtc *crtc, · 758 unmodified lines
74327459 struct drm_device *dev = crtc->base.dev;
74337460 struct drm_i915_private *dev_priv = dev->dev_private;
74347461 int pipe = crtc->pipe;
7435− int dpll_reg = DPLL(crtc->pipe);
7462+ i915_reg_t dpll_reg = DPLL(crtc->pipe);
74367463 enum dpio_channel port = vlv_pipe_to_channel(pipe);
74377464 u32 loopfilter, tribuf_calcntr;
74387465 u32 bestn, bestm1, bestm2, bestp1, bestp2, bestm2_frac;
@@ -9350,8 +9377,8 @@ static void assert_can_disable_lcpll(struct drm_i915_private *dev_priv) · 1911 unmodified lines
93509377
93519378 I915_STATE_WARN(I915_READ(HSW_PWR_WELL_DRIVER), "Power well on\n");
93529379 I915_STATE_WARN(I915_READ(SPLL_CTL) & SPLL_PLL_ENABLE, "SPLL enabled\n");
9353− I915_STATE_WARN(I915_READ(WRPLL_CTL1) & WRPLL_PLL_ENABLE, "WRPLL1 enabled\n");
9354− I915_STATE_WARN(I915_READ(WRPLL_CTL2) & WRPLL_PLL_ENABLE, "WRPLL2 enabled\n");
9380+ I915_STATE_WARN(I915_READ(WRPLL_CTL(0)) & WRPLL_PLL_ENABLE, "WRPLL1 enabled\n");
9381+ I915_STATE_WARN(I915_READ(WRPLL_CTL(1)) & WRPLL_PLL_ENABLE, "WRPLL2 enabled\n");
93559382 I915_STATE_WARN(I915_READ(PCH_PP_STATUS) & PP_ON, "Panel power on\n");
93569383 I915_STATE_WARN(I915_READ(BLC_PWM_CPU_CTL2) & BLM_PWM_ENABLE,
93579384 "CPU PWM1 enabled\n");
@@ -9813,7 +9840,7 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc, · 455 unmodified lines
98139840
98149841 port = (tmp & TRANS_DDI_PORT_MASK) >> TRANS_DDI_PORT_SHIFT;
98159842
9816− if (IS_SKYLAKE(dev))
9843+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
98179844 skylake_get_ddi_pll(dev_priv, port, pipe_config);
98189845 else if (IS_BROXTON(dev))
98199846 bxt_get_ddi_pll(dev_priv, port, pipe_config);
@@ -10154,20 +10181,17 @@ __intel_framebuffer_create(struct drm_device *dev, · 334 unmodified lines
1015410181 int ret;
1015510182
1015610183 intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
10157− if (!intel_fb) {
10158− drm_gem_object_unreference(&obj->base);
10184+ if (!intel_fb)
1015910185 return ERR_PTR(-ENOMEM);
10160− }
1016110186
1016210187 ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj);
1016310188 if (ret)
1016410189 goto err;
1016510190
1016610191 return &intel_fb->base;
10192+
1016710193 err:
10168− drm_gem_object_unreference(&obj->base);
1016910194 kfree(intel_fb);
10170−
1017110195 return ERR_PTR(ret);
1017210196 }
1017310197
@@ -10207,6 +10231,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev, · 33 unmodified lines
1020710231 struct drm_display_mode *mode,
1020810232 int depth, int bpp)
1020910233 {
10234+ struct drm_framebuffer *fb;
1021010235 struct drm_i915_gem_object *obj;
1021110236 struct drm_mode_fb_cmd2 mode_cmd = { 0 };
1021210237
@@ -10221,7 +10246,11 @@ intel_framebuffer_create_for_mode(struct drm_device *dev, · 8 unmodified lines
1022110246 bpp);
1022210247 mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth);
1022310248
10224− return intel_framebuffer_create(dev, &mode_cmd, obj);
10249+ fb = intel_framebuffer_create(dev, &mode_cmd, obj);
10250+ if (IS_ERR(fb))
10251+ drm_gem_object_unreference_unlocked(&obj->base);
10252+
10253+ return fb;
1022510254 }
1022610255
1022710256 static struct drm_framebuffer *
@@ -11124,7 +11153,7 @@ static int intel_gen7_queue_flip(struct drm_device *dev, · 896 unmodified lines
1112411153 */
1112511154 if (ring->id == RCS) {
1112611155 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
11127− intel_ring_emit(ring, DERRMR);
11156+ intel_ring_emit_reg(ring, DERRMR);
1112811157 intel_ring_emit(ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE |
1112911158 DERRMR_PIPEB_PRI_FLIP_DONE |
1113011159 DERRMR_PIPEC_PRI_FLIP_DONE));
@@ -11134,7 +11163,7 @@ static int intel_gen7_queue_flip(struct drm_device *dev, · 3 unmodified lines
1113411163 else
1113511164 intel_ring_emit(ring, MI_STORE_REGISTER_MEM |
1113611165 MI_SRM_LRM_GLOBAL_GTT);
11137− intel_ring_emit(ring, DERRMR);
11166+ intel_ring_emit_reg(ring, DERRMR);
1113811167 intel_ring_emit(ring, ring->scratch.gtt_offset + 256);
1113911168 if (IS_GEN8(dev)) {
1114011169 intel_ring_emit(ring, 0);
@@ -11179,13 +11208,14 @@ static bool use_mmio_flip(struct intel_engine_cs *ring, · 38 unmodified lines
1117911208 }
1118011209
1118111210 static void skl_do_mmio_flip(struct intel_crtc *intel_crtc,
11211+ unsigned int rotation,
1118211212 struct intel_unpin_work *work)
1118311213 {
1118411214 struct drm_device *dev = intel_crtc->base.dev;
1118511215 struct drm_i915_private *dev_priv = dev->dev_private;
1118611216 struct drm_framebuffer *fb = intel_crtc->base.primary->fb;
1118711217 const enum pipe pipe = intel_crtc->pipe;
11188− u32 ctl, stride;
11218+ u32 ctl, stride, tile_height;
1118911219
1119011220 ctl = I915_READ(PLANE_CTL(pipe, 0));
1119111221 ctl &= ~PLANE_CTL_TILED_MASK;
@@ -11209,9 +11239,16 @@ static void skl_do_mmio_flip(struct intel_crtc *intel_crtc, · 17 unmodified lines
1120911239 * The stride is either expressed as a multiple of 64 bytes chunks for
1121011240 * linear buffers or in number of tiles for tiled buffers.
1121111241 */
11212− stride = fb->pitches[0] /
11213− intel_fb_stride_alignment(dev, fb->modifier[0],
11214− fb->pixel_format);
11242+ if (intel_rotation_90_or_270(rotation)) {
11243+ /* stride = Surface height in tiles */
11244+ tile_height = intel_tile_height(dev, fb->pixel_format,
11245+ fb->modifier[0], 0);
11246+ stride = DIV_ROUND_UP(fb->height, tile_height);
11247+ } else {
11248+ stride = fb->pitches[0] /
11249+ intel_fb_stride_alignment(dev, fb->modifier[0],
11250+ fb->pixel_format);
11251+ }
1121511252
1121611253 /*
1121711254 * Both PLANE_CTL and PLANE_STRIDE are not updated on vblank but on
@@ -11232,10 +11269,9 @@ static void ilk_do_mmio_flip(struct intel_crtc *intel_crtc, · 14 unmodified lines
1123211269 struct intel_framebuffer *intel_fb =
1123311270 to_intel_framebuffer(intel_crtc->base.primary->fb);
1123411271 struct drm_i915_gem_object *obj = intel_fb->obj;
11272+ i915_reg_t reg = DSPCNTR(intel_crtc->plane);
1123511273 u32 dspcntr;
11236− u32 reg;
1123711274
11238− reg = DSPCNTR(intel_crtc->plane);
1123911275 dspcntr = I915_READ(reg);
1124011276
1124111277 if (obj->tiling_mode != I915_TILING_NONE)
@@ -11269,7 +11305,7 @@ static void intel_do_mmio_flip(struct intel_mmio_flip *mmio_flip) · 27 unmodified lines
1126911305 intel_pipe_update_start(crtc);
1127011306
1127111307 if (INTEL_INFO(mmio_flip->i915)->gen >= 9)
11272− skl_do_mmio_flip(crtc, work);
11308+ skl_do_mmio_flip(crtc, mmio_flip->rotation, work);
1127311309 else
1127411310 /* use_mmio_flip() retricts MMIO flips to ilk+ */
1127511311 ilk_do_mmio_flip(crtc, work);
@@ -11296,10 +11332,7 @@ static void intel_mmio_flip_work_func(struct work_struct *work) · 20 unmodified lines
1129611332
1129711333 static int intel_queue_mmio_flip(struct drm_device *dev,
1129811334 struct drm_crtc *crtc,
11299− struct drm_framebuffer *fb,
11300− struct drm_i915_gem_object *obj,
11301− struct intel_engine_cs *ring,
11302− uint32_t flags)
11335+ struct drm_i915_gem_object *obj)
1130311336 {
1130411337 struct intel_mmio_flip *mmio_flip;
1130511338
@@ -11310,6 +11343,7 @@ static int intel_queue_mmio_flip(struct drm_device *dev, · 4 unmodified lines
1131011343 mmio_flip->i915 = to_i915(dev);
1131111344 mmio_flip->req = i915_gem_request_reference(obj->last_write_req);
1131211345 mmio_flip->crtc = to_intel_crtc(crtc);
11346+ mmio_flip->rotation = crtc->primary->state->rotation;
1131311347
1131411348 INIT_WORK(&mmio_flip->work, intel_mmio_flip_work_func);
1131511349 schedule_work(&mmio_flip->work);
@@ -11515,9 +11549,14 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, · 199 unmodified lines
1151511549 * synchronisation, so all we want here is to pin the framebuffer
1151611550 * into the display plane and skip any waits.
1151711551 */
11552+ if (!mmio_flip) {
11553+ ret = i915_gem_object_sync(obj, ring, &request);
11554+ if (ret)
11555+ goto cleanup_pending;
11556+ }
11557+
1151811558 ret = intel_pin_and_fence_fb_obj(crtc->primary, fb,
11519− crtc->primary->state,
11520− mmio_flip ? i915_gem_request_get_ring(obj->last_write_req) : ring, &request);
11559+ crtc->primary->state);
1152111560 if (ret)
1152211561 goto cleanup_pending;
1152311562
@@ -11526,8 +11565,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, · 2 unmodified lines
1152611565 work->gtt_offset += intel_crtc->dspaddr_offset;
1152711566
1152811567 if (mmio_flip) {
11529− ret = intel_queue_mmio_flip(dev, crtc, fb, obj, ring,
11530− page_flip_flags);
11568+ ret = intel_queue_mmio_flip(dev, crtc, obj);
1153111569 if (ret)
1153211570 goto cleanup_unpin;
1153311571
@@ -11641,18 +11679,32 @@ retry: · 107 unmodified lines
1164111679 static bool intel_wm_need_update(struct drm_plane *plane,
1164211680 struct drm_plane_state *state)
1164311681 {
11644− /* Update watermarks on tiling changes. */
11682+ struct intel_plane_state *new = to_intel_plane_state(state);
11683+ struct intel_plane_state *cur = to_intel_plane_state(plane->state);
11684+
11685+ /* Update watermarks on tiling or size changes. */
1164511686 if (!plane->state->fb || !state->fb ||
1164611687 plane->state->fb->modifier[0] != state->fb->modifier[0] ||
11647− plane->state->rotation != state->rotation)
11648− return true;
11649−
11650− if (plane->state->crtc_w != state->crtc_w)
11688+ plane->state->rotation != state->rotation ||
11689+ drm_rect_width(&new->src) != drm_rect_width(&cur->src) ||
11690+ drm_rect_height(&new->src) != drm_rect_height(&cur->src) ||
11691+ drm_rect_width(&new->dst) != drm_rect_width(&cur->dst) ||
11692+ drm_rect_height(&new->dst) != drm_rect_height(&cur->dst))
1165111693 return true;
1165211694
1165311695 return false;
1165411696 }
1165511697
11698+static bool needs_scaling(struct intel_plane_state *state)
11699+{
11700+ int src_w = drm_rect_width(&state->src) >> 16;
11701+ int src_h = drm_rect_height(&state->src) >> 16;
11702+ int dst_w = drm_rect_width(&state->dst);
11703+ int dst_h = drm_rect_height(&state->dst);
11704+
11705+ return (src_w != dst_w || src_h != dst_h);
11706+}
11707+
1165611708 int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
1165711709 struct drm_plane_state *plane_state)
1165811710 {
@@ -11668,7 +11720,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, · 9 unmodified lines
1166811720 bool mode_changed = needs_modeset(crtc_state);
1166911721 bool was_crtc_enabled = crtc->state->active;
1167011722 bool is_crtc_enabled = crtc_state->active;
11671−
1167211723 bool turn_off, turn_on, visible, was_visible;
1167311724 struct drm_framebuffer *fb = plane_state->fb;
1167411725
@@ -11681,14 +11732,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, · 6 unmodified lines
1168111732 return ret;
1168211733 }
1168311734
11684− /*
11685− * Disabling a plane is always okay; we just need to update
11686− * fb tracking in a special way since cleanup_fb() won't
11687− * get called by the plane helpers.
11688− */
11689− if (old_plane_state->base.fb && !fb)
11690− intel_crtc->atomic.disabled_planes |= 1 << i;
11691−
1169211735 was_visible = old_plane_state->visible;
1169311736 visible = to_intel_plane_state(plane_state)->visible;
1169411737
@@ -11738,7 +11781,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, · 43 unmodified lines
1173811781
1173911782 switch (plane->type) {
1174011783 case DRM_PLANE_TYPE_PRIMARY:
11741− intel_crtc->atomic.wait_for_flips = true;
1174211784 intel_crtc->atomic.pre_disable_primary = turn_off;
1174311785 intel_crtc->atomic.post_enable_primary = turn_on;
1174411786
@@ -11786,11 +11828,23 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, · 41 unmodified lines
1178611828 case DRM_PLANE_TYPE_CURSOR:
1178711829 break;
1178811830 case DRM_PLANE_TYPE_OVERLAY:
11789− if (turn_off && !mode_changed) {
11831+ /*
11832+ * WaCxSRDisabledForSpriteScaling:ivb
11833+ *
11834+ * cstate->update_wm was already set above, so this flag will
11835+ * take effect when we commit and program watermarks.
11836+ */
11837+ if (IS_IVYBRIDGE(dev) &&
11838+ needs_scaling(to_intel_plane_state(plane_state)) &&
11839+ !needs_scaling(old_plane_state)) {
11840+ to_intel_crtc_state(crtc_state)->disable_lp_wm = true;
11841+ } else if (turn_off && !mode_changed) {
1179011842 intel_crtc->atomic.wait_vblank = true;
1179111843 intel_crtc->atomic.update_sprite_watermarks |=
1179211844 1 << i;
1179311845 }
11846+
11847+ break;
1179411848 }
1179511849 return 0;
1179611850 }
@@ -11875,6 +11929,12 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc, · 78 unmodified lines
1187511929 }
1187611930
1187711931 ret = 0;
11932+ if (dev_priv->display.compute_pipe_wm) {
11933+ ret = dev_priv->display.compute_pipe_wm(intel_crtc, state);
11934+ if (ret)
11935+ return ret;
11936+ }
11937+
1187811938 if (INTEL_INFO(dev)->gen >= 9) {
1187911939 if (mode_changed)
1188011940 ret = skl_update_scaler_crtc(pipe_config);
@@ -12064,7 +12124,7 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, · 183 unmodified lines
1206412124 pipe_config->dpll_hw_state.pll9,
1206512125 pipe_config->dpll_hw_state.pll10,
1206612126 pipe_config->dpll_hw_state.pcsdw12);
12067− } else if (IS_SKYLAKE(dev)) {
12127+ } else if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
1206812128 DRM_DEBUG_KMS("ddi_pll_sel: %u; dpll_hw_state: "
1206912129 "ctrl1: 0x%x, cfgcr1: 0x%x, cfgcr2: 0x%x\n",
1207012130 pipe_config->ddi_pll_sel,
@@ -12322,6 +12382,18 @@ intel_modeset_update_crtc_state(struct drm_atomic_state *state) · 251 unmodified lines
1232212382 crtc->hwmode = crtc->state->adjusted_mode;
1232312383 else
1232412384 crtc->hwmode.crtc_clock = 0;
12385+
12386+ /*
12387+ * Update legacy state to satisfy fbc code. This can
12388+ * be removed when fbc uses the atomic state.
12389+ */
12390+ if (drm_atomic_get_existing_plane_state(state, crtc->primary)) {
12391+ struct drm_plane_state *plane_state = crtc->primary->state;
12392+
12393+ crtc->primary->fb = plane_state->fb;
12394+ crtc->x = plane_state->src_x >> 16;
12395+ crtc->y = plane_state->src_y >> 16;
12396+ }
1232512397 }
1232612398 }
1232712399
@@ -12347,7 +12419,7 @@ static bool intel_fuzzy_clock_check(int clock1, int clock2) · 19 unmodified lines
1234712419 list_for_each_entry((intel_crtc), \
1234812420 &(dev)->mode_config.crtc_list, \
1234912421 base.head) \
12350− if (mask & (1 <<(intel_crtc)->pipe))
12422+ for_each_if (mask & (1 <<(intel_crtc)->pipe))
1235112423
1235212424 static bool
1235312425 intel_compare_m_n(unsigned int m, unsigned int n,
@@ -13085,6 +13157,45 @@ static int intel_modeset_checks(struct drm_atomic_state *state) · 731 unmodified lines
1308513157 return 0;
1308613158 }
1308713159
13160+/*
13161+ * Handle calculation of various watermark data at the end of the atomic check
13162+ * phase. The code here should be run after the per-crtc and per-plane 'check'
13163+ * handlers to ensure that all derived state has been updated.
13164+ */
13165+static void calc_watermark_data(struct drm_atomic_state *state)
13166+{
13167+ struct drm_device *dev = state->dev;
13168+ struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
13169+ struct drm_crtc *crtc;
13170+ struct drm_crtc_state *cstate;
13171+ struct drm_plane *plane;
13172+ struct drm_plane_state *pstate;
13173+
13174+ /*
13175+ * Calculate watermark configuration details now that derived
13176+ * plane/crtc state is all properly updated.
13177+ */
13178+ drm_for_each_crtc(crtc, dev) {
13179+ cstate = drm_atomic_get_existing_crtc_state(state, crtc) ?:
13180+ crtc->state;
13181+
13182+ if (cstate->active)
13183+ intel_state->wm_config.num_pipes_active++;
13184+ }
13185+ drm_for_each_legacy_plane(plane, dev) {
13186+ pstate = drm_atomic_get_existing_plane_state(state, plane) ?:
13187+ plane->state;
13188+
13189+ if (!to_intel_plane_state(pstate)->visible)
13190+ continue;
13191+
13192+ intel_state->wm_config.sprites_enabled = true;
13193+ if (pstate->crtc_w != pstate->src_w >> 16 ||
13194+ pstate->crtc_h != pstate->src_h >> 16)
13195+ intel_state->wm_config.sprites_scaled = true;
13196+ }
13197+}
13198+
1308813199 /**
1308913200 * intel_atomic_check - validate state object
1309013201 * @dev: drm device
@@ -13093,6 +13204,7 @@ static int intel_modeset_checks(struct drm_atomic_state *state) · 2 unmodified lines
1309313204 static int intel_atomic_check(struct drm_device *dev,
1309413205 struct drm_atomic_state *state)
1309513206 {
13207+ struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
1309613208 struct drm_crtc *crtc;
1309713209 struct drm_crtc_state *crtc_state;
1309813210 int ret, i;
@@ -13160,10 +13272,81 @@ static int intel_atomic_check(struct drm_device *dev, · 61 unmodified lines
1316013272 if (ret)
1316113273 return ret;
1316213274 } else
13163− to_intel_atomic_state(state)->cdclk =
13164− to_i915(state->dev)->cdclk_freq;
13275+ intel_state->cdclk = to_i915(state->dev)->cdclk_freq;
1316513276
13166− return drm_atomic_helper_check_planes(state->dev, state);
13277+ ret = drm_atomic_helper_check_planes(state->dev, state);
13278+ if (ret)
13279+ return ret;
13280+
13281+ calc_watermark_data(state);
13282+
13283+ return 0;
13284+}
13285+
13286+static int intel_atomic_prepare_commit(struct drm_device *dev,
13287+ struct drm_atomic_state *state,
13288+ bool async)
13289+{
13290+ struct drm_i915_private *dev_priv = dev->dev_private;
13291+ struct drm_plane_state *plane_state;
13292+ struct drm_crtc_state *crtc_state;
13293+ struct drm_plane *plane;
13294+ struct drm_crtc *crtc;
13295+ int i, ret;
13296+
13297+ if (async) {
13298+ DRM_DEBUG_KMS("i915 does not yet support async commit\n");
13299+ return -EINVAL;
13300+ }
13301+
13302+ for_each_crtc_in_state(state, crtc, crtc_state, i) {
13303+ ret = intel_crtc_wait_for_pending_flips(crtc);
13304+ if (ret)
13305+ return ret;
13306+
13307+ if (atomic_read(&to_intel_crtc(crtc)->unpin_work_count) >= 2)
13308+ flush_workqueue(dev_priv->wq);
13309+ }
13310+
13311+ ret = mutex_lock_interruptible(&dev->struct_mutex);
13312+ if (ret)
13313+ return ret;
13314+
13315+ ret = drm_atomic_helper_prepare_planes(dev, state);
13316+ if (!ret && !async && !i915_reset_in_progress(&dev_priv->gpu_error)) {
13317+ u32 reset_counter;
13318+
13319+ reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter);
13320+ mutex_unlock(&dev->struct_mutex);
13321+
13322+ for_each_plane_in_state(state, plane, plane_state, i) {
13323+ struct intel_plane_state *intel_plane_state =
13324+ to_intel_plane_state(plane_state);
13325+
13326+ if (!intel_plane_state->wait_req)
13327+ continue;
13328+
13329+ ret = __i915_wait_request(intel_plane_state->wait_req,
13330+ reset_counter, true,
13331+ NULL, NULL);
13332+
13333+ /* Swallow -EIO errors to allow updates during hw lockup. */
13334+ if (ret == -EIO)
13335+ ret = 0;
13336+
13337+ if (ret)
13338+ break;
13339+ }
13340+
13341+ if (!ret)
13342+ return 0;
13343+
13344+ mutex_lock(&dev->struct_mutex);
13345+ drm_atomic_helper_cleanup_planes(dev, state);
13346+ }
13347+
13348+ mutex_unlock(&dev->struct_mutex);
13349+ return ret;
1316713350 }
1316813351
1316913352 /**
@@ -13187,22 +13370,20 @@ static int intel_atomic_commit(struct drm_device *dev, · 17 unmodified lines
1318713370 bool async)
1318813371 {
1318913372 struct drm_i915_private *dev_priv = dev->dev_private;
13190− struct drm_crtc *crtc;
1319113373 struct drm_crtc_state *crtc_state;
13374+ struct drm_crtc *crtc;
1319213375 int ret = 0;
1319313376 int i;
1319413377 bool any_ms = false;
1319513378
13196− if (async) {
13197− DRM_DEBUG_KMS("i915 does not yet support async commit\n");
13198− return -EINVAL;
13199− }
13200−
13201− ret = drm_atomic_helper_prepare_planes(dev, state);
13202− if (ret)
13379+ ret = intel_atomic_prepare_commit(dev, state, async);
13380+ if (ret) {
13381+ DRM_DEBUG_ATOMIC("Preparing state failed with %i\n", ret);
1320313382 return ret;
13383+ }
1320413384
1320513385 drm_atomic_helper_swap_state(dev, state);
13386+ dev_priv->wm.config = to_intel_atomic_state(state)->wm_config;
1320613387
1320713388 for_each_crtc_in_state(state, crtc, crtc_state, i) {
1320813389 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
@@ -13240,6 +13421,9 @@ static int intel_atomic_commit(struct drm_device *dev, · 31 unmodified lines
1324013421 to_intel_crtc_state(crtc->state)->update_pipe;
1324113422 unsigned long put_domains = 0;
1324213423
13424+ if (modeset)
13425+ intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET);
13426+
1324313427 if (modeset && crtc->state->active) {
1324413428 update_scanline_offset(to_intel_crtc(crtc));
1324513429 dev_priv->display.crtc_enable(crtc);
@@ -13255,18 +13439,26 @@ static int intel_atomic_commit(struct drm_device *dev, · 9 unmodified lines
1325513439 if (!modeset)
1325613440 intel_pre_plane_update(intel_crtc);
1325713441
13258− drm_atomic_helper_commit_planes_on_crtc(crtc_state);
13442+ if (crtc->state->active &&
13443+ (crtc->state->planes_changed || update_pipe))
13444+ drm_atomic_helper_commit_planes_on_crtc(crtc_state);
1325913445
1326013446 if (put_domains)
1326113447 modeset_put_power_domains(dev_priv, put_domains);
1326213448
1326313449 intel_post_plane_update(intel_crtc);
13450+
13451+ if (modeset)
13452+ intel_display_power_put(dev_priv, POWER_DOMAIN_MODESET);
1326413453 }
1326513454
1326613455 /* FIXME: add subpixel order */
1326713456
1326813457 drm_atomic_helper_wait_for_vblanks(dev, state);
13458+
13459+ mutex_lock(&dev->struct_mutex);
1326913460 drm_atomic_helper_cleanup_planes(dev, state);
13461+ mutex_unlock(&dev->struct_mutex);
1327013462
1327113463 if (any_ms)
1327213464 intel_modeset_check_state(dev, state);
@@ -13435,6 +13627,8 @@ static void intel_shared_dpll_init(struct drm_device *dev) · 162 unmodified lines
1343513627 * bits. Some older platforms need special physical address handling for
1343613628 * cursor planes.
1343713629 *
13630+ * Must be called with struct_mutex held.
13631+ *
1343813632 * Returns 0 on success, negative error code on failure.
1343913633 */
1344013634 int
@@ -13445,28 +13639,58 @@ intel_prepare_plane_fb(struct drm_plane *plane, · 4 unmodified lines
1344513639 struct drm_framebuffer *fb = new_state->fb;
1344613640 struct intel_plane *intel_plane = to_intel_plane(plane);
1344713641 struct drm_i915_gem_object *obj = intel_fb_obj(fb);
13448− struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb);
13642+ struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->state->fb);
1344913643 int ret = 0;
1345013644
13451− if (!obj)
13645+ if (!obj && !old_obj)
1345213646 return 0;
1345313647
13454− mutex_lock(&dev->struct_mutex);
13648+ if (old_obj) {
13649+ struct drm_crtc_state *crtc_state =
13650+ drm_atomic_get_existing_crtc_state(new_state->state, plane->state->crtc);
13651+
13652+ /* Big Hammer, we also need to ensure that any pending
13653+ * MI_WAIT_FOR_EVENT inside a user batch buffer on the
13654+ * current scanout is retired before unpinning the old
13655+ * framebuffer. Note that we rely on userspace rendering
13656+ * into the buffer attached to the pipe they are waiting
13657+ * on. If not, userspace generates a GPU hang with IPEHR
13658+ * point to the MI_WAIT_FOR_EVENT.
13659+ *
13660+ * This should only fail upon a hung GPU, in which case we
13661+ * can safely continue.
13662+ */
13663+ if (needs_modeset(crtc_state))
13664+ ret = i915_gem_object_wait_rendering(old_obj, true);
13665+
13666+ /* Swallow -EIO errors to allow updates during hw lockup. */
13667+ if (ret && ret != -EIO)
13668+ return ret;
13669+ }
1345513670
13456− if (plane->type == DRM_PLANE_TYPE_CURSOR &&
13671+ if (!obj) {
13672+ ret = 0;
13673+ } else if (plane->type == DRM_PLANE_TYPE_CURSOR &&
1345713674 INTEL_INFO(dev)->cursor_needs_physical) {
1345813675 int align = IS_I830(dev) ? 16 * 1024 : 256;
1345913676 ret = i915_gem_object_attach_phys(obj, align);
1346013677 if (ret)
1346113678 DRM_DEBUG_KMS("failed to attach phys object\n");
1346213679 } else {
13463− ret = intel_pin_and_fence_fb_obj(plane, fb, new_state, NULL, NULL);
13680+ ret = intel_pin_and_fence_fb_obj(plane, fb, new_state);
1346413681 }
1346513682
13466− if (ret == 0)
13467− i915_gem_track_fb(old_obj, obj, intel_plane->frontbuffer_bit);
13683+ if (ret == 0) {
13684+ if (obj) {
13685+ struct intel_plane_state *plane_state =
13686+ to_intel_plane_state(new_state);
1346813687
13469− mutex_unlock(&dev->struct_mutex);
13688+ i915_gem_request_assign(&plane_state->wait_req,
13689+ obj->last_write_req);
13690+ }
13691+
13692+ i915_gem_track_fb(old_obj, obj, intel_plane->frontbuffer_bit);
13693+ }
1347013694
1347113695 return ret;
1347213696 }
@@ -13477,23 +13701,35 @@ intel_prepare_plane_fb(struct drm_plane *plane, · 4 unmodified lines
1347713701 * @fb: old framebuffer that was on plane
1347813702 *
1347913703 * Cleans up a framebuffer that has just been removed from a plane.
13704+ *
13705+ * Must be called with struct_mutex held.
1348013706 */
1348113707 void
1348213708 intel_cleanup_plane_fb(struct drm_plane *plane,
1348313709 const struct drm_plane_state *old_state)
1348413710 {
1348513711 struct drm_device *dev = plane->dev;
13486− struct drm_i915_gem_object *obj = intel_fb_obj(old_state->fb);
13712+ struct intel_plane *intel_plane = to_intel_plane(plane);
13713+ struct intel_plane_state *old_intel_state;
13714+ struct drm_i915_gem_object *old_obj = intel_fb_obj(old_state->fb);
13715+ struct drm_i915_gem_object *obj = intel_fb_obj(plane->state->fb);
1348713716
13488− if (!obj)
13717+ old_intel_state = to_intel_plane_state(old_state);
13718+
13719+ if (!obj && !old_obj)
1348913720 return;
1349013721
13491− if (plane->type != DRM_PLANE_TYPE_CURSOR ||
13492− !INTEL_INFO(dev)->cursor_needs_physical) {
13493− mutex_lock(&dev->struct_mutex);
13722+ if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR ||
13723+ !INTEL_INFO(dev)->cursor_needs_physical))
1349413724 intel_unpin_fb_obj(old_state->fb, old_state);
13495− mutex_unlock(&dev->struct_mutex);
13496− }
13725+
13726+ /* prepare_fb aborted? */
13727+ if ((old_obj && (old_obj->frontbuffer_bits & intel_plane->frontbuffer_bit)) ||
13728+ (obj && !(obj->frontbuffer_bits & intel_plane->frontbuffer_bit)))
13729+ i915_gem_track_fb(old_obj, obj, intel_plane->frontbuffer_bit);
13730+
13731+ i915_gem_request_assign(&old_intel_state->wait_req, NULL);
13732+
1349713733 }
1349813734
1349913735 int
@@ -13512,7 +13748,7 @@ skl_max_scale(struct intel_crtc *intel_crtc, struct intel_crtc_state *crtc_state · 12 unmodified lines
1351213748 crtc_clock = crtc_state->base.adjusted_mode.crtc_clock;
1351313749 cdclk = to_intel_atomic_state(crtc_state->base.state)->cdclk;
1351413750
13515− if (!crtc_clock || !cdclk)
13751+ if (WARN_ON_ONCE(!crtc_clock || cdclk < crtc_clock))
1351613752 return DRM_PLANE_HELPER_NO_SCALING;
1351713753
1351813754 /*
@@ -13560,18 +13796,8 @@ intel_commit_primary_plane(struct drm_plane *plane, · 41 unmodified lines
1356013796 struct drm_framebuffer *fb = state->base.fb;
1356113797 struct drm_device *dev = plane->dev;
1356213798 struct drm_i915_private *dev_priv = dev->dev_private;
13563− struct intel_crtc *intel_crtc;
13564− struct drm_rect *src = &state->src;
1356513799
1356613800 crtc = crtc ? crtc : plane->crtc;
13567− intel_crtc = to_intel_crtc(crtc);
13568−
13569− plane->fb = fb;
13570− crtc->x = src->x1 >> 16;
13571− crtc->y = src->y1 >> 16;
13572−
13573− if (!crtc->state->active)
13574− return;
1357513801
1357613802 dev_priv->display.update_primary_plane(crtc, fb,
1357713803 state->src.x1 >> 16,
@@ -13601,8 +13827,7 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc, · 23 unmodified lines
1360113827 intel_update_watermarks(crtc);
1360213828
1360313829 /* Perform vblank evasion around commit operation */
13604− if (crtc->state->active)
13605− intel_pipe_update_start(intel_crtc);
13830+ intel_pipe_update_start(intel_crtc);
1360613831
1360713832 if (modeset)
1360813833 return;
@@ -13618,8 +13843,7 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc, · 9 unmodified lines
1361813843 {
1361913844 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1362013845
13621− if (crtc->state->active)
13622− intel_pipe_update_end(intel_crtc);
13846+ intel_pipe_update_end(intel_crtc);
1362313847 }
1362413848
1362513849 /**
@@ -14087,7 +14311,7 @@ static void intel_setup_outputs(struct drm_device *dev) · 461 unmodified lines
1408714311 */
1408814312 found = I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_INIT_DISPLAY_DETECTED;
1408914313 /* WaIgnoreDDIAStrap: skl */
14090− if (found || IS_SKYLAKE(dev))
14314+ if (found || IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
1409114315 intel_ddi_init(dev, PORT_A);
1409214316
1409314317 /* DDI B, C and D detection is indicated by the SFUSE_STRAP
@@ -14103,7 +14327,7 @@ static void intel_setup_outputs(struct drm_device *dev) · 9 unmodified lines
1410314327 /*
1410414328 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
1410514329 */
14106− if (IS_SKYLAKE(dev) &&
14330+ if ((IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) &&
1410714331 (dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
1410814332 dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
1410914333 dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi))
@@ -14118,7 +14342,7 @@ static void intel_setup_outputs(struct drm_device *dev) · 8 unmodified lines
1411814342
1411914343 if (I915_READ(PCH_HDMIB) & SDVO_DETECTED) {
1412014344 /* PCH SDVOB multiplex with HDMIB */
14121− found = intel_sdvo_init(dev, PCH_SDVOB, true);
14345+ found = intel_sdvo_init(dev, PCH_SDVOB, PORT_B);
1412214346 if (!found)
1412314347 intel_hdmi_init(dev, PCH_HDMIB, PORT_B);
1412414348 if (!found && (I915_READ(PCH_DP_B) & DP_DETECTED))
@@ -14174,7 +14398,7 @@ static void intel_setup_outputs(struct drm_device *dev) · 49 unmodified lines
1417414398
1417514399 if (I915_READ(GEN3_SDVOB) & SDVO_DETECTED) {
1417614400 DRM_DEBUG_KMS("probing SDVOB\n");
14177− found = intel_sdvo_init(dev, GEN3_SDVOB, true);
14401+ found = intel_sdvo_init(dev, GEN3_SDVOB, PORT_B);
1417814402 if (!found && IS_G4X(dev)) {
1417914403 DRM_DEBUG_KMS("probing HDMI on SDVOB\n");
1418014404 intel_hdmi_init(dev, GEN4_HDMIB, PORT_B);
@@ -14188,7 +14412,7 @@ static void intel_setup_outputs(struct drm_device *dev) · 7 unmodified lines
1418814412
1418914413 if (I915_READ(GEN3_SDVOB) & SDVO_DETECTED) {
1419014414 DRM_DEBUG_KMS("probing SDVOC\n");
14191− found = intel_sdvo_init(dev, GEN3_SDVOC, false);
14415+ found = intel_sdvo_init(dev, GEN3_SDVOC, PORT_C);
1419214416 }
1419314417
1419414418 if (!found && (I915_READ(GEN3_SDVOC) & SDVO_DETECTED)) {
@@ -14454,8 +14678,9 @@ static int intel_framebuffer_init(struct drm_device *dev, · 259 unmodified lines
1445414678 static struct drm_framebuffer *
1445514679 intel_user_framebuffer_create(struct drm_device *dev,
1445614680 struct drm_file *filp,
14457− struct drm_mode_fb_cmd2 *user_mode_cmd)
14681+ const struct drm_mode_fb_cmd2 *user_mode_cmd)
1445814682 {
14683+ struct drm_framebuffer *fb;
1445914684 struct drm_i915_gem_object *obj;
1446014685 struct drm_mode_fb_cmd2 mode_cmd = *user_mode_cmd;
1446114686
@@ -14464,7 +14689,11 @@ intel_user_framebuffer_create(struct drm_device *dev, · 2 unmodified lines
1446414689 if (&obj->base == NULL)
1446514690 return ERR_PTR(-ENOENT);
1446614691
14467− return intel_framebuffer_create(dev, &mode_cmd, obj);
14692+ fb = intel_framebuffer_create(dev, &mode_cmd, obj);
14693+ if (IS_ERR(fb))
14694+ drm_gem_object_unreference_unlocked(&obj->base);
14695+
14696+ return fb;
1446814697 }
1446914698
1447014699 #ifndef CONFIG_DRM_FBDEV_EMULATION
@@ -14549,7 +14778,7 @@ static void intel_init_display(struct drm_device *dev) · 78 unmodified lines
1454914778 }
1455014779
1455114780 /* Returns the core display clock speed */
14552− if (IS_SKYLAKE(dev))
14781+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
1455314782 dev_priv->display.get_display_clock_speed =
1455414783 skylake_get_display_clock_speed;
1455514784 else if (IS_BROXTON(dev))
@@ -14838,7 +15067,7 @@ static void i915_disable_vga(struct drm_device *dev) · 282 unmodified lines
1483815067 {
1483915068 struct drm_i915_private *dev_priv = dev->dev_private;
1484015069 u8 sr1;
14841− u32 vga_reg = i915_vgacntrl_reg(dev);
15070+ i915_reg_t vga_reg = i915_vgacntrl_reg(dev);
1484215071
1484315072 /* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
1484415073 vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
@@ -14954,9 +15183,6 @@ void intel_modeset_init(struct drm_device *dev) · 109 unmodified lines
1495415183 i915_disable_vga(dev);
1495515184 intel_setup_outputs(dev);
1495615185
14957− /* Just in case the BIOS is doing something questionable. */
14958− intel_fbc_disable(dev_priv);
14959−
1496015186 drm_modeset_lock_all(dev);
1496115187 intel_modeset_setup_hw_state(dev);
1496215188 drm_modeset_unlock_all(dev);
@@ -15043,10 +15269,9 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) · 80 unmodified lines
1504315269 {
1504415270 struct drm_device *dev = crtc->base.dev;
1504515271 struct drm_i915_private *dev_priv = dev->dev_private;
15046− u32 reg;
15272+ i915_reg_t reg = PIPECONF(crtc->config->cpu_transcoder);
1504715273
1504815274 /* Clear any frame start delays used for debugging left by the BIOS */
15049− reg = PIPECONF(crtc->config->cpu_transcoder);
1505015275 I915_WRITE(reg, I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK);
1505115276
1505215277 /* restore vblank interrupts to correct state */
@@ -15200,7 +15425,7 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder) · 147 unmodified lines
1520015425 void i915_redisable_vga_power_on(struct drm_device *dev)
1520115426 {
1520215427 struct drm_i915_private *dev_priv = dev->dev_private;
15203− u32 vga_reg = i915_vgacntrl_reg(dev);
15428+ i915_reg_t vga_reg = i915_vgacntrl_reg(dev);
1520415429
1520515430 if (!(I915_READ(vga_reg) & VGA_DISP_DISABLE)) {
1520615431 DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n");
@@ -15239,7 +15464,7 @@ static void readout_plane_state(struct intel_crtc *crtc) · 32 unmodified lines
1523915464 struct intel_plane_state *plane_state =
1524015465 to_intel_plane_state(primary->state);
1524115466
15242− plane_state->visible =
15467+ plane_state->visible = crtc->active &&
1524315468 primary_get_hw_state(to_intel_plane(primary));
1524415469
1524515470 if (plane_state->visible)
@@ -15496,8 +15721,7 @@ void intel_modeset_gem_init(struct drm_device *dev) · 250 unmodified lines
1549615721 mutex_lock(&dev->struct_mutex);
1549715722 ret = intel_pin_and_fence_fb_obj(c->primary,
1549815723 c->primary->fb,
15499− c->primary->state,
15500− NULL, NULL);
15724+ c->primary->state);
1550115725 mutex_unlock(&dev->struct_mutex);
1550215726 if (ret) {
1550315727 DRM_ERROR("failed to pin boot fb on pipe %d\n",
drivers/gpu/drm/i915/intel_dp.c+431−609
@@ -541,7 +541,8 @@ void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv) · 540 unmodified lines
541541 }
542542 }
543543
544−static u32 _pp_ctrl_reg(struct intel_dp *intel_dp)
544+static i915_reg_t
545+_pp_ctrl_reg(struct intel_dp *intel_dp)
545546 {
546547 struct drm_device *dev = intel_dp_to_dev(intel_dp);
547548
@@ -553,7 +554,8 @@ static u32 _pp_ctrl_reg(struct intel_dp *intel_dp) · 5 unmodified lines
553554 return VLV_PIPE_PP_CONTROL(vlv_power_sequencer_pipe(intel_dp));
554555 }
555556
556−static u32 _pp_stat_reg(struct intel_dp *intel_dp)
557+static i915_reg_t
558+_pp_stat_reg(struct intel_dp *intel_dp)
557559 {
558560 struct drm_device *dev = intel_dp_to_dev(intel_dp);
559561
@@ -582,7 +584,7 @@ static int edp_notify_handler(struct notifier_block *this, unsigned long code, · 22 unmodified lines
582584
583585 if (IS_VALLEYVIEW(dev)) {
584586 enum pipe pipe = vlv_power_sequencer_pipe(intel_dp);
585− u32 pp_ctrl_reg, pp_div_reg;
587+ i915_reg_t pp_ctrl_reg, pp_div_reg;
586588 u32 pp_div;
587589
588590 pp_ctrl_reg = VLV_PIPE_PP_CONTROL(pipe);
@@ -652,7 +654,7 @@ intel_dp_aux_wait_done(struct intel_dp *intel_dp, bool has_aux_irq) · 63 unmodified lines
652654 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
653655 struct drm_device *dev = intel_dig_port->base.base.dev;
654656 struct drm_i915_private *dev_priv = dev->dev_private;
655− uint32_t ch_ctl = intel_dp->aux_ch_ctl_reg;
657+ i915_reg_t ch_ctl = intel_dp->aux_ch_ctl_reg;
656658 uint32_t status;
657659 bool done;
658660
@@ -750,7 +752,7 @@ static uint32_t i9xx_get_aux_send_ctl(struct intel_dp *intel_dp, · 91 unmodified lines
750752 else
751753 precharge = 5;
752754
753− if (IS_BROADWELL(dev) && intel_dp->aux_ch_ctl_reg == DPA_AUX_CH_CTL)
755+ if (IS_BROADWELL(dev) && intel_dig_port->port == PORT_A)
754756 timeout = DP_AUX_CH_CTL_TIME_OUT_600us;
755757 else
756758 timeout = DP_AUX_CH_CTL_TIME_OUT_400us;
@@ -789,8 +791,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, · 32 unmodified lines
789791 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
790792 struct drm_device *dev = intel_dig_port->base.base.dev;
791793 struct drm_i915_private *dev_priv = dev->dev_private;
792− uint32_t ch_ctl = intel_dp->aux_ch_ctl_reg;
793− uint32_t ch_data = ch_ctl + 4;
794+ i915_reg_t ch_ctl = intel_dp->aux_ch_ctl_reg;
794795 uint32_t aux_clock_divider;
795796 int i, ret, recv_bytes;
796797 uint32_t status;
@@ -854,7 +855,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, · 57 unmodified lines
854855 for (try = 0; try < 5; try++) {
855856 /* Load the send data into the aux channel data registers */
856857 for (i = 0; i < send_bytes; i += 4)
857− I915_WRITE(ch_data + i,
858+ I915_WRITE(intel_dp->aux_ch_data_reg[i >> 2],
858859 intel_dp_pack_aux(send + i,
859860 send_bytes - i));
860861
@@ -918,7 +919,7 @@ done: · 57 unmodified lines
918919 recv_bytes = recv_size;
919920
920921 for (i = 0; i < recv_bytes; i += 4)
921− intel_dp_unpack_aux(I915_READ(ch_data + i),
922+ intel_dp_unpack_aux(I915_READ(intel_dp->aux_ch_data_reg[i >> 2]),
922923 recv + i, recv_bytes - i);
923924
924925 ret = recv_bytes;
@@ -1005,96 +1006,206 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) · 80 unmodified lines
10051006 return ret;
10061007 }
10071008
1008−static void
1009−intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
1009+static i915_reg_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv,
1010+ enum port port)
10101011 {
1011− struct drm_device *dev = intel_dp_to_dev(intel_dp);
1012− struct drm_i915_private *dev_priv = dev->dev_private;
1013− struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
1014− enum port port = intel_dig_port->port;
1015− struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port];
1016− const char *name = NULL;
1017− uint32_t porte_aux_ctl_reg = DPA_AUX_CH_CTL;
1018− int ret;
1012+ switch (port) {
1013+ case PORT_B:
1014+ case PORT_C:
1015+ case PORT_D:
1016+ return DP_AUX_CH_CTL(port);
1017+ default:
1018+ MISSING_CASE(port);
1019+ return DP_AUX_CH_CTL(PORT_B);
1020+ }
1021+}
10191022
1020− /* On SKL we don't have Aux for port E so we rely on VBT to set
1021− * a proper alternate aux channel.
1022− */
1023− if (IS_SKYLAKE(dev) && port == PORT_E) {
1024− switch (info->alternate_aux_channel) {
1025− case DP_AUX_B:
1026− porte_aux_ctl_reg = DPB_AUX_CH_CTL;
1027− break;
1028− case DP_AUX_C:
1029− porte_aux_ctl_reg = DPC_AUX_CH_CTL;
1030− break;
1031− case DP_AUX_D:
1032− porte_aux_ctl_reg = DPD_AUX_CH_CTL;
1033− break;
1034− case DP_AUX_A:
1035− default:
1036− porte_aux_ctl_reg = DPA_AUX_CH_CTL;
1037− }
1023+static i915_reg_t g4x_aux_data_reg(struct drm_i915_private *dev_priv,
1024+ enum port port, int index)
1025+{
1026+ switch (port) {
1027+ case PORT_B:
1028+ case PORT_C:
1029+ case PORT_D:
1030+ return DP_AUX_CH_DATA(port, index);
1031+ default:
1032+ MISSING_CASE(port);
1033+ return DP_AUX_CH_DATA(PORT_B, index);
10381034 }
1035+}
10391036
1037+static i915_reg_t ilk_aux_ctl_reg(struct drm_i915_private *dev_priv,
1038+ enum port port)
1039+{
10401040 switch (port) {
10411041 case PORT_A:
1042− intel_dp->aux_ch_ctl_reg = DPA_AUX_CH_CTL;
1043− name = "DPDDC-A";
1044− break;
1042+ return DP_AUX_CH_CTL(port);
10451043 case PORT_B:
1046− intel_dp->aux_ch_ctl_reg = PCH_DPB_AUX_CH_CTL;
1047− name = "DPDDC-B";
1048− break;
10491044 case PORT_C:
1050− intel_dp->aux_ch_ctl_reg = PCH_DPC_AUX_CH_CTL;
1051− name = "DPDDC-C";
1052− break;
10531045 case PORT_D:
1054− intel_dp->aux_ch_ctl_reg = PCH_DPD_AUX_CH_CTL;
1055− name = "DPDDC-D";
1056− break;
1057− case PORT_E:
1058− intel_dp->aux_ch_ctl_reg = porte_aux_ctl_reg;
1059− name = "DPDDC-E";
1060− break;
1046+ return PCH_DP_AUX_CH_CTL(port);
10611047 default:
1062− BUG();
1048+ MISSING_CASE(port);
1049+ return DP_AUX_CH_CTL(PORT_A);
10631050 }
1051+}
10641052
1065− /*
1066− * The AUX_CTL register is usually DP_CTL + 0x10.
1067− *
1068− * On Haswell and Broadwell though:
1069− * - Both port A DDI_BUF_CTL and DDI_AUX_CTL are on the CPU
1070− * - Port B/C/D AUX channels are on the PCH, DDI_BUF_CTL on the CPU
1071− *
1072− * Skylake moves AUX_CTL back next to DDI_BUF_CTL, on the CPU.
1073− */
1074− if (!IS_HASWELL(dev) && !IS_BROADWELL(dev) && port != PORT_E)
1075− intel_dp->aux_ch_ctl_reg = intel_dp->output_reg + 0x10;
1053+static i915_reg_t ilk_aux_data_reg(struct drm_i915_private *dev_priv,
1054+ enum port port, int index)
1055+{
1056+ switch (port) {
1057+ case PORT_A:
1058+ return DP_AUX_CH_DATA(port, index);
1059+ case PORT_B:
1060+ case PORT_C:
1061+ case PORT_D:
1062+ return PCH_DP_AUX_CH_DATA(port, index);
1063+ default:
1064+ MISSING_CASE(port);
1065+ return DP_AUX_CH_DATA(PORT_A, index);
1066+ }
1067+}
1068+
1069+/*
1070+ * On SKL we don't have Aux for port E so we rely
1071+ * on VBT to set a proper alternate aux channel.
1072+ */
1073+static enum port skl_porte_aux_port(struct drm_i915_private *dev_priv)
1074+{
1075+ const struct ddi_vbt_port_info *info =
1076+ &dev_priv->vbt.ddi_port_info[PORT_E];
1077+
1078+ switch (info->alternate_aux_channel) {
1079+ case DP_AUX_A:
1080+ return PORT_A;
1081+ case DP_AUX_B:
1082+ return PORT_B;
1083+ case DP_AUX_C:
1084+ return PORT_C;
1085+ case DP_AUX_D:
1086+ return PORT_D;
1087+ default:
1088+ MISSING_CASE(info->alternate_aux_channel);
1089+ return PORT_A;
1090+ }
1091+}
1092+
1093+static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv,
1094+ enum port port)
1095+{
1096+ if (port == PORT_E)
1097+ port = skl_porte_aux_port(dev_priv);
1098+
1099+ switch (port) {
1100+ case PORT_A:
1101+ case PORT_B:
1102+ case PORT_C:
1103+ case PORT_D:
1104+ return DP_AUX_CH_CTL(port);
1105+ default:
1106+ MISSING_CASE(port);
1107+ return DP_AUX_CH_CTL(PORT_A);
1108+ }
1109+}
1110+
1111+static i915_reg_t skl_aux_data_reg(struct drm_i915_private *dev_priv,
1112+ enum port port, int index)
1113+{
1114+ if (port == PORT_E)
1115+ port = skl_porte_aux_port(dev_priv);
1116+
1117+ switch (port) {
1118+ case PORT_A:
1119+ case PORT_B:
1120+ case PORT_C:
1121+ case PORT_D:
1122+ return DP_AUX_CH_DATA(port, index);
1123+ default:
1124+ MISSING_CASE(port);
1125+ return DP_AUX_CH_DATA(PORT_A, index);
1126+ }
1127+}
1128+
1129+static i915_reg_t intel_aux_ctl_reg(struct drm_i915_private *dev_priv,
1130+ enum port port)
1131+{
1132+ if (INTEL_INFO(dev_priv)->gen >= 9)
1133+ return skl_aux_ctl_reg(dev_priv, port);
1134+ else if (HAS_PCH_SPLIT(dev_priv))
1135+ return ilk_aux_ctl_reg(dev_priv, port);
1136+ else
1137+ return g4x_aux_ctl_reg(dev_priv, port);
1138+}
1139+
1140+static i915_reg_t intel_aux_data_reg(struct drm_i915_private *dev_priv,
1141+ enum port port, int index)
1142+{
1143+ if (INTEL_INFO(dev_priv)->gen >= 9)
1144+ return skl_aux_data_reg(dev_priv, port, index);
1145+ else if (HAS_PCH_SPLIT(dev_priv))
1146+ return ilk_aux_data_reg(dev_priv, port, index);
1147+ else
1148+ return g4x_aux_data_reg(dev_priv, port, index);
1149+}
1150+
1151+static void intel_aux_reg_init(struct intel_dp *intel_dp)
1152+{
1153+ struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
1154+ enum port port = dp_to_dig_port(intel_dp)->port;
1155+ int i;
1156+
1157+ intel_dp->aux_ch_ctl_reg = intel_aux_ctl_reg(dev_priv, port);
1158+ for (i = 0; i < ARRAY_SIZE(intel_dp->aux_ch_data_reg); i++)
1159+ intel_dp->aux_ch_data_reg[i] = intel_aux_data_reg(dev_priv, port, i);
1160+}
1161+
1162+static void
1163+intel_dp_aux_fini(struct intel_dp *intel_dp)
1164+{
1165+ drm_dp_aux_unregister(&intel_dp->aux);
1166+ kfree(intel_dp->aux.name);
1167+}
1168+
1169+static int
1170+intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
1171+{
1172+ struct drm_device *dev = intel_dp_to_dev(intel_dp);
1173+ struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
1174+ enum port port = intel_dig_port->port;
1175+ int ret;
1176+
1177+ intel_aux_reg_init(intel_dp);
1178+
1179+ intel_dp->aux.name = kasprintf(GFP_KERNEL, "DPDDC-%c", port_name(port));
1180+ if (!intel_dp->aux.name)
1181+ return -ENOMEM;
10761182
1077− intel_dp->aux.name = name;
10781183 intel_dp->aux.dev = dev->dev;
10791184 intel_dp->aux.transfer = intel_dp_aux_transfer;
10801185
1081− DRM_DEBUG_KMS("registering %s bus for %s\n", name,
1186+ DRM_DEBUG_KMS("registering %s bus for %s\n",
1187+ intel_dp->aux.name,
10821188 connector->base.kdev->kobj.name);
10831189
10841190 ret = drm_dp_aux_register(&intel_dp->aux);
10851191 if (ret < 0) {
10861192 DRM_ERROR("drm_dp_aux_register() for %s failed (%d)\n",
1087− name, ret);
1088− return;
1193+ intel_dp->aux.name, ret);
1194+ kfree(intel_dp->aux.name);
1195+ return ret;
10891196 }
10901197
10911198 ret = sysfs_create_link(&connector->base.kdev->kobj,
10921199 &intel_dp->aux.ddc.dev.kobj,
10931200 intel_dp->aux.ddc.dev.kobj.name);
10941201 if (ret < 0) {
1095− DRM_ERROR("sysfs_create_link() for %s failed (%d)\n", name, ret);
1096− drm_dp_aux_unregister(&intel_dp->aux);
1202+ DRM_ERROR("sysfs_create_link() for %s failed (%d)\n",
1203+ intel_dp->aux.name, ret);
1204+ intel_dp_aux_fini(intel_dp);
1205+ return ret;
10971206 }
1207+
1208+ return 0;
10981209 }
10991210
11001211 static void
@@ -1186,10 +1297,13 @@ intel_dp_sink_rates(struct intel_dp *intel_dp, const int **sink_rates) · 85 unmodified lines
11861297 return (intel_dp_max_link_bw(intel_dp) >> 3) + 1;
11871298 }
11881299
1189−static bool intel_dp_source_supports_hbr2(struct drm_device *dev)
1300+bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp)
11901301 {
1302+ struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
1303+ struct drm_device *dev = dig_port->base.base.dev;
1304+
11911305 /* WaDisableHBR2:skl */
1192− if (IS_SKYLAKE(dev) && INTEL_REVID(dev) <= SKL_REVID_B0)
1306+ if (IS_SKL_REVID(dev, 0, SKL_REVID_B0))
11931307 return false;
11941308
11951309 if ((IS_HASWELL(dev) && !IS_HSW_ULX(dev)) || IS_BROADWELL(dev) ||
@@ -1200,14 +1314,16 @@ static bool intel_dp_source_supports_hbr2(struct drm_device *dev) · 4 unmodified lines
12001314 }
12011315
12021316 static int
1203−intel_dp_source_rates(struct drm_device *dev, const int **source_rates)
1317+intel_dp_source_rates(struct intel_dp *intel_dp, const int **source_rates)
12041318 {
1319+ struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
1320+ struct drm_device *dev = dig_port->base.base.dev;
12051321 int size;
12061322
12071323 if (IS_BROXTON(dev)) {
12081324 *source_rates = bxt_rates;
12091325 size = ARRAY_SIZE(bxt_rates);
1210− } else if (IS_SKYLAKE(dev)) {
1326+ } else if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
12111327 *source_rates = skl_rates;
12121328 size = ARRAY_SIZE(skl_rates);
12131329 } else {
@@ -1216,7 +1332,7 @@ intel_dp_source_rates(struct drm_device *dev, const int **source_rates) · 2 unmodified lines
12161332 }
12171333
12181334 /* This depends on the fact that 5.4 is last value in the array */
1219− if (!intel_dp_source_supports_hbr2(dev))
1335+ if (!intel_dp_source_supports_hbr2(intel_dp))
12201336 size--;
12211337
12221338 return size;
@@ -1281,12 +1397,11 @@ static int intersect_rates(const int *source_rates, int source_len, · 58 unmodified lines
12811397 static int intel_dp_common_rates(struct intel_dp *intel_dp,
12821398 int *common_rates)
12831399 {
1284− struct drm_device *dev = intel_dp_to_dev(intel_dp);
12851400 const int *source_rates, *sink_rates;
12861401 int source_len, sink_len;
12871402
12881403 sink_len = intel_dp_sink_rates(intel_dp, &sink_rates);
1289− source_len = intel_dp_source_rates(dev, &source_rates);
1404+ source_len = intel_dp_source_rates(intel_dp, &source_rates);
12901405
12911406 return intersect_rates(source_rates, source_len,
12921407 sink_rates, sink_len,
@@ -1311,7 +1426,6 @@ static void snprintf_int_array(char *str, size_t len, · 18 unmodified lines
13111426
13121427 static void intel_dp_print_rates(struct intel_dp *intel_dp)
13131428 {
1314− struct drm_device *dev = intel_dp_to_dev(intel_dp);
13151429 const int *source_rates, *sink_rates;
13161430 int source_len, sink_len, common_len;
13171431 int common_rates[DP_MAX_SUPPORTED_RATES];
@@ -1320,7 +1434,7 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp) · 2 unmodified lines
13201434 if ((drm_debug & DRM_UT_KMS) == 0)
13211435 return;
13221436
1323− source_len = intel_dp_source_rates(dev, &source_rates);
1437+ source_len = intel_dp_source_rates(intel_dp, &source_rates);
13241438 snprintf_int_array(str, sizeof(str), source_rates, source_len);
13251439 DRM_DEBUG_KMS("source rates: %s\n", str);
13261440
@@ -1362,8 +1476,8 @@ int intel_dp_rate_select(struct intel_dp *intel_dp, int rate) · 35 unmodified lines
13621476 return rate_to_index(rate, intel_dp->sink_rates);
13631477 }
13641478
1365−static void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
1366− uint8_t *link_bw, uint8_t *rate_select)
1479+void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
1480+ uint8_t *link_bw, uint8_t *rate_select)
13671481 {
13681482 if (intel_dp->num_sink_rates) {
13691483 *link_bw = 0;
@@ -1423,7 +1537,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, · 53 unmodified lines
14231537 return ret;
14241538 }
14251539
1426− if (!HAS_PCH_SPLIT(dev))
1540+ if (HAS_GMCH_DISPLAY(dev))
14271541 intel_gmch_panel_fitting(intel_crtc, pipe_config,
14281542 intel_connector->panel.fitting_mode);
14291543 else
@@ -1527,7 +1641,7 @@ found: · 97 unmodified lines
15271641 &pipe_config->dp_m2_n2);
15281642 }
15291643
1530− if (IS_SKYLAKE(dev) && is_edp(intel_dp))
1644+ if ((IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) && is_edp(intel_dp))
15311645 skl_edp_set_pll_config(pipe_config);
15321646 else if (IS_BROXTON(dev))
15331647 /* handled in ddi */;
@@ -1539,37 +1653,6 @@ found: · 5 unmodified lines
15391653 return true;
15401654 }
15411655
1542−static void ironlake_set_pll_cpu_edp(struct intel_dp *intel_dp)
1543−{
1544− struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
1545− struct intel_crtc *crtc = to_intel_crtc(dig_port->base.base.crtc);
1546− struct drm_device *dev = crtc->base.dev;
1547− struct drm_i915_private *dev_priv = dev->dev_private;
1548− u32 dpa_ctl;
1549−
1550− DRM_DEBUG_KMS("eDP PLL enable for clock %d\n",
1551− crtc->config->port_clock);
1552− dpa_ctl = I915_READ(DP_A);
1553− dpa_ctl &= ~DP_PLL_FREQ_MASK;
1554−
1555− if (crtc->config->port_clock == 162000) {
1556− /* For a long time we've carried around a ILK-DevA w/a for the
1557− * 160MHz clock. If we're really unlucky, it's still required.
1558− */
1559− DRM_DEBUG_KMS("160MHz cpu eDP clock, might need ilk devA w/a\n");
1560− dpa_ctl |= DP_PLL_FREQ_160MHZ;
1561− intel_dp->DP |= DP_PLL_FREQ_160MHZ;
1562− } else {
1563− dpa_ctl |= DP_PLL_FREQ_270MHZ;
1564− intel_dp->DP |= DP_PLL_FREQ_270MHZ;
1565− }
1566−
1567− I915_WRITE(DP_A, dpa_ctl);
1568−
1569− POSTING_READ(DP_A);
1570− udelay(500);
1571−}
1572−
15731656 void intel_dp_set_link_params(struct intel_dp *intel_dp,
15741657 const struct intel_crtc_state *pipe_config)
15751658 {
@@ -1614,9 +1697,6 @@ static void intel_dp_prepare(struct intel_encoder *encoder) · 38 unmodified lines
16141697 intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0;
16151698 intel_dp->DP |= DP_PORT_WIDTH(crtc->config->lane_count);
16161699
1617− if (crtc->config->has_audio)
1618− intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE;
1619−
16201700 /* Split out the IBX/CPU vs CPT settings */
16211701
16221702 if (IS_GEN7(dev) && port == PORT_A) {
@@ -1677,7 +1757,7 @@ static void wait_panel_status(struct intel_dp *intel_dp, · 54 unmodified lines
16771757 {
16781758 struct drm_device *dev = intel_dp_to_dev(intel_dp);
16791759 struct drm_i915_private *dev_priv = dev->dev_private;
1680− u32 pp_stat_reg, pp_ctrl_reg;
1760+ i915_reg_t pp_stat_reg, pp_ctrl_reg;
16811761
16821762 lockdep_assert_held(&dev_priv->pps_mutex);
16831763
@@ -1767,7 +1847,7 @@ static bool edp_panel_vdd_on(struct intel_dp *intel_dp) · 83 unmodified lines
17671847 struct drm_i915_private *dev_priv = dev->dev_private;
17681848 enum intel_display_power_domain power_domain;
17691849 u32 pp;
1770− u32 pp_stat_reg, pp_ctrl_reg;
1850+ i915_reg_t pp_stat_reg, pp_ctrl_reg;
17711851 bool need_to_disable = !intel_dp->want_panel_vdd;
17721852
17731853 lockdep_assert_held(&dev_priv->pps_mutex);
@@ -1843,7 +1923,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) · 69 unmodified lines
18431923 struct intel_encoder *intel_encoder = &intel_dig_port->base;
18441924 enum intel_display_power_domain power_domain;
18451925 u32 pp;
1846− u32 pp_stat_reg, pp_ctrl_reg;
1926+ i915_reg_t pp_stat_reg, pp_ctrl_reg;
18471927
18481928 lockdep_assert_held(&dev_priv->pps_mutex);
18491929
@@ -1930,7 +2010,7 @@ static void edp_panel_on(struct intel_dp *intel_dp) · 80 unmodified lines
19302010 struct drm_device *dev = intel_dp_to_dev(intel_dp);
19312011 struct drm_i915_private *dev_priv = dev->dev_private;
19322012 u32 pp;
1933− u32 pp_ctrl_reg;
2013+ i915_reg_t pp_ctrl_reg;
19342014
19352015 lockdep_assert_held(&dev_priv->pps_mutex);
19362016
@@ -1992,7 +2072,7 @@ static void edp_panel_off(struct intel_dp *intel_dp) · 55 unmodified lines
19922072 struct drm_i915_private *dev_priv = dev->dev_private;
19932073 enum intel_display_power_domain power_domain;
19942074 u32 pp;
1995− u32 pp_ctrl_reg;
2075+ i915_reg_t pp_ctrl_reg;
19962076
19972077 lockdep_assert_held(&dev_priv->pps_mutex);
19982078
@@ -2043,7 +2123,7 @@ static void _intel_edp_backlight_on(struct intel_dp *intel_dp) · 44 unmodified lines
20432123 struct drm_device *dev = intel_dig_port->base.base.dev;
20442124 struct drm_i915_private *dev_priv = dev->dev_private;
20452125 u32 pp;
2046− u32 pp_ctrl_reg;
2126+ i915_reg_t pp_ctrl_reg;
20472127
20482128 /*
20492129 * If we enable the backlight right away following a panel power
@@ -2084,7 +2164,7 @@ static void _intel_edp_backlight_off(struct intel_dp *intel_dp) · 34 unmodified lines
20842164 struct drm_device *dev = intel_dp_to_dev(intel_dp);
20852165 struct drm_i915_private *dev_priv = dev->dev_private;
20862166 u32 pp;
2087− u32 pp_ctrl_reg;
2167+ i915_reg_t pp_ctrl_reg;
20882168
20892169 if (!is_edp(intel_dp))
20902170 return;
@@ -2143,27 +2223,61 @@ static void intel_edp_backlight_power(struct intel_connector *connector, · 52 unmodified lines
21432223 _intel_edp_backlight_off(intel_dp);
21442224 }
21452225
2226+static const char *state_string(bool enabled)
2227+{
2228+ return enabled ? "on" : "off";
2229+}
2230+
2231+static void assert_dp_port(struct intel_dp *intel_dp, bool state)
2232+{
2233+ struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
2234+ struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
2235+ bool cur_state = I915_READ(intel_dp->output_reg) & DP_PORT_EN;
2236+
2237+ I915_STATE_WARN(cur_state != state,
2238+ "DP port %c state assertion failure (expected %s, current %s)\n",
2239+ port_name(dig_port->port),
2240+ state_string(state), state_string(cur_state));
2241+}
2242+#define assert_dp_port_disabled(d) assert_dp_port((d), false)
2243+
2244+static void assert_edp_pll(struct drm_i915_private *dev_priv, bool state)
2245+{
2246+ bool cur_state = I915_READ(DP_A) & DP_PLL_ENABLE;
2247+
2248+ I915_STATE_WARN(cur_state != state,
2249+ "eDP PLL state assertion failure (expected %s, current %s)\n",
2250+ state_string(state), state_string(cur_state));
2251+}
2252+#define assert_edp_pll_enabled(d) assert_edp_pll((d), true)
2253+#define assert_edp_pll_disabled(d) assert_edp_pll((d), false)
2254+
21462255 static void ironlake_edp_pll_on(struct intel_dp *intel_dp)
21472256 {
21482257 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
2149− struct drm_crtc *crtc = intel_dig_port->base.base.crtc;
2150− struct drm_device *dev = crtc->dev;
2151− struct drm_i915_private *dev_priv = dev->dev_private;
2152− u32 dpa_ctl;
2258+ struct intel_crtc *crtc = to_intel_crtc(intel_dig_port->base.base.crtc);
2259+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
21532260
2154− assert_pipe_disabled(dev_priv,
2155− to_intel_crtc(crtc)->pipe);
2261+ assert_pipe_disabled(dev_priv, crtc->pipe);
2262+ assert_dp_port_disabled(intel_dp);
2263+ assert_edp_pll_disabled(dev_priv);
2264+
2265+ DRM_DEBUG_KMS("enabling eDP PLL for clock %d\n",
2266+ crtc->config->port_clock);
2267+
2268+ intel_dp->DP &= ~DP_PLL_FREQ_MASK;
2269+
2270+ if (crtc->config->port_clock == 162000)
2271+ intel_dp->DP |= DP_PLL_FREQ_162MHZ;
2272+ else
2273+ intel_dp->DP |= DP_PLL_FREQ_270MHZ;
2274+
2275+ I915_WRITE(DP_A, intel_dp->DP);
2276+ POSTING_READ(DP_A);
2277+ udelay(500);
21562278
2157− DRM_DEBUG_KMS("\n");
2158− dpa_ctl = I915_READ(DP_A);
2159− WARN(dpa_ctl & DP_PLL_ENABLE, "dp pll on, should be off\n");
2160− WARN(dpa_ctl & DP_PORT_EN, "dp port still on, should be off\n");
2161−
2162− /* We don't adjust intel_dp->DP while tearing down the link, to
2163− * facilitate link retraining (e.g. after hotplug). Hence clear all
2164− * enable bits here to ensure that we don't enable too much. */
2165− intel_dp->DP &= ~(DP_PORT_EN | DP_AUDIO_OUTPUT_ENABLE);
21662279 intel_dp->DP |= DP_PLL_ENABLE;
2280+
21672281 I915_WRITE(DP_A, intel_dp->DP);
21682282 POSTING_READ(DP_A);
21692283 udelay(200);
@@ -2172,24 +2286,18 @@ static void ironlake_edp_pll_on(struct intel_dp *intel_dp) · 2 unmodified lines
21722286 static void ironlake_edp_pll_off(struct intel_dp *intel_dp)
21732287 {
21742288 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
2175− struct drm_crtc *crtc = intel_dig_port->base.base.crtc;
2176− struct drm_device *dev = crtc->dev;
2177− struct drm_i915_private *dev_priv = dev->dev_private;
2178− u32 dpa_ctl;
2289+ struct intel_crtc *crtc = to_intel_crtc(intel_dig_port->base.base.crtc);
2290+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
2291+
2292+ assert_pipe_disabled(dev_priv, crtc->pipe);
2293+ assert_dp_port_disabled(intel_dp);
2294+ assert_edp_pll_enabled(dev_priv);
21792295
2180− assert_pipe_disabled(dev_priv,
2181− to_intel_crtc(crtc)->pipe);
2296+ DRM_DEBUG_KMS("disabling eDP PLL\n");
21822297
2183− dpa_ctl = I915_READ(DP_A);
2184− WARN((dpa_ctl & DP_PLL_ENABLE) == 0,
2185− "dp pll off, should be on\n");
2186− WARN(dpa_ctl & DP_PORT_EN, "dp port still on, should be off\n");
2298+ intel_dp->DP &= ~DP_PLL_ENABLE;
21872299
2188− /* We can't rely on the value tracked for the DP register in
2189− * intel_dp->DP because link_down must not change that (otherwise link
2190− * re-training will fail. */
2191− dpa_ctl &= ~DP_PLL_ENABLE;
2192− I915_WRITE(DP_A, dpa_ctl);
2300+ I915_WRITE(DP_A, intel_dp->DP);
21932301 POSTING_READ(DP_A);
21942302 udelay(200);
21952303 }
@@ -2258,7 +2366,7 @@ static bool intel_dp_get_hw_state(struct intel_encoder *encoder, · 62 unmodified lines
22582366 }
22592367
22602368 DRM_DEBUG_KMS("No pipe for dp port 0x%x found\n",
2261− intel_dp->output_reg);
2369+ i915_mmio_reg_offset(intel_dp->output_reg));
22622370 } else if (IS_CHERRYVIEW(dev)) {
22632371 *pipe = DP_PORT_TO_PIPE_CHV(tmp);
22642372 } else {
@@ -2321,7 +2429,7 @@ static void intel_dp_get_config(struct intel_encoder *encoder, · 56 unmodified lines
23212429 intel_dp_get_m_n(crtc, pipe_config);
23222430
23232431 if (port == PORT_A) {
2324− if ((I915_READ(DP_A) & DP_PLL_FREQ_MASK) == DP_PLL_FREQ_160MHZ)
2432+ if ((I915_READ(DP_A) & DP_PLL_FREQ_MASK) == DP_PLL_FREQ_162MHZ)
23252433 pipe_config->port_clock = 162000;
23262434 else
23272435 pipe_config->port_clock = 270000;
@@ -2386,6 +2494,8 @@ static void ilk_post_disable_dp(struct intel_encoder *encoder) · 58 unmodified lines
23862494 enum port port = dp_to_dig_port(intel_dp)->port;
23872495
23882496 intel_dp_link_down(intel_dp);
2497+
2498+ /* Only ilk+ has port A */
23892499 if (port == PORT_A)
23902500 ironlake_edp_pll_off(intel_dp);
23912501 }
@@ -2545,6 +2655,8 @@ static void intel_dp_enable_port(struct intel_dp *intel_dp) · 153 unmodified lines
25452655 {
25462656 struct drm_device *dev = intel_dp_to_dev(intel_dp);
25472657 struct drm_i915_private *dev_priv = dev->dev_private;
2658+ struct intel_crtc *crtc =
2659+ to_intel_crtc(dp_to_dig_port(intel_dp)->base.base.crtc);
25482660
25492661 /* enable with pattern 1 (as per spec) */
25502662 _intel_dp_set_link_train(intel_dp, &intel_dp->DP,
@@ -2560,6 +2672,8 @@ static void intel_dp_enable_port(struct intel_dp *intel_dp) · 9 unmodified lines
25602672 * fail when the power sequencer is freshly used for this port.
25612673 */
25622674 intel_dp->DP |= DP_PORT_EN;
2675+ if (crtc->config->has_audio)
2676+ intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE;
25632677
25642678 I915_WRITE(intel_dp->output_reg, intel_dp->DP);
25652679 POSTING_READ(intel_dp->output_reg);
@@ -2572,6 +2686,8 @@ static void intel_enable_dp(struct intel_encoder *encoder) · 6 unmodified lines
25722686 struct drm_i915_private *dev_priv = dev->dev_private;
25732687 struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
25742688 uint32_t dp_reg = I915_READ(intel_dp->output_reg);
2689+ enum port port = dp_to_dig_port(intel_dp)->port;
2690+ enum pipe pipe = crtc->pipe;
25752691
25762692 if (WARN_ON(dp_reg & DP_PORT_EN))
25772693 return;
@@ -2583,6 +2699,17 @@ static void intel_enable_dp(struct intel_encoder *encoder) · 5 unmodified lines
25832699
25842700 intel_dp_enable_port(intel_dp);
25852701
2702+ if (port == PORT_A && IS_GEN5(dev_priv)) {
2703+ /*
2704+ * Underrun reporting for the other pipe was disabled in
2705+ * g4x_pre_enable_dp(). The eDP PLL and port have now been
2706+ * enabled, so it's now safe to re-enable underrun reporting.
2707+ */
2708+ intel_wait_for_vblank_if_active(dev_priv->dev, !pipe);
2709+ intel_set_cpu_fifo_underrun_reporting(dev_priv, !pipe, true);
2710+ intel_set_pch_fifo_underrun_reporting(dev_priv, !pipe, true);
2711+ }
2712+
25862713 edp_panel_vdd_on(intel_dp);
25872714 edp_panel_on(intel_dp);
25882715 edp_panel_vdd_off(intel_dp, true);
@@ -2605,7 +2732,7 @@ static void intel_enable_dp(struct intel_encoder *encoder) · 16 unmodified lines
26052732
26062733 if (crtc->config->has_audio) {
26072734 DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n",
2608− pipe_name(crtc->pipe));
2735+ pipe_name(pipe));
26092736 intel_audio_codec_enable(encoder);
26102737 }
26112738 }
@@ -2628,16 +2755,29 @@ static void vlv_enable_dp(struct intel_encoder *encoder) · 16 unmodified lines
26282755
26292756 static void g4x_pre_enable_dp(struct intel_encoder *encoder)
26302757 {
2758+ struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
26312759 struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
2632− struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
2760+ enum port port = dp_to_dig_port(intel_dp)->port;
2761+ enum pipe pipe = to_intel_crtc(encoder->base.crtc)->pipe;
26332762
26342763 intel_dp_prepare(encoder);
26352764
2765+ if (port == PORT_A && IS_GEN5(dev_priv)) {
2766+ /*
2767+ * We get FIFO underruns on the other pipe when
2768+ * enabling the CPU eDP PLL, and when enabling CPU
2769+ * eDP port. We could potentially avoid the PLL
2770+ * underrun with a vblank wait just prior to enabling
2771+ * the PLL, but that doesn't appear to help the port
2772+ * enable case. Just sweep it all under the rug.
2773+ */
2774+ intel_set_cpu_fifo_underrun_reporting(dev_priv, !pipe, false);
2775+ intel_set_pch_fifo_underrun_reporting(dev_priv, !pipe, false);
2776+ }
2777+
26362778 /* Only ilk+ has port A */
2637− if (dport->port == PORT_A) {
2638− ironlake_set_pll_cpu_edp(intel_dp);
2779+ if (port == PORT_A)
26392780 ironlake_edp_pll_on(intel_dp);
2640− }
26412781 }
26422782
26432783 static void vlv_detach_power_sequencer(struct intel_dp *intel_dp)
@@ -2645,7 +2785,7 @@ static void vlv_detach_power_sequencer(struct intel_dp *intel_dp) · 1 unmodified line
26452785 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
26462786 struct drm_i915_private *dev_priv = intel_dig_port->base.base.dev->dev_private;
26472787 enum pipe pipe = intel_dp->pps_pipe;
2648− int pp_on_reg = VLV_PIPE_PP_ON_DELAYS(pipe);
2788+ i915_reg_t pp_on_reg = VLV_PIPE_PP_ON_DELAYS(pipe);
26492789
26502790 edp_panel_vdd_off_sync(intel_dp);
26512791
@@ -3043,7 +3183,7 @@ intel_dp_dpcd_read_wake(struct drm_dp_aux *aux, unsigned int offset, · 391 unmodified lines
30433183 * Fetch AUX CH registers 0x202 - 0x207 which contain
30443184 * link status information
30453185 */
3046−static bool
3186+bool
30473187 intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE])
30483188 {
30493189 return intel_dp_dpcd_read_wake(&intel_dp->aux,
@@ -3053,7 +3193,7 @@ intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_ · 3 unmodified lines
30533193 }
30543194
30553195 /* These are source-specific values. */
3056−static uint8_t
3196+uint8_t
30573197 intel_dp_voltage_max(struct intel_dp *intel_dp)
30583198 {
30593199 struct drm_device *dev = intel_dp_to_dev(intel_dp);
@@ -3076,7 +3216,7 @@ intel_dp_voltage_max(struct intel_dp *intel_dp) · 16 unmodified lines
30763216 return DP_TRAIN_VOLTAGE_SWING_LEVEL_2;
30773217 }
30783218
3079−static uint8_t
3219+uint8_t
30803220 intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing)
30813221 {
30823222 struct drm_device *dev = intel_dp_to_dev(intel_dp);
@@ -3418,38 +3558,6 @@ static uint32_t chv_signal_levels(struct intel_dp *intel_dp) · 335 unmodified lines
34183558 return 0;
34193559 }
34203560
3421−static void
3422−intel_get_adjust_train(struct intel_dp *intel_dp,
3423− const uint8_t link_status[DP_LINK_STATUS_SIZE])
3424−{
3425− uint8_t v = 0;
3426− uint8_t p = 0;
3427− int lane;
3428− uint8_t voltage_max;
3429− uint8_t preemph_max;
3430−
3431− for (lane = 0; lane < intel_dp->lane_count; lane++) {
3432− uint8_t this_v = drm_dp_get_adjust_request_voltage(link_status, lane);
3433− uint8_t this_p = drm_dp_get_adjust_request_pre_emphasis(link_status, lane);
3434−
3435− if (this_v > v)
3436− v = this_v;
3437− if (this_p > p)
3438− p = this_p;
3439− }
3440−
3441− voltage_max = intel_dp_voltage_max(intel_dp);
3442− if (v >= voltage_max)
3443− v = voltage_max | DP_TRAIN_MAX_SWING_REACHED;
3444−
3445− preemph_max = intel_dp_pre_emphasis_max(intel_dp, v);
3446− if (p >= preemph_max)
3447− p = preemph_max | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED;
3448−
3449− for (lane = 0; lane < 4; lane++)
3450− intel_dp->train_set[lane] = v | p;
3451−}
3452−
34533561 static uint32_t
34543562 gen4_signal_levels(uint8_t train_set)
34553563 {
@@ -3547,13 +3655,13 @@ gen7_edp_signal_levels(uint8_t train_set) · 91 unmodified lines
35473655 }
35483656 }
35493657
3550−/* Properly updates "DP" with the correct signal levels. */
3551−static void
3552−intel_dp_set_signal_levels(struct intel_dp *intel_dp, uint32_t *DP)
3658+void
3659+intel_dp_set_signal_levels(struct intel_dp *intel_dp)
35533660 {
35543661 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
35553662 enum port port = intel_dig_port->port;
35563663 struct drm_device *dev = intel_dig_port->base.base.dev;
3664+ struct drm_i915_private *dev_priv = to_i915(dev);
35573665 uint32_t signal_levels, mask = 0;
35583666 uint8_t train_set = intel_dp->train_set[0];
35593667
@@ -3588,74 +3696,27 @@ intel_dp_set_signal_levels(struct intel_dp *intel_dp, uint32_t *DP) · 28 unmodified lines
35883696 (train_set & DP_TRAIN_PRE_EMPHASIS_MASK) >>
35893697 DP_TRAIN_PRE_EMPHASIS_SHIFT);
35903698
3591− *DP = (*DP & ~mask) | signal_levels;
3592−}
3699+ intel_dp->DP = (intel_dp->DP & ~mask) | signal_levels;
35933700
3594−static bool
3595−intel_dp_set_link_train(struct intel_dp *intel_dp,
3596− uint32_t *DP,
3597− uint8_t dp_train_pat)
3598−{
3599− struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
3600− struct drm_i915_private *dev_priv =
3601− to_i915(intel_dig_port->base.base.dev);
3602− uint8_t buf[sizeof(intel_dp->train_set) + 1];
3603− int ret, len;
3604−
3605− _intel_dp_set_link_train(intel_dp, DP, dp_train_pat);
3606−
3607− I915_WRITE(intel_dp->output_reg, *DP);
3701+ I915_WRITE(intel_dp->output_reg, intel_dp->DP);
36083702 POSTING_READ(intel_dp->output_reg);
3609−
3610− buf[0] = dp_train_pat;
3611− if ((dp_train_pat & DP_TRAINING_PATTERN_MASK) ==
3612− DP_TRAINING_PATTERN_DISABLE) {
3613− /* don't write DP_TRAINING_LANEx_SET on disable */
3614− len = 1;
3615− } else {
3616− /* DP_TRAINING_LANEx_SET follow DP_TRAINING_PATTERN_SET */
3617− memcpy(buf + 1, intel_dp->train_set, intel_dp->lane_count);
3618− len = intel_dp->lane_count + 1;
3619− }
3620−
3621− ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_PATTERN_SET,
3622− buf, len);
3623−
3624− return ret == len;
3625−}
3626−
3627−static bool
3628−intel_dp_reset_link_train(struct intel_dp *intel_dp, uint32_t *DP,
3629− uint8_t dp_train_pat)
3630−{
3631− if (!intel_dp->train_set_valid)
3632− memset(intel_dp->train_set, 0, sizeof(intel_dp->train_set));
3633− intel_dp_set_signal_levels(intel_dp, DP);
3634− return intel_dp_set_link_train(intel_dp, DP, dp_train_pat);
36353703 }
36363704
3637−static bool
3638−intel_dp_update_link_train(struct intel_dp *intel_dp, uint32_t *DP,
3639− const uint8_t link_status[DP_LINK_STATUS_SIZE])
3705+void
3706+intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
3707+ uint8_t dp_train_pat)
36403708 {
36413709 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
36423710 struct drm_i915_private *dev_priv =
36433711 to_i915(intel_dig_port->base.base.dev);
3644− int ret;
36453712
3646− intel_get_adjust_train(intel_dp, link_status);
3647− intel_dp_set_signal_levels(intel_dp, DP);
3713+ _intel_dp_set_link_train(intel_dp, &intel_dp->DP, dp_train_pat);
36483714
3649− I915_WRITE(intel_dp->output_reg, *DP);
3715+ I915_WRITE(intel_dp->output_reg, intel_dp->DP);
36503716 POSTING_READ(intel_dp->output_reg);
3651−
3652− ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_LANE0_SET,
3653− intel_dp->train_set, intel_dp->lane_count);
3654−
3655− return ret == intel_dp->lane_count;
36563717 }
36573718
3658−static void intel_dp_set_idle_link_train(struct intel_dp *intel_dp)
3719+void intel_dp_set_idle_link_train(struct intel_dp *intel_dp)
36593720 {
36603721 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
36613722 struct drm_device *dev = intel_dig_port->base.base.dev;
@@ -3686,232 +3747,6 @@ static void intel_dp_set_idle_link_train(struct intel_dp *intel_dp) · 24 unmodified lines
36863747 DRM_ERROR("Timed out waiting for DP idle patterns\n");
36873748 }
36883749
3689−/* Enable corresponding port and start training pattern 1 */
3690−static void
3691−intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
3692−{
3693− struct drm_encoder *encoder = &dp_to_dig_port(intel_dp)->base.base;
3694− struct drm_device *dev = encoder->dev;
3695− int i;
3696− uint8_t voltage;
3697− int voltage_tries, loop_tries;
3698− uint32_t DP = intel_dp->DP;
3699− uint8_t link_config[2];
3700− uint8_t link_bw, rate_select;
3701−
3702− if (HAS_DDI(dev))
3703− intel_ddi_prepare_link_retrain(encoder);
3704−
3705− intel_dp_compute_rate(intel_dp, intel_dp->link_rate,
3706− &link_bw, &rate_select);
3707−
3708− /* Write the link configuration data */
3709− link_config[0] = link_bw;
3710− link_config[1] = intel_dp->lane_count;
3711− if (drm_dp_enhanced_frame_cap(intel_dp->dpcd))
3712− link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
3713− drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_BW_SET, link_config, 2);
3714− if (intel_dp->num_sink_rates)
3715− drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_RATE_SET,
3716− &rate_select, 1);
3717−
3718− link_config[0] = 0;
3719− link_config[1] = DP_SET_ANSI_8B10B;
3720− drm_dp_dpcd_write(&intel_dp->aux, DP_DOWNSPREAD_CTRL, link_config, 2);
3721−
3722− DP |= DP_PORT_EN;
3723−
3724− /* clock recovery */
3725− if (!intel_dp_reset_link_train(intel_dp, &DP,
3726− DP_TRAINING_PATTERN_1 |
3727− DP_LINK_SCRAMBLING_DISABLE)) {
3728− DRM_ERROR("failed to enable link training\n");
3729− return;
3730− }
3731−
3732− voltage = 0xff;
3733− voltage_tries = 0;
3734− loop_tries = 0;
3735− for (;;) {
3736− uint8_t link_status[DP_LINK_STATUS_SIZE];
3737−
3738− drm_dp_link_train_clock_recovery_delay(intel_dp->dpcd);
3739− if (!intel_dp_get_link_status(intel_dp, link_status)) {
3740− DRM_ERROR("failed to get link status\n");
3741− break;
3742− }
3743−
3744− if (drm_dp_clock_recovery_ok(link_status, intel_dp->lane_count)) {
3745− DRM_DEBUG_KMS("clock recovery OK\n");
3746− break;
3747− }
3748−
3749− /*
3750− * if we used previously trained voltage and pre-emphasis values
3751− * and we don't get clock recovery, reset link training values
3752− */
3753− if (intel_dp->train_set_valid) {
3754− DRM_DEBUG_KMS("clock recovery not ok, reset");
3755− /* clear the flag as we are not reusing train set */
3756− intel_dp->train_set_valid = false;
3757− if (!intel_dp_reset_link_train(intel_dp, &DP,
3758− DP_TRAINING_PATTERN_1 |
3759− DP_LINK_SCRAMBLING_DISABLE)) {
3760− DRM_ERROR("failed to enable link training\n");
3761− return;
3762− }
3763− continue;
3764− }
3765−
3766− /* Check to see if we've tried the max voltage */
3767− for (i = 0; i < intel_dp->lane_count; i++)
3768− if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0)
3769− break;
3770− if (i == intel_dp->lane_count) {
3771− ++loop_tries;
3772− if (loop_tries == 5) {
3773− DRM_ERROR("too many full retries, give up\n");
3774− break;
3775− }
3776− intel_dp_reset_link_train(intel_dp, &DP,
3777− DP_TRAINING_PATTERN_1 |
3778− DP_LINK_SCRAMBLING_DISABLE);
3779− voltage_tries = 0;
3780− continue;
3781− }
3782−
3783− /* Check to see if we've tried the same voltage 5 times */
3784− if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) {
3785− ++voltage_tries;
3786− if (voltage_tries == 5) {
3787− DRM_ERROR("too many voltage retries, give up\n");
3788− break;
3789− }
3790− } else
3791− voltage_tries = 0;
3792− voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
3793−
3794− /* Update training set as requested by target */
3795− if (!intel_dp_update_link_train(intel_dp, &DP, link_status)) {
3796− DRM_ERROR("failed to update link training\n");
3797− break;
3798− }
3799− }
3800−
3801− intel_dp->DP = DP;
3802−}
3803−
3804−static void
3805−intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp)
3806−{
3807− struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
3808− struct drm_device *dev = dig_port->base.base.dev;
3809− bool channel_eq = false;
3810− int tries, cr_tries;
3811− uint32_t DP = intel_dp->DP;
3812− uint32_t training_pattern = DP_TRAINING_PATTERN_2;
3813−
3814− /*
3815− * Training Pattern 3 for HBR2 or 1.2 devices that support it.
3816− *
3817− * Intel platforms that support HBR2 also support TPS3. TPS3 support is
3818− * also mandatory for downstream devices that support HBR2.
3819− *
3820− * Due to WaDisableHBR2 SKL < B0 is the only exception where TPS3 is
3821− * supported but still not enabled.
3822− */
3823− if (intel_dp_source_supports_hbr2(dev) &&
3824− drm_dp_tps3_supported(intel_dp->dpcd))
3825− training_pattern = DP_TRAINING_PATTERN_3;
3826− else if (intel_dp->link_rate == 540000)
3827− DRM_ERROR("5.4 Gbps link rate without HBR2/TPS3 support\n");
3828−
3829− /* channel equalization */
3830− if (!intel_dp_set_link_train(intel_dp, &DP,
3831− training_pattern |
3832− DP_LINK_SCRAMBLING_DISABLE)) {
3833− DRM_ERROR("failed to start channel equalization\n");
3834− return;
3835− }
3836−
3837− tries = 0;
3838− cr_tries = 0;
3839− channel_eq = false;
3840− for (;;) {
3841− uint8_t link_status[DP_LINK_STATUS_SIZE];
3842−
3843− if (cr_tries > 5) {
3844− DRM_ERROR("failed to train DP, aborting\n");
3845− break;
3846− }
3847−
3848− drm_dp_link_train_channel_eq_delay(intel_dp->dpcd);
3849− if (!intel_dp_get_link_status(intel_dp, link_status)) {
3850− DRM_ERROR("failed to get link status\n");
3851− break;
3852− }
3853−
3854− /* Make sure clock is still ok */
3855− if (!drm_dp_clock_recovery_ok(link_status,
3856− intel_dp->lane_count)) {
3857− intel_dp->train_set_valid = false;
3858− intel_dp_link_training_clock_recovery(intel_dp);
3859− intel_dp_set_link_train(intel_dp, &DP,
3860− training_pattern |
3861− DP_LINK_SCRAMBLING_DISABLE);
3862− cr_tries++;
3863− continue;
3864− }
3865−
3866− if (drm_dp_channel_eq_ok(link_status,
3867− intel_dp->lane_count)) {
3868− channel_eq = true;
3869− break;
3870− }
3871−
3872− /* Try 5 times, then try clock recovery if that fails */
3873− if (tries > 5) {
3874− intel_dp->train_set_valid = false;
3875− intel_dp_link_training_clock_recovery(intel_dp);
3876− intel_dp_set_link_train(intel_dp, &DP,
3877− training_pattern |
3878− DP_LINK_SCRAMBLING_DISABLE);
3879− tries = 0;
3880− cr_tries++;
3881− continue;
3882− }
3883−
3884− /* Update training set as requested by target */
3885− if (!intel_dp_update_link_train(intel_dp, &DP, link_status)) {
3886− DRM_ERROR("failed to update link training\n");
3887− break;
3888− }
3889− ++tries;
3890− }
3891−
3892− intel_dp_set_idle_link_train(intel_dp);
3893−
3894− intel_dp->DP = DP;
3895−
3896− if (channel_eq) {
3897− intel_dp->train_set_valid = true;
3898− DRM_DEBUG_KMS("Channel EQ done. DP Training successful\n");
3899− }
3900−}
3901−
3902−void intel_dp_stop_link_train(struct intel_dp *intel_dp)
3903−{
3904− intel_dp_set_link_train(intel_dp, &intel_dp->DP,
3905− DP_TRAINING_PATTERN_DISABLE);
3906−}
3907−
3908−void
3909−intel_dp_start_link_train(struct intel_dp *intel_dp)
3910−{
3911− intel_dp_link_training_clock_recovery(intel_dp);
3912− intel_dp_link_training_channel_equalization(intel_dp);
3913−}
3914−
39153750 static void
39163751 intel_dp_link_down(struct intel_dp *intel_dp)
39173752 {
@@ -3954,6 +3789,13 @@ intel_dp_link_down(struct intel_dp *intel_dp) · 36 unmodified lines
39543789 * matching HDMI port to be enabled on transcoder A.
39553790 */
39563791 if (HAS_PCH_IBX(dev) && crtc->pipe == PIPE_B && port != PORT_A) {
3792+ /*
3793+ * We get CPU/PCH FIFO underruns on the other pipe when
3794+ * doing the workaround. Sweep them under the rug.
3795+ */
3796+ intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, false);
3797+ intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, false);
3798+
39573799 /* always enable with pattern 1 (as per spec) */
39583800 DP &= ~(DP_PIPEB_SELECT | DP_LINK_TRAIN_MASK);
39593801 DP |= DP_PORT_EN | DP_LINK_TRAIN_PAT_1;
@@ -3963,9 +3805,15 @@ intel_dp_link_down(struct intel_dp *intel_dp) · 3 unmodified lines
39633805 DP &= ~DP_PORT_EN;
39643806 I915_WRITE(intel_dp->output_reg, DP);
39653807 POSTING_READ(intel_dp->output_reg);
3808+
3809+ intel_wait_for_vblank_if_active(dev_priv->dev, PIPE_A);
3810+ intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, true);
3811+ intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
39663812 }
39673813
39683814 msleep(intel_dp->panel_power_down_delay);
3815+
3816+ intel_dp->DP = DP;
39693817 }
39703818
39713819 static bool
@@ -4013,7 +3861,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) · 41 unmodified lines
40133861 }
40143862
40153863 DRM_DEBUG_KMS("Display Port TPS3 support: source %s, sink %s\n",
4016− yesno(intel_dp_source_supports_hbr2(dev)),
3864+ yesno(intel_dp_source_supports_hbr2(intel_dp)),
40173865 yesno(drm_dp_tps3_supported(intel_dp->dpcd)));
40183866
40193867 /* Intermediate frequency support */
@@ -4103,9 +3951,12 @@ intel_dp_probe_mst(struct intel_dp *intel_dp) · 83 unmodified lines
41033951 static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp)
41043952 {
41053953 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
3954+ struct drm_device *dev = dig_port->base.base.dev;
41063955 struct intel_crtc *intel_crtc = to_intel_crtc(dig_port->base.base.crtc);
41073956 u8 buf;
41083957 int ret = 0;
3958+ int count = 0;
3959+ int attempts = 10;
41093960
41103961 if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0) {
41113962 DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
@@ -4120,7 +3971,22 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp) · 8 unmodified lines
41203971 goto out;
41213972 }
41223973
4123− intel_dp->sink_crc.started = false;
3974+ do {
3975+ intel_wait_for_vblank(dev, intel_crtc->pipe);
3976+
3977+ if (drm_dp_dpcd_readb(&intel_dp->aux,
3978+ DP_TEST_SINK_MISC, &buf) < 0) {
3979+ ret = -EIO;
3980+ goto out;
3981+ }
3982+ count = buf & DP_TEST_COUNT_MASK;
3983+ } while (--attempts && count);
3984+
3985+ if (attempts == 0) {
3986+ DRM_ERROR("TIMEOUT: Sink CRC counter is not zeroed\n");
3987+ ret = -ETIMEDOUT;
3988+ }
3989+
41243990 out:
41253991 hsw_enable_ips(intel_crtc);
41263992 return ret;
@@ -4129,27 +3995,26 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp) · 2 unmodified lines
41293995 static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)
41303996 {
41313997 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
3998+ struct drm_device *dev = dig_port->base.base.dev;
41323999 struct intel_crtc *intel_crtc = to_intel_crtc(dig_port->base.base.crtc);
41334000 u8 buf;
41344001 int ret;
41354002
4136− if (intel_dp->sink_crc.started) {
4137− ret = intel_dp_sink_crc_stop(intel_dp);
4138− if (ret)
4139− return ret;
4140− }
4141−
41424003 if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf) < 0)
41434004 return -EIO;
41444005
41454006 if (!(buf & DP_TEST_CRC_SUPPORTED))
41464007 return -ENOTTY;
41474008
4148− intel_dp->sink_crc.last_count = buf & DP_TEST_COUNT_MASK;
4149−
41504009 if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0)
41514010 return -EIO;
41524011
4012+ if (buf & DP_TEST_SINK_START) {
4013+ ret = intel_dp_sink_crc_stop(intel_dp);
4014+ if (ret)
4015+ return ret;
4016+ }
4017+
41534018 hsw_disable_ips(intel_crtc);
41544019
41554020 if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
@@ -4158,7 +4023,7 @@ static int intel_dp_sink_crc_start(struct intel_dp *intel_dp) · 2 unmodified lines
41584023 return -EIO;
41594024 }
41604025
4161− intel_dp->sink_crc.started = true;
4026+ intel_wait_for_vblank(dev, intel_crtc->pipe);
41624027 return 0;
41634028 }
41644029
@@ -4170,7 +4035,6 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · 5 unmodified lines
41704035 u8 buf;
41714036 int count, ret;
41724037 int attempts = 6;
4173− bool old_equal_new;
41744038
41754039 ret = intel_dp_sink_crc_start(intel_dp);
41764040 if (ret)
@@ -4186,35 +4050,17 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · 9 unmodified lines
41864050 }
41874051 count = buf & DP_TEST_COUNT_MASK;
41884052
4189− /*
4190− * Count might be reset during the loop. In this case
4191− * last known count needs to be reset as well.
4192− */
4193− if (count == 0)
4194− intel_dp->sink_crc.last_count = 0;
4195−
4196− if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) < 0) {
4197− ret = -EIO;
4198− goto stop;
4199− }
4200−
4201− old_equal_new = (count == intel_dp->sink_crc.last_count &&
4202− !memcmp(intel_dp->sink_crc.last_crc, crc,
4203− 6 * sizeof(u8)));
4204−
4205− } while (--attempts && (count == 0 || old_equal_new));
4206−
4207− intel_dp->sink_crc.last_count = buf & DP_TEST_COUNT_MASK;
4208− memcpy(intel_dp->sink_crc.last_crc, crc, 6 * sizeof(u8));
4053+ } while (--attempts && count == 0);
42094054
42104055 if (attempts == 0) {
4211− if (old_equal_new) {
4212− DRM_DEBUG_KMS("Unreliable Sink CRC counter: Current returned CRC is identical to the previous one\n");
4213− } else {
4214− DRM_ERROR("Panel is unable to calculate any CRC after 6 vblanks\n");
4215− ret = -ETIMEDOUT;
4216− goto stop;
4217− }
4056+ DRM_ERROR("Panel is unable to calculate any CRC after 6 vblanks\n");
4057+ ret = -ETIMEDOUT;
4058+ goto stop;
4059+ }
4060+
4061+ if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) < 0) {
4062+ ret = -EIO;
4063+ goto stop;
42184064 }
42194065
42204066 stop:
@@ -4314,13 +4160,6 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · 93 unmodified lines
43144160 uint8_t rxdata = 0;
43154161 int status = 0;
43164162
4317− intel_dp->compliance_test_active = 0;
4318− intel_dp->compliance_test_type = 0;
4319− intel_dp->compliance_test_data = 0;
4320−
4321− intel_dp->aux.i2c_nack_count = 0;
4322− intel_dp->aux.i2c_defer_count = 0;
4323−
43244163 status = drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_REQUEST, &rxdata, 1);
43254164 if (status <= 0) {
43264165 DRM_DEBUG_KMS("Could not read test request from sink\n");
@@ -4436,6 +4275,14 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) · 109 unmodified lines
44364275
44374276 WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
44384277
4278+ /*
4279+ * Clearing compliance test variables to allow capturing
4280+ * of values for next automated test request.
4281+ */
4282+ intel_dp->compliance_test_active = 0;
4283+ intel_dp->compliance_test_type = 0;
4284+ intel_dp->compliance_test_data = 0;
4285+
44394286 if (!intel_encoder->base.crtc)
44404287 return;
44414288
@@ -4466,7 +4313,9 @@ intel_dp_check_link_status(struct intel_dp *intel_dp) · 24 unmodified lines
44664313 DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n");
44674314 }
44684315
4469− if (!drm_dp_channel_eq_ok(link_status, intel_dp->lane_count)) {
4316+ /* if link training is requested we should perform it always */
4317+ if ((intel_dp->compliance_test_type == DP_TEST_LINK_TRAINING) ||
4318+ (!drm_dp_channel_eq_ok(link_status, intel_dp->lane_count))) {
44704319 DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n",
44714320 intel_encoder->base.name);
44724321 intel_dp_start_link_train(intel_dp);
@@ -4684,41 +4533,6 @@ bool intel_digital_port_connected(struct drm_i915_private *dev_priv, · 211 unmodified lines
46844533 return g4x_digital_port_connected(dev_priv, port);
46854534 }
46864535
4687−static enum drm_connector_status
4688−ironlake_dp_detect(struct intel_dp *intel_dp)
4689−{
4690− struct drm_device *dev = intel_dp_to_dev(intel_dp);
4691− struct drm_i915_private *dev_priv = dev->dev_private;
4692− struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
4693−
4694− if (!intel_digital_port_connected(dev_priv, intel_dig_port))
4695− return connector_status_disconnected;
4696−
4697− return intel_dp_detect_dpcd(intel_dp);
4698−}
4699−
4700−static enum drm_connector_status
4701−g4x_dp_detect(struct intel_dp *intel_dp)
4702−{
4703− struct drm_device *dev = intel_dp_to_dev(intel_dp);
4704− struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
4705−
4706− /* Can't disconnect eDP, but you can close the lid... */
4707− if (is_edp(intel_dp)) {
4708− enum drm_connector_status status;
4709−
4710− status = intel_panel_detect(dev);
4711− if (status == connector_status_unknown)
4712− status = connector_status_connected;
4713− return status;
4714− }
4715−
4716− if (!intel_digital_port_connected(dev->dev_private, intel_dig_port))
4717− return connector_status_disconnected;
4718−
4719− return intel_dp_detect_dpcd(intel_dp);
4720−}
4721−
47224536 static struct edid *
47234537 intel_dp_get_edid(struct intel_dp *intel_dp)
47244538 {
@@ -4791,12 +4605,19 @@ intel_dp_detect(struct drm_connector *connector, bool force) · 66 unmodified lines
47914605 /* Can't disconnect eDP, but you can close the lid... */
47924606 if (is_edp(intel_dp))
47934607 status = edp_detect(intel_dp);
4794− else if (HAS_PCH_SPLIT(dev))
4795− status = ironlake_dp_detect(intel_dp);
4608+ else if (intel_digital_port_connected(to_i915(dev),
4609+ dp_to_dig_port(intel_dp)))
4610+ status = intel_dp_detect_dpcd(intel_dp);
47964611 else
4797− status = g4x_dp_detect(intel_dp);
4798− if (status != connector_status_connected)
4612+ status = connector_status_disconnected;
4613+
4614+ if (status != connector_status_connected) {
4615+ intel_dp->compliance_test_active = 0;
4616+ intel_dp->compliance_test_type = 0;
4617+ intel_dp->compliance_test_data = 0;
4618+
47994619 goto out;
4620+ }
48004621
48014622 intel_dp_probe_oui(intel_dp);
48024623
@@ -4810,6 +4631,14 @@ intel_dp_detect(struct drm_connector *connector, bool force) · 7 unmodified lines
48104631 goto out;
48114632 }
48124633
4634+ /*
4635+ * Clearing NACK and defer counts to get their exact values
4636+ * while reading EDID which are required by Compliance tests
4637+ * 4.2.2.4 and 4.2.2.5
4638+ */
4639+ intel_dp->aux.i2c_nack_count = 0;
4640+ intel_dp->aux.i2c_defer_count = 0;
4641+
48134642 intel_dp_set_edid(intel_dp);
48144643
48154644 if (intel_encoder->type != INTEL_OUTPUT_EDP)
@@ -5014,7 +4843,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) · 198 unmodified lines
50144843 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
50154844 struct intel_dp *intel_dp = &intel_dig_port->dp;
50164845
5017− drm_dp_aux_unregister(&intel_dp->aux);
4846+ intel_dp_aux_fini(intel_dp);
50184847 intel_dp_mst_encoder_cleanup(intel_dig_port);
50194848 if (is_edp(intel_dp)) {
50204849 cancel_delayed_work_sync(&intel_dp->panel_vdd_work);
@@ -5204,25 +5033,6 @@ put_power: · 183 unmodified lines
52045033 return ret;
52055034 }
52065035
5207−/* Return which DP Port should be selected for Transcoder DP control */
5208−int
5209−intel_trans_dp_port_sel(struct drm_crtc *crtc)
5210−{
5211− struct drm_device *dev = crtc->dev;
5212− struct intel_encoder *intel_encoder;
5213− struct intel_dp *intel_dp;
5214−
5215− for_each_encoder_on_crtc(dev, crtc, intel_encoder) {
5216− intel_dp = enc_to_intel_dp(&intel_encoder->base);
5217−
5218− if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
5219− intel_encoder->type == INTEL_OUTPUT_EDP)
5220− return intel_dp->output_reg;
5221− }
5222−
5223− return -1;
5224−}
5225−
52265036 /* check the VBT to see whether the eDP is on another port */
52275037 bool intel_dp_is_edp(struct drm_device *dev, enum port port)
52285038 {
@@ -5294,7 +5104,7 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev, · 65 unmodified lines
52945104 struct edp_power_seq cur, vbt, spec,
52955105 *final = &intel_dp->pps_delays;
52965106 u32 pp_on, pp_off, pp_div = 0, pp_ctl = 0;
5297− int pp_ctrl_reg, pp_on_reg, pp_off_reg, pp_div_reg = 0;
5107+ i915_reg_t pp_ctrl_reg, pp_on_reg, pp_off_reg, pp_div_reg;
52985108
52995109 lockdep_assert_held(&dev_priv->pps_mutex);
53005110
@@ -5416,7 +5226,7 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, · 115 unmodified lines
54165226 struct drm_i915_private *dev_priv = dev->dev_private;
54175227 u32 pp_on, pp_off, pp_div, port_sel = 0;
54185228 int div = HAS_PCH_SPLIT(dev) ? intel_pch_rawclk(dev) : intel_hrawclk(dev);
5419− int pp_on_reg, pp_off_reg, pp_div_reg = 0, pp_ctrl_reg;
5229+ i915_reg_t pp_on_reg, pp_off_reg, pp_div_reg, pp_ctrl_reg;
54205230 enum port port = dp_to_dig_port(intel_dp)->port;
54215231 const struct edp_power_seq *seq = &intel_dp->pps_delays;
54225232
@@ -5578,7 +5388,7 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate) · 155 unmodified lines
55785388 DRM_ERROR("Unsupported refreshrate type\n");
55795389 }
55805390 } else if (INTEL_INFO(dev)->gen > 6) {
5581− u32 reg = PIPECONF(intel_crtc->config->cpu_transcoder);
5391+ i915_reg_t reg = PIPECONF(intel_crtc->config->cpu_transcoder);
55825392 u32 val;
55835393
55845394 val = I915_READ(reg);
@@ -5996,7 +5806,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · 411 unmodified lines
59965806 struct drm_device *dev = intel_encoder->base.dev;
59975807 struct drm_i915_private *dev_priv = dev->dev_private;
59985808 enum port port = intel_dig_port->port;
5999− int type;
5809+ int type, ret;
60005810
60015811 intel_dp->pps_pipe = INVALID_PIPE;
60025812
@@ -6017,6 +5827,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · 14 unmodified lines
60175827 else
60185828 intel_dp->get_aux_send_ctl = i9xx_get_aux_send_ctl;
60195829
5830+ if (HAS_DDI(dev))
5831+ intel_dp->prepare_link_retrain = intel_ddi_prepare_link_retrain;
5832+
60205833 /* Preserve the current hw state. */
60215834 intel_dp->DP = I915_READ(intel_dp->output_reg);
60225835 intel_dp->attached_connector = intel_connector;
@@ -6068,7 +5881,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · 45 unmodified lines
60685881 break;
60695882 case PORT_B:
60705883 intel_encoder->hpd_pin = HPD_PORT_B;
6071− if (IS_BROXTON(dev_priv) && (INTEL_REVID(dev) < BXT_REVID_B0))
5884+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1))
60725885 intel_encoder->hpd_pin = HPD_PORT_A;
60735886 break;
60745887 case PORT_C:
@@ -6094,7 +5907,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · 19 unmodified lines
60945907 pps_unlock(intel_dp);
60955908 }
60965909
6097− intel_dp_aux_init(intel_dp, intel_connector);
5910+ ret = intel_dp_aux_init(intel_dp, intel_connector);
5911+ if (ret)
5912+ goto fail;
60985913
60995914 /* init MST on ports that can support it */
61005915 if (HAS_DP_MST(dev) &&
@@ -6103,20 +5918,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · 2 unmodified lines
61035918 intel_connector->base.base.id);
61045919
61055920 if (!intel_edp_init_connector(intel_dp, intel_connector)) {
6106− drm_dp_aux_unregister(&intel_dp->aux);
6107− if (is_edp(intel_dp)) {
6108− cancel_delayed_work_sync(&intel_dp->panel_vdd_work);
6109− /*
6110− * vdd might still be enabled do to the delayed vdd off.
6111− * Make sure vdd is actually turned off here.
6112− */
6113− pps_lock(intel_dp);
6114− edp_panel_vdd_off_sync(intel_dp);
6115− pps_unlock(intel_dp);
6116− }
6117− drm_connector_unregister(connector);
6118− drm_connector_cleanup(connector);
6119− return false;
5921+ intel_dp_aux_fini(intel_dp);
5922+ intel_dp_mst_encoder_cleanup(intel_dig_port);
5923+ goto fail;
61205924 }
61215925
61225926 intel_dp_add_properties(intel_dp, connector);
@@ -6133,10 +5937,27 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, · 10 unmodified lines
61335937 i915_debugfs_connector_add(connector);
61345938
61355939 return true;
5940+
5941+fail:
5942+ if (is_edp(intel_dp)) {
5943+ cancel_delayed_work_sync(&intel_dp->panel_vdd_work);
5944+ /*
5945+ * vdd might still be enabled do to the delayed vdd off.
5946+ * Make sure vdd is actually turned off here.
5947+ */
5948+ pps_lock(intel_dp);
5949+ edp_panel_vdd_off_sync(intel_dp);
5950+ pps_unlock(intel_dp);
5951+ }
5952+ drm_connector_unregister(connector);
5953+ drm_connector_cleanup(connector);
5954+
5955+ return false;
61365956 }
61375957
61385958 void
6139−intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
5959+intel_dp_init(struct drm_device *dev,
5960+ i915_reg_t output_reg, enum port port)
61405961 {
61415962 struct drm_i915_private *dev_priv = dev->dev_private;
61425963 struct intel_digital_port *intel_dig_port;
@@ -6182,6 +6003,7 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port) · 39 unmodified lines
61826003 }
61836004
61846005 intel_dig_port->port = port;
6006+ dev_priv->dig_port_map[port] = intel_encoder;
61856007 intel_dig_port->dp.output_reg = output_reg;
61866008
61876009 intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
drivers/gpu/drm/i915/intel_dp_link_training.c+323−0
@@ -0,0 +1,323 @@
1+/*
2+ * Copyright © 2008-2015 Intel Corporation
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice (including the next
12+ * paragraph) shall be included in all copies or substantial portions of the
13+ * Software.
14+ *
15+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21+ * IN THE SOFTWARE.
22+ */
23+
24+#include "intel_drv.h"
25+
26+static void
27+intel_get_adjust_train(struct intel_dp *intel_dp,
28+ const uint8_t link_status[DP_LINK_STATUS_SIZE])
29+{
30+ uint8_t v = 0;
31+ uint8_t p = 0;
32+ int lane;
33+ uint8_t voltage_max;
34+ uint8_t preemph_max;
35+
36+ for (lane = 0; lane < intel_dp->lane_count; lane++) {
37+ uint8_t this_v = drm_dp_get_adjust_request_voltage(link_status, lane);
38+ uint8_t this_p = drm_dp_get_adjust_request_pre_emphasis(link_status, lane);
39+
40+ if (this_v > v)
41+ v = this_v;
42+ if (this_p > p)
43+ p = this_p;
44+ }
45+
46+ voltage_max = intel_dp_voltage_max(intel_dp);
47+ if (v >= voltage_max)
48+ v = voltage_max | DP_TRAIN_MAX_SWING_REACHED;
49+
50+ preemph_max = intel_dp_pre_emphasis_max(intel_dp, v);
51+ if (p >= preemph_max)
52+ p = preemph_max | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED;
53+
54+ for (lane = 0; lane < 4; lane++)
55+ intel_dp->train_set[lane] = v | p;
56+}
57+
58+static bool
59+intel_dp_set_link_train(struct intel_dp *intel_dp,
60+ uint8_t dp_train_pat)
61+{
62+ uint8_t buf[sizeof(intel_dp->train_set) + 1];
63+ int ret, len;
64+
65+ intel_dp_program_link_training_pattern(intel_dp, dp_train_pat);
66+
67+ buf[0] = dp_train_pat;
68+ if ((dp_train_pat & DP_TRAINING_PATTERN_MASK) ==
69+ DP_TRAINING_PATTERN_DISABLE) {
70+ /* don't write DP_TRAINING_LANEx_SET on disable */
71+ len = 1;
72+ } else {
73+ /* DP_TRAINING_LANEx_SET follow DP_TRAINING_PATTERN_SET */
74+ memcpy(buf + 1, intel_dp->train_set, intel_dp->lane_count);
75+ len = intel_dp->lane_count + 1;
76+ }
77+
78+ ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_PATTERN_SET,
79+ buf, len);
80+
81+ return ret == len;
82+}
83+
84+static bool
85+intel_dp_reset_link_train(struct intel_dp *intel_dp,
86+ uint8_t dp_train_pat)
87+{
88+ if (!intel_dp->train_set_valid)
89+ memset(intel_dp->train_set, 0, sizeof(intel_dp->train_set));
90+ intel_dp_set_signal_levels(intel_dp);
91+ return intel_dp_set_link_train(intel_dp, dp_train_pat);
92+}
93+
94+static bool
95+intel_dp_update_link_train(struct intel_dp *intel_dp)
96+{
97+ int ret;
98+
99+ intel_dp_set_signal_levels(intel_dp);
100+
101+ ret = drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_LANE0_SET,
102+ intel_dp->train_set, intel_dp->lane_count);
103+
104+ return ret == intel_dp->lane_count;
105+}
106+
107+/* Enable corresponding port and start training pattern 1 */
108+static void
109+intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
110+{
111+ int i;
112+ uint8_t voltage;
113+ int voltage_tries, loop_tries;
114+ uint8_t link_config[2];
115+ uint8_t link_bw, rate_select;
116+
117+ if (intel_dp->prepare_link_retrain)
118+ intel_dp->prepare_link_retrain(intel_dp);
119+
120+ intel_dp_compute_rate(intel_dp, intel_dp->link_rate,
121+ &link_bw, &rate_select);
122+
123+ /* Write the link configuration data */
124+ link_config[0] = link_bw;
125+ link_config[1] = intel_dp->lane_count;
126+ if (drm_dp_enhanced_frame_cap(intel_dp->dpcd))
127+ link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
128+ drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_BW_SET, link_config, 2);
129+ if (intel_dp->num_sink_rates)
130+ drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_RATE_SET,
131+ &rate_select, 1);
132+
133+ link_config[0] = 0;
134+ link_config[1] = DP_SET_ANSI_8B10B;
135+ drm_dp_dpcd_write(&intel_dp->aux, DP_DOWNSPREAD_CTRL, link_config, 2);
136+
137+ intel_dp->DP |= DP_PORT_EN;
138+
139+ /* clock recovery */
140+ if (!intel_dp_reset_link_train(intel_dp,
141+ DP_TRAINING_PATTERN_1 |
142+ DP_LINK_SCRAMBLING_DISABLE)) {
143+ DRM_ERROR("failed to enable link training\n");
144+ return;
145+ }
146+
147+ voltage = 0xff;
148+ voltage_tries = 0;
149+ loop_tries = 0;
150+ for (;;) {
151+ uint8_t link_status[DP_LINK_STATUS_SIZE];
152+
153+ drm_dp_link_train_clock_recovery_delay(intel_dp->dpcd);
154+ if (!intel_dp_get_link_status(intel_dp, link_status)) {
155+ DRM_ERROR("failed to get link status\n");
156+ break;
157+ }
158+
159+ if (drm_dp_clock_recovery_ok(link_status, intel_dp->lane_count)) {
160+ DRM_DEBUG_KMS("clock recovery OK\n");
161+ break;
162+ }
163+
164+ /*
165+ * if we used previously trained voltage and pre-emphasis values
166+ * and we don't get clock recovery, reset link training values
167+ */
168+ if (intel_dp->train_set_valid) {
169+ DRM_DEBUG_KMS("clock recovery not ok, reset");
170+ /* clear the flag as we are not reusing train set */
171+ intel_dp->train_set_valid = false;
172+ if (!intel_dp_reset_link_train(intel_dp,
173+ DP_TRAINING_PATTERN_1 |
174+ DP_LINK_SCRAMBLING_DISABLE)) {
175+ DRM_ERROR("failed to enable link training\n");
176+ return;
177+ }
178+ continue;
179+ }
180+
181+ /* Check to see if we've tried the max voltage */
182+ for (i = 0; i < intel_dp->lane_count; i++)
183+ if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0)
184+ break;
185+ if (i == intel_dp->lane_count) {
186+ ++loop_tries;
187+ if (loop_tries == 5) {
188+ DRM_ERROR("too many full retries, give up\n");
189+ break;
190+ }
191+ intel_dp_reset_link_train(intel_dp,
192+ DP_TRAINING_PATTERN_1 |
193+ DP_LINK_SCRAMBLING_DISABLE);
194+ voltage_tries = 0;
195+ continue;
196+ }
197+
198+ /* Check to see if we've tried the same voltage 5 times */
199+ if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) {
200+ ++voltage_tries;
201+ if (voltage_tries == 5) {
202+ DRM_ERROR("too many voltage retries, give up\n");
203+ break;
204+ }
205+ } else
206+ voltage_tries = 0;
207+ voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
208+
209+ /* Update training set as requested by target */
210+ intel_get_adjust_train(intel_dp, link_status);
211+ if (!intel_dp_update_link_train(intel_dp)) {
212+ DRM_ERROR("failed to update link training\n");
213+ break;
214+ }
215+ }
216+}
217+
218+static void
219+intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp)
220+{
221+ bool channel_eq = false;
222+ int tries, cr_tries;
223+ uint32_t training_pattern = DP_TRAINING_PATTERN_2;
224+
225+ /*
226+ * Training Pattern 3 for HBR2 or 1.2 devices that support it.
227+ *
228+ * Intel platforms that support HBR2 also support TPS3. TPS3 support is
229+ * also mandatory for downstream devices that support HBR2.
230+ *
231+ * Due to WaDisableHBR2 SKL < B0 is the only exception where TPS3 is
232+ * supported but still not enabled.
233+ */
234+ if (intel_dp_source_supports_hbr2(intel_dp) &&
235+ drm_dp_tps3_supported(intel_dp->dpcd))
236+ training_pattern = DP_TRAINING_PATTERN_3;
237+ else if (intel_dp->link_rate == 540000)
238+ DRM_ERROR("5.4 Gbps link rate without HBR2/TPS3 support\n");
239+
240+ /* channel equalization */
241+ if (!intel_dp_set_link_train(intel_dp,
242+ training_pattern |
243+ DP_LINK_SCRAMBLING_DISABLE)) {
244+ DRM_ERROR("failed to start channel equalization\n");
245+ return;
246+ }
247+
248+ tries = 0;
249+ cr_tries = 0;
250+ channel_eq = false;
251+ for (;;) {
252+ uint8_t link_status[DP_LINK_STATUS_SIZE];
253+
254+ if (cr_tries > 5) {
255+ DRM_ERROR("failed to train DP, aborting\n");
256+ break;
257+ }
258+
259+ drm_dp_link_train_channel_eq_delay(intel_dp->dpcd);
260+ if (!intel_dp_get_link_status(intel_dp, link_status)) {
261+ DRM_ERROR("failed to get link status\n");
262+ break;
263+ }
264+
265+ /* Make sure clock is still ok */
266+ if (!drm_dp_clock_recovery_ok(link_status,
267+ intel_dp->lane_count)) {
268+ intel_dp->train_set_valid = false;
269+ intel_dp_link_training_clock_recovery(intel_dp);
270+ intel_dp_set_link_train(intel_dp,
271+ training_pattern |
272+ DP_LINK_SCRAMBLING_DISABLE);
273+ cr_tries++;
274+ continue;
275+ }
276+
277+ if (drm_dp_channel_eq_ok(link_status,
278+ intel_dp->lane_count)) {
279+ channel_eq = true;
280+ break;
281+ }
282+
283+ /* Try 5 times, then try clock recovery if that fails */
284+ if (tries > 5) {
285+ intel_dp->train_set_valid = false;
286+ intel_dp_link_training_clock_recovery(intel_dp);
287+ intel_dp_set_link_train(intel_dp,
288+ training_pattern |
289+ DP_LINK_SCRAMBLING_DISABLE);
290+ tries = 0;
291+ cr_tries++;
292+ continue;
293+ }
294+
295+ /* Update training set as requested by target */
296+ intel_get_adjust_train(intel_dp, link_status);
297+ if (!intel_dp_update_link_train(intel_dp)) {
298+ DRM_ERROR("failed to update link training\n");
299+ break;
300+ }
301+ ++tries;
302+ }
303+
304+ intel_dp_set_idle_link_train(intel_dp);
305+
306+ if (channel_eq) {
307+ intel_dp->train_set_valid = true;
308+ DRM_DEBUG_KMS("Channel EQ done. DP Training successful\n");
309+ }
310+}
311+
312+void intel_dp_stop_link_train(struct intel_dp *intel_dp)
313+{
314+ intel_dp_set_link_train(intel_dp,
315+ DP_TRAINING_PATTERN_DISABLE);
316+}
317+
318+void
319+intel_dp_start_link_train(struct intel_dp *intel_dp)
320+{
321+ intel_dp_link_training_clock_recovery(intel_dp);
322+ intel_dp_link_training_channel_equalization(intel_dp);
323+}
drivers/gpu/drm/i915/intel_dp_mst.c+9−9
@@ -173,20 +173,14 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder) · 172 unmodified lines
173173 intel_mst->port = found->port;
174174
175175 if (intel_dp->active_mst_links == 0) {
176− enum port port = intel_ddi_get_encoder_port(encoder);
176+ intel_ddi_clk_select(encoder, intel_crtc->config);
177177
178178 intel_dp_set_link_params(intel_dp, intel_crtc->config);
179179
180− /* FIXME: add support for SKL */
181− if (INTEL_INFO(dev)->gen < 9)
182− I915_WRITE(PORT_CLK_SEL(port),
183− intel_crtc->config->ddi_pll_sel);
184−
185180 intel_ddi_init_dp_buf_reg(&intel_dig_port->base);
186181
187182 intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
188183
189−
190184 intel_dp_start_link_train(intel_dp);
191185 intel_dp_stop_link_train(intel_dp);
192186 }
@@ -414,7 +408,10 @@ static void intel_connector_add_to_fbdev(struct intel_connector *connector) · 221 unmodified lines
414408 {
415409 #ifdef CONFIG_DRM_FBDEV_EMULATION
416410 struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
417− drm_fb_helper_add_one_connector(&dev_priv->fbdev->helper, &connector->base);
411+
412+ if (dev_priv->fbdev)
413+ drm_fb_helper_add_one_connector(&dev_priv->fbdev->helper,
414+ &connector->base);
418415 #endif
419416 }
420417
@@ -422,7 +419,10 @@ static void intel_connector_remove_from_fbdev(struct intel_connector *connector) · 1 unmodified line
422419 {
423420 #ifdef CONFIG_DRM_FBDEV_EMULATION
424421 struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
425− drm_fb_helper_remove_one_connector(&dev_priv->fbdev->helper, &connector->base);
422+
423+ if (dev_priv->fbdev)
424+ drm_fb_helper_remove_one_connector(&dev_priv->fbdev->helper,
425+ &connector->base);
426426 #endif
427427 }
428428
drivers/gpu/drm/i915/intel_drv.h+98−61
@@ -123,8 +123,6 @@ struct intel_framebuffer { · 122 unmodified lines
123123 struct intel_fbdev {
124124 struct drm_fb_helper helper;
125125 struct intel_framebuffer *fb;
126− struct list_head fbdev_list;
127− struct drm_display_mode *our_mode;
128126 int preferred_bpp;
129127 };
130128
@@ -250,6 +248,7 @@ struct intel_atomic_state { · 119 unmodified lines
250248 unsigned int cdclk;
251249 bool dpll_set;
252250 struct intel_shared_dpll_config shared_dpll[I915_NUM_PLLS];
251+ struct intel_wm_config wm_config;
253252 };
254253
255254 struct intel_plane_state {
@@ -280,6 +279,9 @@ struct intel_plane_state { · 24 unmodified lines
280279 int scaler_id;
281280
282281 struct drm_intel_sprite_colorkey ckey;
282+
283+ /* async flip related structures */
284+ struct drm_i915_gem_request *wait_req;
283285 };
284286
285287 struct intel_initial_plane_config {
@@ -334,6 +336,21 @@ struct intel_crtc_scaler_state { · 48 unmodified lines
334336 /* drm_mode->private_flags */
335337 #define I915_MODE_FLAG_INHERITED 1
336338
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+
348+struct skl_pipe_wm {
349+ struct skl_wm_level wm[8];
350+ struct skl_wm_level trans_wm;
351+ uint32_t linetime;
352+};
353+
337354 struct intel_crtc_state {
338355 struct drm_crtc_state base;
339356
@@ -468,6 +485,20 @@ struct intel_crtc_state { · 128 unmodified lines
468485
469486 /* w/a for waiting 2 vblanks during crtc enable */
470487 enum pipe hsw_workaround_pipe;
488+
489+ /* IVB sprite scaling w/a (WaCxSRDisabledForSpriteScaling:ivb) */
490+ bool disable_lp_wm;
491+
492+ struct {
493+ /*
494+ * optimal watermarks, programmed post-vblank when this state
495+ * is committed
496+ */
497+ union {
498+ struct intel_pipe_wm ilk;
499+ struct skl_pipe_wm skl;
500+ } optimal;
501+ } wm;
471502 };
472503
473504 struct vlv_wm_state {
@@ -479,26 +510,12 @@ struct vlv_wm_state { · 5 unmodified lines
479510 bool cxsr;
480511 };
481512
482−struct intel_pipe_wm {
483− struct intel_wm_level wm[5];
484− uint32_t linetime;
485− bool fbc_wm_enabled;
486− bool pipe_enabled;
487− bool sprites_enabled;
488− bool sprites_scaled;
489−};
490−
491513 struct intel_mmio_flip {
492514 struct work_struct work;
493515 struct drm_i915_private *i915;
494516 struct drm_i915_gem_request *req;
495517 struct intel_crtc *crtc;
496−};
497−
498−struct skl_pipe_wm {
499− struct skl_wm_level wm[8];
500− struct skl_wm_level trans_wm;
501− uint32_t linetime;
518+ unsigned int rotation;
502519 };
503520
504521 /*
@@ -509,13 +526,11 @@ struct skl_pipe_wm { · 4 unmodified lines
509526 */
510527 struct intel_crtc_atomic_commit {
511528 /* Sleepable operations to perform before commit */
512− bool wait_for_flips;
513529 bool disable_fbc;
514530 bool disable_ips;
515531 bool disable_cxsr;
516532 bool pre_disable_primary;
517533 bool update_wm_pre, update_wm_post;
518− unsigned disabled_planes;
519534
520535 /* Sleepable operations to perform after commit */
521536 unsigned fb_bits;
@@ -567,9 +582,10 @@ struct intel_crtc { · 45 unmodified lines
567582 /* per-pipe watermark state */
568583 struct {
569584 /* watermarks currently being used */
570− struct intel_pipe_wm active;
571− /* SKL wm values currently in use */
572− struct skl_pipe_wm skl_active;
585+ union {
586+ struct intel_pipe_wm ilk;
587+ struct skl_pipe_wm skl;
588+ } active;
573589 /* allow CxSR on this pipe */
574590 bool cxsr_allowed;
575591 } wm;
@@ -677,7 +693,7 @@ struct cxsr_latency { · 101 unmodified lines
677693 #define intel_fb_obj(x) (x ? to_intel_framebuffer(x)->obj : NULL)
678694
679695 struct intel_hdmi {
680− u32 hdmi_reg;
696+ i915_reg_t hdmi_reg;
681697 int ddc_bus;
682698 bool limited_color_range;
683699 bool color_range_auto;
@@ -719,15 +735,10 @@ enum link_m_n_set { · 35 unmodified lines
719735 M2_N2
720736 };
721737
722−struct sink_crc {
723− bool started;
724− u8 last_crc[6];
725− int last_count;
726−};
727−
728738 struct intel_dp {
729− uint32_t output_reg;
730− uint32_t aux_ch_ctl_reg;
739+ i915_reg_t output_reg;
740+ i915_reg_t aux_ch_ctl_reg;
741+ i915_reg_t aux_ch_data_reg[5];
731742 uint32_t DP;
732743 int link_rate;
733744 uint8_t lane_count;
@@ -741,7 +752,6 @@ struct intel_dp { · 7 unmodified lines
741752 /* sink rates as reported by DP_SUPPORTED_LINK_RATES */
742753 uint8_t num_sink_rates;
743754 int sink_rates[DP_MAX_SUPPORTED_RATES];
744− struct sink_crc sink_crc;
745755 struct drm_dp_aux aux;
746756 uint8_t train_set[4];
747757 int panel_power_up_delay;
@@ -783,6 +793,10 @@ struct intel_dp { · 35 unmodified lines
783793 bool has_aux_irq,
784794 int send_bytes,
785795 uint32_t aux_clock_divider);
796+
797+ /* This is called before a link training is starterd */
798+ void (*prepare_link_retrain)(struct intel_dp *intel_dp);
799+
786800 bool train_set_valid;
787801
788802 /* Displayport compliance testing */
@@ -799,6 +813,8 @@ struct intel_digital_port { · 10 unmodified lines
799813 struct intel_hdmi hdmi;
800814 enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
801815 bool release_cl2_override;
816+ /* for communication with audio component; protected by av_mutex */
817+ const struct drm_connector *audio_connector;
802818 };
803819
804820 struct intel_dp_mst_encoder {
@@ -942,7 +958,8 @@ void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, · 137 unmodified lines
942958 enum pipe pipe);
943959 void intel_pch_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
944960 enum transcoder pch_transcoder);
945−void i9xx_check_fifo_underruns(struct drm_i915_private *dev_priv);
961+void intel_check_cpu_fifo_underruns(struct drm_i915_private *dev_priv);
962+void intel_check_pch_fifo_underruns(struct drm_i915_private *dev_priv);
946963
947964 /* i915_irq.c */
948965 void gen5_enable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask);
@@ -973,6 +990,8 @@ void intel_crt_init(struct drm_device *dev); · 24 unmodified lines
973990
974991
975992 /* intel_ddi.c */
993+void intel_ddi_clk_select(struct intel_encoder *encoder,
994+ const struct intel_crtc_state *pipe_config);
976995 void intel_prepare_ddi(struct drm_device *dev);
977996 void hsw_fdi_link_train(struct drm_crtc *crtc);
978997 void intel_ddi_init(struct drm_device *dev, enum port port);
@@ -987,7 +1006,7 @@ void intel_ddi_disable_pipe_clock(struct intel_crtc *intel_crtc); · 8 unmodified lines
9871006 bool intel_ddi_pll_select(struct intel_crtc *crtc,
9881007 struct intel_crtc_state *crtc_state);
9891008 void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
990−void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder);
1009+void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);
9911010 bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
9921011 void intel_ddi_fdi_disable(struct drm_crtc *crtc);
9931012 void intel_ddi_get_config(struct intel_encoder *encoder,
@@ -1055,6 +1074,15 @@ intel_wait_for_vblank(struct drm_device *dev, int pipe) · 61 unmodified lines
10551074 {
10561075 drm_wait_one_vblank(dev, pipe);
10571076 }
1077+static inline void
1078+intel_wait_for_vblank_if_active(struct drm_device *dev, int pipe)
1079+{
1080+ const struct intel_crtc *crtc =
1081+ to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe));
1082+
1083+ if (crtc->active)
1084+ intel_wait_for_vblank(dev, pipe);
1085+}
10581086 int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
10591087 void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
10601088 struct intel_digital_port *dport,
@@ -1068,9 +1096,7 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, · 7 unmodified lines
10681096 struct drm_modeset_acquire_ctx *ctx);
10691097 int intel_pin_and_fence_fb_obj(struct drm_plane *plane,
10701098 struct drm_framebuffer *fb,
1071− const struct drm_plane_state *plane_state,
1072− struct intel_engine_cs *pipelined,
1073− struct drm_i915_gem_request **pipelined_request);
1099+ const struct drm_plane_state *plane_state);
10741100 struct drm_framebuffer *
10751101 __intel_framebuffer_create(struct drm_device *dev,
10761102 struct drm_mode_fb_cmd2 *mode_cmd,
@@ -1151,7 +1177,10 @@ void broxton_ddi_phy_uninit(struct drm_device *dev); · 74 unmodified lines
11511177 void bxt_enable_dc9(struct drm_i915_private *dev_priv);
11521178 void bxt_disable_dc9(struct drm_i915_private *dev_priv);
11531179 void skl_init_cdclk(struct drm_i915_private *dev_priv);
1180+int skl_sanitize_cdclk(struct drm_i915_private *dev_priv);
11541181 void skl_uninit_cdclk(struct drm_i915_private *dev_priv);
1182+void skl_enable_dc6(struct drm_i915_private *dev_priv);
1183+void skl_disable_dc6(struct drm_i915_private *dev_priv);
11551184 void intel_dp_get_m_n(struct intel_crtc *crtc,
11561185 struct intel_crtc_state *pipe_config);
11571186 void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
@@ -1172,31 +1201,26 @@ enum intel_display_power_domain · 14 unmodified lines
11721201 intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder);
11731202 void intel_mode_from_pipe_config(struct drm_display_mode *mode,
11741203 struct intel_crtc_state *pipe_config);
1175−void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc);
11761204 void intel_modeset_preclose(struct drm_device *dev, struct drm_file *file);
11771205
11781206 int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state);
11791207 int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state);
11801208
1181−unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
1182− struct drm_i915_gem_object *obj,
1183− unsigned int plane);
1209+u32 intel_plane_obj_offset(struct intel_plane *intel_plane,
1210+ struct drm_i915_gem_object *obj,
1211+ unsigned int plane);
11841212
11851213 u32 skl_plane_ctl_format(uint32_t pixel_format);
11861214 u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
11871215 u32 skl_plane_ctl_rotation(unsigned int rotation);
11881216
11891217 /* intel_csr.c */
1190−void intel_csr_ucode_init(struct drm_device *dev);
1191−enum csr_state intel_csr_load_status_get(struct drm_i915_private *dev_priv);
1192−void intel_csr_load_status_set(struct drm_i915_private *dev_priv,
1193− enum csr_state state);
1194−void intel_csr_load_program(struct drm_device *dev);
1195−void intel_csr_ucode_fini(struct drm_device *dev);
1196−void assert_csr_loaded(struct drm_i915_private *dev_priv);
1218+void intel_csr_ucode_init(struct drm_i915_private *);
1219+void intel_csr_load_program(struct drm_i915_private *);
1220+void intel_csr_ucode_fini(struct drm_i915_private *);
11971221
11981222 /* intel_dp.c */
1199−void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);
1223+void intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port port);
12001224 bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
12011225 struct intel_connector *intel_connector);
12021226 void intel_dp_set_link_params(struct intel_dp *intel_dp,
@@ -1234,6 +1258,22 @@ bool intel_digital_port_connected(struct drm_i915_private *dev_priv, · 31 unmodified lines
12341258 struct intel_digital_port *port);
12351259 void hsw_dp_set_ddi_pll_sel(struct intel_crtc_state *pipe_config);
12361260
1261+void
1262+intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
1263+ uint8_t dp_train_pat);
1264+void
1265+intel_dp_set_signal_levels(struct intel_dp *intel_dp);
1266+void intel_dp_set_idle_link_train(struct intel_dp *intel_dp);
1267+uint8_t
1268+intel_dp_voltage_max(struct intel_dp *intel_dp);
1269+uint8_t
1270+intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing);
1271+void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
1272+ uint8_t *link_bw, uint8_t *rate_select);
1273+bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp);
1274+bool
1275+intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]);
1276+
12371277 /* intel_dp_mst.c */
12381278 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
12391279 void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port);
@@ -1248,7 +1288,7 @@ void intel_dvo_init(struct drm_device *dev); · 8 unmodified lines
12481288 /* legacy fbdev emulation in intel_fbdev.c */
12491289 #ifdef CONFIG_DRM_FBDEV_EMULATION
12501290 extern int intel_fbdev_init(struct drm_device *dev);
1251−extern void intel_fbdev_initial_config(void *data, async_cookie_t cookie);
1291+extern void intel_fbdev_initial_config_async(struct drm_device *dev);
12521292 extern void intel_fbdev_fini(struct drm_device *dev);
12531293 extern void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous);
12541294 extern void intel_fbdev_output_poll_changed(struct drm_device *dev);
@@ -1259,7 +1299,7 @@ static inline int intel_fbdev_init(struct drm_device *dev) · 4 unmodified lines
12591299 return 0;
12601300 }
12611301
1262−static inline void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
1302+static inline void intel_fbdev_initial_config_async(struct drm_device *dev)
12631303 {
12641304 }
12651305
@@ -1287,11 +1327,10 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv, · 21 unmodified lines
12871327 enum fb_op_origin origin);
12881328 void intel_fbc_flush(struct drm_i915_private *dev_priv,
12891329 unsigned int frontbuffer_bits, enum fb_op_origin origin);
1290−const char *intel_no_fbc_reason_str(enum no_fbc_reason reason);
12911330 void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv);
12921331
12931332 /* intel_hdmi.c */
1294−void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port);
1333+void intel_hdmi_init(struct drm_device *dev, i915_reg_t hdmi_reg, enum port port);
12951334 void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
12961335 struct intel_connector *intel_connector);
12971336 struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
@@ -1367,7 +1406,10 @@ void intel_psr_single_frame_update(struct drm_device *dev, · 69 unmodified lines
13671406 /* intel_runtime_pm.c */
13681407 int intel_power_domains_init(struct drm_i915_private *);
13691408 void intel_power_domains_fini(struct drm_i915_private *);
1370−void intel_power_domains_init_hw(struct drm_i915_private *dev_priv);
1409+void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, bool resume);
1410+void intel_power_domains_suspend(struct drm_i915_private *dev_priv);
1411+void skl_pw1_misc_io_init(struct drm_i915_private *dev_priv);
1412+void skl_pw1_misc_io_fini(struct drm_i915_private *dev_priv);
13711413 void intel_runtime_pm_enable(struct drm_i915_private *dev_priv);
13721414
13731415 bool intel_display_power_is_enabled(struct drm_i915_private *dev_priv,
@@ -1395,12 +1437,6 @@ void intel_init_clock_gating(struct drm_device *dev); · 21 unmodified lines
13951437 void intel_suspend_hw(struct drm_device *dev);
13961438 int ilk_wm_max_level(const struct drm_device *dev);
13971439 void intel_update_watermarks(struct drm_crtc *crtc);
1398−void intel_update_sprite_watermarks(struct drm_plane *plane,
1399− struct drm_crtc *crtc,
1400− uint32_t sprite_width,
1401− uint32_t sprite_height,
1402− int pixel_size,
1403− bool enabled, bool scaled);
14041440 void intel_init_pm(struct drm_device *dev);
14051441 void intel_pm_setup(struct drm_device *dev);
14061442 void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
@@ -1428,7 +1464,8 @@ void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv, · 21 unmodified lines
14281464 uint32_t ilk_pipe_pixel_rate(const struct intel_crtc_state *pipe_config);
14291465
14301466 /* intel_sdvo.c */
1431−bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob);
1467+bool intel_sdvo_init(struct drm_device *dev,
1468+ i915_reg_t reg, enum port port);
14321469
14331470
14341471 /* intel_sprite.c */
drivers/gpu/drm/i915/intel_dsi.c+23−22
@@ -60,7 +60,8 @@ static void wait_for_dsi_fifo_empty(struct intel_dsi *intel_dsi, enum port port) · 59 unmodified lines
6060 DRM_ERROR("DPI FIFOs are not empty\n");
6161 }
6262
63−static void write_data(struct drm_i915_private *dev_priv, u32 reg,
63+static void write_data(struct drm_i915_private *dev_priv,
64+ i915_reg_t reg,
6465 const u8 *data, u32 len)
6566 {
6667 u32 i, j;
@@ -75,7 +76,8 @@ static void write_data(struct drm_i915_private *dev_priv, u32 reg, · 8 unmodified lines
7576 }
7677 }
7778
78−static void read_data(struct drm_i915_private *dev_priv, u32 reg,
79+static void read_data(struct drm_i915_private *dev_priv,
80+ i915_reg_t reg,
7981 u8 *data, u32 len)
8082 {
8183 u32 i, j;
@@ -98,7 +100,8 @@ static ssize_t intel_dsi_host_transfer(struct mipi_dsi_host *host, · 16 unmodified lines
98100 struct mipi_dsi_packet packet;
99101 ssize_t ret;
100102 const u8 *header, *data;
101− u32 data_reg, data_mask, ctrl_reg, ctrl_mask;
103+ i915_reg_t data_reg, ctrl_reg;
104+ u32 data_mask, ctrl_mask;
102105
103106 ret = mipi_dsi_create_packet(&packet, msg);
104107 if (ret < 0)
@@ -377,10 +380,10 @@ static void intel_dsi_port_enable(struct intel_encoder *encoder) · 272 unmodified lines
377380 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
378381 struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
379382 enum port port;
380− u32 temp;
381− u32 port_ctrl;
382383
383384 if (intel_dsi->dual_link == DSI_DUAL_LINK_FRONT_BACK) {
385+ u32 temp;
386+
384387 temp = I915_READ(VLV_CHICKEN_3);
385388 temp &= ~PIXEL_OVERLAP_CNT_MASK |
386389 intel_dsi->pixel_overlap <<
@@ -389,8 +392,9 @@ static void intel_dsi_port_enable(struct intel_encoder *encoder) · 2 unmodified lines
389392 }
390393
391394 for_each_dsi_port(port, intel_dsi->ports) {
392− port_ctrl = IS_BROXTON(dev) ? BXT_MIPI_PORT_CTRL(port) :
393− MIPI_PORT_CTRL(port);
395+ i915_reg_t port_ctrl = IS_BROXTON(dev) ?
396+ BXT_MIPI_PORT_CTRL(port) : MIPI_PORT_CTRL(port);
397+ u32 temp;
394398
395399 temp = I915_READ(port_ctrl);
396400
@@ -416,13 +420,13 @@ static void intel_dsi_port_disable(struct intel_encoder *encoder) · 19 unmodified lines
416420 struct drm_i915_private *dev_priv = dev->dev_private;
417421 struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
418422 enum port port;
419− u32 temp;
420− u32 port_ctrl;
421423
422424 for_each_dsi_port(port, intel_dsi->ports) {
425+ i915_reg_t port_ctrl = IS_BROXTON(dev) ?
426+ BXT_MIPI_PORT_CTRL(port) : MIPI_PORT_CTRL(port);
427+ u32 temp;
428+
423429 /* de-assert ip_tg_enable signal */
424− port_ctrl = IS_BROXTON(dev) ? BXT_MIPI_PORT_CTRL(port) :
425− MIPI_PORT_CTRL(port);
426430 temp = I915_READ(port_ctrl);
427431 I915_WRITE(port_ctrl, temp & ~DPI_ENABLE);
428432 POSTING_READ(port_ctrl);
@@ -580,11 +584,13 @@ static void intel_dsi_clear_device_ready(struct intel_encoder *encoder) · 151 unmodified lines
580584 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
581585 struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
582586 enum port port;
583− u32 val;
584− u32 port_ctrl = 0;
585587
586588 DRM_DEBUG_KMS("\n");
587589 for_each_dsi_port(port, intel_dsi->ports) {
590+ /* Common bit for both MIPI Port A & MIPI Port C on VLV/CHV */
591+ i915_reg_t port_ctrl = IS_BROXTON(dev) ?
592+ BXT_MIPI_PORT_CTRL(port) : MIPI_PORT_CTRL(PORT_A);
593+ u32 val;
588594
589595 I915_WRITE(MIPI_DEVICE_READY(port), DEVICE_READY |
590596 ULPS_STATE_ENTER);
@@ -598,12 +604,6 @@ static void intel_dsi_clear_device_ready(struct intel_encoder *encoder) · 7 unmodified lines
598604 ULPS_STATE_ENTER);
599605 usleep_range(2000, 2500);
600606
601− if (IS_BROXTON(dev))
602− port_ctrl = BXT_MIPI_PORT_CTRL(port);
603− else if (IS_VALLEYVIEW(dev))
604− /* Common bit for both MIPI Port A & MIPI Port C */
605− port_ctrl = MIPI_PORT_CTRL(PORT_A);
606−
607607 /* Wait till Clock lanes are in LP-00 state for MIPI Port A
608608 * only. MIPI Port C has no similar bit for checking
609609 */
@@ -656,7 +656,6 @@ static bool intel_dsi_get_hw_state(struct intel_encoder *encoder, · 46 unmodified lines
656656 struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
657657 struct drm_device *dev = encoder->base.dev;
658658 enum intel_display_power_domain power_domain;
659− u32 dpi_enabled, func, ctrl_reg;
660659 enum port port;
661660
662661 DRM_DEBUG_KMS("\n");
@@ -667,9 +666,11 @@ static bool intel_dsi_get_hw_state(struct intel_encoder *encoder, · 4 unmodified lines
667666
668667 /* XXX: this only works for one DSI output */
669668 for_each_dsi_port(port, intel_dsi->ports) {
669+ i915_reg_t ctrl_reg = IS_BROXTON(dev) ?
670+ BXT_MIPI_PORT_CTRL(port) : MIPI_PORT_CTRL(port);
671+ u32 dpi_enabled, func;
672+
670673 func = I915_READ(MIPI_DSI_FUNC_PRG(port));
671− ctrl_reg = IS_BROXTON(dev) ? BXT_MIPI_PORT_CTRL(port) :
672− MIPI_PORT_CTRL(port);
673674 dpi_enabled = I915_READ(ctrl_reg) & DPI_ENABLE;
674675
675676 /* Due to some hardware limitations on BYT, MIPI Port C DPI
drivers/gpu/drm/i915/intel_dsi.h+1−1
@@ -117,7 +117,7 @@ static inline struct intel_dsi_host *to_intel_dsi_host(struct mipi_dsi_host *h) · 116 unmodified lines
117117
118118 #define for_each_dsi_port(__port, __ports_mask) \
119119 for ((__port) = PORT_A; (__port) < I915_MAX_PORTS; (__port)++) \
120− if ((__ports_mask) & (1 << (__port)))
120+ for_each_if ((__ports_mask) & (1 << (__port)))
121121
122122 static inline struct intel_dsi *enc_to_intel_dsi(struct drm_encoder *encoder)
123123 {
drivers/gpu/drm/i915/intel_dvo.c+11−16
@@ -44,6 +44,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { · 43 unmodified lines
4444 .type = INTEL_DVO_CHIP_TMDS,
4545 .name = "sil164",
4646 .dvo_reg = DVOC,
47+ .dvo_srcdim_reg = DVOC_SRCDIM,
4748 .slave_addr = SIL164_ADDR,
4849 .dev_ops = &sil164_ops,
4950 },
@@ -51,6 +52,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { · 1 unmodified line
5152 .type = INTEL_DVO_CHIP_TMDS,
5253 .name = "ch7xxx",
5354 .dvo_reg = DVOC,
55+ .dvo_srcdim_reg = DVOC_SRCDIM,
5456 .slave_addr = CH7xxx_ADDR,
5557 .dev_ops = &ch7xxx_ops,
5658 },
@@ -58,6 +60,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { · 1 unmodified line
5860 .type = INTEL_DVO_CHIP_TMDS,
5961 .name = "ch7xxx",
6062 .dvo_reg = DVOC,
63+ .dvo_srcdim_reg = DVOC_SRCDIM,
6164 .slave_addr = 0x75, /* For some ch7010 */
6265 .dev_ops = &ch7xxx_ops,
6366 },
@@ -65,6 +68,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { · 1 unmodified line
6568 .type = INTEL_DVO_CHIP_LVDS,
6669 .name = "ivch",
6770 .dvo_reg = DVOA,
71+ .dvo_srcdim_reg = DVOA_SRCDIM,
6872 .slave_addr = 0x02, /* Might also be 0x44, 0x84, 0xc4 */
6973 .dev_ops = &ivch_ops,
7074 },
@@ -72,6 +76,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { · 1 unmodified line
7276 .type = INTEL_DVO_CHIP_TMDS,
7377 .name = "tfp410",
7478 .dvo_reg = DVOC,
79+ .dvo_srcdim_reg = DVOC_SRCDIM,
7580 .slave_addr = TFP410_ADDR,
7681 .dev_ops = &tfp410_ops,
7782 },
@@ -79,6 +84,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { · 1 unmodified line
7984 .type = INTEL_DVO_CHIP_LVDS,
8085 .name = "ch7017",
8186 .dvo_reg = DVOC,
87+ .dvo_srcdim_reg = DVOC_SRCDIM,
8288 .slave_addr = 0x75,
8389 .gpio = GMBUS_PIN_DPB,
8490 .dev_ops = &ch7017_ops,
@@ -87,6 +93,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { · 2 unmodified lines
8793 .type = INTEL_DVO_CHIP_TMDS,
8894 .name = "ns2501",
8995 .dvo_reg = DVOB,
96+ .dvo_srcdim_reg = DVOB_SRCDIM,
9097 .slave_addr = NS2501_ADDR,
9198 .dev_ops = &ns2501_ops,
9299 }
@@ -171,7 +178,7 @@ static void intel_disable_dvo(struct intel_encoder *encoder) · 78 unmodified lines
171178 {
172179 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
173180 struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
174− u32 dvo_reg = intel_dvo->dev.dvo_reg;
181+ i915_reg_t dvo_reg = intel_dvo->dev.dvo_reg;
175182 u32 temp = I915_READ(dvo_reg);
176183
177184 intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, false);
@@ -184,7 +191,7 @@ static void intel_enable_dvo(struct intel_encoder *encoder) · 6 unmodified lines
184191 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
185192 struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
186193 struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
187− u32 dvo_reg = intel_dvo->dev.dvo_reg;
194+ i915_reg_t dvo_reg = intel_dvo->dev.dvo_reg;
188195 u32 temp = I915_READ(dvo_reg);
189196
190197 intel_dvo->dev.dev_ops->mode_set(&intel_dvo->dev,
@@ -255,20 +262,8 @@ static void intel_dvo_pre_enable(struct intel_encoder *encoder) · 64 unmodified lines
255262 struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
256263 int pipe = crtc->pipe;
257264 u32 dvo_val;
258− u32 dvo_reg = intel_dvo->dev.dvo_reg, dvo_srcdim_reg;
259−
260− switch (dvo_reg) {
261− case DVOA:
262− default:
263− dvo_srcdim_reg = DVOA_SRCDIM;
264− break;
265− case DVOB:
266− dvo_srcdim_reg = DVOB_SRCDIM;
267− break;
268− case DVOC:
269− dvo_srcdim_reg = DVOC_SRCDIM;
270− break;
271− }
265+ i915_reg_t dvo_reg = intel_dvo->dev.dvo_reg;
266+ i915_reg_t dvo_srcdim_reg = intel_dvo->dev.dvo_srcdim_reg;
272267
273268 /* Save the data order, since I don't know what it should be set to. */
274269 dvo_val = I915_READ(dvo_reg) &
drivers/gpu/drm/i915/intel_fbc.c+73−123
@@ -46,6 +46,11 @@ static inline bool fbc_supported(struct drm_i915_private *dev_priv) · 45 unmodified lines
4646 return dev_priv->fbc.enable_fbc != NULL;
4747 }
4848
49+static inline bool fbc_on_pipe_a_only(struct drm_i915_private *dev_priv)
50+{
51+ return IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8;
52+}
53+
4954 /*
5055 * In some platforms where the CRTC's x:0/y:0 coordinates doesn't match the
5156 * frontbuffer's x:0/y:0 coordinates we lie to the hardware about the plane's
@@ -182,7 +187,8 @@ static bool g4x_fbc_enabled(struct drm_i915_private *dev_priv) · 130 unmodified lines
182187 return I915_READ(DPFC_CONTROL) & DPFC_CTL_EN;
183188 }
184189
185−static void intel_fbc_nuke(struct drm_i915_private *dev_priv)
190+/* This function forces a CFB recompression through the nuke operation. */
191+static void intel_fbc_recompress(struct drm_i915_private *dev_priv)
186192 {
187193 I915_WRITE(MSG_FBC_REND_STATE, FBC_REND_NUKE);
188194 POSTING_READ(MSG_FBC_REND_STATE);
@@ -231,7 +237,7 @@ static void ilk_fbc_enable(struct intel_crtc *crtc) · 42 unmodified lines
231237 I915_WRITE(DPFC_CPU_FENCE_OFFSET, y_offset);
232238 }
233239
234− intel_fbc_nuke(dev_priv);
240+ intel_fbc_recompress(dev_priv);
235241
236242 DRM_DEBUG_KMS("enabled fbc on plane %c\n", plane_name(crtc->plane));
237243 }
@@ -310,7 +316,7 @@ static void gen7_fbc_enable(struct intel_crtc *crtc) · 72 unmodified lines
310316 SNB_CPU_FENCE_ENABLE | obj->fence_reg);
311317 I915_WRITE(DPFC_CPU_FENCE_OFFSET, get_crtc_fence_y_offset(crtc));
312318
313− intel_fbc_nuke(dev_priv);
319+ intel_fbc_recompress(dev_priv);
314320
315321 DRM_DEBUG_KMS("enabled fbc on plane %c\n", plane_name(crtc->plane));
316322 }
@@ -370,8 +376,6 @@ static void intel_fbc_cancel_work(struct drm_i915_private *dev_priv) · 53 unmodified lines
370376 if (dev_priv->fbc.fbc_work == NULL)
371377 return;
372378
373− DRM_DEBUG_KMS("cancelling pending FBC enable\n");
374−
375379 /* Synchronisation is provided by struct_mutex and checking of
376380 * dev_priv->fbc.fbc_work, so we can perform the cancellation
377381 * entirely asynchronously.
@@ -432,7 +436,8 @@ static void __intel_fbc_disable(struct drm_i915_private *dev_priv) · 54 unmodified lines
432436
433437 intel_fbc_cancel_work(dev_priv);
434438
435− dev_priv->fbc.disable_fbc(dev_priv);
439+ if (dev_priv->fbc.enabled)
440+ dev_priv->fbc.disable_fbc(dev_priv);
436441 dev_priv->fbc.crtc = NULL;
437442 }
438443
@@ -471,78 +476,45 @@ void intel_fbc_disable_crtc(struct intel_crtc *crtc) · 32 unmodified lines
471476 mutex_unlock(&dev_priv->fbc.lock);
472477 }
473478
474−const char *intel_no_fbc_reason_str(enum no_fbc_reason reason)
475−{
476− switch (reason) {
477− case FBC_OK:
478− return "FBC enabled but currently disabled in hardware";
479− case FBC_UNSUPPORTED:
480− return "unsupported by this chipset";
481− case FBC_NO_OUTPUT:
482− return "no output";
483− case FBC_STOLEN_TOO_SMALL:
484− return "not enough stolen memory";
485− case FBC_UNSUPPORTED_MODE:
486− return "mode incompatible with compression";
487− case FBC_MODE_TOO_LARGE:
488− return "mode too large for compression";
489− case FBC_BAD_PLANE:
490− return "FBC unsupported on plane";
491− case FBC_NOT_TILED:
492− return "framebuffer not tiled or fenced";
493− case FBC_MULTIPLE_PIPES:
494− return "more than one pipe active";
495− case FBC_MODULE_PARAM:
496− return "disabled per module param";
497− case FBC_CHIP_DEFAULT:
498− return "disabled per chip default";
499− case FBC_ROTATION:
500− return "rotation unsupported";
501− case FBC_IN_DBG_MASTER:
502− return "Kernel debugger is active";
503− case FBC_BAD_STRIDE:
504− return "framebuffer stride not supported";
505− case FBC_PIXEL_RATE:
506− return "pixel rate is too big";
507− case FBC_PIXEL_FORMAT:
508− return "pixel format is invalid";
509− default:
510− MISSING_CASE(reason);
511− return "unknown reason";
512− }
513−}
514−
515479 static void set_no_fbc_reason(struct drm_i915_private *dev_priv,
516− enum no_fbc_reason reason)
480+ const char *reason)
517481 {
518482 if (dev_priv->fbc.no_fbc_reason == reason)
519483 return;
520484
521485 dev_priv->fbc.no_fbc_reason = reason;
522− DRM_DEBUG_KMS("Disabling FBC: %s\n", intel_no_fbc_reason_str(reason));
486+ DRM_DEBUG_KMS("Disabling FBC: %s\n", reason);
487+}
488+
489+static bool crtc_is_valid(struct intel_crtc *crtc)
490+{
491+ struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
492+
493+ if (fbc_on_pipe_a_only(dev_priv) && crtc->pipe != PIPE_A)
494+ return false;
495+
496+ if (!intel_crtc_active(&crtc->base))
497+ return false;
498+
499+ if (!to_intel_plane_state(crtc->base.primary->state)->visible)
500+ return false;
501+
502+ return true;
523503 }
524504
525505 static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv)
526506 {
527507 struct drm_crtc *crtc = NULL, *tmp_crtc;
528508 enum pipe pipe;
529− bool pipe_a_only = false;
530−
531− if (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8)
532− pipe_a_only = true;
533509
534510 for_each_pipe(dev_priv, pipe) {
535511 tmp_crtc = dev_priv->pipe_to_crtc_mapping[pipe];
536512
537− if (intel_crtc_active(tmp_crtc) &&
538− to_intel_plane_state(tmp_crtc->primary->state)->visible)
513+ if (crtc_is_valid(to_intel_crtc(tmp_crtc)))
539514 crtc = tmp_crtc;
540−
541− if (pipe_a_only)
542− break;
543515 }
544516
545− if (!crtc || crtc->primary->fb == NULL)
517+ if (!crtc)
546518 return NULL;
547519
548520 return crtc;
@@ -581,7 +553,8 @@ static int find_compression_threshold(struct drm_i915_private *dev_priv, · 32 unmodified lines
581553 * reserved range size, so it always assumes the maximum (8mb) is used.
582554 * If we enable FBC using a CFB on that memory range we'll get FIFO
583555 * underruns, even if that range is not reserved by the BIOS. */
584− if (IS_BROADWELL(dev_priv) || IS_SKYLAKE(dev_priv))
556+ if (IS_BROADWELL(dev_priv) ||
557+ IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv))
585558 end = dev_priv->gtt.stolen_size - 8 * 1024 * 1024;
586559 else
587560 end = dev_priv->gtt.stolen_usable_size;
@@ -734,6 +707,7 @@ static int intel_fbc_calculate_cfb_size(struct intel_crtc *crtc) · 146 unmodified lines
734707 if (INTEL_INFO(dev_priv)->gen >= 7)
735708 lines = min(lines, 2048);
736709
710+ /* Hardware needs the full buffer stride, not just the active area. */
737711 return lines * fb->pitches[0];
738712 }
739713
@@ -832,84 +806,62 @@ static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc *crtc) · 92 unmodified lines
832806 * __intel_fbc_update - enable/disable FBC as needed, unlocked
833807 * @dev_priv: i915 device instance
834808 *
835− * Set up the framebuffer compression hardware at mode set time. We
836− * enable it if possible:
837− * - plane A only (on pre-965)
838− * - no pixel mulitply/line duplication
839− * - no alpha buffer discard
840− * - no dual wide
841− * - framebuffer <= max_hdisplay in width, max_vdisplay in height
842− *
843− * We can't assume that any compression will take place (worst case),
844− * so the compressed buffer has to be the same size as the uncompressed
845− * one. It also must reside (along with the line length buffer) in
846− * stolen memory.
847− *
848− * We need to enable/disable FBC on a global basis.
809+ * This function completely reevaluates the status of FBC, then enables,
810+ * disables or maintains it on the same state.
849811 */
850812 static void __intel_fbc_update(struct drm_i915_private *dev_priv)
851813 {
852− struct drm_crtc *crtc = NULL;
853− struct intel_crtc *intel_crtc;
814+ struct drm_crtc *drm_crtc = NULL;
815+ struct intel_crtc *crtc;
854816 struct drm_framebuffer *fb;
855817 struct drm_i915_gem_object *obj;
856818 const struct drm_display_mode *adjusted_mode;
857819
858820 WARN_ON(!mutex_is_locked(&dev_priv->fbc.lock));
859821
860− /* disable framebuffer compression in vGPU */
861822 if (intel_vgpu_active(dev_priv->dev))
862823 i915.enable_fbc = 0;
863824
864825 if (i915.enable_fbc < 0) {
865− set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT);
826+ set_no_fbc_reason(dev_priv, "disabled per chip default");
866827 goto out_disable;
867828 }
868829
869830 if (!i915.enable_fbc) {
870− set_no_fbc_reason(dev_priv, FBC_MODULE_PARAM);
831+ set_no_fbc_reason(dev_priv, "disabled per module param");
871832 goto out_disable;
872833 }
873834
874− /*
875− * If FBC is already on, we just have to verify that we can
876− * keep it that way...
877− * Need to disable if:
878− * - more than one pipe is active
879− * - changing FBC params (stride, fence, mode)
880− * - new fb is too large to fit in compressed buffer
881− * - going to an unsupported config (interlace, pixel multiply, etc.)
882− */
883− crtc = intel_fbc_find_crtc(dev_priv);
884− if (!crtc) {
885− set_no_fbc_reason(dev_priv, FBC_NO_OUTPUT);
835+ drm_crtc = intel_fbc_find_crtc(dev_priv);
836+ if (!drm_crtc) {
837+ set_no_fbc_reason(dev_priv, "no output");
886838 goto out_disable;
887839 }
888840
889841 if (!multiple_pipes_ok(dev_priv)) {
890− set_no_fbc_reason(dev_priv, FBC_MULTIPLE_PIPES);
842+ set_no_fbc_reason(dev_priv, "more than one pipe active");
891843 goto out_disable;
892844 }
893845
894− intel_crtc = to_intel_crtc(crtc);
895− fb = crtc->primary->fb;
846+ crtc = to_intel_crtc(drm_crtc);
847+ fb = crtc->base.primary->fb;
896848 obj = intel_fb_obj(fb);
897− adjusted_mode = &intel_crtc->config->base.adjusted_mode;
849+ adjusted_mode = &crtc->config->base.adjusted_mode;
898850
899851 if ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) ||
900852 (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)) {
901− set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE);
853+ set_no_fbc_reason(dev_priv, "incompatible mode");
902854 goto out_disable;
903855 }
904856
905− if (!intel_fbc_hw_tracking_covers_screen(intel_crtc)) {
906− set_no_fbc_reason(dev_priv, FBC_MODE_TOO_LARGE);
857+ if (!intel_fbc_hw_tracking_covers_screen(crtc)) {
858+ set_no_fbc_reason(dev_priv, "mode too large for compression");
907859 goto out_disable;
908860 }
909861
910862 if ((INTEL_INFO(dev_priv)->gen < 4 || HAS_DDI(dev_priv)) &&
911− intel_crtc->plane != PLANE_A) {
912− set_no_fbc_reason(dev_priv, FBC_BAD_PLANE);
863+ crtc->plane != PLANE_A) {
864+ set_no_fbc_reason(dev_priv, "FBC unsupported on plane");
913865 goto out_disable;
914866 }
915867
@@ -918,41 +870,35 @@ static void __intel_fbc_update(struct drm_i915_private *dev_priv) · 2 unmodified lines
918870 */
919871 if (obj->tiling_mode != I915_TILING_X ||
920872 obj->fence_reg == I915_FENCE_REG_NONE) {
921− set_no_fbc_reason(dev_priv, FBC_NOT_TILED);
873+ set_no_fbc_reason(dev_priv, "framebuffer not tiled or fenced");
922874 goto out_disable;
923875 }
924876 if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) &&
925− crtc->primary->state->rotation != BIT(DRM_ROTATE_0)) {
926− set_no_fbc_reason(dev_priv, FBC_ROTATION);
877+ crtc->base.primary->state->rotation != BIT(DRM_ROTATE_0)) {
878+ set_no_fbc_reason(dev_priv, "rotation unsupported");
927879 goto out_disable;
928880 }
929881
930882 if (!stride_is_valid(dev_priv, fb->pitches[0])) {
931− set_no_fbc_reason(dev_priv, FBC_BAD_STRIDE);
883+ set_no_fbc_reason(dev_priv, "framebuffer stride not supported");
932884 goto out_disable;
933885 }
934886
935887 if (!pixel_format_is_valid(fb)) {
936− set_no_fbc_reason(dev_priv, FBC_PIXEL_FORMAT);
937− goto out_disable;
938− }
939−
940− /* If the kernel debugger is active, always disable compression */
941− if (in_dbg_master()) {
942− set_no_fbc_reason(dev_priv, FBC_IN_DBG_MASTER);
888+ set_no_fbc_reason(dev_priv, "pixel format is invalid");
943889 goto out_disable;
944890 }
945891
946892 /* WaFbcExceedCdClockThreshold:hsw,bdw */
947893 if ((IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) &&
948− ilk_pipe_pixel_rate(intel_crtc->config) >=
894+ ilk_pipe_pixel_rate(crtc->config) >=
949895 dev_priv->cdclk_freq * 95 / 100) {
950− set_no_fbc_reason(dev_priv, FBC_PIXEL_RATE);
896+ set_no_fbc_reason(dev_priv, "pixel rate is too big");
951897 goto out_disable;
952898 }
953899
954− if (intel_fbc_setup_cfb(intel_crtc)) {
955− set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL);
900+ if (intel_fbc_setup_cfb(crtc)) {
901+ set_no_fbc_reason(dev_priv, "not enough stolen memory");
956902 goto out_disable;
957903 }
958904
@@ -961,9 +907,9 @@ static void __intel_fbc_update(struct drm_i915_private *dev_priv) · 2 unmodified lines
961907 * cannot be unpinned (and have its GTT offset and fence revoked)
962908 * without first being decoupled from the scanout and FBC disabled.
963909 */
964− if (dev_priv->fbc.crtc == intel_crtc &&
910+ if (dev_priv->fbc.crtc == crtc &&
965911 dev_priv->fbc.fb_id == fb->base.id &&
966− dev_priv->fbc.y == crtc->y)
912+ dev_priv->fbc.y == crtc->base.y)
967913 return;
968914
969915 if (intel_fbc_enabled(dev_priv)) {
@@ -994,8 +940,8 @@ static void __intel_fbc_update(struct drm_i915_private *dev_priv) · 24 unmodified lines
994940 __intel_fbc_disable(dev_priv);
995941 }
996942
997− intel_fbc_schedule_enable(intel_crtc);
998− dev_priv->fbc.no_fbc_reason = FBC_OK;
943+ intel_fbc_schedule_enable(crtc);
944+ dev_priv->fbc.no_fbc_reason = "FBC enabled (not necessarily active)";
999945 return;
1000946
1001947 out_disable:
@@ -1085,10 +1031,10 @@ void intel_fbc_init(struct drm_i915_private *dev_priv) · 83 unmodified lines
10851031 enum pipe pipe;
10861032
10871033 mutex_init(&dev_priv->fbc.lock);
1034+ dev_priv->fbc.enabled = false;
10881035
10891036 if (!HAS_FBC(dev_priv)) {
1090− dev_priv->fbc.enabled = false;
1091− dev_priv->fbc.no_fbc_reason = FBC_UNSUPPORTED;
1037+ dev_priv->fbc.no_fbc_reason = "unsupported by this chipset";
10921038 return;
10931039 }
10941040
@@ -1096,7 +1042,7 @@ void intel_fbc_init(struct drm_i915_private *dev_priv) · 1 unmodified line
10961042 dev_priv->fbc.possible_framebuffer_bits |=
10971043 INTEL_FRONTBUFFER_PRIMARY(pipe);
10981044
1099− if (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8)
1045+ if (fbc_on_pipe_a_only(dev_priv))
11001046 break;
11011047 }
11021048
@@ -1121,5 +1067,9 @@ void intel_fbc_init(struct drm_i915_private *dev_priv) · 18 unmodified lines
11211067 I915_WRITE(FBC_CONTROL, 500 << FBC_CTL_INTERVAL_SHIFT);
11221068 }
11231069
1124− dev_priv->fbc.enabled = dev_priv->fbc.fbc_enabled(dev_priv);
1070+ /* We still don't have any sort of hardware state readout for FBC, so
1071+ * disable it in case the BIOS enabled it to make sure software matches
1072+ * the hardware state. */
1073+ if (dev_priv->fbc.fbc_enabled(dev_priv))
1074+ dev_priv->fbc.disable_fbc(dev_priv);
11251075 }
drivers/gpu/drm/i915/intel_fbdev.c+32−18
@@ -119,7 +119,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper, · 118 unmodified lines
119119 {
120120 struct intel_fbdev *ifbdev =
121121 container_of(helper, struct intel_fbdev, helper);
122− struct drm_framebuffer *fb;
122+ struct drm_framebuffer *fb = NULL;
123123 struct drm_device *dev = helper->dev;
124124 struct drm_i915_private *dev_priv = to_i915(dev);
125125 struct drm_mode_fb_cmd2 mode_cmd = {};
@@ -138,6 +138,8 @@ static int intelfb_alloc(struct drm_fb_helper *helper, · 12 unmodified lines
138138 mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
139139 sizes->surface_depth);
140140
141+ mutex_lock(&dev->struct_mutex);
142+
141143 size = mode_cmd.pitches[0] * mode_cmd.height;
142144 size = PAGE_ALIGN(size);
143145
@@ -156,26 +158,28 @@ static int intelfb_alloc(struct drm_fb_helper *helper, · 12 unmodified lines
156158
157159 fb = __intel_framebuffer_create(dev, &mode_cmd, obj);
158160 if (IS_ERR(fb)) {
161+ drm_gem_object_unreference(&obj->base);
159162 ret = PTR_ERR(fb);
160− goto out_unref;
163+ goto out;
161164 }
162165
163166 /* Flush everything out, we'll be doing GTT only from now on */
164− ret = intel_pin_and_fence_fb_obj(NULL, fb, NULL, NULL, NULL);
167+ ret = intel_pin_and_fence_fb_obj(NULL, fb, NULL);
165168 if (ret) {
166169 DRM_ERROR("failed to pin obj: %d\n", ret);
167− goto out_fb;
170+ goto out;
168171 }
169172
173+ mutex_unlock(&dev->struct_mutex);
174+
170175 ifbdev->fb = to_intel_framebuffer(fb);
171176
172177 return 0;
173178
174−out_fb:
175− drm_framebuffer_remove(fb);
176−out_unref:
177− drm_gem_object_unreference(&obj->base);
178179 out:
180+ mutex_unlock(&dev->struct_mutex);
181+ if (!IS_ERR_OR_NULL(fb))
182+ drm_framebuffer_unreference(fb);
179183 return ret;
180184 }
181185
@@ -193,8 +197,6 @@ static int intelfb_create(struct drm_fb_helper *helper, · 11 unmodified lines
193197 int size, ret;
194198 bool prealloc = false;
195199
196− mutex_lock(&dev->struct_mutex);
197−
198200 if (intel_fb &&
199201 (sizes->fb_width > intel_fb->base.width ||
200202 sizes->fb_height > intel_fb->base.height)) {
@@ -209,7 +211,7 @@ static int intelfb_create(struct drm_fb_helper *helper, · 8 unmodified lines
209211 DRM_DEBUG_KMS("no BIOS fb, allocating a new one\n");
210212 ret = intelfb_alloc(helper, sizes);
211213 if (ret)
212− goto out_unlock;
214+ return ret;
213215 intel_fb = ifbdev->fb;
214216 } else {
215217 DRM_DEBUG_KMS("re-using BIOS fb\n");
@@ -221,8 +223,11 @@ static int intelfb_create(struct drm_fb_helper *helper, · 5 unmodified lines
221223 obj = intel_fb->obj;
222224 size = obj->base.size;
223225
226+ mutex_lock(&dev->struct_mutex);
227+
224228 info = drm_fb_helper_alloc_fbi(helper);
225229 if (IS_ERR(info)) {
230+ DRM_ERROR("Failed to allocate fb_info\n");
226231 ret = PTR_ERR(info);
227232 goto out_unpin;
228233 }
@@ -249,6 +254,7 @@ static int intelfb_create(struct drm_fb_helper *helper, · 20 unmodified lines
249254 ioremap_wc(dev_priv->gtt.mappable_base + i915_gem_obj_ggtt_offset(obj),
250255 size);
251256 if (!info->screen_base) {
257+ DRM_ERROR("Failed to remap framebuffer into virtual memory\n");
252258 ret = -ENOSPC;
253259 goto out_destroy_fbi;
254260 }
@@ -281,8 +287,6 @@ out_destroy_fbi: · 26 unmodified lines
281287 drm_fb_helper_release_fbi(helper);
282288 out_unpin:
283289 i915_gem_object_ggtt_unpin(obj);
284− drm_gem_object_unreference(&obj->base);
285−out_unlock:
286290 mutex_unlock(&dev->struct_mutex);
287291 return ret;
288292 }
@@ -526,8 +530,10 @@ static void intel_fbdev_destroy(struct drm_device *dev, · 237 unmodified lines
526530
527531 drm_fb_helper_fini(&ifbdev->helper);
528532
529− drm_framebuffer_unregister_private(&ifbdev->fb->base);
530− drm_framebuffer_remove(&ifbdev->fb->base);
533+ if (ifbdev->fb) {
534+ drm_framebuffer_unregister_private(&ifbdev->fb->base);
535+ drm_framebuffer_remove(&ifbdev->fb->base);
536+ }
531537 }
532538
533539 /*
@@ -702,13 +708,20 @@ int intel_fbdev_init(struct drm_device *dev) · 168 unmodified lines
702708 return 0;
703709 }
704710
705−void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
711+static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
706712 {
707713 struct drm_i915_private *dev_priv = data;
708714 struct intel_fbdev *ifbdev = dev_priv->fbdev;
709715
710716 /* Due to peculiar init order wrt to hpd handling this is separate. */
711− drm_fb_helper_initial_config(&ifbdev->helper, ifbdev->preferred_bpp);
717+ if (drm_fb_helper_initial_config(&ifbdev->helper,
718+ ifbdev->preferred_bpp))
719+ intel_fbdev_fini(dev_priv->dev);
720+}
721+
722+void intel_fbdev_initial_config_async(struct drm_device *dev)
723+{
724+ async_schedule(intel_fbdev_initial_config, to_i915(dev));
712725 }
713726
714727 void intel_fbdev_fini(struct drm_device *dev)
@@ -719,7 +732,8 @@ void intel_fbdev_fini(struct drm_device *dev) · 4 unmodified lines
719732
720733 flush_work(&dev_priv->fbdev_suspend_work);
721734
722− async_synchronize_full();
735+ if (!current_is_async())
736+ async_synchronize_full();
723737 intel_fbdev_destroy(dev, dev_priv->fbdev);
724738 kfree(dev_priv->fbdev);
725739 dev_priv->fbdev = NULL;
drivers/gpu/drm/i915/intel_fifo_underrun.c+99−28
@@ -84,38 +84,21 @@ static bool cpt_can_enable_serr_int(struct drm_device *dev) · 83 unmodified lines
8484 return true;
8585 }
8686
87−/**
88− * i9xx_check_fifo_underruns - check for fifo underruns
89− * @dev_priv: i915 device instance
90− *
91− * This function checks for fifo underruns on GMCH platforms. This needs to be
92− * done manually on modeset to make sure that we catch all underruns since they
93− * do not generate an interrupt by themselves on these platforms.
94− */
95−void i9xx_check_fifo_underruns(struct drm_i915_private *dev_priv)
87+static void i9xx_check_fifo_underruns(struct intel_crtc *crtc)
9688 {
97− struct intel_crtc *crtc;
98−
99− spin_lock_irq(&dev_priv->irq_lock);
100−
101− for_each_intel_crtc(dev_priv->dev, crtc) {
102− u32 reg = PIPESTAT(crtc->pipe);
103− u32 pipestat;
104−
105− if (crtc->cpu_fifo_underrun_disabled)
106− continue;
89+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
90+ i915_reg_t reg = PIPESTAT(crtc->pipe);
91+ u32 pipestat = I915_READ(reg) & 0xffff0000;
10792
108− pipestat = I915_READ(reg) & 0xffff0000;
109− if ((pipestat & PIPE_FIFO_UNDERRUN_STATUS) == 0)
110− continue;
93+ assert_spin_locked(&dev_priv->irq_lock);
11194
112− I915_WRITE(reg, pipestat | PIPE_FIFO_UNDERRUN_STATUS);
113− POSTING_READ(reg);
95+ if ((pipestat & PIPE_FIFO_UNDERRUN_STATUS) == 0)
96+ return;
11497
115− DRM_ERROR("pipe %c underrun\n", pipe_name(crtc->pipe));
116− }
98+ I915_WRITE(reg, pipestat | PIPE_FIFO_UNDERRUN_STATUS);
99+ POSTING_READ(reg);
117100
118− spin_unlock_irq(&dev_priv->irq_lock);
101+ DRM_ERROR("pipe %c underrun\n", pipe_name(crtc->pipe));
119102 }
120103
121104 static void i9xx_set_fifo_underrun_reporting(struct drm_device *dev,
@@ -123,7 +106,7 @@ static void i9xx_set_fifo_underrun_reporting(struct drm_device *dev, · 1 unmodified line
123106 bool enable, bool old)
124107 {
125108 struct drm_i915_private *dev_priv = dev->dev_private;
126− u32 reg = PIPESTAT(pipe);
109+ i915_reg_t reg = PIPESTAT(pipe);
127110 u32 pipestat = I915_READ(reg) & 0xffff0000;
128111
129112 assert_spin_locked(&dev_priv->irq_lock);
@@ -150,6 +133,23 @@ static void ironlake_set_fifo_underrun_reporting(struct drm_device *dev, · 20 unmodified lines
150133 ironlake_disable_display_irq(dev_priv, bit);
151134 }
152135
136+static void ivybridge_check_fifo_underruns(struct intel_crtc *crtc)
137+{
138+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
139+ enum pipe pipe = crtc->pipe;
140+ uint32_t err_int = I915_READ(GEN7_ERR_INT);
141+
142+ assert_spin_locked(&dev_priv->irq_lock);
143+
144+ if ((err_int & ERR_INT_FIFO_UNDERRUN(pipe)) == 0)
145+ return;
146+
147+ I915_WRITE(GEN7_ERR_INT, ERR_INT_FIFO_UNDERRUN(pipe));
148+ POSTING_READ(GEN7_ERR_INT);
149+
150+ DRM_ERROR("fifo underrun on pipe %c\n", pipe_name(pipe));
151+}
152+
153153 static void ivybridge_set_fifo_underrun_reporting(struct drm_device *dev,
154154 enum pipe pipe,
155155 bool enable, bool old)
@@ -202,6 +202,24 @@ static void ibx_set_fifo_underrun_reporting(struct drm_device *dev, · 46 unmodified lines
202202 ibx_disable_display_interrupt(dev_priv, bit);
203203 }
204204
205+static void cpt_check_pch_fifo_underruns(struct intel_crtc *crtc)
206+{
207+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
208+ enum transcoder pch_transcoder = (enum transcoder) crtc->pipe;
209+ uint32_t serr_int = I915_READ(SERR_INT);
210+
211+ assert_spin_locked(&dev_priv->irq_lock);
212+
213+ if ((serr_int & SERR_INT_TRANS_FIFO_UNDERRUN(pch_transcoder)) == 0)
214+ return;
215+
216+ I915_WRITE(SERR_INT, SERR_INT_TRANS_FIFO_UNDERRUN(pch_transcoder));
217+ POSTING_READ(SERR_INT);
218+
219+ DRM_ERROR("pch fifo underrun on pch transcoder %c\n",
220+ transcoder_name(pch_transcoder));
221+}
222+
205223 static void cpt_set_fifo_underrun_reporting(struct drm_device *dev,
206224 enum transcoder pch_transcoder,
207225 bool enable, bool old)
@@ -375,3 +393,56 @@ void intel_pch_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, · 167 unmodified lines
375393 DRM_ERROR("PCH transcoder %c FIFO underrun\n",
376394 transcoder_name(pch_transcoder));
377395 }
396+
397+/**
398+ * intel_check_cpu_fifo_underruns - check for CPU fifo underruns immediately
399+ * @dev_priv: i915 device instance
400+ *
401+ * Check for CPU fifo underruns immediately. Useful on IVB/HSW where the shared
402+ * error interrupt may have been disabled, and so CPU fifo underruns won't
403+ * necessarily raise an interrupt, and on GMCH platforms where underruns never
404+ * raise an interrupt.
405+ */
406+void intel_check_cpu_fifo_underruns(struct drm_i915_private *dev_priv)
407+{
408+ struct intel_crtc *crtc;
409+
410+ spin_lock_irq(&dev_priv->irq_lock);
411+
412+ for_each_intel_crtc(dev_priv->dev, crtc) {
413+ if (crtc->cpu_fifo_underrun_disabled)
414+ continue;
415+
416+ if (HAS_GMCH_DISPLAY(dev_priv))
417+ i9xx_check_fifo_underruns(crtc);
418+ else if (IS_GEN7(dev_priv))
419+ ivybridge_check_fifo_underruns(crtc);
420+ }
421+
422+ spin_unlock_irq(&dev_priv->irq_lock);
423+}
424+
425+/**
426+ * intel_check_pch_fifo_underruns - check for PCH fifo underruns immediately
427+ * @dev_priv: i915 device instance
428+ *
429+ * Check for PCH fifo underruns immediately. Useful on CPT/PPT where the shared
430+ * error interrupt may have been disabled, and so PCH fifo underruns won't
431+ * necessarily raise an interrupt.
432+ */
433+void intel_check_pch_fifo_underruns(struct drm_i915_private *dev_priv)
434+{
435+ struct intel_crtc *crtc;
436+
437+ spin_lock_irq(&dev_priv->irq_lock);
438+
439+ for_each_intel_crtc(dev_priv->dev, crtc) {
440+ if (crtc->pch_fifo_underrun_disabled)
441+ continue;
442+
443+ if (HAS_PCH_CPT(dev_priv))
444+ cpt_check_pch_fifo_underruns(crtc);
445+ }
446+
447+ spin_unlock_irq(&dev_priv->irq_lock);
448+}
drivers/gpu/drm/i915/intel_guc.h+7−1
@@ -76,11 +76,17 @@ struct intel_guc_fw { · 75 unmodified lines
7676 uint16_t guc_fw_minor_wanted;
7777 uint16_t guc_fw_major_found;
7878 uint16_t guc_fw_minor_found;
79+
80+ uint32_t header_size;
81+ uint32_t header_offset;
82+ uint32_t rsa_size;
83+ uint32_t rsa_offset;
84+ uint32_t ucode_size;
85+ uint32_t ucode_offset;
7986 };
8087
8188 struct intel_guc {
8289 struct intel_guc_fw guc_fw;
83−
8490 uint32_t log_flags;
8591 struct drm_i915_gem_object *log_obj;
8692
drivers/gpu/drm/i915/intel_guc_fwif.h+72−0
@@ -122,6 +122,78 @@ · 121 unmodified lines
122122
123123 #define GUC_CTL_MAX_DWORDS (GUC_CTL_RSRVD + 1)
124124
125+/**
126+ * DOC: GuC Firmware Layout
127+ *
128+ * The GuC firmware layout looks like this:
129+ *
130+ * +-------------------------------+
131+ * | guc_css_header |
132+ * | contains major/minor version |
133+ * +-------------------------------+
134+ * | uCode |
135+ * +-------------------------------+
136+ * | RSA signature |
137+ * +-------------------------------+
138+ * | modulus key |
139+ * +-------------------------------+
140+ * | exponent val |
141+ * +-------------------------------+
142+ *
143+ * The firmware may or may not have modulus key and exponent data. The header,
144+ * uCode and RSA signature are must-have components that will be used by driver.
145+ * Length of each components, which is all in dwords, can be found in header.
146+ * In the case that modulus and exponent are not present in fw, a.k.a truncated
147+ * image, the length value still appears in header.
148+ *
149+ * Driver will do some basic fw size validation based on the following rules:
150+ *
151+ * 1. Header, uCode and RSA are must-have components.
152+ * 2. All firmware components, if they present, are in the sequence illustrated
153+ * in the layout table above.
154+ * 3. Length info of each component can be found in header, in dwords.
155+ * 4. Modulus and exponent key are not required by driver. They may not appear
156+ * in fw. So driver will load a truncated firmware in this case.
157+ */
158+
159+struct guc_css_header {
160+ uint32_t module_type;
161+ /* header_size includes all non-uCode bits, including css_header, rsa
162+ * key, modulus key and exponent data. */
163+ uint32_t header_size_dw;
164+ uint32_t header_version;
165+ uint32_t module_id;
166+ uint32_t module_vendor;
167+ union {
168+ struct {
169+ uint8_t day;
170+ uint8_t month;
171+ uint16_t year;
172+ };
173+ uint32_t date;
174+ };
175+ uint32_t size_dw; /* uCode plus header_size_dw */
176+ uint32_t key_size_dw;
177+ uint32_t modulus_size_dw;
178+ uint32_t exponent_size_dw;
179+ union {
180+ struct {
181+ uint8_t hour;
182+ uint8_t min;
183+ uint16_t sec;
184+ };
185+ uint32_t time;
186+ };
187+
188+ char username[8];
189+ char buildnumber[12];
190+ uint32_t device_id;
191+ uint32_t guc_sw_version;
192+ uint32_t prod_preprod_fw;
193+ uint32_t reserved[12];
194+ uint32_t header_info;
195+} __packed;
196+
125197 struct guc_doorbell_info {
126198 u32 db_status;
127199 u32 cookie;
drivers/gpu/drm/i915/intel_guc_loader.c+67−38
@@ -31,7 +31,7 @@ · 30 unmodified lines
3131 #include "intel_guc.h"
3232
3333 /**
34− * DOC: GuC
34+ * DOC: GuC-specific firmware loader
3535 *
3636 * intel_guc:
3737 * Top level structure of guc. It handles firmware loading and manages client
@@ -208,16 +208,6 @@ static inline bool guc_ucode_response(struct drm_i915_private *dev_priv, · 170 unmodified lines
208208 /*
209209 * Transfer the firmware image to RAM for execution by the microcontroller.
210210 *
211− * GuC Firmware layout:
212− * +-------------------------------+ ----
213− * | CSS header | 128B
214− * | contains major/minor version |
215− * +-------------------------------+ ----
216− * | uCode |
217− * +-------------------------------+ ----
218− * | RSA signature | 256B
219− * +-------------------------------+ ----
220− *
221211 * Architecturally, the DMA engine is bidirectional, and can potentially even
222212 * transfer between GTT locations. This functionality is left out of the API
223213 * for now as there is no need for it.
@@ -225,33 +215,29 @@ static inline bool guc_ucode_response(struct drm_i915_private *dev_priv, · 1 unmodified line
225215 * Note that GuC needs the CSS header plus uKernel code to be copied by the
226216 * DMA engine in one operation, whereas the RSA signature is loaded via MMIO.
227217 */
228−
229−#define UOS_CSS_HEADER_OFFSET 0
230−#define UOS_VER_MINOR_OFFSET 0x44
231−#define UOS_VER_MAJOR_OFFSET 0x46
232−#define UOS_CSS_HEADER_SIZE 0x80
233−#define UOS_RSA_SIG_SIZE 0x100
234−
235218 static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv)
236219 {
237220 struct intel_guc_fw *guc_fw = &dev_priv->guc.guc_fw;
238221 struct drm_i915_gem_object *fw_obj = guc_fw->guc_fw_obj;
239222 unsigned long offset;
240223 struct sg_table *sg = fw_obj->pages;
241− u32 status, ucode_size, rsa[UOS_RSA_SIG_SIZE / sizeof(u32)];
224+ u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT];
242225 int i, ret = 0;
243226
244− /* uCode size, also is where RSA signature starts */
245− offset = ucode_size = guc_fw->guc_fw_size - UOS_RSA_SIG_SIZE;
246− I915_WRITE(DMA_COPY_SIZE, ucode_size);
227+ /* where RSA signature starts */
228+ offset = guc_fw->rsa_offset;
247229
248230 /* Copy RSA signature from the fw image to HW for verification */
249− sg_pcopy_to_buffer(sg->sgl, sg->nents, rsa, UOS_RSA_SIG_SIZE, offset);
250− for (i = 0; i < UOS_RSA_SIG_SIZE / sizeof(u32); i++)
231+ sg_pcopy_to_buffer(sg->sgl, sg->nents, rsa, sizeof(rsa), offset);
232+ for (i = 0; i < UOS_RSA_SCRATCH_MAX_COUNT; i++)
251233 I915_WRITE(UOS_RSA_SCRATCH(i), rsa[i]);
252234
235+ /* The header plus uCode will be copied to WOPCM via DMA, excluding any
236+ * other components */
237+ I915_WRITE(DMA_COPY_SIZE, guc_fw->header_size + guc_fw->ucode_size);
238+
253239 /* Set the source address for the new blob */
254− offset = i915_gem_obj_ggtt_offset(fw_obj);
240+ offset = i915_gem_obj_ggtt_offset(fw_obj) + guc_fw->header_offset;
255241 I915_WRITE(DMA_ADDR_0_LOW, lower_32_bits(offset));
256242 I915_WRITE(DMA_ADDR_0_HIGH, upper_32_bits(offset) & 0xFFFF);
257243
@@ -322,8 +308,8 @@ static int guc_ucode_xfer(struct drm_i915_private *dev_priv) · 64 unmodified lines
322308 I915_WRITE(GUC_SHIM_CONTROL, GUC_SHIM_CONTROL_VALUE);
323309
324310 /* WaDisableMinuteIaClockGating:skl,bxt */
325− if ((IS_SKYLAKE(dev) && INTEL_REVID(dev) <= SKL_REVID_B0) ||
326− (IS_BROXTON(dev) && INTEL_REVID(dev) == BXT_REVID_A0)) {
311+ if (IS_SKL_REVID(dev, 0, SKL_REVID_B0) ||
312+ IS_BXT_REVID(dev, 0, BXT_REVID_A1)) {
327313 I915_WRITE(GUC_SHIM_CONTROL, (I915_READ(GUC_SHIM_CONTROL) &
328314 ~GUC_ENABLE_MIA_CLOCK_GATING));
329315 }
@@ -378,6 +364,9 @@ int intel_guc_ucode_load(struct drm_device *dev) · 48 unmodified lines
378364 struct intel_guc_fw *guc_fw = &dev_priv->guc.guc_fw;
379365 int err = 0;
380366
367+ if (!i915.enable_guc_submission)
368+ return 0;
369+
381370 DRM_DEBUG_DRIVER("GuC fw status: fetch %s, load %s\n",
382371 intel_guc_fw_status_repr(guc_fw->guc_fw_fetch_status),
383372 intel_guc_fw_status_repr(guc_fw->guc_fw_load_status));
@@ -457,10 +446,8 @@ static void guc_fw_fetch(struct drm_device *dev, struct intel_guc_fw *guc_fw) · 73 unmodified lines
457446 {
458447 struct drm_i915_gem_object *obj;
459448 const struct firmware *fw;
460− const u8 *css_header;
461− const size_t minsize = UOS_CSS_HEADER_SIZE + UOS_RSA_SIG_SIZE;
462− const size_t maxsize = GUC_WOPCM_SIZE_VALUE + UOS_RSA_SIG_SIZE
463− - 0x8000; /* 32k reserved (8K stack + 24k context) */
449+ struct guc_css_header *css;
450+ size_t size;
464451 int err;
465452
466453 DRM_DEBUG_DRIVER("before requesting firmware: GuC fw fetch status %s\n",
@@ -474,12 +461,52 @@ static void guc_fw_fetch(struct drm_device *dev, struct intel_guc_fw *guc_fw) · 7 unmodified lines
474461
475462 DRM_DEBUG_DRIVER("fetch GuC fw from %s succeeded, fw %p\n",
476463 guc_fw->guc_fw_path, fw);
477− DRM_DEBUG_DRIVER("firmware file size %zu (minimum %zu, maximum %zu)\n",
478− fw->size, minsize, maxsize);
479464
480− /* Check the size of the blob befoe examining buffer contents */
481− if (fw->size < minsize || fw->size > maxsize)
465+ /* Check the size of the blob before examining buffer contents */
466+ if (fw->size < sizeof(struct guc_css_header)) {
467+ DRM_ERROR("Firmware header is missing\n");
482468 goto fail;
469+ }
470+
471+ css = (struct guc_css_header *)fw->data;
472+
473+ /* Firmware bits always start from header */
474+ guc_fw->header_offset = 0;
475+ guc_fw->header_size = (css->header_size_dw - css->modulus_size_dw -
476+ css->key_size_dw - css->exponent_size_dw) * sizeof(u32);
477+
478+ if (guc_fw->header_size != sizeof(struct guc_css_header)) {
479+ DRM_ERROR("CSS header definition mismatch\n");
480+ goto fail;
481+ }
482+
483+ /* then, uCode */
484+ guc_fw->ucode_offset = guc_fw->header_offset + guc_fw->header_size;
485+ guc_fw->ucode_size = (css->size_dw - css->header_size_dw) * sizeof(u32);
486+
487+ /* now RSA */
488+ if (css->key_size_dw != UOS_RSA_SCRATCH_MAX_COUNT) {
489+ DRM_ERROR("RSA key size is bad\n");
490+ goto fail;
491+ }
492+ guc_fw->rsa_offset = guc_fw->ucode_offset + guc_fw->ucode_size;
493+ guc_fw->rsa_size = css->key_size_dw * sizeof(u32);
494+
495+ /* At least, it should have header, uCode and RSA. Size of all three. */
496+ size = guc_fw->header_size + guc_fw->ucode_size + guc_fw->rsa_size;
497+ if (fw->size < size) {
498+ DRM_ERROR("Missing firmware components\n");
499+ goto fail;
500+ }
501+
502+ /* Header and uCode will be loaded to WOPCM. Size of the two. */
503+ size = guc_fw->header_size + guc_fw->ucode_size;
504+
505+ /* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */
506+ if (size > GUC_WOPCM_SIZE_VALUE - 0x8000) {
507+ DRM_ERROR("Firmware is too large to fit in WOPCM\n");
508+ goto fail;
509+ }
483510
484511 /*
485512 * The GuC firmware image has the version number embedded at a well-known
@@ -487,9 +514,8 @@ static void guc_fw_fetch(struct drm_device *dev, struct intel_guc_fw *guc_fw) · 1 unmodified line
487514 * TWO bytes each (i.e. u16), although all pointers and offsets are defined
488515 * in terms of bytes (u8).
489516 */
490− css_header = fw->data + UOS_CSS_HEADER_OFFSET;
491− guc_fw->guc_fw_major_found = *(u16 *)(css_header + UOS_VER_MAJOR_OFFSET);
492− guc_fw->guc_fw_minor_found = *(u16 *)(css_header + UOS_VER_MINOR_OFFSET);
517+ guc_fw->guc_fw_major_found = css->guc_sw_version >> 16;
518+ guc_fw->guc_fw_minor_found = css->guc_sw_version & 0xFFFF;
493519
494520 if (guc_fw->guc_fw_major_found != guc_fw->guc_fw_major_wanted ||
495521 guc_fw->guc_fw_minor_found < guc_fw->guc_fw_minor_wanted) {
@@ -566,6 +592,9 @@ void intel_guc_ucode_init(struct drm_device *dev) · 70 unmodified lines
566592 fw_path = ""; /* unknown device */
567593 }
568594
595+ if (!i915.enable_guc_submission)
596+ return;
597+
569598 guc_fw->guc_dev = dev;
570599 guc_fw->guc_fw_path = fw_path;
571600 guc_fw->guc_fw_fetch_status = GUC_FIRMWARE_NONE;
drivers/gpu/drm/i915/intel_hdmi.c+47−30
@@ -113,10 +113,11 @@ static u32 hsw_infoframe_enable(enum hdmi_infoframe_type type) · 112 unmodified lines
113113 }
114114 }
115115
116−static u32 hsw_dip_data_reg(struct drm_i915_private *dev_priv,
117− enum transcoder cpu_transcoder,
118− enum hdmi_infoframe_type type,
119− int i)
116+static i915_reg_t
117+hsw_dip_data_reg(struct drm_i915_private *dev_priv,
118+ enum transcoder cpu_transcoder,
119+ enum hdmi_infoframe_type type,
120+ int i)
120121 {
121122 switch (type) {
122123 case HDMI_INFOFRAME_TYPE_AVI:
@@ -127,7 +128,7 @@ static u32 hsw_dip_data_reg(struct drm_i915_private *dev_priv, · 4 unmodified lines
127128 return HSW_TVIDEO_DIP_VS_DATA(cpu_transcoder, i);
128129 default:
129130 DRM_DEBUG_DRIVER("unknown info frame type %d\n", type);
130− return 0;
131+ return INVALID_MMIO_REG;
131132 }
132133 }
133134
@@ -193,8 +194,9 @@ static void ibx_write_infoframe(struct drm_encoder *encoder, · 59 unmodified lines
193194 struct drm_device *dev = encoder->dev;
194195 struct drm_i915_private *dev_priv = dev->dev_private;
195196 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
196− int i, reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
197+ i915_reg_t reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
197198 u32 val = I915_READ(reg);
199+ int i;
198200
199201 WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
200202
@@ -229,7 +231,7 @@ static bool ibx_infoframe_enabled(struct drm_encoder *encoder) · 28 unmodified lines
229231 struct drm_i915_private *dev_priv = dev->dev_private;
230232 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
231233 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
232− int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
234+ i915_reg_t reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
233235 u32 val = I915_READ(reg);
234236
235237 if ((val & VIDEO_DIP_ENABLE) == 0)
@@ -251,8 +253,9 @@ static void cpt_write_infoframe(struct drm_encoder *encoder, · 15 unmodified lines
251253 struct drm_device *dev = encoder->dev;
252254 struct drm_i915_private *dev_priv = dev->dev_private;
253255 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
254− int i, reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
256+ i915_reg_t reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
255257 u32 val = I915_READ(reg);
258+ int i;
256259
257260 WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
258261
@@ -289,8 +292,7 @@ static bool cpt_infoframe_enabled(struct drm_encoder *encoder) · 30 unmodified lines
289292 struct drm_device *dev = encoder->dev;
290293 struct drm_i915_private *dev_priv = dev->dev_private;
291294 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
292− int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
293− u32 val = I915_READ(reg);
295+ u32 val = I915_READ(TVIDEO_DIP_CTL(intel_crtc->pipe));
294296
295297 if ((val & VIDEO_DIP_ENABLE) == 0)
296298 return false;
@@ -308,8 +310,9 @@ static void vlv_write_infoframe(struct drm_encoder *encoder, · 11 unmodified lines
308310 struct drm_device *dev = encoder->dev;
309311 struct drm_i915_private *dev_priv = dev->dev_private;
310312 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
311− int i, reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
313+ i915_reg_t reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
312314 u32 val = I915_READ(reg);
315+ int i;
313316
314317 WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
315318
@@ -344,8 +347,7 @@ static bool vlv_infoframe_enabled(struct drm_encoder *encoder) · 28 unmodified lines
344347 struct drm_i915_private *dev_priv = dev->dev_private;
345348 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
346349 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
347− int reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
348− u32 val = I915_READ(reg);
350+ u32 val = I915_READ(VLV_TVIDEO_DIP_CTL(intel_crtc->pipe));
349351
350352 if ((val & VIDEO_DIP_ENABLE) == 0)
351353 return false;
@@ -367,13 +369,13 @@ static void hsw_write_infoframe(struct drm_encoder *encoder, · 15 unmodified lines
367369 struct drm_i915_private *dev_priv = dev->dev_private;
368370 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
369371 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
370− u32 ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder);
371− u32 data_reg;
372+ i915_reg_t ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder);
373+ i915_reg_t data_reg;
372374 int i;
373375 u32 val = I915_READ(ctl_reg);
374376
375377 data_reg = hsw_dip_data_reg(dev_priv, cpu_transcoder, type, 0);
376− if (data_reg == 0)
378+ if (i915_mmio_reg_valid(data_reg))
377379 return;
378380
379381 val &= ~hsw_infoframe_enable(type);
@@ -401,8 +403,7 @@ static bool hsw_infoframe_enabled(struct drm_encoder *encoder) · 21 unmodified lines
401403 struct drm_device *dev = encoder->dev;
402404 struct drm_i915_private *dev_priv = dev->dev_private;
403405 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
404− u32 ctl_reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder);
405− u32 val = I915_READ(ctl_reg);
406+ u32 val = I915_READ(HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder));
406407
407408 return val & (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
408409 VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
@@ -513,7 +514,7 @@ static void g4x_set_infoframes(struct drm_encoder *encoder, · 104 unmodified lines
513514 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
514515 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
515516 struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
516− u32 reg = VIDEO_DIP_CTL;
517+ i915_reg_t reg = VIDEO_DIP_CTL;
517518 u32 val = I915_READ(reg);
518519 u32 port = VIDEO_DIP_PORT(intel_dig_port->port);
519520
@@ -633,7 +634,8 @@ static bool intel_hdmi_set_gcp_infoframe(struct drm_encoder *encoder) · 113 unmodified lines
633634 {
634635 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
635636 struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
636− u32 reg, val = 0;
637+ i915_reg_t reg;
638+ u32 val = 0;
637639
638640 if (HAS_DDI(dev_priv))
639641 reg = HSW_TVIDEO_DIP_GCP(crtc->config->cpu_transcoder);
@@ -666,7 +668,7 @@ static void ibx_set_infoframes(struct drm_encoder *encoder, · 26 unmodified lines
666668 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
667669 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
668670 struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
669− u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
671+ i915_reg_t reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
670672 u32 val = I915_READ(reg);
671673 u32 port = VIDEO_DIP_PORT(intel_dig_port->port);
672674
@@ -717,7 +719,7 @@ static void cpt_set_infoframes(struct drm_encoder *encoder, · 44 unmodified lines
717719 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
718720 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
719721 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
720− u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
722+ i915_reg_t reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
721723 u32 val = I915_READ(reg);
722724
723725 assert_hdmi_port_disabled(intel_hdmi);
@@ -760,7 +762,7 @@ static void vlv_set_infoframes(struct drm_encoder *encoder, · 36 unmodified lines
760762 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
761763 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
762764 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
763− u32 reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
765+ i915_reg_t reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
764766 u32 val = I915_READ(reg);
765767 u32 port = VIDEO_DIP_PORT(intel_dig_port->port);
766768
@@ -811,7 +813,7 @@ static void hsw_set_infoframes(struct drm_encoder *encoder, · 44 unmodified lines
811813 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
812814 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
813815 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
814− u32 reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder);
816+ i915_reg_t reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder);
815817 u32 val = I915_READ(reg);
816818
817819 assert_hdmi_port_disabled(intel_hdmi);
@@ -1108,6 +1110,13 @@ static void intel_disable_hdmi(struct intel_encoder *encoder) · 290 unmodified lines
11081110 * matching DP port to be enabled on transcoder A.
11091111 */
11101112 if (HAS_PCH_IBX(dev) && crtc->pipe == PIPE_B) {
1113+ /*
1114+ * We get CPU/PCH FIFO underruns on the other pipe when
1115+ * doing the workaround. Sweep them under the rug.
1116+ */
1117+ intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, false);
1118+ intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, false);
1119+
11111120 temp &= ~SDVO_PIPE_B_SELECT;
11121121 temp |= SDVO_ENABLE;
11131122 /*
@@ -1122,6 +1131,10 @@ static void intel_disable_hdmi(struct intel_encoder *encoder) · 8 unmodified lines
11221131 temp &= ~SDVO_ENABLE;
11231132 I915_WRITE(intel_hdmi->hdmi_reg, temp);
11241133 POSTING_READ(intel_hdmi->hdmi_reg);
1134+
1135+ intel_wait_for_vblank_if_active(dev_priv->dev, PIPE_A);
1136+ intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, true);
1137+ intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
11251138 }
11261139
11271140 intel_hdmi->set_infoframes(&encoder->base, false, NULL);
@@ -1338,14 +1351,15 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force) · 210 unmodified lines
13381351 struct edid *edid = NULL;
13391352 bool connected = false;
13401353
1341− intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
1354+ if (force) {
1355+ intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
13421356
1343− if (force)
13441357 edid = drm_get_edid(connector,
13451358 intel_gmbus_get_adapter(dev_priv,
13461359 intel_hdmi->ddc_bus));
13471360
1348− intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
1361+ intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
1362+ }
13491363
13501364 to_intel_connector(connector)->detect_edid = edid;
13511365 if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) {
@@ -2040,7 +2054,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, · 688 unmodified lines
20402054 * On BXT A0/A1, sw needs to activate DDIA HPD logic and
20412055 * interrupts to check the external panel connection.
20422056 */
2043− if (IS_BROXTON(dev_priv) && (INTEL_REVID(dev) < BXT_REVID_B0))
2057+ if (IS_BXT_REVID(dev_priv, 0, BXT_REVID_A1))
20442058 intel_encoder->hpd_pin = HPD_PORT_A;
20452059 else
20462060 intel_encoder->hpd_pin = HPD_PORT_B;
@@ -2132,8 +2146,10 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, · 85 unmodified lines
21322146 }
21332147 }
21342148
2135−void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port)
2149+void intel_hdmi_init(struct drm_device *dev,
2150+ i915_reg_t hdmi_reg, enum port port)
21362151 {
2152+ struct drm_i915_private *dev_priv = dev->dev_private;
21372153 struct intel_digital_port *intel_dig_port;
21382154 struct intel_encoder *intel_encoder;
21392155 struct intel_connector *intel_connector;
@@ -2202,8 +2218,9 @@ void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port) · 62 unmodified lines
22022218 intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
22032219
22042220 intel_dig_port->port = port;
2221+ dev_priv->dig_port_map[port] = intel_encoder;
22052222 intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
2206− intel_dig_port->dp.output_reg = 0;
2223+ intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
22072224
22082225 intel_hdmi_init_connector(intel_dig_port, intel_connector);
22092226 }
drivers/gpu/drm/i915/intel_i2c.c+16−15
@@ -36,7 +36,7 @@ · 35 unmodified lines
3636
3737 struct gmbus_pin {
3838 const char *name;
39− int reg;
39+ i915_reg_t reg;
4040 };
4141
4242 /* Map gmbus pin pairs to names and registers. */
@@ -63,9 +63,9 @@ static const struct gmbus_pin gmbus_pins_skl[] = { · 20 unmodified lines
6363 };
6464
6565 static const struct gmbus_pin gmbus_pins_bxt[] = {
66− [GMBUS_PIN_1_BXT] = { "dpb", PCH_GPIOB },
67− [GMBUS_PIN_2_BXT] = { "dpc", PCH_GPIOC },
68− [GMBUS_PIN_3_BXT] = { "misc", PCH_GPIOD },
66+ [GMBUS_PIN_1_BXT] = { "dpb", GPIOB },
67+ [GMBUS_PIN_2_BXT] = { "dpc", GPIOC },
68+ [GMBUS_PIN_3_BXT] = { "misc", GPIOD },
6969 };
7070
7171 /* pin is expected to be valid */
@@ -74,7 +74,7 @@ static const struct gmbus_pin *get_gmbus_pin(struct drm_i915_private *dev_priv, · 2 unmodified lines
7474 {
7575 if (IS_BROXTON(dev_priv))
7676 return &gmbus_pins_bxt[pin];
77− else if (IS_SKYLAKE(dev_priv))
77+ else if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv))
7878 return &gmbus_pins_skl[pin];
7979 else if (IS_BROADWELL(dev_priv))
8080 return &gmbus_pins_bdw[pin];
@@ -89,14 +89,15 @@ bool intel_gmbus_is_valid_pin(struct drm_i915_private *dev_priv, · 8 unmodified lines
8989
9090 if (IS_BROXTON(dev_priv))
9191 size = ARRAY_SIZE(gmbus_pins_bxt);
92− else if (IS_SKYLAKE(dev_priv))
92+ else if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv))
9393 size = ARRAY_SIZE(gmbus_pins_skl);
9494 else if (IS_BROADWELL(dev_priv))
9595 size = ARRAY_SIZE(gmbus_pins_bdw);
9696 else
9797 size = ARRAY_SIZE(gmbus_pins);
9898
99− return pin < size && get_gmbus_pin(dev_priv, pin)->reg;
99+ return pin < size &&
100+ i915_mmio_reg_valid(get_gmbus_pin(dev_priv, pin)->reg);
100101 }
101102
102103 /* Intel GPIO access functions */
@@ -240,9 +241,8 @@ intel_gpio_setup(struct intel_gmbus *bus, unsigned int pin) · 137 unmodified lines
240241
241242 algo = &bus->bit_algo;
242243
243− bus->gpio_reg = dev_priv->gpio_mmio_base +
244− get_gmbus_pin(dev_priv, pin)->reg;
245−
244+ bus->gpio_reg = _MMIO(dev_priv->gpio_mmio_base +
245+ i915_mmio_reg_offset(get_gmbus_pin(dev_priv, pin)->reg));
246246 bus->adapter.algo_data = algo;
247247 algo->setsda = set_data;
248248 algo->setscl = set_clock;
@@ -628,12 +628,13 @@ int intel_setup_gmbus(struct drm_device *dev) · 379 unmodified lines
628628
629629 if (HAS_PCH_NOP(dev))
630630 return 0;
631− else if (HAS_PCH_SPLIT(dev))
632− dev_priv->gpio_mmio_base = PCH_GPIOA - GPIOA;
633− else if (IS_VALLEYVIEW(dev))
631+
632+ if (IS_VALLEYVIEW(dev))
634633 dev_priv->gpio_mmio_base = VLV_DISPLAY_BASE;
635− else
636− dev_priv->gpio_mmio_base = 0;
634+ else if (!HAS_GMCH_DISPLAY(dev_priv))
635+ dev_priv->gpio_mmio_base =
636+ i915_mmio_reg_offset(PCH_GPIOA) -
637+ i915_mmio_reg_offset(GPIOA);
637638
638639 mutex_init(&dev_priv->gmbus_mutex);
639640 init_waitqueue_head(&dev_priv->gmbus_wait_queue);
drivers/gpu/drm/i915/intel_lrc.c+67−81
@@ -190,16 +190,21 @@ · 189 unmodified lines
190190 #define GEN8_CTX_L3LLC_COHERENT (1<<5)
191191 #define GEN8_CTX_PRIVILEGE (1<<8)
192192
193−#define ASSIGN_CTX_PDP(ppgtt, reg_state, n) { \
193+#define ASSIGN_CTX_REG(reg_state, pos, reg, val) do { \
194+ (reg_state)[(pos)+0] = i915_mmio_reg_offset(reg); \
195+ (reg_state)[(pos)+1] = (val); \
196+} while (0)
197+
198+#define ASSIGN_CTX_PDP(ppgtt, reg_state, n) do { \
194199 const u64 _addr = i915_page_dir_dma_addr((ppgtt), (n)); \
195200 reg_state[CTX_PDP ## n ## _UDW+1] = upper_32_bits(_addr); \
196201 reg_state[CTX_PDP ## n ## _LDW+1] = lower_32_bits(_addr); \
197−}
202+} while (0)
198203
199−#define ASSIGN_CTX_PML4(ppgtt, reg_state) { \
204+#define ASSIGN_CTX_PML4(ppgtt, reg_state) do { \
200205 reg_state[CTX_PDP0_UDW + 1] = upper_32_bits(px_dma(&ppgtt->pml4)); \
201206 reg_state[CTX_PDP0_LDW + 1] = lower_32_bits(px_dma(&ppgtt->pml4)); \
202−}
207+} while (0)
203208
204209 enum {
205210 ADVANCED_CONTEXT = 0,
@@ -284,8 +289,8 @@ static bool disable_lite_restore_wa(struct intel_engine_cs *ring) · 78 unmodified lines
284289 {
285290 struct drm_device *dev = ring->dev;
286291
287− return ((IS_SKYLAKE(dev) && INTEL_REVID(dev) <= SKL_REVID_B0) ||
288− (IS_BROXTON(dev) && INTEL_REVID(dev) == BXT_REVID_A0)) &&
292+ return (IS_SKL_REVID(dev, 0, SKL_REVID_B0) ||
293+ IS_BXT_REVID(dev, 0, BXT_REVID_A1)) &&
289294 (ring->id == VCS || ring->id == VCS2);
290295 }
291296
@@ -921,7 +926,7 @@ int intel_execlists_submission(struct i915_execbuffer_params *params, · 629 unmodified lines
921926
922927 intel_logical_ring_emit(ringbuf, MI_NOOP);
923928 intel_logical_ring_emit(ringbuf, MI_LOAD_REGISTER_IMM(1));
924− intel_logical_ring_emit(ringbuf, INSTPM);
929+ intel_logical_ring_emit_reg(ringbuf, INSTPM);
925930 intel_logical_ring_emit(ringbuf, instp_mask << 16 | instp_mode);
926931 intel_logical_ring_advance(ringbuf);
927932
@@ -1096,7 +1101,7 @@ static int intel_logical_ring_workarounds_emit(struct drm_i915_gem_request *req) · 168 unmodified lines
10961101
10971102 intel_logical_ring_emit(ringbuf, MI_LOAD_REGISTER_IMM(w->count));
10981103 for (i = 0; i < w->count; i++) {
1099− intel_logical_ring_emit(ringbuf, w->reg[i].addr);
1104+ intel_logical_ring_emit_reg(ringbuf, w->reg[i].addr);
11001105 intel_logical_ring_emit(ringbuf, w->reg[i].value);
11011106 }
11021107 intel_logical_ring_emit(ringbuf, MI_NOOP);
@@ -1120,6 +1125,8 @@ static int intel_logical_ring_workarounds_emit(struct drm_i915_gem_request *req) · 17 unmodified lines
11201125 batch[__index] = (cmd); \
11211126 } while (0)
11221127
1128+#define wa_ctx_emit_reg(batch, index, reg) \
1129+ wa_ctx_emit((batch), (index), i915_mmio_reg_offset(reg))
11231130
11241131 /*
11251132 * In this WA we need to set GEN8_L3SQCREG4[21:21] and reset it after
@@ -1149,17 +1156,17 @@ static inline int gen8_emit_flush_coherentl3_wa(struct intel_engine_cs *ring, · 23 unmodified lines
11491156 * this batch updates GEN8_L3SQCREG4 with default value we need to
11501157 * set this bit here to retain the WA during flush.
11511158 */
1152− if (IS_SKYLAKE(ring->dev) && INTEL_REVID(ring->dev) <= SKL_REVID_E0)
1159+ if (IS_SKL_REVID(ring->dev, 0, SKL_REVID_E0))
11531160 l3sqc4_flush |= GEN8_LQSC_RO_PERF_DIS;
11541161
11551162 wa_ctx_emit(batch, index, (MI_STORE_REGISTER_MEM_GEN8 |
11561163 MI_SRM_LRM_GLOBAL_GTT));
1157− wa_ctx_emit(batch, index, GEN8_L3SQCREG4);
1164+ wa_ctx_emit_reg(batch, index, GEN8_L3SQCREG4);
11581165 wa_ctx_emit(batch, index, ring->scratch.gtt_offset + 256);
11591166 wa_ctx_emit(batch, index, 0);
11601167
11611168 wa_ctx_emit(batch, index, MI_LOAD_REGISTER_IMM(1));
1162− wa_ctx_emit(batch, index, GEN8_L3SQCREG4);
1169+ wa_ctx_emit_reg(batch, index, GEN8_L3SQCREG4);
11631170 wa_ctx_emit(batch, index, l3sqc4_flush);
11641171
11651172 wa_ctx_emit(batch, index, GFX_OP_PIPE_CONTROL(6));
@@ -1172,7 +1179,7 @@ static inline int gen8_emit_flush_coherentl3_wa(struct intel_engine_cs *ring, · 6 unmodified lines
11721179
11731180 wa_ctx_emit(batch, index, (MI_LOAD_REGISTER_MEM_GEN8 |
11741181 MI_SRM_LRM_GLOBAL_GTT));
1175− wa_ctx_emit(batch, index, GEN8_L3SQCREG4);
1182+ wa_ctx_emit_reg(batch, index, GEN8_L3SQCREG4);
11761183 wa_ctx_emit(batch, index, ring->scratch.gtt_offset + 256);
11771184 wa_ctx_emit(batch, index, 0);
11781185
@@ -1314,8 +1321,8 @@ static int gen9_init_indirectctx_bb(struct intel_engine_cs *ring, · 135 unmodified lines
13141321 uint32_t index = wa_ctx_start(wa_ctx, *offset, CACHELINE_DWORDS);
13151322
13161323 /* WaDisableCtxRestoreArbitration:skl,bxt */
1317− if ((IS_SKYLAKE(dev) && (INTEL_REVID(dev) <= SKL_REVID_D0)) ||
1318− (IS_BROXTON(dev) && (INTEL_REVID(dev) == BXT_REVID_A0)))
1324+ if (IS_SKL_REVID(dev, 0, SKL_REVID_D0) ||
1325+ IS_BXT_REVID(dev, 0, BXT_REVID_A1))
13191326 wa_ctx_emit(batch, index, MI_ARB_ON_OFF | MI_ARB_DISABLE);
13201327
13211328 /* WaFlushCoherentL3CacheLinesAtContextSwitch:skl,bxt */
@@ -1340,18 +1347,18 @@ static int gen9_init_perctx_bb(struct intel_engine_cs *ring, · 18 unmodified lines
13401347 uint32_t index = wa_ctx_start(wa_ctx, *offset, CACHELINE_DWORDS);
13411348
13421349 /* WaSetDisablePixMaskCammingAndRhwoInCommonSliceChicken:skl,bxt */
1343− if ((IS_SKYLAKE(dev) && (INTEL_REVID(dev) <= SKL_REVID_B0)) ||
1344− (IS_BROXTON(dev) && (INTEL_REVID(dev) == BXT_REVID_A0))) {
1350+ if (IS_SKL_REVID(dev, 0, SKL_REVID_B0) ||
1351+ IS_BXT_REVID(dev, 0, BXT_REVID_A1)) {
13451352 wa_ctx_emit(batch, index, MI_LOAD_REGISTER_IMM(1));
1346− wa_ctx_emit(batch, index, GEN9_SLICE_COMMON_ECO_CHICKEN0);
1353+ wa_ctx_emit_reg(batch, index, GEN9_SLICE_COMMON_ECO_CHICKEN0);
13471354 wa_ctx_emit(batch, index,
13481355 _MASKED_BIT_ENABLE(DISABLE_PIXEL_MASK_CAMMING));
13491356 wa_ctx_emit(batch, index, MI_NOOP);
13501357 }
13511358
13521359 /* WaDisableCtxRestoreArbitration:skl,bxt */
1353− if ((IS_SKYLAKE(dev) && (INTEL_REVID(dev) <= SKL_REVID_D0)) ||
1354− (IS_BROXTON(dev) && (INTEL_REVID(dev) == BXT_REVID_A0)))
1360+ if (IS_SKL_REVID(dev, 0, SKL_REVID_D0) ||
1361+ IS_BXT_REVID(dev, 0, BXT_REVID_A1))
13551362 wa_ctx_emit(batch, index, MI_ARB_ON_OFF | MI_ARB_ENABLE);
13561363
13571364 wa_ctx_emit(batch, index, MI_BATCH_BUFFER_END);
@@ -1472,12 +1479,6 @@ static int gen8_init_common_ring(struct intel_engine_cs *ring) · 114 unmodified lines
14721479 I915_WRITE_IMR(ring, ~(ring->irq_enable_mask | ring->irq_keep_mask));
14731480 I915_WRITE(RING_HWSTAM(ring->mmio_base), 0xffffffff);
14741481
1475− if (ring->status_page.obj) {
1476− I915_WRITE(RING_HWS_PGA(ring->mmio_base),
1477− (u32)ring->status_page.gfx_addr);
1478− POSTING_READ(RING_HWS_PGA(ring->mmio_base));
1479− }
1480−
14811482 I915_WRITE(RING_MODE_GEN7(ring),
14821483 _MASKED_BIT_DISABLE(GFX_REPLAY_MODE) |
14831484 _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE));
@@ -1562,9 +1563,9 @@ static int intel_logical_ring_emit_pdps(struct drm_i915_gem_request *req) · 78 unmodified lines
15621563 for (i = GEN8_LEGACY_PDPES - 1; i >= 0; i--) {
15631564 const dma_addr_t pd_daddr = i915_page_dir_dma_addr(ppgtt, i);
15641565
1565− intel_logical_ring_emit(ringbuf, GEN8_RING_PDP_UDW(ring, i));
1566+ intel_logical_ring_emit_reg(ringbuf, GEN8_RING_PDP_UDW(ring, i));
15661567 intel_logical_ring_emit(ringbuf, upper_32_bits(pd_daddr));
1567− intel_logical_ring_emit(ringbuf, GEN8_RING_PDP_LDW(ring, i));
1568+ intel_logical_ring_emit_reg(ringbuf, GEN8_RING_PDP_LDW(ring, i));
15681569 intel_logical_ring_emit(ringbuf, lower_32_bits(pd_daddr));
15691570 }
15701571
@@ -1923,6 +1924,7 @@ static int logical_ring_init(struct drm_device *dev, struct intel_engine_cs *rin · 352 unmodified lines
19231924 i915_gem_batch_pool_init(dev, &ring->batch_pool);
19241925 init_waitqueue_head(&ring->irq_queue);
19251926
1927+ INIT_LIST_HEAD(&ring->buffers);
19261928 INIT_LIST_HEAD(&ring->execlist_queue);
19271929 INIT_LIST_HEAD(&ring->execlist_retired_req_list);
19281930 spin_lock_init(&ring->execlist_lock);
@@ -1972,7 +1974,7 @@ static int logical_render_ring_init(struct drm_device *dev) · 43 unmodified lines
19721974 ring->init_hw = gen8_init_render_ring;
19731975 ring->init_context = gen8_init_rcs_context;
19741976 ring->cleanup = intel_fini_pipe_control;
1975− if (IS_BROXTON(dev) && INTEL_REVID(dev) < BXT_REVID_B0) {
1977+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1)) {
19761978 ring->get_seqno = bxt_a_get_seqno;
19771979 ring->set_seqno = bxt_a_set_seqno;
19781980 } else {
@@ -2024,7 +2026,7 @@ static int logical_bsd_ring_init(struct drm_device *dev) · 45 unmodified lines
20242026 GT_CONTEXT_SWITCH_INTERRUPT << GEN8_VCS1_IRQ_SHIFT;
20252027
20262028 ring->init_hw = gen8_init_common_ring;
2027− if (IS_BROXTON(dev) && INTEL_REVID(dev) < BXT_REVID_B0) {
2029+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1)) {
20282030 ring->get_seqno = bxt_a_get_seqno;
20292031 ring->set_seqno = bxt_a_set_seqno;
20302032 } else {
@@ -2079,7 +2081,7 @@ static int logical_blt_ring_init(struct drm_device *dev) · 48 unmodified lines
20792081 GT_CONTEXT_SWITCH_INTERRUPT << GEN8_BCS_IRQ_SHIFT;
20802082
20812083 ring->init_hw = gen8_init_common_ring;
2082− if (IS_BROXTON(dev) && INTEL_REVID(dev) < BXT_REVID_B0) {
2084+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1)) {
20832085 ring->get_seqno = bxt_a_get_seqno;
20842086 ring->set_seqno = bxt_a_set_seqno;
20852087 } else {
@@ -2109,7 +2111,7 @@ static int logical_vebox_ring_init(struct drm_device *dev) · 23 unmodified lines
21092111 GT_CONTEXT_SWITCH_INTERRUPT << GEN8_VECS_IRQ_SHIFT;
21102112
21112113 ring->init_hw = gen8_init_common_ring;
2112− if (IS_BROXTON(dev) && INTEL_REVID(dev) < BXT_REVID_B0) {
2114+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1)) {
21132115 ring->get_seqno = bxt_a_get_seqno;
21142116 ring->set_seqno = bxt_a_set_seqno;
21152117 } else {
@@ -2263,46 +2265,31 @@ populate_lr_context(struct intel_context *ctx, struct drm_i915_gem_object *ctx_o · 147 unmodified lines
22632265 * only for the first context restore: on a subsequent save, the GPU will
22642266 * recreate this batchbuffer with new values (including all the missing
22652267 * MI_LOAD_REGISTER_IMM commands that we are not initializing here). */
2266− if (ring->id == RCS)
2267− reg_state[CTX_LRI_HEADER_0] = MI_LOAD_REGISTER_IMM(14);
2268− else
2269− reg_state[CTX_LRI_HEADER_0] = MI_LOAD_REGISTER_IMM(11);
2270− reg_state[CTX_LRI_HEADER_0] |= MI_LRI_FORCE_POSTED;
2271− reg_state[CTX_CONTEXT_CONTROL] = RING_CONTEXT_CONTROL(ring);
2272− reg_state[CTX_CONTEXT_CONTROL+1] =
2273− _MASKED_BIT_ENABLE(CTX_CTRL_INHIBIT_SYN_CTX_SWITCH |
2274− CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT |
2275− CTX_CTRL_RS_CTX_ENABLE);
2276− reg_state[CTX_RING_HEAD] = RING_HEAD(ring->mmio_base);
2277− reg_state[CTX_RING_HEAD+1] = 0;
2278− reg_state[CTX_RING_TAIL] = RING_TAIL(ring->mmio_base);
2279− reg_state[CTX_RING_TAIL+1] = 0;
2280− reg_state[CTX_RING_BUFFER_START] = RING_START(ring->mmio_base);
2268+ reg_state[CTX_LRI_HEADER_0] =
2269+ MI_LOAD_REGISTER_IMM(ring->id == RCS ? 14 : 11) | MI_LRI_FORCE_POSTED;
2270+ ASSIGN_CTX_REG(reg_state, CTX_CONTEXT_CONTROL, RING_CONTEXT_CONTROL(ring),
2271+ _MASKED_BIT_ENABLE(CTX_CTRL_INHIBIT_SYN_CTX_SWITCH |
2272+ CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT |
2273+ CTX_CTRL_RS_CTX_ENABLE));
2274+ ASSIGN_CTX_REG(reg_state, CTX_RING_HEAD, RING_HEAD(ring->mmio_base), 0);
2275+ ASSIGN_CTX_REG(reg_state, CTX_RING_TAIL, RING_TAIL(ring->mmio_base), 0);
22812276 /* Ring buffer start address is not known until the buffer is pinned.
22822277 * It is written to the context image in execlists_update_context()
22832278 */
2284− reg_state[CTX_RING_BUFFER_CONTROL] = RING_CTL(ring->mmio_base);
2285− reg_state[CTX_RING_BUFFER_CONTROL+1] =
2286− ((ringbuf->size - PAGE_SIZE) & RING_NR_PAGES) | RING_VALID;
2287− reg_state[CTX_BB_HEAD_U] = ring->mmio_base + 0x168;
2288− reg_state[CTX_BB_HEAD_U+1] = 0;
2289− reg_state[CTX_BB_HEAD_L] = ring->mmio_base + 0x140;
2290− reg_state[CTX_BB_HEAD_L+1] = 0;
2291− reg_state[CTX_BB_STATE] = ring->mmio_base + 0x110;
2292− reg_state[CTX_BB_STATE+1] = (1<<5);
2293− reg_state[CTX_SECOND_BB_HEAD_U] = ring->mmio_base + 0x11c;
2294− reg_state[CTX_SECOND_BB_HEAD_U+1] = 0;
2295− reg_state[CTX_SECOND_BB_HEAD_L] = ring->mmio_base + 0x114;
2296− reg_state[CTX_SECOND_BB_HEAD_L+1] = 0;
2297− reg_state[CTX_SECOND_BB_STATE] = ring->mmio_base + 0x118;
2298− reg_state[CTX_SECOND_BB_STATE+1] = 0;
2279+ ASSIGN_CTX_REG(reg_state, CTX_RING_BUFFER_START, RING_START(ring->mmio_base), 0);
2280+ ASSIGN_CTX_REG(reg_state, CTX_RING_BUFFER_CONTROL, RING_CTL(ring->mmio_base),
2281+ ((ringbuf->size - PAGE_SIZE) & RING_NR_PAGES) | RING_VALID);
2282+ ASSIGN_CTX_REG(reg_state, CTX_BB_HEAD_U, RING_BBADDR_UDW(ring->mmio_base), 0);
2283+ ASSIGN_CTX_REG(reg_state, CTX_BB_HEAD_L, RING_BBADDR(ring->mmio_base), 0);
2284+ ASSIGN_CTX_REG(reg_state, CTX_BB_STATE, RING_BBSTATE(ring->mmio_base),
2285+ RING_BB_PPGTT);
2286+ ASSIGN_CTX_REG(reg_state, CTX_SECOND_BB_HEAD_U, RING_SBBADDR_UDW(ring->mmio_base), 0);
2287+ ASSIGN_CTX_REG(reg_state, CTX_SECOND_BB_HEAD_L, RING_SBBADDR(ring->mmio_base), 0);
2288+ ASSIGN_CTX_REG(reg_state, CTX_SECOND_BB_STATE, RING_SBBSTATE(ring->mmio_base), 0);
22992289 if (ring->id == RCS) {
2300− reg_state[CTX_BB_PER_CTX_PTR] = ring->mmio_base + 0x1c0;
2301− reg_state[CTX_BB_PER_CTX_PTR+1] = 0;
2302− reg_state[CTX_RCS_INDIRECT_CTX] = ring->mmio_base + 0x1c4;
2303− reg_state[CTX_RCS_INDIRECT_CTX+1] = 0;
2304− reg_state[CTX_RCS_INDIRECT_CTX_OFFSET] = ring->mmio_base + 0x1c8;
2305− reg_state[CTX_RCS_INDIRECT_CTX_OFFSET+1] = 0;
2290+ ASSIGN_CTX_REG(reg_state, CTX_BB_PER_CTX_PTR, RING_BB_PER_CTX_PTR(ring->mmio_base), 0);
2291+ ASSIGN_CTX_REG(reg_state, CTX_RCS_INDIRECT_CTX, RING_INDIRECT_CTX(ring->mmio_base), 0);
2292+ ASSIGN_CTX_REG(reg_state, CTX_RCS_INDIRECT_CTX_OFFSET, RING_INDIRECT_CTX_OFFSET(ring->mmio_base), 0);
23062293 if (ring->wa_ctx.obj) {
23072294 struct i915_ctx_workarounds *wa_ctx = &ring->wa_ctx;
23082295 uint32_t ggtt_offset = i915_gem_obj_ggtt_offset(wa_ctx->obj);
@@ -2319,18 +2306,17 @@ populate_lr_context(struct intel_context *ctx, struct drm_i915_gem_object *ctx_o · 10 unmodified lines
23192306 0x01;
23202307 }
23212308 }
2322− reg_state[CTX_LRI_HEADER_1] = MI_LOAD_REGISTER_IMM(9);
2323− reg_state[CTX_LRI_HEADER_1] |= MI_LRI_FORCE_POSTED;
2324− reg_state[CTX_CTX_TIMESTAMP] = ring->mmio_base + 0x3a8;
2325− reg_state[CTX_CTX_TIMESTAMP+1] = 0;
2326− reg_state[CTX_PDP3_UDW] = GEN8_RING_PDP_UDW(ring, 3);
2327− reg_state[CTX_PDP3_LDW] = GEN8_RING_PDP_LDW(ring, 3);
2328− reg_state[CTX_PDP2_UDW] = GEN8_RING_PDP_UDW(ring, 2);
2329− reg_state[CTX_PDP2_LDW] = GEN8_RING_PDP_LDW(ring, 2);
2330− reg_state[CTX_PDP1_UDW] = GEN8_RING_PDP_UDW(ring, 1);
2331− reg_state[CTX_PDP1_LDW] = GEN8_RING_PDP_LDW(ring, 1);
2332− reg_state[CTX_PDP0_UDW] = GEN8_RING_PDP_UDW(ring, 0);
2333− reg_state[CTX_PDP0_LDW] = GEN8_RING_PDP_LDW(ring, 0);
2309+ reg_state[CTX_LRI_HEADER_1] = MI_LOAD_REGISTER_IMM(9) | MI_LRI_FORCE_POSTED;
2310+ ASSIGN_CTX_REG(reg_state, CTX_CTX_TIMESTAMP, RING_CTX_TIMESTAMP(ring->mmio_base), 0);
2311+ /* PDP values well be assigned later if needed */
2312+ ASSIGN_CTX_REG(reg_state, CTX_PDP3_UDW, GEN8_RING_PDP_UDW(ring, 3), 0);
2313+ ASSIGN_CTX_REG(reg_state, CTX_PDP3_LDW, GEN8_RING_PDP_LDW(ring, 3), 0);
2314+ ASSIGN_CTX_REG(reg_state, CTX_PDP2_UDW, GEN8_RING_PDP_UDW(ring, 2), 0);
2315+ ASSIGN_CTX_REG(reg_state, CTX_PDP2_LDW, GEN8_RING_PDP_LDW(ring, 2), 0);
2316+ ASSIGN_CTX_REG(reg_state, CTX_PDP1_UDW, GEN8_RING_PDP_UDW(ring, 1), 0);
2317+ ASSIGN_CTX_REG(reg_state, CTX_PDP1_LDW, GEN8_RING_PDP_LDW(ring, 1), 0);
2318+ ASSIGN_CTX_REG(reg_state, CTX_PDP0_UDW, GEN8_RING_PDP_UDW(ring, 0), 0);
2319+ ASSIGN_CTX_REG(reg_state, CTX_PDP0_LDW, GEN8_RING_PDP_LDW(ring, 0), 0);
23342320
23352321 if (USES_FULL_48BIT_PPGTT(ppgtt->base.dev)) {
23362322 /* 64b PPGTT (48bit canonical)
@@ -2352,8 +2338,8 @@ populate_lr_context(struct intel_context *ctx, struct drm_i915_gem_object *ctx_o · 15 unmodified lines
23522338
23532339 if (ring->id == RCS) {
23542340 reg_state[CTX_LRI_HEADER_2] = MI_LOAD_REGISTER_IMM(1);
2355− reg_state[CTX_R_PWR_CLK_STATE] = GEN8_R_PWR_CLK_STATE;
2356− reg_state[CTX_R_PWR_CLK_STATE+1] = make_rpcs(dev);
2341+ ASSIGN_CTX_REG(reg_state, CTX_R_PWR_CLK_STATE, GEN8_R_PWR_CLK_STATE,
2342+ make_rpcs(dev));
23572343 }
23582344
23592345 kunmap_atomic(reg_state);
drivers/gpu/drm/i915/intel_lrc.h+12−7
@@ -29,16 +29,16 @@ · 28 unmodified lines
2929 #define GEN8_CSB_PTR_MASK 0x07
3030
3131 /* Execlists regs */
32−#define RING_ELSP(ring) ((ring)->mmio_base+0x230)
33−#define RING_EXECLIST_STATUS_LO(ring) ((ring)->mmio_base+0x234)
34−#define RING_EXECLIST_STATUS_HI(ring) ((ring)->mmio_base+0x234 + 4)
35−#define RING_CONTEXT_CONTROL(ring) ((ring)->mmio_base+0x244)
32+#define RING_ELSP(ring) _MMIO((ring)->mmio_base + 0x230)
33+#define RING_EXECLIST_STATUS_LO(ring) _MMIO((ring)->mmio_base + 0x234)
34+#define RING_EXECLIST_STATUS_HI(ring) _MMIO((ring)->mmio_base + 0x234 + 4)
35+#define RING_CONTEXT_CONTROL(ring) _MMIO((ring)->mmio_base + 0x244)
3636 #define CTX_CTRL_INHIBIT_SYN_CTX_SWITCH (1 << 3)
3737 #define CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT (1 << 0)
3838 #define CTX_CTRL_RS_CTX_ENABLE (1 << 1)
39−#define RING_CONTEXT_STATUS_BUF_LO(ring, i) ((ring)->mmio_base+0x370 + (i) * 8)
40−#define RING_CONTEXT_STATUS_BUF_HI(ring, i) ((ring)->mmio_base+0x370 + (i) * 8 + 4)
41−#define RING_CONTEXT_STATUS_PTR(ring) ((ring)->mmio_base+0x3a0)
39+#define RING_CONTEXT_STATUS_BUF_LO(ring, i) _MMIO((ring)->mmio_base + 0x370 + (i) * 8)
40+#define RING_CONTEXT_STATUS_BUF_HI(ring, i) _MMIO((ring)->mmio_base + 0x370 + (i) * 8 + 4)
41+#define RING_CONTEXT_STATUS_PTR(ring) _MMIO((ring)->mmio_base + 0x3a0)
4242
4343 /* Logical Rings */
4444 int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request);
@@ -70,6 +70,11 @@ static inline void intel_logical_ring_emit(struct intel_ringbuffer *ringbuf, · 25 unmodified lines
7070 iowrite32(data, ringbuf->virtual_start + ringbuf->tail);
7171 ringbuf->tail += 4;
7272 }
73+static inline void intel_logical_ring_emit_reg(struct intel_ringbuffer *ringbuf,
74+ i915_reg_t reg)
75+{
76+ intel_logical_ring_emit(ringbuf, i915_mmio_reg_offset(reg));
77+}
7378
7479 /* Logical Ring Contexts */
7580
drivers/gpu/drm/i915/intel_lvds.c+5−6
@@ -51,7 +51,7 @@ struct intel_lvds_encoder { · 50 unmodified lines
5151 struct intel_encoder base;
5252
5353 bool is_dual_link;
54− u32 reg;
54+ i915_reg_t reg;
5555 u32 a3_power;
5656
5757 struct intel_lvds_connector *attached_connector;
@@ -210,7 +210,7 @@ static void intel_enable_lvds(struct intel_encoder *encoder) · 152 unmodified lines
210210 struct intel_connector *intel_connector =
211211 &lvds_encoder->attached_connector->base;
212212 struct drm_i915_private *dev_priv = dev->dev_private;
213− u32 ctl_reg, stat_reg;
213+ i915_reg_t ctl_reg, stat_reg;
214214
215215 if (HAS_PCH_SPLIT(dev)) {
216216 ctl_reg = PCH_PP_CONTROL;
@@ -235,7 +235,7 @@ static void intel_disable_lvds(struct intel_encoder *encoder) · 18 unmodified lines
235235 struct drm_device *dev = encoder->base.dev;
236236 struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
237237 struct drm_i915_private *dev_priv = dev->dev_private;
238− u32 ctl_reg, stat_reg;
238+ i915_reg_t ctl_reg, stat_reg;
239239
240240 if (HAS_PCH_SPLIT(dev)) {
241241 ctl_reg = PCH_PP_CONTROL;
@@ -939,7 +939,7 @@ void intel_lvds_init(struct drm_device *dev) · 697 unmodified lines
939939 struct drm_display_mode *downclock_mode = NULL;
940940 struct edid *edid;
941941 struct drm_crtc *crtc;
942− u32 lvds_reg;
942+ i915_reg_t lvds_reg;
943943 u32 lvds;
944944 int pipe;
945945 u8 pin;
@@ -1164,8 +1164,7 @@ out: · 218 unmodified lines
11641164 DRM_DEBUG_KMS("detected %s-link lvds configuration\n",
11651165 lvds_encoder->is_dual_link ? "dual" : "single");
11661166
1167− lvds_encoder->a3_power = I915_READ(lvds_encoder->reg) &
1168− LVDS_A3_POWER_MASK;
1167+ lvds_encoder->a3_power = lvds & LVDS_A3_POWER_MASK;
11691168
11701169 lvds_connector->lid_notifier.notifier_call = intel_lid_notify;
11711170 if (acpi_lid_notifier_register(&lvds_connector->lid_notifier)) {
drivers/gpu/drm/i915/intel_mocs.c+35−26
@@ -143,7 +143,7 @@ static bool get_mocs_settings(struct drm_device *dev, · 142 unmodified lines
143143 {
144144 bool result = false;
145145
146− if (IS_SKYLAKE(dev)) {
146+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
147147 table->size = ARRAY_SIZE(skylake_mocs_table);
148148 table->table = skylake_mocs_table;
149149 result = true;
@@ -159,11 +159,30 @@ static bool get_mocs_settings(struct drm_device *dev, · 9 unmodified lines
159159 return result;
160160 }
161161
162+static i915_reg_t mocs_register(enum intel_ring_id ring, int index)
163+{
164+ switch (ring) {
165+ case RCS:
166+ return GEN9_GFX_MOCS(index);
167+ case VCS:
168+ return GEN9_MFX0_MOCS(index);
169+ case BCS:
170+ return GEN9_BLT_MOCS(index);
171+ case VECS:
172+ return GEN9_VEBOX_MOCS(index);
173+ case VCS2:
174+ return GEN9_MFX1_MOCS(index);
175+ default:
176+ MISSING_CASE(ring);
177+ return INVALID_MMIO_REG;
178+ }
179+}
180+
162181 /**
163182 * emit_mocs_control_table() - emit the mocs control table
164183 * @req: Request to set up the MOCS table for.
165184 * @table: The values to program into the control regs.
166− * @reg_base: The base for the engine that needs to be programmed.
185+ * @ring: The engine for whom to emit the registers.
167186 *
168187 * This function simply emits a MI_LOAD_REGISTER_IMM command for the
169188 * given table starting at the given address.
@@ -172,7 +191,7 @@ static bool get_mocs_settings(struct drm_device *dev, · 2 unmodified lines
172191 */
173192 static int emit_mocs_control_table(struct drm_i915_gem_request *req,
174193 const struct drm_i915_mocs_table *table,
175− u32 reg_base)
194+ enum intel_ring_id ring)
176195 {
177196 struct intel_ringbuffer *ringbuf = req->ringbuf;
178197 unsigned int index;
@@ -191,7 +210,7 @@ static int emit_mocs_control_table(struct drm_i915_gem_request *req, · 12 unmodified lines
191210 MI_LOAD_REGISTER_IMM(GEN9_NUM_MOCS_ENTRIES));
192211
193212 for (index = 0; index < table->size; index++) {
194− intel_logical_ring_emit(ringbuf, reg_base + index * 4);
213+ intel_logical_ring_emit_reg(ringbuf, mocs_register(ring, index));
195214 intel_logical_ring_emit(ringbuf,
196215 table->table[index].control_value);
197216 }
@@ -205,7 +224,7 @@ static int emit_mocs_control_table(struct drm_i915_gem_request *req, · 7 unmodified lines
205224 * that value to all the used entries.
206225 */
207226 for (; index < GEN9_NUM_MOCS_ENTRIES; index++) {
208− intel_logical_ring_emit(ringbuf, reg_base + index * 4);
227+ intel_logical_ring_emit_reg(ringbuf, mocs_register(ring, index));
209228 intel_logical_ring_emit(ringbuf, table->table[0].control_value);
210229 }
211230
@@ -253,7 +272,7 @@ static int emit_mocs_l3cc_table(struct drm_i915_gem_request *req, · 41 unmodified lines
253272 value = (table->table[count].l3cc_value & 0xffff) |
254273 ((table->table[count + 1].l3cc_value & 0xffff) << 16);
255274
256− intel_logical_ring_emit(ringbuf, GEN9_LNCFCMOCS0 + i * 4);
275+ intel_logical_ring_emit_reg(ringbuf, GEN9_LNCFCMOCS(i));
257276 intel_logical_ring_emit(ringbuf, value);
258277 }
259278
@@ -270,7 +289,7 @@ static int emit_mocs_l3cc_table(struct drm_i915_gem_request *req, · 10 unmodified lines
270289 * they are reserved by the hardware.
271290 */
272291 for (; i < GEN9_NUM_MOCS_ENTRIES / 2; i++) {
273− intel_logical_ring_emit(ringbuf, GEN9_LNCFCMOCS0 + i * 4);
292+ intel_logical_ring_emit_reg(ringbuf, GEN9_LNCFCMOCS(i));
274293 intel_logical_ring_emit(ringbuf, value);
275294
276295 value = filler;
@@ -304,26 +323,16 @@ int intel_rcs_context_init_mocs(struct drm_i915_gem_request *req) · 27 unmodified lines
304323 int ret;
305324
306325 if (get_mocs_settings(req->ring->dev, &t)) {
307− /* Program the control registers */
308− ret = emit_mocs_control_table(req, &t, GEN9_GFX_MOCS_0);
309− if (ret)
310− return ret;
311−
312− ret = emit_mocs_control_table(req, &t, GEN9_MFX0_MOCS_0);
313− if (ret)
314− return ret;
326+ struct drm_i915_private *dev_priv = req->i915;
327+ struct intel_engine_cs *ring;
328+ enum intel_ring_id ring_id;
315329
316− ret = emit_mocs_control_table(req, &t, GEN9_MFX1_MOCS_0);
317− if (ret)
318− return ret;
319−
320− ret = emit_mocs_control_table(req, &t, GEN9_VEBOX_MOCS_0);
321− if (ret)
322− return ret;
323−
324− ret = emit_mocs_control_table(req, &t, GEN9_BLT_MOCS_0);
325− if (ret)
326− return ret;
330+ /* Program the control registers */
331+ for_each_ring(ring, dev_priv, ring_id) {
332+ ret = emit_mocs_control_table(req, &t, ring_id);
333+ if (ret)
334+ return ret;
335+ }
327336
328337 /* Now program the l3cc registers */
329338 ret = emit_mocs_l3cc_table(req, &t);
drivers/gpu/drm/i915/intel_opregion.c+1−1
@@ -682,7 +682,7 @@ static void intel_didl_outputs(struct drm_device *dev) · 681 unmodified lines
682682 }
683683
684684 if (!acpi_video_bus) {
685− DRM_ERROR("No ACPI video bus found\n");
685+ DRM_DEBUG_KMS("No ACPI video bus found\n");
686686 return;
687687 }
688688
drivers/gpu/drm/i915/intel_overlay.c+1−1
@@ -749,7 +749,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, · 748 unmodified lines
749749 if (ret != 0)
750750 return ret;
751751
752− ret = i915_gem_object_pin_to_display_plane(new_bo, 0, NULL, NULL,
752+ ret = i915_gem_object_pin_to_display_plane(new_bo, 0,
753753 &i915_ggtt_view_normal);
754754 if (ret != 0)
755755 return ret;
drivers/gpu/drm/i915/intel_pm.c+256−374
@@ -1708,13 +1708,6 @@ static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels, · 1707 unmodified lines
17081708 return DIV_ROUND_UP(pri_val * 64, horiz_pixels * bytes_per_pixel) + 2;
17091709 }
17101710
1711−struct skl_pipe_wm_parameters {
1712− bool active;
1713− uint32_t pipe_htotal;
1714− uint32_t pixel_rate; /* in KHz */
1715− struct intel_plane_wm_parameters plane[I915_MAX_PLANES];
1716−};
1717−
17181711 struct ilk_wm_maximums {
17191712 uint16_t pri;
17201713 uint16_t spr;
@@ -1722,13 +1715,6 @@ struct ilk_wm_maximums { · 1 unmodified line
17221715 uint16_t fbc;
17231716 };
17241717
1725−/* used in computing the new watermarks state */
1726−struct intel_wm_config {
1727− unsigned int num_pipes_active;
1728− bool sprites_enabled;
1729− bool sprites_scaled;
1730−};
1731−
17321718 /*
17331719 * For both WM_PIPE and WM_LP.
17341720 * mem_value must be in 0.1us units.
@@ -1979,9 +1965,11 @@ static void ilk_compute_wm_level(const struct drm_i915_private *dev_priv, · 244 unmodified lines
19791965 const struct intel_crtc *intel_crtc,
19801966 int level,
19811967 struct intel_crtc_state *cstate,
1968+ struct intel_plane_state *pristate,
1969+ struct intel_plane_state *sprstate,
1970+ struct intel_plane_state *curstate,
19821971 struct intel_wm_level *result)
19831972 {
1984− struct intel_plane *intel_plane;
19851973 uint16_t pri_latency = dev_priv->wm.pri_latency[level];
19861974 uint16_t spr_latency = dev_priv->wm.spr_latency[level];
19871975 uint16_t cur_latency = dev_priv->wm.cur_latency[level];
@@ -1993,29 +1981,11 @@ static void ilk_compute_wm_level(const struct drm_i915_private *dev_priv, · 5 unmodified lines
19931981 cur_latency *= 5;
19941982 }
19951983
1996− for_each_intel_plane_on_crtc(dev_priv->dev, intel_crtc, intel_plane) {
1997− struct intel_plane_state *pstate =
1998− to_intel_plane_state(intel_plane->base.state);
1999−
2000− switch (intel_plane->base.type) {
2001− case DRM_PLANE_TYPE_PRIMARY:
2002− result->pri_val = ilk_compute_pri_wm(cstate, pstate,
2003− pri_latency,
2004− level);
2005− result->fbc_val = ilk_compute_fbc_wm(cstate, pstate,
2006− result->pri_val);
2007− break;
2008− case DRM_PLANE_TYPE_OVERLAY:
2009− result->spr_val = ilk_compute_spr_wm(cstate, pstate,
2010− spr_latency);
2011− break;
2012− case DRM_PLANE_TYPE_CURSOR:
2013− result->cur_val = ilk_compute_cur_wm(cstate, pstate,
2014− cur_latency);
2015− break;
2016− }
2017− }
2018−
1984+ result->pri_val = ilk_compute_pri_wm(cstate, pristate,
1985+ pri_latency, level);
1986+ result->spr_val = ilk_compute_spr_wm(cstate, sprstate, spr_latency);
1987+ result->cur_val = ilk_compute_cur_wm(cstate, curstate, cur_latency);
1988+ result->fbc_val = ilk_compute_fbc_wm(cstate, pristate, result->pri_val);
20191989 result->enable = true;
20201990 }
20211991
@@ -2274,34 +2244,19 @@ static void skl_setup_wm_latency(struct drm_device *dev) · 252 unmodified lines
22742244 intel_print_wm_latency(dev, "Gen9 Plane", dev_priv->wm.skl_latency);
22752245 }
22762246
2277−static void ilk_compute_wm_config(struct drm_device *dev,
2278− struct intel_wm_config *config)
2279−{
2280− struct intel_crtc *intel_crtc;
2281−
2282− /* Compute the currently _active_ config */
2283− for_each_intel_crtc(dev, intel_crtc) {
2284− const struct intel_pipe_wm *wm = &intel_crtc->wm.active;
2285−
2286− if (!wm->pipe_enabled)
2287− continue;
2288−
2289− config->sprites_enabled |= wm->sprites_enabled;
2290− config->sprites_scaled |= wm->sprites_scaled;
2291− config->num_pipes_active++;
2292− }
2293−}
2294−
22952247 /* Compute new watermarks for the pipe */
2296−static bool intel_compute_pipe_wm(struct intel_crtc_state *cstate,
2297− struct intel_pipe_wm *pipe_wm)
2248+static int ilk_compute_pipe_wm(struct intel_crtc *intel_crtc,
2249+ struct drm_atomic_state *state)
22982250 {
2299− struct drm_crtc *crtc = cstate->base.crtc;
2300− struct drm_device *dev = crtc->dev;
2251+ struct intel_pipe_wm *pipe_wm;
2252+ struct drm_device *dev = intel_crtc->base.dev;
23012253 const struct drm_i915_private *dev_priv = dev->dev_private;
2302− struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2254+ struct intel_crtc_state *cstate = NULL;
23032255 struct intel_plane *intel_plane;
2256+ struct drm_plane_state *ps;
2257+ struct intel_plane_state *pristate = NULL;
23042258 struct intel_plane_state *sprstate = NULL;
2259+ struct intel_plane_state *curstate = NULL;
23052260 int level, max_level = ilk_wm_max_level(dev);
23062261 /* LP0 watermark maximums depend on this pipe alone */
23072262 struct intel_wm_config config = {
@@ -2309,11 +2264,24 @@ static bool intel_compute_pipe_wm(struct intel_crtc_state *cstate, · 1 unmodified line
23092264 };
23102265 struct ilk_wm_maximums max;
23112266
2267+ cstate = intel_atomic_get_crtc_state(state, intel_crtc);
2268+ if (IS_ERR(cstate))
2269+ return PTR_ERR(cstate);
2270+
2271+ pipe_wm = &cstate->wm.optimal.ilk;
2272+
23122273 for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
2313− if (intel_plane->base.type == DRM_PLANE_TYPE_OVERLAY) {
2314− sprstate = to_intel_plane_state(intel_plane->base.state);
2315− break;
2316− }
2274+ ps = drm_atomic_get_plane_state(state,
2275+ &intel_plane->base);
2276+ if (IS_ERR(ps))
2277+ return PTR_ERR(ps);
2278+
2279+ if (intel_plane->base.type == DRM_PLANE_TYPE_PRIMARY)
2280+ pristate = to_intel_plane_state(ps);
2281+ else if (intel_plane->base.type == DRM_PLANE_TYPE_OVERLAY)
2282+ sprstate = to_intel_plane_state(ps);
2283+ else if (intel_plane->base.type == DRM_PLANE_TYPE_CURSOR)
2284+ curstate = to_intel_plane_state(ps);
23172285 }
23182286
23192287 config.sprites_enabled = sprstate->visible;
@@ -2322,7 +2290,7 @@ static bool intel_compute_pipe_wm(struct intel_crtc_state *cstate, · 2 unmodified lines
23222290 drm_rect_height(&sprstate->dst) != drm_rect_height(&sprstate->src) >> 16);
23232291
23242292 pipe_wm->pipe_enabled = cstate->base.active;
2325− pipe_wm->sprites_enabled = sprstate->visible;
2293+ pipe_wm->sprites_enabled = config.sprites_enabled;
23262294 pipe_wm->sprites_scaled = config.sprites_scaled;
23272295
23282296 /* ILK/SNB: LP2+ watermarks only w/o sprites */
@@ -2333,24 +2301,27 @@ static bool intel_compute_pipe_wm(struct intel_crtc_state *cstate, · 4 unmodified lines
23332301 if (config.sprites_scaled)
23342302 max_level = 0;
23352303
2336− ilk_compute_wm_level(dev_priv, intel_crtc, 0, cstate, &pipe_wm->wm[0]);
2304+ ilk_compute_wm_level(dev_priv, intel_crtc, 0, cstate,
2305+ pristate, sprstate, curstate, &pipe_wm->wm[0]);
23372306
23382307 if (IS_HASWELL(dev) || IS_BROADWELL(dev))
2339− pipe_wm->linetime = hsw_compute_linetime_wm(dev, crtc);
2308+ pipe_wm->linetime = hsw_compute_linetime_wm(dev,
2309+ &intel_crtc->base);
23402310
23412311 /* LP0 watermarks always use 1/2 DDB partitioning */
23422312 ilk_compute_wm_maximums(dev, 0, &config, INTEL_DDB_PART_1_2, &max);
23432313
23442314 /* At least LP0 must be valid */
23452315 if (!ilk_validate_wm_level(0, &max, &pipe_wm->wm[0]))
2346− return false;
2316+ return -EINVAL;
23472317
23482318 ilk_compute_wm_reg_maximums(dev, 1, &max);
23492319
23502320 for (level = 1; level <= max_level; level++) {
23512321 struct intel_wm_level wm = {};
23522322
2353− ilk_compute_wm_level(dev_priv, intel_crtc, level, cstate, &wm);
2323+ ilk_compute_wm_level(dev_priv, intel_crtc, level, cstate,
2324+ pristate, sprstate, curstate, &wm);
23542325
23552326 /*
23562327 * Disable any watermark level that exceeds the
@@ -2363,7 +2334,7 @@ static bool intel_compute_pipe_wm(struct intel_crtc_state *cstate, · 6 unmodified lines
23632334 pipe_wm->wm[level] = wm;
23642335 }
23652336
2366− return true;
2337+ return 0;
23672338 }
23682339
23692340 /*
@@ -2378,7 +2349,9 @@ static void ilk_merge_wm_level(struct drm_device *dev, · 8 unmodified lines
23782349 ret_wm->enable = true;
23792350
23802351 for_each_intel_crtc(dev, intel_crtc) {
2381− const struct intel_pipe_wm *active = &intel_crtc->wm.active;
2352+ const struct intel_crtc_state *cstate =
2353+ to_intel_crtc_state(intel_crtc->base.state);
2354+ const struct intel_pipe_wm *active = &cstate->wm.optimal.ilk;
23822355 const struct intel_wm_level *wm = &active->wm[level];
23832356
23842357 if (!active->pipe_enabled)
@@ -2526,14 +2499,15 @@ static void ilk_compute_wm_results(struct drm_device *dev, · 141 unmodified lines
25262499
25272500 /* LP0 register values */
25282501 for_each_intel_crtc(dev, intel_crtc) {
2502+ const struct intel_crtc_state *cstate =
2503+ to_intel_crtc_state(intel_crtc->base.state);
25292504 enum pipe pipe = intel_crtc->pipe;
2530− const struct intel_wm_level *r =
2531− &intel_crtc->wm.active.wm[0];
2505+ const struct intel_wm_level *r = &cstate->wm.optimal.ilk.wm[0];
25322506
25332507 if (WARN_ON(!r->enable))
25342508 continue;
25352509
2536− results->wm_linetime[pipe] = intel_crtc->wm.active.linetime;
2510+ results->wm_linetime[pipe] = cstate->wm.optimal.ilk.linetime;
25372511
25382512 results->wm_pipe[pipe] =
25392513 (r->pri_val << WM0_PIPE_PLANE_SHIFT) |
@@ -2755,18 +2729,40 @@ static bool ilk_disable_lp_wm(struct drm_device *dev) · 215 unmodified lines
27552729 #define SKL_DDB_SIZE 896 /* in blocks */
27562730 #define BXT_DDB_SIZE 512
27572731
2732+/*
2733+ * Return the index of a plane in the SKL DDB and wm result arrays. Primary
2734+ * plane is always in slot 0, cursor is always in slot I915_MAX_PLANES-1, and
2735+ * other universal planes are in indices 1..n. Note that this may leave unused
2736+ * indices between the top "sprite" plane and the cursor.
2737+ */
2738+static int
2739+skl_wm_plane_id(const struct intel_plane *plane)
2740+{
2741+ switch (plane->base.type) {
2742+ case DRM_PLANE_TYPE_PRIMARY:
2743+ return 0;
2744+ case DRM_PLANE_TYPE_CURSOR:
2745+ return PLANE_CURSOR;
2746+ case DRM_PLANE_TYPE_OVERLAY:
2747+ return plane->plane + 1;
2748+ default:
2749+ MISSING_CASE(plane->base.type);
2750+ return plane->plane;
2751+ }
2752+}
2753+
27582754 static void
27592755 skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
2760− struct drm_crtc *for_crtc,
2756+ const struct intel_crtc_state *cstate,
27612757 const struct intel_wm_config *config,
2762− const struct skl_pipe_wm_parameters *params,
27632758 struct skl_ddb_entry *alloc /* out */)
27642759 {
2760+ struct drm_crtc *for_crtc = cstate->base.crtc;
27652761 struct drm_crtc *crtc;
27662762 unsigned int pipe_size, ddb_size;
27672763 int nth_active_pipe;
27682764
2769− if (!params->active) {
2765+ if (!cstate->base.active) {
27702766 alloc->start = 0;
27712767 alloc->end = 0;
27722768 return;
@@ -2837,19 +2833,29 @@ void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv, · 64 unmodified lines
28372833 }
28382834
28392835 static unsigned int
2840−skl_plane_relative_data_rate(const struct intel_plane_wm_parameters *p, int y)
2836+skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
2837+ const struct drm_plane_state *pstate,
2838+ int y)
28412839 {
2840+ struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
2841+ struct drm_framebuffer *fb = pstate->fb;
28422842
28432843 /* for planar format */
2844− if (p->y_bytes_per_pixel) {
2844+ if (fb->pixel_format == DRM_FORMAT_NV12) {
28452845 if (y) /* y-plane data rate */
2846− return p->horiz_pixels * p->vert_pixels * p->y_bytes_per_pixel;
2846+ return intel_crtc->config->pipe_src_w *
2847+ intel_crtc->config->pipe_src_h *
2848+ drm_format_plane_cpp(fb->pixel_format, 0);
28472849 else /* uv-plane data rate */
2848− return (p->horiz_pixels/2) * (p->vert_pixels/2) * p->bytes_per_pixel;
2850+ return (intel_crtc->config->pipe_src_w/2) *
2851+ (intel_crtc->config->pipe_src_h/2) *
2852+ drm_format_plane_cpp(fb->pixel_format, 1);
28492853 }
28502854
28512855 /* for packed formats */
2852− return p->horiz_pixels * p->vert_pixels * p->bytes_per_pixel;
2856+ return intel_crtc->config->pipe_src_w *
2857+ intel_crtc->config->pipe_src_h *
2858+ drm_format_plane_cpp(fb->pixel_format, 0);
28532859 }
28542860
28552861 /*
@@ -2858,46 +2864,55 @@ skl_plane_relative_data_rate(const struct intel_plane_wm_parameters *p, int y) · 2 unmodified lines
28582864 * 3 * 4096 * 8192 * 4 < 2^32
28592865 */
28602866 static unsigned int
2861−skl_get_total_relative_data_rate(struct intel_crtc *intel_crtc,
2862− const struct skl_pipe_wm_parameters *params)
2867+skl_get_total_relative_data_rate(const struct intel_crtc_state *cstate)
28632868 {
2869+ struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
2870+ struct drm_device *dev = intel_crtc->base.dev;
2871+ const struct intel_plane *intel_plane;
28642872 unsigned int total_data_rate = 0;
2865− int plane;
28662873
2867− for (plane = 0; plane < intel_num_planes(intel_crtc); plane++) {
2868− const struct intel_plane_wm_parameters *p;
2874+ for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
2875+ const struct drm_plane_state *pstate = intel_plane->base.state;
28692876
2870− p = &params->plane[plane];
2871− if (!p->enabled)
2877+ if (pstate->fb == NULL)
28722878 continue;
28732879
2874− total_data_rate += skl_plane_relative_data_rate(p, 0); /* packed/uv */
2875− if (p->y_bytes_per_pixel) {
2876− total_data_rate += skl_plane_relative_data_rate(p, 1); /* y-plane */
2877− }
2880+ if (intel_plane->base.type == DRM_PLANE_TYPE_CURSOR)
2881+ continue;
2882+
2883+ /* packed/uv */
2884+ total_data_rate += skl_plane_relative_data_rate(cstate,
2885+ pstate,
2886+ 0);
2887+
2888+ if (pstate->fb->pixel_format == DRM_FORMAT_NV12)
2889+ /* y-plane */
2890+ total_data_rate += skl_plane_relative_data_rate(cstate,
2891+ pstate,
2892+ 1);
28782893 }
28792894
28802895 return total_data_rate;
28812896 }
28822897
28832898 static void
2884−skl_allocate_pipe_ddb(struct drm_crtc *crtc,
2885− const struct intel_wm_config *config,
2886− const struct skl_pipe_wm_parameters *params,
2899+skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
28872900 struct skl_ddb_allocation *ddb /* out */)
28882901 {
2902+ struct drm_crtc *crtc = cstate->base.crtc;
28892903 struct drm_device *dev = crtc->dev;
2890− struct drm_i915_private *dev_priv = dev->dev_private;
2904+ struct drm_i915_private *dev_priv = to_i915(dev);
2905+ struct intel_wm_config *config = &dev_priv->wm.config;
28912906 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2907+ struct intel_plane *intel_plane;
28922908 enum pipe pipe = intel_crtc->pipe;
28932909 struct skl_ddb_entry *alloc = &ddb->pipe[pipe];
28942910 uint16_t alloc_size, start, cursor_blocks;
28952911 uint16_t minimum[I915_MAX_PLANES];
28962912 uint16_t y_minimum[I915_MAX_PLANES];
28972913 unsigned int total_data_rate;
2898− int plane;
28992914
2900− skl_ddb_get_pipe_allocation_limits(dev, crtc, config, params, alloc);
2915+ skl_ddb_get_pipe_allocation_limits(dev, cstate, config, alloc);
29012916 alloc_size = skl_ddb_entry_size(alloc);
29022917 if (alloc_size == 0) {
29032918 memset(ddb->plane[pipe], 0, sizeof(ddb->plane[pipe]));
@@ -2914,17 +2929,20 @@ skl_allocate_pipe_ddb(struct drm_crtc *crtc, · 10 unmodified lines
29142929 alloc->end -= cursor_blocks;
29152930
29162931 /* 1. Allocate the mininum required blocks for each active plane */
2917− for_each_plane(dev_priv, pipe, plane) {
2918− const struct intel_plane_wm_parameters *p;
2932+ for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
2933+ struct drm_plane *plane = &intel_plane->base;
2934+ struct drm_framebuffer *fb = plane->state->fb;
2935+ int id = skl_wm_plane_id(intel_plane);
29192936
2920− p = &params->plane[plane];
2921− if (!p->enabled)
2937+ if (fb == NULL)
2938+ continue;
2939+ if (plane->type == DRM_PLANE_TYPE_CURSOR)
29222940 continue;
29232941
2924− minimum[plane] = 8;
2925− alloc_size -= minimum[plane];
2926− y_minimum[plane] = p->y_bytes_per_pixel ? 8 : 0;
2927− alloc_size -= y_minimum[plane];
2942+ minimum[id] = 8;
2943+ alloc_size -= minimum[id];
2944+ y_minimum[id] = (fb->pixel_format == DRM_FORMAT_NV12) ? 8 : 0;
2945+ alloc_size -= y_minimum[id];
29282946 }
29292947
29302948 /*
@@ -2933,45 +2951,50 @@ skl_allocate_pipe_ddb(struct drm_crtc *crtc, · 2 unmodified lines
29332951 *
29342952 * FIXME: we may not allocate every single block here.
29352953 */
2936− total_data_rate = skl_get_total_relative_data_rate(intel_crtc, params);
2954+ total_data_rate = skl_get_total_relative_data_rate(cstate);
29372955
29382956 start = alloc->start;
2939− for (plane = 0; plane < intel_num_planes(intel_crtc); plane++) {
2940− const struct intel_plane_wm_parameters *p;
2957+ for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
2958+ struct drm_plane *plane = &intel_plane->base;
2959+ struct drm_plane_state *pstate = intel_plane->base.state;
29412960 unsigned int data_rate, y_data_rate;
29422961 uint16_t plane_blocks, y_plane_blocks = 0;
2962+ int id = skl_wm_plane_id(intel_plane);
29432963
2944− p = &params->plane[plane];
2945− if (!p->enabled)
2964+ if (pstate->fb == NULL)
2965+ continue;
2966+ if (plane->type == DRM_PLANE_TYPE_CURSOR)
29462967 continue;
29472968
2948− data_rate = skl_plane_relative_data_rate(p, 0);
2969+ data_rate = skl_plane_relative_data_rate(cstate, pstate, 0);
29492970
29502971 /*
29512972 * allocation for (packed formats) or (uv-plane part of planar format):
29522973 * promote the expression to 64 bits to avoid overflowing, the
29532974 * result is < available as data_rate / total_data_rate < 1
29542975 */
2955− plane_blocks = minimum[plane];
2976+ plane_blocks = minimum[id];
29562977 plane_blocks += div_u64((uint64_t)alloc_size * data_rate,
29572978 total_data_rate);
29582979
2959− ddb->plane[pipe][plane].start = start;
2960− ddb->plane[pipe][plane].end = start + plane_blocks;
2980+ ddb->plane[pipe][id].start = start;
2981+ ddb->plane[pipe][id].end = start + plane_blocks;
29612982
29622983 start += plane_blocks;
29632984
29642985 /*
29652986 * allocation for y_plane part of planar format:
29662987 */
2967− if (p->y_bytes_per_pixel) {
2968− y_data_rate = skl_plane_relative_data_rate(p, 1);
2969− y_plane_blocks = y_minimum[plane];
2988+ if (pstate->fb->pixel_format == DRM_FORMAT_NV12) {
2989+ y_data_rate = skl_plane_relative_data_rate(cstate,
2990+ pstate,
2991+ 1);
2992+ y_plane_blocks = y_minimum[id];
29702993 y_plane_blocks += div_u64((uint64_t)alloc_size * y_data_rate,
29712994 total_data_rate);
29722995
2973− ddb->y_plane[pipe][plane].start = start;
2974− ddb->y_plane[pipe][plane].end = start + y_plane_blocks;
2996+ ddb->y_plane[pipe][id].start = start;
2997+ ddb->y_plane[pipe][id].end = start + y_plane_blocks;
29752998
29762999 start += y_plane_blocks;
29773000 }
@@ -3041,104 +3064,27 @@ static bool skl_ddb_allocation_changed(const struct skl_ddb_allocation *new_ddb, · 63 unmodified lines
30413064 struct drm_device *dev = intel_crtc->base.dev;
30423065 struct drm_i915_private *dev_priv = dev->dev_private;
30433066 const struct skl_ddb_allocation *cur_ddb = &dev_priv->wm.skl_hw.ddb;
3044− enum pipe pipe = intel_crtc->pipe;
3045−
3046− if (memcmp(new_ddb->plane[pipe], cur_ddb->plane[pipe],
3047− sizeof(new_ddb->plane[pipe])))
3048− return true;
30493067
3050− if (memcmp(&new_ddb->plane[pipe][PLANE_CURSOR], &cur_ddb->plane[pipe][PLANE_CURSOR],
3051− sizeof(new_ddb->plane[pipe][PLANE_CURSOR])))
3068+ /*
3069+ * If ddb allocation of pipes changed, it may require recalculation of
3070+ * watermarks
3071+ */
3072+ if (memcmp(new_ddb->pipe, cur_ddb->pipe, sizeof(new_ddb->pipe)))
30523073 return true;
30533074
30543075 return false;
30553076 }
30563077
3057−static void skl_compute_wm_global_parameters(struct drm_device *dev,
3058− struct intel_wm_config *config)
3059−{
3060− struct drm_crtc *crtc;
3061− struct drm_plane *plane;
3062−
3063− list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
3064− config->num_pipes_active += to_intel_crtc(crtc)->active;
3065−
3066− /* FIXME: I don't think we need those two global parameters on SKL */
3067− list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
3068− struct intel_plane *intel_plane = to_intel_plane(plane);
3069−
3070− config->sprites_enabled |= intel_plane->wm.enabled;
3071− config->sprites_scaled |= intel_plane->wm.scaled;
3072− }
3073−}
3074−
3075−static void skl_compute_wm_pipe_parameters(struct drm_crtc *crtc,
3076− struct skl_pipe_wm_parameters *p)
3077−{
3078− struct drm_device *dev = crtc->dev;
3079− struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3080− enum pipe pipe = intel_crtc->pipe;
3081− struct drm_plane *plane;
3082− struct drm_framebuffer *fb;
3083− int i = 1; /* Index for sprite planes start */
3084−
3085− p->active = intel_crtc->active;
3086− if (p->active) {
3087− p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal;
3088− p->pixel_rate = skl_pipe_pixel_rate(intel_crtc->config);
3089−
3090− fb = crtc->primary->state->fb;
3091− /* For planar: Bpp is for uv plane, y_Bpp is for y plane */
3092− if (fb) {
3093− p->plane[0].enabled = true;
3094− p->plane[0].bytes_per_pixel = fb->pixel_format == DRM_FORMAT_NV12 ?
3095− drm_format_plane_cpp(fb->pixel_format, 1) :
3096− drm_format_plane_cpp(fb->pixel_format, 0);
3097− p->plane[0].y_bytes_per_pixel = fb->pixel_format == DRM_FORMAT_NV12 ?
3098− drm_format_plane_cpp(fb->pixel_format, 0) : 0;
3099− p->plane[0].tiling = fb->modifier[0];
3100− } else {
3101− p->plane[0].enabled = false;
3102− p->plane[0].bytes_per_pixel = 0;
3103− p->plane[0].y_bytes_per_pixel = 0;
3104− p->plane[0].tiling = DRM_FORMAT_MOD_NONE;
3105− }
3106− p->plane[0].horiz_pixels = intel_crtc->config->pipe_src_w;
3107− p->plane[0].vert_pixels = intel_crtc->config->pipe_src_h;
3108− p->plane[0].rotation = crtc->primary->state->rotation;
3109−
3110− fb = crtc->cursor->state->fb;
3111− p->plane[PLANE_CURSOR].y_bytes_per_pixel = 0;
3112− if (fb) {
3113− p->plane[PLANE_CURSOR].enabled = true;
3114− p->plane[PLANE_CURSOR].bytes_per_pixel = fb->bits_per_pixel / 8;
3115− p->plane[PLANE_CURSOR].horiz_pixels = crtc->cursor->state->crtc_w;
3116− p->plane[PLANE_CURSOR].vert_pixels = crtc->cursor->state->crtc_h;
3117− } else {
3118− p->plane[PLANE_CURSOR].enabled = false;
3119− p->plane[PLANE_CURSOR].bytes_per_pixel = 0;
3120− p->plane[PLANE_CURSOR].horiz_pixels = 64;
3121− p->plane[PLANE_CURSOR].vert_pixels = 64;
3122− }
3123− }
3124−
3125− list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
3126− struct intel_plane *intel_plane = to_intel_plane(plane);
3127−
3128− if (intel_plane->pipe == pipe &&
3129− plane->type == DRM_PLANE_TYPE_OVERLAY)
3130− p->plane[i++] = intel_plane->wm;
3131− }
3132−}
3133−
31343078 static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
3135− struct skl_pipe_wm_parameters *p,
3136− struct intel_plane_wm_parameters *p_params,
3079+ struct intel_crtc_state *cstate,
3080+ struct intel_plane *intel_plane,
31373081 uint16_t ddb_allocation,
31383082 int level,
31393083 uint16_t *out_blocks, /* out */
31403084 uint8_t *out_lines /* out */)
31413085 {
3086+ struct drm_plane *plane = &intel_plane->base;
3087+ struct drm_framebuffer *fb = plane->state->fb;
31423088 uint32_t latency = dev_priv->wm.skl_latency[level];
31433089 uint32_t method1, method2;
31443090 uint32_t plane_bytes_per_line, plane_blocks_per_line;
@@ -3146,31 +3092,33 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv, · 1 unmodified line
31463092 uint32_t selected_result;
31473093 uint8_t bytes_per_pixel;
31483094
3149− if (latency == 0 || !p->active || !p_params->enabled)
3095+ if (latency == 0 || !cstate->base.active || !fb)
31503096 return false;
31513097
3152− bytes_per_pixel = p_params->y_bytes_per_pixel ?
3153− p_params->y_bytes_per_pixel :
3154− p_params->bytes_per_pixel;
3155− method1 = skl_wm_method1(p->pixel_rate,
3098+ bytes_per_pixel = drm_format_plane_cpp(fb->pixel_format, 0);
3099+ method1 = skl_wm_method1(skl_pipe_pixel_rate(cstate),
31563100 bytes_per_pixel,
31573101 latency);
3158− method2 = skl_wm_method2(p->pixel_rate,
3159− p->pipe_htotal,
3160− p_params->horiz_pixels,
3102+ method2 = skl_wm_method2(skl_pipe_pixel_rate(cstate),
3103+ cstate->base.adjusted_mode.crtc_htotal,
3104+ cstate->pipe_src_w,
31613105 bytes_per_pixel,
3162− p_params->tiling,
3106+ fb->modifier[0],
31633107 latency);
31643108
3165− plane_bytes_per_line = p_params->horiz_pixels * bytes_per_pixel;
3109+ plane_bytes_per_line = cstate->pipe_src_w * bytes_per_pixel;
31663110 plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line, 512);
31673111
3168− if (p_params->tiling == I915_FORMAT_MOD_Y_TILED ||
3169− p_params->tiling == I915_FORMAT_MOD_Yf_TILED) {
3112+ if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
3113+ fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED) {
31703114 uint32_t min_scanlines = 4;
31713115 uint32_t y_tile_minimum;
3172− if (intel_rotation_90_or_270(p_params->rotation)) {
3173− switch (p_params->bytes_per_pixel) {
3116+ if (intel_rotation_90_or_270(plane->state->rotation)) {
3117+ int bpp = (fb->pixel_format == DRM_FORMAT_NV12) ?
3118+ drm_format_plane_cpp(fb->pixel_format, 1) :
3119+ drm_format_plane_cpp(fb->pixel_format, 0);
3120+
3121+ switch (bpp) {
31743122 case 1:
31753123 min_scanlines = 16;
31763124 break;
@@ -3194,8 +3142,8 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv, · 17 unmodified lines
31943142 res_lines = DIV_ROUND_UP(selected_result, plane_blocks_per_line);
31953143
31963144 if (level >= 1 && level <= 7) {
3197− if (p_params->tiling == I915_FORMAT_MOD_Y_TILED ||
3198− p_params->tiling == I915_FORMAT_MOD_Yf_TILED)
3145+ if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
3146+ fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED)
31993147 res_lines += 4;
32003148 else
32013149 res_blocks++;
@@ -3212,84 +3160,80 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv, · 10 unmodified lines
32123160
32133161 static void skl_compute_wm_level(const struct drm_i915_private *dev_priv,
32143162 struct skl_ddb_allocation *ddb,
3215− struct skl_pipe_wm_parameters *p,
3216− enum pipe pipe,
3163+ struct intel_crtc_state *cstate,
32173164 int level,
3218− int num_planes,
32193165 struct skl_wm_level *result)
32203166 {
3167+ struct drm_device *dev = dev_priv->dev;
3168+ struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
3169+ struct intel_plane *intel_plane;
32213170 uint16_t ddb_blocks;
3222− int i;
3171+ enum pipe pipe = intel_crtc->pipe;
3172+
3173+ for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
3174+ int i = skl_wm_plane_id(intel_plane);
32233175
3224− for (i = 0; i < num_planes; i++) {
32253176 ddb_blocks = skl_ddb_entry_size(&ddb->plane[pipe][i]);
32263177
32273178 result->plane_en[i] = skl_compute_plane_wm(dev_priv,
3228− p, &p->plane[i],
3179+ cstate,
3180+ intel_plane,
32293181 ddb_blocks,
32303182 level,
32313183 &result->plane_res_b[i],
32323184 &result->plane_res_l[i]);
32333185 }
3234−
3235− ddb_blocks = skl_ddb_entry_size(&ddb->plane[pipe][PLANE_CURSOR]);
3236− result->plane_en[PLANE_CURSOR] = skl_compute_plane_wm(dev_priv, p,
3237− &p->plane[PLANE_CURSOR],
3238− ddb_blocks, level,
3239− &result->plane_res_b[PLANE_CURSOR],
3240− &result->plane_res_l[PLANE_CURSOR]);
32413186 }
32423187
32433188 static uint32_t
3244−skl_compute_linetime_wm(struct drm_crtc *crtc, struct skl_pipe_wm_parameters *p)
3189+skl_compute_linetime_wm(struct intel_crtc_state *cstate)
32453190 {
3246− if (!to_intel_crtc(crtc)->active)
3191+ if (!cstate->base.active)
32473192 return 0;
32483193
3249− if (WARN_ON(p->pixel_rate == 0))
3194+ if (WARN_ON(skl_pipe_pixel_rate(cstate) == 0))
32503195 return 0;
32513196
3252− return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate);
3197+ return DIV_ROUND_UP(8 * cstate->base.adjusted_mode.crtc_htotal * 1000,
3198+ skl_pipe_pixel_rate(cstate));
32533199 }
32543200
3255−static void skl_compute_transition_wm(struct drm_crtc *crtc,
3256− struct skl_pipe_wm_parameters *params,
3201+static void skl_compute_transition_wm(struct intel_crtc_state *cstate,
32573202 struct skl_wm_level *trans_wm /* out */)
32583203 {
3204+ struct drm_crtc *crtc = cstate->base.crtc;
32593205 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3260− int i;
3206+ struct intel_plane *intel_plane;
32613207
3262− if (!params->active)
3208+ if (!cstate->base.active)
32633209 return;
32643210
32653211 /* Until we know more, just disable transition WMs */
3266− for (i = 0; i < intel_num_planes(intel_crtc); i++)
3212+ for_each_intel_plane_on_crtc(crtc->dev, intel_crtc, intel_plane) {
3213+ int i = skl_wm_plane_id(intel_plane);
3214+
32673215 trans_wm->plane_en[i] = false;
3268− trans_wm->plane_en[PLANE_CURSOR] = false;
3216+ }
32693217 }
32703218
3271−static void skl_compute_pipe_wm(struct drm_crtc *crtc,
3219+static void skl_compute_pipe_wm(struct intel_crtc_state *cstate,
32723220 struct skl_ddb_allocation *ddb,
3273− struct skl_pipe_wm_parameters *params,
32743221 struct skl_pipe_wm *pipe_wm)
32753222 {
3276− struct drm_device *dev = crtc->dev;
3223+ struct drm_device *dev = cstate->base.crtc->dev;
32773224 const struct drm_i915_private *dev_priv = dev->dev_private;
3278− struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
32793225 int level, max_level = ilk_wm_max_level(dev);
32803226
32813227 for (level = 0; level <= max_level; level++) {
3282− skl_compute_wm_level(dev_priv, ddb, params, intel_crtc->pipe,
3283− level, intel_num_planes(intel_crtc),
3284− &pipe_wm->wm[level]);
3228+ skl_compute_wm_level(dev_priv, ddb, cstate,
3229+ level, &pipe_wm->wm[level]);
32853230 }
3286− pipe_wm->linetime = skl_compute_linetime_wm(crtc, params);
3231+ pipe_wm->linetime = skl_compute_linetime_wm(cstate);
32873232
3288− skl_compute_transition_wm(crtc, params, &pipe_wm->trans_wm);
3233+ skl_compute_transition_wm(cstate, &pipe_wm->trans_wm);
32893234 }
32903235
32913236 static void skl_compute_wm_results(struct drm_device *dev,
3292− struct skl_pipe_wm_parameters *p,
32933237 struct skl_pipe_wm *p_wm,
32943238 struct skl_wm_values *r,
32953239 struct intel_crtc *intel_crtc)
@@ -3346,7 +3290,8 @@ static void skl_compute_wm_results(struct drm_device *dev, · 50 unmodified lines
33463290 r->wm_linetime[pipe] = p_wm->linetime;
33473291 }
33483292
3349−static void skl_ddb_entry_write(struct drm_i915_private *dev_priv, uint32_t reg,
3293+static void skl_ddb_entry_write(struct drm_i915_private *dev_priv,
3294+ i915_reg_t reg,
33503295 const struct skl_ddb_entry *entry)
33513296 {
33523297 if (entry->end)
@@ -3533,28 +3478,25 @@ static void skl_flush_wm_values(struct drm_i915_private *dev_priv, · 180 unmodified lines
35333478 }
35343479
35353480 static bool skl_update_pipe_wm(struct drm_crtc *crtc,
3536− struct skl_pipe_wm_parameters *params,
3537− struct intel_wm_config *config,
35383481 struct skl_ddb_allocation *ddb, /* out */
35393482 struct skl_pipe_wm *pipe_wm /* out */)
35403483 {
35413484 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3485+ struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
35423486
3543− skl_compute_wm_pipe_parameters(crtc, params);
3544− skl_allocate_pipe_ddb(crtc, config, params, ddb);
3545− skl_compute_pipe_wm(crtc, ddb, params, pipe_wm);
3487+ skl_allocate_pipe_ddb(cstate, ddb);
3488+ skl_compute_pipe_wm(cstate, ddb, pipe_wm);
35463489
3547− if (!memcmp(&intel_crtc->wm.skl_active, pipe_wm, sizeof(*pipe_wm)))
3490+ if (!memcmp(&intel_crtc->wm.active.skl, pipe_wm, sizeof(*pipe_wm)))
35483491 return false;
35493492
3550− intel_crtc->wm.skl_active = *pipe_wm;
3493+ intel_crtc->wm.active.skl = *pipe_wm;
35513494
35523495 return true;
35533496 }
35543497
35553498 static void skl_update_other_pipe_wm(struct drm_device *dev,
35563499 struct drm_crtc *crtc,
3557− struct intel_wm_config *config,
35583500 struct skl_wm_values *r)
35593501 {
35603502 struct intel_crtc *intel_crtc;
@@ -3575,7 +3517,6 @@ static void skl_update_other_pipe_wm(struct drm_device *dev, · 14 unmodified lines
35753517 */
35763518 list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list,
35773519 base.head) {
3578− struct skl_pipe_wm_parameters params = {};
35793520 struct skl_pipe_wm pipe_wm = {};
35803521 bool wm_changed;
35813522
@@ -3586,7 +3527,6 @@ static void skl_update_other_pipe_wm(struct drm_device *dev, · 4 unmodified lines
35863527 continue;
35873528
35883529 wm_changed = skl_update_pipe_wm(&intel_crtc->base,
3589− &params, config,
35903530 &r->ddb, &pipe_wm);
35913531
35923532 /*
@@ -3596,7 +3536,7 @@ static void skl_update_other_pipe_wm(struct drm_device *dev, · 3 unmodified lines
35963536 */
35973537 WARN_ON(!wm_changed);
35983538
3599− skl_compute_wm_results(dev, &params, &pipe_wm, r, intel_crtc);
3539+ skl_compute_wm_results(dev, &pipe_wm, r, intel_crtc);
36003540 r->dirty[intel_crtc->pipe] = true;
36013541 }
36023542 }
@@ -3626,10 +3566,9 @@ static void skl_update_wm(struct drm_crtc *crtc) · 23 unmodified lines
36263566 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
36273567 struct drm_device *dev = crtc->dev;
36283568 struct drm_i915_private *dev_priv = dev->dev_private;
3629− struct skl_pipe_wm_parameters params = {};
36303569 struct skl_wm_values *results = &dev_priv->wm.skl_results;
3631− struct skl_pipe_wm pipe_wm = {};
3632− struct intel_wm_config config = {};
3570+ struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
3571+ struct skl_pipe_wm *pipe_wm = &cstate->wm.optimal.skl;
36333572
36343573
36353574 /* Clear all dirty flags */
@@ -3637,16 +3576,13 @@ static void skl_update_wm(struct drm_crtc *crtc) · 1 unmodified line
36373576
36383577 skl_clear_wm(results, intel_crtc->pipe);
36393578
3640− skl_compute_wm_global_parameters(dev, &config);
3641−
3642− if (!skl_update_pipe_wm(crtc, &params, &config,
3643− &results->ddb, &pipe_wm))
3579+ if (!skl_update_pipe_wm(crtc, &results->ddb, pipe_wm))
36443580 return;
36453581
3646− skl_compute_wm_results(dev, &params, &pipe_wm, results, intel_crtc);
3582+ skl_compute_wm_results(dev, pipe_wm, results, intel_crtc);
36473583 results->dirty[intel_crtc->pipe] = true;
36483584
3649− skl_update_other_pipe_wm(dev, crtc, &config, results);
3585+ skl_update_other_pipe_wm(dev, crtc, results);
36503586 skl_write_wm_values(dev_priv, results);
36513587 skl_flush_wm_values(dev_priv, results);
36523588
@@ -3654,71 +3590,23 @@ static void skl_update_wm(struct drm_crtc *crtc) · 1 unmodified line
36543590 dev_priv->wm.skl_hw = *results;
36553591 }
36563592
3657−static void
3658−skl_update_sprite_wm(struct drm_plane *plane, struct drm_crtc *crtc,
3659− uint32_t sprite_width, uint32_t sprite_height,
3660− int pixel_size, bool enabled, bool scaled)
3661−{
3662− struct intel_plane *intel_plane = to_intel_plane(plane);
3663− struct drm_framebuffer *fb = plane->state->fb;
3664−
3665− intel_plane->wm.enabled = enabled;
3666− intel_plane->wm.scaled = scaled;
3667− intel_plane->wm.horiz_pixels = sprite_width;
3668− intel_plane->wm.vert_pixels = sprite_height;
3669− intel_plane->wm.tiling = DRM_FORMAT_MOD_NONE;
3670−
3671− /* For planar: Bpp is for UV plane, y_Bpp is for Y plane */
3672− intel_plane->wm.bytes_per_pixel =
3673− (fb && fb->pixel_format == DRM_FORMAT_NV12) ?
3674− drm_format_plane_cpp(plane->state->fb->pixel_format, 1) : pixel_size;
3675− intel_plane->wm.y_bytes_per_pixel =
3676− (fb && fb->pixel_format == DRM_FORMAT_NV12) ?
3677− drm_format_plane_cpp(plane->state->fb->pixel_format, 0) : 0;
3678−
3679− /*
3680− * Framebuffer can be NULL on plane disable, but it does not
3681− * matter for watermarks if we assume no tiling in that case.
3682− */
3683− if (fb)
3684− intel_plane->wm.tiling = fb->modifier[0];
3685− intel_plane->wm.rotation = plane->state->rotation;
3686−
3687− skl_update_wm(crtc);
3688−}
3689−
3690−static void ilk_update_wm(struct drm_crtc *crtc)
3593+static void ilk_program_watermarks(struct drm_i915_private *dev_priv)
36913594 {
3692− struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3693− struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
3694− struct drm_device *dev = crtc->dev;
3695− struct drm_i915_private *dev_priv = dev->dev_private;
3595+ struct drm_device *dev = dev_priv->dev;
3596+ struct intel_pipe_wm lp_wm_1_2 = {}, lp_wm_5_6 = {}, *best_lp_wm;
36963597 struct ilk_wm_maximums max;
3598+ struct intel_wm_config *config = &dev_priv->wm.config;
36973599 struct ilk_wm_values results = {};
36983600 enum intel_ddb_partitioning partitioning;
3699− struct intel_pipe_wm pipe_wm = {};
3700− struct intel_pipe_wm lp_wm_1_2 = {}, lp_wm_5_6 = {}, *best_lp_wm;
3701− struct intel_wm_config config = {};
3702−
3703− WARN_ON(cstate->base.active != intel_crtc->active);
3704−
3705− intel_compute_pipe_wm(cstate, &pipe_wm);
37063601
3707− if (!memcmp(&intel_crtc->wm.active, &pipe_wm, sizeof(pipe_wm)))
3708− return;
3709−
3710− intel_crtc->wm.active = pipe_wm;
3711−
3712− ilk_compute_wm_config(dev, &config);
3713−
3714− ilk_compute_wm_maximums(dev, 1, &config, INTEL_DDB_PART_1_2, &max);
3715− ilk_wm_merge(dev, &config, &max, &lp_wm_1_2);
3602+ ilk_compute_wm_maximums(dev, 1, config, INTEL_DDB_PART_1_2, &max);
3603+ ilk_wm_merge(dev, config, &max, &lp_wm_1_2);
37163604
37173605 /* 5/6 split only in single pipe config on IVB+ */
37183606 if (INTEL_INFO(dev)->gen >= 7 &&
3719− config.num_pipes_active == 1 && config.sprites_enabled) {
3720− ilk_compute_wm_maximums(dev, 1, &config, INTEL_DDB_PART_5_6, &max);
3721− ilk_wm_merge(dev, &config, &max, &lp_wm_5_6);
3607+ config->num_pipes_active == 1 && config->sprites_enabled) {
3608+ ilk_compute_wm_maximums(dev, 1, config, INTEL_DDB_PART_5_6, &max);
3609+ ilk_wm_merge(dev, config, &max, &lp_wm_5_6);
37223610
37233611 best_lp_wm = ilk_find_best_result(dev, &lp_wm_1_2, &lp_wm_5_6);
37243612 } else {
@@ -3733,14 +3621,13 @@ static void ilk_update_wm(struct drm_crtc *crtc) · 8 unmodified lines
37333621 ilk_write_wm_values(dev_priv, &results);
37343622 }
37353623
3736−static void
3737−ilk_update_sprite_wm(struct drm_plane *plane,
3738− struct drm_crtc *crtc,
3739− uint32_t sprite_width, uint32_t sprite_height,
3740− int pixel_size, bool enabled, bool scaled)
3624+static void ilk_update_wm(struct drm_crtc *crtc)
37413625 {
3742− struct drm_device *dev = plane->dev;
3743− struct intel_plane *intel_plane = to_intel_plane(plane);
3626+ struct drm_i915_private *dev_priv = to_i915(crtc->dev);
3627+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3628+ struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
3629+
3630+ WARN_ON(cstate->base.active != intel_crtc->active);
37443631
37453632 /*
37463633 * IVB workaround: must disable low power watermarks for at least
@@ -3749,10 +3636,14 @@ ilk_update_sprite_wm(struct drm_plane *plane, · 2 unmodified lines
37493636 *
37503637 * WaCxSRDisabledForSpriteScaling:ivb
37513638 */
3752− if (IS_IVYBRIDGE(dev) && scaled && ilk_disable_lp_wm(dev))
3753− intel_wait_for_vblank(dev, intel_plane->pipe);
3639+ if (cstate->disable_lp_wm) {
3640+ ilk_disable_lp_wm(crtc->dev);
3641+ intel_wait_for_vblank(crtc->dev, intel_crtc->pipe);
3642+ }
3643+
3644+ intel_crtc->wm.active.ilk = cstate->wm.optimal.ilk;
37543645
3755− ilk_update_wm(crtc);
3646+ ilk_program_watermarks(dev_priv);
37563647 }
37573648
37583649 static void skl_pipe_wm_active_state(uint32_t val,
@@ -3805,7 +3696,8 @@ static void skl_pipe_wm_get_hw_state(struct drm_crtc *crtc) · 46 unmodified lines
38053696 struct drm_i915_private *dev_priv = dev->dev_private;
38063697 struct skl_wm_values *hw = &dev_priv->wm.skl_hw;
38073698 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3808− struct skl_pipe_wm *active = &intel_crtc->wm.skl_active;
3699+ struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
3700+ struct skl_pipe_wm *active = &cstate->wm.optimal.skl;
38093701 enum pipe pipe = intel_crtc->pipe;
38103702 int level, i, max_level;
38113703 uint32_t temp;
@@ -3849,6 +3741,8 @@ static void skl_pipe_wm_get_hw_state(struct drm_crtc *crtc) · 37 unmodified lines
38493741
38503742 temp = hw->plane_trans[pipe][PLANE_CURSOR];
38513743 skl_pipe_wm_active_state(temp, active, true, true, i, 0);
3744+
3745+ intel_crtc->wm.active.skl = *active;
38523746 }
38533747
38543748 void skl_wm_get_hw_state(struct drm_device *dev)
@@ -3868,9 +3762,10 @@ static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc) · 13 unmodified lines
38683762 struct drm_i915_private *dev_priv = dev->dev_private;
38693763 struct ilk_wm_values *hw = &dev_priv->wm.hw;
38703764 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3871− struct intel_pipe_wm *active = &intel_crtc->wm.active;
3765+ struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
3766+ struct intel_pipe_wm *active = &cstate->wm.optimal.ilk;
38723767 enum pipe pipe = intel_crtc->pipe;
3873− static const unsigned int wm0_pipe_reg[] = {
3768+ static const i915_reg_t wm0_pipe_reg[] = {
38743769 [PIPE_A] = WM0_PIPEA_ILK,
38753770 [PIPE_B] = WM0_PIPEB_ILK,
38763771 [PIPE_C] = WM0_PIPEC_IVB,
@@ -3907,6 +3802,8 @@ static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc) · 30 unmodified lines
39073802 for (level = 0; level <= max_level; level++)
39083803 active->wm[level].enable = true;
39093804 }
3805+
3806+ intel_crtc->wm.active.ilk = *active;
39103807 }
39113808
39123809 #define _FW_WM(value, plane) \
@@ -4132,21 +4029,6 @@ void intel_update_watermarks(struct drm_crtc *crtc) · 219 unmodified lines
41324029 dev_priv->display.update_wm(crtc);
41334030 }
41344031
4135−void intel_update_sprite_watermarks(struct drm_plane *plane,
4136− struct drm_crtc *crtc,
4137− uint32_t sprite_width,
4138− uint32_t sprite_height,
4139− int pixel_size,
4140− bool enabled, bool scaled)
4141−{
4142− struct drm_i915_private *dev_priv = plane->dev->dev_private;
4143−
4144− if (dev_priv->display.update_sprite_wm)
4145− dev_priv->display.update_sprite_wm(plane, crtc,
4146− sprite_width, sprite_height,
4147− pixel_size, enabled, scaled);
4148−}
4149−
41504032 /**
41514033 * Lock protecting IPS related data structures
41524034 */
@@ -4414,7 +4296,7 @@ static void gen6_set_rps(struct drm_device *dev, u8 val) · 261 unmodified lines
44144296 struct drm_i915_private *dev_priv = dev->dev_private;
44154297
44164298 /* WaGsvDisableTurbo: Workaround to disable turbo on BXT A* */
4417− if (IS_BROXTON(dev) && (INTEL_REVID(dev) < BXT_REVID_B0))
4299+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1))
44184300 return;
44194301
44204302 WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
@@ -4689,7 +4571,8 @@ static void gen6_init_rps_frequencies(struct drm_device *dev) · 268 unmodified lines
46894571 dev_priv->rps.max_freq = dev_priv->rps.rp0_freq;
46904572
46914573 dev_priv->rps.efficient_freq = dev_priv->rps.rp1_freq;
4692− if (IS_HASWELL(dev) || IS_BROADWELL(dev) || IS_SKYLAKE(dev)) {
4574+ if (IS_HASWELL(dev) || IS_BROADWELL(dev) ||
4575+ IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
46934576 ret = sandybridge_pcode_read(dev_priv,
46944577 HSW_PCODE_DYNAMIC_DUTY_CYCLE_CONTROL,
46954578 &ddcc_status);
@@ -4701,7 +4584,7 @@ static void gen6_init_rps_frequencies(struct drm_device *dev) · 5 unmodified lines
47014584 dev_priv->rps.max_freq);
47024585 }
47034586
4704− if (IS_SKYLAKE(dev)) {
4587+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
47054588 /* Store the frequency values in 16.66 MHZ units, which is
47064589 the natural hardware unit for SKL */
47074590 dev_priv->rps.rp0_freq *= GEN9_FREQ_SCALER;
@@ -4738,7 +4621,7 @@ static void gen9_enable_rps(struct drm_device *dev) · 30 unmodified lines
47384621 gen6_init_rps_frequencies(dev);
47394622
47404623 /* WaGsvDisableTurbo: Workaround to disable turbo on BXT A* */
4741− if (IS_BROXTON(dev) && (INTEL_REVID(dev) < BXT_REVID_B0)) {
4624+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1)) {
47424625 intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
47434626 return;
47444627 }
@@ -4806,8 +4689,8 @@ static void gen9_enable_rc6(struct drm_device *dev) · 61 unmodified lines
48064689 DRM_INFO("RC6 %s\n", (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ?
48074690 "on" : "off");
48084691 /* WaRsUseTimeoutMode */
4809− if ((IS_SKYLAKE(dev) && INTEL_REVID(dev) <= SKL_REVID_D0) ||
4810− (IS_BROXTON(dev) && INTEL_REVID(dev) <= BXT_REVID_A0)) {
4692+ if (IS_SKL_REVID(dev, 0, SKL_REVID_D0) ||
4693+ IS_BXT_REVID(dev, 0, BXT_REVID_A1)) {
48114694 I915_WRITE(GEN6_RC6_THRESHOLD, 625); /* 800us */
48124695 I915_WRITE(GEN6_RC_CONTROL, GEN6_RC_CTL_HW_ENABLE |
48134696 GEN7_RC_CTL_TO_MODE |
@@ -5055,7 +4938,7 @@ static void __gen6_update_ring_freq(struct drm_device *dev) · 241 unmodified lines
50554938 /* convert DDR frequency from units of 266.6MHz to bandwidth */
50564939 min_ring_freq = mult_frac(min_ring_freq, 8, 3);
50574940
5058− if (IS_SKYLAKE(dev)) {
4941+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
50594942 /* Convert GT frequency to 50 HZ units */
50604943 min_gpu_freq = dev_priv->rps.min_freq / GEN9_FREQ_SCALER;
50614944 max_gpu_freq = dev_priv->rps.max_freq / GEN9_FREQ_SCALER;
@@ -5073,7 +4956,7 @@ static void __gen6_update_ring_freq(struct drm_device *dev) · 11 unmodified lines
50734956 int diff = max_gpu_freq - gpu_freq;
50744957 unsigned int ia_freq = 0, ring_freq = 0;
50754958
5076− if (IS_SKYLAKE(dev)) {
4959+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
50774960 /*
50784961 * ring_freq = 2 * GT. ring_freq is in 100MHz units
50794962 * No floor required for ring frequency on SKL.
@@ -6201,7 +6084,7 @@ static void intel_gen6_powersave_work(struct work_struct *work) · 1121 unmodified lines
62016084 } else if (INTEL_INFO(dev)->gen >= 9) {
62026085 gen9_enable_rc6(dev);
62036086 gen9_enable_rps(dev);
6204− if (IS_SKYLAKE(dev))
6087+ if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
62056088 __gen6_update_ring_freq(dev);
62066089 } else if (IS_BROADWELL(dev)) {
62076090 gen8_enable_rps(dev);
@@ -7057,7 +6940,6 @@ void intel_init_pm(struct drm_device *dev) · 849 unmodified lines
70576940 dev_priv->display.init_clock_gating =
70586941 bxt_init_clock_gating;
70596942 dev_priv->display.update_wm = skl_update_wm;
7060− dev_priv->display.update_sprite_wm = skl_update_sprite_wm;
70616943 } else if (HAS_PCH_SPLIT(dev)) {
70626944 ilk_setup_wm_latency(dev);
70636945
@@ -7066,7 +6948,7 @@ void intel_init_pm(struct drm_device *dev) · 2 unmodified lines
70666948 (!IS_GEN5(dev) && dev_priv->wm.pri_latency[0] &&
70676949 dev_priv->wm.spr_latency[0] && dev_priv->wm.cur_latency[0])) {
70686950 dev_priv->display.update_wm = ilk_update_wm;
7069− dev_priv->display.update_sprite_wm = ilk_update_sprite_wm;
6951+ dev_priv->display.compute_pipe_wm = ilk_compute_pipe_wm;
70706952 } else {
70716953 DRM_DEBUG_KMS("Failed to read display plane latency. "
70726954 "Disable CxSR\n");
drivers/gpu/drm/i915/intel_psr.c+52−25
@@ -80,7 +80,7 @@ static void intel_psr_write_vsc(struct intel_dp *intel_dp, · 79 unmodified lines
8080 struct drm_i915_private *dev_priv = dev->dev_private;
8181 struct intel_crtc *crtc = to_intel_crtc(dig_port->base.base.crtc);
8282 enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
83− u32 ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder);
83+ i915_reg_t ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder);
8484 uint32_t *data = (uint32_t *) vsc_psr;
8585 unsigned int i;
8686
@@ -151,13 +151,31 @@ static void vlv_psr_enable_sink(struct intel_dp *intel_dp) · 64 unmodified lines
151151 DP_PSR_ENABLE | DP_PSR_MAIN_LINK_ACTIVE);
152152 }
153153
154+static i915_reg_t psr_aux_ctl_reg(struct drm_i915_private *dev_priv,
155+ enum port port)
156+{
157+ if (INTEL_INFO(dev_priv)->gen >= 9)
158+ return DP_AUX_CH_CTL(port);
159+ else
160+ return EDP_PSR_AUX_CTL;
161+}
162+
163+static i915_reg_t psr_aux_data_reg(struct drm_i915_private *dev_priv,
164+ enum port port, int index)
165+{
166+ if (INTEL_INFO(dev_priv)->gen >= 9)
167+ return DP_AUX_CH_DATA(port, index);
168+ else
169+ return EDP_PSR_AUX_DATA(index);
170+}
171+
154172 static void hsw_psr_enable_sink(struct intel_dp *intel_dp)
155173 {
156174 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
157175 struct drm_device *dev = dig_port->base.base.dev;
158176 struct drm_i915_private *dev_priv = dev->dev_private;
159177 uint32_t aux_clock_divider;
160− uint32_t aux_data_reg, aux_ctl_reg;
178+ i915_reg_t aux_ctl_reg;
161179 int precharge = 0x3;
162180 static const uint8_t aux_msg[] = {
163181 [0] = DP_AUX_NATIVE_WRITE << 4,
@@ -166,6 +184,7 @@ static void hsw_psr_enable_sink(struct intel_dp *intel_dp) · 2 unmodified lines
166184 [3] = 1 - 1,
167185 [4] = DP_SET_POWER_D0,
168186 };
187+ enum port port = dig_port->port;
169188 int i;
170189
171190 BUILD_BUG_ON(sizeof(aux_msg) > 20);
@@ -181,14 +200,11 @@ static void hsw_psr_enable_sink(struct intel_dp *intel_dp) · 9 unmodified lines
181200 DP_SINK_DEVICE_AUX_FRAME_SYNC_CONF,
182201 DP_AUX_FRAME_SYNC_ENABLE);
183202
184− aux_data_reg = (INTEL_INFO(dev)->gen >= 9) ?
185− DPA_AUX_CH_DATA1 : EDP_PSR_AUX_DATA1(dev);
186− aux_ctl_reg = (INTEL_INFO(dev)->gen >= 9) ?
187− DPA_AUX_CH_CTL : EDP_PSR_AUX_CTL(dev);
203+ aux_ctl_reg = psr_aux_ctl_reg(dev_priv, port);
188204
189205 /* Setup AUX registers */
190206 for (i = 0; i < sizeof(aux_msg); i += 4)
191− I915_WRITE(aux_data_reg + i,
207+ I915_WRITE(psr_aux_data_reg(dev_priv, port, i >> 2),
192208 intel_dp_pack_aux(&aux_msg[i], sizeof(aux_msg) - i));
193209
194210 if (INTEL_INFO(dev)->gen >= 9) {
@@ -267,16 +283,11 @@ static void hsw_psr_enable_source(struct intel_dp *intel_dp) · 72 unmodified lines
267283 const uint32_t link_entry_time = EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
268284
269285 if (intel_dp->psr_dpcd[1] & DP_PSR_NO_TRAIN_ON_EXIT) {
270− /* It doesn't mean we shouldn't send TPS patters, so let's
271− send the minimal TP1 possible and skip TP2. */
272− val |= EDP_PSR_TP1_TIME_100us;
273− val |= EDP_PSR_TP2_TP3_TIME_0us;
274− val |= EDP_PSR_SKIP_AUX_EXIT;
275286 /* Sink should be able to train with the 5 or 6 idle patterns */
276287 idle_frames += 4;
277288 }
278289
279− I915_WRITE(EDP_PSR_CTL(dev), val |
290+ I915_WRITE(EDP_PSR_CTL, val |
280291 (IS_BROADWELL(dev) ? 0 : link_entry_time) |
281292 max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT |
282293 idle_frames << EDP_PSR_IDLE_FRAME_SHIFT |
@@ -340,7 +351,7 @@ static void intel_psr_activate(struct intel_dp *intel_dp) · 57 unmodified lines
340351 struct drm_device *dev = intel_dig_port->base.base.dev;
341352 struct drm_i915_private *dev_priv = dev->dev_private;
342353
343− WARN_ON(I915_READ(EDP_PSR_CTL(dev)) & EDP_PSR_ENABLE);
354+ WARN_ON(I915_READ(EDP_PSR_CTL) & EDP_PSR_ENABLE);
344355 WARN_ON(dev_priv->psr.active);
345356 lockdep_assert_held(&dev_priv->psr.lock);
346357
@@ -404,7 +415,7 @@ void intel_psr_enable(struct intel_dp *intel_dp) · 57 unmodified lines
404415 }
405416
406417 /* Avoid continuous PSR exit by masking memup and hpd */
407− I915_WRITE(EDP_PSR_DEBUG_CTL(dev), EDP_PSR_DEBUG_MASK_MEMUP |
418+ I915_WRITE(EDP_PSR_DEBUG_CTL, EDP_PSR_DEBUG_MASK_MEMUP |
408419 EDP_PSR_DEBUG_MASK_HPD);
409420
410421 /* Enable PSR on the panel */
@@ -427,6 +438,19 @@ void intel_psr_enable(struct intel_dp *intel_dp) · 16 unmodified lines
427438 vlv_psr_enable_source(intel_dp);
428439 }
429440
441+ /*
442+ * FIXME: Activation should happen immediately since this function
443+ * is just called after pipe is fully trained and enabled.
444+ * However on every platform we face issues when first activation
445+ * follows a modeset so quickly.
446+ * - On VLV/CHV we get bank screen on first activation
447+ * - On HSW/BDW we get a recoverable frozen screen until next
448+ * exit-activate sequence.
449+ */
450+ if (INTEL_INFO(dev)->gen < 9)
451+ schedule_delayed_work(&dev_priv->psr.work,
452+ msecs_to_jiffies(intel_dp->panel_power_cycle_delay * 5));
453+
430454 dev_priv->psr.enabled = intel_dp;
431455 unlock:
432456 mutex_unlock(&dev_priv->psr.lock);
@@ -466,17 +490,17 @@ static void hsw_psr_disable(struct intel_dp *intel_dp) · 33 unmodified lines
466490 struct drm_i915_private *dev_priv = dev->dev_private;
467491
468492 if (dev_priv->psr.active) {
469− I915_WRITE(EDP_PSR_CTL(dev),
470− I915_READ(EDP_PSR_CTL(dev)) & ~EDP_PSR_ENABLE);
493+ I915_WRITE(EDP_PSR_CTL,
494+ I915_READ(EDP_PSR_CTL) & ~EDP_PSR_ENABLE);
471495
472496 /* Wait till PSR is idle */
473− if (_wait_for((I915_READ(EDP_PSR_STATUS_CTL(dev)) &
497+ if (_wait_for((I915_READ(EDP_PSR_STATUS_CTL) &
474498 EDP_PSR_STATUS_STATE_MASK) == 0, 2000, 10))
475499 DRM_ERROR("Timed out waiting for PSR Idle State\n");
476500
477501 dev_priv->psr.active = false;
478502 } else {
479− WARN_ON(I915_READ(EDP_PSR_CTL(dev)) & EDP_PSR_ENABLE);
503+ WARN_ON(I915_READ(EDP_PSR_CTL) & EDP_PSR_ENABLE);
480504 }
481505 }
482506
@@ -523,7 +547,7 @@ static void intel_psr_work(struct work_struct *work) · 40 unmodified lines
523547 * and be ready for re-enable.
524548 */
525549 if (HAS_DDI(dev_priv->dev)) {
526− if (wait_for((I915_READ(EDP_PSR_STATUS_CTL(dev_priv->dev)) &
550+ if (wait_for((I915_READ(EDP_PSR_STATUS_CTL) &
527551 EDP_PSR_STATUS_STATE_MASK) == 0, 50)) {
528552 DRM_ERROR("Timed out waiting for PSR Idle for re-enable\n");
529553 return;
@@ -566,11 +590,11 @@ static void intel_psr_exit(struct drm_device *dev) · 36 unmodified lines
566590 return;
567591
568592 if (HAS_DDI(dev)) {
569− val = I915_READ(EDP_PSR_CTL(dev));
593+ val = I915_READ(EDP_PSR_CTL);
570594
571595 WARN_ON(!(val & EDP_PSR_ENABLE));
572596
573− I915_WRITE(EDP_PSR_CTL(dev), val & ~EDP_PSR_ENABLE);
597+ I915_WRITE(EDP_PSR_CTL, val & ~EDP_PSR_ENABLE);
574598 } else {
575599 val = I915_READ(VLV_PSRCTL(pipe));
576600
@@ -700,7 +724,6 @@ void intel_psr_flush(struct drm_device *dev, · 123 unmodified lines
700724 struct drm_i915_private *dev_priv = dev->dev_private;
701725 struct drm_crtc *crtc;
702726 enum pipe pipe;
703− int delay_ms = HAS_DDI(dev) ? 100 : 500;
704727
705728 mutex_lock(&dev_priv->psr.lock);
706729 if (!dev_priv->psr.enabled) {
@@ -735,8 +758,9 @@ void intel_psr_flush(struct drm_device *dev, · 28 unmodified lines
735758 }
736759
737760 if (!dev_priv->psr.active && !dev_priv->psr.busy_frontbuffer_bits)
738− schedule_delayed_work(&dev_priv->psr.work,
739− msecs_to_jiffies(delay_ms));
761+ if (!work_busy(&dev_priv->psr.work.work))
762+ schedule_delayed_work(&dev_priv->psr.work,
763+ msecs_to_jiffies(100));
740764 mutex_unlock(&dev_priv->psr.lock);
741765 }
742766
@@ -751,6 +775,9 @@ void intel_psr_init(struct drm_device *dev) · 8 unmodified lines
751775 {
752776 struct drm_i915_private *dev_priv = dev->dev_private;
753777
778+ dev_priv->psr_mmio_base = IS_HASWELL(dev_priv) ?
779+ HSW_EDP_PSR_BASE : BDW_EDP_PSR_BASE;
780+
754781 INIT_DELAYED_WORK(&dev_priv->psr.work, intel_psr_work);
755782 mutex_init(&dev_priv->psr.lock);
756783 }
drivers/gpu/drm/i915/intel_ringbuffer.c+100−56
@@ -481,7 +481,7 @@ static void intel_ring_setup_status_page(struct intel_engine_cs *ring) · 480 unmodified lines
481481 {
482482 struct drm_device *dev = ring->dev;
483483 struct drm_i915_private *dev_priv = ring->dev->dev_private;
484− u32 mmio = 0;
484+ i915_reg_t mmio;
485485
486486 /* The ring status page addresses are no longer next to the rest of
487487 * the ring registers as of gen7.
@@ -524,7 +524,7 @@ static void intel_ring_setup_status_page(struct intel_engine_cs *ring) · 36 unmodified lines
524524 * invalidating the TLB?
525525 */
526526 if (INTEL_INFO(dev)->gen >= 6 && INTEL_INFO(dev)->gen < 8) {
527− u32 reg = RING_INSTPM(ring->mmio_base);
527+ i915_reg_t reg = RING_INSTPM(ring->mmio_base);
528528
529529 /* ring should be idle before issuing a sync flush*/
530530 WARN_ON((I915_READ_MODE(ring) & MODE_IDLE) == 0);
@@ -733,7 +733,7 @@ static int intel_ring_workarounds_emit(struct drm_i915_gem_request *req) · 202 unmodified lines
733733
734734 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(w->count));
735735 for (i = 0; i < w->count; i++) {
736− intel_ring_emit(ring, w->reg[i].addr);
736+ intel_ring_emit_reg(ring, w->reg[i].addr);
737737 intel_ring_emit(ring, w->reg[i].value);
738738 }
739739 intel_ring_emit(ring, MI_NOOP);
@@ -766,7 +766,8 @@ static int intel_rcs_ctx_init(struct drm_i915_gem_request *req) · 26 unmodified lines
766766 }
767767
768768 static int wa_add(struct drm_i915_private *dev_priv,
769− const u32 addr, const u32 mask, const u32 val)
769+ i915_reg_t addr,
770+ const u32 mask, const u32 val)
770771 {
771772 const u32 idx = dev_priv->workarounds.count;
772773
@@ -924,17 +925,15 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring) · 151 unmodified lines
924925 WA_SET_BIT_MASKED(HALF_SLICE_CHICKEN3,
925926 GEN9_DISABLE_OCL_OOB_SUPPRESS_LOGIC);
926927
927− if ((IS_SKYLAKE(dev) && (INTEL_REVID(dev) == SKL_REVID_A0 ||
928− INTEL_REVID(dev) == SKL_REVID_B0)) ||
929− (IS_BROXTON(dev) && INTEL_REVID(dev) < BXT_REVID_B0)) {
930− /* WaDisableDgMirrorFixInHalfSliceChicken5:skl,bxt */
928+ /* WaDisableDgMirrorFixInHalfSliceChicken5:skl,bxt */
929+ if (IS_SKL_REVID(dev, 0, SKL_REVID_B0) ||
930+ IS_BXT_REVID(dev, 0, BXT_REVID_A1))
931931 WA_CLR_BIT_MASKED(GEN9_HALF_SLICE_CHICKEN5,
932932 GEN9_DG_MIRROR_FIX_ENABLE);
933− }
934933
935− if ((IS_SKYLAKE(dev) && INTEL_REVID(dev) <= SKL_REVID_B0) ||
936− (IS_BROXTON(dev) && INTEL_REVID(dev) < BXT_REVID_B0)) {
937− /* WaSetDisablePixMaskCammingAndRhwoInCommonSliceChicken:skl,bxt */
934+ /* WaSetDisablePixMaskCammingAndRhwoInCommonSliceChicken:skl,bxt */
935+ if (IS_SKL_REVID(dev, 0, SKL_REVID_B0) ||
936+ IS_BXT_REVID(dev, 0, BXT_REVID_A1)) {
938937 WA_SET_BIT_MASKED(GEN7_COMMON_SLICE_CHICKEN1,
939938 GEN9_RHWO_OPTIMIZATION_DISABLE);
940939 /*
@@ -944,12 +943,10 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring) · 3 unmodified lines
944943 */
945944 }
946945
947− if ((IS_SKYLAKE(dev) && INTEL_REVID(dev) >= SKL_REVID_C0) ||
948− IS_BROXTON(dev)) {
949− /* WaEnableYV12BugFixInHalfSliceChicken7:skl,bxt */
946+ /* WaEnableYV12BugFixInHalfSliceChicken7:skl,bxt */
947+ if (IS_SKL_REVID(dev, SKL_REVID_C0, REVID_FOREVER) || IS_BROXTON(dev))
950948 WA_SET_BIT_MASKED(GEN9_HALF_SLICE_CHICKEN7,
951949 GEN9_ENABLE_YV12_BUGFIX);
952− }
953950
954951 /* Wa4x4STCOptimizationDisable:skl,bxt */
955952 /* WaDisablePartialResolveInVc:skl,bxt */
@@ -961,24 +958,22 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring) · 5 unmodified lines
961958 GEN9_CCS_TLB_PREFETCH_ENABLE);
962959
963960 /* WaDisableMaskBasedCammingInRCC:skl,bxt */
964− if ((IS_SKYLAKE(dev) && INTEL_REVID(dev) == SKL_REVID_C0) ||
965− (IS_BROXTON(dev) && INTEL_REVID(dev) < BXT_REVID_B0))
961+ if (IS_SKL_REVID(dev, SKL_REVID_C0, SKL_REVID_C0) ||
962+ IS_BXT_REVID(dev, 0, BXT_REVID_A1))
966963 WA_SET_BIT_MASKED(SLICE_ECO_CHICKEN0,
967964 PIXEL_MASK_CAMMING_DISABLE);
968965
969966 /* WaForceContextSaveRestoreNonCoherent:skl,bxt */
970967 tmp = HDC_FORCE_CONTEXT_SAVE_RESTORE_NON_COHERENT;
971− if ((IS_SKYLAKE(dev) && INTEL_REVID(dev) == SKL_REVID_F0) ||
972− (IS_BROXTON(dev) && INTEL_REVID(dev) >= BXT_REVID_B0))
968+ if (IS_SKL_REVID(dev, SKL_REVID_F0, SKL_REVID_F0) ||
969+ IS_BXT_REVID(dev, BXT_REVID_B0, REVID_FOREVER))
973970 tmp |= HDC_FORCE_CSR_NON_COHERENT_OVR_DISABLE;
974971 WA_SET_BIT_MASKED(HDC_CHICKEN0, tmp);
975972
976973 /* WaDisableSamplerPowerBypassForSOPingPong:skl,bxt */
977− if (IS_SKYLAKE(dev) ||
978− (IS_BROXTON(dev) && INTEL_REVID(dev) <= BXT_REVID_B0)) {
974+ if (IS_SKYLAKE(dev) || IS_BXT_REVID(dev, 0, BXT_REVID_B0))
979975 WA_SET_BIT_MASKED(HALF_SLICE_CHICKEN3,
980976 GEN8_SAMPLER_POWER_BYPASS_DIS);
981− }
982977
983978 /* WaDisableSTUnitPowerOptimization:skl,bxt */
984979 WA_SET_BIT_MASKED(HALF_SLICE_CHICKEN2, GEN8_ST_PO_DISABLE);
@@ -1038,7 +1033,7 @@ static int skl_init_workarounds(struct intel_engine_cs *ring) · 53 unmodified lines
10381033 if (ret)
10391034 return ret;
10401035
1041− if (INTEL_REVID(dev) <= SKL_REVID_D0) {
1036+ if (IS_SKL_REVID(dev, 0, SKL_REVID_D0)) {
10421037 /* WaDisableHDCInvalidation:skl */
10431038 I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) |
10441039 BDW_DISABLE_HDC_INVALIDATION);
@@ -1051,23 +1046,23 @@ static int skl_init_workarounds(struct intel_engine_cs *ring) · 6 unmodified lines
10511046 /* GEN8_L3SQCREG4 has a dependency with WA batch so any new changes
10521047 * involving this register should also be added to WA batch as required.
10531048 */
1054− if (INTEL_REVID(dev) <= SKL_REVID_E0)
1049+ if (IS_SKL_REVID(dev, 0, SKL_REVID_E0))
10551050 /* WaDisableLSQCROPERFforOCL:skl */
10561051 I915_WRITE(GEN8_L3SQCREG4, I915_READ(GEN8_L3SQCREG4) |
10571052 GEN8_LQSC_RO_PERF_DIS);
10581053
10591054 /* WaEnableGapsTsvCreditFix:skl */
1060− if (IS_SKYLAKE(dev) && (INTEL_REVID(dev) >= SKL_REVID_C0)) {
1055+ if (IS_SKL_REVID(dev, SKL_REVID_C0, REVID_FOREVER)) {
10611056 I915_WRITE(GEN8_GARBCNTL, (I915_READ(GEN8_GARBCNTL) |
10621057 GEN9_GAPS_TSV_CREDIT_DISABLE));
10631058 }
10641059
10651060 /* WaDisablePowerCompilerClockGating:skl */
1066− if (INTEL_REVID(dev) == SKL_REVID_B0)
1061+ if (IS_SKL_REVID(dev, SKL_REVID_B0, SKL_REVID_B0))
10671062 WA_SET_BIT_MASKED(HIZ_CHICKEN,
10681063 BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE);
10691064
1070− if (INTEL_REVID(dev) <= SKL_REVID_D0) {
1065+ if (IS_SKL_REVID(dev, 0, SKL_REVID_D0)) {
10711066 /*
10721067 *Use Force Non-Coherent whenever executing a 3D context. This
10731068 * is a workaround for a possible hang in the unlikely event
@@ -1078,19 +1073,17 @@ static int skl_init_workarounds(struct intel_engine_cs *ring) · 4 unmodified lines
10781073 HDC_FORCE_NON_COHERENT);
10791074 }
10801075
1081− if (INTEL_REVID(dev) == SKL_REVID_C0 ||
1082− INTEL_REVID(dev) == SKL_REVID_D0)
1083− /* WaBarrierPerformanceFixDisable:skl */
1076+ /* WaBarrierPerformanceFixDisable:skl */
1077+ if (IS_SKL_REVID(dev, SKL_REVID_C0, SKL_REVID_D0))
10841078 WA_SET_BIT_MASKED(HDC_CHICKEN0,
10851079 HDC_FENCE_DEST_SLM_DISABLE |
10861080 HDC_BARRIER_PERFORMANCE_DISABLE);
10871081
10881082 /* WaDisableSbeCacheDispatchPortSharing:skl */
1089− if (INTEL_REVID(dev) <= SKL_REVID_F0) {
1083+ if (IS_SKL_REVID(dev, 0, SKL_REVID_F0))
10901084 WA_SET_BIT_MASKED(
10911085 GEN7_HALF_SLICE_CHICKEN1,
10921086 GEN7_SBE_SS_CACHE_DISPATCH_PORT_SHARING_DISABLE);
1093− }
10941087
10951088 return skl_tune_iz_hashing(ring);
10961089 }
@@ -1107,11 +1100,11 @@ static int bxt_init_workarounds(struct intel_engine_cs *ring) · 10 unmodified lines
11071100
11081101 /* WaStoreMultiplePTEenable:bxt */
11091102 /* This is a requirement according to Hardware specification */
1110− if (INTEL_REVID(dev) == BXT_REVID_A0)
1103+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1))
11111104 I915_WRITE(TILECTL, I915_READ(TILECTL) | TILECTL_TLBPF);
11121105
11131106 /* WaSetClckGatingDisableMedia:bxt */
1114− if (INTEL_REVID(dev) == BXT_REVID_A0) {
1107+ if (IS_BXT_REVID(dev, 0, BXT_REVID_A1)) {
11151108 I915_WRITE(GEN7_MISCCPCTL, (I915_READ(GEN7_MISCCPCTL) &
11161109 ~GEN8_DOP_CLOCK_GATE_MEDIA_ENABLE));
11171110 }
@@ -1121,7 +1114,7 @@ static int bxt_init_workarounds(struct intel_engine_cs *ring) · 3 unmodified lines
11211114 STALL_DOP_GATING_DISABLE);
11221115
11231116 /* WaDisableSbeCacheDispatchPortSharing:bxt */
1124− if (INTEL_REVID(dev) <= BXT_REVID_B0) {
1117+ if (IS_BXT_REVID(dev, 0, BXT_REVID_B0)) {
11251118 WA_SET_BIT_MASKED(
11261119 GEN7_HALF_SLICE_CHICKEN1,
11271120 GEN7_SBE_SS_CACHE_DISPATCH_PORT_SHARING_DISABLE);
@@ -1319,11 +1312,13 @@ static int gen6_signal(struct drm_i915_gem_request *signaller_req, · 191 unmodified lines
13191312 return ret;
13201313
13211314 for_each_ring(useless, dev_priv, i) {
1322− u32 mbox_reg = signaller->semaphore.mbox.signal[i];
1323− if (mbox_reg != GEN6_NOSYNC) {
1315+ i915_reg_t mbox_reg = signaller->semaphore.mbox.signal[i];
1316+
1317+ if (i915_mmio_reg_valid(mbox_reg)) {
13241318 u32 seqno = i915_gem_request_get_seqno(signaller_req);
1319+
13251320 intel_ring_emit(signaller, MI_LOAD_REGISTER_IMM(1));
1326− intel_ring_emit(signaller, mbox_reg);
1321+ intel_ring_emit_reg(signaller, mbox_reg);
13271322 intel_ring_emit(signaller, seqno);
13281323 }
13291324 }
@@ -2004,11 +1999,35 @@ static int init_phys_status_page(struct intel_engine_cs *ring) · 674 unmodified lines
20041999
20052000 void intel_unpin_ringbuffer_obj(struct intel_ringbuffer *ringbuf)
20062001 {
2007− iounmap(ringbuf->virtual_start);
2002+ if (HAS_LLC(ringbuf->obj->base.dev) && !ringbuf->obj->stolen)
2003+ vunmap(ringbuf->virtual_start);
2004+ else
2005+ iounmap(ringbuf->virtual_start);
20082006 ringbuf->virtual_start = NULL;
20092007 i915_gem_object_ggtt_unpin(ringbuf->obj);
20102008 }
20112009
2010+static u32 *vmap_obj(struct drm_i915_gem_object *obj)
2011+{
2012+ struct sg_page_iter sg_iter;
2013+ struct page **pages;
2014+ void *addr;
2015+ int i;
2016+
2017+ pages = drm_malloc_ab(obj->base.size >> PAGE_SHIFT, sizeof(*pages));
2018+ if (pages == NULL)
2019+ return NULL;
2020+
2021+ i = 0;
2022+ for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0)
2023+ pages[i++] = sg_page_iter_page(&sg_iter);
2024+
2025+ addr = vmap(pages, i, 0, PAGE_KERNEL);
2026+ drm_free_large(pages);
2027+
2028+ return addr;
2029+}
2030+
20122031 int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev,
20132032 struct intel_ringbuffer *ringbuf)
20142033 {
@@ -2016,21 +2035,39 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev, · 1 unmodified line
20162035 struct drm_i915_gem_object *obj = ringbuf->obj;
20172036 int ret;
20182037
2019− ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, PIN_MAPPABLE);
2020− if (ret)
2021− return ret;
2038+ if (HAS_LLC(dev_priv) && !obj->stolen) {
2039+ ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, 0);
2040+ if (ret)
2041+ return ret;
20222042
2023− ret = i915_gem_object_set_to_gtt_domain(obj, true);
2024− if (ret) {
2025− i915_gem_object_ggtt_unpin(obj);
2026− return ret;
2027− }
2043+ ret = i915_gem_object_set_to_cpu_domain(obj, true);
2044+ if (ret) {
2045+ i915_gem_object_ggtt_unpin(obj);
2046+ return ret;
2047+ }
2048+
2049+ ringbuf->virtual_start = vmap_obj(obj);
2050+ if (ringbuf->virtual_start == NULL) {
2051+ i915_gem_object_ggtt_unpin(obj);
2052+ return -ENOMEM;
2053+ }
2054+ } else {
2055+ ret = i915_gem_obj_ggtt_pin(obj, PAGE_SIZE, PIN_MAPPABLE);
2056+ if (ret)
2057+ return ret;
20282058
2029− ringbuf->virtual_start = ioremap_wc(dev_priv->gtt.mappable_base +
2030− i915_gem_obj_ggtt_offset(obj), ringbuf->size);
2031− if (ringbuf->virtual_start == NULL) {
2032− i915_gem_object_ggtt_unpin(obj);
2033− return -EINVAL;
2059+ ret = i915_gem_object_set_to_gtt_domain(obj, true);
2060+ if (ret) {
2061+ i915_gem_object_ggtt_unpin(obj);
2062+ return ret;
2063+ }
2064+
2065+ ringbuf->virtual_start = ioremap_wc(dev_priv->gtt.mappable_base +
2066+ i915_gem_obj_ggtt_offset(obj), ringbuf->size);
2067+ if (ringbuf->virtual_start == NULL) {
2068+ i915_gem_object_ggtt_unpin(obj);
2069+ return -EINVAL;
2070+ }
20342071 }
20352072
20362073 return 0;
@@ -2070,10 +2107,14 @@ intel_engine_create_ringbuffer(struct intel_engine_cs *engine, int size) · 33 unmodified lines
20702107 int ret;
20712108
20722109 ring = kzalloc(sizeof(*ring), GFP_KERNEL);
2073− if (ring == NULL)
2110+ if (ring == NULL) {
2111+ DRM_DEBUG_DRIVER("Failed to allocate ringbuffer %s\n",
2112+ engine->name);
20742113 return ERR_PTR(-ENOMEM);
2114+ }
20752115
20762116 ring->ring = engine;
2117+ list_add(&ring->link, &engine->buffers);
20772118
20782119 ring->size = size;
20792120 /* Workaround an erratum on the i830 which causes a hang if
@@ -2089,8 +2130,9 @@ intel_engine_create_ringbuffer(struct intel_engine_cs *engine, int size) · 9 unmodified lines
20892130
20902131 ret = intel_alloc_ringbuffer_obj(engine->dev, ring);
20912132 if (ret) {
2092− DRM_ERROR("Failed to allocate ringbuffer %s: %d\n",
2093− engine->name, ret);
2133+ DRM_DEBUG_DRIVER("Failed to allocate ringbuffer %s: %d\n",
2134+ engine->name, ret);
2135+ list_del(&ring->link);
20942136 kfree(ring);
20952137 return ERR_PTR(ret);
20962138 }
@@ -2102,6 +2144,7 @@ void · 5 unmodified lines
21022144 intel_ringbuffer_free(struct intel_ringbuffer *ring)
21032145 {
21042146 intel_destroy_ringbuffer_obj(ring);
2147+ list_del(&ring->link);
21052148 kfree(ring);
21062149 }
21072150
@@ -2117,6 +2160,7 @@ static int intel_init_ring_buffer(struct drm_device *dev, · 9 unmodified lines
21172160 INIT_LIST_HEAD(&ring->active_list);
21182161 INIT_LIST_HEAD(&ring->request_list);
21192162 INIT_LIST_HEAD(&ring->execlist_queue);
2163+ INIT_LIST_HEAD(&ring->buffers);
21202164 i915_gem_batch_pool_init(dev, &ring->batch_pool);
21212165 memset(ring->semaphore.sync_seqno, 0, sizeof(ring->semaphore.sync_seqno));
21222166
drivers/gpu/drm/i915/intel_ringbuffer.h+8−1
@@ -100,6 +100,7 @@ struct intel_ringbuffer { · 99 unmodified lines
100100 void __iomem *virtual_start;
101101
102102 struct intel_engine_cs *ring;
103+ struct list_head link;
103104
104105 u32 head;
105106 u32 tail;
@@ -157,6 +158,7 @@ struct intel_engine_cs { · 51 unmodified lines
157158 u32 mmio_base;
158159 struct drm_device *dev;
159160 struct intel_ringbuffer *buffer;
161+ struct list_head buffers;
160162
161163 /*
162164 * A pool of objects to use as shadow copies of client batch buffers
@@ -247,7 +249,7 @@ struct intel_engine_cs { · 84 unmodified lines
247249 /* our mbox written by others */
248250 u32 wait[I915_NUM_RINGS];
249251 /* mboxes this ring signals to */
250− u32 signal[I915_NUM_RINGS];
252+ i915_reg_t signal[I915_NUM_RINGS];
251253 } mbox;
252254 u64 signal_ggtt[I915_NUM_RINGS];
253255 };
@@ -441,6 +443,11 @@ static inline void intel_ring_emit(struct intel_engine_cs *ring, · 187 unmodified lines
441443 iowrite32(data, ringbuf->virtual_start + ringbuf->tail);
442444 ringbuf->tail += 4;
443445 }
446+static inline void intel_ring_emit_reg(struct intel_engine_cs *ring,
447+ i915_reg_t reg)
448+{
449+ intel_ring_emit(ring, i915_mmio_reg_offset(reg));
450+}
444451 static inline void intel_ring_advance(struct intel_engine_cs *ring)
445452 {
446453 struct intel_ringbuffer *ringbuf = ring->buffer;
drivers/gpu/drm/i915/intel_runtime_pm.c+283−209
@@ -49,21 +49,18 @@ · 48 unmodified lines
4949 * present for a given platform.
5050 */
5151
52−#define GEN9_ENABLE_DC5(dev) 0
53−#define SKL_ENABLE_DC6(dev) IS_SKYLAKE(dev)
54−
5552 #define for_each_power_well(i, power_well, domain_mask, power_domains) \
5653 for (i = 0; \
5754 i < (power_domains)->power_well_count && \
5855 ((power_well) = &(power_domains)->power_wells[i]); \
5956 i++) \
60− if ((power_well)->domains & (domain_mask))
57+ for_each_if ((power_well)->domains & (domain_mask))
6158
6259 #define for_each_power_well_rev(i, power_well, domain_mask, power_domains) \
6360 for (i = (power_domains)->power_well_count - 1; \
6461 i >= 0 && ((power_well) = &(power_domains)->power_wells[i]);\
6562 i--) \
66− if ((power_well)->domains & (domain_mask))
63+ for_each_if ((power_well)->domains & (domain_mask))
6764
6865 bool intel_display_power_well_is_enabled(struct drm_i915_private *dev_priv,
6966 int power_well_id);
@@ -244,12 +241,6 @@ static void skl_power_well_post_enable(struct drm_i915_private *dev_priv, · 174 unmodified lines
244241 gen8_irq_power_well_post_enable(dev_priv,
245242 1 << PIPE_C | 1 << PIPE_B);
246243 }
247−
248− if (power_well->data == SKL_DISP_PW_1) {
249− if (!dev_priv->power_domains.initializing)
250− intel_prepare_ddi(dev);
251− gen8_irq_power_well_post_enable(dev_priv, 1 << PIPE_A);
252− }
253244 }
254245
255246 static void hsw_set_power_well(struct drm_i915_private *dev_priv,
@@ -292,58 +283,38 @@ static void hsw_set_power_well(struct drm_i915_private *dev_priv, · 36 unmodified lines
292283 BIT(POWER_DOMAIN_TRANSCODER_C) | \
293284 BIT(POWER_DOMAIN_PIPE_B_PANEL_FITTER) | \
294285 BIT(POWER_DOMAIN_PIPE_C_PANEL_FITTER) | \
295− BIT(POWER_DOMAIN_PORT_DDI_B_2_LANES) | \
296− BIT(POWER_DOMAIN_PORT_DDI_B_4_LANES) | \
297− BIT(POWER_DOMAIN_PORT_DDI_C_2_LANES) | \
298− BIT(POWER_DOMAIN_PORT_DDI_C_4_LANES) | \
299− BIT(POWER_DOMAIN_PORT_DDI_D_2_LANES) | \
300− BIT(POWER_DOMAIN_PORT_DDI_D_4_LANES) | \
301− BIT(POWER_DOMAIN_PORT_DDI_E_2_LANES) | \
286+ BIT(POWER_DOMAIN_PORT_DDI_B_LANES) | \
287+ BIT(POWER_DOMAIN_PORT_DDI_C_LANES) | \
288+ BIT(POWER_DOMAIN_PORT_DDI_D_LANES) | \
289+ BIT(POWER_DOMAIN_PORT_DDI_E_LANES) | \
302290 BIT(POWER_DOMAIN_AUX_B) | \
303291 BIT(POWER_DOMAIN_AUX_C) | \
304292 BIT(POWER_DOMAIN_AUX_D) | \
305293 BIT(POWER_DOMAIN_AUDIO) | \
306294 BIT(POWER_DOMAIN_VGA) | \
307295 BIT(POWER_DOMAIN_INIT))
308−#define SKL_DISPLAY_POWERWELL_1_POWER_DOMAINS ( \
309− SKL_DISPLAY_POWERWELL_2_POWER_DOMAINS | \
310− BIT(POWER_DOMAIN_PLLS) | \
311− BIT(POWER_DOMAIN_PIPE_A) | \
312− BIT(POWER_DOMAIN_TRANSCODER_EDP) | \
313− BIT(POWER_DOMAIN_PIPE_A_PANEL_FITTER) | \
314− BIT(POWER_DOMAIN_PORT_DDI_A_2_LANES) | \
315− BIT(POWER_DOMAIN_PORT_DDI_A_4_LANES) | \
316− BIT(POWER_DOMAIN_AUX_A) | \
317− BIT(POWER_DOMAIN_INIT))
318296 #define SKL_DISPLAY_DDI_A_E_POWER_DOMAINS ( \
319− BIT(POWER_DOMAIN_PORT_DDI_A_2_LANES) | \
320− BIT(POWER_DOMAIN_PORT_DDI_A_4_LANES) | \
321− BIT(POWER_DOMAIN_PORT_DDI_E_2_LANES) | \
297+ BIT(POWER_DOMAIN_PORT_DDI_A_LANES) | \
298+ BIT(POWER_DOMAIN_PORT_DDI_E_LANES) | \
322299 BIT(POWER_DOMAIN_INIT))
323300 #define SKL_DISPLAY_DDI_B_POWER_DOMAINS ( \
324− BIT(POWER_DOMAIN_PORT_DDI_B_2_LANES) | \
325− BIT(POWER_DOMAIN_PORT_DDI_B_4_LANES) | \
301+ BIT(POWER_DOMAIN_PORT_DDI_B_LANES) | \
326302 BIT(POWER_DOMAIN_INIT))
327303 #define SKL_DISPLAY_DDI_C_POWER_DOMAINS ( \
328− BIT(POWER_DOMAIN_PORT_DDI_C_2_LANES) | \
329− BIT(POWER_DOMAIN_PORT_DDI_C_4_LANES) | \
304+ BIT(POWER_DOMAIN_PORT_DDI_C_LANES) | \
330305 BIT(POWER_DOMAIN_INIT))
331306 #define SKL_DISPLAY_DDI_D_POWER_DOMAINS ( \
332− BIT(POWER_DOMAIN_PORT_DDI_D_2_LANES) | \
333− BIT(POWER_DOMAIN_PORT_DDI_D_4_LANES) | \
307+ BIT(POWER_DOMAIN_PORT_DDI_D_LANES) | \
334308 BIT(POWER_DOMAIN_INIT))
335−#define SKL_DISPLAY_MISC_IO_POWER_DOMAINS ( \
336− SKL_DISPLAY_POWERWELL_1_POWER_DOMAINS | \
337− BIT(POWER_DOMAIN_PLLS) | \
309+#define SKL_DISPLAY_DC_OFF_POWER_DOMAINS ( \
310+ SKL_DISPLAY_POWERWELL_2_POWER_DOMAINS | \
311+ BIT(POWER_DOMAIN_MODESET) | \
312+ BIT(POWER_DOMAIN_AUX_A) | \
338313 BIT(POWER_DOMAIN_INIT))
339314 #define SKL_DISPLAY_ALWAYS_ON_POWER_DOMAINS ( \
340− (POWER_DOMAIN_MASK & ~(SKL_DISPLAY_POWERWELL_1_POWER_DOMAINS | \
315+ (POWER_DOMAIN_MASK & ~( \
341316 SKL_DISPLAY_POWERWELL_2_POWER_DOMAINS | \
342− SKL_DISPLAY_DDI_A_E_POWER_DOMAINS | \
343− SKL_DISPLAY_DDI_B_POWER_DOMAINS | \
344− SKL_DISPLAY_DDI_C_POWER_DOMAINS | \
345− SKL_DISPLAY_DDI_D_POWER_DOMAINS | \
346− SKL_DISPLAY_MISC_IO_POWER_DOMAINS)) | \
317+ SKL_DISPLAY_DC_OFF_POWER_DOMAINS)) | \
347318 BIT(POWER_DOMAIN_INIT))
348319
349320 #define BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS ( \
@@ -354,10 +325,8 @@ static void hsw_set_power_well(struct drm_i915_private *dev_priv, · 4 unmodified lines
354325 BIT(POWER_DOMAIN_TRANSCODER_C) | \
355326 BIT(POWER_DOMAIN_PIPE_B_PANEL_FITTER) | \
356327 BIT(POWER_DOMAIN_PIPE_C_PANEL_FITTER) | \
357− BIT(POWER_DOMAIN_PORT_DDI_B_2_LANES) | \
358− BIT(POWER_DOMAIN_PORT_DDI_B_4_LANES) | \
359− BIT(POWER_DOMAIN_PORT_DDI_C_2_LANES) | \
360− BIT(POWER_DOMAIN_PORT_DDI_C_4_LANES) | \
328+ BIT(POWER_DOMAIN_PORT_DDI_B_LANES) | \
329+ BIT(POWER_DOMAIN_PORT_DDI_C_LANES) | \
361330 BIT(POWER_DOMAIN_AUX_B) | \
362331 BIT(POWER_DOMAIN_AUX_C) | \
363332 BIT(POWER_DOMAIN_AUDIO) | \
@@ -369,11 +338,15 @@ static void hsw_set_power_well(struct drm_i915_private *dev_priv, · 5 unmodified lines
369338 BIT(POWER_DOMAIN_PIPE_A) | \
370339 BIT(POWER_DOMAIN_TRANSCODER_EDP) | \
371340 BIT(POWER_DOMAIN_PIPE_A_PANEL_FITTER) | \
372− BIT(POWER_DOMAIN_PORT_DDI_A_2_LANES) | \
373− BIT(POWER_DOMAIN_PORT_DDI_A_4_LANES) | \
341+ BIT(POWER_DOMAIN_PORT_DDI_A_LANES) | \
374342 BIT(POWER_DOMAIN_AUX_A) | \
375343 BIT(POWER_DOMAIN_PLLS) | \
376344 BIT(POWER_DOMAIN_INIT))
345+#define BXT_DISPLAY_DC_OFF_POWER_DOMAINS ( \
346+ BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS | \
347+ BIT(POWER_DOMAIN_MODESET) | \
348+ BIT(POWER_DOMAIN_AUX_A) | \
349+ BIT(POWER_DOMAIN_INIT))
377350 #define BXT_DISPLAY_ALWAYS_ON_POWER_DOMAINS ( \
378351 (POWER_DOMAIN_MASK & ~(BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS | \
379352 BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS)) | \
@@ -417,46 +390,74 @@ static void assert_can_disable_dc9(struct drm_i915_private *dev_priv) · 37 unmodified lines
417390 */
418391 }
419392
420−void bxt_enable_dc9(struct drm_i915_private *dev_priv)
393+static void gen9_set_dc_state_debugmask_memory_up(
394+ struct drm_i915_private *dev_priv)
421395 {
422396 uint32_t val;
423397
424− assert_can_enable_dc9(dev_priv);
398+ /* The below bit doesn't need to be cleared ever afterwards */
399+ val = I915_READ(DC_STATE_DEBUG);
400+ if (!(val & DC_STATE_DEBUG_MASK_MEMORY_UP)) {
401+ val |= DC_STATE_DEBUG_MASK_MEMORY_UP;
402+ I915_WRITE(DC_STATE_DEBUG, val);
403+ POSTING_READ(DC_STATE_DEBUG);
404+ }
405+}
425406
426− DRM_DEBUG_KMS("Enabling DC9\n");
407+static void gen9_set_dc_state(struct drm_i915_private *dev_priv, uint32_t state)
408+{
409+ uint32_t val;
410+ uint32_t mask;
411+
412+ mask = DC_STATE_EN_UPTO_DC5;
413+ if (IS_BROXTON(dev_priv))
414+ mask |= DC_STATE_EN_DC9;
415+ else
416+ mask |= DC_STATE_EN_UPTO_DC6;
417+
418+ WARN_ON_ONCE(state & ~mask);
419+
420+ if (i915.enable_dc == 0)
421+ state = DC_STATE_DISABLE;
422+ else if (i915.enable_dc == 1 && state > DC_STATE_EN_UPTO_DC5)
423+ state = DC_STATE_EN_UPTO_DC5;
424+
425+ if (state & DC_STATE_EN_UPTO_DC5_DC6_MASK)
426+ gen9_set_dc_state_debugmask_memory_up(dev_priv);
427427
428428 val = I915_READ(DC_STATE_EN);
429− val |= DC_STATE_EN_DC9;
429+ DRM_DEBUG_KMS("Setting DC state from %02x to %02x\n",
430+ val & mask, state);
431+ val &= ~mask;
432+ val |= state;
430433 I915_WRITE(DC_STATE_EN, val);
431434 POSTING_READ(DC_STATE_EN);
432435 }
433436
434−void bxt_disable_dc9(struct drm_i915_private *dev_priv)
437+void bxt_enable_dc9(struct drm_i915_private *dev_priv)
435438 {
436− uint32_t val;
439+ assert_can_enable_dc9(dev_priv);
440+
441+ DRM_DEBUG_KMS("Enabling DC9\n");
442+
443+ gen9_set_dc_state(dev_priv, DC_STATE_EN_DC9);
444+}
437445
446+void bxt_disable_dc9(struct drm_i915_private *dev_priv)
447+{
438448 assert_can_disable_dc9(dev_priv);
439449
440450 DRM_DEBUG_KMS("Disabling DC9\n");
441451
442− val = I915_READ(DC_STATE_EN);
443− val &= ~DC_STATE_EN_DC9;
444− I915_WRITE(DC_STATE_EN, val);
445− POSTING_READ(DC_STATE_EN);
452+ gen9_set_dc_state(dev_priv, DC_STATE_DISABLE);
446453 }
447454
448−static void gen9_set_dc_state_debugmask_memory_up(
449− struct drm_i915_private *dev_priv)
455+static void assert_csr_loaded(struct drm_i915_private *dev_priv)
450456 {
451− uint32_t val;
452−
453− /* The below bit doesn't need to be cleared ever afterwards */
454− val = I915_READ(DC_STATE_DEBUG);
455− if (!(val & DC_STATE_DEBUG_MASK_MEMORY_UP)) {
456− val |= DC_STATE_DEBUG_MASK_MEMORY_UP;
457− I915_WRITE(DC_STATE_DEBUG, val);
458− POSTING_READ(DC_STATE_DEBUG);
459− }
457+ WARN_ONCE(!I915_READ(CSR_PROGRAM(0)),
458+ "CSR program storage start is NULL\n");
459+ WARN_ONCE(!I915_READ(CSR_SSP_BASE), "CSR SSP Base Not fine\n");
460+ WARN_ONCE(!I915_READ(CSR_HTP_SKL), "CSR HTP Not fine\n");
460461 }
461462
462463 static void assert_can_enable_dc5(struct drm_i915_private *dev_priv)
@@ -479,8 +480,6 @@ static void assert_can_enable_dc5(struct drm_i915_private *dev_priv) · 16 unmodified lines
479480
480481 static void assert_can_disable_dc5(struct drm_i915_private *dev_priv)
481482 {
482− bool pg2_enabled = intel_display_power_well_is_enabled(dev_priv,
483− SKL_DISP_PW_2);
484483 /*
485484 * During initialization, the firmware may not be loaded yet.
486485 * We still want to make sure that the DC enabling flag is cleared.
@@ -488,40 +487,17 @@ static void assert_can_disable_dc5(struct drm_i915_private *dev_priv) · 1 unmodified line
488487 if (dev_priv->power_domains.initializing)
489488 return;
490489
491− WARN_ONCE(!pg2_enabled, "PG2 not enabled to disable DC5.\n");
492490 WARN_ONCE(dev_priv->pm.suspended,
493491 "Disabling of DC5 while platform is runtime-suspended should never happen.\n");
494492 }
495493
496494 static void gen9_enable_dc5(struct drm_i915_private *dev_priv)
497495 {
498− uint32_t val;
499−
500496 assert_can_enable_dc5(dev_priv);
501497
502498 DRM_DEBUG_KMS("Enabling DC5\n");
503499
504− gen9_set_dc_state_debugmask_memory_up(dev_priv);
505−
506− val = I915_READ(DC_STATE_EN);
507− val &= ~DC_STATE_EN_UPTO_DC5_DC6_MASK;
508− val |= DC_STATE_EN_UPTO_DC5;
509− I915_WRITE(DC_STATE_EN, val);
510− POSTING_READ(DC_STATE_EN);
511−}
512−
513−static void gen9_disable_dc5(struct drm_i915_private *dev_priv)
514−{
515− uint32_t val;
516−
517− assert_can_disable_dc5(dev_priv);
518−
519− DRM_DEBUG_KMS("Disabling DC5\n");
520−
521− val = I915_READ(DC_STATE_EN);
522− val &= ~DC_STATE_EN_UPTO_DC5;
523− I915_WRITE(DC_STATE_EN, val);
524− POSTING_READ(DC_STATE_EN);
500+ gen9_set_dc_state(dev_priv, DC_STATE_EN_UPTO_DC5);
525501 }
526502
527503 static void assert_can_enable_dc6(struct drm_i915_private *dev_priv)
@@ -547,40 +523,37 @@ static void assert_can_disable_dc6(struct drm_i915_private *dev_priv) · 19 unmodified lines
547523 if (dev_priv->power_domains.initializing)
548524 return;
549525
550− assert_csr_loaded(dev_priv);
551526 WARN_ONCE(!(I915_READ(DC_STATE_EN) & DC_STATE_EN_UPTO_DC6),
552527 "DC6 already programmed to be disabled.\n");
553528 }
554529
555−static void skl_enable_dc6(struct drm_i915_private *dev_priv)
530+static void gen9_disable_dc5_dc6(struct drm_i915_private *dev_priv)
556531 {
557− uint32_t val;
532+ assert_can_disable_dc5(dev_priv);
533+
534+ if (IS_SKYLAKE(dev_priv) && i915.enable_dc != 0 && i915.enable_dc != 1)
535+ assert_can_disable_dc6(dev_priv);
558536
537+ gen9_set_dc_state(dev_priv, DC_STATE_DISABLE);
538+}
539+
540+void skl_enable_dc6(struct drm_i915_private *dev_priv)
541+{
559542 assert_can_enable_dc6(dev_priv);
560543
561544 DRM_DEBUG_KMS("Enabling DC6\n");
562545
563− gen9_set_dc_state_debugmask_memory_up(dev_priv);
546+ gen9_set_dc_state(dev_priv, DC_STATE_EN_UPTO_DC6);
564547
565− val = I915_READ(DC_STATE_EN);
566− val &= ~DC_STATE_EN_UPTO_DC5_DC6_MASK;
567− val |= DC_STATE_EN_UPTO_DC6;
568− I915_WRITE(DC_STATE_EN, val);
569− POSTING_READ(DC_STATE_EN);
570548 }
571549
572−static void skl_disable_dc6(struct drm_i915_private *dev_priv)
550+void skl_disable_dc6(struct drm_i915_private *dev_priv)
573551 {
574− uint32_t val;
575−
576552 assert_can_disable_dc6(dev_priv);
577553
578554 DRM_DEBUG_KMS("Disabling DC6\n");
579555
580− val = I915_READ(DC_STATE_EN);
581− val &= ~DC_STATE_EN_UPTO_DC6;
582− I915_WRITE(DC_STATE_EN, val);
583− POSTING_READ(DC_STATE_EN);
556+ gen9_set_dc_state(dev_priv, DC_STATE_DISABLE);
584557 }
585558
586559 static void skl_set_power_well(struct drm_i915_private *dev_priv,
@@ -630,20 +603,16 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv, · 43 unmodified lines
630603 !I915_READ(HSW_PWR_WELL_BIOS),
631604 "Invalid for power well status to be enabled, unless done by the BIOS, \
632605 when request is to disable!\n");
633− if ((GEN9_ENABLE_DC5(dev) || SKL_ENABLE_DC6(dev)) &&
634− power_well->data == SKL_DISP_PW_2) {
635− if (SKL_ENABLE_DC6(dev)) {
636− skl_disable_dc6(dev_priv);
637− /*
638− * DDI buffer programming unnecessary during driver-load/resume
639− * as it's already done during modeset initialization then.
640− * It's also invalid here as encoder list is still uninitialized.
641− */
642− if (!dev_priv->power_domains.initializing)
643− intel_prepare_ddi(dev);
644− } else {
645− gen9_disable_dc5(dev_priv);
646− }
606+ if (power_well->data == SKL_DISP_PW_2) {
607+ /*
608+ * DDI buffer programming unnecessary during
609+ * driver-load/resume as it's already done
610+ * during modeset initialization then. It's
611+ * also invalid here as encoder list is still
612+ * uninitialized.
613+ */
614+ if (!dev_priv->power_domains.initializing)
615+ intel_prepare_ddi(dev);
647616 }
648617 I915_WRITE(HSW_PWR_WELL_DRIVER, tmp | req_mask);
649618 }
@@ -658,34 +627,9 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv, · 8 unmodified lines
658627 }
659628 } else {
660629 if (enable_requested) {
661− if (IS_SKYLAKE(dev) &&
662− (power_well->data == SKL_DISP_PW_1) &&
663− (intel_csr_load_status_get(dev_priv) == FW_LOADED))
664− DRM_DEBUG_KMS("Not Disabling PW1, dmc will handle\n");
665− else {
666− I915_WRITE(HSW_PWR_WELL_DRIVER, tmp & ~req_mask);
667− POSTING_READ(HSW_PWR_WELL_DRIVER);
668− DRM_DEBUG_KMS("Disabling %s\n", power_well->name);
669− }
670−
671− if ((GEN9_ENABLE_DC5(dev) || SKL_ENABLE_DC6(dev)) &&
672− power_well->data == SKL_DISP_PW_2) {
673− enum csr_state state;
674− /* TODO: wait for a completion event or
675− * similar here instead of busy
676− * waiting using wait_for function.
677− */
678− wait_for((state = intel_csr_load_status_get(dev_priv)) !=
679− FW_UNINITIALIZED, 1000);
680− if (state != FW_LOADED)
681− DRM_DEBUG("CSR firmware not ready (%d)\n",
682− state);
683− else
684− if (SKL_ENABLE_DC6(dev))
685− skl_enable_dc6(dev_priv);
686− else
687− gen9_enable_dc5(dev_priv);
688− }
630+ I915_WRITE(HSW_PWR_WELL_DRIVER, tmp & ~req_mask);
631+ POSTING_READ(HSW_PWR_WELL_DRIVER);
632+ DRM_DEBUG_KMS("Disabling %s\n", power_well->name);
689633 }
690634 }
691635
@@ -760,6 +704,41 @@ static void skl_power_well_disable(struct drm_i915_private *dev_priv, · 68 unmodified lines
760704 skl_set_power_well(dev_priv, power_well, false);
761705 }
762706
707+static bool gen9_dc_off_power_well_enabled(struct drm_i915_private *dev_priv,
708+ struct i915_power_well *power_well)
709+{
710+ return (I915_READ(DC_STATE_EN) & DC_STATE_EN_UPTO_DC5_DC6_MASK) == 0;
711+}
712+
713+static void gen9_dc_off_power_well_enable(struct drm_i915_private *dev_priv,
714+ struct i915_power_well *power_well)
715+{
716+ gen9_disable_dc5_dc6(dev_priv);
717+}
718+
719+static void gen9_dc_off_power_well_disable(struct drm_i915_private *dev_priv,
720+ struct i915_power_well *power_well)
721+{
722+ if (IS_SKYLAKE(dev_priv) && i915.enable_dc != 0 && i915.enable_dc != 1)
723+ skl_enable_dc6(dev_priv);
724+ else
725+ gen9_enable_dc5(dev_priv);
726+}
727+
728+static void gen9_dc_off_power_well_sync_hw(struct drm_i915_private *dev_priv,
729+ struct i915_power_well *power_well)
730+{
731+ if (power_well->count > 0) {
732+ gen9_set_dc_state(dev_priv, DC_STATE_DISABLE);
733+ } else {
734+ if (IS_SKYLAKE(dev_priv) && i915.enable_dc != 0 &&
735+ i915.enable_dc != 1)
736+ gen9_set_dc_state(dev_priv, DC_STATE_EN_UPTO_DC6);
737+ else
738+ gen9_set_dc_state(dev_priv, DC_STATE_EN_UPTO_DC5);
739+ }
740+}
741+
763742 static void i9xx_always_on_power_well_noop(struct drm_i915_private *dev_priv,
764743 struct i915_power_well *power_well)
765744 {
@@ -974,10 +953,12 @@ static struct i915_power_well *lookup_power_well(struct drm_i915_private *dev_pr · 208 unmodified lines
974953 int power_well_id)
975954 {
976955 struct i915_power_domains *power_domains = &dev_priv->power_domains;
977− struct i915_power_well *power_well;
978956 int i;
979957
980− for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) {
958+ for (i = 0; i < power_domains->power_well_count; i++) {
959+ struct i915_power_well *power_well;
960+
961+ power_well = &power_domains->power_wells[i];
981962 if (power_well->data == power_well_id)
982963 return power_well;
983964 }
@@ -1458,7 +1439,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, · 474 unmodified lines
14581439 for_each_power_well_rev(i, power_well, BIT(domain), power_domains) {
14591440 WARN_ON(!power_well->count);
14601441
1461− if (!--power_well->count && i915.disable_power_well)
1442+ if (!--power_well->count)
14621443 intel_power_well_disable(dev_priv, power_well);
14631444 }
14641445
@@ -1470,14 +1451,10 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, · 5 unmodified lines
14701451 #define HSW_ALWAYS_ON_POWER_DOMAINS ( \
14711452 BIT(POWER_DOMAIN_PIPE_A) | \
14721453 BIT(POWER_DOMAIN_TRANSCODER_EDP) | \
1473− BIT(POWER_DOMAIN_PORT_DDI_A_2_LANES) | \
1474− BIT(POWER_DOMAIN_PORT_DDI_A_4_LANES) | \
1475− BIT(POWER_DOMAIN_PORT_DDI_B_2_LANES) | \
1476− BIT(POWER_DOMAIN_PORT_DDI_B_4_LANES) | \
1477− BIT(POWER_DOMAIN_PORT_DDI_C_2_LANES) | \
1478− BIT(POWER_DOMAIN_PORT_DDI_C_4_LANES) | \
1479− BIT(POWER_DOMAIN_PORT_DDI_D_2_LANES) | \
1480− BIT(POWER_DOMAIN_PORT_DDI_D_4_LANES) | \
1454+ BIT(POWER_DOMAIN_PORT_DDI_A_LANES) | \
1455+ BIT(POWER_DOMAIN_PORT_DDI_B_LANES) | \
1456+ BIT(POWER_DOMAIN_PORT_DDI_C_LANES) | \
1457+ BIT(POWER_DOMAIN_PORT_DDI_D_LANES) | \
14811458 BIT(POWER_DOMAIN_PORT_CRT) | \
14821459 BIT(POWER_DOMAIN_PLLS) | \
14831460 BIT(POWER_DOMAIN_AUX_A) | \
@@ -1501,49 +1478,42 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, · 17 unmodified lines
15011478 #define VLV_DISPLAY_POWER_DOMAINS POWER_DOMAIN_MASK
15021479
15031480 #define VLV_DPIO_CMN_BC_POWER_DOMAINS ( \
1504− BIT(POWER_DOMAIN_PORT_DDI_B_2_LANES) | \
1505− BIT(POWER_DOMAIN_PORT_DDI_B_4_LANES) | \
1506− BIT(POWER_DOMAIN_PORT_DDI_C_2_LANES) | \
1507− BIT(POWER_DOMAIN_PORT_DDI_C_4_LANES) | \
1481+ BIT(POWER_DOMAIN_PORT_DDI_B_LANES) | \
1482+ BIT(POWER_DOMAIN_PORT_DDI_C_LANES) | \
15081483 BIT(POWER_DOMAIN_PORT_CRT) | \
15091484 BIT(POWER_DOMAIN_AUX_B) | \
15101485 BIT(POWER_DOMAIN_AUX_C) | \
15111486 BIT(POWER_DOMAIN_INIT))
15121487
15131488 #define VLV_DPIO_TX_B_LANES_01_POWER_DOMAINS ( \
1514− BIT(POWER_DOMAIN_PORT_DDI_B_2_LANES) | \
1515− BIT(POWER_DOMAIN_PORT_DDI_B_4_LANES) | \
1489+ BIT(POWER_DOMAIN_PORT_DDI_B_LANES) | \
15161490 BIT(POWER_DOMAIN_AUX_B) | \
15171491 BIT(POWER_DOMAIN_INIT))
15181492
15191493 #define VLV_DPIO_TX_B_LANES_23_POWER_DOMAINS ( \
1520− BIT(POWER_DOMAIN_PORT_DDI_B_4_LANES) | \
1494+ BIT(POWER_DOMAIN_PORT_DDI_B_LANES) | \
15211495 BIT(POWER_DOMAIN_AUX_B) | \
15221496 BIT(POWER_DOMAIN_INIT))
15231497
15241498 #define VLV_DPIO_TX_C_LANES_01_POWER_DOMAINS ( \
1525− BIT(POWER_DOMAIN_PORT_DDI_C_2_LANES) | \
1526− BIT(POWER_DOMAIN_PORT_DDI_C_4_LANES) | \
1499+ BIT(POWER_DOMAIN_PORT_DDI_C_LANES) | \
15271500 BIT(POWER_DOMAIN_AUX_C) | \
15281501 BIT(POWER_DOMAIN_INIT))
15291502
15301503 #define VLV_DPIO_TX_C_LANES_23_POWER_DOMAINS ( \
1531− BIT(POWER_DOMAIN_PORT_DDI_C_4_LANES) | \
1504+ BIT(POWER_DOMAIN_PORT_DDI_C_LANES) | \
15321505 BIT(POWER_DOMAIN_AUX_C) | \
15331506 BIT(POWER_DOMAIN_INIT))
15341507
15351508 #define CHV_DPIO_CMN_BC_POWER_DOMAINS ( \
1536− BIT(POWER_DOMAIN_PORT_DDI_B_2_LANES) | \
1537− BIT(POWER_DOMAIN_PORT_DDI_B_4_LANES) | \
1538− BIT(POWER_DOMAIN_PORT_DDI_C_2_LANES) | \
1539− BIT(POWER_DOMAIN_PORT_DDI_C_4_LANES) | \
1509+ BIT(POWER_DOMAIN_PORT_DDI_B_LANES) | \
1510+ BIT(POWER_DOMAIN_PORT_DDI_C_LANES) | \
15401511 BIT(POWER_DOMAIN_AUX_B) | \
15411512 BIT(POWER_DOMAIN_AUX_C) | \
15421513 BIT(POWER_DOMAIN_INIT))
15431514
15441515 #define CHV_DPIO_CMN_D_POWER_DOMAINS ( \
1545− BIT(POWER_DOMAIN_PORT_DDI_D_2_LANES) | \
1546− BIT(POWER_DOMAIN_PORT_DDI_D_4_LANES) | \
1516+ BIT(POWER_DOMAIN_PORT_DDI_D_LANES) | \
15471517 BIT(POWER_DOMAIN_AUX_D) | \
15481518 BIT(POWER_DOMAIN_INIT))
15491519
@@ -1591,6 +1561,13 @@ static const struct i915_power_well_ops skl_power_well_ops = { · 41 unmodified lines
15911561 .is_enabled = skl_power_well_enabled,
15921562 };
15931563
1564+static const struct i915_power_well_ops gen9_dc_off_power_well_ops = {
1565+ .sync_hw = gen9_dc_off_power_well_sync_hw,
1566+ .enable = gen9_dc_off_power_well_enable,
1567+ .disable = gen9_dc_off_power_well_disable,
1568+ .is_enabled = gen9_dc_off_power_well_enabled,
1569+};
1570+
15941571 static struct i915_power_well hsw_power_wells[] = {
15951572 {
15961573 .name = "always-on",
@@ -1646,6 +1623,7 @@ static struct i915_power_well vlv_power_wells[] = { · 49 unmodified lines
16461623 .always_on = 1,
16471624 .domains = VLV_ALWAYS_ON_POWER_DOMAINS,
16481625 .ops = &i9xx_always_on_power_well_ops,
1626+ .data = PUNIT_POWER_WELL_ALWAYS_ON,
16491627 },
16501628 {
16511629 .name = "display",
@@ -1747,19 +1725,28 @@ static struct i915_power_well skl_power_wells[] = { · 95 unmodified lines
17471725 .always_on = 1,
17481726 .domains = SKL_DISPLAY_ALWAYS_ON_POWER_DOMAINS,
17491727 .ops = &i9xx_always_on_power_well_ops,
1728+ .data = SKL_DISP_PW_ALWAYS_ON,
17501729 },
17511730 {
17521731 .name = "power well 1",
1753− .domains = SKL_DISPLAY_POWERWELL_1_POWER_DOMAINS,
1732+ /* Handled by the DMC firmware */
1733+ .domains = 0,
17541734 .ops = &skl_power_well_ops,
17551735 .data = SKL_DISP_PW_1,
17561736 },
17571737 {
17581738 .name = "MISC IO power well",
1759− .domains = SKL_DISPLAY_MISC_IO_POWER_DOMAINS,
1739+ /* Handled by the DMC firmware */
1740+ .domains = 0,
17601741 .ops = &skl_power_well_ops,
17611742 .data = SKL_DISP_PW_MISC_IO,
17621743 },
1744+ {
1745+ .name = "DC off",
1746+ .domains = SKL_DISPLAY_DC_OFF_POWER_DOMAINS,
1747+ .ops = &gen9_dc_off_power_well_ops,
1748+ .data = SKL_DISP_PW_DC_OFF,
1749+ },
17631750 {
17641751 .name = "power well 2",
17651752 .domains = SKL_DISPLAY_POWERWELL_2_POWER_DOMAINS,
@@ -1792,6 +1779,34 @@ static struct i915_power_well skl_power_wells[] = { · 26 unmodified lines
17921779 },
17931780 };
17941781
1782+void skl_pw1_misc_io_init(struct drm_i915_private *dev_priv)
1783+{
1784+ struct i915_power_well *well;
1785+
1786+ if (!IS_SKYLAKE(dev_priv))
1787+ return;
1788+
1789+ well = lookup_power_well(dev_priv, SKL_DISP_PW_1);
1790+ intel_power_well_enable(dev_priv, well);
1791+
1792+ well = lookup_power_well(dev_priv, SKL_DISP_PW_MISC_IO);
1793+ intel_power_well_enable(dev_priv, well);
1794+}
1795+
1796+void skl_pw1_misc_io_fini(struct drm_i915_private *dev_priv)
1797+{
1798+ struct i915_power_well *well;
1799+
1800+ if (!IS_SKYLAKE(dev_priv))
1801+ return;
1802+
1803+ well = lookup_power_well(dev_priv, SKL_DISP_PW_1);
1804+ intel_power_well_disable(dev_priv, well);
1805+
1806+ well = lookup_power_well(dev_priv, SKL_DISP_PW_MISC_IO);
1807+ intel_power_well_disable(dev_priv, well);
1808+}
1809+
17951810 static struct i915_power_well bxt_power_wells[] = {
17961811 {
17971812 .name = "always-on",
@@ -1805,12 +1820,18 @@ static struct i915_power_well bxt_power_wells[] = { · 7 unmodified lines
18051820 .ops = &skl_power_well_ops,
18061821 .data = SKL_DISP_PW_1,
18071822 },
1823+ {
1824+ .name = "DC off",
1825+ .domains = BXT_DISPLAY_DC_OFF_POWER_DOMAINS,
1826+ .ops = &gen9_dc_off_power_well_ops,
1827+ .data = SKL_DISP_PW_DC_OFF,
1828+ },
18081829 {
18091830 .name = "power well 2",
18101831 .domains = BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS,
18111832 .ops = &skl_power_well_ops,
18121833 .data = SKL_DISP_PW_2,
1813− }
1834+ },
18141835 };
18151836
18161837 static int
@@ -1859,7 +1880,7 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv) · 42 unmodified lines
18591880 set_power_wells(power_domains, hsw_power_wells);
18601881 } else if (IS_BROADWELL(dev_priv->dev)) {
18611882 set_power_wells(power_domains, bdw_power_wells);
1862− } else if (IS_SKYLAKE(dev_priv->dev)) {
1883+ } else if (IS_SKYLAKE(dev_priv->dev) || IS_KABYLAKE(dev_priv->dev)) {
18631884 set_power_wells(power_domains, skl_power_wells);
18641885 } else if (IS_BROXTON(dev_priv->dev)) {
18651886 set_power_wells(power_domains, bxt_power_wells);
@@ -1874,21 +1895,6 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv) · 8 unmodified lines
18741895 return 0;
18751896 }
18761897
1877−static void intel_runtime_pm_disable(struct drm_i915_private *dev_priv)
1878−{
1879− struct drm_device *dev = dev_priv->dev;
1880− struct device *device = &dev->pdev->dev;
1881−
1882− if (!HAS_RUNTIME_PM(dev))
1883− return;
1884−
1885− if (!intel_enable_rc6(dev))
1886− return;
1887−
1888− /* Make sure we're not suspended first. */
1889− pm_runtime_get_sync(device);
1890−}
1891−
18921898 /**
18931899 * intel_power_domains_fini - finalizes the power domain structures
18941900 * @dev_priv: i915 device instance
@@ -1899,15 +1905,17 @@ static void intel_runtime_pm_disable(struct drm_i915_private *dev_priv) · 4 unmodified lines
18991905 */
19001906 void intel_power_domains_fini(struct drm_i915_private *dev_priv)
19011907 {
1902− intel_runtime_pm_disable(dev_priv);
1903−
19041908 /* The i915.ko module is still not prepared to be loaded when
19051909 * the power well is not enabled, so just enable it in case
19061910 * we're going to unload/reload. */
19071911 intel_display_set_init_power(dev_priv, true);
1912+
1913+ /* Remove the refcount we took to keep power well support disabled. */
1914+ if (!i915.disable_power_well)
1915+ intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
19081916 }
19091917
1910−static void intel_power_domains_resume(struct drm_i915_private *dev_priv)
1918+static void intel_power_domains_sync_hw(struct drm_i915_private *dev_priv)
19111919 {
19121920 struct i915_power_domains *power_domains = &dev_priv->power_domains;
19131921 struct i915_power_well *power_well;
@@ -1922,6 +1930,47 @@ static void intel_power_domains_resume(struct drm_i915_private *dev_priv) · 8 unmodified lines
19221930 mutex_unlock(&power_domains->lock);
19231931 }
19241932
1933+static void skl_display_core_init(struct drm_i915_private *dev_priv,
1934+ bool resume)
1935+{
1936+ struct i915_power_domains *power_domains = &dev_priv->power_domains;
1937+ uint32_t val;
1938+
1939+ gen9_set_dc_state(dev_priv, DC_STATE_DISABLE);
1940+
1941+ /* enable PCH reset handshake */
1942+ val = I915_READ(HSW_NDE_RSTWRN_OPT);
1943+ I915_WRITE(HSW_NDE_RSTWRN_OPT, val | RESET_PCH_HANDSHAKE_ENABLE);
1944+
1945+ /* enable PG1 and Misc I/O */
1946+ mutex_lock(&power_domains->lock);
1947+ skl_pw1_misc_io_init(dev_priv);
1948+ mutex_unlock(&power_domains->lock);
1949+

81 more lines aren’t shown here.

drivers/gpu/drm/i915/intel_sdvo.c+41−20

This diff is large: its 170 lines aren’t shown here.

drivers/gpu/drm/i915/intel_sprite.c+5−23

This diff is large: its 86 lines aren’t shown here.

drivers/gpu/drm/i915/intel_uncore.c+147−114

This diff is large: its 569 lines aren’t shown here.

drivers/gpu/drm/imx/Kconfig+0−9

This diff is large: its 16 lines aren’t shown here.

drivers/gpu/drm/imx/imx-drm-core.c+3−9

This diff is large: its 58 lines aren’t shown here.

drivers/gpu/drm/mgag200/mgag200_drv.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/mgag200/mgag200_fb.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/mgag200/mgag200_main.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/drm/msm/msm_drv.h+2−2

This diff is large: its 12 lines aren’t shown here.

drivers/gpu/drm/msm/msm_fb.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/drm/nouveau/nouveau_display.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/drm/nouveau/nouveau_display.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/nouveau/nouveau_fbcon.h+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/gpu/drm/omapdrm/omap_drv.h+3−3

This diff is large: its 21 lines aren’t shown here.

drivers/gpu/drm/omapdrm/omap_fb.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/drm/qxl/qxl_display.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/drm/qxl/qxl_drv.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/qxl/qxl_fb.c+1−2

This diff is large: its 17 lines aren’t shown here.

drivers/gpu/drm/radeon/radeon_display.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/drm/radeon/radeon_fb.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/gpu/drm/radeon/radeon_mode.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/rcar-du/rcar_du_kms.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/rockchip/rockchip_drm_fb.c+3−3

This diff is large: its 27 lines aren’t shown here.

drivers/gpu/drm/rockchip/rockchip_drm_fb.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/shmobile/shmob_drm_kms.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/tegra/Kconfig+0−12

This diff is large: its 19 lines aren’t shown here.

drivers/gpu/drm/tegra/drm.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/drm/tegra/drm.h+4−4

This diff is large: its 33 lines aren’t shown here.

drivers/gpu/drm/tegra/fb.c+8−8

This diff is large: its 72 lines aren’t shown here.

drivers/gpu/drm/tilcdc/tilcdc_drv.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/udl/udl_drv.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/udl/udl_fb.c+2−3

This diff is large: its 26 lines aren’t shown here.

drivers/gpu/drm/virtio/virtgpu_display.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/gpu/drm/virtio/virtgpu_drv.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/gpu/drm/virtio/virtgpu_fb.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/pci/quirks.c+3−1

This diff is large: its 11 lines aren’t shown here.

include/drm/drmP.h+5−0

This diff is large: its 17 lines aren’t shown here.

include/drm/drm_atomic.h+3−3

This diff is large: its 27 lines aren’t shown here.

include/drm/drm_atomic_helper.h+8−0

This diff is large: its 22 lines aren’t shown here.

include/drm/drm_crtc.h+8−4

This diff is large: its 40 lines aren’t shown here.

include/drm/drm_crtc_helper.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/drm/drm_dp_helper.h+36−0

This diff is large: its 53 lines aren’t shown here.

include/drm/drm_fb_cma_helper.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/drm/drm_gem.h+92−14

This diff is large: its 189 lines aren’t shown here.

include/drm/drm_mm.h+10−16

This diff is large: its 47 lines aren’t shown here.

include/drm/drm_modes.h+2−0

This diff is large: its 9 lines aren’t shown here.

include/drm/drm_modeset_lock.h+2−2

This diff is large: its 10 lines aren’t shown here.

include/drm/drm_rect.h+2−1

This diff is large: its 10 lines aren’t shown here.

include/drm/i915_component.h+65−18

This diff is large: its 113 lines aren’t shown here.

include/drm/i915_pciids.h+36−0

This diff is large: its 41 lines aren’t shown here.

include/linux/platform_data/asoc-s3c.h+8−0

This diff is large: its 22 lines aren’t shown here.

include/sound/ac97_codec.h+3−0

This diff is large: its 22 lines aren’t shown here.

include/sound/compress_driver.h+6−1

This diff is large: its 20 lines aren’t shown here.

include/sound/core.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/sound/da7218.h+109−0

This diff is large: its 110 lines aren’t shown here.

include/sound/da7219.h+2−12

This diff is large: its 30 lines aren’t shown here.

include/sound/designware_i2s.h+6−0

This diff is large: its 13 lines aren’t shown here.

include/sound/hda_i915.h+14−0

This diff is large: its 28 lines aren’t shown here.

include/sound/hda_register.h+9−0

This diff is large: its 16 lines aren’t shown here.

include/sound/hdaudio_ext.h+21−0

This diff is large: its 73 lines aren’t shown here.

include/sound/i2c.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/sound/rawmidi.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/sound/rt5659.h+49−0

This diff is large: its 50 lines aren’t shown here.

include/sound/soc-dai.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/sound/soc-dapm.h+4−0

This diff is large: its 18 lines aren’t shown here.

include/sound/soc-topology.h+4−2

This diff is large: its 13 lines aren’t shown here.

include/sound/soc.h+46−7

This diff is large: its 133 lines aren’t shown here.

include/uapi/drm/i915_drm.h+9−2

This diff is large: its 25 lines aren’t shown here.

include/uapi/sound/asoc.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/uapi/sound/compress_params.h+3−2

This diff is large: its 19 lines aren’t shown here.

kernel/async.c+1−0

This diff is large: its 5 lines aren’t shown here.

sound/core/compress_offload.c+97−2

This diff is large: its 155 lines aren’t shown here.

sound/core/init.c+3−0

This diff is large: its 10 lines aren’t shown here.

sound/core/oss/mixer_oss.c+7−1

This diff is large: its 22 lines aren’t shown here.

sound/core/oss/pcm_oss.c+7−3

This diff is large: its 38 lines aren’t shown here.

sound/core/pcm_native.c+13−13

This diff is large: its 117 lines aren’t shown here.

sound/core/seq/oss/seq_oss.c+6−1

This diff is large: its 21 lines aren’t shown here.

sound/core/seq/seq_clientmgr.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/core/seq/seq_queue.c+2−0

This diff is large: its 11 lines aren’t shown here.

sound/core/seq/seq_virmidi.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/core/timer.c+43−33

This diff is large: its 223 lines aren’t shown here.

sound/drivers/dummy.c+2−2

This diff is large: its 18 lines aren’t shown here.

sound/firewire/Kconfig+1−11

This diff is large: its 26 lines aren’t shown here.

sound/firewire/Makefile+0−2

This diff is large: its 14 lines aren’t shown here.

sound/firewire/dice/dice-transaction.c+79−44

This diff is large: its 185 lines aren’t shown here.

sound/firewire/dice/dice.c+120−107

This diff is large: its 304 lines aren’t shown here.

sound/firewire/dice/dice.h+3−0

This diff is large: its 10 lines aren’t shown here.

sound/firewire/fireworks/fireworks.h+2−2

This diff is large: its 11 lines aren’t shown here.

sound/firewire/fireworks/fireworks_midi.c+12−4

This diff is large: its 48 lines aren’t shown here.

sound/firewire/fireworks/fireworks_pcm.c+20−8

This diff is large: its 56 lines aren’t shown here.

sound/firewire/fireworks/fireworks_stream.c+12−20

This diff is large: its 87 lines aren’t shown here.

sound/firewire/oxfw/Makefile+2−2

This diff is large: its 6 lines aren’t shown here.

sound/firewire/oxfw/oxfw-scs1x.c+406−0

This diff is large: its 407 lines aren’t shown here.

sound/firewire/oxfw/oxfw-spkr.crenamed from sound/firewire/oxfw/oxfw-control.c+89−53

This diff is large: its 316 lines aren’t shown here.

sound/firewire/oxfw/oxfw.c+78−32

This diff is large: its 219 lines aren’t shown here.

sound/firewire/oxfw/oxfw.h+7−16

This diff is large: its 49 lines aren’t shown here.

sound/firewire/scs1x.c+0−530

This diff is large: its 531 lines aren’t shown here.

sound/hda/ext/hdac_ext_controller.c+28−1

This diff is large: its 50 lines aren’t shown here.

sound/hda/ext/hdac_ext_stream.c+72−0

This diff is large: its 90 lines aren’t shown here.

sound/hda/hdac_i915.c+66−0

This diff is large: its 73 lines aren’t shown here.

sound/i2c/i2c.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/oss/Kconfig+1−1

This diff is large: its 9 lines aren’t shown here.

sound/pci/atiixp.c+3−3

This diff is large: its 27 lines aren’t shown here.

sound/pci/atiixp_modem.c+2−2

This diff is large: its 18 lines aren’t shown here.

sound/pci/azt3328.c+0−2

This diff is large: its 9 lines aren’t shown here.

sound/pci/cs5535audio/cs5535audio_pcm.c+2−2

This diff is large: its 18 lines aren’t shown here.

sound/pci/fm801.c+95−50

This diff is large: its 309 lines aren’t shown here.

sound/pci/hda/hda_controller.c+2−8

This diff is large: its 27 lines aren’t shown here.

sound/pci/hda/hda_controller.h+9−5

This diff is large: its 39 lines aren’t shown here.

sound/pci/hda/hda_eld.c+1−0

This diff is large: its 8 lines aren’t shown here.

sound/pci/hda/hda_generic.c+70−38

This diff is large: its 203 lines aren’t shown here.

sound/pci/hda/hda_generic.h+0−5

This diff is large: its 14 lines aren’t shown here.

sound/pci/hda/hda_intel.c+49−29

This diff is large: its 172 lines aren’t shown here.

sound/pci/hda/hda_tegra.c+3−2

This diff is large: its 19 lines aren’t shown here.

sound/pci/hda/patch_conexant.c+3−0

This diff is large: its 10 lines aren’t shown here.

sound/pci/hda/patch_hdmi.c+168−77

This diff is large: its 398 lines aren’t shown here.

sound/pci/hda/patch_realtek.c+14−0

This diff is large: its 56 lines aren’t shown here.

sound/pci/ice1712/delta.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/Kconfig+2−0

This diff is large: its 16 lines aren’t shown here.

sound/soc/Makefile+2−0

This diff is large: its 16 lines aren’t shown here.

sound/soc/amd/Kconfig+4−0

This diff is large: its 5 lines aren’t shown here.

sound/soc/amd/Makefile+3−0

This diff is large: its 4 lines aren’t shown here.

sound/soc/amd/acp-pcm-dma.c+1043−0

This diff is large: its 1044 lines aren’t shown here.

sound/soc/amd/acp.h+118−0

This diff is large: its 119 lines aren’t shown here.

sound/soc/amd/include/acp_2_2_d.h+609−0

This diff is large: its 610 lines aren’t shown here.

sound/soc/amd/include/acp_2_2_enum.h+1068−0

This diff is large: its 1069 lines aren’t shown here.

sound/soc/amd/include/acp_2_2_sh_mask.h+2292−0

This diff is large: its 2293 lines aren’t shown here.

sound/soc/atmel/Kconfig+9−0

This diff is large: its 14 lines aren’t shown here.

sound/soc/atmel/Makefile+2−0

This diff is large: its 11 lines aren’t shown here.

sound/soc/atmel/atmel-classd.c+18−8

This diff is large: its 78 lines aren’t shown here.

sound/soc/atmel/atmel-pdmic.c+738−0

This diff is large: its 739 lines aren’t shown here.

sound/soc/atmel/atmel-pdmic.h+80−0

This diff is large: its 81 lines aren’t shown here.

sound/soc/atmel/atmel_wm8904.c+1−0

This diff is large: its 8 lines aren’t shown here.

sound/soc/bcm/bcm2835-i2s.c+6−6

This diff is large: its 27 lines aren’t shown here.

sound/soc/codecs/Kconfig+58−4

This diff is large: its 196 lines aren’t shown here.

sound/soc/codecs/Makefile+20−2

This diff is large: its 96 lines aren’t shown here.

sound/soc/codecs/ak4613.c+83−35

This diff is large: its 197 lines aren’t shown here.

sound/soc/codecs/arizona.c+134−12

This diff is large: its 221 lines aren’t shown here.

sound/soc/codecs/arizona.h+12−5

This diff is large: its 52 lines aren’t shown here.

sound/soc/codecs/cs47l24.c+1148−0

This diff is large: its 1149 lines aren’t shown here.

sound/soc/codecs/cs47l24.h+23−0

This diff is large: its 24 lines aren’t shown here.

sound/soc/codecs/da7218.c+3341−0

This diff is large: its 3342 lines aren’t shown here.

sound/soc/codecs/da7218.h+1414−0

This diff is large: its 1415 lines aren’t shown here.

sound/soc/codecs/da7219.c+88−75

This diff is large: its 287 lines aren’t shown here.

sound/soc/codecs/da7219.h+0−9

This diff is large: its 37 lines aren’t shown here.

sound/soc/codecs/hdac_hdmi.c+697−0

This diff is large: its 698 lines aren’t shown here.

sound/soc/codecs/inno_rk3036.c+490−0

This diff is large: its 491 lines aren’t shown here.

sound/soc/codecs/inno_rk3036.h+123−0

This diff is large: its 124 lines aren’t shown here.

sound/soc/codecs/max98357a.c+10−0

This diff is large: its 28 lines aren’t shown here.

sound/soc/codecs/pcm1792a.c+0−271

This diff is large: its 272 lines aren’t shown here.

sound/soc/codecs/pcm179x.c+271−0

This diff is large: its 272 lines aren’t shown here.

sound/soc/codecs/pcm179x.hrenamed from sound/soc/codecs/pcm1792a.h+3−3

This diff is large: its 18 lines aren’t shown here.

sound/soc/codecs/pcm3168a-i2c.c+66−0

This diff is large: its 67 lines aren’t shown here.

sound/soc/codecs/pcm3168a-spi.c+65−0

This diff is large: its 66 lines aren’t shown here.

sound/soc/codecs/pcm3168a.c+767−0

This diff is large: its 768 lines aren’t shown here.

sound/soc/codecs/pcm3168a.h+100−0

This diff is large: its 101 lines aren’t shown here.

sound/soc/codecs/rt286.c+6−0

This diff is large: its 13 lines aren’t shown here.

sound/soc/codecs/rt298.c+0−2

This diff is large: its 9 lines aren’t shown here.

sound/soc/codecs/rt5616.c+1381−0

This diff is large: its 1382 lines aren’t shown here.

sound/soc/codecs/rt5616.h+1819−0

This diff is large: its 1820 lines aren’t shown here.

sound/soc/codecs/rt5640.c+103−0

This diff is large: its 138 lines aren’t shown here.

sound/soc/codecs/rt5640.h+17−0

This diff is large: its 41 lines aren’t shown here.

sound/soc/codecs/rt5645.c+245−77

This diff is large: its 491 lines aren’t shown here.

sound/soc/codecs/rt5651.c+31−0

This diff is large: its 65 lines aren’t shown here.

sound/soc/codecs/rt5659.c+4223−0

This diff is large: its 4224 lines aren’t shown here.

sound/soc/codecs/rt5659.h+1819−0

This diff is large: its 1820 lines aren’t shown here.

sound/soc/codecs/rt5677.c+7−6

This diff is large: its 49 lines aren’t shown here.

sound/soc/codecs/ssm2518.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/codecs/twl6040.c+1−2

This diff is large: its 10 lines aren’t shown here.

sound/soc/codecs/wm5110.c+240−12

This diff is large: its 392 lines aren’t shown here.

sound/soc/codecs/wm8903.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/codecs/wm8904.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/codecs/wm8960.c+18−6

This diff is large: its 69 lines aren’t shown here.

sound/soc/codecs/wm8962.c+1−2

This diff is large: its 17 lines aren’t shown here.

sound/soc/codecs/wm8974.c+7−0

This diff is large: its 17 lines aren’t shown here.

sound/soc/codecs/wm8998.c+23−23

This diff is large: its 62 lines aren’t shown here.

sound/soc/codecs/wm9713.c+150−146

This diff is large: its 535 lines aren’t shown here.

sound/soc/codecs/wm_adsp.c+1008−87

This diff is large: its 1412 lines aren’t shown here.

sound/soc/codecs/wm_adsp.h+25−3

This diff is large: its 63 lines aren’t shown here.

sound/soc/dwc/designware_i2s.c+86−31

This diff is large: its 229 lines aren’t shown here.

sound/soc/fsl/fsl-asoc-card.c+17−4

This diff is large: its 60 lines aren’t shown here.

sound/soc/fsl/fsl_asrc.c+45−17

This diff is large: its 132 lines aren’t shown here.

sound/soc/fsl/fsl_asrc.h+9−0

This diff is large: its 55 lines aren’t shown here.

sound/soc/fsl/fsl_esai.c+40−23

This diff is large: its 130 lines aren’t shown here.

sound/soc/fsl/fsl_sai.c+87−11

This diff is large: its 179 lines aren’t shown here.

sound/soc/fsl/fsl_sai.h+3−0

This diff is large: its 10 lines aren’t shown here.

sound/soc/fsl/fsl_spdif.c+27−8

This diff is large: its 91 lines aren’t shown here.

sound/soc/fsl/fsl_ssi.c+35−14

This diff is large: its 106 lines aren’t shown here.

sound/soc/fsl/imx-pcm-dma.c+2−0

This diff is large: its 9 lines aren’t shown here.

sound/soc/fsl/imx-pcm-fiq.c+2−2

This diff is large: its 12 lines aren’t shown here.

sound/soc/fsl/imx-wm8962.c+8−2

This diff is large: its 35 lines aren’t shown here.

sound/soc/fsl/mpc8610_hpcd.c+1−2

This diff is large: its 10 lines aren’t shown here.

sound/soc/fsl/p1022_ds.c+1−2

This diff is large: its 10 lines aren’t shown here.

sound/soc/fsl/p1022_rdk.c+1−2

This diff is large: its 10 lines aren’t shown here.

sound/soc/generic/simple-card.c+5−7

This diff is large: its 41 lines aren’t shown here.

sound/soc/img/Kconfig+52−0

This diff is large: its 53 lines aren’t shown here.

sound/soc/img/Makefile+7−0

This diff is large: its 8 lines aren’t shown here.

sound/soc/img/img-i2s-in.c+516−0

This diff is large: its 517 lines aren’t shown here.

sound/soc/img/img-i2s-out.c+565−0

This diff is large: its 566 lines aren’t shown here.

sound/soc/img/img-parallel-out.c+327−0

This diff is large: its 328 lines aren’t shown here.

sound/soc/img/img-spdif-in.c+806−0

This diff is large: its 807 lines aren’t shown here.

sound/soc/img/img-spdif-out.c+441−0

This diff is large: its 442 lines aren’t shown here.

sound/soc/img/pistachio-internal-dac.c+287−0

This diff is large: its 288 lines aren’t shown here.

sound/soc/intel/Kconfig+50−8

This diff is large: its 111 lines aren’t shown here.

sound/soc/intel/atom/sst-atom-controls.c+3−2

This diff is large: its 26 lines aren’t shown here.

sound/soc/intel/atom/sst-atom-controls.h+1−0

This diff is large: its 8 lines aren’t shown here.

sound/soc/intel/atom/sst-mfld-platform-pcm.c+20−12

This diff is large: its 81 lines aren’t shown here.

sound/soc/intel/atom/sst/sst_acpi.c+33−49

This diff is large: its 152 lines aren’t shown here.

sound/soc/intel/atom/sst/sst_stream.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/intel/baytrail/sst-baytrail-pcm.c+2−0

This diff is large: its 9 lines aren’t shown here.

sound/soc/intel/boards/Makefile+6−0

This diff is large: its 24 lines aren’t shown here.

sound/soc/intel/boards/bytcr_rt5640.c+213−53

This diff is large: its 379 lines aren’t shown here.

sound/soc/intel/boards/bytcr_rt5651.c+332−0

This diff is large: its 333 lines aren’t shown here.

sound/soc/intel/boards/cht_bsw_max98090_ti.c+14−5

This diff is large: its 34 lines aren’t shown here.

sound/soc/intel/boards/cht_bsw_rt5645.c+14−5

This diff is large: its 34 lines aren’t shown here.

sound/soc/intel/boards/cht_bsw_rt5672.c+14−5

This diff is large: its 34 lines aren’t shown here.

sound/soc/intel/boards/skl_nau88l25_max98357a.c+485−0

This diff is large: its 486 lines aren’t shown here.

sound/soc/intel/boards/skl_nau88l25_ssm4567.c+536−0

This diff is large: its 537 lines aren’t shown here.

sound/soc/intel/boards/skl_rt286.c+124−4

This diff is large: its 231 lines aren’t shown here.

sound/soc/intel/common/Makefile+7−5

This diff is large: its 19 lines aren’t shown here.

sound/soc/intel/common/sst-acpi.c+5−36

This diff is large: its 81 lines aren’t shown here.

sound/soc/intel/common/sst-acpi.h+33−0

This diff is large: its 34 lines aren’t shown here.

sound/soc/intel/common/sst-dsp-priv.h+5−3

This diff is large: its 29 lines aren’t shown here.

sound/soc/intel/common/sst-dsp.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/intel/common/sst-dsp.h+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/intel/common/sst-firmware.c+17−3

This diff is large: its 35 lines aren’t shown here.

sound/soc/intel/common/sst-match-acpi.c+43−0

This diff is large: its 44 lines aren’t shown here.

sound/soc/intel/haswell/sst-haswell-dsp.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/soc/intel/haswell/sst-haswell-ipc.c+13−18

This diff is large: its 56 lines aren’t shown here.

sound/soc/intel/skylake/skl-messages.c+153−127

This diff is large: its 471 lines aren’t shown here.

sound/soc/intel/skylake/skl-nhlt.c+13−6

This diff is large: its 49 lines aren’t shown here.

sound/soc/intel/skylake/skl-pcm.c+200−110

This diff is large: its 537 lines aren’t shown here.

sound/soc/intel/skylake/skl-sst-cldma.c+69−28

This diff is large: its 150 lines aren’t shown here.

sound/soc/intel/skylake/skl-sst-dsp.h+18−3

This diff is large: its 50 lines aren’t shown here.

sound/soc/intel/skylake/skl-sst-ipc.c+122−1

This diff is large: its 171 lines aren’t shown here.

sound/soc/intel/skylake/skl-sst-ipc.h+14−0

This diff is large: its 34 lines aren’t shown here.

sound/soc/intel/skylake/skl-sst.c+197−20

This diff is large: its 327 lines aren’t shown here.

sound/soc/intel/skylake/skl-topology.c+463−195

This diff is large: its 960 lines aren’t shown here.

sound/soc/intel/skylake/skl-topology.h+47−16

This diff is large: its 142 lines aren’t shown here.

sound/soc/intel/skylake/skl-tplg-interface.h+82−23

This diff is large: its 172 lines aren’t shown here.

sound/soc/intel/skylake/skl.c+172−41

This diff is large: its 330 lines aren’t shown here.

sound/soc/intel/skylake/skl.h+7−1

This diff is large: its 30 lines aren’t shown here.

sound/soc/mediatek/mtk-afe-common.h+0−1

This diff is large: its 8 lines aren’t shown here.

sound/soc/mediatek/mtk-afe-pcm.c+23−36

This diff is large: its 160 lines aren’t shown here.

sound/soc/omap/omap-hdmi-audio.c+2−0

This diff is large: its 9 lines aren’t shown here.

sound/soc/pxa/brownstone.c+1−2

This diff is large: its 10 lines aren’t shown here.

sound/soc/pxa/mioa701_wm9713.c+5−1

This diff is large: its 14 lines aren’t shown here.

sound/soc/qcom/lpass-cpu.c+1−0

This diff is large: its 8 lines aren’t shown here.

sound/soc/rockchip/rockchip_i2s.c+77−62

This diff is large: its 232 lines aren’t shown here.

sound/soc/rockchip/rockchip_max98090.c+6−0

This diff is large: its 18 lines aren’t shown here.

sound/soc/rockchip/rockchip_rt5645.c+6−0

This diff is large: its 18 lines aren’t shown here.

sound/soc/samsung/Kconfig+0−2

This diff is large: its 9 lines aren’t shown here.

sound/soc/samsung/ac97.c+6−23

This diff is large: its 59 lines aren’t shown here.

sound/soc/samsung/bells.c+30−10

This diff is large: its 86 lines aren’t shown here.

sound/soc/samsung/dma.h+4−2

This diff is large: its 21 lines aren’t shown here.

sound/soc/samsung/dmaengine.c+7−13

This diff is large: its 49 lines aren’t shown here.

sound/soc/samsung/i2s.c+10−21

This diff is large: its 71 lines aren’t shown here.

sound/soc/samsung/littlemill.c+26−6

This diff is large: its 68 lines aren’t shown here.

sound/soc/samsung/odroidx2_max98090.c+7−2

This diff is large: its 18 lines aren’t shown here.

sound/soc/samsung/pcm.c+9−16

This diff is large: its 54 lines aren’t shown here.

sound/soc/samsung/s3c2412-i2s.c+12−4

This diff is large: its 58 lines aren’t shown here.

sound/soc/samsung/s3c24xx-i2s.c+12−4

This diff is large: its 58 lines aren’t shown here.

sound/soc/samsung/snow.c+7−2

This diff is large: its 18 lines aren’t shown here.

sound/soc/samsung/spdif.c+8−9

This diff is large: its 41 lines aren’t shown here.

sound/soc/samsung/speyside.c+10−2

This diff is large: its 30 lines aren’t shown here.

sound/soc/samsung/tobermory.c+17−4

This diff is large: its 48 lines aren’t shown here.

sound/soc/sh/Kconfig+0−1

This diff is large: its 8 lines aren’t shown here.

sound/soc/sh/fsi.c+7−4

This diff is large: its 23 lines aren’t shown here.

sound/soc/sh/rcar/Makefile+1−1

This diff is large: its 6 lines aren’t shown here.

sound/soc/sh/rcar/adg.c+31−87

This diff is large: its 197 lines aren’t shown here.

sound/soc/sh/rcar/cmd.c+171−0

This diff is large: its 172 lines aren’t shown here.

sound/soc/sh/rcar/core.c+216−370

This diff is large: its 856 lines aren’t shown here.

sound/soc/sh/rcar/ctu.c+42−57

This diff is large: its 167 lines aren’t shown here.

sound/soc/sh/rcar/dma.c+149−96

This diff is large: its 467 lines aren’t shown here.

sound/soc/sh/rcar/dvc.c+145−128

This diff is large: its 415 lines aren’t shown here.

sound/soc/sh/rcar/gen.c+52−81

This diff is large: its 289 lines aren’t shown here.

sound/soc/sh/rcar/mix.c+78−80

This diff is large: its 255 lines aren’t shown here.

sound/soc/sh/rcar/rcar_snd.h+0−117

This diff is large: its 118 lines aren’t shown here.

sound/soc/sh/rcar/rsnd.h+167−168

This diff is large: its 560 lines aren’t shown here.

sound/soc/sh/rcar/rsrc-card.c+89−40

This diff is large: its 252 lines aren’t shown here.

sound/soc/sh/rcar/src.c+223−675

This diff is large: its 1149 lines aren’t shown here.

sound/soc/sh/rcar/ssi.c+442−313

This diff is large: its 1091 lines aren’t shown here.

sound/soc/sh/rcar/ssiu.c+225−0

This diff is large: its 226 lines aren’t shown here.

sound/soc/soc-ac97.c+125−0

This diff is large: its 160 lines aren’t shown here.

sound/soc/soc-compress.c+27−4

This diff is large: its 54 lines aren’t shown here.

sound/soc/soc-core.c+559−307

This diff is large: its 1327 lines aren’t shown here.

sound/soc/soc-dapm.c+8−6

This diff is large: its 37 lines aren’t shown here.

sound/soc/soc-ops.c+2−2

This diff is large: its 14 lines aren’t shown here.

sound/soc/soc-pcm.c+89−21

This diff is large: its 184 lines aren’t shown here.

sound/soc/sti/uniperif_player.c+1−2

This diff is large: its 10 lines aren’t shown here.

sound/soc/sunxi/sun4i-codec.c+230−49

This diff is large: its 461 lines aren’t shown here.

sound/soc/tegra/tegra_alc5632.c+8−4

This diff is large: its 21 lines aren’t shown here.

sound/soc/tegra/tegra_wm8903.c+2−1

This diff is large: its 10 lines aren’t shown here.

sound/synth/emux/emux_nrpn.c+5−4

This diff is large: its 37 lines aren’t shown here.

sound/usb/card.c+2−0

This diff is large: its 9 lines aren’t shown here.

sound/usb/midi.c+14−13

This diff is large: its 110 lines aren’t shown here.

sound/usb/misc/ua101.c+2−2

This diff is large: its 18 lines aren’t shown here.

sound/usb/mixer_quirks.c+1−1

This diff is large: its 9 lines aren’t shown here.

sound/usb/quirks.c+1−0

This diff is large: its 8 lines aren’t shown here.

sound/usb/stream.c+2−4

This diff is large: its 14 lines aren’t shown here.

sound/usb/usx2y/usbusx2yaudio.c+1−1

This diff is large: its 9 lines aren’t shown here.