Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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()
...

+598 -256
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
··· 909 909 struct cgs_acpi_method_argument *argument = NULL; 910 910 uint32_t i, count; 911 911 acpi_status status; 912 - int result; 912 + int result = 0; 913 913 uint32_t func_no = 0xFFFFFFFF; 914 914 915 915 handle = ACPI_HANDLE(&adev->pdev->dev);
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 1535 1535 /* Post card if necessary */ 1536 1536 if (!amdgpu_card_posted(adev) || 1537 1537 (adev->virtualization.is_virtual && 1538 - !adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN)) { 1538 + !(adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN))) { 1539 1539 if (!adev->bios) { 1540 1540 dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); 1541 1541 return -EINVAL;
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
··· 447 447 dev_info.max_memory_clock = adev->pm.default_mclk * 10; 448 448 } 449 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 452 dev_info.num_hw_gfx_contexts = adev->gfx.config.max_hw_contexts; 452 453 dev_info._pad = 0; 453 454 dev_info.ids_flags = 0;
+13 -15
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
··· 270 270 struct drm_device *ddev = dev_get_drvdata(dev); 271 271 struct amdgpu_device *adev = ddev->dev_private; 272 272 enum amd_pm_state_type state = 0; 273 - long idx; 273 + unsigned long idx; 274 274 int ret; 275 275 276 276 if (strlen(buf) == 1) 277 277 adev->pp_force_state_enabled = false; 278 - else { 279 - ret = kstrtol(buf, 0, &idx); 278 + else if (adev->pp_enabled) { 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 283 count = -EINVAL; 283 284 goto fail; 284 285 } 285 286 286 - if (adev->pp_enabled) { 287 - struct pp_states_info data; 288 - amdgpu_dpm_get_pp_num_states(adev, &data); 289 - state = data.states[idx]; 290 - /* only set user selected power states */ 291 - if (state != POWER_STATE_TYPE_INTERNAL_BOOT && 292 - state != POWER_STATE_TYPE_DEFAULT) { 293 - amdgpu_dpm_dispatch_task(adev, 294 - AMD_PP_EVENT_ENABLE_USER_STATE, &state, NULL); 295 - adev->pp_force_state_enabled = true; 296 - } 287 + amdgpu_dpm_get_pp_num_states(adev, &data); 288 + state = data.states[idx]; 289 + /* only set user selected power states */ 290 + if (state != POWER_STATE_TYPE_INTERNAL_BOOT && 291 + state != POWER_STATE_TYPE_DEFAULT) { 292 + amdgpu_dpm_dispatch_task(adev, 293 + AMD_PP_EVENT_ENABLE_USER_STATE, &state, NULL); 294 + adev->pp_force_state_enabled = true; 297 295 } 298 296 } 299 297 fail:
+2 -1
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
··· 297 297 static const u32 golden_settings_polaris10_a11[] = 298 298 { 299 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 302 mmCB_HW_CONTROL_3, 0x000001ff, 0x00000040, 302 303 mmDB_DEBUG2, 0xf00fffff, 0x00000400, 303 304 mmPA_SC_ENHANCE, 0xffffffff, 0x20000001,
+72
drivers/gpu/drm/amd/include/atombios.h
··· 5538 5538 ULONG ulReserved[12]; 5539 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 5614 typedef struct _ATOM_SCLK_FCW_RANGE_ENTRY_V1{ 5543 5615 ULONG ulMaxSclkFreq;
+2
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c
··· 633 633 data->vddci_control = FIJI_VOLTAGE_CONTROL_NONE; 634 634 data->mvdd_control = FIJI_VOLTAGE_CONTROL_NONE; 635 635 636 + data->force_pcie_gen = PP_PCIEGenInvalid; 637 + 636 638 if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, 637 639 VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) 638 640 data->voltage_control = FIJI_VOLTAGE_CONTROL_BY_SVID2;
+5 -1
drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
··· 306 306 { 307 307 PHM_FUNC_CHECK(hwmgr); 308 308 309 - if (hwmgr->hwmgr_func->store_cc6_data == NULL) 309 + if (display_config == NULL) 310 310 return -EINVAL; 311 311 312 312 hwmgr->display_config = *display_config; 313 + 314 + if (hwmgr->hwmgr_func->store_cc6_data == NULL) 315 + return -EINVAL; 316 + 313 317 /* to do pass other display configuration in furture */ 314 318 315 319 if (hwmgr->hwmgr_func->store_cc6_data)
+127 -101
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
··· 1296 1296 } 1297 1297 1298 1298 mem_level->MclkFrequency = clock; 1299 - mem_level->StutterEnable = 0; 1300 1299 mem_level->EnabledForThrottle = 1; 1301 1300 mem_level->EnabledForActivity = 0; 1302 1301 mem_level->UpHyst = 0; ··· 1303 1304 mem_level->VoltageDownHyst = 0; 1304 1305 mem_level->ActivityLevel = (uint16_t)data->mclk_activity_target; 1305 1306 mem_level->StutterEnable = false; 1306 - 1307 1307 mem_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; 1308 1308 1309 1309 data->display_timing.num_existing_displays = info.display_count; ··· 1361 1363 * a higher state by default such that we are not effected by 1362 1364 * up threshold or and MCLK DPM latency. 1363 1365 */ 1364 - levels[0].ActivityLevel = (uint16_t)data->mclk_dpm0_activity_target; 1366 + levels[0].ActivityLevel = 0x1f; 1365 1367 CONVERT_FROM_HOST_TO_SMC_US(levels[0].ActivityLevel); 1366 1368 1367 1369 data->smc_state_table.MemoryDpmLevelCount = ··· 1759 1761 1760 1762 static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) 1761 1763 { 1762 - uint32_t ro, efuse, efuse2, clock_freq, volt_without_cks, 1763 - volt_with_cks, value; 1764 - uint16_t clock_freq_u16; 1764 + uint32_t ro, efuse, volt_without_cks, volt_with_cks, value, max, min; 1765 1765 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1766 - uint8_t type, i, j, cks_setting, stretch_amount, stretch_amount2, 1767 - volt_offset = 0; 1766 + uint8_t i, stretch_amount, stretch_amount2, volt_offset = 0; 1768 1767 struct phm_ppt_v1_information *table_info = 1769 1768 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1770 1769 struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = ··· 1773 1778 * if the part is SS or FF. if RO >= 1660MHz, part is FF. 1774 1779 */ 1775 1780 efuse = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, 1776 - ixSMU_EFUSE_0 + (146 * 4)); 1777 - efuse2 = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, 1778 - ixSMU_EFUSE_0 + (148 * 4)); 1781 + ixSMU_EFUSE_0 + (67 * 4)); 1779 1782 efuse &= 0xFF000000; 1780 1783 efuse = efuse >> 24; 1781 - efuse2 &= 0xF; 1782 1784 1783 - if (efuse2 == 1) 1784 - ro = (2300 - 1350) * efuse / 255 + 1350; 1785 - else 1786 - ro = (2500 - 1000) * efuse / 255 + 1000; 1785 + if (hwmgr->chip_id == CHIP_POLARIS10) { 1786 + min = 1000; 1787 + max = 2300; 1788 + } else { 1789 + min = 1100; 1790 + max = 2100; 1791 + } 1787 1792 1788 - if (ro >= 1660) 1789 - type = 0; 1790 - else 1791 - type = 1; 1792 - 1793 - /* Populate Stretch amount */ 1794 - data->smc_state_table.ClockStretcherAmount = stretch_amount; 1793 + ro = efuse * (max -min)/255 + min; 1795 1794 1796 1795 /* Populate Sclk_CKS_masterEn0_7 and Sclk_voltageOffset */ 1797 1796 for (i = 0; i < sclk_table->count; i++) { 1798 1797 data->smc_state_table.Sclk_CKS_masterEn0_7 |= 1799 1798 sclk_table->entries[i].cks_enable << i; 1800 - volt_without_cks = (uint32_t)((14041 * 1801 - (sclk_table->entries[i].clk/100) / 10000 + 3571 + 75 - ro) * 1000 / 1802 - (4026 - (13924 * (sclk_table->entries[i].clk/100) / 10000))); 1803 - volt_with_cks = (uint32_t)((13946 * 1804 - (sclk_table->entries[i].clk/100) / 10000 + 3320 + 45 - ro) * 1000 / 1805 - (3664 - (11454 * (sclk_table->entries[i].clk/100) / 10000))); 1799 + 1800 + volt_without_cks = (uint32_t)(((ro - 40) * 1000 - 2753594 - sclk_table->entries[i].clk/100 * 136418 /1000) / \ 1801 + (sclk_table->entries[i].clk/100 * 1132925 /10000 - 242418)/100); 1802 + 1803 + volt_with_cks = (uint32_t)((ro * 1000 -2396351 - sclk_table->entries[i].clk/100 * 329021/1000) / \ 1804 + (sclk_table->entries[i].clk/10000 * 649434 /1000 - 18005)/10); 1805 + 1806 1806 if (volt_without_cks >= volt_with_cks) 1807 1807 volt_offset = (uint8_t)(((volt_without_cks - volt_with_cks + 1808 1808 sclk_table->entries[i].cks_voffset) * 100 / 625) + 1); 1809 + 1809 1810 data->smc_state_table.Sclk_voltageOffset[i] = volt_offset; 1810 1811 } 1811 - 1812 - PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, PWR_CKS_ENABLE, 1813 - STRETCH_ENABLE, 0x0); 1814 - PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, PWR_CKS_ENABLE, 1815 - masterReset, 0x1); 1816 - /* PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, PWR_CKS_ENABLE, staticEnable, 0x1); */ 1817 - PHM_WRITE_INDIRECT_FIELD(hwmgr->device, CGS_IND_REG__SMC, PWR_CKS_ENABLE, 1818 - masterReset, 0x0); 1819 1812 1820 1813 /* Populate CKS Lookup Table */ 1821 1814 if (stretch_amount == 1 || stretch_amount == 2 || stretch_amount == 5) ··· 1816 1833 PP_ASSERT_WITH_CODE(false, 1817 1834 "Stretch Amount in PPTable not supported\n", 1818 1835 return -EINVAL); 1819 - } 1820 - 1821 - value = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, 1822 - ixPWR_CKS_CNTL); 1823 - value &= 0xFFC2FF87; 1824 - data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].minFreq = 1825 - polaris10_clock_stretcher_lookup_table[stretch_amount2][0]; 1826 - data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].maxFreq = 1827 - polaris10_clock_stretcher_lookup_table[stretch_amount2][1]; 1828 - clock_freq_u16 = (uint16_t)(PP_SMC_TO_HOST_UL(data->smc_state_table. 1829 - GraphicsLevel[data->smc_state_table.GraphicsDpmLevelCount - 1].SclkSetting.SclkFrequency) / 100); 1830 - if (polaris10_clock_stretcher_lookup_table[stretch_amount2][0] < clock_freq_u16 1831 - && polaris10_clock_stretcher_lookup_table[stretch_amount2][1] > clock_freq_u16) { 1832 - /* Program PWR_CKS_CNTL. CKS_USE_FOR_LOW_FREQ */ 1833 - value |= (polaris10_clock_stretcher_lookup_table[stretch_amount2][3]) << 16; 1834 - /* Program PWR_CKS_CNTL. CKS_LDO_REFSEL */ 1835 - value |= (polaris10_clock_stretcher_lookup_table[stretch_amount2][2]) << 18; 1836 - /* Program PWR_CKS_CNTL. CKS_STRETCH_AMOUNT */ 1837 - value |= (polaris10_clock_stretch_amount_conversion 1838 - [polaris10_clock_stretcher_lookup_table[stretch_amount2][3]] 1839 - [stretch_amount]) << 3; 1840 - } 1841 - CONVERT_FROM_HOST_TO_SMC_US(data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].minFreq); 1842 - CONVERT_FROM_HOST_TO_SMC_US(data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].maxFreq); 1843 - data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].setting = 1844 - polaris10_clock_stretcher_lookup_table[stretch_amount2][2] & 0x7F; 1845 - data->smc_state_table.CKS_LOOKUPTable.CKS_LOOKUPTableEntry[0].setting |= 1846 - (polaris10_clock_stretcher_lookup_table[stretch_amount2][3]) << 7; 1847 - 1848 - cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, 1849 - ixPWR_CKS_CNTL, value); 1850 - 1851 - /* Populate DDT Lookup Table */ 1852 - for (i = 0; i < 4; i++) { 1853 - /* Assign the minimum and maximum VID stored 1854 - * in the last row of Clock Stretcher Voltage Table. 1855 - */ 1856 - data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].minVID = 1857 - (uint8_t) polaris10_clock_stretcher_ddt_table[type][i][2]; 1858 - data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].maxVID = 1859 - (uint8_t) polaris10_clock_stretcher_ddt_table[type][i][3]; 1860 - /* Loop through each SCLK and check the frequency 1861 - * to see if it lies within the frequency for clock stretcher. 1862 - */ 1863 - for (j = 0; j < data->smc_state_table.GraphicsDpmLevelCount; j++) { 1864 - cks_setting = 0; 1865 - clock_freq = PP_SMC_TO_HOST_UL( 1866 - data->smc_state_table.GraphicsLevel[j].SclkSetting.SclkFrequency); 1867 - /* Check the allowed frequency against the sclk level[j]. 1868 - * Sclk's endianness has already been converted, 1869 - * and it's in 10Khz unit, 1870 - * as opposed to Data table, which is in Mhz unit. 1871 - */ 1872 - if (clock_freq >= (polaris10_clock_stretcher_ddt_table[type][i][0]) * 100) { 1873 - cks_setting |= 0x2; 1874 - if (clock_freq < (polaris10_clock_stretcher_ddt_table[type][i][1]) * 100) 1875 - cks_setting |= 0x1; 1876 - } 1877 - data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].setting 1878 - |= cks_setting << (j * 2); 1879 - } 1880 - CONVERT_FROM_HOST_TO_SMC_US( 1881 - data->smc_state_table.ClockStretcherDataTable.ClockStretcherDataTableEntry[i].setting); 1882 1836 } 1883 1837 1884 1838 value = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixPWR_CKS_CNTL); ··· 1875 1955 1876 1956 return 0; 1877 1957 } 1958 + 1959 + 1960 + int polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr) 1961 + { 1962 + struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 1963 + SMU74_Discrete_DpmTable *table = &(data->smc_state_table); 1964 + int result = 0; 1965 + struct pp_atom_ctrl__avfs_parameters avfs_params = {0}; 1966 + AVFS_meanNsigma_t AVFS_meanNsigma = { {0} }; 1967 + AVFS_Sclk_Offset_t AVFS_SclkOffset = { {0} }; 1968 + uint32_t tmp, i; 1969 + struct pp_smumgr *smumgr = hwmgr->smumgr; 1970 + struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); 1971 + 1972 + struct phm_ppt_v1_information *table_info = 1973 + (struct phm_ppt_v1_information *)hwmgr->pptable; 1974 + struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = 1975 + table_info->vdd_dep_on_sclk; 1976 + 1977 + 1978 + if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED) 1979 + return result; 1980 + 1981 + result = atomctrl_get_avfs_information(hwmgr, &avfs_params); 1982 + 1983 + if (0 == result) { 1984 + table->BTCGB_VDROOP_TABLE[0].a0 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a0); 1985 + table->BTCGB_VDROOP_TABLE[0].a1 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a1); 1986 + table->BTCGB_VDROOP_TABLE[0].a2 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a2); 1987 + table->BTCGB_VDROOP_TABLE[1].a0 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0); 1988 + table->BTCGB_VDROOP_TABLE[1].a1 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1); 1989 + table->BTCGB_VDROOP_TABLE[1].a2 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2); 1990 + table->AVFSGB_VDROOP_TABLE[0].m1 = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSON_m1); 1991 + table->AVFSGB_VDROOP_TABLE[0].m2 = PP_HOST_TO_SMC_US(avfs_params.usAVFSGB_FUSE_TABLE_CKSON_m2); 1992 + table->AVFSGB_VDROOP_TABLE[0].b = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSON_b); 1993 + table->AVFSGB_VDROOP_TABLE[0].m1_shift = 24; 1994 + table->AVFSGB_VDROOP_TABLE[0].m2_shift = 12; 1995 + table->AVFSGB_VDROOP_TABLE[1].m1 = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1); 1996 + table->AVFSGB_VDROOP_TABLE[1].m2 = PP_HOST_TO_SMC_US(avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2); 1997 + table->AVFSGB_VDROOP_TABLE[1].b = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b); 1998 + table->AVFSGB_VDROOP_TABLE[1].m1_shift = 24; 1999 + table->AVFSGB_VDROOP_TABLE[1].m2_shift = 12; 2000 + table->MaxVoltage = PP_HOST_TO_SMC_US(avfs_params.usMaxVoltage_0_25mv); 2001 + AVFS_meanNsigma.Aconstant[0] = PP_HOST_TO_SMC_UL(avfs_params.ulAVFS_meanNsigma_Acontant0); 2002 + AVFS_meanNsigma.Aconstant[1] = PP_HOST_TO_SMC_UL(avfs_params.ulAVFS_meanNsigma_Acontant1); 2003 + AVFS_meanNsigma.Aconstant[2] = PP_HOST_TO_SMC_UL(avfs_params.ulAVFS_meanNsigma_Acontant2); 2004 + AVFS_meanNsigma.DC_tol_sigma = PP_HOST_TO_SMC_US(avfs_params.usAVFS_meanNsigma_DC_tol_sigma); 2005 + AVFS_meanNsigma.Platform_mean = PP_HOST_TO_SMC_US(avfs_params.usAVFS_meanNsigma_Platform_mean); 2006 + AVFS_meanNsigma.PSM_Age_CompFactor = PP_HOST_TO_SMC_US(avfs_params.usPSM_Age_ComFactor); 2007 + AVFS_meanNsigma.Platform_sigma = PP_HOST_TO_SMC_US(avfs_params.usAVFS_meanNsigma_Platform_sigma); 2008 + 2009 + for (i = 0; i < NUM_VFT_COLUMNS; i++) { 2010 + AVFS_meanNsigma.Static_Voltage_Offset[i] = (uint8_t)(sclk_table->entries[i].cks_voffset * 100 / 625); 2011 + AVFS_SclkOffset.Sclk_Offset[i] = PP_HOST_TO_SMC_US((uint16_t)(sclk_table->entries[i].sclk_offset) / 100); 2012 + } 2013 + 2014 + result = polaris10_read_smc_sram_dword(smumgr, 2015 + SMU7_FIRMWARE_HEADER_LOCATION + offsetof(SMU74_Firmware_Header, AvfsMeanNSigma), 2016 + &tmp, data->sram_end); 2017 + 2018 + polaris10_copy_bytes_to_smc(smumgr, 2019 + tmp, 2020 + (uint8_t *)&AVFS_meanNsigma, 2021 + sizeof(AVFS_meanNsigma_t), 2022 + data->sram_end); 2023 + 2024 + result = polaris10_read_smc_sram_dword(smumgr, 2025 + SMU7_FIRMWARE_HEADER_LOCATION + offsetof(SMU74_Firmware_Header, AvfsSclkOffsetTable), 2026 + &tmp, data->sram_end); 2027 + polaris10_copy_bytes_to_smc(smumgr, 2028 + tmp, 2029 + (uint8_t *)&AVFS_SclkOffset, 2030 + sizeof(AVFS_Sclk_Offset_t), 2031 + data->sram_end); 2032 + 2033 + data->avfs_vdroop_override_setting = (avfs_params.ucEnableGB_VDROOP_TABLE_CKSON << BTCGB0_Vdroop_Enable_SHIFT) | 2034 + (avfs_params.ucEnableGB_VDROOP_TABLE_CKSOFF << BTCGB1_Vdroop_Enable_SHIFT) | 2035 + (avfs_params.ucEnableGB_FUSE_TABLE_CKSON << AVFSGB0_Vdroop_Enable_SHIFT) | 2036 + (avfs_params.ucEnableGB_FUSE_TABLE_CKSOFF << AVFSGB1_Vdroop_Enable_SHIFT); 2037 + data->apply_avfs_cks_off_voltage = (avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage == 1) ? true : false; 2038 + } 2039 + return result; 2040 + } 2041 + 1878 2042 1879 2043 /** 1880 2044 * Initializes the SMC table and uploads it ··· 2060 2056 "Failed to populate Clock Stretcher Data Table!", 2061 2057 return result); 2062 2058 } 2059 + 2060 + result = polaris10_populate_avfs_parameters(hwmgr); 2061 + PP_ASSERT_WITH_CODE(0 == result, "Failed to populate AVFS Parameters!", return result;); 2062 + 2063 2063 table->CurrSclkPllRange = 0xff; 2064 2064 table->GraphicsVoltageChangeEnable = 1; 2065 2065 table->GraphicsThermThrottleEnable = 1; ··· 2260 2252 static int polaris10_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) 2261 2253 { 2262 2254 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 2255 + uint32_t soft_register_value = 0; 2256 + uint32_t handshake_disables_offset = data->soft_regs_start 2257 + + offsetof(SMU74_SoftRegisters, HandshakeDisables); 2263 2258 2264 2259 /* enable SCLK dpm */ 2265 2260 if (!data->sclk_dpm_key_disabled) ··· 2273 2262 2274 2263 /* enable MCLK dpm */ 2275 2264 if (0 == data->mclk_dpm_key_disabled) { 2265 + /* Disable UVD - SMU handshake for MCLK. */ 2266 + soft_register_value = cgs_read_ind_register(hwmgr->device, 2267 + CGS_IND_REG__SMC, handshake_disables_offset); 2268 + soft_register_value |= SMU7_UVD_MCLK_HANDSHAKE_DISABLE; 2269 + cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, 2270 + handshake_disables_offset, soft_register_value); 2276 2271 2277 2272 PP_ASSERT_WITH_CODE( 2278 2273 (0 == smum_send_msg_to_smc(hwmgr->smumgr, 2279 2274 PPSMC_MSG_MCLKDPM_Enable)), 2280 2275 "Failed to enable MCLK DPM during DPM Start Function!", 2281 2276 return -1); 2282 - 2283 2277 2284 2278 PHM_WRITE_FIELD(hwmgr->device, MC_SEQ_CNTL_3, CAC_EN, 0x1); 2285 2279 ··· 2622 2606 2623 2607 phm_cap_set(hwmgr->platform_descriptor.platformCaps, 2624 2608 PHM_PlatformCaps_FanSpeedInTableIsRPM); 2609 + 2625 2610 if (hwmgr->chip_id == CHIP_POLARIS11) 2626 2611 phm_cap_set(hwmgr->platform_descriptor.platformCaps, 2627 2612 PHM_PlatformCaps_SPLLShutdownSupport); ··· 2955 2938 data->vddci_control = POLARIS10_VOLTAGE_CONTROL_NONE; 2956 2939 data->mvdd_control = POLARIS10_VOLTAGE_CONTROL_NONE; 2957 2940 2941 + data->enable_tdc_limit_feature = true; 2942 + data->enable_pkg_pwr_tracking_feature = true; 2943 + data->force_pcie_gen = PP_PCIEGenInvalid; 2944 + data->mclk_stutter_mode_threshold = 40000; 2945 + 2958 2946 if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, 2959 2947 VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) 2960 2948 data->voltage_control = POLARIS10_VOLTAGE_CONTROL_BY_SVID2; ··· 2983 2961 VOLTAGE_TYPE_VDDCI, VOLTAGE_OBJ_SVID2)) 2984 2962 data->vddci_control = POLARIS10_VOLTAGE_CONTROL_BY_SVID2; 2985 2963 } 2964 + 2965 + if (table_info->cac_dtp_table->usClockStretchAmount != 0) 2966 + phm_cap_set(hwmgr->platform_descriptor.platformCaps, 2967 + PHM_PlatformCaps_ClockStretcher); 2986 2968 2987 2969 polaris10_set_features_platform_caps(hwmgr); 2988 2970
+3
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h
··· 312 312 313 313 /* soft pptable for re-uploading into smu */ 314 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 320 /* To convert to Q8.8 format for firmware */
+5 -1
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c
··· 625 625 int ret; 626 626 struct pp_smumgr *smumgr = (struct pp_smumgr *)(hwmgr->smumgr); 627 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 631 return 0; 632 + 633 + ret = smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, 634 + PPSMC_MSG_SetGBDroopSettings, data->avfs_vdroop_override_setting); 631 635 632 636 ret = (smum_send_msg_to_smc(smumgr, PPSMC_MSG_EnableAvfs) == 0) ? 633 637 0 : -1;
+16 -2
drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
··· 44 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 61 int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool advertise) 48 62 { 49 63 struct atcs_pref_req_input atcs_input; ··· 66 52 int result; 67 53 struct cgs_system_info info = {0}; 68 54 69 - if (!acpi_atcs_functions_supported(device, ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST)) 55 + if( 0 != acpi_atcs_notify_pcie_device_ready(device)) 70 56 return -EINVAL; 71 57 72 58 info.size = sizeof(struct cgs_system_info); ··· 91 77 ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST, 92 78 &atcs_input, 93 79 &atcs_output, 94 - 0, 80 + 1, 95 81 sizeof(atcs_input), 96 82 sizeof(atcs_output)); 97 83 if (result != 0)
+43
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
··· 1302 1302 1303 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 + }
+32
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h
··· 250 250 }; 251 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 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 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 284 extern uint32_t atomctrl_get_mpll_reference_clock(struct pp_hwmgr *hwmgr); ··· 307 278 extern int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_type, 308 279 uint32_t sclk, uint16_t virtual_voltage_Id, uint16_t *voltage); 309 280 extern int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl_sclk_range_table *table); 281 + 282 + extern int atomctrl_get_avfs_information(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl__avfs_parameters *param); 283 + 310 284 #endif 311 285
+1
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c
··· 4489 4489 data->vdd_ci_control = TONGA_VOLTAGE_CONTROL_NONE; 4490 4490 data->vdd_gfx_control = TONGA_VOLTAGE_CONTROL_NONE; 4491 4491 data->mvdd_control = TONGA_VOLTAGE_CONTROL_NONE; 4492 + data->force_pcie_gen = PP_PCIEGenInvalid; 4492 4493 4493 4494 if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, 4494 4495 VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) {
+1
drivers/gpu/drm/amd/powerplay/inc/polaris10_ppsmc.h
··· 27 27 28 28 #pragma pack(push, 1) 29 29 30 + #define PPSMC_MSG_SetGBDroopSettings ((uint16_t) 0x305) 30 31 31 32 #define PPSMC_SWSTATE_FLAG_DC 0x01 32 33 #define PPSMC_SWSTATE_FLAG_UVD 0x02
+1
drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h
··· 26 26 extern int acpi_pcie_perf_request(void *device, 27 27 uint8_t perf_req, 28 28 bool advertise); 29 + extern bool acpi_atcs_notify_pcie_device_ready(void *device);
+67 -8
drivers/gpu/drm/amd/powerplay/inc/smu74.h
··· 34 34 #define SMU__NUM_LCLK_DPM_LEVELS 8 35 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 61 enum SID_OPTION { 38 62 SID_OPTION_HI, 39 63 SID_OPTION_LO, ··· 572 548 uint32_t CacConfigTable; 573 549 uint32_t CacStatusTable; 574 550 575 - 576 551 uint32_t mcRegisterTable; 577 552 578 - 579 553 uint32_t mcArbDramTimingTable; 580 - 581 - 582 - 583 554 584 555 uint32_t PmFuseTable; 585 556 uint32_t Globals; 586 557 uint32_t ClockStretcherTable; 587 558 uint32_t VftTable; 588 - uint32_t Reserved[21]; 559 + uint32_t Reserved1; 560 + uint32_t AvfsTable; 561 + uint32_t AvfsCksOffGbvTable; 562 + uint32_t AvfsMeanNSigma; 563 + uint32_t AvfsSclkOffsetTable; 564 + uint32_t Reserved[16]; 589 565 uint32_t Signature; 590 566 }; 591 567 ··· 725 701 struct SMU_ClockStretcherDataTableEntry { 726 702 uint8_t minVID; 727 703 uint8_t maxVID; 728 - 729 - 730 704 uint16_t setting; 731 705 }; 732 706 typedef struct SMU_ClockStretcherDataTableEntry SMU_ClockStretcherDataTableEntry; ··· 790 768 791 769 typedef struct VFT_TABLE_t VFT_TABLE_t; 792 770 771 + 772 + /* Total margin, root mean square of Fmax + DC + Platform */ 773 + struct AVFS_Margin_t { 774 + VFT_CELL_t Cell[NUM_VFT_COLUMNS]; 775 + }; 776 + typedef struct AVFS_Margin_t AVFS_Margin_t; 777 + 778 + #define BTCGB_VDROOP_TABLE_MAX_ENTRIES 2 779 + #define AVFSGB_VDROOP_TABLE_MAX_ENTRIES 2 780 + 781 + struct GB_VDROOP_TABLE_t { 782 + int32_t a0; 783 + int32_t a1; 784 + int32_t a2; 785 + uint32_t spare; 786 + }; 787 + typedef struct GB_VDROOP_TABLE_t GB_VDROOP_TABLE_t; 788 + 789 + struct AVFS_CksOff_Gbv_t { 790 + VFT_CELL_t Cell[NUM_VFT_COLUMNS]; 791 + }; 792 + typedef struct AVFS_CksOff_Gbv_t AVFS_CksOff_Gbv_t; 793 + 794 + struct AVFS_meanNsigma_t { 795 + uint32_t Aconstant[3]; 796 + uint16_t DC_tol_sigma; 797 + uint16_t Platform_mean; 798 + uint16_t Platform_sigma; 799 + uint16_t PSM_Age_CompFactor; 800 + uint8_t Static_Voltage_Offset[NUM_VFT_COLUMNS]; 801 + }; 802 + typedef struct AVFS_meanNsigma_t AVFS_meanNsigma_t; 803 + 804 + struct AVFS_Sclk_Offset_t { 805 + uint16_t Sclk_Offset[8]; 806 + }; 807 + typedef struct AVFS_Sclk_Offset_t AVFS_Sclk_Offset_t; 793 808 794 809 #endif 795 810
+31 -11
drivers/gpu/drm/amd/powerplay/inc/smu74_discrete.h
··· 223 223 224 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 236 struct SMU74_Discrete_DpmTable { 227 237 228 238 SMU74_PIDController GraphicsPIDController; ··· 268 258 uint8_t ThermOutPolarity; 269 259 uint8_t ThermOutMode; 270 260 uint8_t BootPhases; 271 - uint32_t Reserved[4]; 261 + 262 + uint8_t VRHotLevel; 263 + uint8_t Reserved1[3]; 264 + uint16_t FanStartTemperature; 265 + uint16_t FanStopTemperature; 266 + uint16_t MaxVoltage; 267 + uint16_t Reserved2; 268 + uint32_t Reserved[1]; 272 269 273 270 SMU74_Discrete_GraphicsLevel GraphicsLevel[SMU74_MAX_LEVELS_GRAPHICS]; 274 271 SMU74_Discrete_MemoryLevel MemoryACPILevel; ··· 364 347 365 348 uint32_t CurrSclkPllRange; 366 349 sclkFcwRange_t SclkFcwRangeTable[NUM_SCLK_RANGE]; 350 + GB_VDROOP_TABLE_t BTCGB_VDROOP_TABLE[BTCGB_VDROOP_TABLE_MAX_ENTRIES]; 351 + SMU_QuadraticCoeffs AVFSGB_VDROOP_TABLE[AVFSGB_VDROOP_TABLE_MAX_ENTRIES]; 367 352 }; 368 353 369 354 typedef struct SMU74_Discrete_DpmTable SMU74_Discrete_DpmTable; ··· 568 549 }; 569 550 570 551 typedef struct SMU7_AcpiScoreboard SMU7_AcpiScoreboard; 571 - 572 - struct SMU_QuadraticCoeffs { 573 - int32_t m1; 574 - uint32_t b; 575 - 576 - int16_t m2; 577 - uint8_t m1_shift; 578 - uint8_t m2_shift; 579 - }; 580 - typedef struct SMU_QuadraticCoeffs SMU_QuadraticCoeffs; 581 552 582 553 struct SMU74_Discrete_PmFuses { 583 554 uint8_t BapmVddCVidHiSidd[8]; ··· 829 820 #define DB_IR_SHIFT 25 830 821 #define DB_PCC_SHIFT 26 831 822 #define DB_EDC_SHIFT 27 823 + 824 + #define BTCGB0_Vdroop_Enable_MASK 0x1 825 + #define BTCGB1_Vdroop_Enable_MASK 0x2 826 + #define AVFSGB0_Vdroop_Enable_MASK 0x4 827 + #define AVFSGB1_Vdroop_Enable_MASK 0x8 828 + 829 + #define BTCGB0_Vdroop_Enable_SHIFT 0 830 + #define BTCGB1_Vdroop_Enable_SHIFT 1 831 + #define AVFSGB0_Vdroop_Enable_SHIFT 2 832 + #define AVFSGB1_Vdroop_Enable_SHIFT 3 833 + 832 834 833 835 #pragma pack(pop) 834 836
+36 -14
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
··· 52 52 static const SMU74_Discrete_GraphicsLevel avfs_graphics_level_polaris10[8] = { 53 53 /* Min pcie DeepSleep Activity CgSpll CgSpll CcPwr CcPwr Sclk Enabled Enabled Voltage Power */ 54 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 } }, 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 } }, 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 } }, 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 } }, 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 } }, 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 } }, 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 } }, 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 } } 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 + { 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 + { 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 + { 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 + { 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 + { 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 + { 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 + { 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 65 static const SMU74_Discrete_MemoryLevel avfs_memory_level_polaris10 = 66 - {0x50140000, 0x50140000, 0x00320000, 0x00, 0x00, 67 - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x00, 0x00}; 66 + {0x100ea446, 0, 0x30750000, 0x01, 0x01, 0x01, 0x00, 0x00, 0x64, 0x00, 0x00, 0x1f00, 0x00, 0x00}; 68 67 69 68 /** 70 69 * Set the address for reading/writing the SMC SRAM space. ··· 218 219 && (0x20100 <= cgs_read_ind_register(smumgr->device, CGS_IND_REG__SMC, ixSMC_PC_C))); 219 220 } 220 221 222 + static bool polaris10_is_hw_avfs_present(struct pp_smumgr *smumgr) 223 + { 224 + uint32_t efuse; 225 + 226 + efuse = cgs_read_ind_register(smumgr->device, CGS_IND_REG__SMC, ixSMU_EFUSE_0 + (49*4)); 227 + efuse &= 0x00000001; 228 + if (efuse) 229 + return true; 230 + 231 + return false; 232 + } 233 + 221 234 /** 222 235 * Send a message to the SMC, and wait for its response. 223 236 * ··· 239 228 */ 240 229 int polaris10_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg) 241 230 { 231 + int ret; 232 + 242 233 if (!polaris10_is_smc_ram_running(smumgr)) 243 234 return -1; 244 235 236 + 245 237 SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0); 246 238 247 - if (1 != SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP)) 248 - printk("Failed to send Previous Message.\n"); 239 + ret = SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP); 249 240 241 + if (ret != 1) 242 + printk("\n failed to send pre message %x ret is %d \n", msg, ret); 250 243 251 244 cgs_write_register(smumgr->device, mmSMC_MESSAGE_0, msg); 252 245 253 246 SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0); 254 247 255 - if (1 != SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP)) 256 - printk("Failed to send Message.\n"); 248 + ret = SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP); 249 + 250 + if (ret != 1) 251 + printk("\n failed to send message %x ret is %d \n", msg, ret); 257 252 258 253 return 0; 259 254 } ··· 969 952 cgs_free_gpu_mem(smumgr->device, 970 953 (cgs_handle_t)smu_data->smu_buffer.handle); 971 954 return -1;); 955 + 956 + if (polaris10_is_hw_avfs_present(smumgr)) 957 + smu_data->avfs.avfs_btc_status = AVFS_BTC_BOOT; 958 + else 959 + smu_data->avfs.avfs_btc_status = AVFS_BTC_NOTSUPPORTED; 972 960 973 961 return 0; 974 962 }
+6 -4
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
··· 266 266 if (!ret) 267 267 ret = atmel_hlcdc_check_endpoint(dev, &ep); 268 268 269 - of_node_put(ep_np); 270 - if (ret) 269 + if (ret) { 270 + of_node_put(ep_np); 271 271 return ret; 272 + } 272 273 } 273 274 274 275 for_each_endpoint_of_node(dev->dev->of_node, ep_np) { ··· 277 276 if (!ret) 278 277 ret = atmel_hlcdc_attach_endpoint(dev, &ep); 279 278 280 - of_node_put(ep_np); 281 - if (ret) 279 + if (ret) { 280 + of_node_put(ep_np); 282 281 return ret; 282 + } 283 283 } 284 284 285 285 return 0;
+2
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
··· 339 339 340 340 atmel_hlcdc_layer_update_cfg(&plane->layer, 13, 0xffffffff, 341 341 factor_reg); 342 + } else { 343 + atmel_hlcdc_layer_update_cfg(&plane->layer, 13, 0xffffffff, 0); 342 344 } 343 345 } 344 346
+26 -1
drivers/gpu/drm/drm_atomic.c
··· 1296 1296 */ 1297 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 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 1319 retry: 1302 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 1323 if (ret) 1306 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 1333 EXPORT_SYMBOL(drm_atomic_legacy_backoff); 1309 1334
-1
drivers/gpu/drm/exynos/exynos7_drm_decon.c
··· 31 31 #include "exynos_drm_plane.h" 32 32 #include "exynos_drm_drv.h" 33 33 #include "exynos_drm_fb.h" 34 - #include "exynos_drm_fbdev.h" 35 34 #include "exynos_drm_iommu.h" 36 35 37 36 /*
+3 -2
drivers/gpu/drm/exynos/exynos_dp.c
··· 34 34 35 35 struct exynos_dp_device { 36 36 struct drm_encoder encoder; 37 - struct drm_connector connector; 37 + struct drm_connector *connector; 38 38 struct drm_bridge *ptn_bridge; 39 39 struct drm_device *drm_dev; 40 40 struct device *dev; ··· 70 70 static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data) 71 71 { 72 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 74 struct drm_display_mode *mode; 75 75 int num_modes = 0; 76 76 ··· 103 103 int ret; 104 104 105 105 drm_connector_register(connector); 106 + dp->connector = connector; 106 107 107 108 /* Pre-empt DP connector creation if there's a bridge */ 108 109 if (dp->ptn_bridge) {
-1
drivers/gpu/drm/exynos/exynos_drm_core.c
··· 15 15 #include <drm/drmP.h> 16 16 #include "exynos_drm_drv.h" 17 17 #include "exynos_drm_crtc.h" 18 - #include "exynos_drm_fbdev.h" 19 18 20 19 static LIST_HEAD(exynos_drm_subdrv_list); 21 20
-5
drivers/gpu/drm/exynos/exynos_drm_fimd.c
··· 30 30 31 31 #include "exynos_drm_drv.h" 32 32 #include "exynos_drm_fb.h" 33 - #include "exynos_drm_fbdev.h" 34 33 #include "exynos_drm_crtc.h" 35 34 #include "exynos_drm_plane.h" 36 35 #include "exynos_drm_iommu.h" ··· 119 120 .timing_base = 0x0, 120 121 .has_clksel = 1, 121 122 .has_limited_fmt = 1, 122 - .has_hw_trigger = 1, 123 123 }; 124 124 125 125 static struct fimd_driver_data exynos3_fimd_driver_data = { ··· 169 171 .lcdblk_vt_shift = 24, 170 172 .lcdblk_bypass_shift = 15, 171 173 .lcdblk_mic_bypass_shift = 11, 172 - .trg_type = I80_HW_TRG, 173 174 .has_shadowcon = 1, 174 175 .has_vidoutcon = 1, 175 176 .has_vtsel = 1, 176 177 .has_mic_bypass = 1, 177 178 .has_dp_clk = 1, 178 - .has_hw_trigger = 1, 179 - .has_trigger_per_te = 1, 180 179 }; 181 180 182 181 struct fimd_context {
+6 -6
drivers/gpu/drm/exynos/exynos_drm_g2d.c
··· 48 48 49 49 /* registers for base address */ 50 50 #define G2D_SRC_BASE_ADDR 0x0304 51 - #define G2D_SRC_STRIDE_REG 0x0308 51 + #define G2D_SRC_STRIDE 0x0308 52 52 #define G2D_SRC_COLOR_MODE 0x030C 53 53 #define G2D_SRC_LEFT_TOP 0x0310 54 54 #define G2D_SRC_RIGHT_BOTTOM 0x0314 55 55 #define G2D_SRC_PLANE2_BASE_ADDR 0x0318 56 56 #define G2D_DST_BASE_ADDR 0x0404 57 - #define G2D_DST_STRIDE_REG 0x0408 57 + #define G2D_DST_STRIDE 0x0408 58 58 #define G2D_DST_COLOR_MODE 0x040C 59 59 #define G2D_DST_LEFT_TOP 0x0410 60 60 #define G2D_DST_RIGHT_BOTTOM 0x0414 ··· 563 563 564 564 switch (reg_offset) { 565 565 case G2D_SRC_BASE_ADDR: 566 - case G2D_SRC_STRIDE_REG: 566 + case G2D_SRC_STRIDE: 567 567 case G2D_SRC_COLOR_MODE: 568 568 case G2D_SRC_LEFT_TOP: 569 569 case G2D_SRC_RIGHT_BOTTOM: ··· 573 573 reg_type = REG_TYPE_SRC_PLANE2; 574 574 break; 575 575 case G2D_DST_BASE_ADDR: 576 - case G2D_DST_STRIDE_REG: 576 + case G2D_DST_STRIDE: 577 577 case G2D_DST_COLOR_MODE: 578 578 case G2D_DST_LEFT_TOP: 579 579 case G2D_DST_RIGHT_BOTTOM: ··· 968 968 } else 969 969 buf_info->types[reg_type] = BUF_TYPE_GEM; 970 970 break; 971 - case G2D_SRC_STRIDE_REG: 972 - case G2D_DST_STRIDE_REG: 971 + case G2D_SRC_STRIDE: 972 + case G2D_DST_STRIDE: 973 973 if (for_addr) 974 974 goto err; 975 975
+1 -1
drivers/gpu/drm/exynos/exynos_drm_plane.c
··· 242 242 state->v_ratio == (1 << 15)) 243 243 height_ok = true; 244 244 245 - if (width_ok & height_ok) 245 + if (width_ok && height_ok) 246 246 return 0; 247 247 248 248 DRM_DEBUG_KMS("scaling mode is not supported");
-3
drivers/gpu/drm/i915/intel_dp.c
··· 4977 4977 intel_display_power_get(dev_priv, power_domain); 4978 4978 4979 4979 if (long_hpd) { 4980 - /* indicate that we need to restart link training */ 4981 - intel_dp->train_set_valid = false; 4982 - 4983 4980 intel_dp_long_pulse(intel_dp->attached_connector); 4984 4981 if (intel_dp->is_mst) 4985 4982 ret = IRQ_HANDLED;
-2
drivers/gpu/drm/i915/intel_drv.h
··· 863 863 /* This is called before a link training is starterd */ 864 864 void (*prepare_link_retrain)(struct intel_dp *intel_dp); 865 865 866 - bool train_set_valid; 867 - 868 866 /* Displayport compliance testing */ 869 867 unsigned long compliance_test_type; 870 868 unsigned long compliance_test_data;
+1 -2
drivers/gpu/drm/i915/intel_fbc.c
··· 824 824 { 825 825 struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; 826 826 struct intel_fbc *fbc = &dev_priv->fbc; 827 - bool enable_by_default = IS_HASWELL(dev_priv) || 828 - IS_BROADWELL(dev_priv); 827 + bool enable_by_default = IS_BROADWELL(dev_priv); 829 828 830 829 if (intel_vgpu_active(dev_priv->dev)) { 831 830 fbc->no_fbc_reason = "VGPU is active";
+2 -1
drivers/gpu/drm/nouveau/nouveau_fbcon.c
··· 552 552 if (ret) 553 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 557 return 0; 557 558 558 559 fini:
+1 -1
drivers/gpu/drm/sun4i/Kconfig
··· 1 1 config DRM_SUN4I 2 2 tristate "DRM Support for Allwinner A10 Display Engine" 3 - depends on DRM && ARM 3 + depends on DRM && ARM && COMMON_CLK 4 4 depends on ARCH_SUNXI || COMPILE_TEST 5 5 select DRM_GEM_CMA_HELPER 6 6 select DRM_KMS_HELPER
+2 -2
drivers/gpu/drm/sun4i/sun4i_backend.c
··· 190 190 /* Get the physical address of the buffer in memory */ 191 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 195 /* Compute the start of the displayed memory */ 196 196 bpp = drm_format_plane_cpp(fb->pixel_format, 0); ··· 198 198 paddr += (state->src_x >> 16) * bpp; 199 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 203 /* Write the 32 lower bits of the address (in bits) */ 204 204 lo_paddr = paddr << 3;
+35 -4
drivers/gpu/drm/sun4i/sun4i_dotclock.c
··· 72 72 static long sun4i_dclk_round_rate(struct clk_hw *hw, unsigned long rate, 73 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 104 static int sun4i_dclk_set_rate(struct clk_hw *hw, unsigned long rate, 79 105 unsigned long parent_rate) 80 106 { 81 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 110 return regmap_update_bits(dclk->regmap, SUN4I_TCON0_DCLK_REG, 85 111 GENMASK(6, 0), div); ··· 153 127 const char *clk_name, *parent_name; 154 128 struct clk_init_data init; 155 129 struct sun4i_dclk *dclk; 130 + int ret; 156 131 157 132 parent_name = __clk_get_name(tcon->sclk0); 158 - of_property_read_string_index(dev->of_node, "clock-output-names", 0, 159 - &clk_name); 133 + ret = of_property_read_string_index(dev->of_node, 134 + "clock-output-names", 0, 135 + &clk_name); 136 + if (ret) 137 + return ret; 160 138 161 139 dclk = devm_kzalloc(dev, sizeof(*dclk), GFP_KERNEL); 162 140 if (!dclk) ··· 170 140 init.ops = &sun4i_dclk_ops; 171 141 init.parent_names = &parent_name; 172 142 init.num_parents = 1; 143 + init.flags = CLK_SET_RATE_PARENT; 173 144 174 145 dclk->regmap = tcon->regs; 175 146 dclk->hw.init = &init;
+21 -29
drivers/gpu/drm/sun4i/sun4i_drv.c
··· 24 24 #include "sun4i_layer.h" 25 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 27 static int sun4i_drv_enable_vblank(struct drm_device *drm, unsigned int pipe) 56 28 { 57 29 struct sun4i_drv *drv = drm->dev_private; ··· 97 125 .disable_vblank = sun4i_drv_disable_vblank, 98 126 }; 99 127 128 + static void sun4i_remove_framebuffers(void) 129 + { 130 + struct apertures_struct *ap; 131 + 132 + ap = alloc_apertures(1); 133 + if (!ap) 134 + return; 135 + 136 + /* The framebuffer can be located anywhere in RAM */ 137 + ap->ranges[0].base = 0; 138 + ap->ranges[0].size = ~0; 139 + 140 + remove_conflicting_framebuffers(ap, "sun4i-drm-fb", false); 141 + kfree(ap); 142 + } 143 + 100 144 static int sun4i_drv_bind(struct device *dev) 101 145 { 102 146 struct drm_device *drm; ··· 160 172 } 161 173 drm->irq_enabled = true; 162 174 175 + /* Remove early framebuffers (ie. simplefb) */ 176 + sun4i_remove_framebuffers(); 177 + 163 178 /* Create our framebuffer */ 164 179 drv->fbdev = sun4i_framebuffer_init(drm); 165 180 if (IS_ERR(drv->fbdev)) { ··· 178 187 if (ret) 179 188 goto free_drm; 180 189 181 - ret = sun4i_drv_connector_plug_all(drm); 190 + ret = drm_connector_register_all(drm); 182 191 if (ret) 183 192 goto unregister_drm; 184 193 ··· 195 204 { 196 205 struct drm_device *drm = dev_get_drvdata(dev); 197 206 207 + drm_connector_unregister_all(drm); 198 208 drm_dev_unregister(drm); 199 209 drm_kms_helper_poll_fini(drm); 200 210 sun4i_framebuffer_free(drm);
+15 -1
drivers/gpu/drm/sun4i/sun4i_rgb.c
··· 54 54 static int sun4i_rgb_mode_valid(struct drm_connector *connector, 55 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 60 u32 hsync = mode->hsync_end - mode->hsync_start; 58 61 u32 vsync = mode->vsync_end - mode->vsync_start; 62 + unsigned long rate = mode->clock * 1000; 63 + long rounded_rate; 59 64 60 65 DRM_DEBUG_DRIVER("Validating modes...\n"); 61 66 ··· 91 86 return MODE_BAD_VVALUE; 92 87 93 88 DRM_DEBUG_DRIVER("Vertical parameters OK\n"); 89 + 90 + rounded_rate = clk_round_rate(tcon->dclk, rate); 91 + if (rounded_rate < rate) 92 + return MODE_CLOCK_LOW; 93 + 94 + if (rounded_rate > rate) 95 + return MODE_CLOCK_HIGH; 96 + 97 + DRM_DEBUG_DRIVER("Clock rate OK\n"); 94 98 95 99 return MODE_OK; 96 100 } ··· 217 203 int ret; 218 204 219 205 /* If we don't have a panel, there's no point in going on */ 220 - if (!tcon->panel) 206 + if (IS_ERR(tcon->panel)) 221 207 return -ENODEV; 222 208 223 209 rgb = devm_kzalloc(drm->dev, sizeof(*rgb), GFP_KERNEL);
+14 -9
drivers/gpu/drm/sun4i/sun4i_tcon.c
··· 425 425 426 426 remote = of_graph_get_remote_port_parent(end_node); 427 427 if (!remote) { 428 - DRM_DEBUG_DRIVER("Enable to parse remote node\n"); 428 + DRM_DEBUG_DRIVER("Unable to parse remote node\n"); 429 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 435 static int sun4i_tcon_bind(struct device *dev, struct device *master, ··· 490 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 499 err_free_clocks: 496 500 sun4i_tcon_free_clocks(tcon); ··· 526 522 * Defer the probe. 527 523 */ 528 524 panel = sun4i_tcon_find_panel(node); 529 - if (IS_ERR(panel)) { 530 - /* 531 - * If we don't have a panel endpoint, just go on 532 - */ 533 - if (PTR_ERR(panel) != -ENODEV) 534 - return -EPROBE_DEFER; 525 + 526 + /* 527 + * If we don't have a panel endpoint, just go on 528 + */ 529 + if (PTR_ERR(panel) == -EPROBE_DEFER) { 530 + DRM_DEBUG_DRIVER("Still waiting for our panel. Deferring...\n"); 531 + return -EPROBE_DEFER; 535 532 } 536 533 537 534 return component_add(&pdev->dev, &sun4i_tcon_ops);