Merge tag 'drm-fixes-v4.7-rc1' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: - one IMX built-in regression fix - a set of amdgpu fixes, mostly powerplay and polaris GPU stuff - a set of i915 fixes all over, many cc'ed to stable. The i915 batch contain support for DP++ dongle detection, which is used to fix some regressions in the HDMI color depth area * tag 'drm-fixes-v4.7-rc1' of git://people.freedesktop.org/~airlied/linux: (44 commits) drm/amd: add Kconfig dependency for ACP on DRM_AMDGPU drm/amdgpu: Fix hdmi deep color support. drm/amdgpu: fix bug in fence driver fini drm/i915: Stop automatically retiring requests after a GPU hang drm/i915: Unify intel_ring_begin() drm/i915: Ignore stale wm register values on resume on ilk-bdw (v2) drm/i915/psr: Try to program link training times correctly drm/imx: Match imx-ipuv3-crtc components using device node in platform data drm/i915/bxt: Adjusting the error in horizontal timings retrieval drm/i915: Don't leave old junk in ilk active watermarks on readout drm/i915: s/DPPL/DPLL/ for SKL DPLLs drm/i915: Fix gen8 semaphores id for legacy mode drm/i915: Set crtc_state->lane_count for HDMI drm/i915/BXT: Retrieving the horizontal timing for DSI drm/i915: Protect gen7 irq_seqno_barrier with uncore lock drm/i915: Re-enable GGTT earlier during resume on pre-gen6 platforms drm/i915: Determine DP++ type 1 DVI adaptor presence based on VBT drm/i915: Enable/disable TMDS output buffers in DP++ adaptor as needed drm/i915: Respect DP++ adaptor TMDS clock limit drm: Add helper for DP++ adaptors ...
This commit is contained in:
Коммит
c61b49c79e
|
@ -1626,6 +1626,12 @@ void intel_crt_init(struct drm_device *dev)
|
|||
!Pdrivers/gpu/drm/drm_dp_helper.c dp helpers
|
||||
!Iinclude/drm/drm_dp_helper.h
|
||||
!Edrivers/gpu/drm/drm_dp_helper.c
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>Display Port Dual Mode Adaptor Helper Functions Reference</title>
|
||||
!Pdrivers/gpu/drm/drm_dp_dual_mode_helper.c dp dual mode helpers
|
||||
!Iinclude/drm/drm_dp_dual_mode_helper.h
|
||||
!Edrivers/gpu/drm/drm_dp_dual_mode_helper.c
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>Display Port MST Helper Functions Reference</title>
|
||||
|
|
|
@ -23,7 +23,7 @@ drm-$(CONFIG_AGP) += drm_agpsupport.o
|
|||
|
||||
drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \
|
||||
drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \
|
||||
drm_kms_helper_common.o
|
||||
drm_kms_helper_common.o drm_dp_dual_mode_helper.o
|
||||
|
||||
drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
|
||||
drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
|
||||
|
|
|
@ -2,6 +2,7 @@ menu "ACP (Audio CoProcessor) Configuration"
|
|||
|
||||
config DRM_AMD_ACP
|
||||
bool "Enable AMD Audio CoProcessor IP support"
|
||||
depends on DRM_AMDGPU
|
||||
select MFD_CORE
|
||||
select PM_GENERIC_DOMAINS if PM
|
||||
help
|
||||
|
|
|
@ -602,6 +602,8 @@ int amdgpu_sync_wait(struct amdgpu_sync *sync);
|
|||
void amdgpu_sync_free(struct amdgpu_sync *sync);
|
||||
int amdgpu_sync_init(void);
|
||||
void amdgpu_sync_fini(void);
|
||||
int amdgpu_fence_slab_init(void);
|
||||
void amdgpu_fence_slab_fini(void);
|
||||
|
||||
/*
|
||||
* GART structures, functions & helpers
|
||||
|
|
|
@ -194,12 +194,12 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)
|
|||
bpc = 8;
|
||||
DRM_DEBUG("%s: HDMI deep color 10 bpc exceeds max tmds clock. Using %d bpc.\n",
|
||||
connector->name, bpc);
|
||||
} else if (bpc > 8) {
|
||||
/* max_tmds_clock missing, but hdmi spec mandates it for deep color. */
|
||||
DRM_DEBUG("%s: Required max tmds clock for HDMI deep color missing. Using 8 bpc.\n",
|
||||
connector->name);
|
||||
bpc = 8;
|
||||
}
|
||||
} else if (bpc > 8) {
|
||||
/* max_tmds_clock missing, but hdmi spec mandates it for deep color. */
|
||||
DRM_DEBUG("%s: Required max tmds clock for HDMI deep color missing. Using 8 bpc.\n",
|
||||
connector->name);
|
||||
bpc = 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,9 +50,11 @@
|
|||
* KMS wrapper.
|
||||
* - 3.0.0 - initial driver
|
||||
* - 3.1.0 - allow reading more status registers (GRBM, SRBM, SDMA, CP)
|
||||
* - 3.2.0 - GFX8: Uses EOP_TC_WB_ACTION_EN, so UMDs don't have to do the same
|
||||
* at the end of IBs.
|
||||
*/
|
||||
#define KMS_DRIVER_MAJOR 3
|
||||
#define KMS_DRIVER_MINOR 1
|
||||
#define KMS_DRIVER_MINOR 2
|
||||
#define KMS_DRIVER_PATCHLEVEL 0
|
||||
|
||||
int amdgpu_vram_limit = 0;
|
||||
|
@ -279,14 +281,26 @@ static const struct pci_device_id pciidlist[] = {
|
|||
{0x1002, 0x98E4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_STONEY|AMD_IS_APU},
|
||||
/* Polaris11 */
|
||||
{0x1002, 0x67E0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
{0x1002, 0x67E1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
{0x1002, 0x67E3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
{0x1002, 0x67E8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
{0x1002, 0x67E9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
{0x1002, 0x67EB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
{0x1002, 0x67EF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
{0x1002, 0x67FF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
{0x1002, 0x67E1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
{0x1002, 0x67E7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
{0x1002, 0x67E9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS11},
|
||||
/* Polaris10 */
|
||||
{0x1002, 0x67C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
{0x1002, 0x67C1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
{0x1002, 0x67C2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
{0x1002, 0x67C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
{0x1002, 0x67C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
{0x1002, 0x67DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
{0x1002, 0x67C8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
{0x1002, 0x67C9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
{0x1002, 0x67CA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
{0x1002, 0x67CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
{0x1002, 0x67CF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS10},
|
||||
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
@ -563,9 +577,12 @@ static struct pci_driver amdgpu_kms_pci_driver = {
|
|||
.driver.pm = &amdgpu_pm_ops,
|
||||
};
|
||||
|
||||
|
||||
|
||||
static int __init amdgpu_init(void)
|
||||
{
|
||||
amdgpu_sync_init();
|
||||
amdgpu_fence_slab_init();
|
||||
if (vgacon_text_force()) {
|
||||
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
|
||||
return -EINVAL;
|
||||
|
@ -576,7 +593,6 @@ static int __init amdgpu_init(void)
|
|||
driver->driver_features |= DRIVER_MODESET;
|
||||
driver->num_ioctls = amdgpu_max_kms_ioctl;
|
||||
amdgpu_register_atpx_handler();
|
||||
|
||||
/* let modprobe override vga console setting */
|
||||
return drm_pci_init(driver, pdriver);
|
||||
}
|
||||
|
@ -587,6 +603,7 @@ static void __exit amdgpu_exit(void)
|
|||
drm_pci_exit(driver, pdriver);
|
||||
amdgpu_unregister_atpx_handler();
|
||||
amdgpu_sync_fini();
|
||||
amdgpu_fence_slab_fini();
|
||||
}
|
||||
|
||||
module_init(amdgpu_init);
|
||||
|
|
|
@ -55,8 +55,21 @@ struct amdgpu_fence {
|
|||
};
|
||||
|
||||
static struct kmem_cache *amdgpu_fence_slab;
|
||||
static atomic_t amdgpu_fence_slab_ref = ATOMIC_INIT(0);
|
||||
|
||||
int amdgpu_fence_slab_init(void)
|
||||
{
|
||||
amdgpu_fence_slab = kmem_cache_create(
|
||||
"amdgpu_fence", sizeof(struct amdgpu_fence), 0,
|
||||
SLAB_HWCACHE_ALIGN, NULL);
|
||||
if (!amdgpu_fence_slab)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void amdgpu_fence_slab_fini(void)
|
||||
{
|
||||
kmem_cache_destroy(amdgpu_fence_slab);
|
||||
}
|
||||
/*
|
||||
* Cast helper
|
||||
*/
|
||||
|
@ -396,13 +409,6 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
|
|||
*/
|
||||
int amdgpu_fence_driver_init(struct amdgpu_device *adev)
|
||||
{
|
||||
if (atomic_inc_return(&amdgpu_fence_slab_ref) == 1) {
|
||||
amdgpu_fence_slab = kmem_cache_create(
|
||||
"amdgpu_fence", sizeof(struct amdgpu_fence), 0,
|
||||
SLAB_HWCACHE_ALIGN, NULL);
|
||||
if (!amdgpu_fence_slab)
|
||||
return -ENOMEM;
|
||||
}
|
||||
if (amdgpu_debugfs_fence_init(adev))
|
||||
dev_err(adev->dev, "fence debugfs file creation failed\n");
|
||||
|
||||
|
@ -437,13 +443,10 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev)
|
|||
amd_sched_fini(&ring->sched);
|
||||
del_timer_sync(&ring->fence_drv.fallback_timer);
|
||||
for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j)
|
||||
fence_put(ring->fence_drv.fences[i]);
|
||||
fence_put(ring->fence_drv.fences[j]);
|
||||
kfree(ring->fence_drv.fences);
|
||||
ring->fence_drv.initialized = false;
|
||||
}
|
||||
|
||||
if (atomic_dec_and_test(&amdgpu_fence_slab_ref))
|
||||
kmem_cache_destroy(amdgpu_fence_slab);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,6 +53,18 @@
|
|||
/* Special value that no flush is necessary */
|
||||
#define AMDGPU_VM_NO_FLUSH (~0ll)
|
||||
|
||||
/* Local structure. Encapsulate some VM table update parameters to reduce
|
||||
* the number of function parameters
|
||||
*/
|
||||
struct amdgpu_vm_update_params {
|
||||
/* address where to copy page table entries from */
|
||||
uint64_t src;
|
||||
/* DMA addresses to use for mapping */
|
||||
dma_addr_t *pages_addr;
|
||||
/* indirect buffer to fill with commands */
|
||||
struct amdgpu_ib *ib;
|
||||
};
|
||||
|
||||
/**
|
||||
* amdgpu_vm_num_pde - return the number of page directory entries
|
||||
*
|
||||
|
@ -389,9 +401,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_find(struct amdgpu_vm *vm,
|
|||
* amdgpu_vm_update_pages - helper to call the right asic function
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @src: address where to copy page table entries from
|
||||
* @pages_addr: DMA addresses to use for mapping
|
||||
* @ib: indirect buffer to fill with commands
|
||||
* @vm_update_params: see amdgpu_vm_update_params definition
|
||||
* @pe: addr of the page entry
|
||||
* @addr: dst addr to write into pe
|
||||
* @count: number of page entries to update
|
||||
|
@ -402,29 +412,29 @@ struct amdgpu_bo_va *amdgpu_vm_bo_find(struct amdgpu_vm *vm,
|
|||
* to setup the page table using the DMA.
|
||||
*/
|
||||
static void amdgpu_vm_update_pages(struct amdgpu_device *adev,
|
||||
uint64_t src,
|
||||
dma_addr_t *pages_addr,
|
||||
struct amdgpu_ib *ib,
|
||||
struct amdgpu_vm_update_params
|
||||
*vm_update_params,
|
||||
uint64_t pe, uint64_t addr,
|
||||
unsigned count, uint32_t incr,
|
||||
uint32_t flags)
|
||||
{
|
||||
trace_amdgpu_vm_set_page(pe, addr, count, incr, flags);
|
||||
|
||||
if (src) {
|
||||
src += (addr >> 12) * 8;
|
||||
amdgpu_vm_copy_pte(adev, ib, pe, src, count);
|
||||
if (vm_update_params->src) {
|
||||
amdgpu_vm_copy_pte(adev, vm_update_params->ib,
|
||||
pe, (vm_update_params->src + (addr >> 12) * 8), count);
|
||||
|
||||
} else if (pages_addr) {
|
||||
amdgpu_vm_write_pte(adev, ib, pages_addr, pe, addr,
|
||||
count, incr, flags);
|
||||
} else if (vm_update_params->pages_addr) {
|
||||
amdgpu_vm_write_pte(adev, vm_update_params->ib,
|
||||
vm_update_params->pages_addr,
|
||||
pe, addr, count, incr, flags);
|
||||
|
||||
} else if (count < 3) {
|
||||
amdgpu_vm_write_pte(adev, ib, NULL, pe, addr,
|
||||
amdgpu_vm_write_pte(adev, vm_update_params->ib, NULL, pe, addr,
|
||||
count, incr, flags);
|
||||
|
||||
} else {
|
||||
amdgpu_vm_set_pte_pde(adev, ib, pe, addr,
|
||||
amdgpu_vm_set_pte_pde(adev, vm_update_params->ib, pe, addr,
|
||||
count, incr, flags);
|
||||
}
|
||||
}
|
||||
|
@ -444,10 +454,12 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
|
|||
struct amdgpu_ring *ring;
|
||||
struct fence *fence = NULL;
|
||||
struct amdgpu_job *job;
|
||||
struct amdgpu_vm_update_params vm_update_params;
|
||||
unsigned entries;
|
||||
uint64_t addr;
|
||||
int r;
|
||||
|
||||
memset(&vm_update_params, 0, sizeof(vm_update_params));
|
||||
ring = container_of(vm->entity.sched, struct amdgpu_ring, sched);
|
||||
|
||||
r = reservation_object_reserve_shared(bo->tbo.resv);
|
||||
|
@ -465,7 +477,8 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
|
|||
if (r)
|
||||
goto error;
|
||||
|
||||
amdgpu_vm_update_pages(adev, 0, NULL, &job->ibs[0], addr, 0, entries,
|
||||
vm_update_params.ib = &job->ibs[0];
|
||||
amdgpu_vm_update_pages(adev, &vm_update_params, addr, 0, entries,
|
||||
0, 0);
|
||||
amdgpu_ring_pad_ib(ring, &job->ibs[0]);
|
||||
|
||||
|
@ -538,11 +551,12 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
|
|||
uint64_t last_pde = ~0, last_pt = ~0;
|
||||
unsigned count = 0, pt_idx, ndw;
|
||||
struct amdgpu_job *job;
|
||||
struct amdgpu_ib *ib;
|
||||
struct amdgpu_vm_update_params vm_update_params;
|
||||
struct fence *fence = NULL;
|
||||
|
||||
int r;
|
||||
|
||||
memset(&vm_update_params, 0, sizeof(vm_update_params));
|
||||
ring = container_of(vm->entity.sched, struct amdgpu_ring, sched);
|
||||
|
||||
/* padding, etc. */
|
||||
|
@ -555,7 +569,7 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
|
|||
if (r)
|
||||
return r;
|
||||
|
||||
ib = &job->ibs[0];
|
||||
vm_update_params.ib = &job->ibs[0];
|
||||
|
||||
/* walk over the address space and update the page directory */
|
||||
for (pt_idx = 0; pt_idx <= vm->max_pde_used; ++pt_idx) {
|
||||
|
@ -575,7 +589,7 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
|
|||
((last_pt + incr * count) != pt)) {
|
||||
|
||||
if (count) {
|
||||
amdgpu_vm_update_pages(adev, 0, NULL, ib,
|
||||
amdgpu_vm_update_pages(adev, &vm_update_params,
|
||||
last_pde, last_pt,
|
||||
count, incr,
|
||||
AMDGPU_PTE_VALID);
|
||||
|
@ -590,14 +604,15 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
|
|||
}
|
||||
|
||||
if (count)
|
||||
amdgpu_vm_update_pages(adev, 0, NULL, ib, last_pde, last_pt,
|
||||
count, incr, AMDGPU_PTE_VALID);
|
||||
amdgpu_vm_update_pages(adev, &vm_update_params,
|
||||
last_pde, last_pt,
|
||||
count, incr, AMDGPU_PTE_VALID);
|
||||
|
||||
if (ib->length_dw != 0) {
|
||||
amdgpu_ring_pad_ib(ring, ib);
|
||||
if (vm_update_params.ib->length_dw != 0) {
|
||||
amdgpu_ring_pad_ib(ring, vm_update_params.ib);
|
||||
amdgpu_sync_resv(adev, &job->sync, pd->tbo.resv,
|
||||
AMDGPU_FENCE_OWNER_VM);
|
||||
WARN_ON(ib->length_dw > ndw);
|
||||
WARN_ON(vm_update_params.ib->length_dw > ndw);
|
||||
r = amdgpu_job_submit(job, ring, &vm->entity,
|
||||
AMDGPU_FENCE_OWNER_VM, &fence);
|
||||
if (r)
|
||||
|
@ -623,18 +638,15 @@ error_free:
|
|||
* amdgpu_vm_frag_ptes - add fragment information to PTEs
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @src: address where to copy page table entries from
|
||||
* @pages_addr: DMA addresses to use for mapping
|
||||
* @ib: IB for the update
|
||||
* @vm_update_params: see amdgpu_vm_update_params definition
|
||||
* @pe_start: first PTE to handle
|
||||
* @pe_end: last PTE to handle
|
||||
* @addr: addr those PTEs should point to
|
||||
* @flags: hw mapping flags
|
||||
*/
|
||||
static void amdgpu_vm_frag_ptes(struct amdgpu_device *adev,
|
||||
uint64_t src,
|
||||
dma_addr_t *pages_addr,
|
||||
struct amdgpu_ib *ib,
|
||||
struct amdgpu_vm_update_params
|
||||
*vm_update_params,
|
||||
uint64_t pe_start, uint64_t pe_end,
|
||||
uint64_t addr, uint32_t flags)
|
||||
{
|
||||
|
@ -671,11 +683,11 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_device *adev,
|
|||
return;
|
||||
|
||||
/* system pages are non continuously */
|
||||
if (src || pages_addr || !(flags & AMDGPU_PTE_VALID) ||
|
||||
(frag_start >= frag_end)) {
|
||||
if (vm_update_params->src || vm_update_params->pages_addr ||
|
||||
!(flags & AMDGPU_PTE_VALID) || (frag_start >= frag_end)) {
|
||||
|
||||
count = (pe_end - pe_start) / 8;
|
||||
amdgpu_vm_update_pages(adev, src, pages_addr, ib, pe_start,
|
||||
amdgpu_vm_update_pages(adev, vm_update_params, pe_start,
|
||||
addr, count, AMDGPU_GPU_PAGE_SIZE,
|
||||
flags);
|
||||
return;
|
||||
|
@ -684,21 +696,21 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_device *adev,
|
|||
/* handle the 4K area at the beginning */
|
||||
if (pe_start != frag_start) {
|
||||
count = (frag_start - pe_start) / 8;
|
||||
amdgpu_vm_update_pages(adev, 0, NULL, ib, pe_start, addr,
|
||||
amdgpu_vm_update_pages(adev, vm_update_params, pe_start, addr,
|
||||
count, AMDGPU_GPU_PAGE_SIZE, flags);
|
||||
addr += AMDGPU_GPU_PAGE_SIZE * count;
|
||||
}
|
||||
|
||||
/* handle the area in the middle */
|
||||
count = (frag_end - frag_start) / 8;
|
||||
amdgpu_vm_update_pages(adev, 0, NULL, ib, frag_start, addr, count,
|
||||
amdgpu_vm_update_pages(adev, vm_update_params, frag_start, addr, count,
|
||||
AMDGPU_GPU_PAGE_SIZE, flags | frag_flags);
|
||||
|
||||
/* handle the 4K area at the end */
|
||||
if (frag_end != pe_end) {
|
||||
addr += AMDGPU_GPU_PAGE_SIZE * count;
|
||||
count = (pe_end - frag_end) / 8;
|
||||
amdgpu_vm_update_pages(adev, 0, NULL, ib, frag_end, addr,
|
||||
amdgpu_vm_update_pages(adev, vm_update_params, frag_end, addr,
|
||||
count, AMDGPU_GPU_PAGE_SIZE, flags);
|
||||
}
|
||||
}
|
||||
|
@ -707,8 +719,7 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_device *adev,
|
|||
* amdgpu_vm_update_ptes - make sure that page tables are valid
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @src: address where to copy page table entries from
|
||||
* @pages_addr: DMA addresses to use for mapping
|
||||
* @vm_update_params: see amdgpu_vm_update_params definition
|
||||
* @vm: requested vm
|
||||
* @start: start of GPU address range
|
||||
* @end: end of GPU address range
|
||||
|
@ -718,10 +729,9 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_device *adev,
|
|||
* Update the page tables in the range @start - @end.
|
||||
*/
|
||||
static void amdgpu_vm_update_ptes(struct amdgpu_device *adev,
|
||||
uint64_t src,
|
||||
dma_addr_t *pages_addr,
|
||||
struct amdgpu_vm_update_params
|
||||
*vm_update_params,
|
||||
struct amdgpu_vm *vm,
|
||||
struct amdgpu_ib *ib,
|
||||
uint64_t start, uint64_t end,
|
||||
uint64_t dst, uint32_t flags)
|
||||
{
|
||||
|
@ -747,7 +757,7 @@ static void amdgpu_vm_update_ptes(struct amdgpu_device *adev,
|
|||
|
||||
if (last_pe_end != pe_start) {
|
||||
|
||||
amdgpu_vm_frag_ptes(adev, src, pages_addr, ib,
|
||||
amdgpu_vm_frag_ptes(adev, vm_update_params,
|
||||
last_pe_start, last_pe_end,
|
||||
last_dst, flags);
|
||||
|
||||
|
@ -762,7 +772,7 @@ static void amdgpu_vm_update_ptes(struct amdgpu_device *adev,
|
|||
dst += nptes * AMDGPU_GPU_PAGE_SIZE;
|
||||
}
|
||||
|
||||
amdgpu_vm_frag_ptes(adev, src, pages_addr, ib, last_pe_start,
|
||||
amdgpu_vm_frag_ptes(adev, vm_update_params, last_pe_start,
|
||||
last_pe_end, last_dst, flags);
|
||||
}
|
||||
|
||||
|
@ -794,11 +804,14 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
|
|||
void *owner = AMDGPU_FENCE_OWNER_VM;
|
||||
unsigned nptes, ncmds, ndw;
|
||||
struct amdgpu_job *job;
|
||||
struct amdgpu_ib *ib;
|
||||
struct amdgpu_vm_update_params vm_update_params;
|
||||
struct fence *f = NULL;
|
||||
int r;
|
||||
|
||||
ring = container_of(vm->entity.sched, struct amdgpu_ring, sched);
|
||||
memset(&vm_update_params, 0, sizeof(vm_update_params));
|
||||
vm_update_params.src = src;
|
||||
vm_update_params.pages_addr = pages_addr;
|
||||
|
||||
/* sync to everything on unmapping */
|
||||
if (!(flags & AMDGPU_PTE_VALID))
|
||||
|
@ -815,11 +828,11 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
|
|||
/* padding, etc. */
|
||||
ndw = 64;
|
||||
|
||||
if (src) {
|
||||
if (vm_update_params.src) {
|
||||
/* only copy commands needed */
|
||||
ndw += ncmds * 7;
|
||||
|
||||
} else if (pages_addr) {
|
||||
} else if (vm_update_params.pages_addr) {
|
||||
/* header for write data commands */
|
||||
ndw += ncmds * 4;
|
||||
|
||||
|
@ -838,7 +851,7 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
|
|||
if (r)
|
||||
return r;
|
||||
|
||||
ib = &job->ibs[0];
|
||||
vm_update_params.ib = &job->ibs[0];
|
||||
|
||||
r = amdgpu_sync_resv(adev, &job->sync, vm->page_directory->tbo.resv,
|
||||
owner);
|
||||
|
@ -849,11 +862,11 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
|
|||
if (r)
|
||||
goto error_free;
|
||||
|
||||
amdgpu_vm_update_ptes(adev, src, pages_addr, vm, ib, start,
|
||||
amdgpu_vm_update_ptes(adev, &vm_update_params, vm, start,
|
||||
last + 1, addr, flags);
|
||||
|
||||
amdgpu_ring_pad_ib(ring, ib);
|
||||
WARN_ON(ib->length_dw > ndw);
|
||||
amdgpu_ring_pad_ib(ring, vm_update_params.ib);
|
||||
WARN_ON(vm_update_params.ib->length_dw > ndw);
|
||||
r = amdgpu_job_submit(job, ring, &vm->entity,
|
||||
AMDGPU_FENCE_OWNER_VM, &f);
|
||||
if (r)
|
||||
|
|
|
@ -103,7 +103,6 @@ static void cik_ih_disable_interrupts(struct amdgpu_device *adev)
|
|||
*/
|
||||
static int cik_ih_irq_init(struct amdgpu_device *adev)
|
||||
{
|
||||
int ret = 0;
|
||||
int rb_bufsz;
|
||||
u32 interrupt_cntl, ih_cntl, ih_rb_cntl;
|
||||
u64 wptr_off;
|
||||
|
@ -156,7 +155,7 @@ static int cik_ih_irq_init(struct amdgpu_device *adev)
|
|||
/* enable irqs */
|
||||
cik_ih_enable_interrupts(adev);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1579,7 +1579,6 @@ static int cz_dpm_update_sclk_limit(struct amdgpu_device *adev)
|
|||
|
||||
static int cz_dpm_set_deep_sleep_sclk_threshold(struct amdgpu_device *adev)
|
||||
{
|
||||
int ret = 0;
|
||||
struct cz_power_info *pi = cz_get_pi(adev);
|
||||
|
||||
if (pi->caps_sclk_ds) {
|
||||
|
@ -1588,20 +1587,19 @@ static int cz_dpm_set_deep_sleep_sclk_threshold(struct amdgpu_device *adev)
|
|||
CZ_MIN_DEEP_SLEEP_SCLK);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ?? without dal support, is this still needed in setpowerstate list*/
|
||||
static int cz_dpm_set_watermark_threshold(struct amdgpu_device *adev)
|
||||
{
|
||||
int ret = 0;
|
||||
struct cz_power_info *pi = cz_get_pi(adev);
|
||||
|
||||
cz_send_msg_to_smc_with_parameter(adev,
|
||||
PPSMC_MSG_SetWatermarkFrequency,
|
||||
pi->sclk_dpm.soft_max_clk);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cz_dpm_enable_nbdpm(struct amdgpu_device *adev)
|
||||
|
@ -1636,7 +1634,6 @@ static void cz_dpm_nbdpm_lm_pstate_enable(struct amdgpu_device *adev,
|
|||
|
||||
static int cz_dpm_update_low_memory_pstate(struct amdgpu_device *adev)
|
||||
{
|
||||
int ret = 0;
|
||||
struct cz_power_info *pi = cz_get_pi(adev);
|
||||
struct cz_ps *ps = &pi->requested_ps;
|
||||
|
||||
|
@ -1647,21 +1644,19 @@ static int cz_dpm_update_low_memory_pstate(struct amdgpu_device *adev)
|
|||
cz_dpm_nbdpm_lm_pstate_enable(adev, true);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* with dpm enabled */
|
||||
static int cz_dpm_set_power_state(struct amdgpu_device *adev)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
cz_dpm_update_sclk_limit(adev);
|
||||
cz_dpm_set_deep_sleep_sclk_threshold(adev);
|
||||
cz_dpm_set_watermark_threshold(adev);
|
||||
cz_dpm_enable_nbdpm(adev);
|
||||
cz_dpm_update_low_memory_pstate(adev);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cz_dpm_post_set_power_state(struct amdgpu_device *adev)
|
||||
|
|
|
@ -103,7 +103,6 @@ static void cz_ih_disable_interrupts(struct amdgpu_device *adev)
|
|||
*/
|
||||
static int cz_ih_irq_init(struct amdgpu_device *adev)
|
||||
{
|
||||
int ret = 0;
|
||||
int rb_bufsz;
|
||||
u32 interrupt_cntl, ih_cntl, ih_rb_cntl;
|
||||
u64 wptr_off;
|
||||
|
@ -157,7 +156,7 @@ static int cz_ih_irq_init(struct amdgpu_device *adev)
|
|||
/* enable interrupts */
|
||||
cz_ih_enable_interrupts(adev);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -137,7 +137,7 @@ static const u32 polaris11_golden_settings_a11[] =
|
|||
mmDCI_CLK_CNTL, 0x00000080, 0x00000000,
|
||||
mmFBC_DEBUG_COMP, 0x000000f0, 0x00000070,
|
||||
mmFBC_DEBUG1, 0xffffffff, 0x00000008,
|
||||
mmFBC_MISC, 0x9f313fff, 0x14300008,
|
||||
mmFBC_MISC, 0x9f313fff, 0x14302008,
|
||||
mmHDMI_CONTROL, 0x313f031f, 0x00000011,
|
||||
};
|
||||
|
||||
|
@ -145,7 +145,7 @@ static const u32 polaris10_golden_settings_a11[] =
|
|||
{
|
||||
mmDCI_CLK_CNTL, 0x00000080, 0x00000000,
|
||||
mmFBC_DEBUG_COMP, 0x000000f0, 0x00000070,
|
||||
mmFBC_MISC, 0x9f313fff, 0x14300008,
|
||||
mmFBC_MISC, 0x9f313fff, 0x14302008,
|
||||
mmHDMI_CONTROL, 0x313f031f, 0x00000011,
|
||||
};
|
||||
|
||||
|
|
|
@ -267,10 +267,13 @@ static const u32 tonga_mgcg_cgcg_init[] =
|
|||
|
||||
static const u32 golden_settings_polaris11_a11[] =
|
||||
{
|
||||
mmCB_HW_CONTROL, 0xfffdf3cf, 0x00006208,
|
||||
mmCB_HW_CONTROL_3, 0x000001ff, 0x00000040,
|
||||
mmDB_DEBUG2, 0xf00fffff, 0x00000400,
|
||||
mmPA_SC_ENHANCE, 0xffffffff, 0x20000001,
|
||||
mmPA_SC_LINE_STIPPLE_STATE, 0x0000ff0f, 0x00000000,
|
||||
mmPA_SC_RASTER_CONFIG, 0x3f3fffff, 0x16000012,
|
||||
mmPA_SC_RASTER_CONFIG_1, 0x0000003f, 0x00000000,
|
||||
mmRLC_CGCG_CGLS_CTRL, 0x00000003, 0x0001003c,
|
||||
mmRLC_CGCG_CGLS_CTRL_3D, 0xffffffff, 0x0001003c,
|
||||
mmSQ_CONFIG, 0x07f80000, 0x07180000,
|
||||
|
@ -284,8 +287,6 @@ static const u32 golden_settings_polaris11_a11[] =
|
|||
static const u32 polaris11_golden_common_all[] =
|
||||
{
|
||||
mmGRBM_GFX_INDEX, 0xffffffff, 0xe0000000,
|
||||
mmPA_SC_RASTER_CONFIG, 0xffffffff, 0x16000012,
|
||||
mmPA_SC_RASTER_CONFIG_1, 0xffffffff, 0x00000000,
|
||||
mmGB_ADDR_CONFIG, 0xffffffff, 0x22011002,
|
||||
mmSPI_RESOURCE_RESERVE_CU_0, 0xffffffff, 0x00000800,
|
||||
mmSPI_RESOURCE_RESERVE_CU_1, 0xffffffff, 0x00000800,
|
||||
|
@ -296,6 +297,7 @@ static const u32 polaris11_golden_common_all[] =
|
|||
static const u32 golden_settings_polaris10_a11[] =
|
||||
{
|
||||
mmATC_MISC_CG, 0x000c0fc0, 0x000c0200,
|
||||
mmCB_HW_CONTROL, 0xfffdf3cf, 0x00006208,
|
||||
mmCB_HW_CONTROL_3, 0x000001ff, 0x00000040,
|
||||
mmDB_DEBUG2, 0xf00fffff, 0x00000400,
|
||||
mmPA_SC_ENHANCE, 0xffffffff, 0x20000001,
|
||||
|
@ -5725,6 +5727,7 @@ static void gfx_v8_0_ring_emit_fence_gfx(struct amdgpu_ring *ring, u64 addr,
|
|||
amdgpu_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4));
|
||||
amdgpu_ring_write(ring, (EOP_TCL1_ACTION_EN |
|
||||
EOP_TC_ACTION_EN |
|
||||
EOP_TC_WB_ACTION_EN |
|
||||
EVENT_TYPE(CACHE_FLUSH_AND_INV_TS_EVENT) |
|
||||
EVENT_INDEX(5)));
|
||||
amdgpu_ring_write(ring, addr & 0xfffffffc);
|
||||
|
|
|
@ -103,7 +103,6 @@ static void iceland_ih_disable_interrupts(struct amdgpu_device *adev)
|
|||
*/
|
||||
static int iceland_ih_irq_init(struct amdgpu_device *adev)
|
||||
{
|
||||
int ret = 0;
|
||||
int rb_bufsz;
|
||||
u32 interrupt_cntl, ih_cntl, ih_rb_cntl;
|
||||
u64 wptr_off;
|
||||
|
@ -157,7 +156,7 @@ static int iceland_ih_irq_init(struct amdgpu_device *adev)
|
|||
/* enable interrupts */
|
||||
iceland_ih_enable_interrupts(adev);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2252,7 +2252,7 @@ static void kv_apply_state_adjust_rules(struct amdgpu_device *adev,
|
|||
if (pi->caps_stable_p_state) {
|
||||
stable_p_state_sclk = (max_limits->sclk * 75) / 100;
|
||||
|
||||
for (i = table->count - 1; i >= 0; i++) {
|
||||
for (i = table->count - 1; i >= 0; i--) {
|
||||
if (stable_p_state_sclk >= table->entries[i].clk) {
|
||||
stable_p_state_sclk = table->entries[i].clk;
|
||||
break;
|
||||
|
|
|
@ -109,10 +109,12 @@ static const u32 fiji_mgcg_cgcg_init[] =
|
|||
static const u32 golden_settings_polaris11_a11[] =
|
||||
{
|
||||
mmSDMA0_CHICKEN_BITS, 0xfc910007, 0x00810007,
|
||||
mmSDMA0_CLK_CTRL, 0xff000fff, 0x00000000,
|
||||
mmSDMA0_GFX_IB_CNTL, 0x800f0111, 0x00000100,
|
||||
mmSDMA0_RLC0_IB_CNTL, 0x800f0111, 0x00000100,
|
||||
mmSDMA0_RLC1_IB_CNTL, 0x800f0111, 0x00000100,
|
||||
mmSDMA1_CHICKEN_BITS, 0xfc910007, 0x00810007,
|
||||
mmSDMA1_CLK_CTRL, 0xff000fff, 0x00000000,
|
||||
mmSDMA1_GFX_IB_CNTL, 0x800f0111, 0x00000100,
|
||||
mmSDMA1_RLC0_IB_CNTL, 0x800f0111, 0x00000100,
|
||||
mmSDMA1_RLC1_IB_CNTL, 0x800f0111, 0x00000100,
|
||||
|
|
|
@ -99,7 +99,6 @@ static void tonga_ih_disable_interrupts(struct amdgpu_device *adev)
|
|||
*/
|
||||
static int tonga_ih_irq_init(struct amdgpu_device *adev)
|
||||
{
|
||||
int ret = 0;
|
||||
int rb_bufsz;
|
||||
u32 interrupt_cntl, ih_rb_cntl, ih_doorbell_rtpr;
|
||||
u64 wptr_off;
|
||||
|
@ -165,7 +164,7 @@ static int tonga_ih_irq_init(struct amdgpu_device *adev)
|
|||
/* enable interrupts */
|
||||
tonga_ih_enable_interrupts(adev);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3573,46 +3573,11 @@ static int fiji_force_dpm_highest(struct pp_hwmgr *hwmgr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void fiji_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr)
|
||||
{
|
||||
struct phm_ppt_v1_information *table_info =
|
||||
(struct phm_ppt_v1_information *)hwmgr->pptable;
|
||||
struct phm_clock_voltage_dependency_table *table =
|
||||
table_info->vddc_dep_on_dal_pwrl;
|
||||
struct phm_ppt_v1_clock_voltage_dependency_table *vddc_table;
|
||||
enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level;
|
||||
uint32_t req_vddc = 0, req_volt, i;
|
||||
|
||||
if (!table && !(dal_power_level >= PP_DAL_POWERLEVEL_ULTRALOW &&
|
||||
dal_power_level <= PP_DAL_POWERLEVEL_PERFORMANCE))
|
||||
return;
|
||||
|
||||
for (i= 0; i < table->count; i++) {
|
||||
if (dal_power_level == table->entries[i].clk) {
|
||||
req_vddc = table->entries[i].v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vddc_table = table_info->vdd_dep_on_sclk;
|
||||
for (i= 0; i < vddc_table->count; i++) {
|
||||
if (req_vddc <= vddc_table->entries[i].vddc) {
|
||||
req_volt = (((uint32_t)vddc_table->entries[i].vddc) * VOLTAGE_SCALE)
|
||||
<< VDDC_SHIFT;
|
||||
smum_send_msg_to_smc_with_parameter(hwmgr->smumgr,
|
||||
PPSMC_MSG_VddC_Request, req_volt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
printk(KERN_ERR "DAL requested level can not"
|
||||
" found a available voltage in VDDC DPM Table \n");
|
||||
}
|
||||
|
||||
static int fiji_upload_dpmlevel_enable_mask(struct pp_hwmgr *hwmgr)
|
||||
{
|
||||
struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
|
||||
|
||||
fiji_apply_dal_min_voltage_request(hwmgr);
|
||||
phm_apply_dal_min_voltage_request(hwmgr);
|
||||
|
||||
if (!data->sclk_dpm_key_disabled) {
|
||||
if (data->dpm_level_enable_mask.sclk_dpm_enable_mask)
|
||||
|
@ -4349,7 +4314,7 @@ static int fiji_populate_and_upload_sclk_mclk_dpm_levels(
|
|||
|
||||
if (data->need_update_smu7_dpm_table &
|
||||
(DPMTABLE_OD_UPDATE_SCLK + DPMTABLE_UPDATE_SCLK)) {
|
||||
result = fiji_populate_all_memory_levels(hwmgr);
|
||||
result = fiji_populate_all_graphic_levels(hwmgr);
|
||||
PP_ASSERT_WITH_CODE((0 == result),
|
||||
"Failed to populate SCLK during PopulateNewDPMClocksStates Function!",
|
||||
return result);
|
||||
|
@ -5109,11 +5074,11 @@ static int fiji_get_pp_table(struct pp_hwmgr *hwmgr, char **table)
|
|||
struct fiji_hwmgr *data = (struct fiji_hwmgr *)(hwmgr->backend);
|
||||
|
||||
if (!data->soft_pp_table) {
|
||||
data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
|
||||
data->soft_pp_table = kmemdup(hwmgr->soft_pp_table,
|
||||
hwmgr->soft_pp_table_size,
|
||||
GFP_KERNEL);
|
||||
if (!data->soft_pp_table)
|
||||
return -ENOMEM;
|
||||
memcpy(data->soft_pp_table, hwmgr->soft_pp_table,
|
||||
hwmgr->soft_pp_table_size);
|
||||
}
|
||||
|
||||
*table = (char *)&data->soft_pp_table;
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
#include "pppcielanes.h"
|
||||
#include "pp_debug.h"
|
||||
#include "ppatomctrl.h"
|
||||
#include "ppsmc.h"
|
||||
|
||||
#define VOLTAGE_SCALE 4
|
||||
|
||||
extern int cz_hwmgr_init(struct pp_hwmgr *hwmgr);
|
||||
extern int tonga_hwmgr_init(struct pp_hwmgr *hwmgr);
|
||||
|
@ -566,3 +569,38 @@ uint32_t phm_get_lowest_enabled_level(struct pp_hwmgr *hwmgr, uint32_t mask)
|
|||
|
||||
return level;
|
||||
}
|
||||
|
||||
void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr)
|
||||
{
|
||||
struct phm_ppt_v1_information *table_info =
|
||||
(struct phm_ppt_v1_information *)hwmgr->pptable;
|
||||
struct phm_clock_voltage_dependency_table *table =
|
||||
table_info->vddc_dep_on_dal_pwrl;
|
||||
struct phm_ppt_v1_clock_voltage_dependency_table *vddc_table;
|
||||
enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level;
|
||||
uint32_t req_vddc = 0, req_volt, i;
|
||||
|
||||
if (!table || table->count <= 0
|
||||
|| dal_power_level < PP_DAL_POWERLEVEL_ULTRALOW
|
||||
|| dal_power_level > PP_DAL_POWERLEVEL_PERFORMANCE)
|
||||
return;
|
||||
|
||||
for (i = 0; i < table->count; i++) {
|
||||
if (dal_power_level == table->entries[i].clk) {
|
||||
req_vddc = table->entries[i].v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vddc_table = table_info->vdd_dep_on_sclk;
|
||||
for (i = 0; i < vddc_table->count; i++) {
|
||||
if (req_vddc <= vddc_table->entries[i].vddc) {
|
||||
req_volt = (((uint32_t)vddc_table->entries[i].vddc) * VOLTAGE_SCALE);
|
||||
smum_send_msg_to_smc_with_parameter(hwmgr->smumgr,
|
||||
PPSMC_MSG_VddC_Request, req_volt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
printk(KERN_ERR "DAL requested level can not"
|
||||
" found a available voltage in VDDC DPM Table \n");
|
||||
}
|
||||
|
|
|
@ -189,41 +189,6 @@ int phm_get_current_pcie_lane_number(struct pp_hwmgr *hwmgr)
|
|||
return decode_pcie_lane_width(link_width);
|
||||
}
|
||||
|
||||
void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr)
|
||||
{
|
||||
struct phm_ppt_v1_information *table_info =
|
||||
(struct phm_ppt_v1_information *)hwmgr->pptable;
|
||||
struct phm_clock_voltage_dependency_table *table =
|
||||
table_info->vddc_dep_on_dal_pwrl;
|
||||
struct phm_ppt_v1_clock_voltage_dependency_table *vddc_table;
|
||||
enum PP_DAL_POWERLEVEL dal_power_level = hwmgr->dal_power_level;
|
||||
uint32_t req_vddc = 0, req_volt, i;
|
||||
|
||||
if (!table && !(dal_power_level >= PP_DAL_POWERLEVEL_ULTRALOW &&
|
||||
dal_power_level <= PP_DAL_POWERLEVEL_PERFORMANCE))
|
||||
return;
|
||||
|
||||
for (i = 0; i < table->count; i++) {
|
||||
if (dal_power_level == table->entries[i].clk) {
|
||||
req_vddc = table->entries[i].v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vddc_table = table_info->vdd_dep_on_sclk;
|
||||
for (i = 0; i < vddc_table->count; i++) {
|
||||
if (req_vddc <= vddc_table->entries[i].vddc) {
|
||||
req_volt = (((uint32_t)vddc_table->entries[i].vddc) * VOLTAGE_SCALE)
|
||||
<< VDDC_SHIFT;
|
||||
smum_send_msg_to_smc_with_parameter(hwmgr->smumgr,
|
||||
PPSMC_MSG_VddC_Request, req_volt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
printk(KERN_ERR "DAL requested level can not"
|
||||
" found a available voltage in VDDC DPM Table \n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable voltage control
|
||||
*
|
||||
|
@ -2091,7 +2056,7 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)
|
|||
"Failed to populate Clock Stretcher Data Table!",
|
||||
return result);
|
||||
}
|
||||
|
||||
table->CurrSclkPllRange = 0xff;
|
||||
table->GraphicsVoltageChangeEnable = 1;
|
||||
table->GraphicsThermThrottleEnable = 1;
|
||||
table->GraphicsInterval = 1;
|
||||
|
@ -2184,6 +2149,7 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)
|
|||
CONVERT_FROM_HOST_TO_SMC_UL(table->SmioMask1);
|
||||
CONVERT_FROM_HOST_TO_SMC_UL(table->SmioMask2);
|
||||
CONVERT_FROM_HOST_TO_SMC_UL(table->SclkStepSize);
|
||||
CONVERT_FROM_HOST_TO_SMC_UL(table->CurrSclkPllRange);
|
||||
CONVERT_FROM_HOST_TO_SMC_US(table->TemperatureLimitHigh);
|
||||
CONVERT_FROM_HOST_TO_SMC_US(table->TemperatureLimitLow);
|
||||
CONVERT_FROM_HOST_TO_SMC_US(table->VoltageResponseTime);
|
||||
|
@ -4760,11 +4726,11 @@ static int polaris10_get_pp_table(struct pp_hwmgr *hwmgr, char **table)
|
|||
struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
|
||||
|
||||
if (!data->soft_pp_table) {
|
||||
data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
|
||||
data->soft_pp_table = kmemdup(hwmgr->soft_pp_table,
|
||||
hwmgr->soft_pp_table_size,
|
||||
GFP_KERNEL);
|
||||
if (!data->soft_pp_table)
|
||||
return -ENOMEM;
|
||||
memcpy(data->soft_pp_table, hwmgr->soft_pp_table,
|
||||
hwmgr->soft_pp_table_size);
|
||||
}
|
||||
|
||||
*table = (char *)&data->soft_pp_table;
|
||||
|
|
|
@ -5331,7 +5331,7 @@ static int tonga_freeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr)
|
|||
(data->need_update_smu7_dpm_table &
|
||||
(DPMTABLE_OD_UPDATE_SCLK + DPMTABLE_UPDATE_SCLK))) {
|
||||
PP_ASSERT_WITH_CODE(
|
||||
true == tonga_is_dpm_running(hwmgr),
|
||||
0 == tonga_is_dpm_running(hwmgr),
|
||||
"Trying to freeze SCLK DPM when DPM is disabled",
|
||||
);
|
||||
PP_ASSERT_WITH_CODE(
|
||||
|
@ -5344,7 +5344,7 @@ static int tonga_freeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr)
|
|||
if ((0 == data->mclk_dpm_key_disabled) &&
|
||||
(data->need_update_smu7_dpm_table &
|
||||
DPMTABLE_OD_UPDATE_MCLK)) {
|
||||
PP_ASSERT_WITH_CODE(true == tonga_is_dpm_running(hwmgr),
|
||||
PP_ASSERT_WITH_CODE(0 == tonga_is_dpm_running(hwmgr),
|
||||
"Trying to freeze MCLK DPM when DPM is disabled",
|
||||
);
|
||||
PP_ASSERT_WITH_CODE(
|
||||
|
@ -5445,7 +5445,7 @@ static int tonga_populate_and_upload_sclk_mclk_dpm_levels(struct pp_hwmgr *hwmgr
|
|||
}
|
||||
|
||||
if (data->need_update_smu7_dpm_table & (DPMTABLE_OD_UPDATE_SCLK + DPMTABLE_UPDATE_SCLK)) {
|
||||
result = tonga_populate_all_memory_levels(hwmgr);
|
||||
result = tonga_populate_all_graphic_levels(hwmgr);
|
||||
PP_ASSERT_WITH_CODE((0 == result),
|
||||
"Failed to populate SCLK during PopulateNewDPMClocksStates Function!",
|
||||
return result);
|
||||
|
@ -5647,7 +5647,7 @@ static int tonga_unfreeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr)
|
|||
(data->need_update_smu7_dpm_table &
|
||||
(DPMTABLE_OD_UPDATE_SCLK + DPMTABLE_UPDATE_SCLK))) {
|
||||
|
||||
PP_ASSERT_WITH_CODE(true == tonga_is_dpm_running(hwmgr),
|
||||
PP_ASSERT_WITH_CODE(0 == tonga_is_dpm_running(hwmgr),
|
||||
"Trying to Unfreeze SCLK DPM when DPM is disabled",
|
||||
);
|
||||
PP_ASSERT_WITH_CODE(
|
||||
|
@ -5661,7 +5661,7 @@ static int tonga_unfreeze_sclk_mclk_dpm(struct pp_hwmgr *hwmgr)
|
|||
(data->need_update_smu7_dpm_table & DPMTABLE_OD_UPDATE_MCLK)) {
|
||||
|
||||
PP_ASSERT_WITH_CODE(
|
||||
true == tonga_is_dpm_running(hwmgr),
|
||||
0 == tonga_is_dpm_running(hwmgr),
|
||||
"Trying to Unfreeze MCLK DPM when DPM is disabled",
|
||||
);
|
||||
PP_ASSERT_WITH_CODE(
|
||||
|
@ -6056,11 +6056,11 @@ static int tonga_get_pp_table(struct pp_hwmgr *hwmgr, char **table)
|
|||
struct tonga_hwmgr *data = (struct tonga_hwmgr *)(hwmgr->backend);
|
||||
|
||||
if (!data->soft_pp_table) {
|
||||
data->soft_pp_table = kzalloc(hwmgr->soft_pp_table_size, GFP_KERNEL);
|
||||
data->soft_pp_table = kmemdup(hwmgr->soft_pp_table,
|
||||
hwmgr->soft_pp_table_size,
|
||||
GFP_KERNEL);
|
||||
if (!data->soft_pp_table)
|
||||
return -ENOMEM;
|
||||
memcpy(data->soft_pp_table, hwmgr->soft_pp_table,
|
||||
hwmgr->soft_pp_table_size);
|
||||
}
|
||||
|
||||
*table = (char *)&data->soft_pp_table;
|
||||
|
|
|
@ -673,7 +673,7 @@ extern int phm_get_sclk_for_voltage_evv(struct pp_hwmgr *hwmgr, phm_ppt_v1_volta
|
|||
extern int phm_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwmgr);
|
||||
extern int phm_hwmgr_backend_fini(struct pp_hwmgr *hwmgr);
|
||||
extern uint32_t phm_get_lowest_enabled_level(struct pp_hwmgr *hwmgr, uint32_t mask);
|
||||
|
||||
extern void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr);
|
||||
|
||||
#define PHM_ENTIRE_REGISTER_MASK 0xFFFFFFFFU
|
||||
|
||||
|
|
|
@ -639,7 +639,7 @@ static int cz_smu_populate_firmware_entries(struct pp_smumgr *smumgr)
|
|||
|
||||
cz_smu->driver_buffer_length = 0;
|
||||
|
||||
for (i = 0; i < sizeof(firmware_list)/sizeof(*firmware_list); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(firmware_list); i++) {
|
||||
|
||||
firmware_type = cz_translate_firmware_enum_to_arg(smumgr,
|
||||
firmware_list[i]);
|
||||
|
|
|
@ -0,0 +1,366 @@
|
|||
/*
|
||||
* Copyright © 2016 Intel Corporation
|
||||
*
|
||||
* 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 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
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 <linux/errno.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/string.h>
|
||||
#include <drm/drm_dp_dual_mode_helper.h>
|
||||
#include <drm/drmP.h>
|
||||
|
||||
/**
|
||||
* DOC: dp dual mode helpers
|
||||
*
|
||||
* Helper functions to deal with DP dual mode (aka. DP++) adaptors.
|
||||
*
|
||||
* Type 1:
|
||||
* Adaptor registers (if any) and the sink DDC bus may be accessed via I2C.
|
||||
*
|
||||
* Type 2:
|
||||
* Adaptor registers and sink DDC bus can be accessed either via I2C or
|
||||
* I2C-over-AUX. Source devices may choose to implement either of these
|
||||
* access methods.
|
||||
*/
|
||||
|
||||
#define DP_DUAL_MODE_SLAVE_ADDRESS 0x40
|
||||
|
||||
/**
|
||||
* drm_dp_dual_mode_read - Read from the DP dual mode adaptor register(s)
|
||||
* @adapter: I2C adapter for the DDC bus
|
||||
* @offset: register offset
|
||||
* @buffer: buffer for return data
|
||||
* @size: sizo of the buffer
|
||||
*
|
||||
* Reads @size bytes from the DP dual mode adaptor registers
|
||||
* starting at @offset.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success, negative error code on failure
|
||||
*/
|
||||
ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter,
|
||||
u8 offset, void *buffer, size_t size)
|
||||
{
|
||||
struct i2c_msg msgs[] = {
|
||||
{
|
||||
.addr = DP_DUAL_MODE_SLAVE_ADDRESS,
|
||||
.flags = 0,
|
||||
.len = 1,
|
||||
.buf = &offset,
|
||||
},
|
||||
{
|
||||
.addr = DP_DUAL_MODE_SLAVE_ADDRESS,
|
||||
.flags = I2C_M_RD,
|
||||
.len = size,
|
||||
.buf = buffer,
|
||||
},
|
||||
};
|
||||
int ret;
|
||||
|
||||
ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret != ARRAY_SIZE(msgs))
|
||||
return -EPROTO;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_dp_dual_mode_read);
|
||||
|
||||
/**
|
||||
* drm_dp_dual_mode_write - Write to the DP dual mode adaptor register(s)
|
||||
* @adapter: I2C adapter for the DDC bus
|
||||
* @offset: register offset
|
||||
* @buffer: buffer for write data
|
||||
* @size: sizo of the buffer
|
||||
*
|
||||
* Writes @size bytes to the DP dual mode adaptor registers
|
||||
* starting at @offset.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success, negative error code on failure
|
||||
*/
|
||||
ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
|
||||
u8 offset, const void *buffer, size_t size)
|
||||
{
|
||||
struct i2c_msg msg = {
|
||||
.addr = DP_DUAL_MODE_SLAVE_ADDRESS,
|
||||
.flags = 0,
|
||||
.len = 1 + size,
|
||||
.buf = NULL,
|
||||
};
|
||||
void *data;
|
||||
int ret;
|
||||
|
||||
data = kmalloc(msg.len, GFP_TEMPORARY);
|
||||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
msg.buf = data;
|
||||
|
||||
memcpy(data, &offset, 1);
|
||||
memcpy(data + 1, buffer, size);
|
||||
|
||||
ret = i2c_transfer(adapter, &msg, 1);
|
||||
|
||||
kfree(data);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret != 1)
|
||||
return -EPROTO;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_dp_dual_mode_write);
|
||||
|
||||
static bool is_hdmi_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN])
|
||||
{
|
||||
static const char dp_dual_mode_hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] =
|
||||
"DP-HDMI ADAPTOR\x04";
|
||||
|
||||
return memcmp(hdmi_id, dp_dual_mode_hdmi_id,
|
||||
sizeof(dp_dual_mode_hdmi_id)) == 0;
|
||||
}
|
||||
|
||||
static bool is_type2_adaptor(uint8_t adaptor_id)
|
||||
{
|
||||
return adaptor_id == (DP_DUAL_MODE_TYPE_TYPE2 |
|
||||
DP_DUAL_MODE_REV_TYPE2);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_dp_dual_mode_detect - Identify the DP dual mode adaptor
|
||||
* @adapter: I2C adapter for the DDC bus
|
||||
*
|
||||
* Attempt to identify the type of the DP dual mode adaptor used.
|
||||
*
|
||||
* Note that when the answer is @DRM_DP_DUAL_MODE_UNKNOWN it's not
|
||||
* certain whether we're dealing with a native HDMI port or
|
||||
* a type 1 DVI dual mode adaptor. The driver will have to use
|
||||
* some other hardware/driver specific mechanism to make that
|
||||
* distinction.
|
||||
*
|
||||
* Returns:
|
||||
* The type of the DP dual mode adaptor used
|
||||
*/
|
||||
enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter)
|
||||
{
|
||||
char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN] = {};
|
||||
uint8_t adaptor_id = 0x00;
|
||||
ssize_t ret;
|
||||
|
||||
/*
|
||||
* Let's see if the adaptor is there the by reading the
|
||||
* HDMI ID registers.
|
||||
*
|
||||
* Note that type 1 DVI adaptors are not required to implemnt
|
||||
* any registers, and that presents a problem for detection.
|
||||
* If the i2c transfer is nacked, we may or may not be dealing
|
||||
* with a type 1 DVI adaptor. Some other mechanism of detecting
|
||||
* the presence of the adaptor is required. One way would be
|
||||
* to check the state of the CONFIG1 pin, Another method would
|
||||
* simply require the driver to know whether the port is a DP++
|
||||
* port or a native HDMI port. Both of these methods are entirely
|
||||
* hardware/driver specific so we can't deal with them here.
|
||||
*/
|
||||
ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_HDMI_ID,
|
||||
hdmi_id, sizeof(hdmi_id));
|
||||
if (ret)
|
||||
return DRM_DP_DUAL_MODE_UNKNOWN;
|
||||
|
||||
/*
|
||||
* Sigh. Some (maybe all?) type 1 adaptors are broken and ack
|
||||
* the offset but ignore it, and instead they just always return
|
||||
* data from the start of the HDMI ID buffer. So for a broken
|
||||
* type 1 HDMI adaptor a single byte read will always give us
|
||||
* 0x44, and for a type 1 DVI adaptor it should give 0x00
|
||||
* (assuming it implements any registers). Fortunately neither
|
||||
* of those values will match the type 2 signature of the
|
||||
* DP_DUAL_MODE_ADAPTOR_ID register so we can proceed with
|
||||
* the type 2 adaptor detection safely even in the presence
|
||||
* of broken type 1 adaptors.
|
||||
*/
|
||||
ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_ADAPTOR_ID,
|
||||
&adaptor_id, sizeof(adaptor_id));
|
||||
if (ret == 0) {
|
||||
if (is_type2_adaptor(adaptor_id)) {
|
||||
if (is_hdmi_adaptor(hdmi_id))
|
||||
return DRM_DP_DUAL_MODE_TYPE2_HDMI;
|
||||
else
|
||||
return DRM_DP_DUAL_MODE_TYPE2_DVI;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_hdmi_adaptor(hdmi_id))
|
||||
return DRM_DP_DUAL_MODE_TYPE1_HDMI;
|
||||
else
|
||||
return DRM_DP_DUAL_MODE_TYPE1_DVI;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_dp_dual_mode_detect);
|
||||
|
||||
/**
|
||||
* drm_dp_dual_mode_max_tmds_clock - Max TMDS clock for DP dual mode adaptor
|
||||
* @type: DP dual mode adaptor type
|
||||
* @adapter: I2C adapter for the DDC bus
|
||||
*
|
||||
* Determine the max TMDS clock the adaptor supports based on the
|
||||
* type of the dual mode adaptor and the DP_DUAL_MODE_MAX_TMDS_CLOCK
|
||||
* register (on type2 adaptors). As some type 1 adaptors have
|
||||
* problems with registers (see comments in drm_dp_dual_mode_detect())
|
||||
* we don't read the register on those, instead we simply assume
|
||||
* a 165 MHz limit based on the specification.
|
||||
*
|
||||
* Returns:
|
||||
* Maximum supported TMDS clock rate for the DP dual mode adaptor in kHz.
|
||||
*/
|
||||
int drm_dp_dual_mode_max_tmds_clock(enum drm_dp_dual_mode_type type,
|
||||
struct i2c_adapter *adapter)
|
||||
{
|
||||
uint8_t max_tmds_clock;
|
||||
ssize_t ret;
|
||||
|
||||
/* native HDMI so no limit */
|
||||
if (type == DRM_DP_DUAL_MODE_NONE)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Type 1 adaptors are limited to 165MHz
|
||||
* Type 2 adaptors can tells us their limit
|
||||
*/
|
||||
if (type < DRM_DP_DUAL_MODE_TYPE2_DVI)
|
||||
return 165000;
|
||||
|
||||
ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_MAX_TMDS_CLOCK,
|
||||
&max_tmds_clock, sizeof(max_tmds_clock));
|
||||
if (ret || max_tmds_clock == 0x00 || max_tmds_clock == 0xff) {
|
||||
DRM_DEBUG_KMS("Failed to query max TMDS clock\n");
|
||||
return 165000;
|
||||
}
|
||||
|
||||
return max_tmds_clock * 5000 / 2;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_dp_dual_mode_max_tmds_clock);
|
||||
|
||||
/**
|
||||
* drm_dp_dual_mode_get_tmds_output - Get the state of the TMDS output buffers in the DP dual mode adaptor
|
||||
* @type: DP dual mode adaptor type
|
||||
* @adapter: I2C adapter for the DDC bus
|
||||
* @enabled: current state of the TMDS output buffers
|
||||
*
|
||||
* Get the state of the TMDS output buffers in the adaptor. For
|
||||
* type2 adaptors this is queried from the DP_DUAL_MODE_TMDS_OEN
|
||||
* register. As some type 1 adaptors have problems with registers
|
||||
* (see comments in drm_dp_dual_mode_detect()) we don't read the
|
||||
* register on those, instead we simply assume that the buffers
|
||||
* are always enabled.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success, negative error code on failure
|
||||
*/
|
||||
int drm_dp_dual_mode_get_tmds_output(enum drm_dp_dual_mode_type type,
|
||||
struct i2c_adapter *adapter,
|
||||
bool *enabled)
|
||||
{
|
||||
uint8_t tmds_oen;
|
||||
ssize_t ret;
|
||||
|
||||
if (type < DRM_DP_DUAL_MODE_TYPE2_DVI) {
|
||||
*enabled = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_TMDS_OEN,
|
||||
&tmds_oen, sizeof(tmds_oen));
|
||||
if (ret) {
|
||||
DRM_DEBUG_KMS("Failed to query state of TMDS output buffers\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
*enabled = !(tmds_oen & DP_DUAL_MODE_TMDS_DISABLE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_dp_dual_mode_get_tmds_output);
|
||||
|
||||
/**
|
||||
* drm_dp_dual_mode_set_tmds_output - Enable/disable TMDS output buffers in the DP dual mode adaptor
|
||||
* @type: DP dual mode adaptor type
|
||||
* @adapter: I2C adapter for the DDC bus
|
||||
* @enable: enable (as opposed to disable) the TMDS output buffers
|
||||
*
|
||||
* Set the state of the TMDS output buffers in the adaptor. For
|
||||
* type2 this is set via the DP_DUAL_MODE_TMDS_OEN register. As
|
||||
* some type 1 adaptors have problems with registers (see comments
|
||||
* in drm_dp_dual_mode_detect()) we avoid touching the register,
|
||||
* making this function a no-op on type 1 adaptors.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success, negative error code on failure
|
||||
*/
|
||||
int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
|
||||
struct i2c_adapter *adapter, bool enable)
|
||||
{
|
||||
uint8_t tmds_oen = enable ? 0 : DP_DUAL_MODE_TMDS_DISABLE;
|
||||
ssize_t ret;
|
||||
|
||||
if (type < DRM_DP_DUAL_MODE_TYPE2_DVI)
|
||||
return 0;
|
||||
|
||||
ret = drm_dp_dual_mode_write(adapter, DP_DUAL_MODE_TMDS_OEN,
|
||||
&tmds_oen, sizeof(tmds_oen));
|
||||
if (ret) {
|
||||
DRM_DEBUG_KMS("Failed to %s TMDS output buffers\n",
|
||||
enable ? "enable" : "disable");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_dp_dual_mode_set_tmds_output);
|
||||
|
||||
/**
|
||||
* drm_dp_get_dual_mode_type_name - Get the name of the DP dual mode adaptor type as a string
|
||||
* @type: DP dual mode adaptor type
|
||||
*
|
||||
* Returns:
|
||||
* String representation of the DP dual mode adaptor type
|
||||
*/
|
||||
const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type)
|
||||
{
|
||||
switch (type) {
|
||||
case DRM_DP_DUAL_MODE_NONE:
|
||||
return "none";
|
||||
case DRM_DP_DUAL_MODE_TYPE1_DVI:
|
||||
return "type 1 DVI";
|
||||
case DRM_DP_DUAL_MODE_TYPE1_HDMI:
|
||||
return "type 1 HDMI";
|
||||
case DRM_DP_DUAL_MODE_TYPE2_DVI:
|
||||
return "type 2 DVI";
|
||||
case DRM_DP_DUAL_MODE_TYPE2_HDMI:
|
||||
return "type 2 HDMI";
|
||||
default:
|
||||
WARN_ON(type != DRM_DP_DUAL_MODE_UNKNOWN);
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name);
|
|
@ -1183,6 +1183,12 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = i915_ggtt_enable_hw(dev);
|
||||
if (ret) {
|
||||
DRM_ERROR("failed to enable GGTT\n");
|
||||
goto out_ggtt;
|
||||
}
|
||||
|
||||
/* WARNING: Apparently we must kick fbdev drivers before vgacon,
|
||||
* otherwise the vga fbdev driver falls over. */
|
||||
ret = i915_kick_out_firmware_fb(dev_priv);
|
||||
|
|
|
@ -734,9 +734,14 @@ int i915_suspend_switcheroo(struct drm_device *dev, pm_message_t state)
|
|||
static int i915_drm_resume(struct drm_device *dev)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
int ret;
|
||||
|
||||
disable_rpm_wakeref_asserts(dev_priv);
|
||||
|
||||
ret = i915_ggtt_enable_hw(dev);
|
||||
if (ret)
|
||||
DRM_ERROR("failed to re-enable GGTT\n");
|
||||
|
||||
intel_csr_ucode_resume(dev_priv);
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
|
|
@ -3482,6 +3482,7 @@ bool intel_bios_is_valid_vbt(const void *buf, size_t size);
|
|||
bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);
|
||||
bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin);
|
||||
bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
|
||||
bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum port port);
|
||||
bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
|
||||
bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
|
||||
enum port port);
|
||||
|
|
|
@ -1456,7 +1456,10 @@ i915_wait_request(struct drm_i915_gem_request *req)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
__i915_gem_request_retire__upto(req);
|
||||
/* If the GPU hung, we want to keep the requests to find the guilty. */
|
||||
if (req->reset_counter == i915_reset_counter(&dev_priv->gpu_error))
|
||||
__i915_gem_request_retire__upto(req);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1513,7 +1516,8 @@ i915_gem_object_retire_request(struct drm_i915_gem_object *obj,
|
|||
else if (obj->last_write_req == req)
|
||||
i915_gem_object_retire__write(obj);
|
||||
|
||||
__i915_gem_request_retire__upto(req);
|
||||
if (req->reset_counter == i915_reset_counter(&req->i915->gpu_error))
|
||||
__i915_gem_request_retire__upto(req);
|
||||
}
|
||||
|
||||
/* A nonblocking variant of the above wait. This is a highly dangerous routine
|
||||
|
@ -4860,9 +4864,6 @@ i915_gem_init_hw(struct drm_device *dev)
|
|||
struct intel_engine_cs *engine;
|
||||
int ret, j;
|
||||
|
||||
if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
|
||||
return -EIO;
|
||||
|
||||
/* Double layer security blanket, see i915_gem_init() */
|
||||
intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
|
||||
|
||||
|
|
|
@ -3236,6 +3236,14 @@ out_gtt_cleanup:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int i915_ggtt_enable_hw(struct drm_device *dev)
|
||||
{
|
||||
if (INTEL_INFO(dev)->gen < 6 && !intel_enable_gtt())
|
||||
return -EIO;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void i915_gem_restore_gtt_mappings(struct drm_device *dev)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
|
|
|
@ -514,6 +514,7 @@ i915_page_dir_dma_addr(const struct i915_hw_ppgtt *ppgtt, const unsigned n)
|
|||
}
|
||||
|
||||
int i915_ggtt_init_hw(struct drm_device *dev);
|
||||
int i915_ggtt_enable_hw(struct drm_device *dev);
|
||||
void i915_gem_init_ggtt(struct drm_device *dev);
|
||||
void i915_ggtt_cleanup_hw(struct drm_device *dev);
|
||||
|
||||
|
|
|
@ -1578,6 +1578,42 @@ bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum port port)
|
||||
{
|
||||
static const struct {
|
||||
u16 dp, hdmi;
|
||||
} port_mapping[] = {
|
||||
/*
|
||||
* Buggy VBTs may declare DP ports as having
|
||||
* HDMI type dvo_port :( So let's check both.
|
||||
*/
|
||||
[PORT_B] = { DVO_PORT_DPB, DVO_PORT_HDMIB, },
|
||||
[PORT_C] = { DVO_PORT_DPC, DVO_PORT_HDMIC, },
|
||||
[PORT_D] = { DVO_PORT_DPD, DVO_PORT_HDMID, },
|
||||
[PORT_E] = { DVO_PORT_DPE, DVO_PORT_HDMIE, },
|
||||
};
|
||||
int i;
|
||||
|
||||
if (port == PORT_A || port >= ARRAY_SIZE(port_mapping))
|
||||
return false;
|
||||
|
||||
if (!dev_priv->vbt.child_dev_num)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
|
||||
const union child_device_config *p_child =
|
||||
&dev_priv->vbt.child_dev[i];
|
||||
|
||||
if ((p_child->common.dvo_port == port_mapping[port].dp ||
|
||||
p_child->common.dvo_port == port_mapping[port].hdmi) &&
|
||||
(p_child->common.device_type & DEVICE_TYPE_DP_DUAL_MODE_BITS) ==
|
||||
(DEVICE_TYPE_DP_DUAL_MODE & DEVICE_TYPE_DP_DUAL_MODE_BITS))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* intel_bios_is_dsi_present - is DSI present in VBT
|
||||
* @dev_priv: i915 device instance
|
||||
|
|
|
@ -1601,6 +1601,12 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
|
|||
enum port port = intel_ddi_get_encoder_port(intel_encoder);
|
||||
int type = intel_encoder->type;
|
||||
|
||||
if (type == INTEL_OUTPUT_HDMI) {
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
|
||||
intel_dp_dual_mode_set_tmds_output(intel_hdmi, true);
|
||||
}
|
||||
|
||||
intel_prepare_ddi_buffer(intel_encoder);
|
||||
|
||||
if (type == INTEL_OUTPUT_EDP) {
|
||||
|
@ -1667,6 +1673,12 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
|
|||
DPLL_CTRL2_DDI_CLK_OFF(port)));
|
||||
else if (INTEL_INFO(dev)->gen < 9)
|
||||
I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE);
|
||||
|
||||
if (type == INTEL_OUTPUT_HDMI) {
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
|
||||
intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void intel_enable_ddi(struct intel_encoder *intel_encoder)
|
||||
|
@ -2180,8 +2192,10 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
|
|||
|
||||
if (intel_hdmi->infoframe_enabled(&encoder->base, pipe_config))
|
||||
pipe_config->has_infoframe = true;
|
||||
break;
|
||||
/* fall through */
|
||||
case TRANS_DDI_MODE_SELECT_DVI:
|
||||
pipe_config->lane_count = 4;
|
||||
break;
|
||||
case TRANS_DDI_MODE_SELECT_FDI:
|
||||
break;
|
||||
case TRANS_DDI_MODE_SELECT_DP_SST:
|
||||
|
|
|
@ -12005,6 +12005,9 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
|
|||
DRM_DEBUG_KMS("No valid intermediate pipe watermarks are possible\n");
|
||||
return ret;
|
||||
}
|
||||
} else if (dev_priv->display.compute_intermediate_wm) {
|
||||
if (HAS_PCH_SPLIT(dev_priv) && INTEL_GEN(dev_priv) < 9)
|
||||
pipe_config->wm.intermediate = pipe_config->wm.optimal.ilk;
|
||||
}
|
||||
|
||||
if (INTEL_INFO(dev)->gen >= 9) {
|
||||
|
@ -15990,6 +15993,9 @@ retry:
|
|||
|
||||
state->acquire_ctx = &ctx;
|
||||
|
||||
/* ignore any reset values/BIOS leftovers in the WM registers */
|
||||
to_intel_atomic_state(state)->skip_intermediate_wm = true;
|
||||
|
||||
for_each_crtc_in_state(state, crtc, crtc_state, i) {
|
||||
/*
|
||||
* Force recalculation even if we restore
|
||||
|
|
|
@ -1702,9 +1702,9 @@ static const struct intel_dpll_mgr hsw_pll_mgr = {
|
|||
|
||||
static const struct dpll_info skl_plls[] = {
|
||||
{ "DPLL 0", DPLL_ID_SKL_DPLL0, &skl_ddi_dpll0_funcs, INTEL_DPLL_ALWAYS_ON },
|
||||
{ "DPPL 1", DPLL_ID_SKL_DPLL1, &skl_ddi_pll_funcs, 0 },
|
||||
{ "DPPL 2", DPLL_ID_SKL_DPLL2, &skl_ddi_pll_funcs, 0 },
|
||||
{ "DPPL 3", DPLL_ID_SKL_DPLL3, &skl_ddi_pll_funcs, 0 },
|
||||
{ "DPLL 1", DPLL_ID_SKL_DPLL1, &skl_ddi_pll_funcs, 0 },
|
||||
{ "DPLL 2", DPLL_ID_SKL_DPLL2, &skl_ddi_pll_funcs, 0 },
|
||||
{ "DPLL 3", DPLL_ID_SKL_DPLL3, &skl_ddi_pll_funcs, 0 },
|
||||
{ NULL, -1, NULL, },
|
||||
};
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_dp_dual_mode_helper.h>
|
||||
#include <drm/drm_dp_mst_helper.h>
|
||||
#include <drm/drm_rect.h>
|
||||
#include <drm/drm_atomic.h>
|
||||
|
@ -753,6 +754,10 @@ struct cxsr_latency {
|
|||
struct intel_hdmi {
|
||||
i915_reg_t hdmi_reg;
|
||||
int ddc_bus;
|
||||
struct {
|
||||
enum drm_dp_dual_mode_type type;
|
||||
int max_tmds_clock;
|
||||
} dp_dual_mode;
|
||||
bool limited_color_range;
|
||||
bool color_range_auto;
|
||||
bool has_hdmi_sink;
|
||||
|
@ -1401,6 +1406,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
|
|||
struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
|
||||
bool intel_hdmi_compute_config(struct intel_encoder *encoder,
|
||||
struct intel_crtc_state *pipe_config);
|
||||
void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
|
||||
|
||||
|
||||
/* intel_lvds.c */
|
||||
|
|
|
@ -46,6 +46,22 @@ static const struct {
|
|||
},
|
||||
};
|
||||
|
||||
/* return pixels in terms of txbyteclkhs */
|
||||
static u16 txbyteclkhs(u16 pixels, int bpp, int lane_count,
|
||||
u16 burst_mode_ratio)
|
||||
{
|
||||
return DIV_ROUND_UP(DIV_ROUND_UP(pixels * bpp * burst_mode_ratio,
|
||||
8 * 100), lane_count);
|
||||
}
|
||||
|
||||
/* return pixels equvalent to txbyteclkhs */
|
||||
static u16 pixels_from_txbyteclkhs(u16 clk_hs, int bpp, int lane_count,
|
||||
u16 burst_mode_ratio)
|
||||
{
|
||||
return DIV_ROUND_UP((clk_hs * lane_count * 8 * 100),
|
||||
(bpp * burst_mode_ratio));
|
||||
}
|
||||
|
||||
enum mipi_dsi_pixel_format pixel_format_from_register_bits(u32 fmt)
|
||||
{
|
||||
/* It just so happens the VBT matches register contents. */
|
||||
|
@ -780,10 +796,19 @@ static void bxt_dsi_get_pipe_config(struct intel_encoder *encoder,
|
|||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct drm_display_mode *adjusted_mode =
|
||||
&pipe_config->base.adjusted_mode;
|
||||
struct drm_display_mode *adjusted_mode_sw;
|
||||
struct intel_crtc *intel_crtc;
|
||||
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
|
||||
unsigned int lane_count = intel_dsi->lane_count;
|
||||
unsigned int bpp, fmt;
|
||||
enum port port;
|
||||
u16 vfp, vsync, vbp;
|
||||
u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
|
||||
u16 hfp_sw, hsync_sw, hbp_sw;
|
||||
u16 crtc_htotal_sw, crtc_hsync_start_sw, crtc_hsync_end_sw,
|
||||
crtc_hblank_start_sw, crtc_hblank_end_sw;
|
||||
|
||||
intel_crtc = to_intel_crtc(encoder->base.crtc);
|
||||
adjusted_mode_sw = &intel_crtc->config->base.adjusted_mode;
|
||||
|
||||
/*
|
||||
* Atleast one port is active as encoder->get_config called only if
|
||||
|
@ -808,26 +833,118 @@ static void bxt_dsi_get_pipe_config(struct intel_encoder *encoder,
|
|||
adjusted_mode->crtc_vtotal =
|
||||
I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
|
||||
|
||||
hactive = adjusted_mode->crtc_hdisplay;
|
||||
hfp = I915_READ(MIPI_HFP_COUNT(port));
|
||||
|
||||
/*
|
||||
* TODO: Retrieve hfp, hsync and hbp. Adjust them for dual link and
|
||||
* calculate hsync_start, hsync_end, htotal and hblank_end
|
||||
* Meaningful for video mode non-burst sync pulse mode only,
|
||||
* can be zero for non-burst sync events and burst modes
|
||||
*/
|
||||
hsync = I915_READ(MIPI_HSYNC_PADDING_COUNT(port));
|
||||
hbp = I915_READ(MIPI_HBP_COUNT(port));
|
||||
|
||||
/* harizontal values are in terms of high speed byte clock */
|
||||
hfp = pixels_from_txbyteclkhs(hfp, bpp, lane_count,
|
||||
intel_dsi->burst_mode_ratio);
|
||||
hsync = pixels_from_txbyteclkhs(hsync, bpp, lane_count,
|
||||
intel_dsi->burst_mode_ratio);
|
||||
hbp = pixels_from_txbyteclkhs(hbp, bpp, lane_count,
|
||||
intel_dsi->burst_mode_ratio);
|
||||
|
||||
if (intel_dsi->dual_link) {
|
||||
hfp *= 2;
|
||||
hsync *= 2;
|
||||
hbp *= 2;
|
||||
}
|
||||
|
||||
/* vertical values are in terms of lines */
|
||||
vfp = I915_READ(MIPI_VFP_COUNT(port));
|
||||
vsync = I915_READ(MIPI_VSYNC_PADDING_COUNT(port));
|
||||
vbp = I915_READ(MIPI_VBP_COUNT(port));
|
||||
|
||||
adjusted_mode->crtc_htotal = hactive + hfp + hsync + hbp;
|
||||
adjusted_mode->crtc_hsync_start = hfp + adjusted_mode->crtc_hdisplay;
|
||||
adjusted_mode->crtc_hsync_end = hsync + adjusted_mode->crtc_hsync_start;
|
||||
adjusted_mode->crtc_hblank_start = adjusted_mode->crtc_hdisplay;
|
||||
adjusted_mode->crtc_hblank_end = adjusted_mode->crtc_htotal;
|
||||
|
||||
adjusted_mode->crtc_vsync_start =
|
||||
vfp + adjusted_mode->crtc_vdisplay;
|
||||
adjusted_mode->crtc_vsync_end =
|
||||
vsync + adjusted_mode->crtc_vsync_start;
|
||||
adjusted_mode->crtc_vsync_start = vfp + adjusted_mode->crtc_vdisplay;
|
||||
adjusted_mode->crtc_vsync_end = vsync + adjusted_mode->crtc_vsync_start;
|
||||
adjusted_mode->crtc_vblank_start = adjusted_mode->crtc_vdisplay;
|
||||
adjusted_mode->crtc_vblank_end = adjusted_mode->crtc_vtotal;
|
||||
}
|
||||
|
||||
/*
|
||||
* In BXT DSI there is no regs programmed with few horizontal timings
|
||||
* in Pixels but txbyteclkhs.. So retrieval process adds some
|
||||
* ROUND_UP ERRORS in the process of PIXELS<==>txbyteclkhs.
|
||||
* Actually here for the given adjusted_mode, we are calculating the
|
||||
* value programmed to the port and then back to the horizontal timing
|
||||
* param in pixels. This is the expected value, including roundup errors
|
||||
* And if that is same as retrieved value from port, then
|
||||
* (HW state) adjusted_mode's horizontal timings are corrected to
|
||||
* match with SW state to nullify the errors.
|
||||
*/
|
||||
/* Calculating the value programmed to the Port register */
|
||||
hfp_sw = adjusted_mode_sw->crtc_hsync_start -
|
||||
adjusted_mode_sw->crtc_hdisplay;
|
||||
hsync_sw = adjusted_mode_sw->crtc_hsync_end -
|
||||
adjusted_mode_sw->crtc_hsync_start;
|
||||
hbp_sw = adjusted_mode_sw->crtc_htotal -
|
||||
adjusted_mode_sw->crtc_hsync_end;
|
||||
|
||||
if (intel_dsi->dual_link) {
|
||||
hfp_sw /= 2;
|
||||
hsync_sw /= 2;
|
||||
hbp_sw /= 2;
|
||||
}
|
||||
|
||||
hfp_sw = txbyteclkhs(hfp_sw, bpp, lane_count,
|
||||
intel_dsi->burst_mode_ratio);
|
||||
hsync_sw = txbyteclkhs(hsync_sw, bpp, lane_count,
|
||||
intel_dsi->burst_mode_ratio);
|
||||
hbp_sw = txbyteclkhs(hbp_sw, bpp, lane_count,
|
||||
intel_dsi->burst_mode_ratio);
|
||||
|
||||
/* Reverse calculating the adjusted mode parameters from port reg vals*/
|
||||
hfp_sw = pixels_from_txbyteclkhs(hfp_sw, bpp, lane_count,
|
||||
intel_dsi->burst_mode_ratio);
|
||||
hsync_sw = pixels_from_txbyteclkhs(hsync_sw, bpp, lane_count,
|
||||
intel_dsi->burst_mode_ratio);
|
||||
hbp_sw = pixels_from_txbyteclkhs(hbp_sw, bpp, lane_count,
|
||||
intel_dsi->burst_mode_ratio);
|
||||
|
||||
if (intel_dsi->dual_link) {
|
||||
hfp_sw *= 2;
|
||||
hsync_sw *= 2;
|
||||
hbp_sw *= 2;
|
||||
}
|
||||
|
||||
crtc_htotal_sw = adjusted_mode_sw->crtc_hdisplay + hfp_sw +
|
||||
hsync_sw + hbp_sw;
|
||||
crtc_hsync_start_sw = hfp_sw + adjusted_mode_sw->crtc_hdisplay;
|
||||
crtc_hsync_end_sw = hsync_sw + crtc_hsync_start_sw;
|
||||
crtc_hblank_start_sw = adjusted_mode_sw->crtc_hdisplay;
|
||||
crtc_hblank_end_sw = crtc_htotal_sw;
|
||||
|
||||
if (adjusted_mode->crtc_htotal == crtc_htotal_sw)
|
||||
adjusted_mode->crtc_htotal = adjusted_mode_sw->crtc_htotal;
|
||||
|
||||
if (adjusted_mode->crtc_hsync_start == crtc_hsync_start_sw)
|
||||
adjusted_mode->crtc_hsync_start =
|
||||
adjusted_mode_sw->crtc_hsync_start;
|
||||
|
||||
if (adjusted_mode->crtc_hsync_end == crtc_hsync_end_sw)
|
||||
adjusted_mode->crtc_hsync_end =
|
||||
adjusted_mode_sw->crtc_hsync_end;
|
||||
|
||||
if (adjusted_mode->crtc_hblank_start == crtc_hblank_start_sw)
|
||||
adjusted_mode->crtc_hblank_start =
|
||||
adjusted_mode_sw->crtc_hblank_start;
|
||||
|
||||
if (adjusted_mode->crtc_hblank_end == crtc_hblank_end_sw)
|
||||
adjusted_mode->crtc_hblank_end =
|
||||
adjusted_mode_sw->crtc_hblank_end;
|
||||
}
|
||||
|
||||
static void intel_dsi_get_config(struct intel_encoder *encoder,
|
||||
struct intel_crtc_state *pipe_config)
|
||||
|
@ -891,14 +1008,6 @@ static u16 txclkesc(u32 divider, unsigned int us)
|
|||
}
|
||||
}
|
||||
|
||||
/* return pixels in terms of txbyteclkhs */
|
||||
static u16 txbyteclkhs(u16 pixels, int bpp, int lane_count,
|
||||
u16 burst_mode_ratio)
|
||||
{
|
||||
return DIV_ROUND_UP(DIV_ROUND_UP(pixels * bpp * burst_mode_ratio,
|
||||
8 * 100), lane_count);
|
||||
}
|
||||
|
||||
static void set_dsi_timings(struct drm_encoder *encoder,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
|
|
|
@ -836,6 +836,22 @@ static void hsw_set_infoframes(struct drm_encoder *encoder,
|
|||
intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
|
||||
}
|
||||
|
||||
void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(intel_hdmi_to_dev(hdmi));
|
||||
struct i2c_adapter *adapter =
|
||||
intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus);
|
||||
|
||||
if (hdmi->dp_dual_mode.type < DRM_DP_DUAL_MODE_TYPE2_DVI)
|
||||
return;
|
||||
|
||||
DRM_DEBUG_KMS("%s DP dual mode adaptor TMDS output\n",
|
||||
enable ? "Enabling" : "Disabling");
|
||||
|
||||
drm_dp_dual_mode_set_tmds_output(hdmi->dp_dual_mode.type,
|
||||
adapter, enable);
|
||||
}
|
||||
|
||||
static void intel_hdmi_prepare(struct intel_encoder *encoder)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
|
@ -845,6 +861,8 @@ static void intel_hdmi_prepare(struct intel_encoder *encoder)
|
|||
const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
|
||||
u32 hdmi_val;
|
||||
|
||||
intel_dp_dual_mode_set_tmds_output(intel_hdmi, true);
|
||||
|
||||
hdmi_val = SDVO_ENCODING_HDMI;
|
||||
if (!HAS_PCH_SPLIT(dev) && crtc->config->limited_color_range)
|
||||
hdmi_val |= HDMI_COLOR_RANGE_16_235;
|
||||
|
@ -953,6 +971,8 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
|
|||
dotclock /= pipe_config->pixel_multiplier;
|
||||
|
||||
pipe_config->base.adjusted_mode.crtc_clock = dotclock;
|
||||
|
||||
pipe_config->lane_count = 4;
|
||||
}
|
||||
|
||||
static void intel_enable_hdmi_audio(struct intel_encoder *encoder)
|
||||
|
@ -1140,6 +1160,8 @@ static void intel_disable_hdmi(struct intel_encoder *encoder)
|
|||
}
|
||||
|
||||
intel_hdmi->set_infoframes(&encoder->base, false, NULL);
|
||||
|
||||
intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
|
||||
}
|
||||
|
||||
static void g4x_disable_hdmi(struct intel_encoder *encoder)
|
||||
|
@ -1165,27 +1187,42 @@ static void pch_post_disable_hdmi(struct intel_encoder *encoder)
|
|||
intel_disable_hdmi(encoder);
|
||||
}
|
||||
|
||||
static int hdmi_port_clock_limit(struct intel_hdmi *hdmi, bool respect_dvi_limit)
|
||||
static int intel_hdmi_source_max_tmds_clock(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
struct drm_device *dev = intel_hdmi_to_dev(hdmi);
|
||||
|
||||
if ((respect_dvi_limit && !hdmi->has_hdmi_sink) || IS_G4X(dev))
|
||||
if (IS_G4X(dev_priv))
|
||||
return 165000;
|
||||
else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8)
|
||||
else if (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8)
|
||||
return 300000;
|
||||
else
|
||||
return 225000;
|
||||
}
|
||||
|
||||
static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,
|
||||
bool respect_downstream_limits)
|
||||
{
|
||||
struct drm_device *dev = intel_hdmi_to_dev(hdmi);
|
||||
int max_tmds_clock = intel_hdmi_source_max_tmds_clock(to_i915(dev));
|
||||
|
||||
if (respect_downstream_limits) {
|
||||
if (hdmi->dp_dual_mode.max_tmds_clock)
|
||||
max_tmds_clock = min(max_tmds_clock,
|
||||
hdmi->dp_dual_mode.max_tmds_clock);
|
||||
if (!hdmi->has_hdmi_sink)
|
||||
max_tmds_clock = min(max_tmds_clock, 165000);
|
||||
}
|
||||
|
||||
return max_tmds_clock;
|
||||
}
|
||||
|
||||
static enum drm_mode_status
|
||||
hdmi_port_clock_valid(struct intel_hdmi *hdmi,
|
||||
int clock, bool respect_dvi_limit)
|
||||
int clock, bool respect_downstream_limits)
|
||||
{
|
||||
struct drm_device *dev = intel_hdmi_to_dev(hdmi);
|
||||
|
||||
if (clock < 25000)
|
||||
return MODE_CLOCK_LOW;
|
||||
if (clock > hdmi_port_clock_limit(hdmi, respect_dvi_limit))
|
||||
if (clock > hdmi_port_clock_limit(hdmi, respect_downstream_limits))
|
||||
return MODE_CLOCK_HIGH;
|
||||
|
||||
/* BXT DPLL can't generate 223-240 MHz */
|
||||
|
@ -1309,7 +1346,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
|
|||
* within limits.
|
||||
*/
|
||||
if (pipe_config->pipe_bpp > 8*3 && pipe_config->has_hdmi_sink &&
|
||||
hdmi_port_clock_valid(intel_hdmi, clock_12bpc, false) == MODE_OK &&
|
||||
hdmi_port_clock_valid(intel_hdmi, clock_12bpc, true) == MODE_OK &&
|
||||
hdmi_12bpc_possible(pipe_config)) {
|
||||
DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");
|
||||
desired_bpp = 12*3;
|
||||
|
@ -1337,6 +1374,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
|
|||
/* Set user selected PAR to incoming mode's member */
|
||||
adjusted_mode->picture_aspect_ratio = intel_hdmi->aspect_ratio;
|
||||
|
||||
pipe_config->lane_count = 4;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1349,10 +1388,57 @@ intel_hdmi_unset_edid(struct drm_connector *connector)
|
|||
intel_hdmi->has_audio = false;
|
||||
intel_hdmi->rgb_quant_range_selectable = false;
|
||||
|
||||
intel_hdmi->dp_dual_mode.type = DRM_DP_DUAL_MODE_NONE;
|
||||
intel_hdmi->dp_dual_mode.max_tmds_clock = 0;
|
||||
|
||||
kfree(to_intel_connector(connector)->detect_edid);
|
||||
to_intel_connector(connector)->detect_edid = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
intel_hdmi_dp_dual_mode_detect(struct drm_connector *connector, bool has_edid)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(connector->dev);
|
||||
struct intel_hdmi *hdmi = intel_attached_hdmi(connector);
|
||||
enum port port = hdmi_to_dig_port(hdmi)->port;
|
||||
struct i2c_adapter *adapter =
|
||||
intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus);
|
||||
enum drm_dp_dual_mode_type type = drm_dp_dual_mode_detect(adapter);
|
||||
|
||||
/*
|
||||
* Type 1 DVI adaptors are not required to implement any
|
||||
* registers, so we can't always detect their presence.
|
||||
* Ideally we should be able to check the state of the
|
||||
* CONFIG1 pin, but no such luck on our hardware.
|
||||
*
|
||||
* The only method left to us is to check the VBT to see
|
||||
* if the port is a dual mode capable DP port. But let's
|
||||
* only do that when we sucesfully read the EDID, to avoid
|
||||
* confusing log messages about DP dual mode adaptors when
|
||||
* there's nothing connected to the port.
|
||||
*/
|
||||
if (type == DRM_DP_DUAL_MODE_UNKNOWN) {
|
||||
if (has_edid &&
|
||||
intel_bios_is_port_dp_dual_mode(dev_priv, port)) {
|
||||
DRM_DEBUG_KMS("Assuming DP dual mode adaptor presence based on VBT\n");
|
||||
type = DRM_DP_DUAL_MODE_TYPE1_DVI;
|
||||
} else {
|
||||
type = DRM_DP_DUAL_MODE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == DRM_DP_DUAL_MODE_NONE)
|
||||
return;
|
||||
|
||||
hdmi->dp_dual_mode.type = type;
|
||||
hdmi->dp_dual_mode.max_tmds_clock =
|
||||
drm_dp_dual_mode_max_tmds_clock(type, adapter);
|
||||
|
||||
DRM_DEBUG_KMS("DP dual mode adaptor (%s) detected (max TMDS clock: %d kHz)\n",
|
||||
drm_dp_get_dual_mode_type_name(type),
|
||||
hdmi->dp_dual_mode.max_tmds_clock);
|
||||
}
|
||||
|
||||
static bool
|
||||
intel_hdmi_set_edid(struct drm_connector *connector, bool force)
|
||||
{
|
||||
|
@ -1368,6 +1454,8 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force)
|
|||
intel_gmbus_get_adapter(dev_priv,
|
||||
intel_hdmi->ddc_bus));
|
||||
|
||||
intel_hdmi_dp_dual_mode_detect(connector, edid != NULL);
|
||||
|
||||
intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
|
||||
}
|
||||
|
||||
|
|
|
@ -721,48 +721,6 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int logical_ring_wait_for_space(struct drm_i915_gem_request *req,
|
||||
int bytes)
|
||||
{
|
||||
struct intel_ringbuffer *ringbuf = req->ringbuf;
|
||||
struct intel_engine_cs *engine = req->engine;
|
||||
struct drm_i915_gem_request *target;
|
||||
unsigned space;
|
||||
int ret;
|
||||
|
||||
if (intel_ring_space(ringbuf) >= bytes)
|
||||
return 0;
|
||||
|
||||
/* The whole point of reserving space is to not wait! */
|
||||
WARN_ON(ringbuf->reserved_in_use);
|
||||
|
||||
list_for_each_entry(target, &engine->request_list, list) {
|
||||
/*
|
||||
* The request queue is per-engine, so can contain requests
|
||||
* from multiple ringbuffers. Here, we must ignore any that
|
||||
* aren't from the ringbuffer we're considering.
|
||||
*/
|
||||
if (target->ringbuf != ringbuf)
|
||||
continue;
|
||||
|
||||
/* Would completion of this request free enough space? */
|
||||
space = __intel_ring_space(target->postfix, ringbuf->tail,
|
||||
ringbuf->size);
|
||||
if (space >= bytes)
|
||||
break;
|
||||
}
|
||||
|
||||
if (WARN_ON(&target->list == &engine->request_list))
|
||||
return -ENOSPC;
|
||||
|
||||
ret = i915_wait_request(target);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ringbuf->space = space;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* intel_logical_ring_advance_and_submit() - advance the tail and submit the workload
|
||||
* @request: Request to advance the logical ringbuffer of.
|
||||
|
@ -814,92 +772,6 @@ intel_logical_ring_advance_and_submit(struct drm_i915_gem_request *request)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void __wrap_ring_buffer(struct intel_ringbuffer *ringbuf)
|
||||
{
|
||||
uint32_t __iomem *virt;
|
||||
int rem = ringbuf->size - ringbuf->tail;
|
||||
|
||||
virt = ringbuf->virtual_start + ringbuf->tail;
|
||||
rem /= 4;
|
||||
while (rem--)
|
||||
iowrite32(MI_NOOP, virt++);
|
||||
|
||||
ringbuf->tail = 0;
|
||||
intel_ring_update_space(ringbuf);
|
||||
}
|
||||
|
||||
static int logical_ring_prepare(struct drm_i915_gem_request *req, int bytes)
|
||||
{
|
||||
struct intel_ringbuffer *ringbuf = req->ringbuf;
|
||||
int remain_usable = ringbuf->effective_size - ringbuf->tail;
|
||||
int remain_actual = ringbuf->size - ringbuf->tail;
|
||||
int ret, total_bytes, wait_bytes = 0;
|
||||
bool need_wrap = false;
|
||||
|
||||
if (ringbuf->reserved_in_use)
|
||||
total_bytes = bytes;
|
||||
else
|
||||
total_bytes = bytes + ringbuf->reserved_size;
|
||||
|
||||
if (unlikely(bytes > remain_usable)) {
|
||||
/*
|
||||
* Not enough space for the basic request. So need to flush
|
||||
* out the remainder and then wait for base + reserved.
|
||||
*/
|
||||
wait_bytes = remain_actual + total_bytes;
|
||||
need_wrap = true;
|
||||
} else {
|
||||
if (unlikely(total_bytes > remain_usable)) {
|
||||
/*
|
||||
* The base request will fit but the reserved space
|
||||
* falls off the end. So don't need an immediate wrap
|
||||
* and only need to effectively wait for the reserved
|
||||
* size space from the start of ringbuffer.
|
||||
*/
|
||||
wait_bytes = remain_actual + ringbuf->reserved_size;
|
||||
} else if (total_bytes > ringbuf->space) {
|
||||
/* No wrapping required, just waiting. */
|
||||
wait_bytes = total_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
if (wait_bytes) {
|
||||
ret = logical_ring_wait_for_space(req, wait_bytes);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
if (need_wrap)
|
||||
__wrap_ring_buffer(ringbuf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* intel_logical_ring_begin() - prepare the logical ringbuffer to accept some commands
|
||||
*
|
||||
* @req: The request to start some new work for
|
||||
* @num_dwords: number of DWORDs that we plan to write to the ringbuffer.
|
||||
*
|
||||
* The ringbuffer might not be ready to accept the commands right away (maybe it needs to
|
||||
* be wrapped, or wait a bit for the tail to be updated). This function takes care of that
|
||||
* and also preallocates a request (every workload submission is still mediated through
|
||||
* requests, same as it did with legacy ringbuffer submission).
|
||||
*
|
||||
* Return: non-zero if the ringbuffer is not ready to be written to.
|
||||
*/
|
||||
int intel_logical_ring_begin(struct drm_i915_gem_request *req, int num_dwords)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = logical_ring_prepare(req, num_dwords * sizeof(uint32_t));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
req->ringbuf->space -= num_dwords * sizeof(uint32_t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int intel_logical_ring_reserve_space(struct drm_i915_gem_request *request)
|
||||
{
|
||||
/*
|
||||
|
@ -912,7 +784,7 @@ int intel_logical_ring_reserve_space(struct drm_i915_gem_request *request)
|
|||
*/
|
||||
intel_ring_reserved_space_reserve(request->ringbuf, MIN_SPACE_FOR_ADD_REQUEST);
|
||||
|
||||
return intel_logical_ring_begin(request, 0);
|
||||
return intel_ring_begin(request, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -982,7 +854,7 @@ int intel_execlists_submission(struct i915_execbuffer_params *params,
|
|||
|
||||
if (engine == &dev_priv->engine[RCS] &&
|
||||
instp_mode != dev_priv->relative_constants_mode) {
|
||||
ret = intel_logical_ring_begin(params->request, 4);
|
||||
ret = intel_ring_begin(params->request, 4);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -1178,7 +1050,7 @@ static int intel_logical_ring_workarounds_emit(struct drm_i915_gem_request *req)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = intel_logical_ring_begin(req, w->count * 2 + 2);
|
||||
ret = intel_ring_begin(req, w->count * 2 + 2);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -1669,7 +1541,7 @@ static int intel_logical_ring_emit_pdps(struct drm_i915_gem_request *req)
|
|||
const int num_lri_cmds = GEN8_LEGACY_PDPES * 2;
|
||||
int i, ret;
|
||||
|
||||
ret = intel_logical_ring_begin(req, num_lri_cmds * 2 + 2);
|
||||
ret = intel_ring_begin(req, num_lri_cmds * 2 + 2);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -1716,7 +1588,7 @@ static int gen8_emit_bb_start(struct drm_i915_gem_request *req,
|
|||
req->ctx->ppgtt->pd_dirty_rings &= ~intel_engine_flag(req->engine);
|
||||
}
|
||||
|
||||
ret = intel_logical_ring_begin(req, 4);
|
||||
ret = intel_ring_begin(req, 4);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -1778,7 +1650,7 @@ static int gen8_emit_flush(struct drm_i915_gem_request *request,
|
|||
uint32_t cmd;
|
||||
int ret;
|
||||
|
||||
ret = intel_logical_ring_begin(request, 4);
|
||||
ret = intel_ring_begin(request, 4);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -1846,7 +1718,7 @@ static int gen8_emit_flush_render(struct drm_i915_gem_request *request,
|
|||
vf_flush_wa = true;
|
||||
}
|
||||
|
||||
ret = intel_logical_ring_begin(request, vf_flush_wa ? 12 : 6);
|
||||
ret = intel_ring_begin(request, vf_flush_wa ? 12 : 6);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -1920,7 +1792,7 @@ static int gen8_emit_request(struct drm_i915_gem_request *request)
|
|||
struct intel_ringbuffer *ringbuf = request->ringbuf;
|
||||
int ret;
|
||||
|
||||
ret = intel_logical_ring_begin(request, 6 + WA_TAIL_DWORDS);
|
||||
ret = intel_ring_begin(request, 6 + WA_TAIL_DWORDS);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -1944,7 +1816,7 @@ static int gen8_emit_request_render(struct drm_i915_gem_request *request)
|
|||
struct intel_ringbuffer *ringbuf = request->ringbuf;
|
||||
int ret;
|
||||
|
||||
ret = intel_logical_ring_begin(request, 8 + WA_TAIL_DWORDS);
|
||||
ret = intel_ring_begin(request, 8 + WA_TAIL_DWORDS);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ int intel_logical_ring_reserve_space(struct drm_i915_gem_request *request);
|
|||
void intel_logical_ring_stop(struct intel_engine_cs *engine);
|
||||
void intel_logical_ring_cleanup(struct intel_engine_cs *engine);
|
||||
int intel_logical_rings_init(struct drm_device *dev);
|
||||
int intel_logical_ring_begin(struct drm_i915_gem_request *req, int num_dwords);
|
||||
|
||||
int logical_ring_flush_all_caches(struct drm_i915_gem_request *req);
|
||||
/**
|
||||
|
|
|
@ -239,11 +239,9 @@ static int emit_mocs_control_table(struct drm_i915_gem_request *req,
|
|||
if (WARN_ON(table->size > GEN9_NUM_MOCS_ENTRIES))
|
||||
return -ENODEV;
|
||||
|
||||
ret = intel_logical_ring_begin(req, 2 + 2 * GEN9_NUM_MOCS_ENTRIES);
|
||||
if (ret) {
|
||||
DRM_DEBUG("intel_logical_ring_begin failed %d\n", ret);
|
||||
ret = intel_ring_begin(req, 2 + 2 * GEN9_NUM_MOCS_ENTRIES);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
intel_logical_ring_emit(ringbuf,
|
||||
MI_LOAD_REGISTER_IMM(GEN9_NUM_MOCS_ENTRIES));
|
||||
|
@ -305,11 +303,9 @@ static int emit_mocs_l3cc_table(struct drm_i915_gem_request *req,
|
|||
if (WARN_ON(table->size > GEN9_NUM_MOCS_ENTRIES))
|
||||
return -ENODEV;
|
||||
|
||||
ret = intel_logical_ring_begin(req, 2 + GEN9_NUM_MOCS_ENTRIES);
|
||||
if (ret) {
|
||||
DRM_DEBUG("intel_logical_ring_begin failed %d\n", ret);
|
||||
ret = intel_ring_begin(req, 2 + GEN9_NUM_MOCS_ENTRIES);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
intel_logical_ring_emit(ringbuf,
|
||||
MI_LOAD_REGISTER_IMM(GEN9_NUM_MOCS_ENTRIES / 2));
|
||||
|
|
|
@ -3904,6 +3904,8 @@ static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc)
|
|||
if (IS_HASWELL(dev) || IS_BROADWELL(dev))
|
||||
hw->wm_linetime[pipe] = I915_READ(PIPE_WM_LINETIME(pipe));
|
||||
|
||||
memset(active, 0, sizeof(*active));
|
||||
|
||||
active->pipe_enabled = intel_crtc->active;
|
||||
|
||||
if (active->pipe_enabled) {
|
||||
|
|
|
@ -280,7 +280,10 @@ static void hsw_psr_enable_source(struct intel_dp *intel_dp)
|
|||
* with the 5 or 6 idle patterns.
|
||||
*/
|
||||
uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
|
||||
uint32_t val = 0x0;
|
||||
uint32_t val = EDP_PSR_ENABLE;
|
||||
|
||||
val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
|
||||
val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;
|
||||
|
||||
if (IS_HASWELL(dev))
|
||||
val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
|
||||
|
@ -288,14 +291,50 @@ static void hsw_psr_enable_source(struct intel_dp *intel_dp)
|
|||
if (dev_priv->psr.link_standby)
|
||||
val |= EDP_PSR_LINK_STANDBY;
|
||||
|
||||
I915_WRITE(EDP_PSR_CTL, val |
|
||||
max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT |
|
||||
idle_frames << EDP_PSR_IDLE_FRAME_SHIFT |
|
||||
EDP_PSR_ENABLE);
|
||||
if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
|
||||
val |= EDP_PSR_TP1_TIME_2500us;
|
||||
else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
|
||||
val |= EDP_PSR_TP1_TIME_500us;
|
||||
else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
|
||||
val |= EDP_PSR_TP1_TIME_100us;
|
||||
else
|
||||
val |= EDP_PSR_TP1_TIME_0us;
|
||||
|
||||
if (dev_priv->psr.psr2_support)
|
||||
I915_WRITE(EDP_PSR2_CTL, EDP_PSR2_ENABLE |
|
||||
EDP_SU_TRACK_ENABLE | EDP_PSR2_TP2_TIME_100);
|
||||
if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
|
||||
val |= EDP_PSR_TP2_TP3_TIME_2500us;
|
||||
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
|
||||
val |= EDP_PSR_TP2_TP3_TIME_500us;
|
||||
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
|
||||
val |= EDP_PSR_TP2_TP3_TIME_100us;
|
||||
else
|
||||
val |= EDP_PSR_TP2_TP3_TIME_0us;
|
||||
|
||||
if (intel_dp_source_supports_hbr2(intel_dp) &&
|
||||
drm_dp_tps3_supported(intel_dp->dpcd))
|
||||
val |= EDP_PSR_TP1_TP3_SEL;
|
||||
else
|
||||
val |= EDP_PSR_TP1_TP2_SEL;
|
||||
|
||||
I915_WRITE(EDP_PSR_CTL, val);
|
||||
|
||||
if (!dev_priv->psr.psr2_support)
|
||||
return;
|
||||
|
||||
/* FIXME: selective update is probably totally broken because it doesn't
|
||||
* mesh at all with our frontbuffer tracking. And the hw alone isn't
|
||||
* good enough. */
|
||||
val = EDP_PSR2_ENABLE | EDP_SU_TRACK_ENABLE;
|
||||
|
||||
if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
|
||||
val |= EDP_PSR2_TP2_TIME_2500;
|
||||
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
|
||||
val |= EDP_PSR2_TP2_TIME_500;
|
||||
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
|
||||
val |= EDP_PSR2_TP2_TIME_100;
|
||||
else
|
||||
val |= EDP_PSR2_TP2_TIME_50;
|
||||
|
||||
I915_WRITE(EDP_PSR2_CTL, val);
|
||||
}
|
||||
|
||||
static bool intel_psr_match_conditions(struct intel_dp *intel_dp)
|
||||
|
|
|
@ -53,12 +53,6 @@ void intel_ring_update_space(struct intel_ringbuffer *ringbuf)
|
|||
ringbuf->tail, ringbuf->size);
|
||||
}
|
||||
|
||||
int intel_ring_space(struct intel_ringbuffer *ringbuf)
|
||||
{
|
||||
intel_ring_update_space(ringbuf);
|
||||
return ringbuf->space;
|
||||
}
|
||||
|
||||
bool intel_engine_stopped(struct intel_engine_cs *engine)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = engine->dev->dev_private;
|
||||
|
@ -1309,7 +1303,7 @@ static int gen8_rcs_signal(struct drm_i915_gem_request *signaller_req,
|
|||
intel_ring_emit(signaller, seqno);
|
||||
intel_ring_emit(signaller, 0);
|
||||
intel_ring_emit(signaller, MI_SEMAPHORE_SIGNAL |
|
||||
MI_SEMAPHORE_TARGET(waiter->id));
|
||||
MI_SEMAPHORE_TARGET(waiter->hw_id));
|
||||
intel_ring_emit(signaller, 0);
|
||||
}
|
||||
|
||||
|
@ -1349,7 +1343,7 @@ static int gen8_xcs_signal(struct drm_i915_gem_request *signaller_req,
|
|||
intel_ring_emit(signaller, upper_32_bits(gtt_offset));
|
||||
intel_ring_emit(signaller, seqno);
|
||||
intel_ring_emit(signaller, MI_SEMAPHORE_SIGNAL |
|
||||
MI_SEMAPHORE_TARGET(waiter->id));
|
||||
MI_SEMAPHORE_TARGET(waiter->hw_id));
|
||||
intel_ring_emit(signaller, 0);
|
||||
}
|
||||
|
||||
|
@ -1573,6 +1567,8 @@ pc_render_add_request(struct drm_i915_gem_request *req)
|
|||
static void
|
||||
gen6_seqno_barrier(struct intel_engine_cs *engine)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = engine->dev->dev_private;
|
||||
|
||||
/* Workaround to force correct ordering between irq and seqno writes on
|
||||
* ivb (and maybe also on snb) by reading from a CS register (like
|
||||
* ACTHD) before reading the status page.
|
||||
|
@ -1584,9 +1580,13 @@ gen6_seqno_barrier(struct intel_engine_cs *engine)
|
|||
* the write time to land, but that would incur a delay after every
|
||||
* batch i.e. much more frequent than a delay when waiting for the
|
||||
* interrupt (with the same net latency).
|
||||
*
|
||||
* Also note that to prevent whole machine hangs on gen7, we have to
|
||||
* take the spinlock to guard against concurrent cacheline access.
|
||||
*/
|
||||
struct drm_i915_private *dev_priv = engine->dev->dev_private;
|
||||
spin_lock_irq(&dev_priv->uncore.lock);
|
||||
POSTING_READ_FW(RING_ACTHD(engine->mmio_base));
|
||||
spin_unlock_irq(&dev_priv->uncore.lock);
|
||||
}
|
||||
|
||||
static u32
|
||||
|
@ -2312,51 +2312,6 @@ void intel_cleanup_engine(struct intel_engine_cs *engine)
|
|||
engine->dev = NULL;
|
||||
}
|
||||
|
||||
static int ring_wait_for_space(struct intel_engine_cs *engine, int n)
|
||||
{
|
||||
struct intel_ringbuffer *ringbuf = engine->buffer;
|
||||
struct drm_i915_gem_request *request;
|
||||
unsigned space;
|
||||
int ret;
|
||||
|
||||
if (intel_ring_space(ringbuf) >= n)
|
||||
return 0;
|
||||
|
||||
/* The whole point of reserving space is to not wait! */
|
||||
WARN_ON(ringbuf->reserved_in_use);
|
||||
|
||||
list_for_each_entry(request, &engine->request_list, list) {
|
||||
space = __intel_ring_space(request->postfix, ringbuf->tail,
|
||||
ringbuf->size);
|
||||
if (space >= n)
|
||||
break;
|
||||
}
|
||||
|
||||
if (WARN_ON(&request->list == &engine->request_list))
|
||||
return -ENOSPC;
|
||||
|
||||
ret = i915_wait_request(request);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ringbuf->space = space;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __wrap_ring_buffer(struct intel_ringbuffer *ringbuf)
|
||||
{
|
||||
uint32_t __iomem *virt;
|
||||
int rem = ringbuf->size - ringbuf->tail;
|
||||
|
||||
virt = ringbuf->virtual_start + ringbuf->tail;
|
||||
rem /= 4;
|
||||
while (rem--)
|
||||
iowrite32(MI_NOOP, virt++);
|
||||
|
||||
ringbuf->tail = 0;
|
||||
intel_ring_update_space(ringbuf);
|
||||
}
|
||||
|
||||
int intel_engine_idle(struct intel_engine_cs *engine)
|
||||
{
|
||||
struct drm_i915_gem_request *req;
|
||||
|
@ -2398,63 +2353,82 @@ int intel_ring_reserve_space(struct drm_i915_gem_request *request)
|
|||
|
||||
void intel_ring_reserved_space_reserve(struct intel_ringbuffer *ringbuf, int size)
|
||||
{
|
||||
WARN_ON(ringbuf->reserved_size);
|
||||
WARN_ON(ringbuf->reserved_in_use);
|
||||
|
||||
GEM_BUG_ON(ringbuf->reserved_size);
|
||||
ringbuf->reserved_size = size;
|
||||
}
|
||||
|
||||
void intel_ring_reserved_space_cancel(struct intel_ringbuffer *ringbuf)
|
||||
{
|
||||
WARN_ON(ringbuf->reserved_in_use);
|
||||
|
||||
GEM_BUG_ON(!ringbuf->reserved_size);
|
||||
ringbuf->reserved_size = 0;
|
||||
ringbuf->reserved_in_use = false;
|
||||
}
|
||||
|
||||
void intel_ring_reserved_space_use(struct intel_ringbuffer *ringbuf)
|
||||
{
|
||||
WARN_ON(ringbuf->reserved_in_use);
|
||||
|
||||
ringbuf->reserved_in_use = true;
|
||||
ringbuf->reserved_tail = ringbuf->tail;
|
||||
GEM_BUG_ON(!ringbuf->reserved_size);
|
||||
ringbuf->reserved_size = 0;
|
||||
}
|
||||
|
||||
void intel_ring_reserved_space_end(struct intel_ringbuffer *ringbuf)
|
||||
{
|
||||
WARN_ON(!ringbuf->reserved_in_use);
|
||||
if (ringbuf->tail > ringbuf->reserved_tail) {
|
||||
WARN(ringbuf->tail > ringbuf->reserved_tail + ringbuf->reserved_size,
|
||||
"request reserved size too small: %d vs %d!\n",
|
||||
ringbuf->tail - ringbuf->reserved_tail, ringbuf->reserved_size);
|
||||
} else {
|
||||
/*
|
||||
* The ring was wrapped while the reserved space was in use.
|
||||
* That means that some unknown amount of the ring tail was
|
||||
* no-op filled and skipped. Thus simply adding the ring size
|
||||
* to the tail and doing the above space check will not work.
|
||||
* Rather than attempt to track how much tail was skipped,
|
||||
* it is much simpler to say that also skipping the sanity
|
||||
* check every once in a while is not a big issue.
|
||||
*/
|
||||
}
|
||||
|
||||
ringbuf->reserved_size = 0;
|
||||
ringbuf->reserved_in_use = false;
|
||||
GEM_BUG_ON(ringbuf->reserved_size);
|
||||
}
|
||||
|
||||
static int __intel_ring_prepare(struct intel_engine_cs *engine, int bytes)
|
||||
static int wait_for_space(struct drm_i915_gem_request *req, int bytes)
|
||||
{
|
||||
struct intel_ringbuffer *ringbuf = engine->buffer;
|
||||
int remain_usable = ringbuf->effective_size - ringbuf->tail;
|
||||
struct intel_ringbuffer *ringbuf = req->ringbuf;
|
||||
struct intel_engine_cs *engine = req->engine;
|
||||
struct drm_i915_gem_request *target;
|
||||
|
||||
intel_ring_update_space(ringbuf);
|
||||
if (ringbuf->space >= bytes)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Space is reserved in the ringbuffer for finalising the request,
|
||||
* as that cannot be allowed to fail. During request finalisation,
|
||||
* reserved_space is set to 0 to stop the overallocation and the
|
||||
* assumption is that then we never need to wait (which has the
|
||||
* risk of failing with EINTR).
|
||||
*
|
||||
* See also i915_gem_request_alloc() and i915_add_request().
|
||||
*/
|
||||
GEM_BUG_ON(!ringbuf->reserved_size);
|
||||
|
||||
list_for_each_entry(target, &engine->request_list, list) {
|
||||
unsigned space;
|
||||
|
||||
/*
|
||||
* The request queue is per-engine, so can contain requests
|
||||
* from multiple ringbuffers. Here, we must ignore any that
|
||||
* aren't from the ringbuffer we're considering.
|
||||
*/
|
||||
if (target->ringbuf != ringbuf)
|
||||
continue;
|
||||
|
||||
/* Would completion of this request free enough space? */
|
||||
space = __intel_ring_space(target->postfix, ringbuf->tail,
|
||||
ringbuf->size);
|
||||
if (space >= bytes)
|
||||
break;
|
||||
}
|
||||
|
||||
if (WARN_ON(&target->list == &engine->request_list))
|
||||
return -ENOSPC;
|
||||
|
||||
return i915_wait_request(target);
|
||||
}
|
||||
|
||||
int intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords)
|
||||
{
|
||||
struct intel_ringbuffer *ringbuf = req->ringbuf;
|
||||
int remain_actual = ringbuf->size - ringbuf->tail;
|
||||
int ret, total_bytes, wait_bytes = 0;
|
||||
int remain_usable = ringbuf->effective_size - ringbuf->tail;
|
||||
int bytes = num_dwords * sizeof(u32);
|
||||
int total_bytes, wait_bytes;
|
||||
bool need_wrap = false;
|
||||
|
||||
if (ringbuf->reserved_in_use)
|
||||
total_bytes = bytes;
|
||||
else
|
||||
total_bytes = bytes + ringbuf->reserved_size;
|
||||
total_bytes = bytes + ringbuf->reserved_size;
|
||||
|
||||
if (unlikely(bytes > remain_usable)) {
|
||||
/*
|
||||
|
@ -2463,44 +2437,42 @@ static int __intel_ring_prepare(struct intel_engine_cs *engine, int bytes)
|
|||
*/
|
||||
wait_bytes = remain_actual + total_bytes;
|
||||
need_wrap = true;
|
||||
} else if (unlikely(total_bytes > remain_usable)) {
|
||||
/*
|
||||
* The base request will fit but the reserved space
|
||||
* falls off the end. So we don't need an immediate wrap
|
||||
* and only need to effectively wait for the reserved
|
||||
* size space from the start of ringbuffer.
|
||||
*/
|
||||
wait_bytes = remain_actual + ringbuf->reserved_size;
|
||||
} else {
|
||||
if (unlikely(total_bytes > remain_usable)) {
|
||||
/*
|
||||
* The base request will fit but the reserved space
|
||||
* falls off the end. So don't need an immediate wrap
|
||||
* and only need to effectively wait for the reserved
|
||||
* size space from the start of ringbuffer.
|
||||
*/
|
||||
wait_bytes = remain_actual + ringbuf->reserved_size;
|
||||
} else if (total_bytes > ringbuf->space) {
|
||||
/* No wrapping required, just waiting. */
|
||||
wait_bytes = total_bytes;
|
||||
}
|
||||
/* No wrapping required, just waiting. */
|
||||
wait_bytes = total_bytes;
|
||||
}
|
||||
|
||||
if (wait_bytes) {
|
||||
ret = ring_wait_for_space(engine, wait_bytes);
|
||||
if (wait_bytes > ringbuf->space) {
|
||||
int ret = wait_for_space(req, wait_bytes);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
if (need_wrap)
|
||||
__wrap_ring_buffer(ringbuf);
|
||||
intel_ring_update_space(ringbuf);
|
||||
if (unlikely(ringbuf->space < wait_bytes))
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (unlikely(need_wrap)) {
|
||||
GEM_BUG_ON(remain_actual > ringbuf->space);
|
||||
GEM_BUG_ON(ringbuf->tail + remain_actual > ringbuf->size);
|
||||
|
||||
int intel_ring_begin(struct drm_i915_gem_request *req,
|
||||
int num_dwords)
|
||||
{
|
||||
struct intel_engine_cs *engine = req->engine;
|
||||
int ret;
|
||||
/* Fill the tail with MI_NOOP */
|
||||
memset(ringbuf->virtual_start + ringbuf->tail,
|
||||
0, remain_actual);
|
||||
ringbuf->tail = 0;
|
||||
ringbuf->space -= remain_actual;
|
||||
}
|
||||
|
||||
ret = __intel_ring_prepare(engine, num_dwords * sizeof(uint32_t));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
engine->buffer->space -= num_dwords * sizeof(uint32_t);
|
||||
ringbuf->space -= bytes;
|
||||
GEM_BUG_ON(ringbuf->space < 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2772,6 +2744,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
|
|||
engine->name = "render ring";
|
||||
engine->id = RCS;
|
||||
engine->exec_id = I915_EXEC_RENDER;
|
||||
engine->hw_id = 0;
|
||||
engine->mmio_base = RENDER_RING_BASE;
|
||||
|
||||
if (INTEL_INFO(dev)->gen >= 8) {
|
||||
|
@ -2923,6 +2896,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev)
|
|||
engine->name = "bsd ring";
|
||||
engine->id = VCS;
|
||||
engine->exec_id = I915_EXEC_BSD;
|
||||
engine->hw_id = 1;
|
||||
|
||||
engine->write_tail = ring_write_tail;
|
||||
if (INTEL_INFO(dev)->gen >= 6) {
|
||||
|
@ -3001,6 +2975,7 @@ int intel_init_bsd2_ring_buffer(struct drm_device *dev)
|
|||
engine->name = "bsd2 ring";
|
||||
engine->id = VCS2;
|
||||
engine->exec_id = I915_EXEC_BSD;
|
||||
engine->hw_id = 4;
|
||||
|
||||
engine->write_tail = ring_write_tail;
|
||||
engine->mmio_base = GEN8_BSD2_RING_BASE;
|
||||
|
@ -3033,6 +3008,7 @@ int intel_init_blt_ring_buffer(struct drm_device *dev)
|
|||
engine->name = "blitter ring";
|
||||
engine->id = BCS;
|
||||
engine->exec_id = I915_EXEC_BLT;
|
||||
engine->hw_id = 2;
|
||||
|
||||
engine->mmio_base = BLT_RING_BASE;
|
||||
engine->write_tail = ring_write_tail;
|
||||
|
@ -3092,6 +3068,7 @@ int intel_init_vebox_ring_buffer(struct drm_device *dev)
|
|||
engine->name = "video enhancement ring";
|
||||
engine->id = VECS;
|
||||
engine->exec_id = I915_EXEC_VEBOX;
|
||||
engine->hw_id = 3;
|
||||
|
||||
engine->mmio_base = VEBOX_RING_BASE;
|
||||
engine->write_tail = ring_write_tail;
|
||||
|
|
|
@ -108,8 +108,6 @@ struct intel_ringbuffer {
|
|||
int size;
|
||||
int effective_size;
|
||||
int reserved_size;
|
||||
int reserved_tail;
|
||||
bool reserved_in_use;
|
||||
|
||||
/** We track the position of the requests in the ring buffer, and
|
||||
* when each is retired we increment last_retired_head as the GPU
|
||||
|
@ -156,7 +154,8 @@ struct intel_engine_cs {
|
|||
#define I915_NUM_ENGINES 5
|
||||
#define _VCS(n) (VCS + (n))
|
||||
unsigned int exec_id;
|
||||
unsigned int guc_id;
|
||||
unsigned int hw_id;
|
||||
unsigned int guc_id; /* XXX same as hw_id? */
|
||||
u32 mmio_base;
|
||||
struct drm_device *dev;
|
||||
struct intel_ringbuffer *buffer;
|
||||
|
@ -459,7 +458,6 @@ static inline void intel_ring_advance(struct intel_engine_cs *engine)
|
|||
}
|
||||
int __intel_ring_space(int head, int tail, int size);
|
||||
void intel_ring_update_space(struct intel_ringbuffer *ringbuf);
|
||||
int intel_ring_space(struct intel_ringbuffer *ringbuf);
|
||||
bool intel_engine_stopped(struct intel_engine_cs *engine);
|
||||
|
||||
int __must_check intel_engine_idle(struct intel_engine_cs *engine);
|
||||
|
|
|
@ -740,6 +740,7 @@ struct bdb_psr {
|
|||
#define DEVICE_TYPE_INT_TV 0x1009
|
||||
#define DEVICE_TYPE_HDMI 0x60D2
|
||||
#define DEVICE_TYPE_DP 0x68C6
|
||||
#define DEVICE_TYPE_DP_DUAL_MODE 0x60D6
|
||||
#define DEVICE_TYPE_eDP 0x78C6
|
||||
|
||||
#define DEVICE_TYPE_CLASS_EXTENSION (1 << 15)
|
||||
|
@ -774,6 +775,17 @@ struct bdb_psr {
|
|||
DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
|
||||
DEVICE_TYPE_ANALOG_OUTPUT)
|
||||
|
||||
#define DEVICE_TYPE_DP_DUAL_MODE_BITS \
|
||||
(DEVICE_TYPE_INTERNAL_CONNECTOR | \
|
||||
DEVICE_TYPE_MIPI_OUTPUT | \
|
||||
DEVICE_TYPE_COMPOSITE_OUTPUT | \
|
||||
DEVICE_TYPE_LVDS_SINGALING | \
|
||||
DEVICE_TYPE_TMDS_DVI_SIGNALING | \
|
||||
DEVICE_TYPE_VIDEO_SIGNALING | \
|
||||
DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
|
||||
DEVICE_TYPE_DIGITAL_OUTPUT | \
|
||||
DEVICE_TYPE_ANALOG_OUTPUT)
|
||||
|
||||
/* define the DVO port for HDMI output type */
|
||||
#define DVO_B 1
|
||||
#define DVO_C 2
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <drm/drm_fb_cma_helper.h>
|
||||
#include <drm/drm_plane_helper.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <video/imx-ipu-v3.h>
|
||||
|
||||
#include "imx-drm.h"
|
||||
|
||||
|
@ -437,6 +438,13 @@ static int compare_of(struct device *dev, void *data)
|
|||
{
|
||||
struct device_node *np = data;
|
||||
|
||||
/* Special case for DI, dev->of_node may not be set yet */
|
||||
if (strcmp(dev->driver->name, "imx-ipuv3-crtc") == 0) {
|
||||
struct ipu_client_platformdata *pdata = dev->platform_data;
|
||||
|
||||
return pdata->of_node == np;
|
||||
}
|
||||
|
||||
/* Special case for LDB, one device for two channels */
|
||||
if (of_node_cmp(np->name, "lvds-channel") == 0) {
|
||||
np = of_get_parent(np);
|
||||
|
|
|
@ -473,7 +473,7 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
|
|||
|
||||
ret = imx_drm_add_crtc(drm, &ipu_crtc->base, &ipu_crtc->imx_crtc,
|
||||
&ipu_crtc->plane[0]->base, &ipu_crtc_helper_funcs,
|
||||
ipu_crtc->dev->of_node);
|
||||
pdata->of_node);
|
||||
if (ret) {
|
||||
dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret);
|
||||
goto err_put_resources;
|
||||
|
|
|
@ -2164,7 +2164,7 @@ static void kv_apply_state_adjust_rules(struct radeon_device *rdev,
|
|||
if (pi->caps_stable_p_state) {
|
||||
stable_p_state_sclk = (max_limits->sclk * 75) / 100;
|
||||
|
||||
for (i = table->count - 1; i >= 0; i++) {
|
||||
for (i = table->count - 1; i >= 0; i--) {
|
||||
if (stable_p_state_sclk >= table->entries[i].clk) {
|
||||
stable_p_state_sclk = table->entries[i].clk;
|
||||
break;
|
||||
|
|
|
@ -997,7 +997,7 @@ struct ipu_platform_reg {
|
|||
};
|
||||
|
||||
/* These must be in the order of the corresponding device tree port nodes */
|
||||
static const struct ipu_platform_reg client_reg[] = {
|
||||
static struct ipu_platform_reg client_reg[] = {
|
||||
{
|
||||
.pdata = {
|
||||
.csi = 0,
|
||||
|
@ -1048,7 +1048,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
|
|||
mutex_unlock(&ipu_client_id_mutex);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
|
||||
const struct ipu_platform_reg *reg = &client_reg[i];
|
||||
struct ipu_platform_reg *reg = &client_reg[i];
|
||||
struct platform_device *pdev;
|
||||
struct device_node *of_node;
|
||||
|
||||
|
@ -1070,6 +1070,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
|
|||
|
||||
pdev->dev.parent = dev;
|
||||
|
||||
reg->pdata.of_node = of_node;
|
||||
ret = platform_device_add_data(pdev, ®->pdata,
|
||||
sizeof(reg->pdata));
|
||||
if (!ret)
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright © 2016 Intel Corporation
|
||||
*
|
||||
* 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 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
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
|
||||
*/
|
||||
|
||||
#ifndef DRM_DP_DUAL_MODE_HELPER_H
|
||||
#define DRM_DP_DUAL_MODE_HELPER_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/*
|
||||
* Optional for type 1 DVI adaptors
|
||||
* Mandatory for type 1 HDMI and type 2 adaptors
|
||||
*/
|
||||
#define DP_DUAL_MODE_HDMI_ID 0x00 /* 00-0f */
|
||||
#define DP_DUAL_MODE_HDMI_ID_LEN 16
|
||||
/*
|
||||
* Optional for type 1 adaptors
|
||||
* Mandatory for type 2 adaptors
|
||||
*/
|
||||
#define DP_DUAL_MODE_ADAPTOR_ID 0x10
|
||||
#define DP_DUAL_MODE_REV_MASK 0x07
|
||||
#define DP_DUAL_MODE_REV_TYPE2 0x00
|
||||
#define DP_DUAL_MODE_TYPE_MASK 0xf0
|
||||
#define DP_DUAL_MODE_TYPE_TYPE2 0xa0
|
||||
#define DP_DUAL_MODE_IEEE_OUI 0x11 /* 11-13*/
|
||||
#define DP_DUAL_IEEE_OUI_LEN 3
|
||||
#define DP_DUAL_DEVICE_ID 0x14 /* 14-19 */
|
||||
#define DP_DUAL_DEVICE_ID_LEN 6
|
||||
#define DP_DUAL_MODE_HARDWARE_REV 0x1a
|
||||
#define DP_DUAL_MODE_FIRMWARE_MAJOR_REV 0x1b
|
||||
#define DP_DUAL_MODE_FIRMWARE_MINOR_REV 0x1c
|
||||
#define DP_DUAL_MODE_MAX_TMDS_CLOCK 0x1d
|
||||
#define DP_DUAL_MODE_I2C_SPEED_CAP 0x1e
|
||||
#define DP_DUAL_MODE_TMDS_OEN 0x20
|
||||
#define DP_DUAL_MODE_TMDS_DISABLE 0x01
|
||||
#define DP_DUAL_MODE_HDMI_PIN_CTRL 0x21
|
||||
#define DP_DUAL_MODE_CEC_ENABLE 0x01
|
||||
#define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22
|
||||
|
||||
struct i2c_adapter;
|
||||
|
||||
ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter,
|
||||
u8 offset, void *buffer, size_t size);
|
||||
ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
|
||||
u8 offset, const void *buffer, size_t size);
|
||||
|
||||
/**
|
||||
* enum drm_dp_dual_mode_type - Type of the DP dual mode adaptor
|
||||
* @DRM_DP_DUAL_MODE_NONE: No DP dual mode adaptor
|
||||
* @DRM_DP_DUAL_MODE_UNKNOWN: Could be either none or type 1 DVI adaptor
|
||||
* @DRM_DP_DUAL_MODE_TYPE1_DVI: Type 1 DVI adaptor
|
||||
* @DRM_DP_DUAL_MODE_TYPE1_HDMI: Type 1 HDMI adaptor
|
||||
* @DRM_DP_DUAL_MODE_TYPE2_DVI: Type 2 DVI adaptor
|
||||
* @DRM_DP_DUAL_MODE_TYPE2_HDMI: Type 2 HDMI adaptor
|
||||
*/
|
||||
enum drm_dp_dual_mode_type {
|
||||
DRM_DP_DUAL_MODE_NONE,
|
||||
DRM_DP_DUAL_MODE_UNKNOWN,
|
||||
DRM_DP_DUAL_MODE_TYPE1_DVI,
|
||||
DRM_DP_DUAL_MODE_TYPE1_HDMI,
|
||||
DRM_DP_DUAL_MODE_TYPE2_DVI,
|
||||
DRM_DP_DUAL_MODE_TYPE2_HDMI,
|
||||
};
|
||||
|
||||
enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter);
|
||||
int drm_dp_dual_mode_max_tmds_clock(enum drm_dp_dual_mode_type type,
|
||||
struct i2c_adapter *adapter);
|
||||
int drm_dp_dual_mode_get_tmds_output(enum drm_dp_dual_mode_type type,
|
||||
struct i2c_adapter *adapter, bool *enabled);
|
||||
int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
|
||||
struct i2c_adapter *adapter, bool enable);
|
||||
const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
|
||||
|
||||
#endif
|
|
@ -16,6 +16,7 @@
|
|||
#include <linux/videodev2.h>
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/of.h>
|
||||
#include <media/v4l2-mediabus.h>
|
||||
#include <video/videomode.h>
|
||||
|
||||
|
@ -345,6 +346,7 @@ struct ipu_client_platformdata {
|
|||
int dc;
|
||||
int dp;
|
||||
int dma[2];
|
||||
struct device_node *of_node;
|
||||
};
|
||||
|
||||
#endif /* __DRM_IPU_H__ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче