From 8e4bff4cab0ddac6060645b0715210484d02ff40 Mon Sep 17 00:00:00 2001
From: Yuval Adam <_@yuv.al>
Date: Wed, 30 Aug 2017 08:25:59 +0000
Subject: Initial file dump from open source release
---
drivers/gpu/Makefile | 2 +
drivers/gpu/drm/Kconfig | 222 +
drivers/gpu/drm/Makefile | 55 +
drivers/gpu/drm/README.drm | 43 +
drivers/gpu/drm/ast/Kconfig | 16 +
drivers/gpu/drm/ast/Makefile | 9 +
drivers/gpu/drm/ast/ast_dram_tables.h | 144 +
drivers/gpu/drm/ast/ast_drv.c | 245 +
drivers/gpu/drm/ast/ast_drv.h | 359 +
drivers/gpu/drm/ast/ast_fb.c | 368 +
drivers/gpu/drm/ast/ast_main.c | 519 ++
drivers/gpu/drm/ast/ast_mode.c | 1160 +++
drivers/gpu/drm/ast/ast_post.c | 1780 ++++
drivers/gpu/drm/ast/ast_tables.h | 265 +
drivers/gpu/drm/ast/ast_ttm.c | 454 +
drivers/gpu/drm/ati_pcigart.c | 202 +
drivers/gpu/drm/cirrus/Kconfig | 12 +
drivers/gpu/drm/cirrus/Makefile | 5 +
drivers/gpu/drm/cirrus/cirrus_drv.c | 180 +
drivers/gpu/drm/cirrus/cirrus_drv.h | 247 +
drivers/gpu/drm/cirrus/cirrus_fbdev.c | 331 +
drivers/gpu/drm/cirrus/cirrus_main.c | 326 +
drivers/gpu/drm/cirrus/cirrus_mode.c | 631 ++
drivers/gpu/drm/cirrus/cirrus_ttm.c | 459 +
drivers/gpu/drm/drm_agpsupport.c | 469 +
drivers/gpu/drm/drm_auth.c | 194 +
drivers/gpu/drm/drm_buffer.c | 185 +
drivers/gpu/drm/drm_bufs.c | 1614 ++++
drivers/gpu/drm/drm_cache.c | 148 +
drivers/gpu/drm/drm_context.c | 452 +
drivers/gpu/drm/drm_crtc.c | 3902 ++++++++
drivers/gpu/drm/drm_crtc_helper.c | 1110 +++
drivers/gpu/drm/drm_debugfs.c | 241 +
drivers/gpu/drm/drm_dma.c | 157 +
drivers/gpu/drm/drm_dp_helper.c | 348 +
drivers/gpu/drm/drm_drv.c | 509 +
drivers/gpu/drm/drm_edid.c | 3048 ++++++
drivers/gpu/drm/drm_edid_load.c | 276 +
drivers/gpu/drm/drm_encoder_slave.c | 184 +
drivers/gpu/drm/drm_fb_cma_helper.c | 455 +
drivers/gpu/drm/drm_fb_helper.c | 1599 ++++
drivers/gpu/drm/drm_fops.c | 640 ++
drivers/gpu/drm/drm_gem.c | 717 ++
drivers/gpu/drm/drm_gem_cma_helper.c | 272 +
drivers/gpu/drm/drm_global.c | 112 +
drivers/gpu/drm/drm_hashtab.c | 208 +
drivers/gpu/drm/drm_info.c | 278 +
drivers/gpu/drm/drm_ioc32.c | 1085 +++
drivers/gpu/drm/drm_ioctl.c | 363 +
drivers/gpu/drm/drm_irq.c | 1417 +++
drivers/gpu/drm/drm_lock.c | 373 +
drivers/gpu/drm/drm_memory.c | 144 +
drivers/gpu/drm/drm_mm.c | 794 ++
drivers/gpu/drm/drm_modes.c | 1269 +++
drivers/gpu/drm/drm_pci.c | 505 +
drivers/gpu/drm/drm_platform.c | 205 +
drivers/gpu/drm/drm_prime.c | 538 ++
drivers/gpu/drm/drm_proc.c | 209 +
drivers/gpu/drm/drm_scatter.c | 213 +
drivers/gpu/drm/drm_stub.c | 509 +
drivers/gpu/drm/drm_sysfs.c | 570 ++
drivers/gpu/drm/drm_trace.h | 66 +
drivers/gpu/drm/drm_trace_points.c | 4 +
drivers/gpu/drm/drm_usb.c | 120 +
drivers/gpu/drm/drm_vm.c | 676 ++
drivers/gpu/drm/exynos/Kconfig | 73 +
drivers/gpu/drm/exynos/Makefile | 24 +
drivers/gpu/drm/exynos/exynos_ddc.c | 71 +
drivers/gpu/drm/exynos/exynos_drm_buf.c | 200 +
drivers/gpu/drm/exynos/exynos_drm_buf.h | 33 +
drivers/gpu/drm/exynos/exynos_drm_connector.c | 379 +
drivers/gpu/drm/exynos/exynos_drm_connector.h | 24 +
drivers/gpu/drm/exynos/exynos_drm_core.c | 236 +
drivers/gpu/drm/exynos/exynos_drm_crtc.c | 434 +
drivers/gpu/drm/exynos/exynos_drm_crtc.h | 23 +
drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | 308 +
drivers/gpu/drm/exynos/exynos_drm_dmabuf.h | 25 +
drivers/gpu/drm/exynos/exynos_drm_drv.c | 508 +
drivers/gpu/drm/exynos/exynos_drm_drv.h | 352 +
drivers/gpu/drm/exynos/exynos_drm_encoder.c | 520 ++
drivers/gpu/drm/exynos/exynos_drm_encoder.h | 37 +
drivers/gpu/drm/exynos/exynos_drm_fb.c | 338 +
drivers/gpu/drm/exynos/exynos_drm_fb.h | 35 +
drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 357 +
drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 23 +
drivers/gpu/drm/exynos/exynos_drm_fimc.c | 1982 ++++
drivers/gpu/drm/exynos/exynos_drm_fimc.h | 23 +
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 1100 +++
drivers/gpu/drm/exynos/exynos_drm_g2d.c | 1540 ++++
drivers/gpu/drm/exynos/exynos_drm_g2d.h | 36 +
drivers/gpu/drm/exynos/exynos_drm_gem.c | 816 ++
drivers/gpu/drm/exynos/exynos_drm_gem.h | 201 +
drivers/gpu/drm/exynos/exynos_drm_gsc.c | 1830 ++++
drivers/gpu/drm/exynos/exynos_drm_gsc.h | 24 +
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 483 +
drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 67 +
drivers/gpu/drm/exynos/exynos_drm_iommu.c | 136 +
drivers/gpu/drm/exynos/exynos_drm_iommu.h | 71 +
drivers/gpu/drm/exynos/exynos_drm_ipp.c | 2067 +++++
drivers/gpu/drm/exynos/exynos_drm_ipp.h | 252 +
drivers/gpu/drm/exynos/exynos_drm_plane.c | 303 +
drivers/gpu/drm/exynos/exynos_drm_plane.h | 20 +
drivers/gpu/drm/exynos/exynos_drm_rotator.c | 830 ++
drivers/gpu/drm/exynos/exynos_drm_rotator.h | 19 +
drivers/gpu/drm/exynos/exynos_drm_vidi.c | 668 ++
drivers/gpu/drm/exynos/exynos_drm_vidi.h | 22 +
drivers/gpu/drm/exynos/exynos_hdmi.c | 2171 +++++
drivers/gpu/drm/exynos/exynos_hdmi.h | 23 +
drivers/gpu/drm/exynos/exynos_hdmiphy.c | 70 +
drivers/gpu/drm/exynos/exynos_mixer.c | 1325 +++
drivers/gpu/drm/exynos/regs-fimc.h | 668 ++
drivers/gpu/drm/exynos/regs-gsc.h | 284 +
drivers/gpu/drm/exynos/regs-hdmi.h | 581 ++
drivers/gpu/drm/exynos/regs-mixer.h | 144 +
drivers/gpu/drm/exynos/regs-rotator.h | 73 +
drivers/gpu/drm/exynos/regs-vp.h | 91 +
drivers/gpu/drm/gma500/Kconfig | 38 +
drivers/gpu/drm/gma500/Makefile | 52 +
drivers/gpu/drm/gma500/accel_2d.c | 364 +
drivers/gpu/drm/gma500/backlight.c | 94 +
drivers/gpu/drm/gma500/cdv_device.c | 658 ++
drivers/gpu/drm/gma500/cdv_device.h | 36 +
drivers/gpu/drm/gma500/cdv_intel_crt.c | 327 +
drivers/gpu/drm/gma500/cdv_intel_display.c | 1790 ++++
drivers/gpu/drm/gma500/cdv_intel_dp.c | 1951 ++++
drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 385 +
drivers/gpu/drm/gma500/cdv_intel_lvds.c | 800 ++
drivers/gpu/drm/gma500/framebuffer.c | 798 ++
drivers/gpu/drm/gma500/framebuffer.h | 47 +
drivers/gpu/drm/gma500/gem.c | 299 +
drivers/gpu/drm/gma500/gtt.c | 587 ++
drivers/gpu/drm/gma500/gtt.h | 64 +
drivers/gpu/drm/gma500/intel_bios.c | 597 ++
drivers/gpu/drm/gma500/intel_bios.h | 621 ++
drivers/gpu/drm/gma500/intel_gmbus.c | 492 +
drivers/gpu/drm/gma500/intel_i2c.c | 169 +
drivers/gpu/drm/gma500/mdfld_device.c | 551 ++
drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 1016 ++
drivers/gpu/drm/gma500/mdfld_dsi_dpi.h | 79 +
drivers/gpu/drm/gma500/mdfld_dsi_output.c | 615 ++
drivers/gpu/drm/gma500/mdfld_dsi_output.h | 377 +
drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 688 ++
drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.h | 92 +
drivers/gpu/drm/gma500/mdfld_intel_display.c | 1054 +++
drivers/gpu/drm/gma500/mdfld_output.c | 74 +
drivers/gpu/drm/gma500/mdfld_output.h | 77 +
drivers/gpu/drm/gma500/mdfld_tmd_vid.c | 201 +
drivers/gpu/drm/gma500/mdfld_tpo_vid.c | 124 +
drivers/gpu/drm/gma500/mid_bios.c | 338 +
drivers/gpu/drm/gma500/mid_bios.h | 21 +
drivers/gpu/drm/gma500/mmu.c | 849 ++
drivers/gpu/drm/gma500/oaktrail.h | 257 +
drivers/gpu/drm/gma500/oaktrail_crtc.c | 586 ++
drivers/gpu/drm/gma500/oaktrail_device.c | 569 ++
drivers/gpu/drm/gma500/oaktrail_hdmi.c | 870 ++
drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c | 327 +
drivers/gpu/drm/gma500/oaktrail_lvds.c | 448 +
drivers/gpu/drm/gma500/opregion.c | 341 +
drivers/gpu/drm/gma500/opregion.h | 54 +
drivers/gpu/drm/gma500/power.c | 332 +
drivers/gpu/drm/gma500/power.h | 70 +
drivers/gpu/drm/gma500/psb_device.c | 396 +
drivers/gpu/drm/gma500/psb_drv.c | 695 ++
drivers/gpu/drm/gma500/psb_drv.h | 982 ++
drivers/gpu/drm/gma500/psb_intel_display.c | 1368 +++
drivers/gpu/drm/gma500/psb_intel_display.h | 25 +
drivers/gpu/drm/gma500/psb_intel_drv.h | 298 +
drivers/gpu/drm/gma500/psb_intel_lvds.c | 858 ++
drivers/gpu/drm/gma500/psb_intel_modes.c | 75 +
drivers/gpu/drm/gma500/psb_intel_reg.h | 1545 ++++
drivers/gpu/drm/gma500/psb_intel_sdvo.c | 2628 ++++++
drivers/gpu/drm/gma500/psb_intel_sdvo_regs.h | 723 ++
drivers/gpu/drm/gma500/psb_irq.c | 642 ++
drivers/gpu/drm/gma500/psb_irq.h | 47 +
drivers/gpu/drm/gma500/psb_lid.c | 94 +
drivers/gpu/drm/gma500/psb_reg.h | 582 ++
drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c | 829 ++
drivers/gpu/drm/gma500/tc35876x-dsi-lvds.h | 38 +
drivers/gpu/drm/i2c/Kconfig | 28 +
drivers/gpu/drm/i2c/Makefile | 10 +
drivers/gpu/drm/i2c/ch7006_drv.c | 552 ++
drivers/gpu/drm/i2c/ch7006_mode.c | 471 +
drivers/gpu/drm/i2c/ch7006_priv.h | 345 +
drivers/gpu/drm/i2c/sil164_drv.c | 464 +
drivers/gpu/drm/i2c/tda998x_drv.c | 906 ++
drivers/gpu/drm/i810/Makefile | 8 +
drivers/gpu/drm/i810/i810_dma.c | 1278 +++
drivers/gpu/drm/i810/i810_drv.c | 104 +
drivers/gpu/drm/i810/i810_drv.h | 243 +
drivers/gpu/drm/i915/Makefile | 53 +
drivers/gpu/drm/i915/dvo.h | 149 +
drivers/gpu/drm/i915/dvo_ch7017.c | 414 +
drivers/gpu/drm/i915/dvo_ch7xxx.c | 344 +
drivers/gpu/drm/i915/dvo_ivch.c | 436 +
drivers/gpu/drm/i915/dvo_ns2501.c | 588 ++
drivers/gpu/drm/i915/dvo_sil164.c | 279 +
drivers/gpu/drm/i915/dvo_tfp410.c | 318 +
drivers/gpu/drm/i915/i915_debugfs.c | 2165 +++++
drivers/gpu/drm/i915/i915_dma.c | 1933 ++++
drivers/gpu/drm/i915/i915_drv.c | 1344 +++
drivers/gpu/drm/i915/i915_drv.h | 1965 ++++
drivers/gpu/drm/i915/i915_gem.c | 4503 +++++++++
drivers/gpu/drm/i915/i915_gem_context.c | 519 ++
drivers/gpu/drm/i915/i915_gem_debug.c | 187 +
drivers/gpu/drm/i915/i915_gem_dmabuf.c | 308 +
drivers/gpu/drm/i915/i915_gem_evict.c | 185 +
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 1234 +++
drivers/gpu/drm/i915/i915_gem_gtt.c | 830 ++
drivers/gpu/drm/i915/i915_gem_stolen.c | 387 +
drivers/gpu/drm/i915/i915_gem_tiling.c | 523 ++
drivers/gpu/drm/i915/i915_ioc32.c | 221 +
drivers/gpu/drm/i915/i915_irq.c | 3212 +++++++
drivers/gpu/drm/i915/i915_reg.h | 4839 ++++++++++
drivers/gpu/drm/i915/i915_suspend.c | 424 +
drivers/gpu/drm/i915/i915_sysfs.c | 408 +
drivers/gpu/drm/i915/i915_trace.h | 455 +
drivers/gpu/drm/i915/i915_trace_points.c | 13 +
drivers/gpu/drm/i915/i915_ums.c | 503 +
drivers/gpu/drm/i915/intel_acpi.c | 251 +
drivers/gpu/drm/i915/intel_bios.c | 771 ++
drivers/gpu/drm/i915/intel_bios.h | 621 ++
drivers/gpu/drm/i915/intel_crt.c | 817 ++
drivers/gpu/drm/i915/intel_ddi.c | 1568 ++++
drivers/gpu/drm/i915/intel_display.c | 9673 ++++++++++++++++++++
drivers/gpu/drm/i915/intel_dp.c | 3026 ++++++
drivers/gpu/drm/i915/intel_drv.h | 732 ++
drivers/gpu/drm/i915/intel_dvo.c | 533 ++
drivers/gpu/drm/i915/intel_fb.c | 313 +
drivers/gpu/drm/i915/intel_hdmi.c | 1107 +++
drivers/gpu/drm/i915/intel_i2c.c | 615 ++
drivers/gpu/drm/i915/intel_lvds.c | 1315 +++
drivers/gpu/drm/i915/intel_modes.c | 128 +
drivers/gpu/drm/i915/intel_opregion.c | 556 ++
drivers/gpu/drm/i915/intel_overlay.c | 1539 ++++
drivers/gpu/drm/i915/intel_panel.c | 493 +
drivers/gpu/drm/i915/intel_pm.c | 4657 ++++++++++
drivers/gpu/drm/i915/intel_ringbuffer.c | 1938 ++++
drivers/gpu/drm/i915/intel_ringbuffer.h | 251 +
drivers/gpu/drm/i915/intel_sdvo.c | 2871 ++++++
drivers/gpu/drm/i915/intel_sdvo_regs.h | 730 ++
drivers/gpu/drm/i915/intel_sprite.c | 963 ++
drivers/gpu/drm/i915/intel_tv.c | 1685 ++++
drivers/gpu/drm/mga/Makefile | 11 +
drivers/gpu/drm/mga/mga_dma.c | 1154 +++
drivers/gpu/drm/mga/mga_drv.c | 143 +
drivers/gpu/drm/mga/mga_drv.h | 666 ++
drivers/gpu/drm/mga/mga_ioc32.c | 225 +
drivers/gpu/drm/mga/mga_irq.c | 173 +
drivers/gpu/drm/mga/mga_state.c | 1102 +++
drivers/gpu/drm/mga/mga_warp.c | 169 +
drivers/gpu/drm/mgag200/Kconfig | 15 +
drivers/gpu/drm/mgag200/Makefile | 5 +
drivers/gpu/drm/mgag200/mgag200_drv.c | 139 +
drivers/gpu/drm/mgag200/mgag200_drv.h | 277 +
drivers/gpu/drm/mgag200/mgag200_fb.c | 314 +
drivers/gpu/drm/mgag200/mgag200_i2c.c | 156 +
drivers/gpu/drm/mgag200/mgag200_main.c | 362 +
drivers/gpu/drm/mgag200/mgag200_mode.c | 1631 ++++
drivers/gpu/drm/mgag200/mgag200_reg.h | 661 ++
drivers/gpu/drm/mgag200/mgag200_ttm.c | 453 +
drivers/gpu/drm/nouveau/Kconfig | 55 +
drivers/gpu/drm/nouveau/Makefile | 247 +
drivers/gpu/drm/nouveau/core/core/client.c | 112 +
drivers/gpu/drm/nouveau/core/core/engctx.c | 251 +
drivers/gpu/drm/nouveau/core/core/engine.c | 55 +
drivers/gpu/drm/nouveau/core/core/enum.c | 68 +
drivers/gpu/drm/nouveau/core/core/event.c | 110 +
drivers/gpu/drm/nouveau/core/core/falcon.c | 250 +
drivers/gpu/drm/nouveau/core/core/gpuobj.c | 323 +
drivers/gpu/drm/nouveau/core/core/handle.c | 226 +
drivers/gpu/drm/nouveau/core/core/mm.c | 251 +
drivers/gpu/drm/nouveau/core/core/namedb.c | 203 +
drivers/gpu/drm/nouveau/core/core/object.c | 474 +
drivers/gpu/drm/nouveau/core/core/option.c | 131 +
drivers/gpu/drm/nouveau/core/core/parent.c | 128 +
drivers/gpu/drm/nouveau/core/core/printk.c | 74 +
drivers/gpu/drm/nouveau/core/core/ramht.c | 109 +
drivers/gpu/drm/nouveau/core/core/subdev.c | 115 +
drivers/gpu/drm/nouveau/core/engine/bsp/nv84.c | 93 +
drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c | 110 +
drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c | 110 +
.../gpu/drm/nouveau/core/engine/copy/fuc/nva3.fuc | 872 ++
.../drm/nouveau/core/engine/copy/fuc/nva3.fuc.h | 620 ++
.../drm/nouveau/core/engine/copy/fuc/nvc0.fuc.h | 606 ++
drivers/gpu/drm/nouveau/core/engine/copy/nva3.c | 164 +
drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c | 178 +
drivers/gpu/drm/nouveau/core/engine/copy/nve0.c | 136 +
.../gpu/drm/nouveau/core/engine/crypt/fuc/nv98.fuc | 698 ++
.../drm/nouveau/core/engine/crypt/fuc/nv98.fuc.h | 584 ++
drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c | 197 +
drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c | 165 +
drivers/gpu/drm/nouveau/core/engine/device/base.c | 477 +
drivers/gpu/drm/nouveau/core/engine/device/nv04.c | 89 +
drivers/gpu/drm/nouveau/core/engine/device/nv10.c | 204 +
drivers/gpu/drm/nouveau/core/engine/device/nv20.c | 131 +
drivers/gpu/drm/nouveau/core/engine/device/nv30.c | 153 +
drivers/gpu/drm/nouveau/core/engine/device/nv40.c | 393 +
drivers/gpu/drm/nouveau/core/engine/device/nv50.c | 425 +
drivers/gpu/drm/nouveau/core/engine/device/nvc0.c | 320 +
drivers/gpu/drm/nouveau/core/engine/device/nve0.c | 184 +
drivers/gpu/drm/nouveau/core/engine/disp/base.c | 52 +
drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c | 98 +
drivers/gpu/drm/nouveau/core/engine/disp/dport.c | 346 +
drivers/gpu/drm/nouveau/core/engine/disp/dport.h | 78 +
drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c | 50 +
drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c | 55 +
.../gpu/drm/nouveau/core/engine/disp/hdminv84.c | 70 +
.../gpu/drm/nouveau/core/engine/disp/hdminva3.c | 70 +
.../gpu/drm/nouveau/core/engine/disp/hdminvd0.c | 62 +
drivers/gpu/drm/nouveau/core/engine/disp/nv04.c | 105 +
drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | 1328 +++
drivers/gpu/drm/nouveau/core/engine/disp/nv50.h | 147 +
drivers/gpu/drm/nouveau/core/engine/disp/nv84.c | 102 +
drivers/gpu/drm/nouveau/core/engine/disp/nv94.c | 103 +
drivers/gpu/drm/nouveau/core/engine/disp/nva0.c | 89 +
drivers/gpu/drm/nouveau/core/engine/disp/nva3.c | 105 +
drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | 994 ++
drivers/gpu/drm/nouveau/core/engine/disp/nve0.c | 89 +
drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c | 89 +
.../gpu/drm/nouveau/core/engine/disp/piornv50.c | 140 +
drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c | 79 +
drivers/gpu/drm/nouveau/core/engine/disp/sornv94.c | 127 +
drivers/gpu/drm/nouveau/core/engine/disp/sornvd0.c | 124 +
drivers/gpu/drm/nouveau/core/engine/disp/vga.c | 215 +
drivers/gpu/drm/nouveau/core/engine/dmaobj/base.c | 120 +
drivers/gpu/drm/nouveau/core/engine/dmaobj/nv04.c | 143 +
drivers/gpu/drm/nouveau/core/engine/dmaobj/nv50.c | 161 +
drivers/gpu/drm/nouveau/core/engine/dmaobj/nvc0.c | 143 +
drivers/gpu/drm/nouveau/core/engine/dmaobj/nvd0.c | 125 +
drivers/gpu/drm/nouveau/core/engine/fifo/base.c | 208 +
drivers/gpu/drm/nouveau/core/engine/fifo/nv04.c | 644 ++
drivers/gpu/drm/nouveau/core/engine/fifo/nv04.h | 178 +
drivers/gpu/drm/nouveau/core/engine/fifo/nv10.c | 171 +
drivers/gpu/drm/nouveau/core/engine/fifo/nv17.c | 208 +
drivers/gpu/drm/nouveau/core/engine/fifo/nv40.c | 349 +
drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c | 515 ++
drivers/gpu/drm/nouveau/core/engine/fifo/nv50.h | 36 +
drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c | 442 +
drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c | 733 ++
drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c | 679 ++
drivers/gpu/drm/nouveau/core/engine/graph/ctx.h | 129 +
.../gpu/drm/nouveau/core/engine/graph/ctxnv40.c | 695 ++
.../gpu/drm/nouveau/core/engine/graph/ctxnv50.c | 3341 +++++++
.../gpu/drm/nouveau/core/engine/graph/ctxnvc0.c | 3038 ++++++
.../gpu/drm/nouveau/core/engine/graph/ctxnve0.c | 2793 ++++++
.../drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc | 544 ++
.../nouveau/core/engine/graph/fuc/gpcnvc0.fuc.h | 604 ++
.../drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc | 456 +
.../nouveau/core/engine/graph/fuc/gpcnve0.fuc.h | 533 ++
.../drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc | 869 ++
.../nouveau/core/engine/graph/fuc/hubnvc0.fuc.h | 928 ++
.../drm/nouveau/core/engine/graph/fuc/hubnve0.fuc | 793 ++
.../nouveau/core/engine/graph/fuc/hubnve0.fuc.h | 858 ++
.../gpu/drm/nouveau/core/engine/graph/fuc/nvc0.fuc | 400 +
.../gpu/drm/nouveau/core/engine/graph/fuc/nve0.fuc | 400 +
drivers/gpu/drm/nouveau/core/engine/graph/nv04.c | 1389 +++
drivers/gpu/drm/nouveau/core/engine/graph/nv10.c | 1316 +++
drivers/gpu/drm/nouveau/core/engine/graph/nv20.c | 384 +
drivers/gpu/drm/nouveau/core/engine/graph/nv20.h | 31 +
drivers/gpu/drm/nouveau/core/engine/graph/nv25.c | 167 +
drivers/gpu/drm/nouveau/core/engine/graph/nv2a.c | 134 +
drivers/gpu/drm/nouveau/core/engine/graph/nv30.c | 238 +
drivers/gpu/drm/nouveau/core/engine/graph/nv34.c | 168 +
drivers/gpu/drm/nouveau/core/engine/graph/nv35.c | 166 +
drivers/gpu/drm/nouveau/core/engine/graph/nv40.c | 537 ++
drivers/gpu/drm/nouveau/core/engine/graph/nv40.h | 21 +
drivers/gpu/drm/nouveau/core/engine/graph/nv50.c | 966 ++
drivers/gpu/drm/nouveau/core/engine/graph/nv50.h | 7 +
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 964 ++
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h | 175 +
drivers/gpu/drm/nouveau/core/engine/graph/nve0.c | 807 ++
drivers/gpu/drm/nouveau/core/engine/graph/regs.h | 274 +
drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c | 311 +
drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c | 144 +
drivers/gpu/drm/nouveau/core/engine/mpeg/nv50.c | 239 +
drivers/gpu/drm/nouveau/core/engine/mpeg/nv84.c | 104 +
drivers/gpu/drm/nouveau/core/engine/ppp/nv98.c | 98 +
drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c | 110 +
.../gpu/drm/nouveau/core/engine/software/nv04.c | 147 +
.../gpu/drm/nouveau/core/engine/software/nv10.c | 129 +
.../gpu/drm/nouveau/core/engine/software/nv50.c | 219 +
.../gpu/drm/nouveau/core/engine/software/nvc0.c | 225 +
drivers/gpu/drm/nouveau/core/engine/vp/nv84.c | 93 +
drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c | 110 +
drivers/gpu/drm/nouveau/core/engine/vp/nve0.c | 110 +
drivers/gpu/drm/nouveau/core/include/core/class.h | 361 +
drivers/gpu/drm/nouveau/core/include/core/client.h | 46 +
drivers/gpu/drm/nouveau/core/include/core/debug.h | 13 +
drivers/gpu/drm/nouveau/core/include/core/device.h | 137 +
drivers/gpu/drm/nouveau/core/include/core/engctx.h | 54 +
drivers/gpu/drm/nouveau/core/include/core/engine.h | 57 +
drivers/gpu/drm/nouveau/core/include/core/enum.h | 24 +
drivers/gpu/drm/nouveau/core/include/core/event.h | 36 +
drivers/gpu/drm/nouveau/core/include/core/falcon.h | 81 +
drivers/gpu/drm/nouveau/core/include/core/gpuobj.h | 71 +
drivers/gpu/drm/nouveau/core/include/core/handle.h | 31 +
drivers/gpu/drm/nouveau/core/include/core/math.h | 16 +
drivers/gpu/drm/nouveau/core/include/core/mm.h | 38 +
drivers/gpu/drm/nouveau/core/include/core/namedb.h | 56 +
drivers/gpu/drm/nouveau/core/include/core/object.h | 202 +
drivers/gpu/drm/nouveau/core/include/core/option.h | 11 +
drivers/gpu/drm/nouveau/core/include/core/parent.h | 61 +
drivers/gpu/drm/nouveau/core/include/core/printk.h | 40 +
drivers/gpu/drm/nouveau/core/include/core/ramht.h | 23 +
drivers/gpu/drm/nouveau/core/include/core/subdev.h | 118 +
drivers/gpu/drm/nouveau/core/include/engine/bsp.h | 8 +
drivers/gpu/drm/nouveau/core/include/engine/copy.h | 12 +
.../gpu/drm/nouveau/core/include/engine/crypt.h | 7 +
.../gpu/drm/nouveau/core/include/engine/device.h | 23 +
drivers/gpu/drm/nouveau/core/include/engine/disp.h | 49 +
.../gpu/drm/nouveau/core/include/engine/dmaobj.h | 48 +
drivers/gpu/drm/nouveau/core/include/engine/fifo.h | 116 +
.../gpu/drm/nouveau/core/include/engine/graph.h | 76 +
drivers/gpu/drm/nouveau/core/include/engine/mpeg.h | 61 +
drivers/gpu/drm/nouveau/core/include/engine/ppp.h | 7 +
.../gpu/drm/nouveau/core/include/engine/software.h | 60 +
drivers/gpu/drm/nouveau/core/include/engine/vp.h | 8 +
drivers/gpu/drm/nouveau/core/include/subdev/bar.h | 55 +
drivers/gpu/drm/nouveau/core/include/subdev/bios.h | 35 +
.../gpu/drm/nouveau/core/include/subdev/bios/bit.h | 13 +
.../gpu/drm/nouveau/core/include/subdev/bios/bmp.h | 39 +
.../drm/nouveau/core/include/subdev/bios/conn.h | 27 +
.../gpu/drm/nouveau/core/include/subdev/bios/dcb.h | 69 +
.../drm/nouveau/core/include/subdev/bios/disp.h | 48 +
.../gpu/drm/nouveau/core/include/subdev/bios/dp.h | 34 +
.../drm/nouveau/core/include/subdev/bios/extdev.h | 30 +
.../drm/nouveau/core/include/subdev/bios/gpio.h | 40 +
.../gpu/drm/nouveau/core/include/subdev/bios/i2c.h | 25 +
.../drm/nouveau/core/include/subdev/bios/init.h | 22 +
.../gpu/drm/nouveau/core/include/subdev/bios/mxm.h | 9 +
.../drm/nouveau/core/include/subdev/bios/perf.h | 14 +
.../gpu/drm/nouveau/core/include/subdev/bios/pll.h | 79 +
.../drm/nouveau/core/include/subdev/bios/therm.h | 62 +
.../drm/nouveau/core/include/subdev/bios/xpio.h | 19 +
drivers/gpu/drm/nouveau/core/include/subdev/bus.h | 41 +
.../gpu/drm/nouveau/core/include/subdev/clock.h | 60 +
.../gpu/drm/nouveau/core/include/subdev/devinit.h | 40 +
drivers/gpu/drm/nouveau/core/include/subdev/fb.h | 171 +
drivers/gpu/drm/nouveau/core/include/subdev/gpio.h | 53 +
drivers/gpu/drm/nouveau/core/include/subdev/i2c.h | 151 +
drivers/gpu/drm/nouveau/core/include/subdev/ibus.h | 34 +
.../gpu/drm/nouveau/core/include/subdev/instmem.h | 73 +
drivers/gpu/drm/nouveau/core/include/subdev/ltcg.h | 40 +
drivers/gpu/drm/nouveau/core/include/subdev/mc.h | 52 +
drivers/gpu/drm/nouveau/core/include/subdev/mxm.h | 37 +
.../gpu/drm/nouveau/core/include/subdev/therm.h | 80 +
.../gpu/drm/nouveau/core/include/subdev/timer.h | 61 +
drivers/gpu/drm/nouveau/core/include/subdev/vga.h | 30 +
drivers/gpu/drm/nouveau/core/include/subdev/vm.h | 142 +
drivers/gpu/drm/nouveau/core/os.h | 49 +
drivers/gpu/drm/nouveau/core/subdev/bar/base.c | 135 +
drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c | 265 +
drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c | 219 +
drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 520 ++
drivers/gpu/drm/nouveau/core/subdev/bios/bit.c | 52 +
drivers/gpu/drm/nouveau/core/subdev/bios/conn.c | 56 +
drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c | 205 +
drivers/gpu/drm/nouveau/core/subdev/bios/disp.c | 178 +
drivers/gpu/drm/nouveau/core/subdev/bios/dp.c | 204 +
drivers/gpu/drm/nouveau/core/subdev/bios/extdev.c | 100 +
drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c | 150 +
drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c | 134 +
drivers/gpu/drm/nouveau/core/subdev/bios/init.c | 2219 +++++
drivers/gpu/drm/nouveau/core/subdev/bios/mxm.c | 135 +
drivers/gpu/drm/nouveau/core/subdev/bios/perf.c | 75 +
drivers/gpu/drm/nouveau/core/subdev/bios/pll.c | 415 +
drivers/gpu/drm/nouveau/core/subdev/bios/therm.c | 203 +
drivers/gpu/drm/nouveau/core/subdev/bios/xpio.c | 76 +
drivers/gpu/drm/nouveau/core/subdev/bus/nv04.c | 95 +
drivers/gpu/drm/nouveau/core/subdev/bus/nv31.c | 112 +
drivers/gpu/drm/nouveau/core/subdev/bus/nv50.c | 105 +
drivers/gpu/drm/nouveau/core/subdev/bus/nvc0.c | 101 +
drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c | 359 +
drivers/gpu/drm/nouveau/core/subdev/clock/nv40.c | 59 +
drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c | 106 +
drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c | 114 +
drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c | 97 +
drivers/gpu/drm/nouveau/core/subdev/clock/pll.h | 9 +
.../gpu/drm/nouveau/core/subdev/clock/pllnv04.c | 242 +
.../gpu/drm/nouveau/core/subdev/clock/pllnva3.c | 80 +
drivers/gpu/drm/nouveau/core/subdev/devinit/base.c | 69 +
.../gpu/drm/nouveau/core/subdev/devinit/fbmem.h | 98 +
drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c | 189 +
drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c | 159 +
drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c | 124 +
drivers/gpu/drm/nouveau/core/subdev/devinit/nv1a.c | 58 +
drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c | 96 +
drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c | 121 +
drivers/gpu/drm/nouveau/core/subdev/fb/base.c | 140 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c | 134 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c | 104 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c | 89 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c | 132 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c | 81 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c | 159 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c | 82 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c | 82 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c | 113 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c | 106 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c | 114 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c | 79 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c | 66 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c | 84 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c | 72 +
drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c | 522 ++
drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c | 247 +
drivers/gpu/drm/nouveau/core/subdev/gpio/base.c | 158 +
drivers/gpu/drm/nouveau/core/subdev/gpio/nv10.c | 177 +
drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c | 212 +
drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c | 107 +
drivers/gpu/drm/nouveau/core/subdev/gpio/nve0.c | 131 +
drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h | 17 +
drivers/gpu/drm/nouveau/core/subdev/i2c/anx9805.c | 279 +
drivers/gpu/drm/nouveau/core/subdev/i2c/aux.c | 100 +
drivers/gpu/drm/nouveau/core/subdev/i2c/base.c | 365 +
drivers/gpu/drm/nouveau/core/subdev/i2c/bit.c | 232 +
drivers/gpu/drm/nouveau/core/subdev/i2c/nv04.c | 143 +
drivers/gpu/drm/nouveau/core/subdev/i2c/nv4e.c | 135 +
drivers/gpu/drm/nouveau/core/subdev/i2c/nv50.c | 149 +
drivers/gpu/drm/nouveau/core/subdev/i2c/nv50.h | 32 +
drivers/gpu/drm/nouveau/core/subdev/i2c/nv94.c | 285 +
drivers/gpu/drm/nouveau/core/subdev/i2c/nvd0.c | 124 +
drivers/gpu/drm/nouveau/core/subdev/ibus/nvc0.c | 123 +
drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c | 123 +
drivers/gpu/drm/nouveau/core/subdev/instmem/base.c | 154 +
drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c | 190 +
drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.h | 38 +
drivers/gpu/drm/nouveau/core/subdev/instmem/nv40.c | 140 +
drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c | 172 +
drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c | 221 +
drivers/gpu/drm/nouveau/core/subdev/mc/base.c | 105 +
drivers/gpu/drm/nouveau/core/subdev/mc/nv04.c | 81 +
drivers/gpu/drm/nouveau/core/subdev/mc/nv44.c | 72 +
drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c | 80 +
drivers/gpu/drm/nouveau/core/subdev/mc/nv98.c | 74 +
drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c | 76 +
drivers/gpu/drm/nouveau/core/subdev/mxm/base.c | 290 +
drivers/gpu/drm/nouveau/core/subdev/mxm/mxms.c | 193 +
drivers/gpu/drm/nouveau/core/subdev/mxm/mxms.h | 22 +
drivers/gpu/drm/nouveau/core/subdev/mxm/nv50.c | 233 +
drivers/gpu/drm/nouveau/core/subdev/therm/base.c | 336 +
drivers/gpu/drm/nouveau/core/subdev/therm/fan.c | 261 +
drivers/gpu/drm/nouveau/core/subdev/therm/fannil.c | 54 +
drivers/gpu/drm/nouveau/core/subdev/therm/fanpwm.c | 107 +
drivers/gpu/drm/nouveau/core/subdev/therm/fantog.c | 115 +
drivers/gpu/drm/nouveau/core/subdev/therm/ic.c | 120 +
drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c | 224 +
drivers/gpu/drm/nouveau/core/subdev/therm/nv50.c | 197 +
drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c | 221 +
drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c | 99 +
drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c | 153 +
drivers/gpu/drm/nouveau/core/subdev/therm/priv.h | 150 +
drivers/gpu/drm/nouveau/core/subdev/therm/temp.c | 245 +
drivers/gpu/drm/nouveau/core/subdev/timer/base.c | 87 +
drivers/gpu/drm/nouveau/core/subdev/timer/nv04.c | 254 +
drivers/gpu/drm/nouveau/core/subdev/vm/base.c | 480 +
drivers/gpu/drm/nouveau/core/subdev/vm/nv04.c | 151 +
drivers/gpu/drm/nouveau/core/subdev/vm/nv04.h | 19 +
drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c | 159 +
drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c | 249 +
drivers/gpu/drm/nouveau/core/subdev/vm/nv50.c | 227 +
drivers/gpu/drm/nouveau/core/subdev/vm/nvc0.c | 243 +
drivers/gpu/drm/nouveau/dispnv04/Makefile | 10 +
drivers/gpu/drm/nouveau/dispnv04/arb.c | 265 +
drivers/gpu/drm/nouveau/dispnv04/crtc.c | 1072 +++
drivers/gpu/drm/nouveau/dispnv04/cursor.c | 70 +
drivers/gpu/drm/nouveau/dispnv04/dac.c | 556 ++
drivers/gpu/drm/nouveau/dispnv04/dfp.c | 720 ++
drivers/gpu/drm/nouveau/dispnv04/disp.c | 211 +
drivers/gpu/drm/nouveau/dispnv04/disp.h | 185 +
drivers/gpu/drm/nouveau/dispnv04/hw.c | 827 ++
drivers/gpu/drm/nouveau/dispnv04/hw.h | 409 +
drivers/gpu/drm/nouveau/dispnv04/nvreg.h | 517 ++
drivers/gpu/drm/nouveau/dispnv04/tvmodesnv17.c | 592 ++
drivers/gpu/drm/nouveau/dispnv04/tvnv04.c | 246 +
drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 843 ++
drivers/gpu/drm/nouveau/dispnv04/tvnv17.h | 163 +
drivers/gpu/drm/nouveau/nouveau_abi16.c | 493 +
drivers/gpu/drm/nouveau/nouveau_abi16.h | 115 +
drivers/gpu/drm/nouveau/nouveau_acpi.c | 422 +
drivers/gpu/drm/nouveau/nouveau_acpi.h | 26 +
drivers/gpu/drm/nouveau/nouveau_agp.c | 164 +
drivers/gpu/drm/nouveau/nouveau_agp.h | 10 +
drivers/gpu/drm/nouveau/nouveau_backlight.c | 264 +
drivers/gpu/drm/nouveau/nouveau_bios.c | 2121 +++++
drivers/gpu/drm/nouveau/nouveau_bios.h | 179 +
drivers/gpu/drm/nouveau/nouveau_bo.c | 1546 ++++
drivers/gpu/drm/nouveau/nouveau_bo.h | 100 +
drivers/gpu/drm/nouveau/nouveau_chan.c | 403 +
drivers/gpu/drm/nouveau/nouveau_chan.h | 47 +
drivers/gpu/drm/nouveau/nouveau_connector.c | 1150 +++
drivers/gpu/drm/nouveau/nouveau_connector.h | 113 +
drivers/gpu/drm/nouveau/nouveau_crtc.h | 87 +
drivers/gpu/drm/nouveau/nouveau_debugfs.c | 64 +
drivers/gpu/drm/nouveau/nouveau_debugfs.h | 22 +
drivers/gpu/drm/nouveau/nouveau_display.c | 714 ++
drivers/gpu/drm/nouveau/nouveau_display.h | 91 +
drivers/gpu/drm/nouveau/nouveau_dma.c | 262 +
drivers/gpu/drm/nouveau/nouveau_dma.h | 211 +
drivers/gpu/drm/nouveau/nouveau_dp.c | 96 +
drivers/gpu/drm/nouveau/nouveau_drm.c | 802 ++
drivers/gpu/drm/nouveau/nouveau_drm.h | 159 +
drivers/gpu/drm/nouveau/nouveau_encoder.h | 94 +
drivers/gpu/drm/nouveau/nouveau_fbcon.c | 528 ++
drivers/gpu/drm/nouveau/nouveau_fbcon.h | 70 +
drivers/gpu/drm/nouveau/nouveau_fence.c | 277 +
drivers/gpu/drm/nouveau/nouveau_fence.h | 96 +
drivers/gpu/drm/nouveau/nouveau_gem.c | 891 ++
drivers/gpu/drm/nouveau/nouveau_gem.h | 45 +
drivers/gpu/drm/nouveau/nouveau_hwsq.h | 115 +
drivers/gpu/drm/nouveau/nouveau_ioc32.c | 69 +
drivers/gpu/drm/nouveau/nouveau_ioctl.h | 6 +
drivers/gpu/drm/nouveau/nouveau_mem.c | 647 ++
drivers/gpu/drm/nouveau/nouveau_perf.c | 416 +
drivers/gpu/drm/nouveau/nouveau_pm.c | 1174 +++
drivers/gpu/drm/nouveau/nouveau_pm.h | 283 +
drivers/gpu/drm/nouveau/nouveau_prime.c | 95 +
drivers/gpu/drm/nouveau/nouveau_reg.h | 858 ++
drivers/gpu/drm/nouveau/nouveau_sgdma.c | 112 +
drivers/gpu/drm/nouveau/nouveau_ttm.c | 442 +
drivers/gpu/drm/nouveau/nouveau_ttm.h | 25 +
drivers/gpu/drm/nouveau/nouveau_vga.c | 98 +
drivers/gpu/drm/nouveau/nouveau_vga.h | 8 +
drivers/gpu/drm/nouveau/nouveau_volt.c | 250 +
drivers/gpu/drm/nouveau/nv04_fbcon.c | 277 +
drivers/gpu/drm/nouveau/nv04_fence.c | 111 +
drivers/gpu/drm/nouveau/nv04_pm.c | 146 +
drivers/gpu/drm/nouveau/nv10_fence.c | 110 +
drivers/gpu/drm/nouveau/nv10_fence.h | 19 +
drivers/gpu/drm/nouveau/nv17_fence.c | 149 +
drivers/gpu/drm/nouveau/nv40_pm.c | 353 +
drivers/gpu/drm/nouveau/nv50_display.c | 2300 +++++
drivers/gpu/drm/nouveau/nv50_display.h | 45 +
drivers/gpu/drm/nouveau/nv50_fbcon.c | 259 +
drivers/gpu/drm/nouveau/nv50_fence.c | 123 +
drivers/gpu/drm/nouveau/nv50_pm.c | 855 ++
drivers/gpu/drm/nouveau/nv84_fence.c | 276 +
drivers/gpu/drm/nouveau/nva3_pm.c | 624 ++
drivers/gpu/drm/nouveau/nvc0_fbcon.c | 262 +
drivers/gpu/drm/nouveau/nvc0_fence.c | 90 +
drivers/gpu/drm/nouveau/nvc0_pm.c | 599 ++
drivers/gpu/drm/omapdrm/Kconfig | 25 +
drivers/gpu/drm/omapdrm/Makefile | 24 +
drivers/gpu/drm/omapdrm/TODO | 23 +
drivers/gpu/drm/omapdrm/omap_connector.c | 319 +
drivers/gpu/drm/omapdrm/omap_crtc.c | 661 ++
drivers/gpu/drm/omapdrm/omap_debugfs.c | 125 +
drivers/gpu/drm/omapdrm/omap_dmm_priv.h | 188 +
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 988 ++
drivers/gpu/drm/omapdrm/omap_dmm_tiler.h | 141 +
drivers/gpu/drm/omapdrm/omap_drv.c | 712 ++
drivers/gpu/drm/omapdrm/omap_drv.h | 303 +
drivers/gpu/drm/omapdrm/omap_encoder.c | 188 +
drivers/gpu/drm/omapdrm/omap_fb.c | 471 +
drivers/gpu/drm/omapdrm/omap_fbdev.c | 397 +
drivers/gpu/drm/omapdrm/omap_gem.c | 1507 +++
drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 224 +
drivers/gpu/drm/omapdrm/omap_gem_helpers.c | 169 +
drivers/gpu/drm/omapdrm/omap_irq.c | 327 +
drivers/gpu/drm/omapdrm/omap_plane.c | 454 +
drivers/gpu/drm/omapdrm/tcm-sita.c | 703 ++
drivers/gpu/drm/omapdrm/tcm-sita.h | 95 +
drivers/gpu/drm/omapdrm/tcm.h | 328 +
drivers/gpu/drm/qxl/Kconfig | 11 +
drivers/gpu/drm/qxl/Makefile | 9 +
drivers/gpu/drm/qxl/qxl_cmd.c | 694 ++
drivers/gpu/drm/qxl/qxl_debugfs.c | 141 +
drivers/gpu/drm/qxl/qxl_dev.h | 879 ++
drivers/gpu/drm/qxl/qxl_display.c | 973 ++
drivers/gpu/drm/qxl/qxl_draw.c | 390 +
drivers/gpu/drm/qxl/qxl_drv.c | 145 +
drivers/gpu/drm/qxl/qxl_drv.h | 559 ++
drivers/gpu/drm/qxl/qxl_dumb.c | 93 +
drivers/gpu/drm/qxl/qxl_fb.c | 567 ++
drivers/gpu/drm/qxl/qxl_fence.c | 97 +
drivers/gpu/drm/qxl/qxl_gem.c | 149 +
drivers/gpu/drm/qxl/qxl_image.c | 176 +
drivers/gpu/drm/qxl/qxl_ioctl.c | 417 +
drivers/gpu/drm/qxl/qxl_irq.c | 100 +
drivers/gpu/drm/qxl/qxl_kms.c | 303 +
drivers/gpu/drm/qxl/qxl_object.c | 365 +
drivers/gpu/drm/qxl/qxl_object.h | 112 +
drivers/gpu/drm/qxl/qxl_release.c | 304 +
drivers/gpu/drm/qxl/qxl_ttm.c | 582 ++
drivers/gpu/drm/r128/Makefile | 10 +
drivers/gpu/drm/r128/r128_cce.c | 937 ++
drivers/gpu/drm/r128/r128_drv.c | 112 +
drivers/gpu/drm/r128/r128_drv.h | 530 ++
drivers/gpu/drm/r128/r128_ioc32.c | 214 +
drivers/gpu/drm/r128/r128_irq.c | 115 +
drivers/gpu/drm/r128/r128_state.c | 1666 ++++
drivers/gpu/drm/radeon/.gitignore | 3 +
drivers/gpu/drm/radeon/Kconfig | 8 +
drivers/gpu/drm/radeon/Makefile | 87 +
drivers/gpu/drm/radeon/ObjectID.h | 696 ++
drivers/gpu/drm/radeon/atom-bits.h | 48 +
drivers/gpu/drm/radeon/atom-names.h | 100 +
drivers/gpu/drm/radeon/atom-types.h | 42 +
drivers/gpu/drm/radeon/atom.c | 1416 +++
drivers/gpu/drm/radeon/atom.h | 159 +
drivers/gpu/drm/radeon/atombios.h | 8012 ++++++++++++++++
drivers/gpu/drm/radeon/atombios_crtc.c | 1952 ++++
drivers/gpu/drm/radeon/atombios_dp.c | 938 ++
drivers/gpu/drm/radeon/atombios_encoders.c | 2680 ++++++
drivers/gpu/drm/radeon/atombios_i2c.c | 141 +
drivers/gpu/drm/radeon/avivod.h | 62 +
drivers/gpu/drm/radeon/cayman_blit_shaders.c | 374 +
drivers/gpu/drm/radeon/cayman_blit_shaders.h | 35 +
drivers/gpu/drm/radeon/evergreen.c | 5083 ++++++++++
drivers/gpu/drm/radeon/evergreen_blit_kms.c | 729 ++
drivers/gpu/drm/radeon/evergreen_blit_shaders.c | 357 +
drivers/gpu/drm/radeon/evergreen_blit_shaders.h | 35 +
drivers/gpu/drm/radeon/evergreen_cs.c | 3517 +++++++
drivers/gpu/drm/radeon/evergreen_hdmi.c | 298 +
drivers/gpu/drm/radeon/evergreen_reg.h | 240 +
drivers/gpu/drm/radeon/evergreend.h | 2100 +++++
drivers/gpu/drm/radeon/mkregtable.c | 725 ++
drivers/gpu/drm/radeon/ni.c | 2489 +++++
drivers/gpu/drm/radeon/ni_reg.h | 86 +
drivers/gpu/drm/radeon/nid.h | 704 ++
drivers/gpu/drm/radeon/r100.c | 4113 +++++++++
drivers/gpu/drm/radeon/r100_track.h | 97 +
drivers/gpu/drm/radeon/r100d.h | 869 ++
drivers/gpu/drm/radeon/r200.c | 548 ++
drivers/gpu/drm/radeon/r300.c | 1558 ++++
drivers/gpu/drm/radeon/r300_cmdbuf.c | 1186 +++
drivers/gpu/drm/radeon/r300_reg.h | 1789 ++++
drivers/gpu/drm/radeon/r300d.h | 343 +
drivers/gpu/drm/radeon/r420.c | 491 +
drivers/gpu/drm/radeon/r420d.h | 249 +
drivers/gpu/drm/radeon/r500_reg.h | 800 ++
drivers/gpu/drm/radeon/r520.c | 329 +
drivers/gpu/drm/radeon/r520d.h | 187 +
drivers/gpu/drm/radeon/r600.c | 4838 ++++++++++
drivers/gpu/drm/radeon/r600_audio.c | 193 +
drivers/gpu/drm/radeon/r600_blit.c | 843 ++
drivers/gpu/drm/radeon/r600_blit_kms.c | 785 ++
drivers/gpu/drm/radeon/r600_blit_shaders.c | 719 ++
drivers/gpu/drm/radeon/r600_blit_shaders.h | 39 +
drivers/gpu/drm/radeon/r600_cp.c | 2660 ++++++
drivers/gpu/drm/radeon/r600_cs.c | 2624 ++++++
drivers/gpu/drm/radeon/r600_hdmi.c | 561 ++
drivers/gpu/drm/radeon/r600_reg.h | 174 +
drivers/gpu/drm/radeon/r600d.h | 2003 ++++
drivers/gpu/drm/radeon/radeon.h | 2079 +++++
drivers/gpu/drm/radeon/radeon_acpi.c | 649 ++
drivers/gpu/drm/radeon/radeon_acpi.h | 445 +
drivers/gpu/drm/radeon/radeon_agp.c | 285 +
drivers/gpu/drm/radeon/radeon_asic.c | 2097 +++++
drivers/gpu/drm/radeon/radeon_asic.h | 556 ++
drivers/gpu/drm/radeon/radeon_atombios.c | 3326 +++++++
drivers/gpu/drm/radeon/radeon_atpx_handler.c | 568 ++
drivers/gpu/drm/radeon/radeon_benchmark.c | 250 +
drivers/gpu/drm/radeon/radeon_bios.c | 701 ++
drivers/gpu/drm/radeon/radeon_blit_common.h | 44 +
drivers/gpu/drm/radeon/radeon_clocks.c | 912 ++
drivers/gpu/drm/radeon/radeon_combios.c | 3619 ++++++++
drivers/gpu/drm/radeon/radeon_connectors.c | 2051 +++++
drivers/gpu/drm/radeon/radeon_cp.c | 2243 +++++
drivers/gpu/drm/radeon/radeon_cs.c | 817 ++
drivers/gpu/drm/radeon/radeon_cursor.c | 316 +
drivers/gpu/drm/radeon/radeon_device.c | 1549 ++++
drivers/gpu/drm/radeon/radeon_display.c | 1672 ++++
drivers/gpu/drm/radeon/radeon_drv.c | 505 +
drivers/gpu/drm/radeon/radeon_drv.h | 2164 +++++
drivers/gpu/drm/radeon/radeon_encoders.c | 384 +
drivers/gpu/drm/radeon/radeon_family.h | 116 +
drivers/gpu/drm/radeon/radeon_fb.c | 405 +
drivers/gpu/drm/radeon/radeon_fence.c | 949 ++
drivers/gpu/drm/radeon/radeon_gart.c | 1289 +++
drivers/gpu/drm/radeon/radeon_gem.c | 627 ++
drivers/gpu/drm/radeon/radeon_i2c.c | 1191 +++
drivers/gpu/drm/radeon/radeon_ioc32.c | 424 +
drivers/gpu/drm/radeon/radeon_irq.c | 402 +
drivers/gpu/drm/radeon/radeon_irq_kms.c | 480 +
drivers/gpu/drm/radeon/radeon_kms.c | 770 ++
drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 1105 +++
drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 1810 ++++
drivers/gpu/drm/radeon/radeon_legacy_tv.c | 923 ++
drivers/gpu/drm/radeon/radeon_mem.c | 302 +
drivers/gpu/drm/radeon/radeon_mode.h | 761 ++
drivers/gpu/drm/radeon/radeon_object.c | 650 ++
drivers/gpu/drm/radeon/radeon_object.h | 181 +
drivers/gpu/drm/radeon/radeon_pm.c | 876 ++
drivers/gpu/drm/radeon/radeon_prime.c | 98 +
drivers/gpu/drm/radeon/radeon_reg.h | 3724 ++++++++
drivers/gpu/drm/radeon/radeon_ring.c | 896 ++
drivers/gpu/drm/radeon/radeon_sa.c | 420 +
drivers/gpu/drm/radeon/radeon_semaphore.c | 119 +
drivers/gpu/drm/radeon/radeon_state.c | 3261 +++++++
drivers/gpu/drm/radeon/radeon_test.c | 533 ++
drivers/gpu/drm/radeon/radeon_trace.h | 82 +
drivers/gpu/drm/radeon/radeon_trace_points.c | 9 +
drivers/gpu/drm/radeon/radeon_ttm.c | 893 ++
drivers/gpu/drm/radeon/radeon_uvd.c | 875 ++
drivers/gpu/drm/radeon/reg_srcs/cayman | 642 ++
drivers/gpu/drm/radeon/reg_srcs/evergreen | 644 ++
drivers/gpu/drm/radeon/reg_srcs/r100 | 105 +
drivers/gpu/drm/radeon/reg_srcs/r200 | 186 +
drivers/gpu/drm/radeon/reg_srcs/r300 | 714 ++
drivers/gpu/drm/radeon/reg_srcs/r420 | 780 ++
drivers/gpu/drm/radeon/reg_srcs/r600 | 755 ++
drivers/gpu/drm/radeon/reg_srcs/rn50 | 30 +
drivers/gpu/drm/radeon/reg_srcs/rs600 | 780 ++
drivers/gpu/drm/radeon/reg_srcs/rv515 | 496 +
drivers/gpu/drm/radeon/rs100d.h | 40 +
drivers/gpu/drm/radeon/rs400.c | 569 ++
drivers/gpu/drm/radeon/rs400d.h | 160 +
drivers/gpu/drm/radeon/rs600.c | 1080 +++
drivers/gpu/drm/radeon/rs600d.h | 685 ++
drivers/gpu/drm/radeon/rs690.c | 817 ++
drivers/gpu/drm/radeon/rs690d.h | 313 +
drivers/gpu/drm/radeon/rv200d.h | 36 +
drivers/gpu/drm/radeon/rv250d.h | 123 +
drivers/gpu/drm/radeon/rv350d.h | 52 +
drivers/gpu/drm/radeon/rv515.c | 1257 +++
drivers/gpu/drm/radeon/rv515d.h | 638 ++
drivers/gpu/drm/radeon/rv770.c | 2194 +++++
drivers/gpu/drm/radeon/rv770d.h | 717 ++
drivers/gpu/drm/radeon/si.c | 5782 ++++++++++++
drivers/gpu/drm/radeon/si_blit_shaders.c | 253 +
drivers/gpu/drm/radeon/si_blit_shaders.h | 32 +
drivers/gpu/drm/radeon/si_reg.h | 105 +
drivers/gpu/drm/radeon/sid.h | 1115 +++
drivers/gpu/drm/savage/Makefile | 9 +
drivers/gpu/drm/savage/savage_bci.c | 1095 +++
drivers/gpu/drm/savage/savage_drv.c | 93 +
drivers/gpu/drm/savage/savage_drv.h | 575 ++
drivers/gpu/drm/savage/savage_state.c | 1163 +++
drivers/gpu/drm/shmobile/Kconfig | 10 +
drivers/gpu/drm/shmobile/Makefile | 7 +
drivers/gpu/drm/shmobile/shmob_drm_backlight.c | 90 +
drivers/gpu/drm/shmobile/shmob_drm_backlight.h | 23 +
drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 752 ++
drivers/gpu/drm/shmobile/shmob_drm_crtc.h | 60 +
drivers/gpu/drm/shmobile/shmob_drm_drv.c | 359 +
drivers/gpu/drm/shmobile/shmob_drm_drv.h | 47 +
drivers/gpu/drm/shmobile/shmob_drm_kms.c | 160 +
drivers/gpu/drm/shmobile/shmob_drm_kms.h | 34 +
drivers/gpu/drm/shmobile/shmob_drm_plane.c | 268 +
drivers/gpu/drm/shmobile/shmob_drm_plane.h | 22 +
drivers/gpu/drm/shmobile/shmob_drm_regs.h | 311 +
drivers/gpu/drm/sis/Makefile | 10 +
drivers/gpu/drm/sis/sis_drv.c | 145 +
drivers/gpu/drm/sis/sis_drv.h | 76 +
drivers/gpu/drm/sis/sis_mm.c | 360 +
drivers/gpu/drm/tdfx/Makefile | 8 +
drivers/gpu/drm/tdfx/tdfx_drv.c | 89 +
drivers/gpu/drm/tdfx/tdfx_drv.h | 47 +
drivers/gpu/drm/tilcdc/Kconfig | 13 +
drivers/gpu/drm/tilcdc/Makefile | 13 +
drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 602 ++
drivers/gpu/drm/tilcdc/tilcdc_drv.c | 651 ++
drivers/gpu/drm/tilcdc/tilcdc_drv.h | 150 +
drivers/gpu/drm/tilcdc/tilcdc_panel.c | 434 +
drivers/gpu/drm/tilcdc/tilcdc_panel.h | 26 +
drivers/gpu/drm/tilcdc/tilcdc_regs.h | 154 +
drivers/gpu/drm/tilcdc/tilcdc_slave.c | 376 +
drivers/gpu/drm/tilcdc/tilcdc_slave.h | 26 +
drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 419 +
drivers/gpu/drm/tilcdc/tilcdc_tfp410.h | 26 +
drivers/gpu/drm/ttm/Makefile | 14 +
drivers/gpu/drm/ttm/ttm_agp_backend.c | 151 +
drivers/gpu/drm/ttm/ttm_bo.c | 1951 ++++
drivers/gpu/drm/ttm/ttm_bo_manager.c | 157 +
drivers/gpu/drm/ttm/ttm_bo_util.c | 710 ++
drivers/gpu/drm/ttm/ttm_bo_vm.c | 465 +
drivers/gpu/drm/ttm/ttm_execbuf_util.c | 242 +
drivers/gpu/drm/ttm/ttm_lock.c | 310 +
drivers/gpu/drm/ttm/ttm_memory.c | 601 ++
drivers/gpu/drm/ttm/ttm_module.c | 102 +
drivers/gpu/drm/ttm/ttm_object.c | 454 +
drivers/gpu/drm/ttm/ttm_page_alloc.c | 919 ++
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 1134 +++
drivers/gpu/drm/ttm/ttm_tt.c | 377 +
drivers/gpu/drm/udl/Kconfig | 13 +
drivers/gpu/drm/udl/Makefile | 6 +
drivers/gpu/drm/udl/udl_connector.c | 164 +
drivers/gpu/drm/udl/udl_drv.c | 119 +
drivers/gpu/drm/udl/udl_drv.h | 147 +
drivers/gpu/drm/udl/udl_encoder.c | 80 +
drivers/gpu/drm/udl/udl_fb.c | 672 ++
drivers/gpu/drm/udl/udl_gem.c | 330 +
drivers/gpu/drm/udl/udl_main.c | 335 +
drivers/gpu/drm/udl/udl_modeset.c | 443 +
drivers/gpu/drm/udl/udl_transfer.c | 264 +
drivers/gpu/drm/via/Makefile | 8 +
drivers/gpu/drm/via/via_3d_reg.h | 1650 ++++
drivers/gpu/drm/via/via_dma.c | 740 ++
drivers/gpu/drm/via/via_dmablit.c | 808 ++
drivers/gpu/drm/via/via_dmablit.h | 140 +
drivers/gpu/drm/via/via_drv.c | 125 +
drivers/gpu/drm/via/via_drv.h | 160 +
drivers/gpu/drm/via/via_irq.c | 391 +
drivers/gpu/drm/via/via_map.c | 128 +
drivers/gpu/drm/via/via_mm.c | 237 +
drivers/gpu/drm/via/via_verifier.c | 1110 +++
drivers/gpu/drm/via/via_verifier.h | 62 +
drivers/gpu/drm/via/via_video.c | 93 +
drivers/gpu/drm/vmwgfx/Kconfig | 22 +
drivers/gpu/drm/vmwgfx/Makefile | 11 +
drivers/gpu/drm/vmwgfx/svga3d_reg.h | 1896 ++++
drivers/gpu/drm/vmwgfx/svga3d_surfacedefs.h | 909 ++
drivers/gpu/drm/vmwgfx/svga_escape.h | 89 +
drivers/gpu/drm/vmwgfx/svga_overlay.h | 201 +
drivers/gpu/drm/vmwgfx/svga_reg.h | 1552 ++++
drivers/gpu/drm/vmwgfx/svga_types.h | 45 +
drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c | 352 +
drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 274 +
drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c | 320 +
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1215 +++
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 768 ++
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 1795 ++++
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 657 ++
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 1154 +++
drivers/gpu/drm/vmwgfx/vmwgfx_fence.h | 120 +
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 569 ++
drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c | 300 +
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 161 +
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 326 +
drivers/gpu/drm/vmwgfx/vmwgfx_irq.c | 324 +
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2060 +++++
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 166 +
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 444 +
drivers/gpu/drm/vmwgfx/vmwgfx_marker.c | 171 +
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | 619 ++
drivers/gpu/drm/vmwgfx/vmwgfx_reg.h | 57 +
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 1298 +++
drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h | 84 +
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 571 ++
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 893 ++
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c | 98 +
drivers/gpu/host1x/Kconfig | 24 +
drivers/gpu/host1x/Makefile | 20 +
drivers/gpu/host1x/cdma.c | 491 +
drivers/gpu/host1x/cdma.h | 100 +
drivers/gpu/host1x/channel.c | 126 +
drivers/gpu/host1x/channel.h | 52 +
drivers/gpu/host1x/debug.c | 210 +
drivers/gpu/host1x/debug.h | 51 +
drivers/gpu/host1x/dev.c | 246 +
drivers/gpu/host1x/dev.h | 308 +
drivers/gpu/host1x/drm/Kconfig | 29 +
drivers/gpu/host1x/drm/dc.c | 1195 +++
drivers/gpu/host1x/drm/dc.h | 400 +
drivers/gpu/host1x/drm/drm.c | 640 ++
drivers/gpu/host1x/drm/drm.h | 271 +
drivers/gpu/host1x/drm/fb.c | 374 +
drivers/gpu/host1x/drm/gem.c | 270 +
drivers/gpu/host1x/drm/gem.h | 59 +
drivers/gpu/host1x/drm/gr2d.c | 339 +
drivers/gpu/host1x/drm/hdmi.c | 1313 +++
drivers/gpu/host1x/drm/hdmi.h | 386 +
drivers/gpu/host1x/drm/output.c | 272 +
drivers/gpu/host1x/drm/rgb.c | 228 +
drivers/gpu/host1x/host1x.h | 30 +
drivers/gpu/host1x/host1x_bo.h | 87 +
drivers/gpu/host1x/host1x_client.h | 35 +
drivers/gpu/host1x/hw/Makefile | 6 +
drivers/gpu/host1x/hw/cdma_hw.c | 326 +
drivers/gpu/host1x/hw/channel_hw.c | 168 +
drivers/gpu/host1x/hw/debug_hw.c | 322 +
drivers/gpu/host1x/hw/host1x01.c | 42 +
drivers/gpu/host1x/hw/host1x01.h | 25 +
drivers/gpu/host1x/hw/host1x01_hardware.h | 143 +
drivers/gpu/host1x/hw/hw_host1x01_channel.h | 120 +
drivers/gpu/host1x/hw/hw_host1x01_sync.h | 243 +
drivers/gpu/host1x/hw/hw_host1x01_uclass.h | 174 +
drivers/gpu/host1x/hw/intr_hw.c | 143 +
drivers/gpu/host1x/hw/syncpt_hw.c | 114 +
drivers/gpu/host1x/intr.c | 354 +
drivers/gpu/host1x/intr.h | 102 +
drivers/gpu/host1x/job.c | 603 ++
drivers/gpu/host1x/job.h | 162 +
drivers/gpu/host1x/syncpt.c | 387 +
drivers/gpu/host1x/syncpt.h | 165 +
drivers/gpu/ion/Makefile | 7 +
drivers/gpu/ion/compat_ion.c | 199 +
drivers/gpu/ion/compat_ion.h | 30 +
drivers/gpu/ion/ion.c | 1786 ++++
drivers/gpu/ion/ion_carveout_heap.c | 240 +
drivers/gpu/ion/ion_chunk_heap.c | 229 +
drivers/gpu/ion/ion_cma_heap.c | 206 +
drivers/gpu/ion/ion_heap.c | 355 +
drivers/gpu/ion/ion_page_pool.c | 207 +
drivers/gpu/ion/ion_priv.h | 404 +
drivers/gpu/ion/ion_system_heap.c | 697 ++
drivers/gpu/ion/ion_system_mapper.c | 114 +
drivers/gpu/ion/sprd/Makefile | 5 +
drivers/gpu/ion/sprd/compat_sprd_ion.c | 336 +
drivers/gpu/ion/sprd/compat_sprd_ion.h | 30 +
drivers/gpu/ion/sprd/sprd_fence.c | 469 +
drivers/gpu/ion/sprd/sprd_fence.h | 52 +
drivers/gpu/ion/sprd/sprd_ion.c | 1093 +++
drivers/gpu/ion/sprd/sprd_ion_cma_heap.c | 279 +
drivers/gpu/ion/tegra/Makefile | 1 +
drivers/gpu/ion/tegra/tegra_ion.c | 96 +
drivers/gpu/sprd_iommu/Kconfig | 5 +
drivers/gpu/sprd_iommu/Makefile | 2 +
drivers/gpu/sprd_iommu/gsp/Makefile | 1 +
drivers/gpu/sprd_iommu/gsp/sprd_iommu_gsp.c | 229 +
drivers/gpu/sprd_iommu/mm/Makefile | 1 +
drivers/gpu/sprd_iommu/mm/sprd_iommu_mm.c | 268 +
drivers/gpu/sprd_iommu/sprd_iommu_common.c | 349 +
drivers/gpu/sprd_iommu/sprd_iommu_common.h | 144 +
drivers/gpu/sprd_iommu/sprd_iommu_drv.c | 432 +
drivers/gpu/sprd_iommu/sprd_iommu_sysfs.c | 157 +
drivers/gpu/sprd_iommu/sprd_iommu_sysfs.h | 12 +
drivers/gpu/sprd_iommu/v2/Makefile | 6 +
drivers/gpu/sprd_iommu/v2/sprd_iommu_dcam.c | 192 +
drivers/gpu/sprd_iommu/v2/sprd_iommu_dispc.c | 229 +
drivers/gpu/sprd_iommu/v2/sprd_iommu_gsp0.c | 229 +
drivers/gpu/sprd_iommu/v2/sprd_iommu_gsp1.c | 229 +
drivers/gpu/sprd_iommu/v2/sprd_iommu_vpp.c | 192 +
drivers/gpu/sprd_iommu/v2/sprd_iommu_vsp.c | 192 +
drivers/gpu/vga/Kconfig | 30 +
drivers/gpu/vga/Makefile | 2 +
drivers/gpu/vga/vga_switcheroo.c | 567 ++
drivers/gpu/vga/vgaarb.c | 1333 +++
1019 files changed, 483939 insertions(+)
create mode 100644 drivers/gpu/Makefile
create mode 100644 drivers/gpu/drm/Kconfig
create mode 100644 drivers/gpu/drm/Makefile
create mode 100644 drivers/gpu/drm/README.drm
create mode 100644 drivers/gpu/drm/ast/Kconfig
create mode 100644 drivers/gpu/drm/ast/Makefile
create mode 100644 drivers/gpu/drm/ast/ast_dram_tables.h
create mode 100644 drivers/gpu/drm/ast/ast_drv.c
create mode 100644 drivers/gpu/drm/ast/ast_drv.h
create mode 100644 drivers/gpu/drm/ast/ast_fb.c
create mode 100644 drivers/gpu/drm/ast/ast_main.c
create mode 100644 drivers/gpu/drm/ast/ast_mode.c
create mode 100644 drivers/gpu/drm/ast/ast_post.c
create mode 100644 drivers/gpu/drm/ast/ast_tables.h
create mode 100644 drivers/gpu/drm/ast/ast_ttm.c
create mode 100644 drivers/gpu/drm/ati_pcigart.c
create mode 100644 drivers/gpu/drm/cirrus/Kconfig
create mode 100644 drivers/gpu/drm/cirrus/Makefile
create mode 100644 drivers/gpu/drm/cirrus/cirrus_drv.c
create mode 100644 drivers/gpu/drm/cirrus/cirrus_drv.h
create mode 100644 drivers/gpu/drm/cirrus/cirrus_fbdev.c
create mode 100644 drivers/gpu/drm/cirrus/cirrus_main.c
create mode 100644 drivers/gpu/drm/cirrus/cirrus_mode.c
create mode 100644 drivers/gpu/drm/cirrus/cirrus_ttm.c
create mode 100644 drivers/gpu/drm/drm_agpsupport.c
create mode 100644 drivers/gpu/drm/drm_auth.c
create mode 100644 drivers/gpu/drm/drm_buffer.c
create mode 100644 drivers/gpu/drm/drm_bufs.c
create mode 100644 drivers/gpu/drm/drm_cache.c
create mode 100644 drivers/gpu/drm/drm_context.c
create mode 100644 drivers/gpu/drm/drm_crtc.c
create mode 100644 drivers/gpu/drm/drm_crtc_helper.c
create mode 100644 drivers/gpu/drm/drm_debugfs.c
create mode 100644 drivers/gpu/drm/drm_dma.c
create mode 100644 drivers/gpu/drm/drm_dp_helper.c
create mode 100644 drivers/gpu/drm/drm_drv.c
create mode 100644 drivers/gpu/drm/drm_edid.c
create mode 100644 drivers/gpu/drm/drm_edid_load.c
create mode 100644 drivers/gpu/drm/drm_encoder_slave.c
create mode 100644 drivers/gpu/drm/drm_fb_cma_helper.c
create mode 100644 drivers/gpu/drm/drm_fb_helper.c
create mode 100644 drivers/gpu/drm/drm_fops.c
create mode 100644 drivers/gpu/drm/drm_gem.c
create mode 100644 drivers/gpu/drm/drm_gem_cma_helper.c
create mode 100644 drivers/gpu/drm/drm_global.c
create mode 100644 drivers/gpu/drm/drm_hashtab.c
create mode 100644 drivers/gpu/drm/drm_info.c
create mode 100644 drivers/gpu/drm/drm_ioc32.c
create mode 100644 drivers/gpu/drm/drm_ioctl.c
create mode 100644 drivers/gpu/drm/drm_irq.c
create mode 100644 drivers/gpu/drm/drm_lock.c
create mode 100644 drivers/gpu/drm/drm_memory.c
create mode 100644 drivers/gpu/drm/drm_mm.c
create mode 100644 drivers/gpu/drm/drm_modes.c
create mode 100644 drivers/gpu/drm/drm_pci.c
create mode 100644 drivers/gpu/drm/drm_platform.c
create mode 100644 drivers/gpu/drm/drm_prime.c
create mode 100644 drivers/gpu/drm/drm_proc.c
create mode 100644 drivers/gpu/drm/drm_scatter.c
create mode 100644 drivers/gpu/drm/drm_stub.c
create mode 100644 drivers/gpu/drm/drm_sysfs.c
create mode 100644 drivers/gpu/drm/drm_trace.h
create mode 100644 drivers/gpu/drm/drm_trace_points.c
create mode 100644 drivers/gpu/drm/drm_usb.c
create mode 100644 drivers/gpu/drm/drm_vm.c
create mode 100644 drivers/gpu/drm/exynos/Kconfig
create mode 100644 drivers/gpu/drm/exynos/Makefile
create mode 100644 drivers/gpu/drm/exynos/exynos_ddc.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_buf.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_buf.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_connector.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_connector.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_core.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_crtc.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_crtc.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_dmabuf.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_drv.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_drv.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fb.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fb.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fbdev.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fbdev.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimc.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_fimd.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_g2d.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_g2d.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_gem.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_gem.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_gsc.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_gsc.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_hdmi.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_iommu.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_iommu.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_ipp.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_plane.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_plane.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_rotator.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_rotator.h
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_vidi.c
create mode 100644 drivers/gpu/drm/exynos/exynos_drm_vidi.h
create mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.c
create mode 100644 drivers/gpu/drm/exynos/exynos_hdmi.h
create mode 100644 drivers/gpu/drm/exynos/exynos_hdmiphy.c
create mode 100644 drivers/gpu/drm/exynos/exynos_mixer.c
create mode 100644 drivers/gpu/drm/exynos/regs-fimc.h
create mode 100644 drivers/gpu/drm/exynos/regs-gsc.h
create mode 100644 drivers/gpu/drm/exynos/regs-hdmi.h
create mode 100644 drivers/gpu/drm/exynos/regs-mixer.h
create mode 100644 drivers/gpu/drm/exynos/regs-rotator.h
create mode 100644 drivers/gpu/drm/exynos/regs-vp.h
create mode 100644 drivers/gpu/drm/gma500/Kconfig
create mode 100644 drivers/gpu/drm/gma500/Makefile
create mode 100644 drivers/gpu/drm/gma500/accel_2d.c
create mode 100644 drivers/gpu/drm/gma500/backlight.c
create mode 100644 drivers/gpu/drm/gma500/cdv_device.c
create mode 100644 drivers/gpu/drm/gma500/cdv_device.h
create mode 100644 drivers/gpu/drm/gma500/cdv_intel_crt.c
create mode 100644 drivers/gpu/drm/gma500/cdv_intel_display.c
create mode 100644 drivers/gpu/drm/gma500/cdv_intel_dp.c
create mode 100644 drivers/gpu/drm/gma500/cdv_intel_hdmi.c
create mode 100644 drivers/gpu/drm/gma500/cdv_intel_lvds.c
create mode 100644 drivers/gpu/drm/gma500/framebuffer.c
create mode 100644 drivers/gpu/drm/gma500/framebuffer.h
create mode 100644 drivers/gpu/drm/gma500/gem.c
create mode 100644 drivers/gpu/drm/gma500/gtt.c
create mode 100644 drivers/gpu/drm/gma500/gtt.h
create mode 100644 drivers/gpu/drm/gma500/intel_bios.c
create mode 100644 drivers/gpu/drm/gma500/intel_bios.h
create mode 100644 drivers/gpu/drm/gma500/intel_gmbus.c
create mode 100644 drivers/gpu/drm/gma500/intel_i2c.c
create mode 100644 drivers/gpu/drm/gma500/mdfld_device.c
create mode 100644 drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
create mode 100644 drivers/gpu/drm/gma500/mdfld_dsi_dpi.h
create mode 100644 drivers/gpu/drm/gma500/mdfld_dsi_output.c
create mode 100644 drivers/gpu/drm/gma500/mdfld_dsi_output.h
create mode 100644 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
create mode 100644 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.h
create mode 100644 drivers/gpu/drm/gma500/mdfld_intel_display.c
create mode 100644 drivers/gpu/drm/gma500/mdfld_output.c
create mode 100644 drivers/gpu/drm/gma500/mdfld_output.h
create mode 100644 drivers/gpu/drm/gma500/mdfld_tmd_vid.c
create mode 100644 drivers/gpu/drm/gma500/mdfld_tpo_vid.c
create mode 100644 drivers/gpu/drm/gma500/mid_bios.c
create mode 100644 drivers/gpu/drm/gma500/mid_bios.h
create mode 100644 drivers/gpu/drm/gma500/mmu.c
create mode 100644 drivers/gpu/drm/gma500/oaktrail.h
create mode 100644 drivers/gpu/drm/gma500/oaktrail_crtc.c
create mode 100644 drivers/gpu/drm/gma500/oaktrail_device.c
create mode 100644 drivers/gpu/drm/gma500/oaktrail_hdmi.c
create mode 100644 drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c
create mode 100644 drivers/gpu/drm/gma500/oaktrail_lvds.c
create mode 100644 drivers/gpu/drm/gma500/opregion.c
create mode 100644 drivers/gpu/drm/gma500/opregion.h
create mode 100644 drivers/gpu/drm/gma500/power.c
create mode 100644 drivers/gpu/drm/gma500/power.h
create mode 100644 drivers/gpu/drm/gma500/psb_device.c
create mode 100644 drivers/gpu/drm/gma500/psb_drv.c
create mode 100644 drivers/gpu/drm/gma500/psb_drv.h
create mode 100644 drivers/gpu/drm/gma500/psb_intel_display.c
create mode 100644 drivers/gpu/drm/gma500/psb_intel_display.h
create mode 100644 drivers/gpu/drm/gma500/psb_intel_drv.h
create mode 100644 drivers/gpu/drm/gma500/psb_intel_lvds.c
create mode 100644 drivers/gpu/drm/gma500/psb_intel_modes.c
create mode 100644 drivers/gpu/drm/gma500/psb_intel_reg.h
create mode 100644 drivers/gpu/drm/gma500/psb_intel_sdvo.c
create mode 100644 drivers/gpu/drm/gma500/psb_intel_sdvo_regs.h
create mode 100644 drivers/gpu/drm/gma500/psb_irq.c
create mode 100644 drivers/gpu/drm/gma500/psb_irq.h
create mode 100644 drivers/gpu/drm/gma500/psb_lid.c
create mode 100644 drivers/gpu/drm/gma500/psb_reg.h
create mode 100644 drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
create mode 100644 drivers/gpu/drm/gma500/tc35876x-dsi-lvds.h
create mode 100644 drivers/gpu/drm/i2c/Kconfig
create mode 100644 drivers/gpu/drm/i2c/Makefile
create mode 100644 drivers/gpu/drm/i2c/ch7006_drv.c
create mode 100644 drivers/gpu/drm/i2c/ch7006_mode.c
create mode 100644 drivers/gpu/drm/i2c/ch7006_priv.h
create mode 100644 drivers/gpu/drm/i2c/sil164_drv.c
create mode 100644 drivers/gpu/drm/i2c/tda998x_drv.c
create mode 100644 drivers/gpu/drm/i810/Makefile
create mode 100644 drivers/gpu/drm/i810/i810_dma.c
create mode 100644 drivers/gpu/drm/i810/i810_drv.c
create mode 100644 drivers/gpu/drm/i810/i810_drv.h
create mode 100644 drivers/gpu/drm/i915/Makefile
create mode 100644 drivers/gpu/drm/i915/dvo.h
create mode 100644 drivers/gpu/drm/i915/dvo_ch7017.c
create mode 100644 drivers/gpu/drm/i915/dvo_ch7xxx.c
create mode 100644 drivers/gpu/drm/i915/dvo_ivch.c
create mode 100644 drivers/gpu/drm/i915/dvo_ns2501.c
create mode 100644 drivers/gpu/drm/i915/dvo_sil164.c
create mode 100644 drivers/gpu/drm/i915/dvo_tfp410.c
create mode 100644 drivers/gpu/drm/i915/i915_debugfs.c
create mode 100644 drivers/gpu/drm/i915/i915_dma.c
create mode 100644 drivers/gpu/drm/i915/i915_drv.c
create mode 100644 drivers/gpu/drm/i915/i915_drv.h
create mode 100644 drivers/gpu/drm/i915/i915_gem.c
create mode 100644 drivers/gpu/drm/i915/i915_gem_context.c
create mode 100644 drivers/gpu/drm/i915/i915_gem_debug.c
create mode 100644 drivers/gpu/drm/i915/i915_gem_dmabuf.c
create mode 100644 drivers/gpu/drm/i915/i915_gem_evict.c
create mode 100644 drivers/gpu/drm/i915/i915_gem_execbuffer.c
create mode 100644 drivers/gpu/drm/i915/i915_gem_gtt.c
create mode 100644 drivers/gpu/drm/i915/i915_gem_stolen.c
create mode 100644 drivers/gpu/drm/i915/i915_gem_tiling.c
create mode 100644 drivers/gpu/drm/i915/i915_ioc32.c
create mode 100644 drivers/gpu/drm/i915/i915_irq.c
create mode 100644 drivers/gpu/drm/i915/i915_reg.h
create mode 100644 drivers/gpu/drm/i915/i915_suspend.c
create mode 100644 drivers/gpu/drm/i915/i915_sysfs.c
create mode 100644 drivers/gpu/drm/i915/i915_trace.h
create mode 100644 drivers/gpu/drm/i915/i915_trace_points.c
create mode 100644 drivers/gpu/drm/i915/i915_ums.c
create mode 100644 drivers/gpu/drm/i915/intel_acpi.c
create mode 100644 drivers/gpu/drm/i915/intel_bios.c
create mode 100644 drivers/gpu/drm/i915/intel_bios.h
create mode 100644 drivers/gpu/drm/i915/intel_crt.c
create mode 100644 drivers/gpu/drm/i915/intel_ddi.c
create mode 100644 drivers/gpu/drm/i915/intel_display.c
create mode 100644 drivers/gpu/drm/i915/intel_dp.c
create mode 100644 drivers/gpu/drm/i915/intel_drv.h
create mode 100644 drivers/gpu/drm/i915/intel_dvo.c
create mode 100644 drivers/gpu/drm/i915/intel_fb.c
create mode 100644 drivers/gpu/drm/i915/intel_hdmi.c
create mode 100644 drivers/gpu/drm/i915/intel_i2c.c
create mode 100644 drivers/gpu/drm/i915/intel_lvds.c
create mode 100644 drivers/gpu/drm/i915/intel_modes.c
create mode 100644 drivers/gpu/drm/i915/intel_opregion.c
create mode 100644 drivers/gpu/drm/i915/intel_overlay.c
create mode 100644 drivers/gpu/drm/i915/intel_panel.c
create mode 100644 drivers/gpu/drm/i915/intel_pm.c
create mode 100644 drivers/gpu/drm/i915/intel_ringbuffer.c
create mode 100644 drivers/gpu/drm/i915/intel_ringbuffer.h
create mode 100644 drivers/gpu/drm/i915/intel_sdvo.c
create mode 100644 drivers/gpu/drm/i915/intel_sdvo_regs.h
create mode 100644 drivers/gpu/drm/i915/intel_sprite.c
create mode 100644 drivers/gpu/drm/i915/intel_tv.c
create mode 100644 drivers/gpu/drm/mga/Makefile
create mode 100644 drivers/gpu/drm/mga/mga_dma.c
create mode 100644 drivers/gpu/drm/mga/mga_drv.c
create mode 100644 drivers/gpu/drm/mga/mga_drv.h
create mode 100644 drivers/gpu/drm/mga/mga_ioc32.c
create mode 100644 drivers/gpu/drm/mga/mga_irq.c
create mode 100644 drivers/gpu/drm/mga/mga_state.c
create mode 100644 drivers/gpu/drm/mga/mga_warp.c
create mode 100644 drivers/gpu/drm/mgag200/Kconfig
create mode 100644 drivers/gpu/drm/mgag200/Makefile
create mode 100644 drivers/gpu/drm/mgag200/mgag200_drv.c
create mode 100644 drivers/gpu/drm/mgag200/mgag200_drv.h
create mode 100644 drivers/gpu/drm/mgag200/mgag200_fb.c
create mode 100644 drivers/gpu/drm/mgag200/mgag200_i2c.c
create mode 100644 drivers/gpu/drm/mgag200/mgag200_main.c
create mode 100644 drivers/gpu/drm/mgag200/mgag200_mode.c
create mode 100644 drivers/gpu/drm/mgag200/mgag200_reg.h
create mode 100644 drivers/gpu/drm/mgag200/mgag200_ttm.c
create mode 100644 drivers/gpu/drm/nouveau/Kconfig
create mode 100644 drivers/gpu/drm/nouveau/Makefile
create mode 100644 drivers/gpu/drm/nouveau/core/core/client.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/engctx.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/engine.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/enum.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/event.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/falcon.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/gpuobj.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/handle.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/mm.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/namedb.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/object.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/option.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/parent.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/printk.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/ramht.c
create mode 100644 drivers/gpu/drm/nouveau/core/core/subdev.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/bsp/nv84.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/bsp/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/bsp/nve0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/copy/fuc/nva3.fuc
create mode 100644 drivers/gpu/drm/nouveau/core/engine/copy/fuc/nva3.fuc.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/copy/fuc/nvc0.fuc.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/copy/nva3.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/copy/nve0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/crypt/fuc/nv98.fuc
create mode 100644 drivers/gpu/drm/nouveau/core/engine/crypt/fuc/nv98.fuc.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/device/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/device/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/device/nv10.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/device/nv20.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/device/nv30.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/device/nv40.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/device/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/device/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/device/nve0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/dacnv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/dport.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/dport.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/hdminv84.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/hdminva3.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/hdminvd0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/nv50.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/nv84.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/nv94.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/nva0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/nva3.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/nve0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/nvf0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/piornv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/sornv94.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/sornvd0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/disp/vga.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/dmaobj/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/dmaobj/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/dmaobj/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/dmaobj/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/dmaobj/nvd0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/nv04.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/nv10.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/nv17.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/nv40.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/nv50.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/ctx.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/ctxnv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/ctxnve0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnvc0.fuc.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/fuc/nvc0.fuc
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/fuc/nve0.fuc
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv10.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv20.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv20.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv25.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv2a.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv30.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv34.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv35.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv40.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv40.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nv50.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/regs.h
create mode 100644 drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/mpeg/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/mpeg/nv84.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/ppp/nv98.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/ppp/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/software/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/software/nv10.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/software/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/software/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/vp/nv84.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/vp/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/engine/vp/nve0.c
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/class.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/client.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/debug.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/device.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/engctx.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/engine.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/enum.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/event.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/falcon.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/gpuobj.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/handle.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/math.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/mm.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/namedb.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/object.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/option.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/parent.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/printk.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/ramht.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/core/subdev.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/bsp.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/copy.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/crypt.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/device.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/disp.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/dmaobj.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/fifo.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/graph.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/mpeg.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/ppp.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/software.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/engine/vp.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bar.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/bit.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/bmp.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/conn.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/dcb.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/disp.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/dp.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/extdev.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/i2c.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/mxm.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/perf.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bios/xpio.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/bus.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/clock.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/devinit.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/fb.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/i2c.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/ibus.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/instmem.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/ltcg.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/mc.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/mxm.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/therm.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/timer.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/vga.h
create mode 100644 drivers/gpu/drm/nouveau/core/include/subdev/vm.h
create mode 100644 drivers/gpu/drm/nouveau/core/os.h
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bar/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/bit.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/conn.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/disp.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/dp.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/extdev.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/init.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/mxm.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/perf.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/pll.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/therm.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bios/xpio.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bus/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bus/nv31.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bus/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/bus/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/clock/nv40.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/clock/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/clock/pll.h
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/clock/pllnv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/clock/pllnva3.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/devinit/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/devinit/fbmem.h
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/devinit/nv1a.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/devinit/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/gpio/nv10.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/gpio/nve0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/i2c/anx9805.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/i2c/aux.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/i2c/bit.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/i2c/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/i2c/nv4e.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/i2c/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/i2c/nv50.h
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/i2c/nv94.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/i2c/nvd0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/ibus/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/instmem/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/instmem/nv04.h
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/instmem/nv40.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/ltcg/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/mc/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/mc/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/mc/nv44.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/mc/nv98.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/mc/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/mxm/mxms.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/mxm/mxms.h
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/mxm/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/fannil.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/fanpwm.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/fantog.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/ic.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/priv.h
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/therm/temp.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/timer/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/timer/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/vm/base.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/vm/nv04.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/vm/nv04.h
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/vm/nv50.c
create mode 100644 drivers/gpu/drm/nouveau/core/subdev/vm/nvc0.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/Makefile
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/arb.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/crtc.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/cursor.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/dac.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/dfp.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/disp.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/disp.h
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/hw.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/hw.h
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/nvreg.h
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/tvmodesnv17.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/tvnv04.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
create mode 100644 drivers/gpu/drm/nouveau/dispnv04/tvnv17.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_abi16.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_abi16.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_acpi.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_acpi.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_agp.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_agp.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_backlight.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_bios.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_bios.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_bo.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_bo.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_chan.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_chan.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_connector.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_connector.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_crtc.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_debugfs.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_debugfs.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_display.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_display.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_dma.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_dma.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_dp.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_drm.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_drm.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_encoder.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_fbcon.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_fbcon.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_fence.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_fence.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_gem.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_gem.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_hwsq.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_ioc32.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_ioctl.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_mem.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_perf.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_pm.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_pm.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_prime.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_reg.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_sgdma.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_ttm.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_ttm.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_vga.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_vga.h
create mode 100644 drivers/gpu/drm/nouveau/nouveau_volt.c
create mode 100644 drivers/gpu/drm/nouveau/nv04_fbcon.c
create mode 100644 drivers/gpu/drm/nouveau/nv04_fence.c
create mode 100644 drivers/gpu/drm/nouveau/nv04_pm.c
create mode 100644 drivers/gpu/drm/nouveau/nv10_fence.c
create mode 100644 drivers/gpu/drm/nouveau/nv10_fence.h
create mode 100644 drivers/gpu/drm/nouveau/nv17_fence.c
create mode 100644 drivers/gpu/drm/nouveau/nv40_pm.c
create mode 100644 drivers/gpu/drm/nouveau/nv50_display.c
create mode 100644 drivers/gpu/drm/nouveau/nv50_display.h
create mode 100644 drivers/gpu/drm/nouveau/nv50_fbcon.c
create mode 100644 drivers/gpu/drm/nouveau/nv50_fence.c
create mode 100644 drivers/gpu/drm/nouveau/nv50_pm.c
create mode 100644 drivers/gpu/drm/nouveau/nv84_fence.c
create mode 100644 drivers/gpu/drm/nouveau/nva3_pm.c
create mode 100644 drivers/gpu/drm/nouveau/nvc0_fbcon.c
create mode 100644 drivers/gpu/drm/nouveau/nvc0_fence.c
create mode 100644 drivers/gpu/drm/nouveau/nvc0_pm.c
create mode 100644 drivers/gpu/drm/omapdrm/Kconfig
create mode 100644 drivers/gpu/drm/omapdrm/Makefile
create mode 100644 drivers/gpu/drm/omapdrm/TODO
create mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_crtc.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_debugfs.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_dmm_priv.h
create mode 100644 drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_dmm_tiler.h
create mode 100644 drivers/gpu/drm/omapdrm/omap_drv.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_drv.h
create mode 100644 drivers/gpu/drm/omapdrm/omap_encoder.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_fb.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_fbdev.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_gem.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_gem_helpers.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_irq.c
create mode 100644 drivers/gpu/drm/omapdrm/omap_plane.c
create mode 100644 drivers/gpu/drm/omapdrm/tcm-sita.c
create mode 100644 drivers/gpu/drm/omapdrm/tcm-sita.h
create mode 100644 drivers/gpu/drm/omapdrm/tcm.h
create mode 100644 drivers/gpu/drm/qxl/Kconfig
create mode 100644 drivers/gpu/drm/qxl/Makefile
create mode 100644 drivers/gpu/drm/qxl/qxl_cmd.c
create mode 100644 drivers/gpu/drm/qxl/qxl_debugfs.c
create mode 100644 drivers/gpu/drm/qxl/qxl_dev.h
create mode 100644 drivers/gpu/drm/qxl/qxl_display.c
create mode 100644 drivers/gpu/drm/qxl/qxl_draw.c
create mode 100644 drivers/gpu/drm/qxl/qxl_drv.c
create mode 100644 drivers/gpu/drm/qxl/qxl_drv.h
create mode 100644 drivers/gpu/drm/qxl/qxl_dumb.c
create mode 100644 drivers/gpu/drm/qxl/qxl_fb.c
create mode 100644 drivers/gpu/drm/qxl/qxl_fence.c
create mode 100644 drivers/gpu/drm/qxl/qxl_gem.c
create mode 100644 drivers/gpu/drm/qxl/qxl_image.c
create mode 100644 drivers/gpu/drm/qxl/qxl_ioctl.c
create mode 100644 drivers/gpu/drm/qxl/qxl_irq.c
create mode 100644 drivers/gpu/drm/qxl/qxl_kms.c
create mode 100644 drivers/gpu/drm/qxl/qxl_object.c
create mode 100644 drivers/gpu/drm/qxl/qxl_object.h
create mode 100644 drivers/gpu/drm/qxl/qxl_release.c
create mode 100644 drivers/gpu/drm/qxl/qxl_ttm.c
create mode 100644 drivers/gpu/drm/r128/Makefile
create mode 100644 drivers/gpu/drm/r128/r128_cce.c
create mode 100644 drivers/gpu/drm/r128/r128_drv.c
create mode 100644 drivers/gpu/drm/r128/r128_drv.h
create mode 100644 drivers/gpu/drm/r128/r128_ioc32.c
create mode 100644 drivers/gpu/drm/r128/r128_irq.c
create mode 100644 drivers/gpu/drm/r128/r128_state.c
create mode 100644 drivers/gpu/drm/radeon/.gitignore
create mode 100644 drivers/gpu/drm/radeon/Kconfig
create mode 100644 drivers/gpu/drm/radeon/Makefile
create mode 100644 drivers/gpu/drm/radeon/ObjectID.h
create mode 100644 drivers/gpu/drm/radeon/atom-bits.h
create mode 100644 drivers/gpu/drm/radeon/atom-names.h
create mode 100644 drivers/gpu/drm/radeon/atom-types.h
create mode 100644 drivers/gpu/drm/radeon/atom.c
create mode 100644 drivers/gpu/drm/radeon/atom.h
create mode 100644 drivers/gpu/drm/radeon/atombios.h
create mode 100644 drivers/gpu/drm/radeon/atombios_crtc.c
create mode 100644 drivers/gpu/drm/radeon/atombios_dp.c
create mode 100644 drivers/gpu/drm/radeon/atombios_encoders.c
create mode 100644 drivers/gpu/drm/radeon/atombios_i2c.c
create mode 100644 drivers/gpu/drm/radeon/avivod.h
create mode 100644 drivers/gpu/drm/radeon/cayman_blit_shaders.c
create mode 100644 drivers/gpu/drm/radeon/cayman_blit_shaders.h
create mode 100644 drivers/gpu/drm/radeon/evergreen.c
create mode 100644 drivers/gpu/drm/radeon/evergreen_blit_kms.c
create mode 100644 drivers/gpu/drm/radeon/evergreen_blit_shaders.c
create mode 100644 drivers/gpu/drm/radeon/evergreen_blit_shaders.h
create mode 100644 drivers/gpu/drm/radeon/evergreen_cs.c
create mode 100644 drivers/gpu/drm/radeon/evergreen_hdmi.c
create mode 100644 drivers/gpu/drm/radeon/evergreen_reg.h
create mode 100644 drivers/gpu/drm/radeon/evergreend.h
create mode 100644 drivers/gpu/drm/radeon/mkregtable.c
create mode 100644 drivers/gpu/drm/radeon/ni.c
create mode 100644 drivers/gpu/drm/radeon/ni_reg.h
create mode 100644 drivers/gpu/drm/radeon/nid.h
create mode 100644 drivers/gpu/drm/radeon/r100.c
create mode 100644 drivers/gpu/drm/radeon/r100_track.h
create mode 100644 drivers/gpu/drm/radeon/r100d.h
create mode 100644 drivers/gpu/drm/radeon/r200.c
create mode 100644 drivers/gpu/drm/radeon/r300.c
create mode 100644 drivers/gpu/drm/radeon/r300_cmdbuf.c
create mode 100644 drivers/gpu/drm/radeon/r300_reg.h
create mode 100644 drivers/gpu/drm/radeon/r300d.h
create mode 100644 drivers/gpu/drm/radeon/r420.c
create mode 100644 drivers/gpu/drm/radeon/r420d.h
create mode 100644 drivers/gpu/drm/radeon/r500_reg.h
create mode 100644 drivers/gpu/drm/radeon/r520.c
create mode 100644 drivers/gpu/drm/radeon/r520d.h
create mode 100644 drivers/gpu/drm/radeon/r600.c
create mode 100644 drivers/gpu/drm/radeon/r600_audio.c
create mode 100644 drivers/gpu/drm/radeon/r600_blit.c
create mode 100644 drivers/gpu/drm/radeon/r600_blit_kms.c
create mode 100644 drivers/gpu/drm/radeon/r600_blit_shaders.c
create mode 100644 drivers/gpu/drm/radeon/r600_blit_shaders.h
create mode 100644 drivers/gpu/drm/radeon/r600_cp.c
create mode 100644 drivers/gpu/drm/radeon/r600_cs.c
create mode 100644 drivers/gpu/drm/radeon/r600_hdmi.c
create mode 100644 drivers/gpu/drm/radeon/r600_reg.h
create mode 100644 drivers/gpu/drm/radeon/r600d.h
create mode 100644 drivers/gpu/drm/radeon/radeon.h
create mode 100644 drivers/gpu/drm/radeon/radeon_acpi.c
create mode 100644 drivers/gpu/drm/radeon/radeon_acpi.h
create mode 100644 drivers/gpu/drm/radeon/radeon_agp.c
create mode 100644 drivers/gpu/drm/radeon/radeon_asic.c
create mode 100644 drivers/gpu/drm/radeon/radeon_asic.h
create mode 100644 drivers/gpu/drm/radeon/radeon_atombios.c
create mode 100644 drivers/gpu/drm/radeon/radeon_atpx_handler.c
create mode 100644 drivers/gpu/drm/radeon/radeon_benchmark.c
create mode 100644 drivers/gpu/drm/radeon/radeon_bios.c
create mode 100644 drivers/gpu/drm/radeon/radeon_blit_common.h
create mode 100644 drivers/gpu/drm/radeon/radeon_clocks.c
create mode 100644 drivers/gpu/drm/radeon/radeon_combios.c
create mode 100644 drivers/gpu/drm/radeon/radeon_connectors.c
create mode 100644 drivers/gpu/drm/radeon/radeon_cp.c
create mode 100644 drivers/gpu/drm/radeon/radeon_cs.c
create mode 100644 drivers/gpu/drm/radeon/radeon_cursor.c
create mode 100644 drivers/gpu/drm/radeon/radeon_device.c
create mode 100644 drivers/gpu/drm/radeon/radeon_display.c
create mode 100644 drivers/gpu/drm/radeon/radeon_drv.c
create mode 100644 drivers/gpu/drm/radeon/radeon_drv.h
create mode 100644 drivers/gpu/drm/radeon/radeon_encoders.c
create mode 100644 drivers/gpu/drm/radeon/radeon_family.h
create mode 100644 drivers/gpu/drm/radeon/radeon_fb.c
create mode 100644 drivers/gpu/drm/radeon/radeon_fence.c
create mode 100644 drivers/gpu/drm/radeon/radeon_gart.c
create mode 100644 drivers/gpu/drm/radeon/radeon_gem.c
create mode 100644 drivers/gpu/drm/radeon/radeon_i2c.c
create mode 100644 drivers/gpu/drm/radeon/radeon_ioc32.c
create mode 100644 drivers/gpu/drm/radeon/radeon_irq.c
create mode 100644 drivers/gpu/drm/radeon/radeon_irq_kms.c
create mode 100644 drivers/gpu/drm/radeon/radeon_kms.c
create mode 100644 drivers/gpu/drm/radeon/radeon_legacy_crtc.c
create mode 100644 drivers/gpu/drm/radeon/radeon_legacy_encoders.c
create mode 100644 drivers/gpu/drm/radeon/radeon_legacy_tv.c
create mode 100644 drivers/gpu/drm/radeon/radeon_mem.c
create mode 100644 drivers/gpu/drm/radeon/radeon_mode.h
create mode 100644 drivers/gpu/drm/radeon/radeon_object.c
create mode 100644 drivers/gpu/drm/radeon/radeon_object.h
create mode 100644 drivers/gpu/drm/radeon/radeon_pm.c
create mode 100644 drivers/gpu/drm/radeon/radeon_prime.c
create mode 100644 drivers/gpu/drm/radeon/radeon_reg.h
create mode 100644 drivers/gpu/drm/radeon/radeon_ring.c
create mode 100644 drivers/gpu/drm/radeon/radeon_sa.c
create mode 100644 drivers/gpu/drm/radeon/radeon_semaphore.c
create mode 100644 drivers/gpu/drm/radeon/radeon_state.c
create mode 100644 drivers/gpu/drm/radeon/radeon_test.c
create mode 100644 drivers/gpu/drm/radeon/radeon_trace.h
create mode 100644 drivers/gpu/drm/radeon/radeon_trace_points.c
create mode 100644 drivers/gpu/drm/radeon/radeon_ttm.c
create mode 100644 drivers/gpu/drm/radeon/radeon_uvd.c
create mode 100644 drivers/gpu/drm/radeon/reg_srcs/cayman
create mode 100644 drivers/gpu/drm/radeon/reg_srcs/evergreen
create mode 100644 drivers/gpu/drm/radeon/reg_srcs/r100
create mode 100644 drivers/gpu/drm/radeon/reg_srcs/r200
create mode 100644 drivers/gpu/drm/radeon/reg_srcs/r300
create mode 100644 drivers/gpu/drm/radeon/reg_srcs/r420
create mode 100644 drivers/gpu/drm/radeon/reg_srcs/r600
create mode 100644 drivers/gpu/drm/radeon/reg_srcs/rn50
create mode 100644 drivers/gpu/drm/radeon/reg_srcs/rs600
create mode 100644 drivers/gpu/drm/radeon/reg_srcs/rv515
create mode 100644 drivers/gpu/drm/radeon/rs100d.h
create mode 100644 drivers/gpu/drm/radeon/rs400.c
create mode 100644 drivers/gpu/drm/radeon/rs400d.h
create mode 100644 drivers/gpu/drm/radeon/rs600.c
create mode 100644 drivers/gpu/drm/radeon/rs600d.h
create mode 100644 drivers/gpu/drm/radeon/rs690.c
create mode 100644 drivers/gpu/drm/radeon/rs690d.h
create mode 100644 drivers/gpu/drm/radeon/rv200d.h
create mode 100644 drivers/gpu/drm/radeon/rv250d.h
create mode 100644 drivers/gpu/drm/radeon/rv350d.h
create mode 100644 drivers/gpu/drm/radeon/rv515.c
create mode 100644 drivers/gpu/drm/radeon/rv515d.h
create mode 100644 drivers/gpu/drm/radeon/rv770.c
create mode 100644 drivers/gpu/drm/radeon/rv770d.h
create mode 100644 drivers/gpu/drm/radeon/si.c
create mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c
create mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h
create mode 100644 drivers/gpu/drm/radeon/si_reg.h
create mode 100644 drivers/gpu/drm/radeon/sid.h
create mode 100644 drivers/gpu/drm/savage/Makefile
create mode 100644 drivers/gpu/drm/savage/savage_bci.c
create mode 100644 drivers/gpu/drm/savage/savage_drv.c
create mode 100644 drivers/gpu/drm/savage/savage_drv.h
create mode 100644 drivers/gpu/drm/savage/savage_state.c
create mode 100644 drivers/gpu/drm/shmobile/Kconfig
create mode 100644 drivers/gpu/drm/shmobile/Makefile
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_backlight.c
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_backlight.h
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_crtc.c
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_crtc.h
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_drv.c
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_drv.h
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_kms.c
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_kms.h
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_plane.c
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_plane.h
create mode 100644 drivers/gpu/drm/shmobile/shmob_drm_regs.h
create mode 100644 drivers/gpu/drm/sis/Makefile
create mode 100644 drivers/gpu/drm/sis/sis_drv.c
create mode 100644 drivers/gpu/drm/sis/sis_drv.h
create mode 100644 drivers/gpu/drm/sis/sis_mm.c
create mode 100644 drivers/gpu/drm/tdfx/Makefile
create mode 100644 drivers/gpu/drm/tdfx/tdfx_drv.c
create mode 100644 drivers/gpu/drm/tdfx/tdfx_drv.h
create mode 100644 drivers/gpu/drm/tilcdc/Kconfig
create mode 100644 drivers/gpu/drm/tilcdc/Makefile
create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_crtc.c
create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_drv.c
create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_drv.h
create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_panel.c
create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_panel.h
create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_regs.h
create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_slave.c
create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_slave.h
create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
create mode 100644 drivers/gpu/drm/tilcdc/tilcdc_tfp410.h
create mode 100644 drivers/gpu/drm/ttm/Makefile
create mode 100644 drivers/gpu/drm/ttm/ttm_agp_backend.c
create mode 100644 drivers/gpu/drm/ttm/ttm_bo.c
create mode 100644 drivers/gpu/drm/ttm/ttm_bo_manager.c
create mode 100644 drivers/gpu/drm/ttm/ttm_bo_util.c
create mode 100644 drivers/gpu/drm/ttm/ttm_bo_vm.c
create mode 100644 drivers/gpu/drm/ttm/ttm_execbuf_util.c
create mode 100644 drivers/gpu/drm/ttm/ttm_lock.c
create mode 100644 drivers/gpu/drm/ttm/ttm_memory.c
create mode 100644 drivers/gpu/drm/ttm/ttm_module.c
create mode 100644 drivers/gpu/drm/ttm/ttm_object.c
create mode 100644 drivers/gpu/drm/ttm/ttm_page_alloc.c
create mode 100644 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
create mode 100644 drivers/gpu/drm/ttm/ttm_tt.c
create mode 100644 drivers/gpu/drm/udl/Kconfig
create mode 100644 drivers/gpu/drm/udl/Makefile
create mode 100644 drivers/gpu/drm/udl/udl_connector.c
create mode 100644 drivers/gpu/drm/udl/udl_drv.c
create mode 100644 drivers/gpu/drm/udl/udl_drv.h
create mode 100644 drivers/gpu/drm/udl/udl_encoder.c
create mode 100644 drivers/gpu/drm/udl/udl_fb.c
create mode 100644 drivers/gpu/drm/udl/udl_gem.c
create mode 100644 drivers/gpu/drm/udl/udl_main.c
create mode 100644 drivers/gpu/drm/udl/udl_modeset.c
create mode 100644 drivers/gpu/drm/udl/udl_transfer.c
create mode 100644 drivers/gpu/drm/via/Makefile
create mode 100644 drivers/gpu/drm/via/via_3d_reg.h
create mode 100644 drivers/gpu/drm/via/via_dma.c
create mode 100644 drivers/gpu/drm/via/via_dmablit.c
create mode 100644 drivers/gpu/drm/via/via_dmablit.h
create mode 100644 drivers/gpu/drm/via/via_drv.c
create mode 100644 drivers/gpu/drm/via/via_drv.h
create mode 100644 drivers/gpu/drm/via/via_irq.c
create mode 100644 drivers/gpu/drm/via/via_map.c
create mode 100644 drivers/gpu/drm/via/via_mm.c
create mode 100644 drivers/gpu/drm/via/via_verifier.c
create mode 100644 drivers/gpu/drm/via/via_verifier.h
create mode 100644 drivers/gpu/drm/via/via_video.c
create mode 100644 drivers/gpu/drm/vmwgfx/Kconfig
create mode 100644 drivers/gpu/drm/vmwgfx/Makefile
create mode 100644 drivers/gpu/drm/vmwgfx/svga3d_reg.h
create mode 100644 drivers/gpu/drm/vmwgfx/svga3d_surfacedefs.h
create mode 100644 drivers/gpu/drm/vmwgfx/svga_escape.h
create mode 100644 drivers/gpu/drm/vmwgfx/svga_overlay.h
create mode 100644 drivers/gpu/drm/vmwgfx/svga_reg.h
create mode 100644 drivers/gpu/drm/vmwgfx/svga_types.h
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_context.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_fence.h
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_marker.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_reg.h
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
create mode 100644 drivers/gpu/host1x/Kconfig
create mode 100644 drivers/gpu/host1x/Makefile
create mode 100644 drivers/gpu/host1x/cdma.c
create mode 100644 drivers/gpu/host1x/cdma.h
create mode 100644 drivers/gpu/host1x/channel.c
create mode 100644 drivers/gpu/host1x/channel.h
create mode 100644 drivers/gpu/host1x/debug.c
create mode 100644 drivers/gpu/host1x/debug.h
create mode 100644 drivers/gpu/host1x/dev.c
create mode 100644 drivers/gpu/host1x/dev.h
create mode 100644 drivers/gpu/host1x/drm/Kconfig
create mode 100644 drivers/gpu/host1x/drm/dc.c
create mode 100644 drivers/gpu/host1x/drm/dc.h
create mode 100644 drivers/gpu/host1x/drm/drm.c
create mode 100644 drivers/gpu/host1x/drm/drm.h
create mode 100644 drivers/gpu/host1x/drm/fb.c
create mode 100644 drivers/gpu/host1x/drm/gem.c
create mode 100644 drivers/gpu/host1x/drm/gem.h
create mode 100644 drivers/gpu/host1x/drm/gr2d.c
create mode 100644 drivers/gpu/host1x/drm/hdmi.c
create mode 100644 drivers/gpu/host1x/drm/hdmi.h
create mode 100644 drivers/gpu/host1x/drm/output.c
create mode 100644 drivers/gpu/host1x/drm/rgb.c
create mode 100644 drivers/gpu/host1x/host1x.h
create mode 100644 drivers/gpu/host1x/host1x_bo.h
create mode 100644 drivers/gpu/host1x/host1x_client.h
create mode 100644 drivers/gpu/host1x/hw/Makefile
create mode 100644 drivers/gpu/host1x/hw/cdma_hw.c
create mode 100644 drivers/gpu/host1x/hw/channel_hw.c
create mode 100644 drivers/gpu/host1x/hw/debug_hw.c
create mode 100644 drivers/gpu/host1x/hw/host1x01.c
create mode 100644 drivers/gpu/host1x/hw/host1x01.h
create mode 100644 drivers/gpu/host1x/hw/host1x01_hardware.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x01_channel.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x01_sync.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x01_uclass.h
create mode 100644 drivers/gpu/host1x/hw/intr_hw.c
create mode 100644 drivers/gpu/host1x/hw/syncpt_hw.c
create mode 100644 drivers/gpu/host1x/intr.c
create mode 100644 drivers/gpu/host1x/intr.h
create mode 100644 drivers/gpu/host1x/job.c
create mode 100644 drivers/gpu/host1x/job.h
create mode 100644 drivers/gpu/host1x/syncpt.c
create mode 100644 drivers/gpu/host1x/syncpt.h
create mode 100644 drivers/gpu/ion/Makefile
create mode 100644 drivers/gpu/ion/compat_ion.c
create mode 100644 drivers/gpu/ion/compat_ion.h
create mode 100644 drivers/gpu/ion/ion.c
create mode 100644 drivers/gpu/ion/ion_carveout_heap.c
create mode 100644 drivers/gpu/ion/ion_chunk_heap.c
create mode 100644 drivers/gpu/ion/ion_cma_heap.c
create mode 100644 drivers/gpu/ion/ion_heap.c
create mode 100644 drivers/gpu/ion/ion_page_pool.c
create mode 100644 drivers/gpu/ion/ion_priv.h
create mode 100644 drivers/gpu/ion/ion_system_heap.c
create mode 100644 drivers/gpu/ion/ion_system_mapper.c
create mode 100644 drivers/gpu/ion/sprd/Makefile
create mode 100644 drivers/gpu/ion/sprd/compat_sprd_ion.c
create mode 100644 drivers/gpu/ion/sprd/compat_sprd_ion.h
create mode 100644 drivers/gpu/ion/sprd/sprd_fence.c
create mode 100644 drivers/gpu/ion/sprd/sprd_fence.h
create mode 100644 drivers/gpu/ion/sprd/sprd_ion.c
create mode 100644 drivers/gpu/ion/sprd/sprd_ion_cma_heap.c
create mode 100644 drivers/gpu/ion/tegra/Makefile
create mode 100644 drivers/gpu/ion/tegra/tegra_ion.c
create mode 100644 drivers/gpu/sprd_iommu/Kconfig
create mode 100644 drivers/gpu/sprd_iommu/Makefile
create mode 100644 drivers/gpu/sprd_iommu/gsp/Makefile
create mode 100755 drivers/gpu/sprd_iommu/gsp/sprd_iommu_gsp.c
create mode 100644 drivers/gpu/sprd_iommu/mm/Makefile
create mode 100644 drivers/gpu/sprd_iommu/mm/sprd_iommu_mm.c
create mode 100644 drivers/gpu/sprd_iommu/sprd_iommu_common.c
create mode 100644 drivers/gpu/sprd_iommu/sprd_iommu_common.h
create mode 100644 drivers/gpu/sprd_iommu/sprd_iommu_drv.c
create mode 100644 drivers/gpu/sprd_iommu/sprd_iommu_sysfs.c
create mode 100644 drivers/gpu/sprd_iommu/sprd_iommu_sysfs.h
create mode 100644 drivers/gpu/sprd_iommu/v2/Makefile
create mode 100644 drivers/gpu/sprd_iommu/v2/sprd_iommu_dcam.c
create mode 100644 drivers/gpu/sprd_iommu/v2/sprd_iommu_dispc.c
create mode 100644 drivers/gpu/sprd_iommu/v2/sprd_iommu_gsp0.c
create mode 100644 drivers/gpu/sprd_iommu/v2/sprd_iommu_gsp1.c
create mode 100644 drivers/gpu/sprd_iommu/v2/sprd_iommu_vpp.c
create mode 100644 drivers/gpu/sprd_iommu/v2/sprd_iommu_vsp.c
create mode 100644 drivers/gpu/vga/Kconfig
create mode 100644 drivers/gpu/vga/Makefile
create mode 100644 drivers/gpu/vga/vga_switcheroo.c
create mode 100644 drivers/gpu/vga/vgaarb.c
(limited to 'drivers/gpu')
diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile
new file mode 100644
index 00000000..9b26e0b4
--- /dev/null
+++ b/drivers/gpu/Makefile
@@ -0,0 +1,2 @@
+obj-y += drm/ vga/ sprd_iommu/
+obj-$(CONFIG_TEGRA_HOST1X) += host1x/
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
new file mode 100644
index 00000000..b16c50ee
--- /dev/null
+++ b/drivers/gpu/drm/Kconfig
@@ -0,0 +1,222 @@
+#
+# Drm device configuration
+#
+# This driver provides support for the
+# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
+#
+menuconfig DRM
+ tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
+ depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU
+ select HDMI
+ select I2C
+ select I2C_ALGOBIT
+ select DMA_SHARED_BUFFER
+ help
+ Kernel-level support for the Direct Rendering Infrastructure (DRI)
+ introduced in XFree86 4.0. If you say Y here, you need to select
+ the module that's right for your graphics card from the list below.
+ These modules provide support for synchronization, security, and
+ DMA transfers. Please see for more
+ details. You should also select and configure AGP
+ (/dev/agpgart) support if it is available for your platform.
+
+config DRM_USB
+ tristate
+ depends on DRM
+ depends on USB_SUPPORT && USB_ARCH_HAS_HCD
+ select USB
+
+config DRM_KMS_HELPER
+ tristate
+ depends on DRM
+ select FB
+ select FRAMEBUFFER_CONSOLE if !EXPERT
+ select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
+ help
+ FB and CRTC helpers for KMS drivers.
+
+config DRM_LOAD_EDID_FIRMWARE
+ bool "Allow to specify an EDID data set instead of probing for it"
+ depends on DRM_KMS_HELPER
+ help
+ Say Y here, if you want to use EDID data to be loaded from the
+ /lib/firmware directory or one of the provided built-in
+ data sets. This may be necessary, if the graphics adapter or
+ monitor are unable to provide appropriate EDID data. Since this
+ feature is provided as a workaround for broken hardware, the
+ default case is N. Details and instructions how to build your own
+ EDID data are given in Documentation/EDID/HOWTO.txt.
+
+config DRM_TTM
+ tristate
+ depends on DRM
+ help
+ GPU memory management subsystem for devices with multiple
+ GPU memory types. Will be enabled automatically if a device driver
+ uses it.
+
+config DRM_GEM_CMA_HELPER
+ bool
+ depends on DRM
+ help
+ Choose this if you need the GEM CMA helper functions
+
+config DRM_KMS_CMA_HELPER
+ bool
+ select DRM_GEM_CMA_HELPER
+ select FB_SYS_FILLRECT
+ select FB_SYS_COPYAREA
+ select FB_SYS_IMAGEBLIT
+ help
+ Choose this if you need the KMS CMA helper functions
+
+source "drivers/gpu/drm/i2c/Kconfig"
+
+config DRM_TDFX
+ tristate "3dfx Banshee/Voodoo3+"
+ depends on DRM && PCI
+ help
+ Choose this option if you have a 3dfx Banshee or Voodoo3 (or later),
+ graphics card. If M is selected, the module will be called tdfx.
+
+config DRM_R128
+ tristate "ATI Rage 128"
+ depends on DRM && PCI
+ select FW_LOADER
+ help
+ Choose this option if you have an ATI Rage 128 graphics card. If M
+ is selected, the module will be called r128. AGP support for
+ this card is strongly suggested (unless you have a PCI version).
+
+config DRM_RADEON
+ tristate "ATI Radeon"
+ depends on DRM && PCI
+ select FB_CFB_FILLRECT
+ select FB_CFB_COPYAREA
+ select FB_CFB_IMAGEBLIT
+ select FW_LOADER
+ select DRM_KMS_HELPER
+ select DRM_TTM
+ select POWER_SUPPLY
+ select HWMON
+ select BACKLIGHT_CLASS_DEVICE
+ help
+ Choose this option if you have an ATI Radeon graphics card. There
+ are both PCI and AGP versions. You don't need to choose this to
+ run the Radeon in plain VGA mode.
+
+ If M is selected, the module will be called radeon.
+
+source "drivers/gpu/drm/radeon/Kconfig"
+
+source "drivers/gpu/drm/nouveau/Kconfig"
+
+config DRM_I810
+ tristate "Intel I810"
+ # !PREEMPT because of missing ioctl locking
+ depends on DRM && AGP && AGP_INTEL && (!PREEMPT || BROKEN)
+ help
+ Choose this option if you have an Intel I810 graphics card. If M is
+ selected, the module will be called i810. AGP support is required
+ for this driver to work.
+
+config DRM_I915
+ tristate "Intel 8xx/9xx/G3x/G4x/HD Graphics"
+ depends on DRM
+ depends on AGP
+ depends on AGP_INTEL
+ # we need shmfs for the swappable backing store, and in particular
+ # the shmem_readpage() which depends upon tmpfs
+ select SHMEM
+ select TMPFS
+ select DRM_KMS_HELPER
+ select FB_CFB_FILLRECT
+ select FB_CFB_COPYAREA
+ select FB_CFB_IMAGEBLIT
+ # i915 depends on ACPI_VIDEO when ACPI is enabled
+ # but for select to work, need to select ACPI_VIDEO's dependencies, ick
+ select BACKLIGHT_LCD_SUPPORT if ACPI
+ select BACKLIGHT_CLASS_DEVICE if ACPI
+ select VIDEO_OUTPUT_CONTROL if ACPI
+ select INPUT if ACPI
+ select ACPI_VIDEO if ACPI
+ select ACPI_BUTTON if ACPI
+ help
+ Choose this option if you have a system that has "Intel Graphics
+ Media Accelerator" or "HD Graphics" integrated graphics,
+ including 830M, 845G, 852GM, 855GM, 865G, 915G, 945G, 965G,
+ G35, G41, G43, G45 chipsets and Celeron, Pentium, Core i3,
+ Core i5, Core i7 as well as Atom CPUs with integrated graphics.
+ If M is selected, the module will be called i915. AGP support
+ is required for this driver to work. This driver is used by
+ the Intel driver in X.org 6.8 and XFree86 4.4 and above. It
+ replaces the older i830 module that supported a subset of the
+ hardware in older X.org releases.
+
+ Note that the older i810/i815 chipsets require the use of the
+ i810 driver instead, and the Atom z5xx series has an entirely
+ different implementation.
+
+config DRM_I915_KMS
+ bool "Enable modesetting on intel by default"
+ depends on DRM_I915
+ help
+ Choose this option if you want kernel modesetting enabled by default,
+ and you have a new enough userspace to support this. Running old
+ userspaces with this enabled will cause pain. Note that this causes
+ the driver to bind to PCI devices, which precludes loading things
+ like intelfb.
+
+config DRM_MGA
+ tristate "Matrox g200/g400"
+ depends on DRM && PCI
+ select FW_LOADER
+ help
+ Choose this option if you have a Matrox G200, G400 or G450 graphics
+ card. If M is selected, the module will be called mga. AGP
+ support is required for this driver to work.
+
+config DRM_SIS
+ tristate "SiS video cards"
+ depends on DRM && AGP
+ depends on FB_SIS || FB_SIS=n
+ help
+ Choose this option if you have a SiS 630 or compatible video
+ chipset. If M is selected the module will be called sis. AGP
+ support is required for this driver to work.
+
+config DRM_VIA
+ tristate "Via unichrome video cards"
+ depends on DRM && PCI
+ help
+ Choose this option if you have a Via unichrome or compatible video
+ chipset. If M is selected the module will be called via.
+
+config DRM_SAVAGE
+ tristate "Savage video cards"
+ depends on DRM && PCI
+ help
+ Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
+ chipset. If M is selected the module will be called savage.
+
+source "drivers/gpu/drm/exynos/Kconfig"
+
+source "drivers/gpu/drm/vmwgfx/Kconfig"
+
+source "drivers/gpu/drm/gma500/Kconfig"
+
+source "drivers/gpu/drm/udl/Kconfig"
+
+source "drivers/gpu/drm/ast/Kconfig"
+
+source "drivers/gpu/drm/mgag200/Kconfig"
+
+source "drivers/gpu/drm/cirrus/Kconfig"
+
+source "drivers/gpu/drm/shmobile/Kconfig"
+
+source "drivers/gpu/drm/omapdrm/Kconfig"
+
+source "drivers/gpu/drm/tilcdc/Kconfig"
+
+source "drivers/gpu/drm/qxl/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
new file mode 100644
index 00000000..1c9f2439
--- /dev/null
+++ b/drivers/gpu/drm/Makefile
@@ -0,0 +1,55 @@
+#
+# Makefile for the drm device driver. This driver provides support for the
+# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
+
+ccflags-y := -Iinclude/drm
+
+drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \
+ drm_context.o drm_dma.o \
+ drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
+ drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
+ drm_agpsupport.o drm_scatter.o drm_pci.o \
+ drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
+ drm_crtc.o drm_modes.o drm_edid.o \
+ drm_info.o drm_debugfs.o drm_encoder_slave.o \
+ drm_trace_points.o drm_global.o drm_prime.o
+
+drm-$(CONFIG_COMPAT) += drm_ioc32.o
+drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
+drm-$(CONFIG_PCI) += ati_pcigart.o
+
+drm-usb-y := drm_usb.o
+
+drm_kms_helper-y := drm_fb_helper.o drm_crtc_helper.o drm_dp_helper.o
+drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
+drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
+
+obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
+
+CFLAGS_drm_trace_points.o := -I$(src)
+
+obj-$(CONFIG_DRM) += drm.o
+obj-$(CONFIG_DRM_USB) += drm_usb.o
+obj-$(CONFIG_DRM_TTM) += ttm/
+obj-$(CONFIG_DRM_TDFX) += tdfx/
+obj-$(CONFIG_DRM_R128) += r128/
+obj-$(CONFIG_DRM_RADEON)+= radeon/
+obj-$(CONFIG_DRM_MGA) += mga/
+obj-$(CONFIG_DRM_I810) += i810/
+obj-$(CONFIG_DRM_I915) += i915/
+obj-$(CONFIG_DRM_MGAG200) += mgag200/
+obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/
+obj-$(CONFIG_DRM_SIS) += sis/
+obj-$(CONFIG_DRM_SAVAGE)+= savage/
+obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/
+obj-$(CONFIG_DRM_VIA) +=via/
+obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/
+obj-$(CONFIG_DRM_EXYNOS) +=exynos/
+obj-$(CONFIG_DRM_GMA500) += gma500/
+obj-$(CONFIG_DRM_UDL) += udl/
+obj-$(CONFIG_DRM_AST) += ast/
+obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/
+obj-$(CONFIG_DRM_OMAP) += omapdrm/
+obj-$(CONFIG_DRM_TILCDC) += tilcdc/
+obj-$(CONFIG_DRM_QXL) += qxl/
+obj-y += i2c/
diff --git a/drivers/gpu/drm/README.drm b/drivers/gpu/drm/README.drm
new file mode 100644
index 00000000..b5b33272
--- /dev/null
+++ b/drivers/gpu/drm/README.drm
@@ -0,0 +1,43 @@
+************************************************************
+* For the very latest on DRI development, please see: *
+* http://dri.freedesktop.org/ *
+************************************************************
+
+The Direct Rendering Manager (drm) is a device-independent kernel-level
+device driver that provides support for the XFree86 Direct Rendering
+Infrastructure (DRI).
+
+The DRM supports the Direct Rendering Infrastructure (DRI) in four major
+ways:
+
+ 1. The DRM provides synchronized access to the graphics hardware via
+ the use of an optimized two-tiered lock.
+
+ 2. The DRM enforces the DRI security policy for access to the graphics
+ hardware by only allowing authenticated X11 clients access to
+ restricted regions of memory.
+
+ 3. The DRM provides a generic DMA engine, complete with multiple
+ queues and the ability to detect the need for an OpenGL context
+ switch.
+
+ 4. The DRM is extensible via the use of small device-specific modules
+ that rely extensively on the API exported by the DRM module.
+
+
+Documentation on the DRI is available from:
+ http://dri.freedesktop.org/wiki/Documentation
+ http://sourceforge.net/project/showfiles.php?group_id=387
+ http://dri.sourceforge.net/doc/
+
+For specific information about kernel-level support, see:
+
+ The Direct Rendering Manager, Kernel Support for the Direct Rendering
+ Infrastructure
+ http://dri.sourceforge.net/doc/drm_low_level.html
+
+ Hardware Locking for the Direct Rendering Infrastructure
+ http://dri.sourceforge.net/doc/hardware_locking_low_level.html
+
+ A Security Analysis of the Direct Rendering Infrastructure
+ http://dri.sourceforge.net/doc/security_low_level.html
diff --git a/drivers/gpu/drm/ast/Kconfig b/drivers/gpu/drm/ast/Kconfig
new file mode 100644
index 00000000..da4a51ea
--- /dev/null
+++ b/drivers/gpu/drm/ast/Kconfig
@@ -0,0 +1,16 @@
+config DRM_AST
+ tristate "AST server chips"
+ depends on DRM && PCI
+ select DRM_TTM
+ select FB_SYS_COPYAREA
+ select FB_SYS_FILLRECT
+ select FB_SYS_IMAGEBLIT
+ select DRM_KMS_HELPER
+ select DRM_TTM
+ help
+ Say yes for experimental AST GPU driver. Do not enable
+ this driver without having a working -modesetting,
+ and a version of AST that knows to fail if KMS
+ is bound to the driver. These GPUs are commonly found
+ in server chipsets.
+
diff --git a/drivers/gpu/drm/ast/Makefile b/drivers/gpu/drm/ast/Makefile
new file mode 100644
index 00000000..8df4f284
--- /dev/null
+++ b/drivers/gpu/drm/ast/Makefile
@@ -0,0 +1,9 @@
+#
+# Makefile for the drm device driver. This driver provides support for the
+# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
+
+ccflags-y := -Iinclude/drm
+
+ast-y := ast_drv.o ast_main.o ast_mode.o ast_fb.o ast_ttm.o ast_post.o
+
+obj-$(CONFIG_DRM_AST) := ast.o
\ No newline at end of file
diff --git a/drivers/gpu/drm/ast/ast_dram_tables.h b/drivers/gpu/drm/ast/ast_dram_tables.h
new file mode 100644
index 00000000..cc04539c
--- /dev/null
+++ b/drivers/gpu/drm/ast/ast_dram_tables.h
@@ -0,0 +1,144 @@
+#ifndef AST_DRAM_TABLES_H
+#define AST_DRAM_TABLES_H
+
+/* DRAM timing tables */
+struct ast_dramstruct {
+ u16 index;
+ u32 data;
+};
+
+static const struct ast_dramstruct ast2000_dram_table_data[] = {
+ { 0x0108, 0x00000000 },
+ { 0x0120, 0x00004a21 },
+ { 0xFF00, 0x00000043 },
+ { 0x0000, 0xFFFFFFFF },
+ { 0x0004, 0x00000089 },
+ { 0x0008, 0x22331353 },
+ { 0x000C, 0x0d07000b },
+ { 0x0010, 0x11113333 },
+ { 0x0020, 0x00110350 },
+ { 0x0028, 0x1e0828f0 },
+ { 0x0024, 0x00000001 },
+ { 0x001C, 0x00000000 },
+ { 0x0014, 0x00000003 },
+ { 0xFF00, 0x00000043 },
+ { 0x0018, 0x00000131 },
+ { 0x0014, 0x00000001 },
+ { 0xFF00, 0x00000043 },
+ { 0x0018, 0x00000031 },
+ { 0x0014, 0x00000001 },
+ { 0xFF00, 0x00000043 },
+ { 0x0028, 0x1e0828f1 },
+ { 0x0024, 0x00000003 },
+ { 0x002C, 0x1f0f28fb },
+ { 0x0030, 0xFFFFFE01 },
+ { 0xFFFF, 0xFFFFFFFF }
+};
+
+static const struct ast_dramstruct ast1100_dram_table_data[] = {
+ { 0x2000, 0x1688a8a8 },
+ { 0x2020, 0x000041f0 },
+ { 0xFF00, 0x00000043 },
+ { 0x0000, 0xfc600309 },
+ { 0x006C, 0x00909090 },
+ { 0x0064, 0x00050000 },
+ { 0x0004, 0x00000585 },
+ { 0x0008, 0x0011030f },
+ { 0x0010, 0x22201724 },
+ { 0x0018, 0x1e29011a },
+ { 0x0020, 0x00c82222 },
+ { 0x0014, 0x01001523 },
+ { 0x001C, 0x1024010d },
+ { 0x0024, 0x00cb2522 },
+ { 0x0038, 0xffffff82 },
+ { 0x003C, 0x00000000 },
+ { 0x0040, 0x00000000 },
+ { 0x0044, 0x00000000 },
+ { 0x0048, 0x00000000 },
+ { 0x004C, 0x00000000 },
+ { 0x0050, 0x00000000 },
+ { 0x0054, 0x00000000 },
+ { 0x0058, 0x00000000 },
+ { 0x005C, 0x00000000 },
+ { 0x0060, 0x032aa02a },
+ { 0x0064, 0x002d3000 },
+ { 0x0068, 0x00000000 },
+ { 0x0070, 0x00000000 },
+ { 0x0074, 0x00000000 },
+ { 0x0078, 0x00000000 },
+ { 0x007C, 0x00000000 },
+ { 0x0034, 0x00000001 },
+ { 0xFF00, 0x00000043 },
+ { 0x002C, 0x00000732 },
+ { 0x0030, 0x00000040 },
+ { 0x0028, 0x00000005 },
+ { 0x0028, 0x00000007 },
+ { 0x0028, 0x00000003 },
+ { 0x0028, 0x00000001 },
+ { 0x000C, 0x00005a08 },
+ { 0x002C, 0x00000632 },
+ { 0x0028, 0x00000001 },
+ { 0x0030, 0x000003c0 },
+ { 0x0028, 0x00000003 },
+ { 0x0030, 0x00000040 },
+ { 0x0028, 0x00000003 },
+ { 0x000C, 0x00005a21 },
+ { 0x0034, 0x00007c03 },
+ { 0x0120, 0x00004c41 },
+ { 0xffff, 0xffffffff },
+};
+
+static const struct ast_dramstruct ast2100_dram_table_data[] = {
+ { 0x2000, 0x1688a8a8 },
+ { 0x2020, 0x00004120 },
+ { 0xFF00, 0x00000043 },
+ { 0x0000, 0xfc600309 },
+ { 0x006C, 0x00909090 },
+ { 0x0064, 0x00070000 },
+ { 0x0004, 0x00000489 },
+ { 0x0008, 0x0011030f },
+ { 0x0010, 0x32302926 },
+ { 0x0018, 0x274c0122 },
+ { 0x0020, 0x00ce2222 },
+ { 0x0014, 0x01001523 },
+ { 0x001C, 0x1024010d },
+ { 0x0024, 0x00cb2522 },
+ { 0x0038, 0xffffff82 },
+ { 0x003C, 0x00000000 },
+ { 0x0040, 0x00000000 },
+ { 0x0044, 0x00000000 },
+ { 0x0048, 0x00000000 },
+ { 0x004C, 0x00000000 },
+ { 0x0050, 0x00000000 },
+ { 0x0054, 0x00000000 },
+ { 0x0058, 0x00000000 },
+ { 0x005C, 0x00000000 },
+ { 0x0060, 0x0f2aa02a },
+ { 0x0064, 0x003f3005 },
+ { 0x0068, 0x02020202 },
+ { 0x0070, 0x00000000 },
+ { 0x0074, 0x00000000 },
+ { 0x0078, 0x00000000 },
+ { 0x007C, 0x00000000 },
+ { 0x0034, 0x00000001 },
+ { 0xFF00, 0x00000043 },
+ { 0x002C, 0x00000942 },
+ { 0x0030, 0x00000040 },
+ { 0x0028, 0x00000005 },
+ { 0x0028, 0x00000007 },
+ { 0x0028, 0x00000003 },
+ { 0x0028, 0x00000001 },
+ { 0x000C, 0x00005a08 },
+ { 0x002C, 0x00000842 },
+ { 0x0028, 0x00000001 },
+ { 0x0030, 0x000003c0 },
+ { 0x0028, 0x00000003 },
+ { 0x0030, 0x00000040 },
+ { 0x0028, 0x00000003 },
+ { 0x000C, 0x00005a21 },
+ { 0x0034, 0x00007c03 },
+ { 0x0120, 0x00005061 },
+ { 0xffff, 0xffffffff },
+};
+
+#endif
diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
new file mode 100644
index 00000000..df0d0a08
--- /dev/null
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -0,0 +1,245 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie
+ */
+#include
+#include
+
+#include
+#include
+
+#include "ast_drv.h"
+
+int ast_modeset = -1;
+
+MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
+module_param_named(modeset, ast_modeset, int, 0400);
+
+#define PCI_VENDOR_ASPEED 0x1a03
+
+static struct drm_driver driver;
+
+#define AST_VGA_DEVICE(id, info) { \
+ .class = PCI_BASE_CLASS_DISPLAY << 16, \
+ .class_mask = 0xff0000, \
+ .vendor = PCI_VENDOR_ASPEED, \
+ .device = id, \
+ .subvendor = PCI_ANY_ID, \
+ .subdevice = PCI_ANY_ID, \
+ .driver_data = (unsigned long) info }
+
+static DEFINE_PCI_DEVICE_TABLE(pciidlist) = {
+ AST_VGA_DEVICE(PCI_CHIP_AST2000, NULL),
+ AST_VGA_DEVICE(PCI_CHIP_AST2100, NULL),
+ /* AST_VGA_DEVICE(PCI_CHIP_AST1180, NULL), - don't bind to 1180 for now */
+ {0, 0, 0},
+};
+
+MODULE_DEVICE_TABLE(pci, pciidlist);
+
+static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+ return drm_get_pci_dev(pdev, ent, &driver);
+}
+
+static void
+ast_pci_remove(struct pci_dev *pdev)
+{
+ struct drm_device *dev = pci_get_drvdata(pdev);
+
+ drm_put_dev(dev);
+}
+
+
+
+static int ast_drm_freeze(struct drm_device *dev)
+{
+ drm_kms_helper_poll_disable(dev);
+
+ pci_save_state(dev->pdev);
+
+ console_lock();
+ ast_fbdev_set_suspend(dev, 1);
+ console_unlock();
+ return 0;
+}
+
+static int ast_drm_thaw(struct drm_device *dev)
+{
+ int error = 0;
+
+ ast_post_gpu(dev);
+
+ drm_mode_config_reset(dev);
+ drm_modeset_lock_all(dev);
+ drm_helper_resume_force_mode(dev);
+ drm_modeset_unlock_all(dev);
+
+ console_lock();
+ ast_fbdev_set_suspend(dev, 0);
+ console_unlock();
+ return error;
+}
+
+static int ast_drm_resume(struct drm_device *dev)
+{
+ int ret;
+
+ if (pci_enable_device(dev->pdev))
+ return -EIO;
+
+ ret = ast_drm_thaw(dev);
+ if (ret)
+ return ret;
+
+ drm_kms_helper_poll_enable(dev);
+ return 0;
+}
+
+static int ast_pm_suspend(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct drm_device *ddev = pci_get_drvdata(pdev);
+ int error;
+
+ error = ast_drm_freeze(ddev);
+ if (error)
+ return error;
+
+ pci_disable_device(pdev);
+ pci_set_power_state(pdev, PCI_D3hot);
+ return 0;
+}
+static int ast_pm_resume(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct drm_device *ddev = pci_get_drvdata(pdev);
+ return ast_drm_resume(ddev);
+}
+
+static int ast_pm_freeze(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct drm_device *ddev = pci_get_drvdata(pdev);
+
+ if (!ddev || !ddev->dev_private)
+ return -ENODEV;
+ return ast_drm_freeze(ddev);
+
+}
+
+static int ast_pm_thaw(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct drm_device *ddev = pci_get_drvdata(pdev);
+ return ast_drm_thaw(ddev);
+}
+
+static int ast_pm_poweroff(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct drm_device *ddev = pci_get_drvdata(pdev);
+
+ return ast_drm_freeze(ddev);
+}
+
+static const struct dev_pm_ops ast_pm_ops = {
+ .suspend = ast_pm_suspend,
+ .resume = ast_pm_resume,
+ .freeze = ast_pm_freeze,
+ .thaw = ast_pm_thaw,
+ .poweroff = ast_pm_poweroff,
+ .restore = ast_pm_resume,
+};
+
+static struct pci_driver ast_pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = ast_pci_probe,
+ .remove = ast_pci_remove,
+ .driver.pm = &ast_pm_ops,
+};
+
+static const struct file_operations ast_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = ast_mmap,
+ .poll = drm_poll,
+ .fasync = drm_fasync,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = drm_compat_ioctl,
+#endif
+ .read = drm_read,
+};
+
+static struct drm_driver driver = {
+ .driver_features = DRIVER_USE_MTRR | DRIVER_MODESET | DRIVER_GEM,
+ .dev_priv_size = 0,
+
+ .load = ast_driver_load,
+ .unload = ast_driver_unload,
+
+ .fops = &ast_fops,
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
+
+ .gem_init_object = ast_gem_init_object,
+ .gem_free_object = ast_gem_free_object,
+ .dumb_create = ast_dumb_create,
+ .dumb_map_offset = ast_dumb_mmap_offset,
+ .dumb_destroy = ast_dumb_destroy,
+
+};
+
+static int __init ast_init(void)
+{
+#ifdef CONFIG_VGA_CONSOLE
+ if (vgacon_text_force() && ast_modeset == -1)
+ return -EINVAL;
+#endif
+
+ if (ast_modeset == 0)
+ return -EINVAL;
+ return drm_pci_init(&driver, &ast_pci_driver);
+}
+static void __exit ast_exit(void)
+{
+ drm_pci_exit(&driver, &ast_pci_driver);
+}
+
+module_init(ast_init);
+module_exit(ast_exit);
+
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL and additional rights");
+
diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
new file mode 100644
index 00000000..b6b7d70f
--- /dev/null
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -0,0 +1,359 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie
+ */
+#ifndef __AST_DRV_H__
+#define __AST_DRV_H__
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#define DRIVER_AUTHOR "Dave Airlie"
+
+#define DRIVER_NAME "ast"
+#define DRIVER_DESC "AST"
+#define DRIVER_DATE "20120228"
+
+#define DRIVER_MAJOR 0
+#define DRIVER_MINOR 1
+#define DRIVER_PATCHLEVEL 0
+
+#define PCI_CHIP_AST2000 0x2000
+#define PCI_CHIP_AST2100 0x2010
+#define PCI_CHIP_AST1180 0x1180
+
+
+enum ast_chip {
+ AST2000,
+ AST2100,
+ AST1100,
+ AST2200,
+ AST2150,
+ AST2300,
+ AST1180,
+};
+
+#define AST_DRAM_512Mx16 0
+#define AST_DRAM_1Gx16 1
+#define AST_DRAM_512Mx32 2
+#define AST_DRAM_1Gx32 3
+#define AST_DRAM_2Gx16 6
+#define AST_DRAM_4Gx16 7
+
+struct ast_fbdev;
+
+struct ast_private {
+ struct drm_device *dev;
+
+ void __iomem *regs;
+ void __iomem *ioregs;
+
+ enum ast_chip chip;
+ bool vga2_clone;
+ uint32_t dram_bus_width;
+ uint32_t dram_type;
+ uint32_t mclk;
+ uint32_t vram_size;
+
+ struct ast_fbdev *fbdev;
+
+ int fb_mtrr;
+
+ struct {
+ struct drm_global_reference mem_global_ref;
+ struct ttm_bo_global_ref bo_global_ref;
+ struct ttm_bo_device bdev;
+ } ttm;
+
+ struct drm_gem_object *cursor_cache;
+ uint64_t cursor_cache_gpu_addr;
+ /* Acces to this cache is protected by the crtc->mutex of the only crtc
+ * we have. */
+ struct ttm_bo_kmap_obj cache_kmap;
+ int next_cursor;
+};
+
+int ast_driver_load(struct drm_device *dev, unsigned long flags);
+int ast_driver_unload(struct drm_device *dev);
+
+struct ast_gem_object;
+
+#define AST_IO_AR_PORT_WRITE (0x40)
+#define AST_IO_MISC_PORT_WRITE (0x42)
+#define AST_IO_SEQ_PORT (0x44)
+#define AST_DAC_INDEX_READ (0x3c7)
+#define AST_IO_DAC_INDEX_WRITE (0x48)
+#define AST_IO_DAC_DATA (0x49)
+#define AST_IO_GR_PORT (0x4E)
+#define AST_IO_CRTC_PORT (0x54)
+#define AST_IO_INPUT_STATUS1_READ (0x5A)
+#define AST_IO_MISC_PORT_READ (0x4C)
+
+#define __ast_read(x) \
+static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \
+u##x val = 0;\
+val = ioread##x(ast->regs + reg); \
+return val;\
+}
+
+__ast_read(8);
+__ast_read(16);
+__ast_read(32)
+
+#define __ast_io_read(x) \
+static inline u##x ast_io_read##x(struct ast_private *ast, u32 reg) { \
+u##x val = 0;\
+val = ioread##x(ast->ioregs + reg); \
+return val;\
+}
+
+__ast_io_read(8);
+__ast_io_read(16);
+__ast_io_read(32);
+
+#define __ast_write(x) \
+static inline void ast_write##x(struct ast_private *ast, u32 reg, u##x val) {\
+ iowrite##x(val, ast->regs + reg);\
+ }
+
+__ast_write(8);
+__ast_write(16);
+__ast_write(32);
+
+#define __ast_io_write(x) \
+static inline void ast_io_write##x(struct ast_private *ast, u32 reg, u##x val) {\
+ iowrite##x(val, ast->ioregs + reg);\
+ }
+
+__ast_io_write(8);
+__ast_io_write(16);
+#undef __ast_io_write
+
+static inline void ast_set_index_reg(struct ast_private *ast,
+ uint32_t base, uint8_t index,
+ uint8_t val)
+{
+ ast_io_write16(ast, base, ((u16)val << 8) | index);
+}
+
+void ast_set_index_reg_mask(struct ast_private *ast,
+ uint32_t base, uint8_t index,
+ uint8_t mask, uint8_t val);
+uint8_t ast_get_index_reg(struct ast_private *ast,
+ uint32_t base, uint8_t index);
+uint8_t ast_get_index_reg_mask(struct ast_private *ast,
+ uint32_t base, uint8_t index, uint8_t mask);
+
+static inline void ast_open_key(struct ast_private *ast)
+{
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x80, 0xA8);
+}
+
+#define AST_VIDMEM_SIZE_8M 0x00800000
+#define AST_VIDMEM_SIZE_16M 0x01000000
+#define AST_VIDMEM_SIZE_32M 0x02000000
+#define AST_VIDMEM_SIZE_64M 0x04000000
+#define AST_VIDMEM_SIZE_128M 0x08000000
+
+#define AST_VIDMEM_DEFAULT_SIZE AST_VIDMEM_SIZE_8M
+
+#define AST_MAX_HWC_WIDTH 64
+#define AST_MAX_HWC_HEIGHT 64
+
+#define AST_HWC_SIZE (AST_MAX_HWC_WIDTH*AST_MAX_HWC_HEIGHT*2)
+#define AST_HWC_SIGNATURE_SIZE 32
+
+#define AST_DEFAULT_HWC_NUM 2
+/* define for signature structure */
+#define AST_HWC_SIGNATURE_CHECKSUM 0x00
+#define AST_HWC_SIGNATURE_SizeX 0x04
+#define AST_HWC_SIGNATURE_SizeY 0x08
+#define AST_HWC_SIGNATURE_X 0x0C
+#define AST_HWC_SIGNATURE_Y 0x10
+#define AST_HWC_SIGNATURE_HOTSPOTX 0x14
+#define AST_HWC_SIGNATURE_HOTSPOTY 0x18
+
+
+struct ast_i2c_chan {
+ struct i2c_adapter adapter;
+ struct drm_device *dev;
+ struct i2c_algo_bit_data bit;
+};
+
+struct ast_connector {
+ struct drm_connector base;
+ struct ast_i2c_chan *i2c;
+};
+
+struct ast_crtc {
+ struct drm_crtc base;
+ u8 lut_r[256], lut_g[256], lut_b[256];
+ struct drm_gem_object *cursor_bo;
+ uint64_t cursor_addr;
+ int cursor_width, cursor_height;
+ u8 offset_x, offset_y;
+};
+
+struct ast_encoder {
+ struct drm_encoder base;
+};
+
+struct ast_framebuffer {
+ struct drm_framebuffer base;
+ struct drm_gem_object *obj;
+};
+
+struct ast_fbdev {
+ struct drm_fb_helper helper;
+ struct ast_framebuffer afb;
+ struct list_head fbdev_list;
+ void *sysram;
+ int size;
+ struct ttm_bo_kmap_obj mapping;
+ int x1, y1, x2, y2; /* dirty rect */
+ spinlock_t dirty_lock;
+};
+
+#define to_ast_crtc(x) container_of(x, struct ast_crtc, base)
+#define to_ast_connector(x) container_of(x, struct ast_connector, base)
+#define to_ast_encoder(x) container_of(x, struct ast_encoder, base)
+#define to_ast_framebuffer(x) container_of(x, struct ast_framebuffer, base)
+
+struct ast_vbios_stdtable {
+ u8 misc;
+ u8 seq[4];
+ u8 crtc[25];
+ u8 ar[20];
+ u8 gr[9];
+};
+
+struct ast_vbios_enhtable {
+ u32 ht;
+ u32 hde;
+ u32 hfp;
+ u32 hsync;
+ u32 vt;
+ u32 vde;
+ u32 vfp;
+ u32 vsync;
+ u32 dclk_index;
+ u32 flags;
+ u32 refresh_rate;
+ u32 refresh_rate_index;
+ u32 mode_id;
+};
+
+struct ast_vbios_dclk_info {
+ u8 param1;
+ u8 param2;
+ u8 param3;
+};
+
+struct ast_vbios_mode_info {
+ struct ast_vbios_stdtable *std_table;
+ struct ast_vbios_enhtable *enh_table;
+};
+
+extern int ast_mode_init(struct drm_device *dev);
+extern void ast_mode_fini(struct drm_device *dev);
+
+int ast_framebuffer_init(struct drm_device *dev,
+ struct ast_framebuffer *ast_fb,
+ struct drm_mode_fb_cmd2 *mode_cmd,
+ struct drm_gem_object *obj);
+
+int ast_fbdev_init(struct drm_device *dev);
+void ast_fbdev_fini(struct drm_device *dev);
+void ast_fbdev_set_suspend(struct drm_device *dev, int state);
+
+struct ast_bo {
+ struct ttm_buffer_object bo;
+ struct ttm_placement placement;
+ struct ttm_bo_kmap_obj kmap;
+ struct drm_gem_object gem;
+ u32 placements[3];
+ int pin_count;
+};
+#define gem_to_ast_bo(gobj) container_of((gobj), struct ast_bo, gem)
+
+static inline struct ast_bo *
+ast_bo(struct ttm_buffer_object *bo)
+{
+ return container_of(bo, struct ast_bo, bo);
+}
+
+
+#define to_ast_obj(x) container_of(x, struct ast_gem_object, base)
+
+#define AST_MM_ALIGN_SHIFT 4
+#define AST_MM_ALIGN_MASK ((1 << AST_MM_ALIGN_SHIFT) - 1)
+
+extern int ast_dumb_create(struct drm_file *file,
+ struct drm_device *dev,
+ struct drm_mode_create_dumb *args);
+extern int ast_dumb_destroy(struct drm_file *file,
+ struct drm_device *dev,
+ uint32_t handle);
+
+extern int ast_gem_init_object(struct drm_gem_object *obj);
+extern void ast_gem_free_object(struct drm_gem_object *obj);
+extern int ast_dumb_mmap_offset(struct drm_file *file,
+ struct drm_device *dev,
+ uint32_t handle,
+ uint64_t *offset);
+
+#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
+
+int ast_mm_init(struct ast_private *ast);
+void ast_mm_fini(struct ast_private *ast);
+
+int ast_bo_create(struct drm_device *dev, int size, int align,
+ uint32_t flags, struct ast_bo **pastbo);
+
+int ast_gem_create(struct drm_device *dev,
+ u32 size, bool iskernel,
+ struct drm_gem_object **obj);
+
+int ast_bo_pin(struct ast_bo *bo, u32 pl_flag, u64 *gpu_addr);
+int ast_bo_unpin(struct ast_bo *bo);
+
+int ast_bo_reserve(struct ast_bo *bo, bool no_wait);
+void ast_bo_unreserve(struct ast_bo *bo);
+void ast_ttm_placement(struct ast_bo *bo, int domain);
+int ast_bo_push_sysram(struct ast_bo *bo);
+int ast_mmap(struct file *filp, struct vm_area_struct *vma);
+
+/* ast post */
+void ast_post_gpu(struct drm_device *dev);
+#endif
diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
new file mode 100644
index 00000000..fbc0823c
--- /dev/null
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -0,0 +1,368 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+#include
+#include
+#include
+#include
+#include "ast_drv.h"
+
+static void ast_dirty_update(struct ast_fbdev *afbdev,
+ int x, int y, int width, int height)
+{
+ int i;
+ struct drm_gem_object *obj;
+ struct ast_bo *bo;
+ int src_offset, dst_offset;
+ int bpp = (afbdev->afb.base.bits_per_pixel + 7)/8;
+ int ret;
+ bool unmap = false;
+ bool store_for_later = false;
+ int x2, y2;
+ unsigned long flags;
+
+ obj = afbdev->afb.obj;
+ bo = gem_to_ast_bo(obj);
+
+ /*
+ * try and reserve the BO, if we fail with busy
+ * then the BO is being moved and we should
+ * store up the damage until later.
+ */
+ ret = ast_bo_reserve(bo, true);
+ if (ret) {
+ if (ret != -EBUSY)
+ return;
+
+ store_for_later = true;
+ }
+
+ x2 = x + width - 1;
+ y2 = y + height - 1;
+ spin_lock_irqsave(&afbdev->dirty_lock, flags);
+
+ if (afbdev->y1 < y)
+ y = afbdev->y1;
+ if (afbdev->y2 > y2)
+ y2 = afbdev->y2;
+ if (afbdev->x1 < x)
+ x = afbdev->x1;
+ if (afbdev->x2 > x2)
+ x2 = afbdev->x2;
+
+ if (store_for_later) {
+ afbdev->x1 = x;
+ afbdev->x2 = x2;
+ afbdev->y1 = y;
+ afbdev->y2 = y2;
+ spin_unlock_irqrestore(&afbdev->dirty_lock, flags);
+ return;
+ }
+
+ afbdev->x1 = afbdev->y1 = INT_MAX;
+ afbdev->x2 = afbdev->y2 = 0;
+ spin_unlock_irqrestore(&afbdev->dirty_lock, flags);
+
+ if (!bo->kmap.virtual) {
+ ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
+ if (ret) {
+ DRM_ERROR("failed to kmap fb updates\n");
+ ast_bo_unreserve(bo);
+ return;
+ }
+ unmap = true;
+ }
+ for (i = y; i <= y2; i++) {
+ /* assume equal stride for now */
+ src_offset = dst_offset = i * afbdev->afb.base.pitches[0] + (x * bpp);
+ memcpy_toio(bo->kmap.virtual + src_offset, afbdev->sysram + src_offset, (x2 - x + 1) * bpp);
+
+ }
+ if (unmap)
+ ttm_bo_kunmap(&bo->kmap);
+
+ ast_bo_unreserve(bo);
+}
+
+static void ast_fillrect(struct fb_info *info,
+ const struct fb_fillrect *rect)
+{
+ struct ast_fbdev *afbdev = info->par;
+ sys_fillrect(info, rect);
+ ast_dirty_update(afbdev, rect->dx, rect->dy, rect->width,
+ rect->height);
+}
+
+static void ast_copyarea(struct fb_info *info,
+ const struct fb_copyarea *area)
+{
+ struct ast_fbdev *afbdev = info->par;
+ sys_copyarea(info, area);
+ ast_dirty_update(afbdev, area->dx, area->dy, area->width,
+ area->height);
+}
+
+static void ast_imageblit(struct fb_info *info,
+ const struct fb_image *image)
+{
+ struct ast_fbdev *afbdev = info->par;
+ sys_imageblit(info, image);
+ ast_dirty_update(afbdev, image->dx, image->dy, image->width,
+ image->height);
+}
+
+static struct fb_ops astfb_ops = {
+ .owner = THIS_MODULE,
+ .fb_check_var = drm_fb_helper_check_var,
+ .fb_set_par = drm_fb_helper_set_par,
+ .fb_fillrect = ast_fillrect,
+ .fb_copyarea = ast_copyarea,
+ .fb_imageblit = ast_imageblit,
+ .fb_pan_display = drm_fb_helper_pan_display,
+ .fb_blank = drm_fb_helper_blank,
+ .fb_setcmap = drm_fb_helper_setcmap,
+ .fb_debug_enter = drm_fb_helper_debug_enter,
+ .fb_debug_leave = drm_fb_helper_debug_leave,
+};
+
+static int astfb_create_object(struct ast_fbdev *afbdev,
+ struct drm_mode_fb_cmd2 *mode_cmd,
+ struct drm_gem_object **gobj_p)
+{
+ struct drm_device *dev = afbdev->helper.dev;
+ u32 bpp, depth;
+ u32 size;
+ struct drm_gem_object *gobj;
+
+ int ret = 0;
+ drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
+
+ size = mode_cmd->pitches[0] * mode_cmd->height;
+ ret = ast_gem_create(dev, size, true, &gobj);
+ if (ret)
+ return ret;
+
+ *gobj_p = gobj;
+ return ret;
+}
+
+static int astfb_create(struct drm_fb_helper *helper,
+ struct drm_fb_helper_surface_size *sizes)
+{
+ struct ast_fbdev *afbdev = (struct ast_fbdev *)helper;
+ struct drm_device *dev = afbdev->helper.dev;
+ struct drm_mode_fb_cmd2 mode_cmd;
+ struct drm_framebuffer *fb;
+ struct fb_info *info;
+ int size, ret;
+ struct device *device = &dev->pdev->dev;
+ void *sysram;
+ struct drm_gem_object *gobj = NULL;
+ struct ast_bo *bo = NULL;
+ mode_cmd.width = sizes->surface_width;
+ mode_cmd.height = sizes->surface_height;
+ mode_cmd.pitches[0] = mode_cmd.width * ((sizes->surface_bpp + 7)/8);
+
+ mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
+ sizes->surface_depth);
+
+ size = mode_cmd.pitches[0] * mode_cmd.height;
+
+ ret = astfb_create_object(afbdev, &mode_cmd, &gobj);
+ if (ret) {
+ DRM_ERROR("failed to create fbcon backing object %d\n", ret);
+ return ret;
+ }
+ bo = gem_to_ast_bo(gobj);
+
+ sysram = vmalloc(size);
+ if (!sysram)
+ return -ENOMEM;
+
+ info = framebuffer_alloc(0, device);
+ if (!info) {
+ ret = -ENOMEM;
+ goto out;
+ }
+ info->par = afbdev;
+
+ ret = ast_framebuffer_init(dev, &afbdev->afb, &mode_cmd, gobj);
+ if (ret)
+ goto out;
+
+ afbdev->sysram = sysram;
+ afbdev->size = size;
+
+ fb = &afbdev->afb.base;
+ afbdev->helper.fb = fb;
+ afbdev->helper.fbdev = info;
+
+ strcpy(info->fix.id, "astdrmfb");
+
+ info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
+ info->fbops = &astfb_ops;
+
+ ret = fb_alloc_cmap(&info->cmap, 256, 0);
+ if (ret) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ info->apertures = alloc_apertures(1);
+ if (!info->apertures) {
+ ret = -ENOMEM;
+ goto out;
+ }
+ info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0);
+ info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);
+
+ drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
+ drm_fb_helper_fill_var(info, &afbdev->helper, sizes->fb_width, sizes->fb_height);
+
+ info->screen_base = sysram;
+ info->screen_size = size;
+
+ info->pixmap.flags = FB_PIXMAP_SYSTEM;
+
+ DRM_DEBUG_KMS("allocated %dx%d\n",
+ fb->width, fb->height);
+
+ return 0;
+out:
+ return ret;
+}
+
+static void ast_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
+ u16 blue, int regno)
+{
+ struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
+ ast_crtc->lut_r[regno] = red >> 8;
+ ast_crtc->lut_g[regno] = green >> 8;
+ ast_crtc->lut_b[regno] = blue >> 8;
+}
+
+static void ast_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
+ u16 *blue, int regno)
+{
+ struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
+ *red = ast_crtc->lut_r[regno] << 8;
+ *green = ast_crtc->lut_g[regno] << 8;
+ *blue = ast_crtc->lut_b[regno] << 8;
+}
+
+static struct drm_fb_helper_funcs ast_fb_helper_funcs = {
+ .gamma_set = ast_fb_gamma_set,
+ .gamma_get = ast_fb_gamma_get,
+ .fb_probe = astfb_create,
+};
+
+static void ast_fbdev_destroy(struct drm_device *dev,
+ struct ast_fbdev *afbdev)
+{
+ struct fb_info *info;
+ struct ast_framebuffer *afb = &afbdev->afb;
+ if (afbdev->helper.fbdev) {
+ info = afbdev->helper.fbdev;
+ unregister_framebuffer(info);
+ if (info->cmap.len)
+ fb_dealloc_cmap(&info->cmap);
+ framebuffer_release(info);
+ }
+
+ if (afb->obj) {
+ drm_gem_object_unreference_unlocked(afb->obj);
+ afb->obj = NULL;
+ }
+ drm_fb_helper_fini(&afbdev->helper);
+
+ vfree(afbdev->sysram);
+ drm_framebuffer_unregister_private(&afb->base);
+ drm_framebuffer_cleanup(&afb->base);
+}
+
+int ast_fbdev_init(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+ struct ast_fbdev *afbdev;
+ int ret;
+
+ afbdev = kzalloc(sizeof(struct ast_fbdev), GFP_KERNEL);
+ if (!afbdev)
+ return -ENOMEM;
+
+ ast->fbdev = afbdev;
+ afbdev->helper.funcs = &ast_fb_helper_funcs;
+ spin_lock_init(&afbdev->dirty_lock);
+ ret = drm_fb_helper_init(dev, &afbdev->helper,
+ 1, 1);
+ if (ret) {
+ kfree(afbdev);
+ return ret;
+ }
+
+ drm_fb_helper_single_add_all_connectors(&afbdev->helper);
+
+ /* disable all the possible outputs/crtcs before entering KMS mode */
+ drm_helper_disable_unused_functions(dev);
+
+ drm_fb_helper_initial_config(&afbdev->helper, 32);
+ return 0;
+}
+
+void ast_fbdev_fini(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+
+ if (!ast->fbdev)
+ return;
+
+ ast_fbdev_destroy(dev, ast->fbdev);
+ kfree(ast->fbdev);
+ ast->fbdev = NULL;
+}
+
+void ast_fbdev_set_suspend(struct drm_device *dev, int state)
+{
+ struct ast_private *ast = dev->dev_private;
+
+ if (!ast->fbdev)
+ return;
+
+ fb_set_suspend(ast->fbdev->helper.fbdev, state);
+}
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
new file mode 100644
index 00000000..96f874a5
--- /dev/null
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -0,0 +1,519 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie
+ */
+#include
+#include "ast_drv.h"
+
+
+#include
+#include
+
+#include "ast_dram_tables.h"
+
+void ast_set_index_reg_mask(struct ast_private *ast,
+ uint32_t base, uint8_t index,
+ uint8_t mask, uint8_t val)
+{
+ u8 tmp;
+ ast_io_write8(ast, base, index);
+ tmp = (ast_io_read8(ast, base + 1) & mask) | val;
+ ast_set_index_reg(ast, base, index, tmp);
+}
+
+uint8_t ast_get_index_reg(struct ast_private *ast,
+ uint32_t base, uint8_t index)
+{
+ uint8_t ret;
+ ast_io_write8(ast, base, index);
+ ret = ast_io_read8(ast, base + 1);
+ return ret;
+}
+
+uint8_t ast_get_index_reg_mask(struct ast_private *ast,
+ uint32_t base, uint8_t index, uint8_t mask)
+{
+ uint8_t ret;
+ ast_io_write8(ast, base, index);
+ ret = ast_io_read8(ast, base + 1) & mask;
+ return ret;
+}
+
+
+static int ast_detect_chip(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+
+ if (dev->pdev->device == PCI_CHIP_AST1180) {
+ ast->chip = AST1100;
+ DRM_INFO("AST 1180 detected\n");
+ } else {
+ if (dev->pdev->revision >= 0x20) {
+ ast->chip = AST2300;
+ DRM_INFO("AST 2300 detected\n");
+ } else if (dev->pdev->revision >= 0x10) {
+ uint32_t data;
+ ast_write32(ast, 0xf004, 0x1e6e0000);
+ ast_write32(ast, 0xf000, 0x1);
+
+ data = ast_read32(ast, 0x1207c);
+ switch (data & 0x0300) {
+ case 0x0200:
+ ast->chip = AST1100;
+ DRM_INFO("AST 1100 detected\n");
+ break;
+ case 0x0100:
+ ast->chip = AST2200;
+ DRM_INFO("AST 2200 detected\n");
+ break;
+ case 0x0000:
+ ast->chip = AST2150;
+ DRM_INFO("AST 2150 detected\n");
+ break;
+ default:
+ ast->chip = AST2100;
+ DRM_INFO("AST 2100 detected\n");
+ break;
+ }
+ ast->vga2_clone = false;
+ } else {
+ ast->chip = AST2000;
+ DRM_INFO("AST 2000 detected\n");
+ }
+ }
+ return 0;
+}
+
+static int ast_get_dram_info(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+ uint32_t data, data2;
+ uint32_t denum, num, div, ref_pll;
+
+ ast_write32(ast, 0xf004, 0x1e6e0000);
+ ast_write32(ast, 0xf000, 0x1);
+
+
+ ast_write32(ast, 0x10000, 0xfc600309);
+
+ do {
+ ;
+ } while (ast_read32(ast, 0x10000) != 0x01);
+ data = ast_read32(ast, 0x10004);
+
+ if (data & 0x400)
+ ast->dram_bus_width = 16;
+ else
+ ast->dram_bus_width = 32;
+
+ if (ast->chip == AST2300) {
+ switch (data & 0x03) {
+ case 0:
+ ast->dram_type = AST_DRAM_512Mx16;
+ break;
+ default:
+ case 1:
+ ast->dram_type = AST_DRAM_1Gx16;
+ break;
+ case 2:
+ ast->dram_type = AST_DRAM_2Gx16;
+ break;
+ case 3:
+ ast->dram_type = AST_DRAM_4Gx16;
+ break;
+ }
+ } else {
+ switch (data & 0x0c) {
+ case 0:
+ case 4:
+ ast->dram_type = AST_DRAM_512Mx16;
+ break;
+ case 8:
+ if (data & 0x40)
+ ast->dram_type = AST_DRAM_1Gx16;
+ else
+ ast->dram_type = AST_DRAM_512Mx32;
+ break;
+ case 0xc:
+ ast->dram_type = AST_DRAM_1Gx32;
+ break;
+ }
+ }
+
+ data = ast_read32(ast, 0x10120);
+ data2 = ast_read32(ast, 0x10170);
+ if (data2 & 0x2000)
+ ref_pll = 14318;
+ else
+ ref_pll = 12000;
+
+ denum = data & 0x1f;
+ num = (data & 0x3fe0) >> 5;
+ data = (data & 0xc000) >> 14;
+ switch (data) {
+ case 3:
+ div = 0x4;
+ break;
+ case 2:
+ case 1:
+ div = 0x2;
+ break;
+ default:
+ div = 0x1;
+ break;
+ }
+ ast->mclk = ref_pll * (num + 2) / (denum + 2) * (div * 1000);
+ return 0;
+}
+
+uint32_t ast_get_max_dclk(struct drm_device *dev, int bpp)
+{
+ struct ast_private *ast = dev->dev_private;
+ uint32_t dclk, jreg;
+ uint32_t dram_bus_width, mclk, dram_bandwidth, actual_dram_bandwidth, dram_efficency = 500;
+
+ dram_bus_width = ast->dram_bus_width;
+ mclk = ast->mclk;
+
+ if (ast->chip == AST2100 ||
+ ast->chip == AST1100 ||
+ ast->chip == AST2200 ||
+ ast->chip == AST2150 ||
+ ast->dram_bus_width == 16)
+ dram_efficency = 600;
+ else if (ast->chip == AST2300)
+ dram_efficency = 400;
+
+ dram_bandwidth = mclk * dram_bus_width * 2 / 8;
+ actual_dram_bandwidth = dram_bandwidth * dram_efficency / 1000;
+
+ if (ast->chip == AST1180)
+ dclk = actual_dram_bandwidth / ((bpp + 1) / 8);
+ else {
+ jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff);
+ if ((jreg & 0x08) && (ast->chip == AST2000))
+ dclk = actual_dram_bandwidth / ((bpp + 1 + 16) / 8);
+ else if ((jreg & 0x08) && (bpp == 8))
+ dclk = actual_dram_bandwidth / ((bpp + 1 + 24) / 8);
+ else
+ dclk = actual_dram_bandwidth / ((bpp + 1) / 8);
+ }
+
+ if (ast->chip == AST2100 ||
+ ast->chip == AST2200 ||
+ ast->chip == AST2300 ||
+ ast->chip == AST1180) {
+ if (dclk > 200)
+ dclk = 200;
+ } else {
+ if (dclk > 165)
+ dclk = 165;
+ }
+
+ return dclk;
+}
+
+static void ast_user_framebuffer_destroy(struct drm_framebuffer *fb)
+{
+ struct ast_framebuffer *ast_fb = to_ast_framebuffer(fb);
+ if (ast_fb->obj)
+ drm_gem_object_unreference_unlocked(ast_fb->obj);
+
+ drm_framebuffer_cleanup(fb);
+ kfree(fb);
+}
+
+static const struct drm_framebuffer_funcs ast_fb_funcs = {
+ .destroy = ast_user_framebuffer_destroy,
+};
+
+
+int ast_framebuffer_init(struct drm_device *dev,
+ struct ast_framebuffer *ast_fb,
+ struct drm_mode_fb_cmd2 *mode_cmd,
+ struct drm_gem_object *obj)
+{
+ int ret;
+
+ drm_helper_mode_fill_fb_struct(&ast_fb->base, mode_cmd);
+ ast_fb->obj = obj;
+ ret = drm_framebuffer_init(dev, &ast_fb->base, &ast_fb_funcs);
+ if (ret) {
+ DRM_ERROR("framebuffer init failed %d\n", ret);
+ return ret;
+ }
+ return 0;
+}
+
+static struct drm_framebuffer *
+ast_user_framebuffer_create(struct drm_device *dev,
+ struct drm_file *filp,
+ struct drm_mode_fb_cmd2 *mode_cmd)
+{
+ struct drm_gem_object *obj;
+ struct ast_framebuffer *ast_fb;
+ int ret;
+
+ obj = drm_gem_object_lookup(dev, filp, mode_cmd->handles[0]);
+ if (obj == NULL)
+ return ERR_PTR(-ENOENT);
+
+ ast_fb = kzalloc(sizeof(*ast_fb), GFP_KERNEL);
+ if (!ast_fb) {
+ drm_gem_object_unreference_unlocked(obj);
+ return ERR_PTR(-ENOMEM);
+ }
+
+ ret = ast_framebuffer_init(dev, ast_fb, mode_cmd, obj);
+ if (ret) {
+ drm_gem_object_unreference_unlocked(obj);
+ kfree(ast_fb);
+ return ERR_PTR(ret);
+ }
+ return &ast_fb->base;
+}
+
+static const struct drm_mode_config_funcs ast_mode_funcs = {
+ .fb_create = ast_user_framebuffer_create,
+};
+
+static u32 ast_get_vram_info(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+ u8 jreg;
+
+ ast_open_key(ast);
+
+ jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xaa, 0xff);
+ switch (jreg & 3) {
+ case 0: return AST_VIDMEM_SIZE_8M;
+ case 1: return AST_VIDMEM_SIZE_16M;
+ case 2: return AST_VIDMEM_SIZE_32M;
+ case 3: return AST_VIDMEM_SIZE_64M;
+ }
+ return AST_VIDMEM_DEFAULT_SIZE;
+}
+
+int ast_driver_load(struct drm_device *dev, unsigned long flags)
+{
+ struct ast_private *ast;
+ int ret = 0;
+
+ ast = kzalloc(sizeof(struct ast_private), GFP_KERNEL);
+ if (!ast)
+ return -ENOMEM;
+
+ dev->dev_private = ast;
+ ast->dev = dev;
+
+ ast->regs = pci_iomap(dev->pdev, 1, 0);
+ if (!ast->regs) {
+ ret = -EIO;
+ goto out_free;
+ }
+ ast->ioregs = pci_iomap(dev->pdev, 2, 0);
+ if (!ast->ioregs) {
+ ret = -EIO;
+ goto out_free;
+ }
+
+ ast_detect_chip(dev);
+
+ if (ast->chip != AST1180) {
+ ast_get_dram_info(dev);
+ ast->vram_size = ast_get_vram_info(dev);
+ DRM_INFO("dram %d %d %d %08x\n", ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size);
+ }
+
+ ret = ast_mm_init(ast);
+ if (ret)
+ goto out_free;
+
+ drm_mode_config_init(dev);
+
+ dev->mode_config.funcs = (void *)&ast_mode_funcs;
+ dev->mode_config.min_width = 0;
+ dev->mode_config.min_height = 0;
+ dev->mode_config.preferred_depth = 24;
+ dev->mode_config.prefer_shadow = 1;
+
+ if (ast->chip == AST2100 ||
+ ast->chip == AST2200 ||
+ ast->chip == AST2300 ||
+ ast->chip == AST1180) {
+ dev->mode_config.max_width = 1920;
+ dev->mode_config.max_height = 2048;
+ } else {
+ dev->mode_config.max_width = 1600;
+ dev->mode_config.max_height = 1200;
+ }
+
+ ret = ast_mode_init(dev);
+ if (ret)
+ goto out_free;
+
+ ret = ast_fbdev_init(dev);
+ if (ret)
+ goto out_free;
+
+ return 0;
+out_free:
+ kfree(ast);
+ dev->dev_private = NULL;
+ return ret;
+}
+
+int ast_driver_unload(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+
+ ast_mode_fini(dev);
+ ast_fbdev_fini(dev);
+ drm_mode_config_cleanup(dev);
+
+ ast_mm_fini(ast);
+ pci_iounmap(dev->pdev, ast->ioregs);
+ pci_iounmap(dev->pdev, ast->regs);
+ kfree(ast);
+ return 0;
+}
+
+int ast_gem_create(struct drm_device *dev,
+ u32 size, bool iskernel,
+ struct drm_gem_object **obj)
+{
+ struct ast_bo *astbo;
+ int ret;
+
+ *obj = NULL;
+
+ size = roundup(size, PAGE_SIZE);
+ if (size == 0)
+ return -EINVAL;
+
+ ret = ast_bo_create(dev, size, 0, 0, &astbo);
+ if (ret) {
+ if (ret != -ERESTARTSYS)
+ DRM_ERROR("failed to allocate GEM object\n");
+ return ret;
+ }
+ *obj = &astbo->gem;
+ return 0;
+}
+
+int ast_dumb_create(struct drm_file *file,
+ struct drm_device *dev,
+ struct drm_mode_create_dumb *args)
+{
+ int ret;
+ struct drm_gem_object *gobj;
+ u32 handle;
+
+ args->pitch = args->width * ((args->bpp + 7) / 8);
+ args->size = args->pitch * args->height;
+
+ ret = ast_gem_create(dev, args->size, false,
+ &gobj);
+ if (ret)
+ return ret;
+
+ ret = drm_gem_handle_create(file, gobj, &handle);
+ drm_gem_object_unreference_unlocked(gobj);
+ if (ret)
+ return ret;
+
+ args->handle = handle;
+ return 0;
+}
+
+int ast_dumb_destroy(struct drm_file *file,
+ struct drm_device *dev,
+ uint32_t handle)
+{
+ return drm_gem_handle_delete(file, handle);
+}
+
+int ast_gem_init_object(struct drm_gem_object *obj)
+{
+ BUG();
+ return 0;
+}
+
+void ast_bo_unref(struct ast_bo **bo)
+{
+ struct ttm_buffer_object *tbo;
+
+ if ((*bo) == NULL)
+ return;
+
+ tbo = &((*bo)->bo);
+ ttm_bo_unref(&tbo);
+ if (tbo == NULL)
+ *bo = NULL;
+
+}
+void ast_gem_free_object(struct drm_gem_object *obj)
+{
+ struct ast_bo *ast_bo = gem_to_ast_bo(obj);
+
+ if (!ast_bo)
+ return;
+ ast_bo_unref(&ast_bo);
+}
+
+
+static inline u64 ast_bo_mmap_offset(struct ast_bo *bo)
+{
+ return bo->bo.addr_space_offset;
+}
+int
+ast_dumb_mmap_offset(struct drm_file *file,
+ struct drm_device *dev,
+ uint32_t handle,
+ uint64_t *offset)
+{
+ struct drm_gem_object *obj;
+ int ret;
+ struct ast_bo *bo;
+
+ mutex_lock(&dev->struct_mutex);
+ obj = drm_gem_object_lookup(dev, file, handle);
+ if (obj == NULL) {
+ ret = -ENOENT;
+ goto out_unlock;
+ }
+
+ bo = gem_to_ast_bo(obj);
+ *offset = ast_bo_mmap_offset(bo);
+
+ drm_gem_object_unreference(obj);
+ ret = 0;
+out_unlock:
+ mutex_unlock(&dev->struct_mutex);
+ return ret;
+
+}
+
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
new file mode 100644
index 00000000..e8f6418b
--- /dev/null
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -0,0 +1,1160 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ * Parts based on xf86-video-ast
+ * Copyright (c) 2005 ASPEED Technology Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie
+ */
+#include
+#include
+#include
+#include
+#include "ast_drv.h"
+
+#include "ast_tables.h"
+
+static struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev);
+static void ast_i2c_destroy(struct ast_i2c_chan *i2c);
+static int ast_cursor_set(struct drm_crtc *crtc,
+ struct drm_file *file_priv,
+ uint32_t handle,
+ uint32_t width,
+ uint32_t height);
+static int ast_cursor_move(struct drm_crtc *crtc,
+ int x, int y);
+
+static inline void ast_load_palette_index(struct ast_private *ast,
+ u8 index, u8 red, u8 green,
+ u8 blue)
+{
+ ast_io_write8(ast, AST_IO_DAC_INDEX_WRITE, index);
+ ast_io_read8(ast, AST_IO_SEQ_PORT);
+ ast_io_write8(ast, AST_IO_DAC_DATA, red);
+ ast_io_read8(ast, AST_IO_SEQ_PORT);
+ ast_io_write8(ast, AST_IO_DAC_DATA, green);
+ ast_io_read8(ast, AST_IO_SEQ_PORT);
+ ast_io_write8(ast, AST_IO_DAC_DATA, blue);
+ ast_io_read8(ast, AST_IO_SEQ_PORT);
+}
+
+static void ast_crtc_load_lut(struct drm_crtc *crtc)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
+ int i;
+
+ if (!crtc->enabled)
+ return;
+
+ for (i = 0; i < 256; i++)
+ ast_load_palette_index(ast, i, ast_crtc->lut_r[i],
+ ast_crtc->lut_g[i], ast_crtc->lut_b[i]);
+}
+
+static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode,
+ struct ast_vbios_mode_info *vbios_mode)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ u32 refresh_rate_index = 0, mode_id, color_index, refresh_rate;
+ u32 hborder, vborder;
+
+ switch (crtc->fb->bits_per_pixel) {
+ case 8:
+ vbios_mode->std_table = &vbios_stdtable[VGAModeIndex];
+ color_index = VGAModeIndex - 1;
+ break;
+ case 16:
+ vbios_mode->std_table = &vbios_stdtable[HiCModeIndex];
+ color_index = HiCModeIndex;
+ break;
+ case 24:
+ case 32:
+ vbios_mode->std_table = &vbios_stdtable[TrueCModeIndex];
+ color_index = TrueCModeIndex;
+ break;
+ default:
+ return false;
+ }
+
+ switch (crtc->mode.crtc_hdisplay) {
+ case 640:
+ vbios_mode->enh_table = &res_640x480[refresh_rate_index];
+ break;
+ case 800:
+ vbios_mode->enh_table = &res_800x600[refresh_rate_index];
+ break;
+ case 1024:
+ vbios_mode->enh_table = &res_1024x768[refresh_rate_index];
+ break;
+ case 1280:
+ if (crtc->mode.crtc_vdisplay == 800)
+ vbios_mode->enh_table = &res_1280x800[refresh_rate_index];
+ else
+ vbios_mode->enh_table = &res_1280x1024[refresh_rate_index];
+ break;
+ case 1440:
+ vbios_mode->enh_table = &res_1440x900[refresh_rate_index];
+ break;
+ case 1600:
+ vbios_mode->enh_table = &res_1600x1200[refresh_rate_index];
+ break;
+ case 1680:
+ vbios_mode->enh_table = &res_1680x1050[refresh_rate_index];
+ break;
+ case 1920:
+ if (crtc->mode.crtc_vdisplay == 1080)
+ vbios_mode->enh_table = &res_1920x1080[refresh_rate_index];
+ else
+ vbios_mode->enh_table = &res_1920x1200[refresh_rate_index];
+ break;
+ default:
+ return false;
+ }
+
+ refresh_rate = drm_mode_vrefresh(mode);
+ while (vbios_mode->enh_table->refresh_rate < refresh_rate) {
+ vbios_mode->enh_table++;
+ if ((vbios_mode->enh_table->refresh_rate > refresh_rate) ||
+ (vbios_mode->enh_table->refresh_rate == 0xff)) {
+ vbios_mode->enh_table--;
+ break;
+ }
+ }
+
+ hborder = (vbios_mode->enh_table->flags & HBorder) ? 8 : 0;
+ vborder = (vbios_mode->enh_table->flags & VBorder) ? 8 : 0;
+
+ adjusted_mode->crtc_htotal = vbios_mode->enh_table->ht;
+ adjusted_mode->crtc_hblank_start = vbios_mode->enh_table->hde + hborder;
+ adjusted_mode->crtc_hblank_end = vbios_mode->enh_table->ht - hborder;
+ adjusted_mode->crtc_hsync_start = vbios_mode->enh_table->hde + hborder +
+ vbios_mode->enh_table->hfp;
+ adjusted_mode->crtc_hsync_end = (vbios_mode->enh_table->hde + hborder +
+ vbios_mode->enh_table->hfp +
+ vbios_mode->enh_table->hsync);
+
+ adjusted_mode->crtc_vtotal = vbios_mode->enh_table->vt;
+ adjusted_mode->crtc_vblank_start = vbios_mode->enh_table->vde + vborder;
+ adjusted_mode->crtc_vblank_end = vbios_mode->enh_table->vt - vborder;
+ adjusted_mode->crtc_vsync_start = vbios_mode->enh_table->vde + vborder +
+ vbios_mode->enh_table->vfp;
+ adjusted_mode->crtc_vsync_end = (vbios_mode->enh_table->vde + vborder +
+ vbios_mode->enh_table->vfp +
+ vbios_mode->enh_table->vsync);
+
+ refresh_rate_index = vbios_mode->enh_table->refresh_rate_index;
+ mode_id = vbios_mode->enh_table->mode_id;
+
+ if (ast->chip == AST1180) {
+ /* TODO 1180 */
+ } else {
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8c, (u8)((color_index & 0xf) << 4));
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8d, refresh_rate_index & 0xff);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8e, mode_id & 0xff);
+
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0xa8);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x92, crtc->fb->bits_per_pixel);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x93, adjusted_mode->clock / 1000);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x94, adjusted_mode->crtc_hdisplay);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x95, adjusted_mode->crtc_hdisplay >> 8);
+
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x96, adjusted_mode->crtc_vdisplay);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x97, adjusted_mode->crtc_vdisplay >> 8);
+ }
+
+ return true;
+
+
+}
+static void ast_set_std_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
+ struct ast_vbios_mode_info *vbios_mode)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ struct ast_vbios_stdtable *stdtable;
+ u32 i;
+ u8 jreg;
+
+ stdtable = vbios_mode->std_table;
+
+ jreg = stdtable->misc;
+ ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg);
+
+ /* Set SEQ */
+ ast_set_index_reg(ast, AST_IO_SEQ_PORT, 0x00, 0x03);
+ for (i = 0; i < 4; i++) {
+ jreg = stdtable->seq[i];
+ if (!i)
+ jreg |= 0x20;
+ ast_set_index_reg(ast, AST_IO_SEQ_PORT, (i + 1) , jreg);
+ }
+
+ /* Set CRTC */
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00);
+ for (i = 0; i < 25; i++)
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, stdtable->crtc[i]);
+
+ /* set AR */
+ jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ);
+ for (i = 0; i < 20; i++) {
+ jreg = stdtable->ar[i];
+ ast_io_write8(ast, AST_IO_AR_PORT_WRITE, (u8)i);
+ ast_io_write8(ast, AST_IO_AR_PORT_WRITE, jreg);
+ }
+ ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x14);
+ ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x00);
+
+ jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ);
+ ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x20);
+
+ /* Set GR */
+ for (i = 0; i < 9; i++)
+ ast_set_index_reg(ast, AST_IO_GR_PORT, i, stdtable->gr[i]);
+}
+
+static void ast_set_crtc_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
+ struct ast_vbios_mode_info *vbios_mode)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0;
+ u16 temp;
+
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00);
+
+ temp = (mode->crtc_htotal >> 3) - 5;
+ if (temp & 0x100)
+ jregAC |= 0x01; /* HT D[8] */
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x00, 0x00, temp);
+
+ temp = (mode->crtc_hdisplay >> 3) - 1;
+ if (temp & 0x100)
+ jregAC |= 0x04; /* HDE D[8] */
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x01, 0x00, temp);
+
+ temp = (mode->crtc_hblank_start >> 3) - 1;
+ if (temp & 0x100)
+ jregAC |= 0x10; /* HBS D[8] */
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x02, 0x00, temp);
+
+ temp = ((mode->crtc_hblank_end >> 3) - 1) & 0x7f;
+ if (temp & 0x20)
+ jreg05 |= 0x80; /* HBE D[5] */
+ if (temp & 0x40)
+ jregAD |= 0x01; /* HBE D[5] */
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x03, 0xE0, (temp & 0x1f));
+
+ temp = (mode->crtc_hsync_start >> 3) - 1;
+ if (temp & 0x100)
+ jregAC |= 0x40; /* HRS D[5] */
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x04, 0x00, temp);
+
+ temp = ((mode->crtc_hsync_end >> 3) - 1) & 0x3f;
+ if (temp & 0x20)
+ jregAD |= 0x04; /* HRE D[5] */
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x05, 0x60, (u8)((temp & 0x1f) | jreg05));
+
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAC, 0x00, jregAC);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAD, 0x00, jregAD);
+
+ /* vert timings */
+ temp = (mode->crtc_vtotal) - 2;
+ if (temp & 0x100)
+ jreg07 |= 0x01;
+ if (temp & 0x200)
+ jreg07 |= 0x20;
+ if (temp & 0x400)
+ jregAE |= 0x01;
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x06, 0x00, temp);
+
+ temp = (mode->crtc_vsync_start) - 1;
+ if (temp & 0x100)
+ jreg07 |= 0x04;
+ if (temp & 0x200)
+ jreg07 |= 0x80;
+ if (temp & 0x400)
+ jregAE |= 0x08;
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x10, 0x00, temp);
+
+ temp = (mode->crtc_vsync_end - 1) & 0x3f;
+ if (temp & 0x10)
+ jregAE |= 0x20;
+ if (temp & 0x20)
+ jregAE |= 0x40;
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x70, temp & 0xf);
+
+ temp = mode->crtc_vdisplay - 1;
+ if (temp & 0x100)
+ jreg07 |= 0x02;
+ if (temp & 0x200)
+ jreg07 |= 0x40;
+ if (temp & 0x400)
+ jregAE |= 0x02;
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x12, 0x00, temp);
+
+ temp = mode->crtc_vblank_start - 1;
+ if (temp & 0x100)
+ jreg07 |= 0x08;
+ if (temp & 0x200)
+ jreg09 |= 0x20;
+ if (temp & 0x400)
+ jregAE |= 0x04;
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x15, 0x00, temp);
+
+ temp = mode->crtc_vblank_end - 1;
+ if (temp & 0x100)
+ jregAE |= 0x10;
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x16, 0x00, temp);
+
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x07, 0x00, jreg07);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x09, 0xdf, jreg09);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAE, 0x00, (jregAE | 0x80));
+
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x80);
+}
+
+static void ast_set_offset_reg(struct drm_crtc *crtc)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+
+ u16 offset;
+
+ offset = crtc->fb->pitches[0] >> 3;
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x13, (offset & 0xff));
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xb0, (offset >> 8) & 0x3f);
+}
+
+static void ast_set_dclk_reg(struct drm_device *dev, struct drm_display_mode *mode,
+ struct ast_vbios_mode_info *vbios_mode)
+{
+ struct ast_private *ast = dev->dev_private;
+ struct ast_vbios_dclk_info *clk_info;
+
+ clk_info = &dclk_table[vbios_mode->enh_table->dclk_index];
+
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc0, 0x00, clk_info->param1);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc1, 0x00, clk_info->param2);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xbb, 0x0f,
+ (clk_info->param3 & 0x80) | ((clk_info->param3 & 0x3) << 4));
+}
+
+static void ast_set_ext_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
+ struct ast_vbios_mode_info *vbios_mode)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ u8 jregA0 = 0, jregA3 = 0, jregA8 = 0;
+
+ switch (crtc->fb->bits_per_pixel) {
+ case 8:
+ jregA0 = 0x70;
+ jregA3 = 0x01;
+ jregA8 = 0x00;
+ break;
+ case 15:
+ case 16:
+ jregA0 = 0x70;
+ jregA3 = 0x04;
+ jregA8 = 0x02;
+ break;
+ case 32:
+ jregA0 = 0x70;
+ jregA3 = 0x08;
+ jregA8 = 0x02;
+ break;
+ }
+
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa0, 0x8f, jregA0);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xf0, jregA3);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa8, 0xfd, jregA8);
+
+ /* Set Threshold */
+ if (ast->chip == AST2300) {
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60);
+ } else if (ast->chip == AST2100 ||
+ ast->chip == AST1100 ||
+ ast->chip == AST2200 ||
+ ast->chip == AST2150) {
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x3f);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x2f);
+ } else {
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x2f);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x1f);
+ }
+}
+
+void ast_set_sync_reg(struct drm_device *dev, struct drm_display_mode *mode,
+ struct ast_vbios_mode_info *vbios_mode)
+{
+ struct ast_private *ast = dev->dev_private;
+ u8 jreg;
+
+ jreg = ast_io_read8(ast, AST_IO_MISC_PORT_READ);
+ jreg |= (vbios_mode->enh_table->flags & SyncNN);
+ ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg);
+}
+
+bool ast_set_dac_reg(struct drm_crtc *crtc, struct drm_display_mode *mode,
+ struct ast_vbios_mode_info *vbios_mode)
+{
+ switch (crtc->fb->bits_per_pixel) {
+ case 8:
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+void ast_set_start_address_crt1(struct drm_crtc *crtc, unsigned offset)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ u32 addr;
+
+ addr = offset >> 2;
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0d, (u8)(addr & 0xff));
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0c, (u8)((addr >> 8) & 0xff));
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xaf, (u8)((addr >> 16) & 0xff));
+
+}
+
+static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+
+ if (ast->chip == AST1180)
+ return;
+
+ switch (mode) {
+ case DRM_MODE_DPMS_ON:
+ case DRM_MODE_DPMS_STANDBY:
+ case DRM_MODE_DPMS_SUSPEND:
+ ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0);
+ ast_crtc_load_lut(crtc);
+ break;
+ case DRM_MODE_DPMS_OFF:
+ ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0x20);
+ break;
+ }
+}
+
+static bool ast_crtc_mode_fixup(struct drm_crtc *crtc,
+ const struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode)
+{
+ return true;
+}
+
+/* ast is different - we will force move buffers out of VRAM */
+static int ast_crtc_do_set_base(struct drm_crtc *crtc,
+ struct drm_framebuffer *fb,
+ int x, int y, int atomic)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ struct drm_gem_object *obj;
+ struct ast_framebuffer *ast_fb;
+ struct ast_bo *bo;
+ int ret;
+ u64 gpu_addr;
+
+ /* push the previous fb to system ram */
+ if (!atomic && fb) {
+ ast_fb = to_ast_framebuffer(fb);
+ obj = ast_fb->obj;
+ bo = gem_to_ast_bo(obj);
+ ret = ast_bo_reserve(bo, false);
+ if (ret)
+ return ret;
+ ast_bo_push_sysram(bo);
+ ast_bo_unreserve(bo);
+ }
+
+ ast_fb = to_ast_framebuffer(crtc->fb);
+ obj = ast_fb->obj;
+ bo = gem_to_ast_bo(obj);
+
+ ret = ast_bo_reserve(bo, false);
+ if (ret)
+ return ret;
+
+ ret = ast_bo_pin(bo, TTM_PL_FLAG_VRAM, &gpu_addr);
+ if (ret) {
+ ast_bo_unreserve(bo);
+ return ret;
+ }
+
+ if (&ast->fbdev->afb == ast_fb) {
+ /* if pushing console in kmap it */
+ ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
+ if (ret)
+ DRM_ERROR("failed to kmap fbcon\n");
+ }
+ ast_bo_unreserve(bo);
+
+ ast_set_start_address_crt1(crtc, (u32)gpu_addr);
+
+ return 0;
+}
+
+static int ast_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
+ struct drm_framebuffer *old_fb)
+{
+ return ast_crtc_do_set_base(crtc, old_fb, x, y, 0);
+}
+
+static int ast_crtc_mode_set(struct drm_crtc *crtc,
+ struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode,
+ int x, int y,
+ struct drm_framebuffer *old_fb)
+{
+ struct drm_device *dev = crtc->dev;
+ struct ast_private *ast = crtc->dev->dev_private;
+ struct ast_vbios_mode_info vbios_mode;
+ bool ret;
+ if (ast->chip == AST1180) {
+ DRM_ERROR("AST 1180 modesetting not supported\n");
+ return -EINVAL;
+ }
+
+ ret = ast_get_vbios_mode_info(crtc, mode, adjusted_mode, &vbios_mode);
+ if (ret == false)
+ return -EINVAL;
+ ast_open_key(ast);
+
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04);
+
+ ast_set_std_reg(crtc, adjusted_mode, &vbios_mode);
+ ast_set_crtc_reg(crtc, adjusted_mode, &vbios_mode);
+ ast_set_offset_reg(crtc);
+ ast_set_dclk_reg(dev, adjusted_mode, &vbios_mode);
+ ast_set_ext_reg(crtc, adjusted_mode, &vbios_mode);
+ ast_set_sync_reg(dev, adjusted_mode, &vbios_mode);
+ ast_set_dac_reg(crtc, adjusted_mode, &vbios_mode);
+
+ ast_crtc_mode_set_base(crtc, x, y, old_fb);
+
+ return 0;
+}
+
+static void ast_crtc_disable(struct drm_crtc *crtc)
+{
+
+}
+
+static void ast_crtc_prepare(struct drm_crtc *crtc)
+{
+
+}
+
+static void ast_crtc_commit(struct drm_crtc *crtc)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0);
+}
+
+
+static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = {
+ .dpms = ast_crtc_dpms,
+ .mode_fixup = ast_crtc_mode_fixup,
+ .mode_set = ast_crtc_mode_set,
+ .mode_set_base = ast_crtc_mode_set_base,
+ .disable = ast_crtc_disable,
+ .load_lut = ast_crtc_load_lut,
+ .prepare = ast_crtc_prepare,
+ .commit = ast_crtc_commit,
+
+};
+
+static void ast_crtc_reset(struct drm_crtc *crtc)
+{
+
+}
+
+static void ast_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
+ u16 *blue, uint32_t start, uint32_t size)
+{
+ struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
+ int end = (start + size > 256) ? 256 : start + size, i;
+
+ /* userspace palettes are always correct as is */
+ for (i = start; i < end; i++) {
+ ast_crtc->lut_r[i] = red[i] >> 8;
+ ast_crtc->lut_g[i] = green[i] >> 8;
+ ast_crtc->lut_b[i] = blue[i] >> 8;
+ }
+ ast_crtc_load_lut(crtc);
+}
+
+
+static void ast_crtc_destroy(struct drm_crtc *crtc)
+{
+ drm_crtc_cleanup(crtc);
+ kfree(crtc);
+}
+
+static const struct drm_crtc_funcs ast_crtc_funcs = {
+ .cursor_set = ast_cursor_set,
+ .cursor_move = ast_cursor_move,
+ .reset = ast_crtc_reset,
+ .set_config = drm_crtc_helper_set_config,
+ .gamma_set = ast_crtc_gamma_set,
+ .destroy = ast_crtc_destroy,
+};
+
+int ast_crtc_init(struct drm_device *dev)
+{
+ struct ast_crtc *crtc;
+ int i;
+
+ crtc = kzalloc(sizeof(struct ast_crtc), GFP_KERNEL);
+ if (!crtc)
+ return -ENOMEM;
+
+ drm_crtc_init(dev, &crtc->base, &ast_crtc_funcs);
+ drm_mode_crtc_set_gamma_size(&crtc->base, 256);
+ drm_crtc_helper_add(&crtc->base, &ast_crtc_helper_funcs);
+
+ for (i = 0; i < 256; i++) {
+ crtc->lut_r[i] = i;
+ crtc->lut_g[i] = i;
+ crtc->lut_b[i] = i;
+ }
+ return 0;
+}
+
+static void ast_encoder_destroy(struct drm_encoder *encoder)
+{
+ drm_encoder_cleanup(encoder);
+ kfree(encoder);
+}
+
+
+static struct drm_encoder *ast_best_single_encoder(struct drm_connector *connector)
+{
+ int enc_id = connector->encoder_ids[0];
+ struct drm_mode_object *obj;
+ struct drm_encoder *encoder;
+
+ /* pick the encoder ids */
+ if (enc_id) {
+ obj = drm_mode_object_find(connector->dev, enc_id, DRM_MODE_OBJECT_ENCODER);
+ if (!obj)
+ return NULL;
+ encoder = obj_to_encoder(obj);
+ return encoder;
+ }
+ return NULL;
+}
+
+
+static const struct drm_encoder_funcs ast_enc_funcs = {
+ .destroy = ast_encoder_destroy,
+};
+
+static void ast_encoder_dpms(struct drm_encoder *encoder, int mode)
+{
+
+}
+
+static bool ast_mode_fixup(struct drm_encoder *encoder,
+ const struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode)
+{
+ return true;
+}
+
+static void ast_encoder_mode_set(struct drm_encoder *encoder,
+ struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode)
+{
+}
+
+static void ast_encoder_prepare(struct drm_encoder *encoder)
+{
+
+}
+
+static void ast_encoder_commit(struct drm_encoder *encoder)
+{
+
+}
+
+
+static const struct drm_encoder_helper_funcs ast_enc_helper_funcs = {
+ .dpms = ast_encoder_dpms,
+ .mode_fixup = ast_mode_fixup,
+ .prepare = ast_encoder_prepare,
+ .commit = ast_encoder_commit,
+ .mode_set = ast_encoder_mode_set,
+};
+
+int ast_encoder_init(struct drm_device *dev)
+{
+ struct ast_encoder *ast_encoder;
+
+ ast_encoder = kzalloc(sizeof(struct ast_encoder), GFP_KERNEL);
+ if (!ast_encoder)
+ return -ENOMEM;
+
+ drm_encoder_init(dev, &ast_encoder->base, &ast_enc_funcs,
+ DRM_MODE_ENCODER_DAC);
+ drm_encoder_helper_add(&ast_encoder->base, &ast_enc_helper_funcs);
+
+ ast_encoder->base.possible_crtcs = 1;
+ return 0;
+}
+
+static int ast_get_modes(struct drm_connector *connector)
+{
+ struct ast_connector *ast_connector = to_ast_connector(connector);
+ struct edid *edid;
+ int ret;
+
+ edid = drm_get_edid(connector, &ast_connector->i2c->adapter);
+ if (edid) {
+ drm_mode_connector_update_edid_property(&ast_connector->base, edid);
+ ret = drm_add_edid_modes(connector, edid);
+ kfree(edid);
+ return ret;
+ } else
+ drm_mode_connector_update_edid_property(&ast_connector->base, NULL);
+ return 0;
+}
+
+static int ast_mode_valid(struct drm_connector *connector,
+ struct drm_display_mode *mode)
+{
+ return MODE_OK;
+}
+
+static void ast_connector_destroy(struct drm_connector *connector)
+{
+ struct ast_connector *ast_connector = to_ast_connector(connector);
+ ast_i2c_destroy(ast_connector->i2c);
+ drm_sysfs_connector_remove(connector);
+ drm_connector_cleanup(connector);
+ kfree(connector);
+}
+
+static enum drm_connector_status
+ast_connector_detect(struct drm_connector *connector, bool force)
+{
+ return connector_status_connected;
+}
+
+static const struct drm_connector_helper_funcs ast_connector_helper_funcs = {
+ .mode_valid = ast_mode_valid,
+ .get_modes = ast_get_modes,
+ .best_encoder = ast_best_single_encoder,
+};
+
+static const struct drm_connector_funcs ast_connector_funcs = {
+ .dpms = drm_helper_connector_dpms,
+ .detect = ast_connector_detect,
+ .fill_modes = drm_helper_probe_single_connector_modes,
+ .destroy = ast_connector_destroy,
+};
+
+int ast_connector_init(struct drm_device *dev)
+{
+ struct ast_connector *ast_connector;
+ struct drm_connector *connector;
+ struct drm_encoder *encoder;
+
+ ast_connector = kzalloc(sizeof(struct ast_connector), GFP_KERNEL);
+ if (!ast_connector)
+ return -ENOMEM;
+
+ connector = &ast_connector->base;
+ drm_connector_init(dev, connector, &ast_connector_funcs, DRM_MODE_CONNECTOR_VGA);
+
+ drm_connector_helper_add(connector, &ast_connector_helper_funcs);
+
+ connector->interlace_allowed = 0;
+ connector->doublescan_allowed = 0;
+
+ drm_sysfs_connector_add(connector);
+
+ connector->polled = DRM_CONNECTOR_POLL_CONNECT;
+
+ encoder = list_first_entry(&dev->mode_config.encoder_list, struct drm_encoder, head);
+ drm_mode_connector_attach_encoder(connector, encoder);
+
+ ast_connector->i2c = ast_i2c_create(dev);
+ if (!ast_connector->i2c)
+ DRM_ERROR("failed to add ddc bus for connector\n");
+
+ return 0;
+}
+
+/* allocate cursor cache and pin at start of VRAM */
+int ast_cursor_init(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+ int size;
+ int ret;
+ struct drm_gem_object *obj;
+ struct ast_bo *bo;
+ uint64_t gpu_addr;
+
+ size = (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE) * AST_DEFAULT_HWC_NUM;
+
+ ret = ast_gem_create(dev, size, true, &obj);
+ if (ret)
+ return ret;
+ bo = gem_to_ast_bo(obj);
+ ret = ast_bo_reserve(bo, false);
+ if (unlikely(ret != 0))
+ goto fail;
+
+ ret = ast_bo_pin(bo, TTM_PL_FLAG_VRAM, &gpu_addr);
+ ast_bo_unreserve(bo);
+ if (ret)
+ goto fail;
+
+ /* kmap the object */
+ ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &ast->cache_kmap);
+ if (ret)
+ goto fail;
+
+ ast->cursor_cache = obj;
+ ast->cursor_cache_gpu_addr = gpu_addr;
+ DRM_DEBUG_KMS("pinned cursor cache at %llx\n", ast->cursor_cache_gpu_addr);
+ return 0;
+fail:
+ return ret;
+}
+
+void ast_cursor_fini(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+ ttm_bo_kunmap(&ast->cache_kmap);
+ drm_gem_object_unreference_unlocked(ast->cursor_cache);
+}
+
+int ast_mode_init(struct drm_device *dev)
+{
+ ast_cursor_init(dev);
+ ast_crtc_init(dev);
+ ast_encoder_init(dev);
+ ast_connector_init(dev);
+ return 0;
+}
+
+void ast_mode_fini(struct drm_device *dev)
+{
+ ast_cursor_fini(dev);
+}
+
+static int get_clock(void *i2c_priv)
+{
+ struct ast_i2c_chan *i2c = i2c_priv;
+ struct ast_private *ast = i2c->dev->dev_private;
+ uint32_t val;
+
+ val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4;
+ return val & 1 ? 1 : 0;
+}
+
+static int get_data(void *i2c_priv)
+{
+ struct ast_i2c_chan *i2c = i2c_priv;
+ struct ast_private *ast = i2c->dev->dev_private;
+ uint32_t val;
+
+ val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5;
+ return val & 1 ? 1 : 0;
+}
+
+static void set_clock(void *i2c_priv, int clock)
+{
+ struct ast_i2c_chan *i2c = i2c_priv;
+ struct ast_private *ast = i2c->dev->dev_private;
+ int i;
+ u8 ujcrb7, jtemp;
+
+ for (i = 0; i < 0x10000; i++) {
+ ujcrb7 = ((clock & 0x01) ? 0 : 1);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfe, ujcrb7);
+ jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x01);
+ if (ujcrb7 == jtemp)
+ break;
+ }
+}
+
+static void set_data(void *i2c_priv, int data)
+{
+ struct ast_i2c_chan *i2c = i2c_priv;
+ struct ast_private *ast = i2c->dev->dev_private;
+ int i;
+ u8 ujcrb7, jtemp;
+
+ for (i = 0; i < 0x10000; i++) {
+ ujcrb7 = ((data & 0x01) ? 0 : 1) << 2;
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfb, ujcrb7);
+ jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x04);
+ if (ujcrb7 == jtemp)
+ break;
+ }
+}
+
+static struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev)
+{
+ struct ast_i2c_chan *i2c;
+ int ret;
+
+ i2c = kzalloc(sizeof(struct ast_i2c_chan), GFP_KERNEL);
+ if (!i2c)
+ return NULL;
+
+ i2c->adapter.owner = THIS_MODULE;
+ i2c->adapter.class = I2C_CLASS_DDC;
+ i2c->adapter.dev.parent = &dev->pdev->dev;
+ i2c->dev = dev;
+ i2c_set_adapdata(&i2c->adapter, i2c);
+ snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
+ "AST i2c bit bus");
+ i2c->adapter.algo_data = &i2c->bit;
+
+ i2c->bit.udelay = 20;
+ i2c->bit.timeout = 2;
+ i2c->bit.data = i2c;
+ i2c->bit.setsda = set_data;
+ i2c->bit.setscl = set_clock;
+ i2c->bit.getsda = get_data;
+ i2c->bit.getscl = get_clock;
+ ret = i2c_bit_add_bus(&i2c->adapter);
+ if (ret) {
+ DRM_ERROR("Failed to register bit i2c\n");
+ goto out_free;
+ }
+
+ return i2c;
+out_free:
+ kfree(i2c);
+ return NULL;
+}
+
+static void ast_i2c_destroy(struct ast_i2c_chan *i2c)
+{
+ if (!i2c)
+ return;
+ i2c_del_adapter(&i2c->adapter);
+ kfree(i2c);
+}
+
+void ast_show_cursor(struct drm_crtc *crtc)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ u8 jreg;
+
+ jreg = 0x2;
+ /* enable ARGB cursor */
+ jreg |= 1;
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, jreg);
+}
+
+void ast_hide_cursor(struct drm_crtc *crtc)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, 0x00);
+}
+
+static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height)
+{
+ union {
+ u32 ul;
+ u8 b[4];
+ } srcdata32[2], data32;
+ union {
+ u16 us;
+ u8 b[2];
+ } data16;
+ u32 csum = 0;
+ s32 alpha_dst_delta, last_alpha_dst_delta;
+ u8 *srcxor, *dstxor;
+ int i, j;
+ u32 per_pixel_copy, two_pixel_copy;
+
+ alpha_dst_delta = AST_MAX_HWC_WIDTH << 1;
+ last_alpha_dst_delta = alpha_dst_delta - (width << 1);
+
+ srcxor = src;
+ dstxor = (u8 *)dst + last_alpha_dst_delta + (AST_MAX_HWC_HEIGHT - height) * alpha_dst_delta;
+ per_pixel_copy = width & 1;
+ two_pixel_copy = width >> 1;
+
+ for (j = 0; j < height; j++) {
+ for (i = 0; i < two_pixel_copy; i++) {
+ srcdata32[0].ul = *((u32 *)srcxor) & 0xf0f0f0f0;
+ srcdata32[1].ul = *((u32 *)(srcxor + 4)) & 0xf0f0f0f0;
+ data32.b[0] = srcdata32[0].b[1] | (srcdata32[0].b[0] >> 4);
+ data32.b[1] = srcdata32[0].b[3] | (srcdata32[0].b[2] >> 4);
+ data32.b[2] = srcdata32[1].b[1] | (srcdata32[1].b[0] >> 4);
+ data32.b[3] = srcdata32[1].b[3] | (srcdata32[1].b[2] >> 4);
+
+ writel(data32.ul, dstxor);
+ csum += data32.ul;
+
+ dstxor += 4;
+ srcxor += 8;
+
+ }
+
+ for (i = 0; i < per_pixel_copy; i++) {
+ srcdata32[0].ul = *((u32 *)srcxor) & 0xf0f0f0f0;
+ data16.b[0] = srcdata32[0].b[1] | (srcdata32[0].b[0] >> 4);
+ data16.b[1] = srcdata32[0].b[3] | (srcdata32[0].b[2] >> 4);
+ writew(data16.us, dstxor);
+ csum += (u32)data16.us;
+
+ dstxor += 2;
+ srcxor += 4;
+ }
+ dstxor += last_alpha_dst_delta;
+ }
+ return csum;
+}
+
+static int ast_cursor_set(struct drm_crtc *crtc,
+ struct drm_file *file_priv,
+ uint32_t handle,
+ uint32_t width,
+ uint32_t height)
+{
+ struct ast_private *ast = crtc->dev->dev_private;
+ struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
+ struct drm_gem_object *obj;
+ struct ast_bo *bo;
+ uint64_t gpu_addr;
+ u32 csum;
+ int ret;
+ struct ttm_bo_kmap_obj uobj_map;
+ u8 *src, *dst;
+ bool src_isiomem, dst_isiomem;
+ if (!handle) {
+ ast_hide_cursor(crtc);
+ return 0;
+ }
+
+ if (width > AST_MAX_HWC_WIDTH || height > AST_MAX_HWC_HEIGHT)
+ return -EINVAL;
+
+ obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
+ if (!obj) {
+ DRM_ERROR("Cannot find cursor object %x for crtc\n", handle);
+ return -ENOENT;
+ }
+ bo = gem_to_ast_bo(obj);
+
+ ret = ast_bo_reserve(bo, false);
+ if (ret)
+ goto fail;
+
+ ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &uobj_map);
+
+ src = ttm_kmap_obj_virtual(&uobj_map, &src_isiomem);
+ dst = ttm_kmap_obj_virtual(&ast->cache_kmap, &dst_isiomem);
+
+ if (src_isiomem == true)
+ DRM_ERROR("src cursor bo should be in main memory\n");
+ if (dst_isiomem == false)
+ DRM_ERROR("dst bo should be in VRAM\n");
+
+ dst += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor;
+
+ /* do data transfer to cursor cache */
+ csum = copy_cursor_image(src, dst, width, height);
+
+ /* write checksum + signature */
+ ttm_bo_kunmap(&uobj_map);
+ ast_bo_unreserve(bo);
+ {
+ u8 *dst = (u8 *)ast->cache_kmap.virtual + (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor + AST_HWC_SIZE;
+ writel(csum, dst);
+ writel(width, dst + AST_HWC_SIGNATURE_SizeX);
+ writel(height, dst + AST_HWC_SIGNATURE_SizeY);
+ writel(0, dst + AST_HWC_SIGNATURE_HOTSPOTX);
+ writel(0, dst + AST_HWC_SIGNATURE_HOTSPOTY);
+
+ /* set pattern offset */
+ gpu_addr = ast->cursor_cache_gpu_addr;
+ gpu_addr += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor;
+ gpu_addr >>= 3;
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc8, gpu_addr & 0xff);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc9, (gpu_addr >> 8) & 0xff);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xca, (gpu_addr >> 16) & 0xff);
+ }
+ ast_crtc->cursor_width = width;
+ ast_crtc->cursor_height = height;
+ ast_crtc->offset_x = AST_MAX_HWC_WIDTH - width;
+ ast_crtc->offset_y = AST_MAX_HWC_WIDTH - height;
+
+ ast->next_cursor = (ast->next_cursor + 1) % AST_DEFAULT_HWC_NUM;
+
+ ast_show_cursor(crtc);
+
+ drm_gem_object_unreference_unlocked(obj);
+ return 0;
+fail:
+ drm_gem_object_unreference_unlocked(obj);
+ return ret;
+}
+
+static int ast_cursor_move(struct drm_crtc *crtc,
+ int x, int y)
+{
+ struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
+ struct ast_private *ast = crtc->dev->dev_private;
+ int x_offset, y_offset;
+ u8 *sig;
+
+ sig = (u8 *)ast->cache_kmap.virtual + (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor + AST_HWC_SIZE;
+ writel(x, sig + AST_HWC_SIGNATURE_X);
+ writel(y, sig + AST_HWC_SIGNATURE_Y);
+
+ x_offset = ast_crtc->offset_x;
+ y_offset = ast_crtc->offset_y;
+ if (x < 0) {
+ x_offset = (-x) + ast_crtc->offset_x;
+ x = 0;
+ }
+
+ if (y < 0) {
+ y_offset = (-y) + ast_crtc->offset_y;
+ y = 0;
+ }
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc2, x_offset);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc3, y_offset);
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc4, (x & 0xff));
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc5, ((x >> 8) & 0x0f));
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc6, (y & 0xff));
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07));
+
+ /* dummy write to fire HWC */
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xCB, 0xFF, 0x00);
+
+ return 0;
+}
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
new file mode 100644
index 00000000..977cfb35
--- /dev/null
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -0,0 +1,1780 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie
+ */
+
+#include
+#include "ast_drv.h"
+
+#include "ast_dram_tables.h"
+
+static void ast_init_dram_2300(struct drm_device *dev);
+
+static void
+ast_enable_vga(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+
+ ast_io_write8(ast, 0x43, 0x01);
+ ast_io_write8(ast, 0x42, 0x01);
+}
+
+#if 0 /* will use later */
+static bool
+ast_is_vga_enabled(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+ u8 ch;
+
+ if (ast->chip == AST1180) {
+ /* TODO 1180 */
+ } else {
+ ch = ast_io_read8(ast, 0x43);
+ if (ch) {
+ ast_open_key(ast);
+ ch = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0xff);
+ return ch & 0x04;
+ }
+ }
+ return 0;
+}
+#endif
+
+static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff };
+static const u8 extreginfo_ast2300a0[] = { 0x0f, 0x04, 0x1c, 0xff };
+static const u8 extreginfo_ast2300[] = { 0x0f, 0x04, 0x1f, 0xff };
+
+static void
+ast_set_def_ext_reg(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+ u8 i, index, reg;
+ const u8 *ext_reg_info;
+
+ /* reset scratch */
+ for (i = 0x81; i <= 0x8f; i++)
+ ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, 0x00);
+
+ if (ast->chip == AST2300) {
+ if (dev->pdev->revision >= 0x20)
+ ext_reg_info = extreginfo_ast2300;
+ else
+ ext_reg_info = extreginfo_ast2300a0;
+ } else
+ ext_reg_info = extreginfo;
+
+ index = 0xa0;
+ while (*ext_reg_info != 0xff) {
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, index, 0x00, *ext_reg_info);
+ index++;
+ ext_reg_info++;
+ }
+
+ /* disable standard IO/MEM decode if secondary */
+ /* ast_set_index_reg-mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x3); */
+
+ /* Set Ext. Default */
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x8c, 0x00, 0x01);
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x00, 0x00);
+
+ /* Enable RAMDAC for A1 */
+ reg = 0x04;
+ if (ast->chip == AST2300)
+ reg |= 0x20;
+ ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0xff, reg);
+}
+
+static inline u32 mindwm(struct ast_private *ast, u32 r)
+{
+ ast_write32(ast, 0xf004, r & 0xffff0000);
+ ast_write32(ast, 0xf000, 0x1);
+
+ return ast_read32(ast, 0x10000 + (r & 0x0000ffff));
+}
+
+static inline void moutdwm(struct ast_private *ast, u32 r, u32 v)
+{
+ ast_write32(ast, 0xf004, r & 0xffff0000);
+ ast_write32(ast, 0xf000, 0x1);
+ ast_write32(ast, 0x10000 + (r & 0x0000ffff), v);
+}
+
+/*
+ * AST2100/2150 DLL CBR Setting
+ */
+#define CBR_SIZE_AST2150 ((16 << 10) - 1)
+#define CBR_PASSNUM_AST2150 5
+#define CBR_THRESHOLD_AST2150 10
+#define CBR_THRESHOLD2_AST2150 10
+#define TIMEOUT_AST2150 5000000
+
+#define CBR_PATNUM_AST2150 8
+
+static const u32 pattern_AST2150[14] = {
+ 0xFF00FF00,
+ 0xCC33CC33,
+ 0xAA55AA55,
+ 0xFFFE0001,
+ 0x683501FE,
+ 0x0F1929B0,
+ 0x2D0B4346,
+ 0x60767F02,
+ 0x6FBE36A6,
+ 0x3A253035,
+ 0x3019686D,
+ 0x41C6167E,
+ 0x620152BF,
+ 0x20F050E0
+};
+
+static u32 mmctestburst2_ast2150(struct ast_private *ast, u32 datagen)
+{
+ u32 data, timeout;
+
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ moutdwm(ast, 0x1e6e0070, 0x00000001 | (datagen << 3));
+ timeout = 0;
+ do {
+ data = mindwm(ast, 0x1e6e0070) & 0x40;
+ if (++timeout > TIMEOUT_AST2150) {
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ return 0xffffffff;
+ }
+ } while (!data);
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ moutdwm(ast, 0x1e6e0070, 0x00000003 | (datagen << 3));
+ timeout = 0;
+ do {
+ data = mindwm(ast, 0x1e6e0070) & 0x40;
+ if (++timeout > TIMEOUT_AST2150) {
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ return 0xffffffff;
+ }
+ } while (!data);
+ data = (mindwm(ast, 0x1e6e0070) & 0x80) >> 7;
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ return data;
+}
+
+#if 0 /* unused in DDX driver - here for completeness */
+static u32 mmctestsingle2_ast2150(struct ast_private *ast, u32 datagen)
+{
+ u32 data, timeout;
+
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ moutdwm(ast, 0x1e6e0070, 0x00000005 | (datagen << 3));
+ timeout = 0;
+ do {
+ data = mindwm(ast, 0x1e6e0070) & 0x40;
+ if (++timeout > TIMEOUT_AST2150) {
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ return 0xffffffff;
+ }
+ } while (!data);
+ data = (mindwm(ast, 0x1e6e0070) & 0x80) >> 7;
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ return data;
+}
+#endif
+
+static int cbrtest_ast2150(struct ast_private *ast)
+{
+ int i;
+
+ for (i = 0; i < 8; i++)
+ if (mmctestburst2_ast2150(ast, i))
+ return 0;
+ return 1;
+}
+
+static int cbrscan_ast2150(struct ast_private *ast, int busw)
+{
+ u32 patcnt, loop;
+
+ for (patcnt = 0; patcnt < CBR_PATNUM_AST2150; patcnt++) {
+ moutdwm(ast, 0x1e6e007c, pattern_AST2150[patcnt]);
+ for (loop = 0; loop < CBR_PASSNUM_AST2150; loop++) {
+ if (cbrtest_ast2150(ast))
+ break;
+ }
+ if (loop == CBR_PASSNUM_AST2150)
+ return 0;
+ }
+ return 1;
+}
+
+
+static void cbrdlli_ast2150(struct ast_private *ast, int busw)
+{
+ u32 dll_min[4], dll_max[4], dlli, data, passcnt;
+
+cbr_start:
+ dll_min[0] = dll_min[1] = dll_min[2] = dll_min[3] = 0xff;
+ dll_max[0] = dll_max[1] = dll_max[2] = dll_max[3] = 0x0;
+ passcnt = 0;
+
+ for (dlli = 0; dlli < 100; dlli++) {
+ moutdwm(ast, 0x1e6e0068, dlli | (dlli << 8) | (dlli << 16) | (dlli << 24));
+ data = cbrscan_ast2150(ast, busw);
+ if (data != 0) {
+ if (data & 0x1) {
+ if (dll_min[0] > dlli)
+ dll_min[0] = dlli;
+ if (dll_max[0] < dlli)
+ dll_max[0] = dlli;
+ }
+ passcnt++;
+ } else if (passcnt >= CBR_THRESHOLD_AST2150)
+ goto cbr_start;
+ }
+ if (dll_max[0] == 0 || (dll_max[0]-dll_min[0]) < CBR_THRESHOLD_AST2150)
+ goto cbr_start;
+
+ dlli = dll_min[0] + (((dll_max[0] - dll_min[0]) * 7) >> 4);
+ moutdwm(ast, 0x1e6e0068, dlli | (dlli << 8) | (dlli << 16) | (dlli << 24));
+}
+
+
+
+static void ast_init_dram_reg(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+ u8 j;
+ u32 data, temp, i;
+ const struct ast_dramstruct *dram_reg_info;
+
+ j = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff);
+
+ if ((j & 0x80) == 0) { /* VGA only */
+ if (ast->chip == AST2000) {
+ dram_reg_info = ast2000_dram_table_data;
+ ast_write32(ast, 0xf004, 0x1e6e0000);
+ ast_write32(ast, 0xf000, 0x1);
+ ast_write32(ast, 0x10100, 0xa8);
+
+ do {
+ ;
+ } while (ast_read32(ast, 0x10100) != 0xa8);
+ } else {/* AST2100/1100 */
+ if (ast->chip == AST2100 || ast->chip == 2200)
+ dram_reg_info = ast2100_dram_table_data;
+ else
+ dram_reg_info = ast1100_dram_table_data;
+
+ ast_write32(ast, 0xf004, 0x1e6e0000);
+ ast_write32(ast, 0xf000, 0x1);
+ ast_write32(ast, 0x12000, 0x1688A8A8);
+ do {
+ ;
+ } while (ast_read32(ast, 0x12000) != 0x01);
+
+ ast_write32(ast, 0x10000, 0xfc600309);
+ do {
+ ;
+ } while (ast_read32(ast, 0x10000) != 0x01);
+ }
+
+ while (dram_reg_info->index != 0xffff) {
+ if (dram_reg_info->index == 0xff00) {/* delay fn */
+ for (i = 0; i < 15; i++)
+ udelay(dram_reg_info->data);
+ } else if (dram_reg_info->index == 0x4 && ast->chip != AST2000) {
+ data = dram_reg_info->data;
+ if (ast->dram_type == AST_DRAM_1Gx16)
+ data = 0x00000d89;
+ else if (ast->dram_type == AST_DRAM_1Gx32)
+ data = 0x00000c8d;
+
+ temp = ast_read32(ast, 0x12070);
+ temp &= 0xc;
+ temp <<= 2;
+ ast_write32(ast, 0x10000 + dram_reg_info->index, data | temp);
+ } else
+ ast_write32(ast, 0x10000 + dram_reg_info->index, dram_reg_info->data);
+ dram_reg_info++;
+ }
+
+ /* AST 2100/2150 DRAM calibration */
+ data = ast_read32(ast, 0x10120);
+ if (data == 0x5061) { /* 266Mhz */
+ data = ast_read32(ast, 0x10004);
+ if (data & 0x40)
+ cbrdlli_ast2150(ast, 16); /* 16 bits */
+ else
+ cbrdlli_ast2150(ast, 32); /* 32 bits */
+ }
+
+ switch (ast->chip) {
+ case AST2000:
+ temp = ast_read32(ast, 0x10140);
+ ast_write32(ast, 0x10140, temp | 0x40);
+ break;
+ case AST1100:
+ case AST2100:
+ case AST2200:
+ case AST2150:
+ temp = ast_read32(ast, 0x1200c);
+ ast_write32(ast, 0x1200c, temp & 0xfffffffd);
+ temp = ast_read32(ast, 0x12040);
+ ast_write32(ast, 0x12040, temp | 0x40);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* wait ready */
+ do {
+ j = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff);
+ } while ((j & 0x40) == 0);
+}
+
+void ast_post_gpu(struct drm_device *dev)
+{
+ u32 reg;
+ struct ast_private *ast = dev->dev_private;
+
+ pci_read_config_dword(ast->dev->pdev, 0x04, ®);
+ reg |= 0x3;
+ pci_write_config_dword(ast->dev->pdev, 0x04, reg);
+
+ ast_enable_vga(dev);
+ ast_open_key(ast);
+ ast_set_def_ext_reg(dev);
+
+ if (ast->chip == AST2300)
+ ast_init_dram_2300(dev);
+ else
+ ast_init_dram_reg(dev);
+}
+
+/* AST 2300 DRAM settings */
+#define AST_DDR3 0
+#define AST_DDR2 1
+
+struct ast2300_dram_param {
+ u32 dram_type;
+ u32 dram_chipid;
+ u32 dram_freq;
+ u32 vram_size;
+ u32 odt;
+ u32 wodt;
+ u32 rodt;
+ u32 dram_config;
+ u32 reg_PERIOD;
+ u32 reg_MADJ;
+ u32 reg_SADJ;
+ u32 reg_MRS;
+ u32 reg_EMRS;
+ u32 reg_AC1;
+ u32 reg_AC2;
+ u32 reg_DQSIC;
+ u32 reg_DRV;
+ u32 reg_IOZ;
+ u32 reg_DQIDLY;
+ u32 reg_FREQ;
+ u32 madj_max;
+ u32 dll2_finetune_step;
+};
+
+/*
+ * DQSI DLL CBR Setting
+ */
+#define CBR_SIZE1 ((4 << 10) - 1)
+#define CBR_SIZE2 ((64 << 10) - 1)
+#define CBR_PASSNUM 5
+#define CBR_PASSNUM2 5
+#define CBR_THRESHOLD 10
+#define CBR_THRESHOLD2 10
+#define TIMEOUT 5000000
+#define CBR_PATNUM 8
+
+static const u32 pattern[8] = {
+ 0xFF00FF00,
+ 0xCC33CC33,
+ 0xAA55AA55,
+ 0x88778877,
+ 0x92CC4D6E,
+ 0x543D3CDE,
+ 0xF1E843C7,
+ 0x7C61D253
+};
+
+#if 0 /* unused in DDX, included for completeness */
+static int mmc_test_burst(struct ast_private *ast, u32 datagen)
+{
+ u32 data, timeout;
+
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ moutdwm(ast, 0x1e6e0070, 0x000000c1 | (datagen << 3));
+ timeout = 0;
+ do {
+ data = mindwm(ast, 0x1e6e0070) & 0x3000;
+ if (data & 0x2000) {
+ return 0;
+ }
+ if (++timeout > TIMEOUT) {
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ return 0;
+ }
+ } while (!data);
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ return 1;
+}
+#endif
+
+static int mmc_test_burst2(struct ast_private *ast, u32 datagen)
+{
+ u32 data, timeout;
+
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ moutdwm(ast, 0x1e6e0070, 0x00000041 | (datagen << 3));
+ timeout = 0;
+ do {
+ data = mindwm(ast, 0x1e6e0070) & 0x1000;
+ if (++timeout > TIMEOUT) {
+ moutdwm(ast, 0x1e6e0070, 0x0);
+ return -1;
+ }
+ } while (!data);
+ data = mindwm(ast, 0x1e6e0078);
+ data = (data | (data >> 16)) & 0xffff;
+ moutdwm(ast, 0x1e6e0070, 0x0);
+ return data;
+}
+
+#if 0 /* Unused in DDX here for completeness */
+static int mmc_test_single(struct ast_private *ast, u32 datagen)
+{
+ u32 data, timeout;
+
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ moutdwm(ast, 0x1e6e0070, 0x000000c5 | (datagen << 3));
+ timeout = 0;
+ do {
+ data = mindwm(ast, 0x1e6e0070) & 0x3000;
+ if (data & 0x2000)
+ return 0;
+ if (++timeout > TIMEOUT) {
+ moutdwm(ast, 0x1e6e0070, 0x0);
+ return 0;
+ }
+ } while (!data);
+ moutdwm(ast, 0x1e6e0070, 0x0);
+ return 1;
+}
+#endif
+
+static int mmc_test_single2(struct ast_private *ast, u32 datagen)
+{
+ u32 data, timeout;
+
+ moutdwm(ast, 0x1e6e0070, 0x00000000);
+ moutdwm(ast, 0x1e6e0070, 0x00000005 | (datagen << 3));
+ timeout = 0;
+ do {
+ data = mindwm(ast, 0x1e6e0070) & 0x1000;
+ if (++timeout > TIMEOUT) {
+ moutdwm(ast, 0x1e6e0070, 0x0);
+ return -1;
+ }
+ } while (!data);
+ data = mindwm(ast, 0x1e6e0078);
+ data = (data | (data >> 16)) & 0xffff;
+ moutdwm(ast, 0x1e6e0070, 0x0);
+ return data;
+}
+
+static int cbr_test(struct ast_private *ast)
+{
+ u32 data;
+ int i;
+ data = mmc_test_single2(ast, 0);
+ if ((data & 0xff) && (data & 0xff00))
+ return 0;
+ for (i = 0; i < 8; i++) {
+ data = mmc_test_burst2(ast, i);
+ if ((data & 0xff) && (data & 0xff00))
+ return 0;
+ }
+ if (!data)
+ return 3;
+ else if (data & 0xff)
+ return 2;
+ return 1;
+}
+
+static int cbr_scan(struct ast_private *ast)
+{
+ u32 data, data2, patcnt, loop;
+
+ data2 = 3;
+ for (patcnt = 0; patcnt < CBR_PATNUM; patcnt++) {
+ moutdwm(ast, 0x1e6e007c, pattern[patcnt]);
+ for (loop = 0; loop < CBR_PASSNUM2; loop++) {
+ if ((data = cbr_test(ast)) != 0) {
+ data2 &= data;
+ if (!data2)
+ return 0;
+ break;
+ }
+ }
+ if (loop == CBR_PASSNUM2)
+ return 0;
+ }
+ return data2;
+}
+
+static u32 cbr_test2(struct ast_private *ast)
+{
+ u32 data;
+
+ data = mmc_test_burst2(ast, 0);
+ if (data == 0xffff)
+ return 0;
+ data |= mmc_test_single2(ast, 0);
+ if (data == 0xffff)
+ return 0;
+
+ return ~data & 0xffff;
+}
+
+static u32 cbr_scan2(struct ast_private *ast)
+{
+ u32 data, data2, patcnt, loop;
+
+ data2 = 0xffff;
+ for (patcnt = 0; patcnt < CBR_PATNUM; patcnt++) {
+ moutdwm(ast, 0x1e6e007c, pattern[patcnt]);
+ for (loop = 0; loop < CBR_PASSNUM2; loop++) {
+ if ((data = cbr_test2(ast)) != 0) {
+ data2 &= data;
+ if (!data)
+ return 0;
+ break;
+ }
+ }
+ if (loop == CBR_PASSNUM2)
+ return 0;
+ }
+ return data2;
+}
+
+#if 0 /* unused in DDX - added for completeness */
+static void finetuneDQI(struct ast_private *ast, struct ast2300_dram_param *param)
+{
+ u32 gold_sadj[2], dllmin[16], dllmax[16], dlli, data, cnt, mask, passcnt;
+
+ gold_sadj[0] = (mindwm(ast, 0x1E6E0024) >> 16) & 0xffff;
+ gold_sadj[1] = gold_sadj[0] >> 8;
+ gold_sadj[0] = gold_sadj[0] & 0xff;
+ gold_sadj[0] = (gold_sadj[0] + gold_sadj[1]) >> 1;
+ gold_sadj[1] = gold_sadj[0];
+
+ for (cnt = 0; cnt < 16; cnt++) {
+ dllmin[cnt] = 0xff;
+ dllmax[cnt] = 0x0;
+ }
+ passcnt = 0;
+ for (dlli = 0; dlli < 76; dlli++) {
+ moutdwm(ast, 0x1E6E0068, 0x00001400 | (dlli << 16) | (dlli << 24));
+ /* Wait DQSI latch phase calibration */
+ moutdwm(ast, 0x1E6E0074, 0x00000010);
+ moutdwm(ast, 0x1E6E0070, 0x00000003);
+ do {
+ data = mindwm(ast, 0x1E6E0070);
+ } while (!(data & 0x00001000));
+ moutdwm(ast, 0x1E6E0070, 0x00000000);
+
+ moutdwm(ast, 0x1E6E0074, CBR_SIZE1);
+ data = cbr_scan2(ast);
+ if (data != 0) {
+ mask = 0x00010001;
+ for (cnt = 0; cnt < 16; cnt++) {
+ if (data & mask) {
+ if (dllmin[cnt] > dlli) {
+ dllmin[cnt] = dlli;
+ }
+ if (dllmax[cnt] < dlli) {
+ dllmax[cnt] = dlli;
+ }
+ }
+ mask <<= 1;
+ }
+ passcnt++;
+ } else if (passcnt >= CBR_THRESHOLD) {
+ break;
+ }
+ }
+ data = 0;
+ for (cnt = 0; cnt < 8; cnt++) {
+ data >>= 3;
+ if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD)) {
+ dlli = (dllmin[cnt] + dllmax[cnt]) >> 1;
+ if (gold_sadj[0] >= dlli) {
+ dlli = (gold_sadj[0] - dlli) >> 1;
+ if (dlli > 3) {
+ dlli = 3;
+ }
+ } else {
+ dlli = (dlli - gold_sadj[0]) >> 1;
+ if (dlli > 4) {
+ dlli = 4;
+ }
+ dlli = (8 - dlli) & 0x7;
+ }
+ data |= dlli << 21;
+ }
+ }
+ moutdwm(ast, 0x1E6E0080, data);
+
+ data = 0;
+ for (cnt = 8; cnt < 16; cnt++) {
+ data >>= 3;
+ if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD)) {
+ dlli = (dllmin[cnt] + dllmax[cnt]) >> 1;
+ if (gold_sadj[1] >= dlli) {
+ dlli = (gold_sadj[1] - dlli) >> 1;
+ if (dlli > 3) {
+ dlli = 3;
+ } else {
+ dlli = (dlli - 1) & 0x7;
+ }
+ } else {
+ dlli = (dlli - gold_sadj[1]) >> 1;
+ dlli += 1;
+ if (dlli > 4) {
+ dlli = 4;
+ }
+ dlli = (8 - dlli) & 0x7;
+ }
+ data |= dlli << 21;
+ }
+ }
+ moutdwm(ast, 0x1E6E0084, data);
+
+} /* finetuneDQI */
+#endif
+
+static void finetuneDQI_L(struct ast_private *ast, struct ast2300_dram_param *param)
+{
+ u32 gold_sadj[2], dllmin[16], dllmax[16], dlli, data, cnt, mask, passcnt;
+
+FINETUNE_START:
+ for (cnt = 0; cnt < 16; cnt++) {
+ dllmin[cnt] = 0xff;
+ dllmax[cnt] = 0x0;
+ }
+ passcnt = 0;
+ for (dlli = 0; dlli < 76; dlli++) {
+ moutdwm(ast, 0x1E6E0068, 0x00001400 | (dlli << 16) | (dlli << 24));
+ /* Wait DQSI latch phase calibration */
+ moutdwm(ast, 0x1E6E0074, 0x00000010);
+ moutdwm(ast, 0x1E6E0070, 0x00000003);
+ do {
+ data = mindwm(ast, 0x1E6E0070);
+ } while (!(data & 0x00001000));
+ moutdwm(ast, 0x1E6E0070, 0x00000000);
+
+ moutdwm(ast, 0x1E6E0074, CBR_SIZE1);
+ data = cbr_scan2(ast);
+ if (data != 0) {
+ mask = 0x00010001;
+ for (cnt = 0; cnt < 16; cnt++) {
+ if (data & mask) {
+ if (dllmin[cnt] > dlli) {
+ dllmin[cnt] = dlli;
+ }
+ if (dllmax[cnt] < dlli) {
+ dllmax[cnt] = dlli;
+ }
+ }
+ mask <<= 1;
+ }
+ passcnt++;
+ } else if (passcnt >= CBR_THRESHOLD2) {
+ break;
+ }
+ }
+ gold_sadj[0] = 0x0;
+ passcnt = 0;
+ for (cnt = 0; cnt < 16; cnt++) {
+ if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) {
+ gold_sadj[0] += dllmin[cnt];
+ passcnt++;
+ }
+ }
+ if (passcnt != 16) {
+ goto FINETUNE_START;
+ }
+ gold_sadj[0] = gold_sadj[0] >> 4;
+ gold_sadj[1] = gold_sadj[0];
+
+ data = 0;
+ for (cnt = 0; cnt < 8; cnt++) {
+ data >>= 3;
+ if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) {
+ dlli = dllmin[cnt];
+ if (gold_sadj[0] >= dlli) {
+ dlli = ((gold_sadj[0] - dlli) * 19) >> 5;
+ if (dlli > 3) {
+ dlli = 3;
+ }
+ } else {
+ dlli = ((dlli - gold_sadj[0]) * 19) >> 5;
+ if (dlli > 4) {
+ dlli = 4;
+ }
+ dlli = (8 - dlli) & 0x7;
+ }
+ data |= dlli << 21;
+ }
+ }
+ moutdwm(ast, 0x1E6E0080, data);
+
+ data = 0;
+ for (cnt = 8; cnt < 16; cnt++) {
+ data >>= 3;
+ if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) {
+ dlli = dllmin[cnt];
+ if (gold_sadj[1] >= dlli) {
+ dlli = ((gold_sadj[1] - dlli) * 19) >> 5;
+ if (dlli > 3) {
+ dlli = 3;
+ } else {
+ dlli = (dlli - 1) & 0x7;
+ }
+ } else {
+ dlli = ((dlli - gold_sadj[1]) * 19) >> 5;
+ dlli += 1;
+ if (dlli > 4) {
+ dlli = 4;
+ }
+ dlli = (8 - dlli) & 0x7;
+ }
+ data |= dlli << 21;
+ }
+ }
+ moutdwm(ast, 0x1E6E0084, data);
+
+} /* finetuneDQI_L */
+
+static void finetuneDQI_L2(struct ast_private *ast, struct ast2300_dram_param *param)
+{
+ u32 gold_sadj[2], dllmin[16], dllmax[16], dlli, data, cnt, mask, passcnt, data2;
+
+ for (cnt = 0; cnt < 16; cnt++) {
+ dllmin[cnt] = 0xff;
+ dllmax[cnt] = 0x0;
+ }
+ passcnt = 0;
+ for (dlli = 0; dlli < 76; dlli++) {
+ moutdwm(ast, 0x1E6E0068, 0x00001400 | (dlli << 16) | (dlli << 24));
+ /* Wait DQSI latch phase calibration */
+ moutdwm(ast, 0x1E6E0074, 0x00000010);
+ moutdwm(ast, 0x1E6E0070, 0x00000003);
+ do {
+ data = mindwm(ast, 0x1E6E0070);
+ } while (!(data & 0x00001000));
+ moutdwm(ast, 0x1E6E0070, 0x00000000);
+
+ moutdwm(ast, 0x1E6E0074, CBR_SIZE2);
+ data = cbr_scan2(ast);
+ if (data != 0) {
+ mask = 0x00010001;
+ for (cnt = 0; cnt < 16; cnt++) {
+ if (data & mask) {
+ if (dllmin[cnt] > dlli) {
+ dllmin[cnt] = dlli;
+ }
+ if (dllmax[cnt] < dlli) {
+ dllmax[cnt] = dlli;
+ }
+ }
+ mask <<= 1;
+ }
+ passcnt++;
+ } else if (passcnt >= CBR_THRESHOLD2) {
+ break;
+ }
+ }
+ gold_sadj[0] = 0x0;
+ gold_sadj[1] = 0xFF;
+ for (cnt = 0; cnt < 8; cnt++) {
+ if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) {
+ if (gold_sadj[0] < dllmin[cnt]) {
+ gold_sadj[0] = dllmin[cnt];
+ }
+ if (gold_sadj[1] > dllmax[cnt]) {
+ gold_sadj[1] = dllmax[cnt];
+ }
+ }
+ }
+ gold_sadj[0] = (gold_sadj[1] + gold_sadj[0]) >> 1;
+ gold_sadj[1] = mindwm(ast, 0x1E6E0080);
+
+ data = 0;
+ for (cnt = 0; cnt < 8; cnt++) {
+ data >>= 3;
+ data2 = gold_sadj[1] & 0x7;
+ gold_sadj[1] >>= 3;
+ if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) {
+ dlli = (dllmin[cnt] + dllmax[cnt]) >> 1;
+ if (gold_sadj[0] >= dlli) {
+ dlli = (gold_sadj[0] - dlli) >> 1;
+ if (dlli > 0) {
+ dlli = 1;
+ }
+ if (data2 != 3) {
+ data2 = (data2 + dlli) & 0x7;
+ }
+ } else {
+ dlli = (dlli - gold_sadj[0]) >> 1;
+ if (dlli > 0) {
+ dlli = 1;
+ }
+ if (data2 != 4) {
+ data2 = (data2 - dlli) & 0x7;
+ }
+ }
+ }
+ data |= data2 << 21;
+ }
+ moutdwm(ast, 0x1E6E0080, data);
+
+ gold_sadj[0] = 0x0;
+ gold_sadj[1] = 0xFF;
+ for (cnt = 8; cnt < 16; cnt++) {
+ if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) {
+ if (gold_sadj[0] < dllmin[cnt]) {
+ gold_sadj[0] = dllmin[cnt];
+ }
+ if (gold_sadj[1] > dllmax[cnt]) {
+ gold_sadj[1] = dllmax[cnt];
+ }
+ }
+ }
+ gold_sadj[0] = (gold_sadj[1] + gold_sadj[0]) >> 1;
+ gold_sadj[1] = mindwm(ast, 0x1E6E0084);
+
+ data = 0;
+ for (cnt = 8; cnt < 16; cnt++) {
+ data >>= 3;
+ data2 = gold_sadj[1] & 0x7;
+ gold_sadj[1] >>= 3;
+ if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) {
+ dlli = (dllmin[cnt] + dllmax[cnt]) >> 1;
+ if (gold_sadj[0] >= dlli) {
+ dlli = (gold_sadj[0] - dlli) >> 1;
+ if (dlli > 0) {
+ dlli = 1;
+ }
+ if (data2 != 3) {
+ data2 = (data2 + dlli) & 0x7;
+ }
+ } else {
+ dlli = (dlli - gold_sadj[0]) >> 1;
+ if (dlli > 0) {
+ dlli = 1;
+ }
+ if (data2 != 4) {
+ data2 = (data2 - dlli) & 0x7;
+ }
+ }
+ }
+ data |= data2 << 21;
+ }
+ moutdwm(ast, 0x1E6E0084, data);
+
+} /* finetuneDQI_L2 */
+
+static void cbr_dll2(struct ast_private *ast, struct ast2300_dram_param *param)
+{
+ u32 dllmin[2], dllmax[2], dlli, data, data2, passcnt;
+
+
+ finetuneDQI_L(ast, param);
+ finetuneDQI_L2(ast, param);
+
+CBR_START2:
+ dllmin[0] = dllmin[1] = 0xff;
+ dllmax[0] = dllmax[1] = 0x0;
+ passcnt = 0;
+ for (dlli = 0; dlli < 76; dlli++) {
+ moutdwm(ast, 0x1E6E0068, 0x00001300 | (dlli << 16) | (dlli << 24));
+ /* Wait DQSI latch phase calibration */
+ moutdwm(ast, 0x1E6E0074, 0x00000010);
+ moutdwm(ast, 0x1E6E0070, 0x00000003);
+ do {
+ data = mindwm(ast, 0x1E6E0070);
+ } while (!(data & 0x00001000));
+ moutdwm(ast, 0x1E6E0070, 0x00000000);
+
+ moutdwm(ast, 0x1E6E0074, CBR_SIZE2);
+ data = cbr_scan(ast);
+ if (data != 0) {
+ if (data & 0x1) {
+ if (dllmin[0] > dlli) {
+ dllmin[0] = dlli;
+ }
+ if (dllmax[0] < dlli) {
+ dllmax[0] = dlli;
+ }
+ }
+ if (data & 0x2) {
+ if (dllmin[1] > dlli) {
+ dllmin[1] = dlli;
+ }
+ if (dllmax[1] < dlli) {
+ dllmax[1] = dlli;
+ }
+ }
+ passcnt++;
+ } else if (passcnt >= CBR_THRESHOLD) {
+ break;
+ }
+ }
+ if (dllmax[0] == 0 || (dllmax[0]-dllmin[0]) < CBR_THRESHOLD) {
+ goto CBR_START2;
+ }
+ if (dllmax[1] == 0 || (dllmax[1]-dllmin[1]) < CBR_THRESHOLD) {
+ goto CBR_START2;
+ }
+ dlli = (dllmin[1] + dllmax[1]) >> 1;
+ dlli <<= 8;
+ dlli += (dllmin[0] + dllmax[0]) >> 1;
+ moutdwm(ast, 0x1E6E0068, (mindwm(ast, 0x1E6E0068) & 0xFFFF) | (dlli << 16));
+
+ data = (mindwm(ast, 0x1E6E0080) >> 24) & 0x1F;
+ data2 = (mindwm(ast, 0x1E6E0018) & 0xff80ffff) | (data << 16);
+ moutdwm(ast, 0x1E6E0018, data2);
+ moutdwm(ast, 0x1E6E0024, 0x8001 | (data << 1) | (param->dll2_finetune_step << 8));
+
+ /* Wait DQSI latch phase calibration */
+ moutdwm(ast, 0x1E6E0074, 0x00000010);
+ moutdwm(ast, 0x1E6E0070, 0x00000003);
+ do {
+ data = mindwm(ast, 0x1E6E0070);
+ } while (!(data & 0x00001000));
+ moutdwm(ast, 0x1E6E0070, 0x00000000);
+ moutdwm(ast, 0x1E6E0070, 0x00000003);
+ do {
+ data = mindwm(ast, 0x1E6E0070);
+ } while (!(data & 0x00001000));
+ moutdwm(ast, 0x1E6E0070, 0x00000000);
+} /* CBRDLL2 */
+
+static void get_ddr3_info(struct ast_private *ast, struct ast2300_dram_param *param)
+{
+ u32 trap, trap_AC2, trap_MRS;
+
+ moutdwm(ast, 0x1E6E2000, 0x1688A8A8);
+
+ /* Ger trap info */
+ trap = (mindwm(ast, 0x1E6E2070) >> 25) & 0x3;
+ trap_AC2 = 0x00020000 + (trap << 16);
+ trap_AC2 |= 0x00300000 + ((trap & 0x2) << 19);
+ trap_MRS = 0x00000010 + (trap << 4);
+ trap_MRS |= ((trap & 0x2) << 18);
+
+ param->reg_MADJ = 0x00034C4C;
+ param->reg_SADJ = 0x00001800;
+ param->reg_DRV = 0x000000F0;
+ param->reg_PERIOD = param->dram_freq;
+ param->rodt = 0;
+
+ switch (param->dram_freq) {
+ case 336:
+ moutdwm(ast, 0x1E6E2020, 0x0190);
+ param->wodt = 0;
+ param->reg_AC1 = 0x22202725;
+ param->reg_AC2 = 0xAA007613 | trap_AC2;
+ param->reg_DQSIC = 0x000000BA;
+ param->reg_MRS = 0x04001400 | trap_MRS;
+ param->reg_EMRS = 0x00000000;
+ param->reg_IOZ = 0x00000034;
+ param->reg_DQIDLY = 0x00000074;
+ param->reg_FREQ = 0x00004DC0;
+ param->madj_max = 96;
+ param->dll2_finetune_step = 3;
+ break;
+ default:
+ case 396:
+ moutdwm(ast, 0x1E6E2020, 0x03F1);
+ param->wodt = 1;
+ param->reg_AC1 = 0x33302825;
+ param->reg_AC2 = 0xCC009617 | trap_AC2;
+ param->reg_DQSIC = 0x000000E2;
+ param->reg_MRS = 0x04001600 | trap_MRS;
+ param->reg_EMRS = 0x00000000;
+ param->reg_IOZ = 0x00000034;
+ param->reg_DRV = 0x000000FA;
+ param->reg_DQIDLY = 0x00000089;
+ param->reg_FREQ = 0x000050C0;
+ param->madj_max = 96;
+ param->dll2_finetune_step = 4;
+
+ switch (param->dram_chipid) {
+ default:
+ case AST_DRAM_512Mx16:
+ case AST_DRAM_1Gx16:
+ param->reg_AC2 = 0xCC009617 | trap_AC2;
+ break;
+ case AST_DRAM_2Gx16:
+ param->reg_AC2 = 0xCC009622 | trap_AC2;
+ break;
+ case AST_DRAM_4Gx16:
+ param->reg_AC2 = 0xCC00963F | trap_AC2;
+ break;
+ }
+ break;
+
+ case 408:
+ moutdwm(ast, 0x1E6E2020, 0x01F0);
+ param->wodt = 1;
+ param->reg_AC1 = 0x33302825;
+ param->reg_AC2 = 0xCC009617 | trap_AC2;
+ param->reg_DQSIC = 0x000000E2;
+ param->reg_MRS = 0x04001600 | trap_MRS;
+ param->reg_EMRS = 0x00000000;
+ param->reg_IOZ = 0x00000034;
+ param->reg_DRV = 0x000000FA;
+ param->reg_DQIDLY = 0x00000089;
+ param->reg_FREQ = 0x000050C0;
+ param->madj_max = 96;
+ param->dll2_finetune_step = 4;
+
+ switch (param->dram_chipid) {
+ default:
+ case AST_DRAM_512Mx16:
+ case AST_DRAM_1Gx16:
+ param->reg_AC2 = 0xCC009617 | trap_AC2;
+ break;
+ case AST_DRAM_2Gx16:
+ param->reg_AC2 = 0xCC009622 | trap_AC2;
+ break;
+ case AST_DRAM_4Gx16:
+ param->reg_AC2 = 0xCC00963F | trap_AC2;
+ break;
+ }
+
+ break;
+ case 456:
+ moutdwm(ast, 0x1E6E2020, 0x0230);
+ param->wodt = 0;
+ param->reg_AC1 = 0x33302926;
+ param->reg_AC2 = 0xCD44961A;
+ param->reg_DQSIC = 0x000000FC;
+ param->reg_MRS = 0x00081830;
+ param->reg_EMRS = 0x00000000;
+ param->reg_IOZ = 0x00000045;
+ param->reg_DQIDLY = 0x00000097;
+ param->reg_FREQ = 0x000052C0;
+ param->madj_max = 88;
+ param->dll2_finetune_step = 4;
+ break;
+ case 504:
+ moutdwm(ast, 0x1E6E2020, 0x0270);
+ param->wodt = 1;
+ param->reg_AC1 = 0x33302926;
+ param->reg_AC2 = 0xDE44A61D;
+ param->reg_DQSIC = 0x00000117;
+ param->reg_MRS = 0x00081A30;
+ param->reg_EMRS = 0x00000000;
+ param->reg_IOZ = 0x070000BB;
+ param->reg_DQIDLY = 0x000000A0;
+ param->reg_FREQ = 0x000054C0;
+ param->madj_max = 79;
+ param->dll2_finetune_step = 4;
+ break;
+ case 528:
+ moutdwm(ast, 0x1E6E2020, 0x0290);
+ param->wodt = 1;
+ param->rodt = 1;
+ param->reg_AC1 = 0x33302926;
+ param->reg_AC2 = 0xEF44B61E;
+ param->reg_DQSIC = 0x00000125;
+ param->reg_MRS = 0x00081A30;
+ param->reg_EMRS = 0x00000040;
+ param->reg_DRV = 0x000000F5;
+ param->reg_IOZ = 0x00000023;
+ param->reg_DQIDLY = 0x00000088;
+ param->reg_FREQ = 0x000055C0;
+ param->madj_max = 76;
+ param->dll2_finetune_step = 3;
+ break;
+ case 576:
+ moutdwm(ast, 0x1E6E2020, 0x0140);
+ param->reg_MADJ = 0x00136868;
+ param->reg_SADJ = 0x00004534;
+ param->wodt = 1;
+ param->rodt = 1;
+ param->reg_AC1 = 0x33302A37;
+ param->reg_AC2 = 0xEF56B61E;
+ param->reg_DQSIC = 0x0000013F;
+ param->reg_MRS = 0x00101A50;
+ param->reg_EMRS = 0x00000040;
+ param->reg_DRV = 0x000000FA;
+ param->reg_IOZ = 0x00000023;
+ param->reg_DQIDLY = 0x00000078;
+ param->reg_FREQ = 0x000057C0;
+ param->madj_max = 136;
+ param->dll2_finetune_step = 3;
+ break;
+ case 600:
+ moutdwm(ast, 0x1E6E2020, 0x02E1);
+ param->reg_MADJ = 0x00136868;
+ param->reg_SADJ = 0x00004534;
+ param->wodt = 1;
+ param->rodt = 1;
+ param->reg_AC1 = 0x32302A37;
+ param->reg_AC2 = 0xDF56B61F;
+ param->reg_DQSIC = 0x0000014D;
+ param->reg_MRS = 0x00101A50;
+ param->reg_EMRS = 0x00000004;
+ param->reg_DRV = 0x000000F5;
+ param->reg_IOZ = 0x00000023;
+ param->reg_DQIDLY = 0x00000078;
+ param->reg_FREQ = 0x000058C0;
+ param->madj_max = 132;
+ param->dll2_finetune_step = 3;
+ break;
+ case 624:
+ moutdwm(ast, 0x1E6E2020, 0x0160);
+ param->reg_MADJ = 0x00136868;
+ param->reg_SADJ = 0x00004534;
+ param->wodt = 1;
+ param->rodt = 1;
+ param->reg_AC1 = 0x32302A37;
+ param->reg_AC2 = 0xEF56B621;
+ param->reg_DQSIC = 0x0000015A;
+ param->reg_MRS = 0x02101A50;
+ param->reg_EMRS = 0x00000004;
+ param->reg_DRV = 0x000000F5;
+ param->reg_IOZ = 0x00000034;
+ param->reg_DQIDLY = 0x00000078;
+ param->reg_FREQ = 0x000059C0;
+ param->madj_max = 128;
+ param->dll2_finetune_step = 3;
+ break;
+ } /* switch freq */
+
+ switch (param->dram_chipid) {
+ case AST_DRAM_512Mx16:
+ param->dram_config = 0x130;
+ break;
+ default:
+ case AST_DRAM_1Gx16:
+ param->dram_config = 0x131;
+ break;
+ case AST_DRAM_2Gx16:
+ param->dram_config = 0x132;
+ break;
+ case AST_DRAM_4Gx16:
+ param->dram_config = 0x133;
+ break;
+ }; /* switch size */
+
+ switch (param->vram_size) {
+ default:
+ case AST_VIDMEM_SIZE_8M:
+ param->dram_config |= 0x00;
+ break;
+ case AST_VIDMEM_SIZE_16M:
+ param->dram_config |= 0x04;
+ break;
+ case AST_VIDMEM_SIZE_32M:
+ param->dram_config |= 0x08;
+ break;
+ case AST_VIDMEM_SIZE_64M:
+ param->dram_config |= 0x0c;
+ break;
+ }
+
+}
+
+static void ddr3_init(struct ast_private *ast, struct ast2300_dram_param *param)
+{
+ u32 data, data2;
+
+ moutdwm(ast, 0x1E6E0000, 0xFC600309);
+ moutdwm(ast, 0x1E6E0018, 0x00000100);
+ moutdwm(ast, 0x1E6E0024, 0x00000000);
+ moutdwm(ast, 0x1E6E0034, 0x00000000);
+ udelay(10);
+ moutdwm(ast, 0x1E6E0064, param->reg_MADJ);
+ moutdwm(ast, 0x1E6E0068, param->reg_SADJ);
+ udelay(10);
+ moutdwm(ast, 0x1E6E0064, param->reg_MADJ | 0xC0000);
+ udelay(10);
+
+ moutdwm(ast, 0x1E6E0004, param->dram_config);
+ moutdwm(ast, 0x1E6E0008, 0x90040f);
+ moutdwm(ast, 0x1E6E0010, param->reg_AC1);
+ moutdwm(ast, 0x1E6E0014, param->reg_AC2);
+ moutdwm(ast, 0x1E6E0020, param->reg_DQSIC);
+ moutdwm(ast, 0x1E6E0080, 0x00000000);
+ moutdwm(ast, 0x1E6E0084, 0x00000000);
+ moutdwm(ast, 0x1E6E0088, param->reg_DQIDLY);
+ moutdwm(ast, 0x1E6E0018, 0x4040A170);
+ moutdwm(ast, 0x1E6E0018, 0x20402370);
+ moutdwm(ast, 0x1E6E0038, 0x00000000);
+ moutdwm(ast, 0x1E6E0040, 0xFF444444);
+ moutdwm(ast, 0x1E6E0044, 0x22222222);
+ moutdwm(ast, 0x1E6E0048, 0x22222222);
+ moutdwm(ast, 0x1E6E004C, 0x00000002);
+ moutdwm(ast, 0x1E6E0050, 0x80000000);
+ moutdwm(ast, 0x1E6E0050, 0x00000000);
+ moutdwm(ast, 0x1E6E0054, 0);
+ moutdwm(ast, 0x1E6E0060, param->reg_DRV);
+ moutdwm(ast, 0x1E6E006C, param->reg_IOZ);
+ moutdwm(ast, 0x1E6E0070, 0x00000000);
+ moutdwm(ast, 0x1E6E0074, 0x00000000);
+ moutdwm(ast, 0x1E6E0078, 0x00000000);
+ moutdwm(ast, 0x1E6E007C, 0x00000000);
+ /* Wait MCLK2X lock to MCLK */
+ do {
+ data = mindwm(ast, 0x1E6E001C);
+ } while (!(data & 0x08000000));
+ moutdwm(ast, 0x1E6E0034, 0x00000001);
+ moutdwm(ast, 0x1E6E000C, 0x00005C04);
+ udelay(10);
+ moutdwm(ast, 0x1E6E000C, 0x00000000);
+ moutdwm(ast, 0x1E6E0034, 0x00000000);
+ data = mindwm(ast, 0x1E6E001C);
+ data = (data >> 8) & 0xff;
+ while ((data & 0x08) || ((data & 0x7) < 2) || (data < 4)) {
+ data2 = (mindwm(ast, 0x1E6E0064) & 0xfff3ffff) + 4;
+ if ((data2 & 0xff) > param->madj_max) {
+ break;
+ }
+ moutdwm(ast, 0x1E6E0064, data2);
+ if (data2 & 0x00100000) {
+ data2 = ((data2 & 0xff) >> 3) + 3;
+ } else {
+ data2 = ((data2 & 0xff) >> 2) + 5;
+ }
+ data = mindwm(ast, 0x1E6E0068) & 0xffff00ff;
+ data2 += data & 0xff;
+ data = data | (data2 << 8);
+ moutdwm(ast, 0x1E6E0068, data);
+ udelay(10);
+ moutdwm(ast, 0x1E6E0064, mindwm(ast, 0x1E6E0064) | 0xC0000);
+ udelay(10);
+ data = mindwm(ast, 0x1E6E0018) & 0xfffff1ff;
+ moutdwm(ast, 0x1E6E0018, data);
+ data = data | 0x200;
+ moutdwm(ast, 0x1E6E0018, data);
+ do {
+ data = mindwm(ast, 0x1E6E001C);
+ } while (!(data & 0x08000000));
+
+ moutdwm(ast, 0x1E6E0034, 0x00000001);
+ moutdwm(ast, 0x1E6E000C, 0x00005C04);
+ udelay(10);
+ moutdwm(ast, 0x1E6E000C, 0x00000000);
+ moutdwm(ast, 0x1E6E0034, 0x00000000);
+ data = mindwm(ast, 0x1E6E001C);
+ data = (data >> 8) & 0xff;
+ }
+ data = mindwm(ast, 0x1E6E0018) | 0xC00;
+ moutdwm(ast, 0x1E6E0018, data);
+
+ moutdwm(ast, 0x1E6E0034, 0x00000001);
+ moutdwm(ast, 0x1E6E000C, 0x00000040);
+ udelay(50);
+ /* Mode Register Setting */
+ moutdwm(ast, 0x1E6E002C, param->reg_MRS | 0x100);
+ moutdwm(ast, 0x1E6E0030, param->reg_EMRS);
+ moutdwm(ast, 0x1E6E0028, 0x00000005);
+ moutdwm(ast, 0x1E6E0028, 0x00000007);
+ moutdwm(ast, 0x1E6E0028, 0x00000003);
+ moutdwm(ast, 0x1E6E0028, 0x00000001);
+ moutdwm(ast, 0x1E6E002C, param->reg_MRS);
+ moutdwm(ast, 0x1E6E000C, 0x00005C08);
+ moutdwm(ast, 0x1E6E0028, 0x00000001);
+
+ moutdwm(ast, 0x1E6E000C, 0x7FFF5C01);
+ data = 0;
+ if (param->wodt) {
+ data = 0x300;
+ }
+ if (param->rodt) {
+ data = data | 0x3000 | ((param->reg_AC2 & 0x60000) >> 3);
+ }
+ moutdwm(ast, 0x1E6E0034, data | 0x3);
+
+ /* Wait DQI delay lock */
+ do {
+ data = mindwm(ast, 0x1E6E0080);
+ } while (!(data & 0x40000000));
+ /* Wait DQSI delay lock */
+ do {
+ data = mindwm(ast, 0x1E6E0020);
+ } while (!(data & 0x00000800));
+ /* Calibrate the DQSI delay */
+ cbr_dll2(ast, param);
+
+ moutdwm(ast, 0x1E6E0120, param->reg_FREQ);
+ /* ECC Memory Initialization */
+#ifdef ECC
+ moutdwm(ast, 0x1E6E007C, 0x00000000);
+ moutdwm(ast, 0x1E6E0070, 0x221);
+ do {
+ data = mindwm(ast, 0x1E6E0070);
+ } while (!(data & 0x00001000));
+ moutdwm(ast, 0x1E6E0070, 0x00000000);
+ moutdwm(ast, 0x1E6E0050, 0x80000000);
+ moutdwm(ast, 0x1E6E0050, 0x00000000);
+#endif
+
+
+}
+
+static void get_ddr2_info(struct ast_private *ast, struct ast2300_dram_param *param)
+{
+ u32 trap, trap_AC2, trap_MRS;
+
+ moutdwm(ast, 0x1E6E2000, 0x1688A8A8);
+
+ /* Ger trap info */
+ trap = (mindwm(ast, 0x1E6E2070) >> 25) & 0x3;
+ trap_AC2 = (trap << 20) | (trap << 16);
+ trap_AC2 += 0x00110000;
+ trap_MRS = 0x00000040 | (trap << 4);
+
+
+ param->reg_MADJ = 0x00034C4C;
+ param->reg_SADJ = 0x00001800;
+ param->reg_DRV = 0x000000F0;
+ param->reg_PERIOD = param->dram_freq;
+ param->rodt = 0;
+
+ switch (param->dram_freq) {
+ case 264:
+ moutdwm(ast, 0x1E6E2020, 0x0130);
+ param->wodt = 0;
+ param->reg_AC1 = 0x11101513;
+ param->reg_AC2 = 0x78117011;
+ param->reg_DQSIC = 0x00000092;
+ param->reg_MRS = 0x00000842;
+ param->reg_EMRS = 0x00000000;
+ param->reg_DRV = 0x000000F0;
+ param->reg_IOZ = 0x00000034;
+ param->reg_DQIDLY = 0x0000005A;
+ param->reg_FREQ = 0x00004AC0;
+ param->madj_max = 138;
+ param->dll2_finetune_step = 3;
+ break;
+ case 336:
+ moutdwm(ast, 0x1E6E2020, 0x0190);
+ param->wodt = 1;
+ param->reg_AC1 = 0x22202613;
+ param->reg_AC2 = 0xAA009016 | trap_AC2;
+ param->reg_DQSIC = 0x000000BA;
+ param->reg_MRS = 0x00000A02 | trap_MRS;
+ param->reg_EMRS = 0x00000040;
+ param->reg_DRV = 0x000000FA;
+ param->reg_IOZ = 0x00000034;
+ param->reg_DQIDLY = 0x00000074;
+ param->reg_FREQ = 0x00004DC0;
+ param->madj_max = 96;
+ param->dll2_finetune_step = 3;
+ break;
+ default:
+ case 396:
+ moutdwm(ast, 0x1E6E2020, 0x03F1);
+ param->wodt = 1;
+ param->rodt = 0;
+ param->reg_AC1 = 0x33302714;
+ param->reg_AC2 = 0xCC00B01B | trap_AC2;
+ param->reg_DQSIC = 0x000000E2;
+ param->reg_MRS = 0x00000C02 | trap_MRS;
+ param->reg_EMRS = 0x00000040;
+ param->reg_DRV = 0x000000FA;
+ param->reg_IOZ = 0x00000034;
+ param->reg_DQIDLY = 0x00000089;
+ param->reg_FREQ = 0x000050C0;
+ param->madj_max = 96;
+ param->dll2_finetune_step = 4;
+
+ switch (param->dram_chipid) {
+ case AST_DRAM_512Mx16:
+ param->reg_AC2 = 0xCC00B016 | trap_AC2;
+ break;
+ default:
+ case AST_DRAM_1Gx16:
+ param->reg_AC2 = 0xCC00B01B | trap_AC2;
+ break;
+ case AST_DRAM_2Gx16:
+ param->reg_AC2 = 0xCC00B02B | trap_AC2;
+ break;
+ case AST_DRAM_4Gx16:
+ param->reg_AC2 = 0xCC00B03F | trap_AC2;
+ break;
+ }
+
+ break;
+
+ case 408:
+ moutdwm(ast, 0x1E6E2020, 0x01F0);
+ param->wodt = 1;
+ param->rodt = 0;
+ param->reg_AC1 = 0x33302714;
+ param->reg_AC2 = 0xCC00B01B | trap_AC2;
+ param->reg_DQSIC = 0x000000E2;
+ param->reg_MRS = 0x00000C02 | trap_MRS;
+ param->reg_EMRS = 0x00000040;
+ param->reg_DRV = 0x000000FA;
+ param->reg_IOZ = 0x00000034;
+ param->reg_DQIDLY = 0x00000089;
+ param->reg_FREQ = 0x000050C0;
+ param->madj_max = 96;
+ param->dll2_finetune_step = 4;
+
+ switch (param->dram_chipid) {
+ case AST_DRAM_512Mx16:
+ param->reg_AC2 = 0xCC00B016 | trap_AC2;
+ break;
+ default:
+ case AST_DRAM_1Gx16:
+ param->reg_AC2 = 0xCC00B01B | trap_AC2;
+ break;
+ case AST_DRAM_2Gx16:
+ param->reg_AC2 = 0xCC00B02B | trap_AC2;
+ break;
+ case AST_DRAM_4Gx16:
+ param->reg_AC2 = 0xCC00B03F | trap_AC2;
+ break;
+ }
+
+ break;
+ case 456:
+ moutdwm(ast, 0x1E6E2020, 0x0230);
+ param->wodt = 0;
+ param->reg_AC1 = 0x33302815;
+ param->reg_AC2 = 0xCD44B01E;
+ param->reg_DQSIC = 0x000000FC;
+ param->reg_MRS = 0x00000E72;
+ param->reg_EMRS = 0x00000000;
+ param->reg_DRV = 0x00000000;
+ param->reg_IOZ = 0x00000034;
+ param->reg_DQIDLY = 0x00000097;
+ param->reg_FREQ = 0x000052C0;
+ param->madj_max = 88;
+ param->dll2_finetune_step = 3;
+ break;
+ case 504:
+ moutdwm(ast, 0x1E6E2020, 0x0261);
+ param->wodt = 1;
+ param->rodt = 1;
+ param->reg_AC1 = 0x33302815;
+ param->reg_AC2 = 0xDE44C022;
+ param->reg_DQSIC = 0x00000117;
+ param->reg_MRS = 0x00000E72;
+ param->reg_EMRS = 0x00000040;
+ param->reg_DRV = 0x0000000A;
+ param->reg_IOZ = 0x00000045;
+ param->reg_DQIDLY = 0x000000A0;
+ param->reg_FREQ = 0x000054C0;
+ param->madj_max = 79;
+ param->dll2_finetune_step = 3;
+ break;
+ case 528:
+ moutdwm(ast, 0x1E6E2020, 0x0120);
+ param->wodt = 1;
+ param->rodt = 1;
+ param->reg_AC1 = 0x33302815;
+ param->reg_AC2 = 0xEF44D024;
+ param->reg_DQSIC = 0x00000125;
+ param->reg_MRS = 0x00000E72;
+ param->reg_EMRS = 0x00000004;
+ param->reg_DRV = 0x000000F9;
+ param->reg_IOZ = 0x00000045;
+ param->reg_DQIDLY = 0x000000A7;
+ param->reg_FREQ = 0x000055C0;
+ param->madj_max = 76;
+ param->dll2_finetune_step = 3;
+ break;
+ case 552:
+ moutdwm(ast, 0x1E6E2020, 0x02A1);
+ param->wodt = 1;
+ param->rodt = 1;
+ param->reg_AC1 = 0x43402915;
+ param->reg_AC2 = 0xFF44E025;
+ param->reg_DQSIC = 0x00000132;
+ param->reg_MRS = 0x00000E72;
+ param->reg_EMRS = 0x00000040;
+ param->reg_DRV = 0x0000000A;
+ param->reg_IOZ = 0x00000045;
+ param->reg_DQIDLY = 0x000000AD;
+ param->reg_FREQ = 0x000056C0;
+ param->madj_max = 76;
+ param->dll2_finetune_step = 3;
+ break;
+ case 576:
+ moutdwm(ast, 0x1E6E2020, 0x0140);
+ param->wodt = 1;
+ param->rodt = 1;
+ param->reg_AC1 = 0x43402915;
+ param->reg_AC2 = 0xFF44E027;
+ param->reg_DQSIC = 0x0000013F;
+ param->reg_MRS = 0x00000E72;
+ param->reg_EMRS = 0x00000004;
+ param->reg_DRV = 0x000000F5;
+ param->reg_IOZ = 0x00000045;
+ param->reg_DQIDLY = 0x000000B3;
+ param->reg_FREQ = 0x000057C0;
+ param->madj_max = 76;
+ param->dll2_finetune_step = 3;
+ break;
+ }
+
+ switch (param->dram_chipid) {
+ case AST_DRAM_512Mx16:
+ param->dram_config = 0x100;
+ break;
+ default:
+ case AST_DRAM_1Gx16:
+ param->dram_config = 0x121;
+ break;
+ case AST_DRAM_2Gx16:
+ param->dram_config = 0x122;
+ break;
+ case AST_DRAM_4Gx16:
+ param->dram_config = 0x123;
+ break;
+ }; /* switch size */
+
+ switch (param->vram_size) {
+ default:
+ case AST_VIDMEM_SIZE_8M:
+ param->dram_config |= 0x00;
+ break;
+ case AST_VIDMEM_SIZE_16M:
+ param->dram_config |= 0x04;
+ break;
+ case AST_VIDMEM_SIZE_32M:
+ param->dram_config |= 0x08;
+ break;
+ case AST_VIDMEM_SIZE_64M:
+ param->dram_config |= 0x0c;
+ break;
+ }
+}
+
+static void ddr2_init(struct ast_private *ast, struct ast2300_dram_param *param)
+{
+ u32 data, data2;
+
+ moutdwm(ast, 0x1E6E0000, 0xFC600309);
+ moutdwm(ast, 0x1E6E0018, 0x00000100);
+ moutdwm(ast, 0x1E6E0024, 0x00000000);
+ moutdwm(ast, 0x1E6E0064, param->reg_MADJ);
+ moutdwm(ast, 0x1E6E0068, param->reg_SADJ);
+ udelay(10);
+ moutdwm(ast, 0x1E6E0064, param->reg_MADJ | 0xC0000);
+ udelay(10);
+
+ moutdwm(ast, 0x1E6E0004, param->dram_config);
+ moutdwm(ast, 0x1E6E0008, 0x90040f);
+ moutdwm(ast, 0x1E6E0010, param->reg_AC1);
+ moutdwm(ast, 0x1E6E0014, param->reg_AC2);
+ moutdwm(ast, 0x1E6E0020, param->reg_DQSIC);
+ moutdwm(ast, 0x1E6E0080, 0x00000000);
+ moutdwm(ast, 0x1E6E0084, 0x00000000);
+ moutdwm(ast, 0x1E6E0088, param->reg_DQIDLY);
+ moutdwm(ast, 0x1E6E0018, 0x4040A130);
+ moutdwm(ast, 0x1E6E0018, 0x20402330);
+ moutdwm(ast, 0x1E6E0038, 0x00000000);
+ moutdwm(ast, 0x1E6E0040, 0xFF808000);
+ moutdwm(ast, 0x1E6E0044, 0x88848466);
+ moutdwm(ast, 0x1E6E0048, 0x44440008);
+ moutdwm(ast, 0x1E6E004C, 0x00000000);
+ moutdwm(ast, 0x1E6E0050, 0x80000000);
+ moutdwm(ast, 0x1E6E0050, 0x00000000);
+ moutdwm(ast, 0x1E6E0054, 0);
+ moutdwm(ast, 0x1E6E0060, param->reg_DRV);
+ moutdwm(ast, 0x1E6E006C, param->reg_IOZ);
+ moutdwm(ast, 0x1E6E0070, 0x00000000);
+ moutdwm(ast, 0x1E6E0074, 0x00000000);
+ moutdwm(ast, 0x1E6E0078, 0x00000000);
+ moutdwm(ast, 0x1E6E007C, 0x00000000);
+
+ /* Wait MCLK2X lock to MCLK */
+ do {
+ data = mindwm(ast, 0x1E6E001C);
+ } while (!(data & 0x08000000));
+ moutdwm(ast, 0x1E6E0034, 0x00000001);
+ moutdwm(ast, 0x1E6E000C, 0x00005C04);
+ udelay(10);
+ moutdwm(ast, 0x1E6E000C, 0x00000000);
+ moutdwm(ast, 0x1E6E0034, 0x00000000);
+ data = mindwm(ast, 0x1E6E001C);
+ data = (data >> 8) & 0xff;
+ while ((data & 0x08) || ((data & 0x7) < 2) || (data < 4)) {
+ data2 = (mindwm(ast, 0x1E6E0064) & 0xfff3ffff) + 4;
+ if ((data2 & 0xff) > param->madj_max) {
+ break;
+ }
+ moutdwm(ast, 0x1E6E0064, data2);
+ if (data2 & 0x00100000) {
+ data2 = ((data2 & 0xff) >> 3) + 3;
+ } else {
+ data2 = ((data2 & 0xff) >> 2) + 5;
+ }
+ data = mindwm(ast, 0x1E6E0068) & 0xffff00ff;
+ data2 += data & 0xff;
+ data = data | (data2 << 8);
+ moutdwm(ast, 0x1E6E0068, data);
+ udelay(10);
+ moutdwm(ast, 0x1E6E0064, mindwm(ast, 0x1E6E0064) | 0xC0000);
+ udelay(10);
+ data = mindwm(ast, 0x1E6E0018) & 0xfffff1ff;
+ moutdwm(ast, 0x1E6E0018, data);
+ data = data | 0x200;
+ moutdwm(ast, 0x1E6E0018, data);
+ do {
+ data = mindwm(ast, 0x1E6E001C);
+ } while (!(data & 0x08000000));
+
+ moutdwm(ast, 0x1E6E0034, 0x00000001);
+ moutdwm(ast, 0x1E6E000C, 0x00005C04);
+ udelay(10);
+ moutdwm(ast, 0x1E6E000C, 0x00000000);
+ moutdwm(ast, 0x1E6E0034, 0x00000000);
+ data = mindwm(ast, 0x1E6E001C);
+ data = (data >> 8) & 0xff;
+ }
+ data = mindwm(ast, 0x1E6E0018) | 0xC00;
+ moutdwm(ast, 0x1E6E0018, data);
+
+ moutdwm(ast, 0x1E6E0034, 0x00000001);
+ moutdwm(ast, 0x1E6E000C, 0x00000000);
+ udelay(50);
+ /* Mode Register Setting */
+ moutdwm(ast, 0x1E6E002C, param->reg_MRS | 0x100);
+ moutdwm(ast, 0x1E6E0030, param->reg_EMRS);
+ moutdwm(ast, 0x1E6E0028, 0x00000005);
+ moutdwm(ast, 0x1E6E0028, 0x00000007);
+ moutdwm(ast, 0x1E6E0028, 0x00000003);
+ moutdwm(ast, 0x1E6E0028, 0x00000001);
+
+ moutdwm(ast, 0x1E6E000C, 0x00005C08);
+ moutdwm(ast, 0x1E6E002C, param->reg_MRS);
+ moutdwm(ast, 0x1E6E0028, 0x00000001);
+ moutdwm(ast, 0x1E6E0030, param->reg_EMRS | 0x380);
+ moutdwm(ast, 0x1E6E0028, 0x00000003);
+ moutdwm(ast, 0x1E6E0030, param->reg_EMRS);
+ moutdwm(ast, 0x1E6E0028, 0x00000003);
+
+ moutdwm(ast, 0x1E6E000C, 0x7FFF5C01);
+ data = 0;
+ if (param->wodt) {
+ data = 0x500;
+ }
+ if (param->rodt) {
+ data = data | 0x3000 | ((param->reg_AC2 & 0x60000) >> 3);
+ }
+ moutdwm(ast, 0x1E6E0034, data | 0x3);
+ moutdwm(ast, 0x1E6E0120, param->reg_FREQ);
+
+ /* Wait DQI delay lock */
+ do {
+ data = mindwm(ast, 0x1E6E0080);
+ } while (!(data & 0x40000000));
+ /* Wait DQSI delay lock */
+ do {
+ data = mindwm(ast, 0x1E6E0020);
+ } while (!(data & 0x00000800));
+ /* Calibrate the DQSI delay */
+ cbr_dll2(ast, param);
+
+ /* ECC Memory Initialization */
+#ifdef ECC
+ moutdwm(ast, 0x1E6E007C, 0x00000000);
+ moutdwm(ast, 0x1E6E0070, 0x221);
+ do {
+ data = mindwm(ast, 0x1E6E0070);
+ } while (!(data & 0x00001000));
+ moutdwm(ast, 0x1E6E0070, 0x00000000);
+ moutdwm(ast, 0x1E6E0050, 0x80000000);
+ moutdwm(ast, 0x1E6E0050, 0x00000000);
+#endif
+
+}
+
+static void ast_init_dram_2300(struct drm_device *dev)
+{
+ struct ast_private *ast = dev->dev_private;
+ struct ast2300_dram_param param;
+ u32 temp;
+ u8 reg;
+
+ reg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff);
+ if ((reg & 0x80) == 0) {/* vga only */
+ ast_write32(ast, 0xf004, 0x1e6e0000);
+ ast_write32(ast, 0xf000, 0x1);
+ ast_write32(ast, 0x12000, 0x1688a8a8);
+ do {
+ ;
+ } while (ast_read32(ast, 0x12000) != 0x1);
+
+ ast_write32(ast, 0x10000, 0xfc600309);
+ do {
+ ;
+ } while (ast_read32(ast, 0x10000) != 0x1);
+
+ /* Slow down CPU/AHB CLK in VGA only mode */
+ temp = ast_read32(ast, 0x12008);
+ temp |= 0x73;
+ ast_write32(ast, 0x12008, temp);
+
+ param.dram_type = AST_DDR3;
+ if (temp & 0x01000000)
+ param.dram_type = AST_DDR2;
+ param.dram_chipid = ast->dram_type;
+ param.dram_freq = ast->mclk;
+ param.vram_size = ast->vram_size;
+
+ if (param.dram_type == AST_DDR3) {
+ get_ddr3_info(ast, ¶m);
+ ddr3_init(ast, ¶m);
+ } else {
+ get_ddr2_info(ast, ¶m);
+ ddr2_init(ast, ¶m);
+ }
+
+ temp = mindwm(ast, 0x1e6e2040);
+ moutdwm(ast, 0x1e6e2040, temp | 0x40);
+ }
+
+ /* wait ready */
+ do {
+ reg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff);
+ } while ((reg & 0x40) == 0);
+}
+
diff --git a/drivers/gpu/drm/ast/ast_tables.h b/drivers/gpu/drm/ast/ast_tables.h
new file mode 100644
index 00000000..95fa6aba
--- /dev/null
+++ b/drivers/gpu/drm/ast/ast_tables.h
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2005 ASPEED Technology Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the authors not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The authors makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/* Ported from xf86-video-ast driver */
+
+#ifndef AST_TABLES_H
+#define AST_TABLES_H
+
+/* Std. Table Index Definition */
+#define TextModeIndex 0
+#define EGAModeIndex 1
+#define VGAModeIndex 2
+#define HiCModeIndex 3
+#define TrueCModeIndex 4
+
+#define Charx8Dot 0x00000001
+#define HalfDCLK 0x00000002
+#define DoubleScanMode 0x00000004
+#define LineCompareOff 0x00000008
+#define SyncPP 0x00000000
+#define SyncPN 0x00000040
+#define SyncNP 0x00000080
+#define SyncNN 0x000000C0
+#define HBorder 0x00000020
+#define VBorder 0x00000010
+#define WideScreenMode 0x00000100
+
+
+/* DCLK Index */
+#define VCLK25_175 0x00
+#define VCLK28_322 0x01
+#define VCLK31_5 0x02
+#define VCLK36 0x03
+#define VCLK40 0x04
+#define VCLK49_5 0x05
+#define VCLK50 0x06
+#define VCLK56_25 0x07
+#define VCLK65 0x08
+#define VCLK75 0x09
+#define VCLK78_75 0x0A
+#define VCLK94_5 0x0B
+#define VCLK108 0x0C
+#define VCLK135 0x0D
+#define VCLK157_5 0x0E
+#define VCLK162 0x0F
+/* #define VCLK193_25 0x10 */
+#define VCLK154 0x10
+#define VCLK83_5 0x11
+#define VCLK106_5 0x12
+#define VCLK146_25 0x13
+#define VCLK148_5 0x14
+
+static struct ast_vbios_dclk_info dclk_table[] = {
+ {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */
+ {0x95, 0x62, 0x03}, /* 01: VCLK28_322 */
+ {0x67, 0x63, 0x01}, /* 02: VCLK31_5 */
+ {0x76, 0x63, 0x01}, /* 03: VCLK36 */
+ {0xEE, 0x67, 0x01}, /* 04: VCLK40 */
+ {0x82, 0x62, 0x01}, /* 05: VCLK49_5 */
+ {0xC6, 0x64, 0x01}, /* 06: VCLK50 */
+ {0x94, 0x62, 0x01}, /* 07: VCLK56_25 */
+ {0x80, 0x64, 0x00}, /* 08: VCLK65 */
+ {0x7B, 0x63, 0x00}, /* 09: VCLK75 */
+ {0x67, 0x62, 0x00}, /* 0A: VCLK78_75 */
+ {0x7C, 0x62, 0x00}, /* 0B: VCLK94_5 */
+ {0x8E, 0x62, 0x00}, /* 0C: VCLK108 */
+ {0x85, 0x24, 0x00}, /* 0D: VCLK135 */
+ {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */
+ {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */
+ {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */
+ {0xa7, 0x78, 0x80}, /* 11: VCLK83.5 */
+ {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */
+ {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */
+ {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */
+};
+
+static struct ast_vbios_stdtable vbios_stdtable[] = {
+ /* MD_2_3_400 */
+ {
+ 0x67,
+ {0x00,0x03,0x00,0x02},
+ {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
+ 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
+ 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
+ 0xff},
+ {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
+ 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
+ 0x0c,0x00,0x0f,0x08},
+ {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
+ 0xff}
+ },
+ /* Mode12/ExtEGATable */
+ {
+ 0xe3,
+ {0x01,0x0f,0x00,0x06},
+ {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,
+ 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3,
+ 0xff},
+ {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
+ 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
+ 0x01,0x00,0x0f,0x00},
+ {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
+ 0xff}
+ },
+ /* ExtVGATable */
+ {
+ 0x2f,
+ {0x01,0x0f,0x00,0x0e},
+ {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
+ 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
+ 0xff},
+ {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
+ 0x01,0x00,0x00,0x00},
+ {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
+ 0xff}
+ },
+ /* ExtHiCTable */
+ {
+ 0x2f,
+ {0x01,0x0f,0x00,0x0e},
+ {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
+ 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
+ 0xff},
+ {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
+ 0x01,0x00,0x00,0x00},
+ {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
+ 0xff}
+ },
+ /* ExtTrueCTable */
+ {
+ 0x2f,
+ {0x01,0x0f,0x00,0x0e},
+ {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
+ 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
+ 0xff},
+ {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
+ 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
+ 0x01,0x00,0x00,0x00},
+ {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
+ 0xff}
+ },
+};
+
+static struct ast_vbios_enhtable res_640x480[] = {
+ { 800, 640, 8, 96, 525, 480, 2, 2, VCLK25_175, /* 60Hz */
+ (SyncNN | HBorder | VBorder | Charx8Dot), 60, 1, 0x2E },
+ { 832, 640, 16, 40, 520, 480, 1, 3, VCLK31_5, /* 72Hz */
+ (SyncNN | HBorder | VBorder | Charx8Dot), 72, 2, 0x2E },
+ { 840, 640, 16, 64, 500, 480, 1, 3, VCLK31_5, /* 75Hz */
+ (SyncNN | Charx8Dot) , 75, 3, 0x2E },
+ { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* 85Hz */
+ (SyncNN | Charx8Dot) , 85, 4, 0x2E },
+ { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* end */
+ (SyncNN | Charx8Dot) , 0xFF, 4, 0x2E },
+};
+
+static struct ast_vbios_enhtable res_800x600[] = {
+ {1024, 800, 24, 72, 625, 600, 1, 2, VCLK36, /* 56Hz */
+ (SyncPP | Charx8Dot), 56, 1, 0x30 },
+ {1056, 800, 40, 128, 628, 600, 1, 4, VCLK40, /* 60Hz */
+ (SyncPP | Charx8Dot), 60, 2, 0x30 },
+ {1040, 800, 56, 120, 666, 600, 37, 6, VCLK50, /* 72Hz */
+ (SyncPP | Charx8Dot), 72, 3, 0x30 },
+ {1056, 800, 16, 80, 625, 600, 1, 3, VCLK49_5, /* 75Hz */
+ (SyncPP | Charx8Dot), 75, 4, 0x30 },
+ {1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25, /* 85Hz */
+ (SyncPP | Charx8Dot), 84, 5, 0x30 },
+ {1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25, /* end */
+ (SyncPP | Charx8Dot), 0xFF, 5, 0x30 },
+};
+
+
+static struct ast_vbios_enhtable res_1024x768[] = {
+ {1344, 1024, 24, 136, 806, 768, 3, 6, VCLK65, /* 60Hz */
+ (SyncNN | Charx8Dot), 60, 1, 0x31 },
+ {1328, 1024, 24, 136, 806, 768, 3, 6, VCLK75, /* 70Hz */
+ (SyncNN | Charx8Dot), 70, 2, 0x31 },
+ {1312, 1024, 16, 96, 800, 768, 1, 3, VCLK78_75, /* 75Hz */
+ (SyncPP | Charx8Dot), 75, 3, 0x31 },
+ {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* 85Hz */
+ (SyncPP | Charx8Dot), 84, 4, 0x31 },
+ {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* end */
+ (SyncPP | Charx8Dot), 0xFF, 4, 0x31 },
+};
+
+static struct ast_vbios_enhtable res_1280x1024[] = {
+ {1688, 1280, 48, 112, 1066, 1024, 1, 3, VCLK108, /* 60Hz */
+ (SyncPP | Charx8Dot), 60, 1, 0x32 },
+ {1688, 1280, 16, 144, 1066, 1024, 1, 3, VCLK135, /* 75Hz */
+ (SyncPP | Charx8Dot), 75, 2, 0x32 },
+ {1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5, /* 85Hz */
+ (SyncPP | Charx8Dot), 85, 3, 0x32 },
+ {1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5, /* end */
+ (SyncPP | Charx8Dot), 0xFF, 3, 0x32 },
+};
+
+static struct ast_vbios_enhtable res_1600x1200[] = {
+ {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* 60Hz */
+ (SyncPP | Charx8Dot), 60, 1, 0x33 },
+ {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* end */
+ (SyncPP | Charx8Dot), 0xFF, 1, 0x33 },
+};
+
+static struct ast_vbios_enhtable res_1920x1200[] = {
+ {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz */
+ (SyncNP | Charx8Dot), 60, 1, 0x34 },
+ {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz */
+ (SyncNP | Charx8Dot), 0xFF, 1, 0x34 },
+};
+
+/* 16:10 */
+static struct ast_vbios_enhtable res_1280x800[] = {
+ {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */
+ (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 60, 1, 0x35 },
+ {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */
+ (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 0xFF, 1, 0x35 },
+
+};
+
+static struct ast_vbios_enhtable res_1440x900[] = {
+ {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */
+ (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 60, 1, 0x36 },
+ {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */
+ (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 0xFF, 1, 0x36 },
+};
+
+static struct ast_vbios_enhtable res_1680x1050[] = {
+ {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */
+ (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 60, 1, 0x37 },
+ {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */
+ (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 0xFF, 1, 0x37 },
+};
+
+/* HDTV */
+static struct ast_vbios_enhtable res_1920x1080[] = {
+ {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* 60Hz */
+ (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode), 60, 1, 0x38 },
+ {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* 60Hz */
+ (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode), 0xFF, 1, 0x38 },
+};
+#endif
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
new file mode 100644
index 00000000..d5902e21
--- /dev/null
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -0,0 +1,454 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie
+ */
+#include
+#include "ast_drv.h"
+#include
+
+static inline struct ast_private *
+ast_bdev(struct ttm_bo_device *bd)
+{
+ return container_of(bd, struct ast_private, ttm.bdev);
+}
+
+static int
+ast_ttm_mem_global_init(struct drm_global_reference *ref)
+{
+ return ttm_mem_global_init(ref->object);
+}
+
+static void
+ast_ttm_mem_global_release(struct drm_global_reference *ref)
+{
+ ttm_mem_global_release(ref->object);
+}
+
+static int ast_ttm_global_init(struct ast_private *ast)
+{
+ struct drm_global_reference *global_ref;
+ int r;
+
+ global_ref = &ast->ttm.mem_global_ref;
+ global_ref->global_type = DRM_GLOBAL_TTM_MEM;
+ global_ref->size = sizeof(struct ttm_mem_global);
+ global_ref->init = &ast_ttm_mem_global_init;
+ global_ref->release = &ast_ttm_mem_global_release;
+ r = drm_global_item_ref(global_ref);
+ if (r != 0) {
+ DRM_ERROR("Failed setting up TTM memory accounting "
+ "subsystem.\n");
+ return r;
+ }
+
+ ast->ttm.bo_global_ref.mem_glob =
+ ast->ttm.mem_global_ref.object;
+ global_ref = &ast->ttm.bo_global_ref.ref;
+ global_ref->global_type = DRM_GLOBAL_TTM_BO;
+ global_ref->size = sizeof(struct ttm_bo_global);
+ global_ref->init = &ttm_bo_global_init;
+ global_ref->release = &ttm_bo_global_release;
+ r = drm_global_item_ref(global_ref);
+ if (r != 0) {
+ DRM_ERROR("Failed setting up TTM BO subsystem.\n");
+ drm_global_item_unref(&ast->ttm.mem_global_ref);
+ return r;
+ }
+ return 0;
+}
+
+void
+ast_ttm_global_release(struct ast_private *ast)
+{
+ if (ast->ttm.mem_global_ref.release == NULL)
+ return;
+
+ drm_global_item_unref(&ast->ttm.bo_global_ref.ref);
+ drm_global_item_unref(&ast->ttm.mem_global_ref);
+ ast->ttm.mem_global_ref.release = NULL;
+}
+
+
+static void ast_bo_ttm_destroy(struct ttm_buffer_object *tbo)
+{
+ struct ast_bo *bo;
+
+ bo = container_of(tbo, struct ast_bo, bo);
+
+ drm_gem_object_release(&bo->gem);
+ kfree(bo);
+}
+
+bool ast_ttm_bo_is_ast_bo(struct ttm_buffer_object *bo)
+{
+ if (bo->destroy == &ast_bo_ttm_destroy)
+ return true;
+ return false;
+}
+
+static int
+ast_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
+ struct ttm_mem_type_manager *man)
+{
+ switch (type) {
+ case TTM_PL_SYSTEM:
+ man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
+ man->available_caching = TTM_PL_MASK_CACHING;
+ man->default_caching = TTM_PL_FLAG_CACHED;
+ break;
+ case TTM_PL_VRAM:
+ man->func = &ttm_bo_manager_func;
+ man->flags = TTM_MEMTYPE_FLAG_FIXED |
+ TTM_MEMTYPE_FLAG_MAPPABLE;
+ man->available_caching = TTM_PL_FLAG_UNCACHED |
+ TTM_PL_FLAG_WC;
+ man->default_caching = TTM_PL_FLAG_WC;
+ break;
+ default:
+ DRM_ERROR("Unsupported memory type %u\n", (unsigned)type);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static void
+ast_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl)
+{
+ struct ast_bo *astbo = ast_bo(bo);
+
+ if (!ast_ttm_bo_is_ast_bo(bo))
+ return;
+
+ ast_ttm_placement(astbo, TTM_PL_FLAG_SYSTEM);
+ *pl = astbo->placement;
+}
+
+static int ast_bo_verify_access(struct ttm_buffer_object *bo, struct file *filp)
+{
+ return 0;
+}
+
+static int ast_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
+ struct ttm_mem_reg *mem)
+{
+ struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
+ struct ast_private *ast = ast_bdev(bdev);
+
+ mem->bus.addr = NULL;
+ mem->bus.offset = 0;
+ mem->bus.size = mem->num_pages << PAGE_SHIFT;
+ mem->bus.base = 0;
+ mem->bus.is_iomem = false;
+ if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE))
+ return -EINVAL;
+ switch (mem->mem_type) {
+ case TTM_PL_SYSTEM:
+ /* system memory */
+ return 0;
+ case TTM_PL_VRAM:
+ mem->bus.offset = mem->start << PAGE_SHIFT;
+ mem->bus.base = pci_resource_start(ast->dev->pdev, 0);
+ mem->bus.is_iomem = true;
+ break;
+ default:
+ return -EINVAL;
+ break;
+ }
+ return 0;
+}
+
+static void ast_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
+{
+}
+
+static int ast_bo_move(struct ttm_buffer_object *bo,
+ bool evict, bool interruptible,
+ bool no_wait_gpu,
+ struct ttm_mem_reg *new_mem)
+{
+ int r;
+ r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
+ return r;
+}
+
+
+static void ast_ttm_backend_destroy(struct ttm_tt *tt)
+{
+ ttm_tt_fini(tt);
+ kfree(tt);
+}
+
+static struct ttm_backend_func ast_tt_backend_func = {
+ .destroy = &ast_ttm_backend_destroy,
+};
+
+
+struct ttm_tt *ast_ttm_tt_create(struct ttm_bo_device *bdev,
+ unsigned long size, uint32_t page_flags,
+ struct page *dummy_read_page)
+{
+ struct ttm_tt *tt;
+
+ tt = kzalloc(sizeof(struct ttm_tt), GFP_KERNEL);
+ if (tt == NULL)
+ return NULL;
+ tt->func = &ast_tt_backend_func;
+ if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
+ kfree(tt);
+ return NULL;
+ }
+ return tt;
+}
+
+static int ast_ttm_tt_populate(struct ttm_tt *ttm)
+{
+ return ttm_pool_populate(ttm);
+}
+
+static void ast_ttm_tt_unpopulate(struct ttm_tt *ttm)
+{
+ ttm_pool_unpopulate(ttm);
+}
+
+struct ttm_bo_driver ast_bo_driver = {
+ .ttm_tt_create = ast_ttm_tt_create,
+ .ttm_tt_populate = ast_ttm_tt_populate,
+ .ttm_tt_unpopulate = ast_ttm_tt_unpopulate,
+ .init_mem_type = ast_bo_init_mem_type,
+ .evict_flags = ast_bo_evict_flags,
+ .move = ast_bo_move,
+ .verify_access = ast_bo_verify_access,
+ .io_mem_reserve = &ast_ttm_io_mem_reserve,
+ .io_mem_free = &ast_ttm_io_mem_free,
+};
+
+int ast_mm_init(struct ast_private *ast)
+{
+ int ret;
+ struct drm_device *dev = ast->dev;
+ struct ttm_bo_device *bdev = &ast->ttm.bdev;
+
+ ret = ast_ttm_global_init(ast);
+ if (ret)
+ return ret;
+
+ ret = ttm_bo_device_init(&ast->ttm.bdev,
+ ast->ttm.bo_global_ref.ref.object,
+ &ast_bo_driver, DRM_FILE_PAGE_OFFSET,
+ true);
+ if (ret) {
+ DRM_ERROR("Error initialising bo driver; %d\n", ret);
+ return ret;
+ }
+
+ ret = ttm_bo_init_mm(bdev, TTM_PL_VRAM,
+ ast->vram_size >> PAGE_SHIFT);
+ if (ret) {
+ DRM_ERROR("Failed ttm VRAM init: %d\n", ret);
+ return ret;
+ }
+
+ ast->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 0),
+ pci_resource_len(dev->pdev, 0),
+ DRM_MTRR_WC);
+
+ return 0;
+}
+
+void ast_mm_fini(struct ast_private *ast)
+{
+ struct drm_device *dev = ast->dev;
+ ttm_bo_device_release(&ast->ttm.bdev);
+
+ ast_ttm_global_release(ast);
+
+ if (ast->fb_mtrr >= 0) {
+ drm_mtrr_del(ast->fb_mtrr,
+ pci_resource_start(dev->pdev, 0),
+ pci_resource_len(dev->pdev, 0), DRM_MTRR_WC);
+ ast->fb_mtrr = -1;
+ }
+}
+
+void ast_ttm_placement(struct ast_bo *bo, int domain)
+{
+ u32 c = 0;
+ bo->placement.fpfn = 0;
+ bo->placement.lpfn = 0;
+ bo->placement.placement = bo->placements;
+ bo->placement.busy_placement = bo->placements;
+ if (domain & TTM_PL_FLAG_VRAM)
+ bo->placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM;
+ if (domain & TTM_PL_FLAG_SYSTEM)
+ bo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
+ if (!c)
+ bo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
+ bo->placement.num_placement = c;
+ bo->placement.num_busy_placement = c;
+}
+
+int ast_bo_reserve(struct ast_bo *bo, bool no_wait)
+{
+ int ret;
+
+ ret = ttm_bo_reserve(&bo->bo, true, no_wait, false, 0);
+ if (ret) {
+ if (ret != -ERESTARTSYS && ret != -EBUSY)
+ DRM_ERROR("reserve failed %p\n", bo);
+ return ret;
+ }
+ return 0;
+}
+
+void ast_bo_unreserve(struct ast_bo *bo)
+{
+ ttm_bo_unreserve(&bo->bo);
+}
+
+int ast_bo_create(struct drm_device *dev, int size, int align,
+ uint32_t flags, struct ast_bo **pastbo)
+{
+ struct ast_private *ast = dev->dev_private;
+ struct ast_bo *astbo;
+ size_t acc_size;
+ int ret;
+
+ astbo = kzalloc(sizeof(struct ast_bo), GFP_KERNEL);
+ if (!astbo)
+ return -ENOMEM;
+
+ ret = drm_gem_object_init(dev, &astbo->gem, size);
+ if (ret) {
+ kfree(astbo);
+ return ret;
+ }
+
+ astbo->gem.driver_private = NULL;
+ astbo->bo.bdev = &ast->ttm.bdev;
+ astbo->bo.bdev->dev_mapping = dev->dev_mapping;
+
+ ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
+
+ acc_size = ttm_bo_dma_acc_size(&ast->ttm.bdev, size,
+ sizeof(struct ast_bo));
+
+ ret = ttm_bo_init(&ast->ttm.bdev, &astbo->bo, size,
+ ttm_bo_type_device, &astbo->placement,
+ align >> PAGE_SHIFT, false, NULL, acc_size,
+ NULL, ast_bo_ttm_destroy);
+ if (ret)
+ return ret;
+
+ *pastbo = astbo;
+ return 0;
+}
+
+static inline u64 ast_bo_gpu_offset(struct ast_bo *bo)
+{
+ return bo->bo.offset;
+}
+
+int ast_bo_pin(struct ast_bo *bo, u32 pl_flag, u64 *gpu_addr)
+{
+ int i, ret;
+
+ if (bo->pin_count) {
+ bo->pin_count++;
+ if (gpu_addr)
+ *gpu_addr = ast_bo_gpu_offset(bo);
+ }
+
+ ast_ttm_placement(bo, pl_flag);
+ for (i = 0; i < bo->placement.num_placement; i++)
+ bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
+ ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
+ if (ret)
+ return ret;
+
+ bo->pin_count = 1;
+ if (gpu_addr)
+ *gpu_addr = ast_bo_gpu_offset(bo);
+ return 0;
+}
+
+int ast_bo_unpin(struct ast_bo *bo)
+{
+ int i, ret;
+ if (!bo->pin_count) {
+ DRM_ERROR("unpin bad %p\n", bo);
+ return 0;
+ }
+ bo->pin_count--;
+ if (bo->pin_count)
+ return 0;
+
+ for (i = 0; i < bo->placement.num_placement ; i++)
+ bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT;
+ ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+int ast_bo_push_sysram(struct ast_bo *bo)
+{
+ int i, ret;
+ if (!bo->pin_count) {
+ DRM_ERROR("unpin bad %p\n", bo);
+ return 0;
+ }
+ bo->pin_count--;
+ if (bo->pin_count)
+ return 0;
+
+ if (bo->kmap.virtual)
+ ttm_bo_kunmap(&bo->kmap);
+
+ ast_ttm_placement(bo, TTM_PL_FLAG_SYSTEM);
+ for (i = 0; i < bo->placement.num_placement ; i++)
+ bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
+
+ ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
+ if (ret) {
+ DRM_ERROR("pushing to VRAM failed\n");
+ return ret;
+ }
+ return 0;
+}
+
+int ast_mmap(struct file *filp, struct vm_area_struct *vma)
+{
+ struct drm_file *file_priv;
+ struct ast_private *ast;
+
+ if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
+ return drm_mmap(filp, vma);
+
+ file_priv = filp->private_data;
+ ast = file_priv->minor->dev->dev_private;
+ return ttm_bo_mmap(filp, vma, &ast->ttm.bdev);
+}
diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c
new file mode 100644
index 00000000..c399dea2
--- /dev/null
+++ b/drivers/gpu/drm/ati_pcigart.c
@@ -0,0 +1,202 @@
+/**
+ * \file ati_pcigart.c
+ * ATI PCI GART support
+ *
+ * \author Gareth Hughes
+ */
+
+/*
+ * Created: Wed Dec 13 21:52:19 2000 by gareth@valinux.com
+ *
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include
+#include
+
+# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */
+
+static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
+ struct drm_ati_pcigart_info *gart_info)
+{
+ gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size,
+ PAGE_SIZE);
+ if (gart_info->table_handle == NULL)
+ return -ENOMEM;
+
+ return 0;
+}
+
+static void drm_ati_free_pcigart_table(struct drm_device *dev,
+ struct drm_ati_pcigart_info *gart_info)
+{
+ drm_pci_free(dev, gart_info->table_handle);
+ gart_info->table_handle = NULL;
+}
+
+int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info)
+{
+ struct drm_sg_mem *entry = dev->sg;
+ unsigned long pages;
+ int i;
+ int max_pages;
+
+ /* we need to support large memory configurations */
+ if (!entry) {
+ DRM_ERROR("no scatter/gather memory!\n");
+ return 0;
+ }
+
+ if (gart_info->bus_addr) {
+
+ max_pages = (gart_info->table_size / sizeof(u32));
+ pages = (entry->pages <= max_pages)
+ ? entry->pages : max_pages;
+
+ for (i = 0; i < pages; i++) {
+ if (!entry->busaddr[i])
+ break;
+ pci_unmap_page(dev->pdev, entry->busaddr[i],
+ PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+ }
+
+ if (gart_info->gart_table_location == DRM_ATI_GART_MAIN)
+ gart_info->bus_addr = 0;
+ }
+
+ if (gart_info->gart_table_location == DRM_ATI_GART_MAIN &&
+ gart_info->table_handle) {
+ drm_ati_free_pcigart_table(dev, gart_info);
+ }
+
+ return 1;
+}
+EXPORT_SYMBOL(drm_ati_pcigart_cleanup);
+
+int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info)
+{
+ struct drm_local_map *map = &gart_info->mapping;
+ struct drm_sg_mem *entry = dev->sg;
+ void *address = NULL;
+ unsigned long pages;
+ u32 *pci_gart = NULL, page_base, gart_idx;
+ dma_addr_t bus_address = 0;
+ int i, j, ret = 0;
+ int max_ati_pages, max_real_pages;
+
+ if (!entry) {
+ DRM_ERROR("no scatter/gather memory!\n");
+ goto done;
+ }
+
+ if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
+ DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
+
+ if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) {
+ DRM_ERROR("fail to set dma mask to 0x%Lx\n",
+ (unsigned long long)gart_info->table_mask);
+ ret = 1;
+ goto done;
+ }
+
+ ret = drm_ati_alloc_pcigart_table(dev, gart_info);
+ if (ret) {
+ DRM_ERROR("cannot allocate PCI GART page!\n");
+ goto done;
+ }
+
+ pci_gart = gart_info->table_handle->vaddr;
+ address = gart_info->table_handle->vaddr;
+ bus_address = gart_info->table_handle->busaddr;
+ } else {
+ address = gart_info->addr;
+ bus_address = gart_info->bus_addr;
+ DRM_DEBUG("PCI: Gart Table: VRAM %08LX mapped at %08lX\n",
+ (unsigned long long)bus_address,
+ (unsigned long)address);
+ }
+
+
+ max_ati_pages = (gart_info->table_size / sizeof(u32));
+ max_real_pages = max_ati_pages / (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE);
+ pages = (entry->pages <= max_real_pages)
+ ? entry->pages : max_real_pages;
+
+ if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
+ memset(pci_gart, 0, max_ati_pages * sizeof(u32));
+ } else {
+ memset_io((void __iomem *)map->handle, 0, max_ati_pages * sizeof(u32));
+ }
+
+ gart_idx = 0;
+ for (i = 0; i < pages; i++) {
+ /* we need to support large memory configurations */
+ entry->busaddr[i] = pci_map_page(dev->pdev, entry->pagelist[i],
+ 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+ if (pci_dma_mapping_error(dev->pdev, entry->busaddr[i])) {
+ DRM_ERROR("unable to map PCIGART pages!\n");
+ drm_ati_pcigart_cleanup(dev, gart_info);
+ address = NULL;
+ bus_address = 0;
+ goto done;
+ }
+ page_base = (u32) entry->busaddr[i];
+
+ for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
+ u32 val;
+
+ switch(gart_info->gart_reg_if) {
+ case DRM_ATI_GART_IGP:
+ val = page_base | 0xc;
+ break;
+ case DRM_ATI_GART_PCIE:
+ val = (page_base >> 8) | 0xc;
+ break;
+ default:
+ case DRM_ATI_GART_PCI:
+ val = page_base;
+ break;
+ }
+ if (gart_info->gart_table_location ==
+ DRM_ATI_GART_MAIN)
+ pci_gart[gart_idx] = cpu_to_le32(val);
+ else
+ DRM_WRITE32(map, gart_idx * sizeof(u32), val);
+ gart_idx++;
+ page_base += ATI_PCIGART_PAGE_SIZE;
+ }
+ }
+ ret = 1;
+
+#if defined(__i386__) || defined(__x86_64__)
+ wbinvd();
+#else
+ mb();
+#endif
+
+ done:
+ gart_info->addr = address;
+ gart_info->bus_addr = bus_address;
+ return ret;
+}
+EXPORT_SYMBOL(drm_ati_pcigart_init);
diff --git a/drivers/gpu/drm/cirrus/Kconfig b/drivers/gpu/drm/cirrus/Kconfig
new file mode 100644
index 00000000..bf67b227
--- /dev/null
+++ b/drivers/gpu/drm/cirrus/Kconfig
@@ -0,0 +1,12 @@
+config DRM_CIRRUS_QEMU
+ tristate "Cirrus driver for QEMU emulated device"
+ depends on DRM && PCI
+ select FB_SYS_FILLRECT
+ select FB_SYS_COPYAREA
+ select FB_SYS_IMAGEBLIT
+ select DRM_KMS_HELPER
+ select DRM_TTM
+ help
+ This is a KMS driver for emulated cirrus device in qemu.
+ It is *NOT* intended for real cirrus devices. This requires
+ the modesetting userspace X.org driver.
diff --git a/drivers/gpu/drm/cirrus/Makefile b/drivers/gpu/drm/cirrus/Makefile
new file mode 100644
index 00000000..69ffe700
--- /dev/null
+++ b/drivers/gpu/drm/cirrus/Makefile
@@ -0,0 +1,5 @@
+ccflags-y := -Iinclude/drm
+cirrus-y := cirrus_main.o cirrus_mode.o \
+ cirrus_drv.o cirrus_fbdev.o cirrus_ttm.o
+
+obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
new file mode 100644
index 00000000..64bfc235
--- /dev/null
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2012 Red Hat
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License version 2. See the file COPYING in the main
+ * directory of this archive for more details.
+ *
+ * Authors: Matthew Garrett
+ * Dave Airlie
+ */
+#include
+#include
+#include
+#include
+
+#include "cirrus_drv.h"
+
+int cirrus_modeset = -1;
+
+MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
+module_param_named(modeset, cirrus_modeset, int, 0400);
+
+/*
+ * This is the generic driver code. This binds the driver to the drm core,
+ * which then performs further device association and calls our graphics init
+ * functions
+ */
+
+static struct drm_driver driver;
+
+/* only bind to the cirrus chip in qemu */
+static DEFINE_PCI_DEVICE_TABLE(pciidlist) = {
+ { PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, 0x1af4, 0x1100, 0,
+ 0, 0 },
+ {0,}
+};
+
+
+static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev)
+{
+ struct apertures_struct *ap;
+ bool primary = false;
+
+ ap = alloc_apertures(1);
+ if (!ap)
+ return -ENOMEM;
+
+ ap->ranges[0].base = pci_resource_start(pdev, 0);
+ ap->ranges[0].size = pci_resource_len(pdev, 0);
+
+#ifdef CONFIG_X86
+ primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
+#endif
+ remove_conflicting_framebuffers(ap, "cirrusdrmfb", primary);
+ kfree(ap);
+
+ return 0;
+}
+
+static int cirrus_pci_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
+{
+ int ret;
+
+ ret = cirrus_kick_out_firmware_fb(pdev);
+ if (ret)
+ return ret;
+
+ return drm_get_pci_dev(pdev, ent, &driver);
+}
+
+static void cirrus_pci_remove(struct pci_dev *pdev)
+{
+ struct drm_device *dev = pci_get_drvdata(pdev);
+
+ drm_put_dev(dev);
+}
+
+static int cirrus_pm_suspend(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct drm_device *drm_dev = pci_get_drvdata(pdev);
+ struct cirrus_device *cdev = drm_dev->dev_private;
+
+ drm_kms_helper_poll_disable(drm_dev);
+
+ if (cdev->mode_info.gfbdev) {
+ console_lock();
+ fb_set_suspend(cdev->mode_info.gfbdev->helper.fbdev, 1);
+ console_unlock();
+ }
+
+ return 0;
+}
+
+static int cirrus_pm_resume(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ struct drm_device *drm_dev = pci_get_drvdata(pdev);
+ struct cirrus_device *cdev = drm_dev->dev_private;
+
+ drm_helper_resume_force_mode(drm_dev);
+
+ if (cdev->mode_info.gfbdev) {
+ console_lock();
+ fb_set_suspend(cdev->mode_info.gfbdev->helper.fbdev, 0);
+ console_unlock();
+ }
+
+ drm_kms_helper_poll_enable(drm_dev);
+ return 0;
+}
+
+static const struct file_operations cirrus_driver_fops = {
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .unlocked_ioctl = drm_ioctl,
+ .mmap = cirrus_mmap,
+ .poll = drm_poll,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = drm_compat_ioctl,
+#endif
+ .fasync = drm_fasync,
+};
+static struct drm_driver driver = {
+ .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_USE_MTRR,
+ .load = cirrus_driver_load,
+ .unload = cirrus_driver_unload,
+ .fops = &cirrus_driver_fops,
+ .name = DRIVER_NAME,
+ .desc = DRIVER_DESC,
+ .date = DRIVER_DATE,
+ .major = DRIVER_MAJOR,
+ .minor = DRIVER_MINOR,
+ .patchlevel = DRIVER_PATCHLEVEL,
+ .gem_init_object = cirrus_gem_init_object,
+ .gem_free_object = cirrus_gem_free_object,
+ .dumb_create = cirrus_dumb_create,
+ .dumb_map_offset = cirrus_dumb_mmap_offset,
+ .dumb_destroy = cirrus_dumb_destroy,
+};
+
+static const struct dev_pm_ops cirrus_pm_ops = {
+ SET_SYSTEM_SLEEP_PM_OPS(cirrus_pm_suspend,
+ cirrus_pm_resume)
+};
+
+static struct pci_driver cirrus_pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = cirrus_pci_probe,
+ .remove = cirrus_pci_remove,
+ .driver.pm = &cirrus_pm_ops,
+};
+
+static int __init cirrus_init(void)
+{
+#ifdef CONFIG_VGA_CONSOLE
+ if (vgacon_text_force() && cirrus_modeset == -1)
+ return -EINVAL;
+#endif
+
+ if (cirrus_modeset == 0)
+ return -EINVAL;
+ return drm_pci_init(&driver, &cirrus_pci_driver);
+}
+
+static void __exit cirrus_exit(void)
+{
+ drm_pci_exit(&driver, &cirrus_pci_driver);
+}
+
+module_init(cirrus_init);
+module_exit(cirrus_exit);
+
+MODULE_DEVICE_TABLE(pci, pciidlist);
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.h b/drivers/gpu/drm/cirrus/cirrus_drv.h
new file mode 100644
index 00000000..7ca05959
--- /dev/null
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.h
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2012 Red Hat
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License version 2. See the file COPYING in the main
+ * directory of this archive for more details.
+ *
+ * Authors: Matthew Garrett
+ * Dave Airlie
+ */
+#ifndef __CIRRUS_DRV_H__
+#define __CIRRUS_DRV_H__
+
+#include