diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-06-24 00:35:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-06-24 00:35:12 -0400 |
commit | 0bf0ea431f84bcf34facc5b1f792d000f5957565 (patch) | |
tree | 02eedcd96881753249c64bd919f7dae6754edf1e | |
parent | 75befb31ec3cfc74bc502b034b67cc07e1eac6f7 (diff) | |
parent | 81e257e964268d050f8e9188becd44d50f241d72 (diff) |
Merge tag 'drm-fixes-for-v4.7-rc5' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie:
"This is the drm fixes tree for 4.7-rc5.
It's a bit larger than normal, due to fixes for production AMD Polaris
GPUs. We only merged support for these in 4.7-rc1 so it would be good
if we got all the fixes into final. The changes don't hit any other
hardware.
Other than the amdgpu Polaris changes:
- A single fix for atomic modesetting WARN
- Nouveau fix for when fbdev is disabled
- i915 fixes for FBC on Haswell and displayport regression
- Exynos fix for a display panel regression and some other minor changes
- Atmel fixes for scaling and OF graph interaction
- Allwiinner build, warning and probing fixes
- AMD GPU non-polaris fix for num_rbs and some minor fixes
Also I've just moved house, and my new place is Internet challenged
due to incompetent incumbent ISPs, hopefully sorted out in a couple of
weeks, so I might not be too responsive over the next while. It also
helps Daniel is on holidays for those couple of weeks as well"
* tag 'drm-fixes-for-v4.7-rc5' of git://people.freedesktop.org/~airlied/linux: (38 commits)
drm/atomic: Make drm_atomic_legacy_backoff reset crtc->acquire_ctx
drm/nouveau: fix for disabled fbdev emulation
drm/i915/fbc: Disable on HSW by default for now
drm/i915: Revert DisplayPort fast link training feature
drm/amd/powerplay: enable clock stretch feature for polaris
drm/amdgpu/gfx8: update golden setting for polaris10
drm/amd/powerplay: enable avfs feature for polaris
drm/amdgpu/atombios: add avfs struct for Polaris10/11
drm/amd/powerplay: add avfs related define for polaris
drm/amd/powrplay: enable stutter_mode for polaris.
drm/amd/powerplay: disable UVD SMU handshake for MCLK.
drm/amd/powerplay: initialize variables which were missed.
drm/amd/powerplay: enable PowerContainment feature for polaris10/11.
drm/amd/powerplay: need to notify system bios pcie device ready
drm/amd/powerplay: fix bug that function parameter was incorect.
drm/amd/powerplay: fix logic error.
drm: atmel-hlcdc: Fix OF graph parsing
drm: atmel-hlcdc: actually disable scaling when no scaling is required
drm/amdgpu: initialize amdgpu_cgs_acpi_eval_object result value
drm/amdgpu: precedence bug in amdgpu_device_init()
...
40 files changed, 598 insertions, 256 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index 8943099eb135..cf6f49fc1c75 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | |||
@@ -909,7 +909,7 @@ static int amdgpu_cgs_acpi_eval_object(struct cgs_device *cgs_device, | |||
909 | struct cgs_acpi_method_argument *argument = NULL; | 909 | struct cgs_acpi_method_argument *argument = NULL; |
910 | uint32_t i, count; | 910 | uint32_t i, count; |
911 | acpi_status status; | 911 | acpi_status status; |
912 | int result; | 912 | int result = 0; |
913 | uint32_t func_no = 0xFFFFFFFF; | 913 | uint32_t func_no = 0xFFFFFFFF; |
914 | 914 | ||
915 | handle = ACPI_HANDLE(&adev->pdev->dev); | 915 | handle = ACPI_HANDLE(&adev->pdev->dev); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 66482b429458..6e920086af46 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1535,7 +1535,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1535 | /* Post card if necessary */ | 1535 | /* Post card if necessary */ |
1536 | if (!amdgpu_card_posted(adev) || | 1536 | if (!amdgpu_card_posted(adev) || |
1537 | (adev->virtualization.is_virtual && | 1537 | (adev->virtualization.is_virtual && |
1538 | !adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN)) { | 1538 | !(adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN))) { |
1539 | if (!adev->bios) { | 1539 | if (!adev->bios) { |
1540 | dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); | 1540 | dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); |
1541 | return -EINVAL; | 1541 | return -EINVAL; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 40a23704a981..d851ea15059f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |||
@@ -447,7 +447,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||
447 | dev_info.max_memory_clock = adev->pm.default_mclk * 10; | 447 | dev_info.max_memory_clock = adev->pm.default_mclk * 10; |
448 | } | 448 | } |
449 | dev_info.enabled_rb_pipes_mask = adev->gfx.config.backend_enable_mask; | 449 | dev_info.enabled_rb_pipes_mask = adev->gfx.config.backend_enable_mask; |
450 | dev_info.num_rb_pipes = adev->gfx.config.num_rbs; | 450 | dev_info.num_rb_pipes = adev->gfx.config.max_backends_per_se * |
451 | adev->gfx.config.max_shader_engines; | ||
451 | dev_info.num_hw_gfx_contexts = adev->gfx.config.max_hw_contexts; | 452 | dev_info.num_hw_gfx_contexts = adev->gfx.config.max_hw_contexts; |
452 | dev_info._pad = 0; | 453 | dev_info._pad = 0; |
453 | dev_info.ids_flags = 0; | 454 | dev_info.ids_flags = 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index 589b36e8c5cf..0e13d80d2a95 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | |||
@@ -270,30 +270,28 @@ static ssize_t amdgpu_set_pp_force_state(struct device *dev, | |||
270 | struct drm_device *ddev = dev_get_drvdata(dev); | 270 | struct drm_device *ddev = dev_get_drvdata(dev); |
271 | struct amdgpu_device *adev = ddev->dev_private; | 271 | struct amdgpu_device *adev = ddev->dev_private; |
272 | enum amd_pm_state_type state = 0; | 272 | enum amd_pm_state_type state = 0; |
273 | long idx; | 273 | unsigned long idx; |
274 | int ret; | 274 | int ret; |
275 | 275 | ||
276 | if (strlen(buf) == 1) | 276 | if (strlen(buf) == 1) |
277 | adev->pp_force_state_enabled = false; | 277 | adev->pp_force_state_enabled = false; |
278 | else { | 278 | else if (adev->pp_enabled) { |
279 | ret = kstrtol(buf, 0, &idx); | 279 | struct pp_states_info data; |
280 | 280 | ||
281 | if (ret) { | 281 | ret = kstrtoul(buf, 0, &idx); |
282 | if (ret || idx >= ARRAY_SIZE(data.states)) { | ||
282 | count = -EINVAL; | 283 | count = -EINVAL; |
283 | goto fail; | 284 | goto fail; |
284 | } | 285 | } |
285 | 286 | ||
286 | if (adev->pp_enabled) { | 287 | amdgpu_dpm_get_pp_num_states(adev, &data); |
287 | struct pp_states_info data; | 288 | state = data.states[idx]; |
288 | amdgpu_dpm_get_pp_num_states(adev, &data); | 289 | /* only set user selected power states */ |
289 | state = data.states[idx]; | 290 | if (state != POWER_STATE_TYPE_INTERNAL_BOOT && |
290 | /* only set user selected power states */ | 291 | state != POWER_STATE_TYPE_DEFAULT) { |
291 | if (state != POWER_STATE_TYPE_INTERNAL_BOOT && | 292 | amdgpu_dpm_dispatch_task(adev, |
292 | state != POWER_STATE_TYPE_DEFAULT) { | 293 | AMD_PP_EVENT_ENABLE_USER_STATE, &state, NULL); |
293 | amdgpu_dpm_dispatch_task(adev, | 294 | adev->pp_force_state_enabled = true; |
294 | AMD_PP_EVENT_ENABLE_USER_STATE, &state, NULL); | ||
295 | adev->pp_force_state_enabled = true; | ||
296 | } | ||
297 | } | 295 | } |
298 | } | 296 | } |
299 | fail: | 297 | fail: |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 9f6f8669edc3..1a5cbaff1e34 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -297,7 +297,8 @@ static const u32 polaris11_golden_common_all[] = | |||
297 | static const u32 golden_settings_polaris10_a11[] = | 297 | static const u32 golden_settings_polaris10_a11[] = |
298 | { | 298 | { |
299 | mmATC_MISC_CG, 0x000c0fc0, 0x000c0200, | 299 | mmATC_MISC_CG, 0x000c0fc0, 0x000c0200, |
300 | mmCB_HW_CONTROL, 0xfffdf3cf, 0x00006208, | 300 | mmCB_HW_CONTROL, 0xfffdf3cf, 0x00007208, |
301 | mmCB_HW_CONTROL_2, 0, 0x0f000000, | ||
301 | mmCB_HW_CONTROL_3, 0x000001ff, 0x00000040, | 302 | mmCB_HW_CONTROL_3, 0x000001ff, 0x00000040, |
302 | mmDB_DEBUG2, 0xf00fffff, 0x00000400, | 303 | mmDB_DEBUG2, 0xf00fffff, 0x00000400, |
303 | mmPA_SC_ENHANCE, 0xffffffff, 0x20000001, | 304 | mmPA_SC_ENHANCE, 0xffffffff, 0x20000001, |
diff --git a/drivers/gpu/drm/amd/include/atombios.h b/drivers/gpu/drm/amd/include/atombios.h index 32f3e345de08..3493da5c8f0e 100644 --- a/drivers/gpu/drm/amd/include/atombios.h +++ b/drivers/gpu/drm/amd/include/atombios.h | |||
@@ -5538,6 +5538,78 @@ typedef struct _ATOM_ASIC_PROFILING_INFO_V3_5 | |||
5538 | ULONG ulReserved[12]; | 5538 | ULONG ulReserved[12]; |
5539 | }ATOM_ASIC_PROFILING_INFO_V3_5; | 5539 | }ATOM_ASIC_PROFILING_INFO_V3_5; |
5540 | 5540 | ||
5541 | /* for Polars10/11 AVFS parameters */ | ||
5542 | typedef struct _ATOM_ASIC_PROFILING_INFO_V3_6 | ||
5543 | { | ||
5544 | ATOM_COMMON_TABLE_HEADER asHeader; | ||
5545 | ULONG ulMaxVddc; | ||
5546 | ULONG ulMinVddc; | ||
5547 | USHORT usLkgEuseIndex; | ||
5548 | UCHAR ucLkgEfuseBitLSB; | ||
5549 | UCHAR ucLkgEfuseLength; | ||
5550 | ULONG ulLkgEncodeLn_MaxDivMin; | ||
5551 | ULONG ulLkgEncodeMax; | ||
5552 | ULONG ulLkgEncodeMin; | ||
5553 | EFUSE_LINEAR_FUNC_PARAM sRoFuse; | ||
5554 | ULONG ulEvvDefaultVddc; | ||
5555 | ULONG ulEvvNoCalcVddc; | ||
5556 | ULONG ulSpeed_Model; | ||
5557 | ULONG ulSM_A0; | ||
5558 | ULONG ulSM_A1; | ||
5559 | ULONG ulSM_A2; | ||
5560 | ULONG ulSM_A3; | ||
5561 | ULONG ulSM_A4; | ||
5562 | ULONG ulSM_A5; | ||
5563 | ULONG ulSM_A6; | ||
5564 | ULONG ulSM_A7; | ||
5565 | UCHAR ucSM_A0_sign; | ||
5566 | UCHAR ucSM_A1_sign; | ||
5567 | UCHAR ucSM_A2_sign; | ||
5568 | UCHAR ucSM_A3_sign; | ||
5569 | UCHAR ucSM_A4_sign; | ||
5570 | UCHAR ucSM_A5_sign; | ||
5571 | UCHAR ucSM_A6_sign; | ||
5572 | UCHAR ucSM_A7_sign; | ||
5573 | ULONG ulMargin_RO_a; | ||
5574 | ULONG ulMargin_RO_b; | ||
5575 | ULONG ulMargin_RO_c; | ||
5576 | ULONG ulMargin_fixed; | ||
5577 | ULONG ulMargin_Fmax_mean; | ||
5578 | ULONG ulMargin_plat_mean; | ||
5579 | ULONG ulMargin_Fmax_sigma; | ||
5580 | ULONG ulMargin_plat_sigma; | ||
5581 | ULONG ulMargin_DC_sigma; | ||
5582 | ULONG ulLoadLineSlop; | ||
5583 | ULONG ulaTDClimitPerDPM[8]; | ||
5584 | ULONG ulaNoCalcVddcPerDPM[8]; | ||
5585 | ULONG ulAVFS_meanNsigma_Acontant0; | ||
5586 | ULONG ulAVFS_meanNsigma_Acontant1; | ||
5587 | ULONG ulAVFS_meanNsigma_Acontant2; | ||
5588 | USHORT usAVFS_meanNsigma_DC_tol_sigma; | ||
5589 | USHORT usAVFS_meanNsigma_Platform_mean; | ||
5590 | USHORT usAVFS_meanNsigma_Platform_sigma; | ||
5591 | ULONG ulGB_VDROOP_TABLE_CKSOFF_a0; | ||
5592 | ULONG ulGB_VDROOP_TABLE_CKSOFF_a1; | ||
5593 | ULONG ulGB_VDROOP_TABLE_CKSOFF_a2; | ||
5594 | ULONG ulGB_VDROOP_TABLE_CKSON_a0; | ||
5595 | ULONG ulGB_VDROOP_TABLE_CKSON_a1; | ||
5596 | ULONG ulGB_VDROOP_TABLE_CKSON_a2; | ||
5597 | ULONG ulAVFSGB_FUSE_TABLE_CKSOFF_m1; | ||
5598 | USHORT usAVFSGB_FUSE_TABLE_CKSOFF_m2; | ||
5599 | ULONG ulAVFSGB_FUSE_TABLE_CKSOFF_b; | ||
5600 | ULONG ulAVFSGB_FUSE_TABLE_CKSON_m1; | ||
5601 | USHORT usAVFSGB_FUSE_TABLE_CKSON_m2; | ||
5602 | ULONG ulAVFSGB_FUSE_TABLE_CKSON_b; | ||
5603 | USHORT usMaxVoltage_0_25mv; | ||
5604 | UCHAR ucEnableGB_VDROOP_TABLE_CKSOFF; | ||
5605 | UCHAR ucEnableGB_VDROOP_TABLE_CKSON; | ||
5606 | UCHAR ucEnableGB_FUSE_TABLE_CKSOFF; | ||
5607 | UCHAR ucEnableGB_FUSE_TABLE_CKSON; | ||
5608 | USHORT usPSM_Age_ComFactor; | ||
5609 | UCHAR ucEnableApplyAVFS_CKS_OFF_Voltage; | ||
5610 | UCHAR ucReserved; | ||
5611 | }ATOM_ASIC_PROFILING_INFO_V3_6; | ||
5612 | |||
5541 | 5613 | ||
5542 | typedef struct _ATOM_SCLK_FCW_RANGE_ENTRY_V1{ | 5614 | typedef struct _ATOM_SCLK_FCW_RANGE_ENTRY_V1{ |
5543 | ULONG ulMaxSclkFreq; | 5615 | ULONG ulMaxSclkFreq; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c index 586f73276226..92912ab20944 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | |||
@@ -633,6 +633,8 @@ static int fiji_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
633 | data->vddci_control = FIJI_VOLTAGE_CONTROL_NONE; | 633 | data->vddci_control = FIJI_VOLTAGE_CONTROL_NONE; |
634 | data->mvdd_control = FIJI_VOLTAGE_CONTROL_NONE; | 634 | data->mvdd_control = FIJI_VOLTAGE_CONTROL_NONE; |
635 | 635 | ||
636 | data->force_pcie_gen = PP_PCIEGenInvalid; | ||
637 | |||
636 | if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, | 638 | if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, |
637 | VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) | 639 | VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) |
638 | data->voltage_control = FIJI_VOLTAGE_CONTROL_BY_SVID2; | 640 | data->voltage_control = FIJI_VOLTAGE_CONTROL_BY_SVID2; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c index fa208ada6892..efb77eda7508 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c | |||
@@ -306,10 +306,14 @@ int phm_store_dal_configuration_data(struct pp_hwmgr *hwmgr, | |||
306 | { | 306 | { |
307 | PHM_FUNC_CHECK(hwmgr); | 307 | PHM_FUNC_CHECK(hwmgr); |
308 | 308 | ||
309 | if (hwmgr->hwmgr_func->store_cc6_data == NULL) | 309 | if (display_config == NULL) |
310 | return -EINVAL; | 310 | return -EINVAL; |
311 | 311 | ||
312 | hwmgr->display_config = *display_config; | 312 | hwmgr->display_config = *display_config; |
313 | |||
314 | if (hwmgr->hwmgr_func->store_cc6_data == NULL) | ||
315 | return -EINVAL; | ||
316 | |||
313 | /* to do pass other display configuration in furture */ | 317 | /* to do pass other display configuration in furture */ |
314 | 318 | ||
315 | if (hwmgr->hwmgr_func->store_cc6_data) | 319 | if (hwmgr->hwmgr_func->store_cc6_data) |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c index 1400bc420881..64ee78f7d41e 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | |||
@@ -1296,7 +1296,6 @@ static int polaris10_populate_single_memory_level(struct pp_hwmgr *hwmgr, | |||
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | mem_level->MclkFrequency = clock; | 1298 | mem_level->MclkFrequency = clock; |
1299 | mem_level->StutterEnable = 0; | ||
1300 | mem_level->EnabledForThrottle = 1; | 1299 | mem_level->EnabledForThrottle = 1; |
1301 | mem_level->EnabledForActivity = 0; | 1300 | mem_level->EnabledForActivity = 0; |
1302 | mem_level->UpHyst = 0; | 1301 | mem_level->UpHyst = 0; |
@@ -1304,7 +1303,6 @@ static int polaris10_populate_single_memory_level(struct pp_hwmgr *hwmgr, | |||
1304 | mem_level->VoltageDownHyst = 0; | 1303 | mem_level->VoltageDownHyst = 0; |
1305 | mem_level->ActivityLevel = (uint16_t)data->mclk_activity_target; | 1304 | mem_level->ActivityLevel = (uint16_t)data->mclk_activity_target; |
1306 | mem_level->StutterEnable = false; | 1305 | mem_level->StutterEnable = false; |
1307 | |||
1308 | mem_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; | 1306 | mem_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; |
1309 | 1307 | ||
1310 | data->display_timing.num_existing_displays = info.display_count; | 1308 | data->display_timing.num_existing_displays = info.display_count; |
@@ -1363,7 +1361,7 @@ static int polaris10_populate_all_memory_levels(struct pp_hwmgr *hwmgr) | |||
1363 | * a higher state by default such that we are not effected by | 1361 | * a higher state by default such that we are not effected by |
1364 | * up threshold or and MCLK DPM latency. | 1362 | * up threshold or and MCLK DPM latency. |
1365 | */ | 1363 | */ |
1366 | levels[0].ActivityLevel = (uint16_t)data->mclk_dpm0_activity_target; | 1364 | levels[0].ActivityLevel = 0x1f; |
1367 | CONVERT_FROM_HOST_TO_SMC_US(levels[0].ActivityLevel); | 1365 | CONVERT_FROM_HOST_TO_SMC_US(levels[0].ActivityLevel); |
1368 | 1366 | ||
1369 | data->smc_state_table.MemoryDpmLevelCount = | 1367 | data->smc_state_table.MemoryDpmLevelCount = |
@@ -1761,12 +1759,9 @@ static int polaris10_populate_smc_initailial_state(struct pp_hwmgr *hwmgr) | |||
1761 | 1759 | ||
1762 | static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) | 1760 | static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) |
1763 | { | 1761 | { |
1764 | uint32_t ro, efuse, efuse2, clock_freq, volt_without_cks, | 1762 | uint32_t ro, efuse, volt_without_cks, volt_with_cks, value, max, min; |
1765 | volt_with_cks, value; | ||
1766 | uint16_t clock_freq_u16; | ||
1767 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | 1763 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); |
1768 | uint8_t type, i, j, cks_setting, stretch_amount, stretch_amount2, | 1764 | uint8_t i, stretch_amount, stretch_amount2, volt_offset = 0; |
1769 | volt_offset = 0; | ||
1770 | struct phm_ppt_v1_information *table_info = | 1765 | struct phm_ppt_v1_information *table_info = |
1771 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | 1766 | (struct phm_ppt_v1_information *)(hwmgr->pptable); |
1772 | struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = | 1767 | struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = |
@@ -1778,50 +1773,38 @@ static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) | |||
1778 | * if the part is SS or FF. if RO >= 1660MHz, part is FF. | 1773 | * if the part is SS or FF. if RO >= 1660MHz, part is FF. |
1779 | */ | 1774 | */ |
1780 | efuse = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, | 1775 | efuse = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, |
1781 | ixSMU_EFUSE_0 + (146 * 4)); | 1776 | ixSMU_EFUSE_0 + (67 * 4)); |
1782 | efuse2 = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, | ||
1783 | ixSMU_EFUSE_0 + (148 * 4)); | ||
1784 | efuse &= 0xFF000000; | 1777 | efuse &= 0xFF000000; |
1785 | efuse = efuse >> 24; | 1778 | efuse = efuse >> 24; |
1786 | efuse2 &= 0xF; | ||
1787 | |||
1788 | if (efuse2 == 1) | ||
1789 | ro = (2300 - 1350) * efuse / 255 + 1350; | ||
1790 | else | ||
1791 | ro = (2500 - 1000) * efuse / 255 + 1000; | ||
1792 | 1779 | ||
1793 | if (ro >= 1660) | 1780 | if (hwmgr->chip_id == CHIP_POLARIS10) { |
1794 | type = 0; | 1781 | min = 1000; |
1795 | else | 1782 | max = 2300; |
1796 | type = 1; | 1783 | } else { |
1784 | min = 1100; | ||
1785 | max = 2100; | ||
1786 | } | ||
1797 | 1787 | ||
1798 | /* Populate Stretch amount */ | 1788 | ro = efuse * (max -min)/255 + min; |
1799 | data->smc_state_table.ClockStretcherAmount = stretch_amount; | ||
1800 | 1789 | ||
1801 | /* Populate Sclk_CKS_masterEn0_7 and Sclk_voltageOffset */ | 1790 | /* Populate Sclk_CKS_masterEn0_7 and Sclk_voltageOffset */ |
1802 | for (i = 0; i < sclk_table->count; i++) { | 1791 | for (i = 0; i < sclk_table->count; i++) { |
1803 | data->smc_state_table.Sclk_CKS_masterEn0_7 |= | 1792 | data->smc_state_table.Sclk_CKS_masterEn0_7 |= |
1804 | sclk_table->entries[i].cks_enable << i; | 1793 | sclk_table->entries[i].cks_enable << i; |
1805 | volt_without_cks = (uint32_t)((14041 * | 1794 | |
1806 | (sclk_table->entries[i].clk/100) / 10000 + 3571 + 75 - ro) * 1000 / | 1795 | volt_without_cks = (uint32_t)(((ro - 40) * 1000 - 2753594 - sclk_table->entries[i].clk/100 * 136418 /1000) / \ |
1807 | (4026 - (13924 * (sclk_table->entries[i].clk/100) / 10000))); | 1796 | (sclk_table->entries[i].clk/100 * 1132925 /10000 - 242418)/100); |
1808 | volt_with_cks = (uint32_t)((13946 * | 1797 | |
1809 | (sclk_table->entries[i].clk/100) / 10000 + 3320 + 45 - ro) * 1000 / | 1798 | volt_with_cks = (uint32_t)((ro * 1000 -2396351 - sclk_table->entries[i].clk/100 * 329021/1000) / \ |
1810 | (3664 - (11454 * (sclk_table->entries[i].clk/100) / 10000))); | 1799 | (sclk_table->entries[i].clk/10000 * 649434 /1000 - 18005)/10); |
1800 | |||
1811 | if (volt_without_cks >= volt_with_cks) | 1801 | if (volt_without_cks >= volt_with_cks) |
1812 | volt_offset = (uint8_t)(((volt_without_cks - volt_with_cks + | 1802 | volt_offset = (uint8_t)(((volt_without_cks - volt_with_cks + |
1813 | sclk_table->entries[i].cks_voffset) * 100 / 625) + 1); | 1803 | sclk_table->entries[i].cks_voffset) * 100 / 625) + 1); |
1804 | |||
1814 | data->smc_state_table.Sclk_voltageOffset[i] = volt_offset; | 1805 | data->smc_state_table.Sclk_voltageOffset[i] = volt_offset; |
1815 | } | 1806 | } |
1816 | 1807 | ||
1817 | PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, PWR_CKS_ENABLE, | ||
1818 | STRETCH_ENABLE, 0x0); | ||
1819 | PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, PWR_CKS_ENABLE, | ||
1820 | masterReset, 0x1); | ||
1821 | /* PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, PWR_CKS_ENABLE, staticEnable, 0x1); */ | ||
1822 | PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, PWR_CKS_ENABLE, | ||
1823 | masterReset, 0x0); | ||
1824 | |||
1825 | /* Populate CKS Lookup Table */ | 1808 | /* Populate CKS Lookup Table */ |
1826 | if (stretch_amount == 1 || stretch_amount == 2 || stretch_amount == 5) | 1809 | if (stretch_amount == 1 || stretch_amount == 2 || stretch_amount == 5) |
1827 | stretch_amount2 = 0; | 1810 | stretch_amount2 = 0; |
@@ -1835,69 +1818,6 @@ static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) | |||
1835 | return -EINVAL); | 1818 | return -EINVAL); |
1836 | } | 1819 | } |
1837 | 1820 | ||
1838 | value = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, | ||
1839 | ixPWR_CKS_CNTL); | ||
1840 | value &= 0xFFC2FF87; | ||
1841 | data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].minFreq = | ||
1842 | polaris10_clock_stretcher_lookup_table[stretch_amount2][0]; | ||
1843 | data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].maxFreq = | ||
1844 | polaris10_clock_stretcher_lookup_table[stretch_amount2][1]; | ||
1845 | clock_freq_u16 = (uint16_t)(PP_SMC_TO_HOST_UL(data->smc_state_table. | ||
1846 | GraphicsLevel[data->smc_state_table.GraphicsDpmLevelCount - 1].SclkSetting.SclkFrequency) / 100); | ||
1847 | if (polaris10_clock_stretcher_lookup_table[stretch_amount2][0] < clock_freq_u16 | ||
1848 | && polaris10_clock_stretcher_lookup_table[stretch_amount2][1] > clock_freq_u16) { | ||
1849 | /* Program PWR_CKS_CNTL. CKS_USE_FOR_LOW_FREQ */ | ||
1850 | value |= (polaris10_clock_stretcher_lookup_table[stretch_amount2][3]) << 16; | ||
1851 | /* Program PWR_CKS_CNTL. CKS_LDO_REFSEL */ | ||
1852 | value |= (polaris10_clock_stretcher_lookup_table[stretch_amount2][2]) << 18; | ||
1853 | /* Program PWR_CKS_CNTL. CKS_STRETCH_AMOUNT */ | ||
1854 | value |= (polaris10_clock_stretch_amount_conversion | ||
1855 | [polaris10_clock_stretcher_lookup_table[stretch_amount2][3]] | ||
1856 | [stretch_amount]) << 3; | ||
1857 | } | ||
1858 | CONVERT_FROM_HOST_TO_SMC_US(data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].minFreq); | ||
1859 | CONVERT_FROM_HOST_TO_SMC_US(data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].maxFreq); | ||
1860 | data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].setting = | ||
1861 | polaris10_clock_stretcher_lookup_table[stretch_amount2][2] & 0x7F; | ||
1862 | data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].setting |= | ||
1863 | (polaris10_clock_stretcher_lookup_table[stretch_amount2][3]) << 7; | ||
1864 | |||
1865 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, | ||
1866 | ixPWR_CKS_CNTL, value); | ||
1867 | |||
1868 | /* Populate DDT Lookup Table */ | ||
1869 | for (i = 0; i < 4; i++) { | ||
1870 | /* Assign the minimum and maximum VID stored | ||
1871 | * in the last row of Clock Stretcher Voltage Table. | ||
1872 | */ | ||
1873 | data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].minVID = | ||
1874 | (uint8_t) polaris10_clock_stretcher_ddt_table[type][i][2]; | ||
1875 | data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].maxVID = | ||
1876 | (uint8_t) polaris10_clock_stretcher_ddt_table[type][i][3]; | ||
1877 | /* Loop through each SCLK and check the frequency | ||
1878 | * to see if it lies within the frequency for clock stretcher. | ||
1879 | */ | ||
1880 | for (j = 0; j < data->smc_state_table.GraphicsDpmLevelCount; j++) { | ||
1881 | cks_setting = 0; | ||
1882 | clock_freq = PP_SMC_TO_HOST_UL( | ||
1883 | data->smc_state_table.GraphicsLevel[j].SclkSetting.SclkFrequency); | ||
1884 | /* Check the allowed frequency against the sclk level[j]. | ||
1885 | * Sclk's endianness has already been converted, | ||
1886 | * and it's in 10Khz unit, | ||
1887 | * as opposed to Data table, which is in Mhz unit. | ||
1888 | */ | ||
1889 | if (clock_freq >= (polaris10_clock_stretcher_ddt_table[type][i][0]) * 100) { | ||
1890 | cks_setting |= 0x2; | ||
1891 | if (clock_freq < (polaris10_clock_stretcher_ddt_table[type][i][1]) * 100) | ||
1892 | cks_setting |= 0x1; | ||
1893 | } | ||
1894 | data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].setting | ||
1895 | |= cks_setting << (j * 2); | ||
1896 | } | ||
1897 | CONVERT_FROM_HOST_TO_SMC_US( | ||
1898 | data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].setting); | ||
1899 | } | ||
1900 | |||
1901 | value = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixPWR_CKS_CNTL); | 1821 | value = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixPWR_CKS_CNTL); |
1902 | value &= 0xFFFFFFFE; | 1822 | value &= 0xFFFFFFFE; |
1903 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixPWR_CKS_CNTL, value); | 1823 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixPWR_CKS_CNTL, value); |
@@ -1956,6 +1876,90 @@ static int polaris10_populate_vr_config(struct pp_hwmgr *hwmgr, | |||
1956 | return 0; | 1876 | return 0; |
1957 | } | 1877 | } |
1958 | 1878 | ||
1879 | |||
1880 | int polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr) | ||
1881 | { | ||
1882 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | ||
1883 | SMU74_Discrete_DpmTable *table = &(data->smc_state_table); | ||
1884 | int result = 0; | ||
1885 | struct pp_atom_ctrl__avfs_parameters avfs_params = {0}; | ||
1886 | AVFS_meanNsigma_t AVFS_meanNsigma = { {0} }; | ||
1887 | AVFS_Sclk_Offset_t AVFS_SclkOffset = { {0} }; | ||
1888 | uint32_t tmp, i; | ||
1889 | struct pp_smumgr *smumgr = hwmgr->smumgr; | ||
1890 | struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); | ||
1891 | |||
1892 | struct phm_ppt_v1_information *table_info = | ||
1893 | (struct phm_ppt_v1_information *)hwmgr->pptable; | ||
1894 | struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = | ||
1895 | table_info->vdd_dep_on_sclk; | ||
1896 | |||
1897 | |||
1898 | if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED) | ||
1899 | return result; | ||
1900 | |||
1901 | result = atomctrl_get_avfs_information(hwmgr, &avfs_params); | ||
1902 | |||
1903 | if (0 == result) { | ||
1904 | table->BTCGB_VDROOP_TABLE[0].a0 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a0); | ||
1905 | table->BTCGB_VDROOP_TABLE[0].a1 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a1); | ||
1906 | table->BTCGB_VDROOP_TABLE[0].a2 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a2); | ||
1907 | table->BTCGB_VDROOP_TABLE[1].a0 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0); | ||
1908 | table->BTCGB_VDROOP_TABLE[1].a1 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1); | ||
1909 | table->BTCGB_VDROOP_TABLE[1].a2 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2); | ||
1910 | table->AVFSGB_VDROOP_TABLE[0].m1 = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSON_m1); | ||
1911 | table->AVFSGB_VDROOP_TABLE[0].m2 = PP_HOST_TO_SMC_US(avfs_params.usAVFSGB_FUSE_TABLE_CKSON_m2); | ||
1912 | table->AVFSGB_VDROOP_TABLE[0].b = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSON_b); | ||
1913 | table->AVFSGB_VDROOP_TABLE[0].m1_shift = 24; | ||
1914 | table->AVFSGB_VDROOP_TABLE[0].m2_shift = 12; | ||
1915 | table->AVFSGB_VDROOP_TABLE[1].m1 = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1); | ||
1916 | table->AVFSGB_VDROOP_TABLE[1].m2 = PP_HOST_TO_SMC_US(avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2); | ||
1917 | table->AVFSGB_VDROOP_TABLE[1].b = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b); | ||
1918 | table->AVFSGB_VDROOP_TABLE[1].m1_shift = 24; | ||
1919 | table->AVFSGB_VDROOP_TABLE[1].m2_shift = 12; | ||
1920 | table->MaxVoltage = PP_HOST_TO_SMC_US(avfs_params.usMaxVoltage_0_25mv); | ||
1921 | AVFS_meanNsigma.Aconstant[0] = PP_HOST_TO_SMC_UL(avfs_params.ulAVFS_meanNsigma_Acontant0); | ||
1922 | AVFS_meanNsigma.Aconstant[1] = PP_HOST_TO_SMC_UL(avfs_params.ulAVFS_meanNsigma_Acontant1); | ||
1923 | AVFS_meanNsigma.Aconstant[2] = PP_HOST_TO_SMC_UL(avfs_params.ulAVFS_meanNsigma_Acontant2); | ||
1924 | AVFS_meanNsigma.DC_tol_sigma = PP_HOST_TO_SMC_US(avfs_params.usAVFS_meanNsigma_DC_tol_sigma); | ||
1925 | AVFS_meanNsigma.Platform_mean = PP_HOST_TO_SMC_US(avfs_params.usAVFS_meanNsigma_Platform_mean); | ||
1926 | AVFS_meanNsigma.PSM_Age_CompFactor = PP_HOST_TO_SMC_US(avfs_params.usPSM_Age_ComFactor); | ||
1927 | AVFS_meanNsigma.Platform_sigma = PP_HOST_TO_SMC_US(avfs_params.usAVFS_meanNsigma_Platform_sigma); | ||
1928 | |||
1929 | for (i = 0; i < NUM_VFT_COLUMNS; i++) { | ||
1930 | AVFS_meanNsigma.Static_Voltage_Offset[i] = (uint8_t)(sclk_table->entries[i].cks_voffset * 100 / 625); | ||
1931 | AVFS_SclkOffset.Sclk_Offset[i] = PP_HOST_TO_SMC_US((uint16_t)(sclk_table->entries[i].sclk_offset) / 100); | ||
1932 | } | ||
1933 | |||
1934 | result = polaris10_read_smc_sram_dword(smumgr, | ||
1935 | SMU7_FIRMWARE_HEADER_LOCATION + offsetof(SMU74_Firmware_Header, AvfsMeanNSigma), | ||
1936 | &tmp, data->sram_end); | ||
1937 | |||
1938 | polaris10_copy_bytes_to_smc(smumgr, | ||
1939 | tmp, | ||
1940 | (uint8_t *)&AVFS_meanNsigma, | ||
1941 | sizeof(AVFS_meanNsigma_t), | ||
1942 | data->sram_end); | ||
1943 | |||
1944 | result = polaris10_read_smc_sram_dword(smumgr, | ||
1945 | SMU7_FIRMWARE_HEADER_LOCATION + offsetof(SMU74_Firmware_Header, AvfsSclkOffsetTable), | ||
1946 | &tmp, data->sram_end); | ||
1947 | polaris10_copy_bytes_to_smc(smumgr, | ||
1948 | tmp, | ||
1949 | (uint8_t *)&AVFS_SclkOffset, | ||
1950 | sizeof(AVFS_Sclk_Offset_t), | ||
1951 | data->sram_end); | ||
1952 | |||
1953 | data->avfs_vdroop_override_setting = (avfs_params.ucEnableGB_VDROOP_TABLE_CKSON << BTCGB0_Vdroop_Enable_SHIFT) | | ||
1954 | (avfs_params.ucEnableGB_VDROOP_TABLE_CKSOFF << BTCGB1_Vdroop_Enable_SHIFT) | | ||
1955 | (avfs_params.ucEnableGB_FUSE_TABLE_CKSON << AVFSGB0_Vdroop_Enable_SHIFT) | | ||
1956 | (avfs_params.ucEnableGB_FUSE_TABLE_CKSOFF << AVFSGB1_Vdroop_Enable_SHIFT); | ||
1957 | data->apply_avfs_cks_off_voltage = (avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage == 1) ? true : false; | ||
1958 | } | ||
1959 | return result; | ||
1960 | } | ||
1961 | |||
1962 | |||
1959 | /** | 1963 | /** |
1960 | * Initializes the SMC table and uploads it | 1964 | * Initializes the SMC table and uploads it |
1961 | * | 1965 | * |
@@ -2056,6 +2060,10 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr) | |||
2056 | "Failed to populate Clock Stretcher Data Table!", | 2060 | "Failed to populate Clock Stretcher Data Table!", |
2057 | return result); | 2061 | return result); |
2058 | } | 2062 | } |
2063 | |||
2064 | result = polaris10_populate_avfs_parameters(hwmgr); | ||
2065 | PP_ASSERT_WITH_CODE(0 == result, "Failed to populate AVFS Parameters!", return result;); | ||
2066 | |||
2059 | table->CurrSclkPllRange = 0xff; | 2067 | table->CurrSclkPllRange = 0xff; |
2060 | table->GraphicsVoltageChangeEnable = 1; | 2068 | table->GraphicsVoltageChangeEnable = 1; |
2061 | table->GraphicsThermThrottleEnable = 1; | 2069 | table->GraphicsThermThrottleEnable = 1; |
@@ -2252,6 +2260,9 @@ static int polaris10_enable_deep_sleep_master_switch(struct pp_hwmgr *hwmgr) | |||
2252 | static int polaris10_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) | 2260 | static int polaris10_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) |
2253 | { | 2261 | { |
2254 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | 2262 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); |
2263 | uint32_t soft_register_value = 0; | ||
2264 | uint32_t handshake_disables_offset = data->soft_regs_start | ||
2265 | + offsetof(SMU74_SoftRegisters, HandshakeDisables); | ||
2255 | 2266 | ||
2256 | /* enable SCLK dpm */ | 2267 | /* enable SCLK dpm */ |
2257 | if (!data->sclk_dpm_key_disabled) | 2268 | if (!data->sclk_dpm_key_disabled) |
@@ -2262,6 +2273,12 @@ static int polaris10_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) | |||
2262 | 2273 | ||
2263 | /* enable MCLK dpm */ | 2274 | /* enable MCLK dpm */ |
2264 | if (0 == data->mclk_dpm_key_disabled) { | 2275 | if (0 == data->mclk_dpm_key_disabled) { |
2276 | /* Disable UVD - SMU handshake for MCLK. */ | ||
2277 | soft_register_value = cgs_read_ind_register(hwmgr->device, | ||
2278 | CGS_IND_REG__SMC, handshake_disables_offset); | ||
2279 | soft_register_value |= SMU7_UVD_MCLK_HANDSHAKE_DISABLE; | ||
2280 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, | ||
2281 | handshake_disables_offset, soft_register_value); | ||
2265 | 2282 | ||
2266 | PP_ASSERT_WITH_CODE( | 2283 | PP_ASSERT_WITH_CODE( |
2267 | (0 == smum_send_msg_to_smc(hwmgr->smumgr, | 2284 | (0 == smum_send_msg_to_smc(hwmgr->smumgr, |
@@ -2269,7 +2286,6 @@ static int polaris10_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) | |||
2269 | "Failed to enable MCLK DPM during DPM Start Function!", | 2286 | "Failed to enable MCLK DPM during DPM Start Function!", |
2270 | return -1); | 2287 | return -1); |
2271 | 2288 | ||
2272 | |||
2273 | PHM_WRITE_FIELD(hwmgr->device, MC_SEQ_CNTL_3, CAC_EN, 0x1); | 2289 | PHM_WRITE_FIELD(hwmgr->device, MC_SEQ_CNTL_3, CAC_EN, 0x1); |
2274 | 2290 | ||
2275 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixLCAC_MC0_CNTL, 0x5); | 2291 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixLCAC_MC0_CNTL, 0x5); |
@@ -2606,6 +2622,7 @@ int polaris10_set_features_platform_caps(struct pp_hwmgr *hwmgr) | |||
2606 | 2622 | ||
2607 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 2623 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
2608 | PHM_PlatformCaps_FanSpeedInTableIsRPM); | 2624 | PHM_PlatformCaps_FanSpeedInTableIsRPM); |
2625 | |||
2609 | if (hwmgr->chip_id == CHIP_POLARIS11) | 2626 | if (hwmgr->chip_id == CHIP_POLARIS11) |
2610 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 2627 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
2611 | PHM_PlatformCaps_SPLLShutdownSupport); | 2628 | PHM_PlatformCaps_SPLLShutdownSupport); |
@@ -2938,6 +2955,11 @@ int polaris10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
2938 | data->vddci_control = POLARIS10_VOLTAGE_CONTROL_NONE; | 2955 | data->vddci_control = POLARIS10_VOLTAGE_CONTROL_NONE; |
2939 | data->mvdd_control = POLARIS10_VOLTAGE_CONTROL_NONE; | 2956 | data->mvdd_control = POLARIS10_VOLTAGE_CONTROL_NONE; |
2940 | 2957 | ||
2958 | data->enable_tdc_limit_feature = true; | ||
2959 | data->enable_pkg_pwr_tracking_feature = true; | ||
2960 | data->force_pcie_gen = PP_PCIEGenInvalid; | ||
2961 | data->mclk_stutter_mode_threshold = 40000; | ||
2962 | |||
2941 | if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, | 2963 | if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, |
2942 | VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) | 2964 | VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) |
2943 | data->voltage_control = POLARIS10_VOLTAGE_CONTROL_BY_SVID2; | 2965 | data->voltage_control = POLARIS10_VOLTAGE_CONTROL_BY_SVID2; |
@@ -2962,6 +2984,10 @@ int polaris10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
2962 | data->vddci_control = POLARIS10_VOLTAGE_CONTROL_BY_SVID2; | 2984 | data->vddci_control = POLARIS10_VOLTAGE_CONTROL_BY_SVID2; |
2963 | } | 2985 | } |
2964 | 2986 | ||
2987 | if (table_info->cac_dtp_table->usClockStretchAmount != 0) | ||
2988 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | ||
2989 | PHM_PlatformCaps_ClockStretcher); | ||
2990 | |||
2965 | polaris10_set_features_platform_caps(hwmgr); | 2991 | polaris10_set_features_platform_caps(hwmgr); |
2966 | 2992 | ||
2967 | polaris10_init_dpm_defaults(hwmgr); | 2993 | polaris10_init_dpm_defaults(hwmgr); |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h index beedf35cbfa6..d717789441f5 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h | |||
@@ -312,6 +312,9 @@ struct polaris10_hwmgr { | |||
312 | 312 | ||
313 | /* soft pptable for re-uploading into smu */ | 313 | /* soft pptable for re-uploading into smu */ |
314 | void *soft_pp_table; | 314 | void *soft_pp_table; |
315 | |||
316 | uint32_t avfs_vdroop_override_setting; | ||
317 | bool apply_avfs_cks_off_voltage; | ||
315 | }; | 318 | }; |
316 | 319 | ||
317 | /* To convert to Q8.8 format for firmware */ | 320 | /* To convert to Q8.8 format for firmware */ |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c index aba167f7d167..b206632d4650 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c | |||
@@ -625,10 +625,14 @@ static int tf_polaris10_thermal_avfs_enable(struct pp_hwmgr *hwmgr, | |||
625 | int ret; | 625 | int ret; |
626 | struct pp_smumgr *smumgr = (struct pp_smumgr *)(hwmgr->smumgr); | 626 | struct pp_smumgr *smumgr = (struct pp_smumgr *)(hwmgr->smumgr); |
627 | struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); | 627 | struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); |
628 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | ||
628 | 629 | ||
629 | if (smu_data->avfs.avfs_btc_status != AVFS_BTC_ENABLEAVFS) | 630 | if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED) |
630 | return 0; | 631 | return 0; |
631 | 632 | ||
633 | ret = smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, | ||
634 | PPSMC_MSG_SetGBDroopSettings, data->avfs_vdroop_override_setting); | ||
635 | |||
632 | ret = (smum_send_msg_to_smc(smumgr, PPSMC_MSG_EnableAvfs) == 0) ? | 636 | ret = (smum_send_msg_to_smc(smumgr, PPSMC_MSG_EnableAvfs) == 0) ? |
633 | 0 : -1; | 637 | 0 : -1; |
634 | 638 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c index 58742e0d1492..a3c38bbd1e94 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c | |||
@@ -44,6 +44,20 @@ bool acpi_atcs_functions_supported(void *device, uint32_t index) | |||
44 | return result == 0 ? (output_buf.function_bits & (1 << (index - 1))) != 0 : false; | 44 | return result == 0 ? (output_buf.function_bits & (1 << (index - 1))) != 0 : false; |
45 | } | 45 | } |
46 | 46 | ||
47 | bool acpi_atcs_notify_pcie_device_ready(void *device) | ||
48 | { | ||
49 | int32_t temp_buffer = 1; | ||
50 | |||
51 | return cgs_call_acpi_method(device, CGS_ACPI_METHOD_ATCS, | ||
52 | ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION, | ||
53 | &temp_buffer, | ||
54 | NULL, | ||
55 | 0, | ||
56 | sizeof(temp_buffer), | ||
57 | 0); | ||
58 | } | ||
59 | |||
60 | |||
47 | int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool advertise) | 61 | int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool advertise) |
48 | { | 62 | { |
49 | struct atcs_pref_req_input atcs_input; | 63 | struct atcs_pref_req_input atcs_input; |
@@ -52,7 +66,7 @@ int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool advertise) | |||
52 | int result; | 66 | int result; |
53 | struct cgs_system_info info = {0}; | 67 | struct cgs_system_info info = {0}; |
54 | 68 | ||
55 | if (!acpi_atcs_functions_supported(device, ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST)) | 69 | if( 0 != acpi_atcs_notify_pcie_device_ready(device)) |
56 | return -EINVAL; | 70 | return -EINVAL; |
57 | 71 | ||
58 | info.size = sizeof(struct cgs_system_info); | 72 | info.size = sizeof(struct cgs_system_info); |
@@ -77,7 +91,7 @@ int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool advertise) | |||
77 | ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST, | 91 | ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST, |
78 | &atcs_input, | 92 | &atcs_input, |
79 | &atcs_output, | 93 | &atcs_output, |
80 | 0, | 94 | 1, |
81 | sizeof(atcs_input), | 95 | sizeof(atcs_input), |
82 | sizeof(atcs_output)); | 96 | sizeof(atcs_output)); |
83 | if (result != 0) | 97 | if (result != 0) |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c index da9f5f1b6dc2..bf4e18fd3872 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c | |||
@@ -1302,3 +1302,46 @@ int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_atom_ctr | |||
1302 | 1302 | ||
1303 | return 0; | 1303 | return 0; |
1304 | } | 1304 | } |
1305 | |||
1306 | int atomctrl_get_avfs_information(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl__avfs_parameters *param) | ||
1307 | { | ||
1308 | ATOM_ASIC_PROFILING_INFO_V3_6 *profile = NULL; | ||
1309 | |||
1310 | if (param == NULL) | ||
1311 | return -EINVAL; | ||
1312 | |||
1313 | profile = (ATOM_ASIC_PROFILING_INFO_V3_6 *) | ||
1314 | cgs_atom_get_data_table(hwmgr->device, | ||
1315 | GetIndexIntoMasterTable(DATA, ASIC_ProfilingInfo), | ||
1316 | NULL, NULL, NULL); | ||
1317 | if (!profile) | ||
1318 | return -1; | ||
1319 | |||
1320 | param->ulAVFS_meanNsigma_Acontant0 = profile->ulAVFS_meanNsigma_Acontant0; | ||
1321 | param->ulAVFS_meanNsigma_Acontant1 = profile->ulAVFS_meanNsigma_Acontant1; | ||
1322 | param->ulAVFS_meanNsigma_Acontant2 = profile->ulAVFS_meanNsigma_Acontant2; | ||
1323 | param->usAVFS_meanNsigma_DC_tol_sigma = profile->usAVFS_meanNsigma_DC_tol_sigma; | ||
1324 | param->usAVFS_meanNsigma_Platform_mean = profile->usAVFS_meanNsigma_Platform_mean; | ||
1325 | param->usAVFS_meanNsigma_Platform_sigma = profile->usAVFS_meanNsigma_Platform_sigma; | ||
1326 | param->ulGB_VDROOP_TABLE_CKSOFF_a0 = profile->ulGB_VDROOP_TABLE_CKSOFF_a0; | ||
1327 | param->ulGB_VDROOP_TABLE_CKSOFF_a1 = profile->ulGB_VDROOP_TABLE_CKSOFF_a1; | ||
1328 | param->ulGB_VDROOP_TABLE_CKSOFF_a2 = profile->ulGB_VDROOP_TABLE_CKSOFF_a2; | ||
1329 | param->ulGB_VDROOP_TABLE_CKSON_a0 = profile->ulGB_VDROOP_TABLE_CKSON_a0; | ||
1330 | param->ulGB_VDROOP_TABLE_CKSON_a1 = profile->ulGB_VDROOP_TABLE_CKSON_a1; | ||
1331 | param->ulGB_VDROOP_TABLE_CKSON_a2 = profile->ulGB_VDROOP_TABLE_CKSON_a2; | ||
1332 | param->ulAVFSGB_FUSE_TABLE_CKSOFF_m1 = profile->ulAVFSGB_FUSE_TABLE_CKSOFF_m1; | ||
1333 | param->usAVFSGB_FUSE_TABLE_CKSOFF_m2 = profile->usAVFSGB_FUSE_TABLE_CKSOFF_m2; | ||
1334 | param->ulAVFSGB_FUSE_TABLE_CKSOFF_b = profile->ulAVFSGB_FUSE_TABLE_CKSOFF_b; | ||
1335 | param->ulAVFSGB_FUSE_TABLE_CKSON_m1 = profile->ulAVFSGB_FUSE_TABLE_CKSON_m1; | ||
1336 | param->usAVFSGB_FUSE_TABLE_CKSON_m2 = profile->usAVFSGB_FUSE_TABLE_CKSON_m2; | ||
1337 | param->ulAVFSGB_FUSE_TABLE_CKSON_b = profile->ulAVFSGB_FUSE_TABLE_CKSON_b; | ||
1338 | param->usMaxVoltage_0_25mv = profile->usMaxVoltage_0_25mv; | ||
1339 | param->ucEnableGB_VDROOP_TABLE_CKSOFF = profile->ucEnableGB_VDROOP_TABLE_CKSOFF; | ||
1340 | param->ucEnableGB_VDROOP_TABLE_CKSON = profile->ucEnableGB_VDROOP_TABLE_CKSON; | ||
1341 | param->ucEnableGB_FUSE_TABLE_CKSOFF = profile->ucEnableGB_FUSE_TABLE_CKSOFF; | ||
1342 | param->ucEnableGB_FUSE_TABLE_CKSON = profile->ucEnableGB_FUSE_TABLE_CKSON; | ||
1343 | param->usPSM_Age_ComFactor = profile->usPSM_Age_ComFactor; | ||
1344 | param->ucEnableApplyAVFS_CKS_OFF_Voltage = profile->ucEnableApplyAVFS_CKS_OFF_Voltage; | ||
1345 | |||
1346 | return 0; | ||
1347 | } | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h index d24ebb566905..248c5db5f380 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h | |||
@@ -250,6 +250,35 @@ struct pp_atomctrl_gpio_pin_assignment { | |||
250 | }; | 250 | }; |
251 | typedef struct pp_atomctrl_gpio_pin_assignment pp_atomctrl_gpio_pin_assignment; | 251 | typedef struct pp_atomctrl_gpio_pin_assignment pp_atomctrl_gpio_pin_assignment; |
252 | 252 | ||
253 | struct pp_atom_ctrl__avfs_parameters { | ||
254 | uint32_t ulAVFS_meanNsigma_Acontant0; | ||
255 | uint32_t ulAVFS_meanNsigma_Acontant1; | ||
256 | uint32_t ulAVFS_meanNsigma_Acontant2; | ||
257 | uint16_t usAVFS_meanNsigma_DC_tol_sigma; | ||
258 | uint16_t usAVFS_meanNsigma_Platform_mean; | ||
259 | uint16_t usAVFS_meanNsigma_Platform_sigma; | ||
260 | uint32_t ulGB_VDROOP_TABLE_CKSOFF_a0; | ||
261 | uint32_t ulGB_VDROOP_TABLE_CKSOFF_a1; | ||
262 | uint32_t ulGB_VDROOP_TABLE_CKSOFF_a2; | ||
263 | uint32_t ulGB_VDROOP_TABLE_CKSON_a0; | ||
264 | uint32_t ulGB_VDROOP_TABLE_CKSON_a1; | ||
265 | uint32_t ulGB_VDROOP_TABLE_CKSON_a2; | ||
266 | uint32_t ulAVFSGB_FUSE_TABLE_CKSOFF_m1; | ||
267 | uint16_t usAVFSGB_FUSE_TABLE_CKSOFF_m2; | ||
268 | uint32_t ulAVFSGB_FUSE_TABLE_CKSOFF_b; | ||
269 | uint32_t ulAVFSGB_FUSE_TABLE_CKSON_m1; | ||
270 | uint16_t usAVFSGB_FUSE_TABLE_CKSON_m2; | ||
271 | uint32_t ulAVFSGB_FUSE_TABLE_CKSON_b; | ||
272 | uint16_t usMaxVoltage_0_25mv; | ||
273 | uint8_t ucEnableGB_VDROOP_TABLE_CKSOFF; | ||
274 | uint8_t ucEnableGB_VDROOP_TABLE_CKSON; | ||
275 | uint8_t ucEnableGB_FUSE_TABLE_CKSOFF; | ||
276 | uint8_t ucEnableGB_FUSE_TABLE_CKSON; | ||
277 | uint16_t usPSM_Age_ComFactor; | ||
278 | uint8_t ucEnableApplyAVFS_CKS_OFF_Voltage; | ||
279 | uint8_t ucReserved; | ||
280 | }; | ||
281 | |||
253 | extern bool atomctrl_get_pp_assign_pin(struct pp_hwmgr *hwmgr, const uint32_t pinId, pp_atomctrl_gpio_pin_assignment *gpio_pin_assignment); | 282 | extern bool atomctrl_get_pp_assign_pin(struct pp_hwmgr *hwmgr, const uint32_t pinId, pp_atomctrl_gpio_pin_assignment *gpio_pin_assignment); |
254 | extern int atomctrl_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type, uint32_t sclk, uint16_t virtual_voltage_Id, uint16_t *voltage); | 283 | extern int atomctrl_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type, uint32_t sclk, uint16_t virtual_voltage_Id, uint16_t *voltage); |
255 | extern uint32_t atomctrl_get_mpll_reference_clock(struct pp_hwmgr *hwmgr); | 284 | extern uint32_t atomctrl_get_mpll_reference_clock(struct pp_hwmgr *hwmgr); |
@@ -278,5 +307,8 @@ extern int atomctrl_set_ac_timing_ai(struct pp_hwmgr *hwmgr, uint32_t memory_clo | |||
278 | extern int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_type, | 307 | extern int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_type, |
279 | uint32_t sclk, uint16_t virtual_voltage_Id, uint16_t *voltage); | 308 | uint32_t sclk, uint16_t virtual_voltage_Id, uint16_t *voltage); |
280 | extern int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl_sclk_range_table *table); | 309 | extern int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl_sclk_range_table *table); |
310 | |||
311 | extern int atomctrl_get_avfs_information(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl__avfs_parameters *param); | ||
312 | |||
281 | #endif | 313 | #endif |
282 | 314 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index d27e8c40602a..233eb7f36c1d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | |||
@@ -4489,6 +4489,7 @@ int tonga_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
4489 | data->vdd_ci_control = TONGA_VOLTAGE_CONTROL_NONE; | 4489 | data->vdd_ci_control = TONGA_VOLTAGE_CONTROL_NONE; |
4490 | data->vdd_gfx_control = TONGA_VOLTAGE_CONTROL_NONE; | 4490 | data->vdd_gfx_control = TONGA_VOLTAGE_CONTROL_NONE; |
4491 | data->mvdd_control = TONGA_VOLTAGE_CONTROL_NONE; | 4491 | data->mvdd_control = TONGA_VOLTAGE_CONTROL_NONE; |
4492 | data->force_pcie_gen = PP_PCIEGenInvalid; | ||
4492 | 4493 | ||
4493 | if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, | 4494 | if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, |
4494 | VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) { | 4495 | VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) { |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/polaris10_ppsmc.h b/drivers/gpu/drm/amd/powerplay/inc/polaris10_ppsmc.h index 0c6a413eaa5b..d41d37ab5b7c 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/polaris10_ppsmc.h +++ b/drivers/gpu/drm/amd/powerplay/inc/polaris10_ppsmc.h | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #pragma pack(push, 1) | 28 | #pragma pack(push, 1) |
29 | 29 | ||
30 | #define PPSMC_MSG_SetGBDroopSettings ((uint16_t) 0x305) | ||
30 | 31 | ||
31 | #define PPSMC_SWSTATE_FLAG_DC 0x01 | 32 | #define PPSMC_SWSTATE_FLAG_DC 0x01 |
32 | #define PPSMC_SWSTATE_FLAG_UVD 0x02 | 33 | #define PPSMC_SWSTATE_FLAG_UVD 0x02 |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h index 3bd5e69b9045..3df5de2cdab0 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h +++ b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h | |||
@@ -26,3 +26,4 @@ extern bool acpi_atcs_functions_supported(void *device, | |||
26 | extern int acpi_pcie_perf_request(void *device, | 26 | extern int acpi_pcie_perf_request(void *device, |
27 | uint8_t perf_req, | 27 | uint8_t perf_req, |
28 | bool advertise); | 28 | bool advertise); |
29 | extern bool acpi_atcs_notify_pcie_device_ready(void *device); | ||
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu74.h b/drivers/gpu/drm/amd/powerplay/inc/smu74.h index 1a12d85b8e97..fd10a9fa843d 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/smu74.h +++ b/drivers/gpu/drm/amd/powerplay/inc/smu74.h | |||
@@ -34,6 +34,30 @@ | |||
34 | #define SMU__NUM_LCLK_DPM_LEVELS 8 | 34 | #define SMU__NUM_LCLK_DPM_LEVELS 8 |
35 | #define SMU__NUM_PCIE_DPM_LEVELS 8 | 35 | #define SMU__NUM_PCIE_DPM_LEVELS 8 |
36 | 36 | ||
37 | #define EXP_M1 35 | ||
38 | #define EXP_M2 92821 | ||
39 | #define EXP_B 66629747 | ||
40 | |||
41 | #define EXP_M1_1 365 | ||
42 | #define EXP_M2_1 658700 | ||
43 | #define EXP_B_1 305506134 | ||
44 | |||
45 | #define EXP_M1_2 189 | ||
46 | #define EXP_M2_2 379692 | ||
47 | #define EXP_B_2 194609469 | ||
48 | |||
49 | #define EXP_M1_3 99 | ||
50 | #define EXP_M2_3 217915 | ||
51 | #define EXP_B_3 122255994 | ||
52 | |||
53 | #define EXP_M1_4 51 | ||
54 | #define EXP_M2_4 122643 | ||
55 | #define EXP_B_4 74893384 | ||
56 | |||
57 | #define EXP_M1_5 423 | ||
58 | #define EXP_M2_5 1103326 | ||
59 | #define EXP_B_5 728122621 | ||
60 | |||
37 | enum SID_OPTION { | 61 | enum SID_OPTION { |
38 | SID_OPTION_HI, | 62 | SID_OPTION_HI, |
39 | SID_OPTION_LO, | 63 | SID_OPTION_LO, |
@@ -548,20 +572,20 @@ struct SMU74_Firmware_Header { | |||
548 | uint32_t CacConfigTable; | 572 | uint32_t CacConfigTable; |
549 | uint32_t CacStatusTable; | 573 | uint32_t CacStatusTable; |
550 | 574 | ||
551 | |||
552 | uint32_t mcRegisterTable; | 575 | uint32_t mcRegisterTable; |
553 | 576 | ||
554 | |||
555 | uint32_t mcArbDramTimingTable; | 577 | uint32_t mcArbDramTimingTable; |
556 | 578 | ||
557 | |||
558 | |||
559 | |||
560 | uint32_t PmFuseTable; | 579 | uint32_t PmFuseTable; |
561 | uint32_t Globals; | 580 | uint32_t Globals; |
562 | uint32_t ClockStretcherTable; | 581 | uint32_t ClockStretcherTable; |
563 | uint32_t VftTable; | 582 | uint32_t VftTable; |
564 | uint32_t Reserved[21]; | 583 | uint32_t Reserved1; |
584 | uint32_t AvfsTable; | ||
585 | uint32_t AvfsCksOffGbvTable; | ||
586 | uint32_t AvfsMeanNSigma; | ||
587 | uint32_t AvfsSclkOffsetTable; | ||
588 | uint32_t Reserved[16]; | ||
565 | uint32_t Signature; | 589 | uint32_t Signature; |
566 | }; | 590 | }; |
567 | 591 | ||
@@ -701,8 +725,6 @@ VR Config info is contained in dpmTable.VRConfig */ | |||
701 | struct SMU_ClockStretcherDataTableEntry { | 725 | struct SMU_ClockStretcherDataTableEntry { |
702 | uint8_t minVID; | 726 | uint8_t minVID; |
703 | uint8_t maxVID; | 727 | uint8_t maxVID; |
704 | |||
705 | |||
706 | uint16_t setting; | 728 | uint16_t setting; |
707 | }; | 729 | }; |
708 | typedef struct SMU_ClockStretcherDataTableEntry SMU_ClockStretcherDataTableEntry; | 730 | typedef struct SMU_ClockStretcherDataTableEntry SMU_ClockStretcherDataTableEntry; |
@@ -769,6 +791,43 @@ struct VFT_TABLE_t { | |||
769 | typedef struct VFT_TABLE_t VFT_TABLE_t; | 791 | typedef struct VFT_TABLE_t VFT_TABLE_t; |
770 | 792 | ||
771 | 793 | ||
794 | /* Total margin, root mean square of Fmax + DC + Platform */ | ||
795 | struct AVFS_Margin_t { | ||
796 | VFT_CELL_t Cell[NUM_VFT_COLUMNS]; | ||
797 | }; | ||
798 | typedef struct AVFS_Margin_t AVFS_Margin_t; | ||
799 | |||
800 | #define BTCGB_VDROOP_TABLE_MAX_ENTRIES 2 | ||
801 | #define AVFSGB_VDROOP_TABLE_MAX_ENTRIES 2 | ||
802 | |||
803 | struct GB_VDROOP_TABLE_t { | ||
804 | int32_t a0; | ||
805 | int32_t a1; | ||
806 | int32_t a2; | ||
807 | uint32_t spare; | ||
808 | }; | ||
809 | typedef struct GB_VDROOP_TABLE_t GB_VDROOP_TABLE_t; | ||
810 | |||
811 | struct AVFS_CksOff_Gbv_t { | ||
812 | VFT_CELL_t Cell[NUM_VFT_COLUMNS]; | ||
813 | }; | ||
814 | typedef struct AVFS_CksOff_Gbv_t AVFS_CksOff_Gbv_t; | ||
815 | |||
816 | struct AVFS_meanNsigma_t { | ||
817 | uint32_t Aconstant[3]; | ||
818 | uint16_t DC_tol_sigma; | ||
819 | uint16_t Platform_mean; | ||
820 | uint16_t Platform_sigma; | ||
821 | uint16_t PSM_Age_CompFactor; | ||
822 | uint8_t Static_Voltage_Offset[NUM_VFT_COLUMNS]; | ||
823 | }; | ||
824 | typedef struct AVFS_meanNsigma_t AVFS_meanNsigma_t; | ||
825 | |||
826 | struct AVFS_Sclk_Offset_t { | ||
827 | uint16_t Sclk_Offset[8]; | ||
828 | }; | ||
829 | typedef struct AVFS_Sclk_Offset_t AVFS_Sclk_Offset_t; | ||
830 | |||
772 | #endif | 831 | #endif |
773 | 832 | ||
774 | 833 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h b/drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h index 0dfe82336dc7..b85ff5400e57 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h +++ b/drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h | |||
@@ -223,6 +223,16 @@ struct SMU74_Discrete_StateInfo { | |||
223 | 223 | ||
224 | typedef struct SMU74_Discrete_StateInfo SMU74_Discrete_StateInfo; | 224 | typedef struct SMU74_Discrete_StateInfo SMU74_Discrete_StateInfo; |
225 | 225 | ||
226 | struct SMU_QuadraticCoeffs { | ||
227 | int32_t m1; | ||
228 | uint32_t b; | ||
229 | |||
230 | int16_t m2; | ||
231 | uint8_t m1_shift; | ||
232 | uint8_t m2_shift; | ||
233 | }; | ||
234 | typedef struct SMU_QuadraticCoeffs SMU_QuadraticCoeffs; | ||
235 | |||
226 | struct SMU74_Discrete_DpmTable { | 236 | struct SMU74_Discrete_DpmTable { |
227 | 237 | ||
228 | SMU74_PIDController GraphicsPIDController; | 238 | SMU74_PIDController GraphicsPIDController; |
@@ -258,7 +268,14 @@ struct SMU74_Discrete_DpmTable { | |||
258 | uint8_t ThermOutPolarity; | 268 | uint8_t ThermOutPolarity; |
259 | uint8_t ThermOutMode; | 269 | uint8_t ThermOutMode; |
260 | uint8_t BootPhases; | 270 | uint8_t BootPhases; |
261 | uint32_t Reserved[4]; | 271 | |
272 | uint8_t VRHotLevel; | ||
273 | uint8_t Reserved1[3]; | ||
274 | uint16_t FanStartTemperature; | ||
275 | uint16_t FanStopTemperature; | ||
276 | uint16_t MaxVoltage; | ||
277 | uint16_t Reserved2; | ||
278 | uint32_t Reserved[1]; | ||
262 | 279 | ||
263 | SMU74_Discrete_GraphicsLevel GraphicsLevel[SMU74_MAX_LEVELS_GRAPHICS]; | 280 | SMU74_Discrete_GraphicsLevel GraphicsLevel[SMU74_MAX_LEVELS_GRAPHICS]; |
264 | SMU74_Discrete_MemoryLevel MemoryACPILevel; | 281 | SMU74_Discrete_MemoryLevel MemoryACPILevel; |
@@ -347,6 +364,8 @@ struct SMU74_Discrete_DpmTable { | |||
347 | 364 | ||
348 | uint32_t CurrSclkPllRange; | 365 | uint32_t CurrSclkPllRange; |
349 | sclkFcwRange_t SclkFcwRangeTable[NUM_SCLK_RANGE]; | 366 | sclkFcwRange_t SclkFcwRangeTable[NUM_SCLK_RANGE]; |
367 | GB_VDROOP_TABLE_t BTCGB_VDROOP_TABLE[BTCGB_VDROOP_TABLE_MAX_ENTRIES]; | ||
368 | SMU_QuadraticCoeffs AVFSGB_VDROOP_TABLE[AVFSGB_VDROOP_TABLE_MAX_ENTRIES]; | ||
350 | }; | 369 | }; |
351 | 370 | ||
352 | typedef struct SMU74_Discrete_DpmTable SMU74_Discrete_DpmTable; | 371 | typedef struct SMU74_Discrete_DpmTable SMU74_Discrete_DpmTable; |
@@ -550,16 +569,6 @@ struct SMU7_AcpiScoreboard { | |||
550 | 569 | ||
551 | typedef struct SMU7_AcpiScoreboard SMU7_AcpiScoreboard; | 570 | typedef struct SMU7_AcpiScoreboard SMU7_AcpiScoreboard; |
552 | 571 | ||
553 | struct SMU_QuadraticCoeffs { | ||
554 | int32_t m1; | ||
555 | uint32_t b; | ||
556 | |||
557 | int16_t m2; | ||
558 | uint8_t m1_shift; | ||
559 | uint8_t m2_shift; | ||
560 | }; | ||
561 | typedef struct SMU_QuadraticCoeffs SMU_QuadraticCoeffs; | ||
562 | |||
563 | struct SMU74_Discrete_PmFuses { | 572 | struct SMU74_Discrete_PmFuses { |
564 | uint8_t BapmVddCVidHiSidd[8]; | 573 | uint8_t BapmVddCVidHiSidd[8]; |
565 | uint8_t BapmVddCVidLoSidd[8]; | 574 | uint8_t BapmVddCVidLoSidd[8]; |
@@ -821,6 +830,17 @@ typedef struct SMU7_GfxCuPgScoreboard SMU7_GfxCuPgScoreboard; | |||
821 | #define DB_PCC_SHIFT 26 | 830 | #define DB_PCC_SHIFT 26 |
822 | #define DB_EDC_SHIFT 27 | 831 | #define DB_EDC_SHIFT 27 |
823 | 832 | ||
833 | #define BTCGB0_Vdroop_Enable_MASK 0x1 | ||
834 | #define BTCGB1_Vdroop_Enable_MASK 0x2 | ||
835 | #define AVFSGB0_Vdroop_Enable_MASK 0x4 | ||
836 | #define AVFSGB1_Vdroop_Enable_MASK 0x8 | ||
837 | |||
838 | #define BTCGB0_Vdroop_Enable_SHIFT 0 | ||
839 | #define BTCGB1_Vdroop_Enable_SHIFT 1 | ||
840 | #define AVFSGB0_Vdroop_Enable_SHIFT 2 | ||
841 | #define AVFSGB1_Vdroop_Enable_SHIFT 3 | ||
842 | |||
843 | |||
824 | #pragma pack(pop) | 844 | #pragma pack(pop) |
825 | 845 | ||
826 | 846 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c index 043b6ac09d5f..5dba7c509710 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c | |||
@@ -52,19 +52,18 @@ | |||
52 | static const SMU74_Discrete_GraphicsLevel avfs_graphics_level_polaris10[8] = { | 52 | static const SMU74_Discrete_GraphicsLevel avfs_graphics_level_polaris10[8] = { |
53 | /* Min pcie DeepSleep Activity CgSpll CgSpll CcPwr CcPwr Sclk Enabled Enabled Voltage Power */ | 53 | /* Min pcie DeepSleep Activity CgSpll CgSpll CcPwr CcPwr Sclk Enabled Enabled Voltage Power */ |
54 | /* Voltage, DpmLevel, DivId, Level, FuncCntl3, FuncCntl4, DynRm, DynRm1 Did, Padding,ForActivity, ForThrottle, UpHyst, DownHyst, DownHyst, Throttle */ | 54 | /* Voltage, DpmLevel, DivId, Level, FuncCntl3, FuncCntl4, DynRm, DynRm1 Did, Padding,ForActivity, ForThrottle, UpHyst, DownHyst, DownHyst, Throttle */ |
55 | { 0x3c0fd047, 0x00, 0x03, 0x1e00, 0x00200410, 0x87020000, 0, 0, 0x16, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x30750000, 0, 0, 0, 0, 0, 0, 0 } }, | 55 | { 0x100ea446, 0x00, 0x03, 0x3200, 0, 0, 0, 0, 0, 0, 0x01, 0x01, 0x0a, 0x00, 0x00, 0x00, { 0x30750000, 0x3000, 0, 0x2600, 0, 0, 0x0004, 0x8f02, 0xffff, 0x2f00, 0x300e, 0x2700 } }, |
56 | { 0xa00fd047, 0x01, 0x04, 0x1e00, 0x00800510, 0x87020000, 0, 0, 0x16, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x409c0000, 0, 0, 0, 0, 0, 0, 0 } }, | 56 | { 0x400ea446, 0x01, 0x04, 0x3200, 0, 0, 0, 0, 0, 0, 0x01, 0x01, 0x0a, 0x00, 0x00, 0x00, { 0x409c0000, 0x2000, 0, 0x1e00, 1, 1, 0x0004, 0x8300, 0xffff, 0x1f00, 0xcb5e, 0x1a00 } }, |
57 | { 0x0410d047, 0x01, 0x00, 0x1e00, 0x00600410, 0x87020000, 0, 0, 0x0e, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x50c30000, 0, 0, 0, 0, 0, 0, 0 } }, | 57 | { 0x740ea446, 0x01, 0x00, 0x3200, 0, 0, 0, 0, 0, 0, 0x01, 0x01, 0x0a, 0x00, 0x00, 0x00, { 0x50c30000, 0x2800, 0, 0x2000, 1, 1, 0x0004, 0x0c02, 0xffff, 0x2700, 0x6433, 0x2100 } }, |
58 | { 0x6810d047, 0x01, 0x00, 0x1e00, 0x00800410, 0x87020000, 0, 0, 0x0c, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x60ea0000, 0, 0, 0, 0, 0, 0, 0 } }, | 58 | { 0xa40ea446, 0x01, 0x00, 0x3200, 0, 0, 0, 0, 0, 0, 0x01, 0x01, 0x0a, 0x00, 0x00, 0x00, { 0x60ea0000, 0x3000, 0, 0x2600, 1, 1, 0x0004, 0x8f02, 0xffff, 0x2f00, 0x300e, 0x2700 } }, |
59 | { 0xcc10d047, 0x01, 0x00, 0x1e00, 0x00e00410, 0x87020000, 0, 0, 0x0c, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0xe8fd0000, 0, 0, 0, 0, 0, 0, 0 } }, | 59 | { 0xd80ea446, 0x01, 0x00, 0x3200, 0, 0, 0, 0, 0, 0, 0x01, 0x01, 0x0a, 0x00, 0x00, 0x00, { 0x70110100, 0x3800, 0, 0x2c00, 1, 1, 0x0004, 0x1203, 0xffff, 0x3600, 0xc9e2, 0x2e00 } }, |
60 | { 0x3011d047, 0x01, 0x00, 0x1e00, 0x00400510, 0x87020000, 0, 0, 0x0c, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x70110100, 0, 0, 0, 0, 0, 0, 0 } }, | 60 | { 0x3c0fa446, 0x01, 0x00, 0x3200, 0, 0, 0, 0, 0, 0, 0x01, 0x01, 0x0a, 0x00, 0x00, 0x00, { 0x80380100, 0x2000, 0, 0x1e00, 2, 1, 0x0004, 0x8300, 0xffff, 0x1f00, 0xcb5e, 0x1a00 } }, |
61 | { 0x9411d047, 0x01, 0x00, 0x1e00, 0x00a00510, 0x87020000, 0, 0, 0x0c, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0xf8240100, 0, 0, 0, 0, 0, 0, 0 } }, | 61 | { 0x6c0fa446, 0x01, 0x00, 0x3200, 0, 0, 0, 0, 0, 0, 0x01, 0x01, 0x0a, 0x00, 0x00, 0x00, { 0x905f0100, 0x2400, 0, 0x1e00, 2, 1, 0x0004, 0x8901, 0xffff, 0x2300, 0x314c, 0x1d00 } }, |
62 | { 0xf811d047, 0x01, 0x00, 0x1e00, 0x00000610, 0x87020000, 0, 0, 0x0c, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x80380100, 0, 0, 0, 0, 0, 0, 0 } } | 62 | { 0xa00fa446, 0x01, 0x00, 0x3200, 0, 0, 0, 0, 0, 0, 0x01, 0x01, 0x0a, 0x00, 0x00, 0x00, { 0xa0860100, 0x2800, 0, 0x2000, 2, 1, 0x0004, 0x0c02, 0xffff, 0x2700, 0x6433, 0x2100 } } |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static const SMU74_Discrete_MemoryLevel avfs_memory_level_polaris10 = | 65 | static const SMU74_Discrete_MemoryLevel avfs_memory_level_polaris10 = |
66 | {0x50140000, 0x50140000, 0x00320000, 0x00, 0x00, | 66 | {0x100ea446, 0, 0x30750000, 0x01, 0x01, 0x01, 0x00, 0x00, 0x64, 0x00, 0x00, 0x1f00, 0x00, 0x00}; |
67 | 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x00, 0x00}; | ||
68 | 67 | ||
69 | /** | 68 | /** |
70 | * Set the address for reading/writing the SMC SRAM space. | 69 | * Set the address for reading/writing the SMC SRAM space. |
@@ -219,6 +218,18 @@ bool polaris10_is_smc_ram_running(struct pp_smumgr *smumgr) | |||
219 | && (0x20100 <= cgs_read_ind_register(smumgr->device, CGS_IND_REG__SMC, ixSMC_PC_C))); | 218 | && (0x20100 <= cgs_read_ind_register(smumgr->device, CGS_IND_REG__SMC, ixSMC_PC_C))); |
220 | } | 219 | } |
221 | 220 | ||
221 | static bool polaris10_is_hw_avfs_present(struct pp_smumgr *smumgr) | ||
222 | { | ||
223 | uint32_t efuse; | ||
224 | |||
225 | efuse = cgs_read_ind_register(smumgr->device, CGS_IND_REG__SMC, ixSMU_EFUSE_0 + (49*4)); | ||
226 | efuse &= 0x00000001; | ||
227 | if (efuse) | ||
228 | return true; | ||
229 | |||
230 | return false; | ||
231 | } | ||
232 | |||
222 | /** | 233 | /** |
223 | * Send a message to the SMC, and wait for its response. | 234 | * Send a message to the SMC, and wait for its response. |
224 | * | 235 | * |
@@ -228,21 +239,27 @@ bool polaris10_is_smc_ram_running(struct pp_smumgr *smumgr) | |||
228 | */ | 239 | */ |
229 | int polaris10_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg) | 240 | int polaris10_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg) |
230 | { | 241 | { |
242 | int ret; | ||
243 | |||
231 | if (!polaris10_is_smc_ram_running(smumgr)) | 244 | if (!polaris10_is_smc_ram_running(smumgr)) |
232 | return -1; | 245 | return -1; |
233 | 246 | ||
247 | |||
234 | SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0); | 248 | SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0); |
235 | 249 | ||
236 | if (1 != SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP)) | 250 | ret = SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP); |
237 | printk("Failed to send Previous Message.\n"); | ||
238 | 251 | ||
252 | if (ret != 1) | ||
253 | printk("\n failed to send pre message %x ret is %d \n", msg, ret); | ||
239 | 254 | ||
240 | cgs_write_register(smumgr->device, mmSMC_MESSAGE_0, msg); | 255 | cgs_write_register(smumgr->device, mmSMC_MESSAGE_0, msg); |
241 | 256 | ||
242 | SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0); | 257 | SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0); |
243 | 258 | ||
244 | if (1 != SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP)) | 259 | ret = SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP); |
245 | printk("Failed to send Message.\n"); | 260 | |
261 | if (ret != 1) | ||
262 | printk("\n failed to send message %x ret is %d \n", msg, ret); | ||
246 | 263 | ||
247 | return 0; | 264 | return 0; |
248 | } | 265 | } |
@@ -953,6 +970,11 @@ static int polaris10_smu_init(struct pp_smumgr *smumgr) | |||
953 | (cgs_handle_t)smu_data->smu_buffer.handle); | 970 | (cgs_handle_t)smu_data->smu_buffer.handle); |
954 | return -1;); | 971 | return -1;); |
955 | 972 | ||
973 | if (polaris10_is_hw_avfs_present(smumgr)) | ||
974 | smu_data->avfs.avfs_btc_status = AVFS_BTC_BOOT; | ||
975 | else | ||
976 | smu_data->avfs.avfs_btc_status = AVFS_BTC_NOTSUPPORTED; | ||
977 | |||
956 | return 0; | 978 | return 0; |
957 | } | 979 | } |
958 | 980 | ||
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c index 39802c0539b6..3d34fc4ca826 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | |||
@@ -266,9 +266,10 @@ int atmel_hlcdc_create_outputs(struct drm_device *dev) | |||
266 | if (!ret) | 266 | if (!ret) |
267 | ret = atmel_hlcdc_check_endpoint(dev, &ep); | 267 | ret = atmel_hlcdc_check_endpoint(dev, &ep); |
268 | 268 | ||
269 | of_node_put(ep_np); | 269 | if (ret) { |
270 | if (ret) | 270 | of_node_put(ep_np); |
271 | return ret; | 271 | return ret; |
272 | } | ||
272 | } | 273 | } |
273 | 274 | ||
274 | for_each_endpoint_of_node(dev->dev->of_node, ep_np) { | 275 | for_each_endpoint_of_node(dev->dev->of_node, ep_np) { |
@@ -276,9 +277,10 @@ int atmel_hlcdc_create_outputs(struct drm_device *dev) | |||
276 | if (!ret) | 277 | if (!ret) |
277 | ret = atmel_hlcdc_attach_endpoint(dev, &ep); | 278 | ret = atmel_hlcdc_attach_endpoint(dev, &ep); |
278 | 279 | ||
279 | of_node_put(ep_np); | 280 | if (ret) { |
280 | if (ret) | 281 | of_node_put(ep_np); |
281 | return ret; | 282 | return ret; |
283 | } | ||
282 | } | 284 | } |
283 | 285 | ||
284 | return 0; | 286 | return 0; |
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index aef3ca8a81fa..016c191221f3 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | |||
@@ -339,6 +339,8 @@ atmel_hlcdc_plane_update_pos_and_size(struct atmel_hlcdc_plane *plane, | |||
339 | 339 | ||
340 | atmel_hlcdc_layer_update_cfg(&plane->layer, 13, 0xffffffff, | 340 | atmel_hlcdc_layer_update_cfg(&plane->layer, 13, 0xffffffff, |
341 | factor_reg); | 341 | factor_reg); |
342 | } else { | ||
343 | atmel_hlcdc_layer_update_cfg(&plane->layer, 13, 0xffffffff, 0); | ||
342 | } | 344 | } |
343 | } | 345 | } |
344 | 346 | ||
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index c204ef32df16..9bb99e274d23 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c | |||
@@ -1296,14 +1296,39 @@ EXPORT_SYMBOL(drm_atomic_add_affected_planes); | |||
1296 | */ | 1296 | */ |
1297 | void drm_atomic_legacy_backoff(struct drm_atomic_state *state) | 1297 | void drm_atomic_legacy_backoff(struct drm_atomic_state *state) |
1298 | { | 1298 | { |
1299 | struct drm_device *dev = state->dev; | ||
1300 | unsigned crtc_mask = 0; | ||
1301 | struct drm_crtc *crtc; | ||
1299 | int ret; | 1302 | int ret; |
1303 | bool global = false; | ||
1304 | |||
1305 | drm_for_each_crtc(crtc, dev) { | ||
1306 | if (crtc->acquire_ctx != state->acquire_ctx) | ||
1307 | continue; | ||
1308 | |||
1309 | crtc_mask |= drm_crtc_mask(crtc); | ||
1310 | crtc->acquire_ctx = NULL; | ||
1311 | } | ||
1312 | |||
1313 | if (WARN_ON(dev->mode_config.acquire_ctx == state->acquire_ctx)) { | ||
1314 | global = true; | ||
1315 | |||
1316 | dev->mode_config.acquire_ctx = NULL; | ||
1317 | } | ||
1300 | 1318 | ||
1301 | retry: | 1319 | retry: |
1302 | drm_modeset_backoff(state->acquire_ctx); | 1320 | drm_modeset_backoff(state->acquire_ctx); |
1303 | 1321 | ||
1304 | ret = drm_modeset_lock_all_ctx(state->dev, state->acquire_ctx); | 1322 | ret = drm_modeset_lock_all_ctx(dev, state->acquire_ctx); |
1305 | if (ret) | 1323 | if (ret) |
1306 | goto retry; | 1324 | goto retry; |
1325 | |||
1326 | drm_for_each_crtc(crtc, dev) | ||
1327 | if (drm_crtc_mask(crtc) & crtc_mask) | ||
1328 | crtc->acquire_ctx = state->acquire_ctx; | ||
1329 | |||
1330 | if (global) | ||
1331 | dev->mode_config.acquire_ctx = state->acquire_ctx; | ||
1307 | } | 1332 | } |
1308 | EXPORT_SYMBOL(drm_atomic_legacy_backoff); | 1333 | EXPORT_SYMBOL(drm_atomic_legacy_backoff); |
1309 | 1334 | ||
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index f6223f907c15..7f9901b7777b 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "exynos_drm_plane.h" | 31 | #include "exynos_drm_plane.h" |
32 | #include "exynos_drm_drv.h" | 32 | #include "exynos_drm_drv.h" |
33 | #include "exynos_drm_fb.h" | 33 | #include "exynos_drm_fb.h" |
34 | #include "exynos_drm_fbdev.h" | ||
35 | #include "exynos_drm_iommu.h" | 34 | #include "exynos_drm_iommu.h" |
36 | 35 | ||
37 | /* | 36 | /* |
diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c index 468498e3fec1..4c1fb3f8b5a6 100644 --- a/drivers/gpu/drm/exynos/exynos_dp.c +++ b/drivers/gpu/drm/exynos/exynos_dp.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | struct exynos_dp_device { | 35 | struct exynos_dp_device { |
36 | struct drm_encoder encoder; | 36 | struct drm_encoder encoder; |
37 | struct drm_connector connector; | 37 | struct drm_connector *connector; |
38 | struct drm_bridge *ptn_bridge; | 38 | struct drm_bridge *ptn_bridge; |
39 | struct drm_device *drm_dev; | 39 | struct drm_device *drm_dev; |
40 | struct device *dev; | 40 | struct device *dev; |
@@ -70,7 +70,7 @@ static int exynos_dp_poweroff(struct analogix_dp_plat_data *plat_data) | |||
70 | static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data) | 70 | static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data) |
71 | { | 71 | { |
72 | struct exynos_dp_device *dp = to_dp(plat_data); | 72 | struct exynos_dp_device *dp = to_dp(plat_data); |
73 | struct drm_connector *connector = &dp->connector; | 73 | struct drm_connector *connector = dp->connector; |
74 | struct drm_display_mode *mode; | 74 | struct drm_display_mode *mode; |
75 | int num_modes = 0; | 75 | int num_modes = 0; |
76 | 76 | ||
@@ -103,6 +103,7 @@ static int exynos_dp_bridge_attach(struct analogix_dp_plat_data *plat_data, | |||
103 | int ret; | 103 | int ret; |
104 | 104 | ||
105 | drm_connector_register(connector); | 105 | drm_connector_register(connector); |
106 | dp->connector = connector; | ||
106 | 107 | ||
107 | /* Pre-empt DP connector creation if there's a bridge */ | 108 | /* Pre-empt DP connector creation if there's a bridge */ |
108 | if (dp->ptn_bridge) { | 109 | if (dp->ptn_bridge) { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 011211e4167d..edbd98ff293e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <drm/drmP.h> | 15 | #include <drm/drmP.h> |
16 | #include "exynos_drm_drv.h" | 16 | #include "exynos_drm_drv.h" |
17 | #include "exynos_drm_crtc.h" | 17 | #include "exynos_drm_crtc.h" |
18 | #include "exynos_drm_fbdev.h" | ||
19 | 18 | ||
20 | static LIST_HEAD(exynos_drm_subdrv_list); | 19 | static LIST_HEAD(exynos_drm_subdrv_list); |
21 | 20 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 3efe1aa89416..d47216488985 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -30,7 +30,6 @@ | |||
30 | 30 | ||
31 | #include "exynos_drm_drv.h" | 31 | #include "exynos_drm_drv.h" |
32 | #include "exynos_drm_fb.h" | 32 | #include "exynos_drm_fb.h" |
33 | #include "exynos_drm_fbdev.h" | ||
34 | #include "exynos_drm_crtc.h" | 33 | #include "exynos_drm_crtc.h" |
35 | #include "exynos_drm_plane.h" | 34 | #include "exynos_drm_plane.h" |
36 | #include "exynos_drm_iommu.h" | 35 | #include "exynos_drm_iommu.h" |
@@ -120,7 +119,6 @@ static struct fimd_driver_data s3c64xx_fimd_driver_data = { | |||
120 | .timing_base = 0x0, | 119 | .timing_base = 0x0, |
121 | .has_clksel = 1, | 120 | .has_clksel = 1, |
122 | .has_limited_fmt = 1, | 121 | .has_limited_fmt = 1, |
123 | .has_hw_trigger = 1, | ||
124 | }; | 122 | }; |
125 | 123 | ||
126 | static struct fimd_driver_data exynos3_fimd_driver_data = { | 124 | static struct fimd_driver_data exynos3_fimd_driver_data = { |
@@ -171,14 +169,11 @@ static struct fimd_driver_data exynos5420_fimd_driver_data = { | |||
171 | .lcdblk_vt_shift = 24, | 169 | .lcdblk_vt_shift = 24, |
172 | .lcdblk_bypass_shift = 15, | 170 | .lcdblk_bypass_shift = 15, |
173 | .lcdblk_mic_bypass_shift = 11, | 171 | .lcdblk_mic_bypass_shift = 11, |
174 | .trg_type = I80_HW_TRG, | ||
175 | .has_shadowcon = 1, | 172 | .has_shadowcon = 1, |
176 | .has_vidoutcon = 1, | 173 | .has_vidoutcon = 1, |
177 | .has_vtsel = 1, | 174 | .has_vtsel = 1, |
178 | .has_mic_bypass = 1, | 175 | .has_mic_bypass = 1, |
179 | .has_dp_clk = 1, | 176 | .has_dp_clk = 1, |
180 | .has_hw_trigger = 1, | ||
181 | .has_trigger_per_te = 1, | ||
182 | }; | 177 | }; |
183 | 178 | ||
184 | struct fimd_context { | 179 | struct fimd_context { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 493552368295..8564c3da0d22 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
@@ -48,13 +48,13 @@ | |||
48 | 48 | ||
49 | /* registers for base address */ | 49 | /* registers for base address */ |
50 | #define G2D_SRC_BASE_ADDR 0x0304 | 50 | #define G2D_SRC_BASE_ADDR 0x0304 |
51 | #define G2D_SRC_STRIDE_REG 0x0308 | 51 | #define G2D_SRC_STRIDE 0x0308 |
52 | #define G2D_SRC_COLOR_MODE 0x030C | 52 | #define G2D_SRC_COLOR_MODE 0x030C |
53 | #define G2D_SRC_LEFT_TOP 0x0310 | 53 | #define G2D_SRC_LEFT_TOP 0x0310 |
54 | #define G2D_SRC_RIGHT_BOTTOM 0x0314 | 54 | #define G2D_SRC_RIGHT_BOTTOM 0x0314 |
55 | #define G2D_SRC_PLANE2_BASE_ADDR 0x0318 | 55 | #define G2D_SRC_PLANE2_BASE_ADDR 0x0318 |
56 | #define G2D_DST_BASE_ADDR 0x0404 | 56 | #define G2D_DST_BASE_ADDR 0x0404 |
57 | #define G2D_DST_STRIDE_REG 0x0408 | 57 | #define G2D_DST_STRIDE 0x0408 |
58 | #define G2D_DST_COLOR_MODE 0x040C | 58 | #define G2D_DST_COLOR_MODE 0x040C |
59 | #define G2D_DST_LEFT_TOP 0x0410 | 59 | #define G2D_DST_LEFT_TOP 0x0410 |
60 | #define G2D_DST_RIGHT_BOTTOM 0x0414 | 60 | #define G2D_DST_RIGHT_BOTTOM 0x0414 |
@@ -563,7 +563,7 @@ static enum g2d_reg_type g2d_get_reg_type(int reg_offset) | |||
563 | 563 | ||
564 | switch (reg_offset) { | 564 | switch (reg_offset) { |
565 | case G2D_SRC_BASE_ADDR: | 565 | case G2D_SRC_BASE_ADDR: |
566 | case G2D_SRC_STRIDE_REG: | 566 | case G2D_SRC_STRIDE: |
567 | case G2D_SRC_COLOR_MODE: | 567 | case G2D_SRC_COLOR_MODE: |
568 | case G2D_SRC_LEFT_TOP: | 568 | case G2D_SRC_LEFT_TOP: |
569 | case G2D_SRC_RIGHT_BOTTOM: | 569 | case G2D_SRC_RIGHT_BOTTOM: |
@@ -573,7 +573,7 @@ static enum g2d_reg_type g2d_get_reg_type(int reg_offset) | |||
573 | reg_type = REG_TYPE_SRC_PLANE2; | 573 | reg_type = REG_TYPE_SRC_PLANE2; |
574 | break; | 574 | break; |
575 | case G2D_DST_BASE_ADDR: | 575 | case G2D_DST_BASE_ADDR: |
576 | case G2D_DST_STRIDE_REG: | 576 | case G2D_DST_STRIDE: |
577 | case G2D_DST_COLOR_MODE: | 577 | case G2D_DST_COLOR_MODE: |
578 | case G2D_DST_LEFT_TOP: | 578 | case G2D_DST_LEFT_TOP: |
579 | case G2D_DST_RIGHT_BOTTOM: | 579 | case G2D_DST_RIGHT_BOTTOM: |
@@ -968,8 +968,8 @@ static int g2d_check_reg_offset(struct device *dev, | |||
968 | } else | 968 | } else |
969 | buf_info->types[reg_type] = BUF_TYPE_GEM; | 969 | buf_info->types[reg_type] = BUF_TYPE_GEM; |
970 | break; | 970 | break; |
971 | case G2D_SRC_STRIDE_REG: | 971 | case G2D_SRC_STRIDE: |
972 | case G2D_DST_STRIDE_REG: | 972 | case G2D_DST_STRIDE: |
973 | if (for_addr) | 973 | if (for_addr) |
974 | goto err; | 974 | goto err; |
975 | 975 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 55f1d37c666a..77f12c00abf9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c | |||
@@ -242,7 +242,7 @@ exynos_drm_plane_check_size(const struct exynos_drm_plane_config *config, | |||
242 | state->v_ratio == (1 << 15)) | 242 | state->v_ratio == (1 << 15)) |
243 | height_ok = true; | 243 | height_ok = true; |
244 | 244 | ||
245 | if (width_ok & height_ok) | 245 | if (width_ok && height_ok) |
246 | return 0; | 246 | return 0; |
247 | 247 | ||
248 | DRM_DEBUG_KMS("scaling mode is not supported"); | 248 | DRM_DEBUG_KMS("scaling mode is not supported"); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index ffe5f8430957..79cf2d5f5a20 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -4977,9 +4977,6 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) | |||
4977 | intel_display_power_get(dev_priv, power_domain); | 4977 | intel_display_power_get(dev_priv, power_domain); |
4978 | 4978 | ||
4979 | if (long_hpd) { | 4979 | if (long_hpd) { |
4980 | /* indicate that we need to restart link training */ | ||
4981 | intel_dp->train_set_valid = false; | ||
4982 | |||
4983 | intel_dp_long_pulse(intel_dp->attached_connector); | 4980 | intel_dp_long_pulse(intel_dp->attached_connector); |
4984 | if (intel_dp->is_mst) | 4981 | if (intel_dp->is_mst) |
4985 | ret = IRQ_HANDLED; | 4982 | ret = IRQ_HANDLED; |
diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c index 0b8eefc2acc5..60fb39cd220b 100644 --- a/drivers/gpu/drm/i915/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c | |||
@@ -85,8 +85,7 @@ static bool | |||
85 | intel_dp_reset_link_train(struct intel_dp *intel_dp, | 85 | intel_dp_reset_link_train(struct intel_dp *intel_dp, |
86 | uint8_t dp_train_pat) | 86 | uint8_t dp_train_pat) |
87 | { | 87 | { |
88 | if (!intel_dp->train_set_valid) | 88 | memset(intel_dp->train_set, 0, sizeof(intel_dp->train_set)); |
89 | memset(intel_dp->train_set, 0, sizeof(intel_dp->train_set)); | ||
90 | intel_dp_set_signal_levels(intel_dp); | 89 | intel_dp_set_signal_levels(intel_dp); |
91 | return intel_dp_set_link_train(intel_dp, dp_train_pat); | 90 | return intel_dp_set_link_train(intel_dp, dp_train_pat); |
92 | } | 91 | } |
@@ -161,23 +160,6 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp) | |||
161 | break; | 160 | break; |
162 | } | 161 | } |
163 | 162 | ||
164 | /* | ||
165 | * if we used previously trained voltage and pre-emphasis values | ||
166 | * and we don't get clock recovery, reset link training values | ||
167 | */ | ||
168 | if (intel_dp->train_set_valid) { | ||
169 | DRM_DEBUG_KMS("clock recovery not ok, reset"); | ||
170 | /* clear the flag as we are not reusing train set */ | ||
171 | intel_dp->train_set_valid = false; | ||
172 | if (!intel_dp_reset_link_train(intel_dp, | ||
173 | DP_TRAINING_PATTERN_1 | | ||
174 | DP_LINK_SCRAMBLING_DISABLE)) { | ||
175 | DRM_ERROR("failed to enable link training\n"); | ||
176 | return; | ||
177 | } | ||
178 | continue; | ||
179 | } | ||
180 | |||
181 | /* Check to see if we've tried the max voltage */ | 163 | /* Check to see if we've tried the max voltage */ |
182 | for (i = 0; i < intel_dp->lane_count; i++) | 164 | for (i = 0; i < intel_dp->lane_count; i++) |
183 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) | 165 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) |
@@ -284,7 +266,6 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp) | |||
284 | /* Make sure clock is still ok */ | 266 | /* Make sure clock is still ok */ |
285 | if (!drm_dp_clock_recovery_ok(link_status, | 267 | if (!drm_dp_clock_recovery_ok(link_status, |
286 | intel_dp->lane_count)) { | 268 | intel_dp->lane_count)) { |
287 | intel_dp->train_set_valid = false; | ||
288 | intel_dp_link_training_clock_recovery(intel_dp); | 269 | intel_dp_link_training_clock_recovery(intel_dp); |
289 | intel_dp_set_link_train(intel_dp, | 270 | intel_dp_set_link_train(intel_dp, |
290 | training_pattern | | 271 | training_pattern | |
@@ -301,7 +282,6 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp) | |||
301 | 282 | ||
302 | /* Try 5 times, then try clock recovery if that fails */ | 283 | /* Try 5 times, then try clock recovery if that fails */ |
303 | if (tries > 5) { | 284 | if (tries > 5) { |
304 | intel_dp->train_set_valid = false; | ||
305 | intel_dp_link_training_clock_recovery(intel_dp); | 285 | intel_dp_link_training_clock_recovery(intel_dp); |
306 | intel_dp_set_link_train(intel_dp, | 286 | intel_dp_set_link_train(intel_dp, |
307 | training_pattern | | 287 | training_pattern | |
@@ -322,10 +302,8 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp) | |||
322 | 302 | ||
323 | intel_dp_set_idle_link_train(intel_dp); | 303 | intel_dp_set_idle_link_train(intel_dp); |
324 | 304 | ||
325 | if (channel_eq) { | 305 | if (channel_eq) |
326 | intel_dp->train_set_valid = true; | ||
327 | DRM_DEBUG_KMS("Channel EQ done. DP Training successful\n"); | 306 | DRM_DEBUG_KMS("Channel EQ done. DP Training successful\n"); |
328 | } | ||
329 | } | 307 | } |
330 | 308 | ||
331 | void intel_dp_stop_link_train(struct intel_dp *intel_dp) | 309 | void intel_dp_stop_link_train(struct intel_dp *intel_dp) |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 4a24b0067a3a..f7f0f01814f6 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -863,8 +863,6 @@ struct intel_dp { | |||
863 | /* This is called before a link training is starterd */ | 863 | /* This is called before a link training is starterd */ |
864 | void (*prepare_link_retrain)(struct intel_dp *intel_dp); | 864 | void (*prepare_link_retrain)(struct intel_dp *intel_dp); |
865 | 865 | ||
866 | bool train_set_valid; | ||
867 | |||
868 | /* Displayport compliance testing */ | 866 | /* Displayport compliance testing */ |
869 | unsigned long compliance_test_type; | 867 | unsigned long compliance_test_type; |
870 | unsigned long compliance_test_data; | 868 | unsigned long compliance_test_data; |
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c index d5a7cfec589b..647127f3aaff 100644 --- a/drivers/gpu/drm/i915/intel_fbc.c +++ b/drivers/gpu/drm/i915/intel_fbc.c | |||
@@ -824,8 +824,7 @@ static bool intel_fbc_can_choose(struct intel_crtc *crtc) | |||
824 | { | 824 | { |
825 | struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; | 825 | struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; |
826 | struct intel_fbc *fbc = &dev_priv->fbc; | 826 | struct intel_fbc *fbc = &dev_priv->fbc; |
827 | bool enable_by_default = IS_HASWELL(dev_priv) || | 827 | bool enable_by_default = IS_BROADWELL(dev_priv); |
828 | IS_BROADWELL(dev_priv); | ||
829 | 828 | ||
830 | if (intel_vgpu_active(dev_priv->dev)) { | 829 | if (intel_vgpu_active(dev_priv->dev)) { |
831 | fbc->no_fbc_reason = "VGPU is active"; | 830 | fbc->no_fbc_reason = "VGPU is active"; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 300ea03be8f0..d1f248fd3506 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -552,7 +552,8 @@ nouveau_fbcon_init(struct drm_device *dev) | |||
552 | if (ret) | 552 | if (ret) |
553 | goto fini; | 553 | goto fini; |
554 | 554 | ||
555 | fbcon->helper.fbdev->pixmap.buf_align = 4; | 555 | if (fbcon->helper.fbdev) |
556 | fbcon->helper.fbdev->pixmap.buf_align = 4; | ||
556 | return 0; | 557 | return 0; |
557 | 558 | ||
558 | fini: | 559 | fini: |
diff --git a/drivers/gpu/drm/sun4i/Kconfig b/drivers/gpu/drm/sun4i/Kconfig index 99510e64e91a..a4b357db8856 100644 --- a/drivers/gpu/drm/sun4i/Kconfig +++ b/drivers/gpu/drm/sun4i/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DRM_SUN4I | 1 | config DRM_SUN4I |
2 | tristate "DRM Support for Allwinner A10 Display Engine" | 2 | tristate "DRM Support for Allwinner A10 Display Engine" |
3 | depends on DRM && ARM | 3 | depends on DRM && ARM && COMMON_CLK |
4 | depends on ARCH_SUNXI || COMPILE_TEST | 4 | depends on ARCH_SUNXI || COMPILE_TEST |
5 | select DRM_GEM_CMA_HELPER | 5 | select DRM_GEM_CMA_HELPER |
6 | select DRM_KMS_HELPER | 6 | select DRM_KMS_HELPER |
diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index f7a15c1a93bf..3ab560450a82 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c | |||
@@ -190,7 +190,7 @@ int sun4i_backend_update_layer_buffer(struct sun4i_backend *backend, | |||
190 | /* Get the physical address of the buffer in memory */ | 190 | /* Get the physical address of the buffer in memory */ |
191 | gem = drm_fb_cma_get_gem_obj(fb, 0); | 191 | gem = drm_fb_cma_get_gem_obj(fb, 0); |
192 | 192 | ||
193 | DRM_DEBUG_DRIVER("Using GEM @ 0x%x\n", gem->paddr); | 193 | DRM_DEBUG_DRIVER("Using GEM @ %pad\n", &gem->paddr); |
194 | 194 | ||
195 | /* Compute the start of the displayed memory */ | 195 | /* Compute the start of the displayed memory */ |
196 | bpp = drm_format_plane_cpp(fb->pixel_format, 0); | 196 | bpp = drm_format_plane_cpp(fb->pixel_format, 0); |
@@ -198,7 +198,7 @@ int sun4i_backend_update_layer_buffer(struct sun4i_backend *backend, | |||
198 | paddr += (state->src_x >> 16) * bpp; | 198 | paddr += (state->src_x >> 16) * bpp; |
199 | paddr += (state->src_y >> 16) * fb->pitches[0]; | 199 | paddr += (state->src_y >> 16) * fb->pitches[0]; |
200 | 200 | ||
201 | DRM_DEBUG_DRIVER("Setting buffer address to 0x%x\n", paddr); | 201 | DRM_DEBUG_DRIVER("Setting buffer address to %pad\n", &paddr); |
202 | 202 | ||
203 | /* Write the 32 lower bits of the address (in bits) */ | 203 | /* Write the 32 lower bits of the address (in bits) */ |
204 | lo_paddr = paddr << 3; | 204 | lo_paddr = paddr << 3; |
diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c index 3ff668cb463c..5b3463197c48 100644 --- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c +++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c | |||
@@ -72,14 +72,40 @@ static unsigned long sun4i_dclk_recalc_rate(struct clk_hw *hw, | |||
72 | static long sun4i_dclk_round_rate(struct clk_hw *hw, unsigned long rate, | 72 | static long sun4i_dclk_round_rate(struct clk_hw *hw, unsigned long rate, |
73 | unsigned long *parent_rate) | 73 | unsigned long *parent_rate) |
74 | { | 74 | { |
75 | return *parent_rate / DIV_ROUND_CLOSEST(*parent_rate, rate); | 75 | unsigned long best_parent = 0; |
76 | u8 best_div = 1; | ||
77 | int i; | ||
78 | |||
79 | for (i = 6; i < 127; i++) { | ||
80 | unsigned long ideal = rate * i; | ||
81 | unsigned long rounded; | ||
82 | |||
83 | rounded = clk_hw_round_rate(clk_hw_get_parent(hw), | ||
84 | ideal); | ||
85 | |||
86 | if (rounded == ideal) { | ||
87 | best_parent = rounded; | ||
88 | best_div = i; | ||
89 | goto out; | ||
90 | } | ||
91 | |||
92 | if ((rounded < ideal) && (rounded > best_parent)) { | ||
93 | best_parent = rounded; | ||
94 | best_div = i; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | out: | ||
99 | *parent_rate = best_parent; | ||
100 | |||
101 | return best_parent / best_div; | ||
76 | } | 102 | } |
77 | 103 | ||
78 | static int sun4i_dclk_set_rate(struct clk_hw *hw, unsigned long rate, | 104 | static int sun4i_dclk_set_rate(struct clk_hw *hw, unsigned long rate, |
79 | unsigned long parent_rate) | 105 | unsigned long parent_rate) |
80 | { | 106 | { |
81 | struct sun4i_dclk *dclk = hw_to_dclk(hw); | 107 | struct sun4i_dclk *dclk = hw_to_dclk(hw); |
82 | int div = DIV_ROUND_CLOSEST(parent_rate, rate); | 108 | u8 div = parent_rate / rate; |
83 | 109 | ||
84 | return regmap_update_bits(dclk->regmap, SUN4I_TCON0_DCLK_REG, | 110 | return regmap_update_bits(dclk->regmap, SUN4I_TCON0_DCLK_REG, |
85 | GENMASK(6, 0), div); | 111 | GENMASK(6, 0), div); |
@@ -127,10 +153,14 @@ int sun4i_dclk_create(struct device *dev, struct sun4i_tcon *tcon) | |||
127 | const char *clk_name, *parent_name; | 153 | const char *clk_name, *parent_name; |
128 | struct clk_init_data init; | 154 | struct clk_init_data init; |
129 | struct sun4i_dclk *dclk; | 155 | struct sun4i_dclk *dclk; |
156 | int ret; | ||
130 | 157 | ||
131 | parent_name = __clk_get_name(tcon->sclk0); | 158 | parent_name = __clk_get_name(tcon->sclk0); |
132 | of_property_read_string_index(dev->of_node, "clock-output-names", 0, | 159 | ret = of_property_read_string_index(dev->of_node, |
133 | &clk_name); | 160 | "clock-output-names", 0, |
161 | &clk_name); | ||
162 | if (ret) | ||
163 | return ret; | ||
134 | 164 | ||
135 | dclk = devm_kzalloc(dev, sizeof(*dclk), GFP_KERNEL); | 165 | dclk = devm_kzalloc(dev, sizeof(*dclk), GFP_KERNEL); |
136 | if (!dclk) | 166 | if (!dclk) |
@@ -140,6 +170,7 @@ int sun4i_dclk_create(struct device *dev, struct sun4i_tcon *tcon) | |||
140 | init.ops = &sun4i_dclk_ops; | 170 | init.ops = &sun4i_dclk_ops; |
141 | init.parent_names = &parent_name; | 171 | init.parent_names = &parent_name; |
142 | init.num_parents = 1; | 172 | init.num_parents = 1; |
173 | init.flags = CLK_SET_RATE_PARENT; | ||
143 | 174 | ||
144 | dclk->regmap = tcon->regs; | 175 | dclk->regmap = tcon->regs; |
145 | dclk->hw.init = &init; | 176 | dclk->hw.init = &init; |
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 76e922bb60e5..257d2b4f3645 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c | |||
@@ -24,34 +24,6 @@ | |||
24 | #include "sun4i_layer.h" | 24 | #include "sun4i_layer.h" |
25 | #include "sun4i_tcon.h" | 25 | #include "sun4i_tcon.h" |
26 | 26 | ||
27 | static int sun4i_drv_connector_plug_all(struct drm_device *drm) | ||
28 | { | ||
29 | struct drm_connector *connector, *failed; | ||
30 | int ret; | ||
31 | |||
32 | mutex_lock(&drm->mode_config.mutex); | ||
33 | list_for_each_entry(connector, &drm->mode_config.connector_list, head) { | ||
34 | ret = drm_connector_register(connector); | ||
35 | if (ret) { | ||
36 | failed = connector; | ||
37 | goto err; | ||
38 | } | ||
39 | } | ||
40 | mutex_unlock(&drm->mode_config.mutex); | ||
41 | return 0; | ||
42 | |||
43 | err: | ||
44 | list_for_each_entry(connector, &drm->mode_config.connector_list, head) { | ||
45 | if (failed == connector) | ||
46 | break; | ||
47 | |||
48 | drm_connector_unregister(connector); | ||
49 | } | ||
50 | mutex_unlock(&drm->mode_config.mutex); | ||
51 | |||
52 | return ret; | ||
53 | } | ||
54 | |||
55 | static int sun4i_drv_enable_vblank(struct drm_device *drm, unsigned int pipe) | 27 | static int sun4i_drv_enable_vblank(struct drm_device *drm, unsigned int pipe) |
56 | { | 28 | { |
57 | struct sun4i_drv *drv = drm->dev_private; | 29 | struct sun4i_drv *drv = drm->dev_private; |
@@ -125,6 +97,22 @@ static struct drm_driver sun4i_drv_driver = { | |||
125 | .disable_vblank = sun4i_drv_disable_vblank, | 97 | .disable_vblank = sun4i_drv_disable_vblank, |
126 | }; | 98 | }; |
127 | 99 | ||
100 | static void sun4i_remove_framebuffers(void) | ||
101 | { | ||
102 | struct apertures_struct *ap; | ||
103 | |||
104 | ap = alloc_apertures(1); | ||
105 | if (!ap) | ||
106 | return; | ||
107 | |||
108 | /* The framebuffer can be located anywhere in RAM */ | ||
109 | ap->ranges[0].base = 0; | ||
110 | ap->ranges[0].size = ~0; | ||
111 | |||
112 | remove_conflicting_framebuffers(ap, "sun4i-drm-fb", false); | ||
113 | kfree(ap); | ||
114 | } | ||
115 | |||
128 | static int sun4i_drv_bind(struct device *dev) | 116 | static int sun4i_drv_bind(struct device *dev) |
129 | { | 117 | { |
130 | struct drm_device *drm; | 118 | struct drm_device *drm; |
@@ -172,6 +160,9 @@ static int sun4i_drv_bind(struct device *dev) | |||
172 | } | 160 | } |
173 | drm->irq_enabled = true; | 161 | drm->irq_enabled = true; |
174 | 162 | ||
163 | /* Remove early framebuffers (ie. simplefb) */ | ||
164 | sun4i_remove_framebuffers(); | ||
165 | |||
175 | /* Create our framebuffer */ | 166 | /* Create our framebuffer */ |
176 | drv->fbdev = sun4i_framebuffer_init(drm); | 167 | drv->fbdev = sun4i_framebuffer_init(drm); |
177 | if (IS_ERR(drv->fbdev)) { | 168 | if (IS_ERR(drv->fbdev)) { |
@@ -187,7 +178,7 @@ static int sun4i_drv_bind(struct device *dev) | |||
187 | if (ret) | 178 | if (ret) |
188 | goto free_drm; | 179 | goto free_drm; |
189 | 180 | ||
190 | ret = sun4i_drv_connector_plug_all(drm); | 181 | ret = drm_connector_register_all(drm); |
191 | if (ret) | 182 | if (ret) |
192 | goto unregister_drm; | 183 | goto unregister_drm; |
193 | 184 | ||
@@ -204,6 +195,7 @@ static void sun4i_drv_unbind(struct device *dev) | |||
204 | { | 195 | { |
205 | struct drm_device *drm = dev_get_drvdata(dev); | 196 | struct drm_device *drm = dev_get_drvdata(dev); |
206 | 197 | ||
198 | drm_connector_unregister_all(drm); | ||
207 | drm_dev_unregister(drm); | 199 | drm_dev_unregister(drm); |
208 | drm_kms_helper_poll_fini(drm); | 200 | drm_kms_helper_poll_fini(drm); |
209 | sun4i_framebuffer_free(drm); | 201 | sun4i_framebuffer_free(drm); |
diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c index ab6494818050..aaffe9e64ffb 100644 --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c | |||
@@ -54,8 +54,13 @@ static int sun4i_rgb_get_modes(struct drm_connector *connector) | |||
54 | static int sun4i_rgb_mode_valid(struct drm_connector *connector, | 54 | static int sun4i_rgb_mode_valid(struct drm_connector *connector, |
55 | struct drm_display_mode *mode) | 55 | struct drm_display_mode *mode) |
56 | { | 56 | { |
57 | struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector); | ||
58 | struct sun4i_drv *drv = rgb->drv; | ||
59 | struct sun4i_tcon *tcon = drv->tcon; | ||
57 | u32 hsync = mode->hsync_end - mode->hsync_start; | 60 | u32 hsync = mode->hsync_end - mode->hsync_start; |
58 | u32 vsync = mode->vsync_end - mode->vsync_start; | 61 | u32 vsync = mode->vsync_end - mode->vsync_start; |
62 | unsigned long rate = mode->clock * 1000; | ||
63 | long rounded_rate; | ||
59 | 64 | ||
60 | DRM_DEBUG_DRIVER("Validating modes...\n"); | 65 | DRM_DEBUG_DRIVER("Validating modes...\n"); |
61 | 66 | ||
@@ -87,6 +92,15 @@ static int sun4i_rgb_mode_valid(struct drm_connector *connector, | |||
87 | 92 | ||
88 | DRM_DEBUG_DRIVER("Vertical parameters OK\n"); | 93 | DRM_DEBUG_DRIVER("Vertical parameters OK\n"); |
89 | 94 | ||
95 | rounded_rate = clk_round_rate(tcon->dclk, rate); | ||
96 | if (rounded_rate < rate) | ||
97 | return MODE_CLOCK_LOW; | ||
98 | |||
99 | if (rounded_rate > rate) | ||
100 | return MODE_CLOCK_HIGH; | ||
101 | |||
102 | DRM_DEBUG_DRIVER("Clock rate OK\n"); | ||
103 | |||
90 | return MODE_OK; | 104 | return MODE_OK; |
91 | } | 105 | } |
92 | 106 | ||
@@ -203,7 +217,7 @@ int sun4i_rgb_init(struct drm_device *drm) | |||
203 | int ret; | 217 | int ret; |
204 | 218 | ||
205 | /* If we don't have a panel, there's no point in going on */ | 219 | /* If we don't have a panel, there's no point in going on */ |
206 | if (!tcon->panel) | 220 | if (IS_ERR(tcon->panel)) |
207 | return -ENODEV; | 221 | return -ENODEV; |
208 | 222 | ||
209 | rgb = devm_kzalloc(drm->dev, sizeof(*rgb), GFP_KERNEL); | 223 | rgb = devm_kzalloc(drm->dev, sizeof(*rgb), GFP_KERNEL); |
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 9f19b0e08560..652385f09735 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c | |||
@@ -425,11 +425,11 @@ static struct drm_panel *sun4i_tcon_find_panel(struct device_node *node) | |||
425 | 425 | ||
426 | remote = of_graph_get_remote_port_parent(end_node); | 426 | remote = of_graph_get_remote_port_parent(end_node); |
427 | if (!remote) { | 427 | if (!remote) { |
428 | DRM_DEBUG_DRIVER("Enable to parse remote node\n"); | 428 | DRM_DEBUG_DRIVER("Unable to parse remote node\n"); |
429 | return ERR_PTR(-EINVAL); | 429 | return ERR_PTR(-EINVAL); |
430 | } | 430 | } |
431 | 431 | ||
432 | return of_drm_find_panel(remote); | 432 | return of_drm_find_panel(remote) ?: ERR_PTR(-EPROBE_DEFER); |
433 | } | 433 | } |
434 | 434 | ||
435 | static int sun4i_tcon_bind(struct device *dev, struct device *master, | 435 | static int sun4i_tcon_bind(struct device *dev, struct device *master, |
@@ -490,7 +490,11 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, | |||
490 | return 0; | 490 | return 0; |
491 | } | 491 | } |
492 | 492 | ||
493 | return sun4i_rgb_init(drm); | 493 | ret = sun4i_rgb_init(drm); |
494 | if (ret < 0) | ||
495 | goto err_free_clocks; | ||
496 | |||
497 | return 0; | ||
494 | 498 | ||
495 | err_free_clocks: | 499 | err_free_clocks: |
496 | sun4i_tcon_free_clocks(tcon); | 500 | sun4i_tcon_free_clocks(tcon); |
@@ -522,12 +526,13 @@ static int sun4i_tcon_probe(struct platform_device *pdev) | |||
522 | * Defer the probe. | 526 | * Defer the probe. |
523 | */ | 527 | */ |
524 | panel = sun4i_tcon_find_panel(node); | 528 | panel = sun4i_tcon_find_panel(node); |
525 | if (IS_ERR(panel)) { | 529 | |
526 | /* | 530 | /* |
527 | * If we don't have a panel endpoint, just go on | 531 | * If we don't have a panel endpoint, just go on |
528 | */ | 532 | */ |
529 | if (PTR_ERR(panel) != -ENODEV) | 533 | if (PTR_ERR(panel) == -EPROBE_DEFER) { |
530 | return -EPROBE_DEFER; | 534 | DRM_DEBUG_DRIVER("Still waiting for our panel. Deferring...\n"); |
535 | return -EPROBE_DEFER; | ||
531 | } | 536 | } |
532 | 537 | ||
533 | return component_add(&pdev->dev, &sun4i_tcon_ops); | 538 | return component_add(&pdev->dev, &sun4i_tcon_ops); |