Merge tag 'amd-drm-next-5.12-2021-01-20' of https://gitlab.freedesktop.org/agd5f...
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 20 Jan 2021 12:08:18 +0000 (13:08 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 20 Jan 2021 12:08:18 +0000 (13:08 +0100)
amd-drm-next-5.12-2021-01-20:

amdgpu:
- Fix non-x86 build
- W=1 fixes from Lee Jones
- Enable GPU reset on Navy Flounder
- Kernel doc fixes
- SMU workload profile fixes for APUs
- Display updates
- SR-IOV fixes
- Vangogh SMU feature enablment and bug fixes
- GPU reset support for Vangogh
- Misc cleanups

Conflicts:
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c

Resolve the conflict by picking the initialization value from amd from
f03e80d2e82c ("drm/amd/display: Initialize stack variable") over the
one Linus picked in 61d791365b72 ("drm/amd/display: avoid
uninitialized variable warning"). It shouldn't matter.

From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210120060951.22600-1-alexander.deucher@amd.com
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
141 files changed:
MAINTAINERS
drivers/gpu/drm/amd/amdgpu/Makefile
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
drivers/gpu/drm/amd/amdgpu/amdgpu_fw_attestation.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c [new file with mode: 0644]
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.h [new file with mode: 0644]
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c
drivers/gpu/drm/amd/amdgpu/nv.c
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
drivers/gpu/drm/amd/amdgpu/soc15.c
drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h [new file with mode: 0644]
drivers/gpu/drm/amd/amdgpu/vega20_ih.c
drivers/gpu/drm/amd/amdkfd/kfd_crat.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.h
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
drivers/gpu/drm/amd/display/dc/basics/conversion.c
drivers/gpu/drm/amd/display/dc/basics/dc_common.c
drivers/gpu/drm/amd/display/dc/basics/dc_common.h
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
drivers/gpu/drm/amd/display/dc/bios/command_table_helper.c
drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/dcn301_smu.c
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
drivers/gpu/drm/amd/display/dc/core/dc_stream.c
drivers/gpu/drm/amd/display/dc/core/dc_surface.c
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dc_dp_types.h
drivers/gpu/drm/amd/display/dc/dc_helper.c
drivers/gpu/drm/amd/display/dc/dc_link.h
drivers/gpu/drm/amd/display/dc/dc_stream.h
drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.h
drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c
drivers/gpu/drm/amd/display/dc/dce/dce_i2c_sw.c
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
drivers/gpu/drm/amd/display/dc/dce/dce_opp.c
drivers/gpu/drm/amd/display/dc/dce/dce_opp.h
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c
drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
drivers/gpu/drm/amd/display/dc/dce100/Makefile
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
drivers/gpu/drm/amd/display/dc/dce110/Makefile
drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator_v.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.c
drivers/gpu/drm/amd/display/dc/dce112/Makefile
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
drivers/gpu/drm/amd/display/dc/dce120/Makefile
drivers/gpu/drm/amd/display/dc/dce120/dce120_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c
drivers/gpu/drm/amd/display/dc/dce60/Makefile
drivers/gpu/drm/amd/display/dc/dce60/dce60_resource.c
drivers/gpu/drm/amd/display/dc/dce60/dce60_timing_generator.c
drivers/gpu/drm/amd/display/dc/dce80/Makefile
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.h
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dpp_cm.c
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubp.h
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.h
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_init.c
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_optc.c
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
drivers/gpu/drm/amd/display/dc/gpio/diagnostics/hw_factory_diag.c
drivers/gpu/drm/amd/display/dc/gpio/diagnostics/hw_factory_diag.h
drivers/gpu/drm/amd/display/dc/gpio/diagnostics/hw_translate_diag.c
drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c
drivers/gpu/drm/amd/display/dc/inc/core_types.h
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
drivers/gpu/drm/amd/display/dc/irq/irq_service.c
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn30.c
drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c
drivers/gpu/drm/amd/display/modules/power/power_helpers.c
drivers/gpu/drm/amd/include/kgd_pp_interface.h
drivers/gpu/drm/amd/include/renoir_ip_offset.h
drivers/gpu/drm/amd/pm/amdgpu_pm.c
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
drivers/gpu/drm/amd/pm/inc/smu_types.h
drivers/gpu/drm/amd/pm/inc/smu_v11_0.h
drivers/gpu/drm/amd/pm/powerplay/hwmgr/hwmgr.c
drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c
drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.h
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h

index d082757..fd38679 100644 (file)
@@ -907,7 +907,7 @@ AMD KFD
 M:     Felix Kuehling <Felix.Kuehling@amd.com>
 L:     amd-gfx@lists.freedesktop.org
 S:     Supported
-T:     git git://people.freedesktop.org/~agd5f/linux
+T:     git https://gitlab.freedesktop.org/agd5f/linux.git
 F:     drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd*.[ch]
 F:     drivers/gpu/drm/amd/amdkfd/
 F:     drivers/gpu/drm/amd/include/cik_structs.h
@@ -14821,7 +14821,7 @@ M:      Alex Deucher <alexander.deucher@amd.com>
 M:     Christian König <christian.koenig@amd.com>
 L:     amd-gfx@lists.freedesktop.org
 S:     Supported
-T:     git git://people.freedesktop.org/~agd5f/linux
+T:     git https://gitlab.freedesktop.org/agd5f/linux.git
 F:     drivers/gpu/drm/amd/
 F:     drivers/gpu/drm/radeon/
 F:     include/uapi/drm/amdgpu_drm.h
index e74cd44..f8903ab 100644 (file)
@@ -56,7 +56,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \
        amdgpu_gmc.o amdgpu_mmhub.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \
        amdgpu_vm_sdma.o amdgpu_discovery.o amdgpu_ras_eeprom.o amdgpu_nbio.o \
        amdgpu_umc.o smu_v11_0_i2c.o amdgpu_fru_eeprom.o amdgpu_rap.o \
-       amdgpu_fw_attestation.o
+       amdgpu_fw_attestation.o amdgpu_securedisplay.o
 
 amdgpu-$(CONFIG_PERF_EVENTS) += amdgpu_pmu.o
 
index 3060778..6107ac9 100644 (file)
@@ -112,6 +112,7 @@ int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev)
 union igp_info {
        struct atom_integrated_system_info_v1_11 v11;
        struct atom_integrated_system_info_v1_12 v12;
+       struct atom_integrated_system_info_v2_1 v21;
 };
 
 union umc_info {
@@ -209,24 +210,42 @@ amdgpu_atomfirmware_get_vram_info(struct amdgpu_device *adev,
                if (adev->flags & AMD_IS_APU) {
                        igp_info = (union igp_info *)
                                (mode_info->atom_context->bios + data_offset);
-                       switch (crev) {
-                       case 11:
-                               mem_channel_number = igp_info->v11.umachannelnumber;
-                               /* channel width is 64 */
-                               if (vram_width)
-                                       *vram_width = mem_channel_number * 64;
-                               mem_type = igp_info->v11.memorytype;
-                               if (vram_type)
-                                       *vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
+                       switch (frev) {
+                       case 1:
+                               switch (crev) {
+                               case 11:
+                               case 12:
+                                       mem_channel_number = igp_info->v11.umachannelnumber;
+                                       if (!mem_channel_number)
+                                               mem_channel_number = 1;
+                                       /* channel width is 64 */
+                                       if (vram_width)
+                                               *vram_width = mem_channel_number * 64;
+                                       mem_type = igp_info->v11.memorytype;
+                                       if (vram_type)
+                                               *vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
+                                       break;
+                               default:
+                                       return -EINVAL;
+                               }
                                break;
-                       case 12:
-                               mem_channel_number = igp_info->v12.umachannelnumber;
-                               /* channel width is 64 */
-                               if (vram_width)
-                                       *vram_width = mem_channel_number * 64;
-                               mem_type = igp_info->v12.memorytype;
-                               if (vram_type)
-                                       *vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
+                       case 2:
+                               switch (crev) {
+                               case 1:
+                               case 2:
+                                       mem_channel_number = igp_info->v21.umachannelnumber;
+                                       if (!mem_channel_number)
+                                               mem_channel_number = 1;
+                                       /* channel width is 64 */
+                                       if (vram_width)
+                                               *vram_width = mem_channel_number * 64;
+                                       mem_type = igp_info->v21.memorytype;
+                                       if (vram_type)
+                                               *vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
+                                       break;
+                               default:
+                                       return -EINVAL;
+                               }
                                break;
                        default:
                                return -EINVAL;
index c34be9f..0a25fec 100644 (file)
@@ -35,6 +35,7 @@
 #include "amdgpu_dm_debugfs.h"
 #include "amdgpu_ras.h"
 #include "amdgpu_rap.h"
+#include "amdgpu_securedisplay.h"
 #include "amdgpu_fw_attestation.h"
 
 /**
@@ -1669,6 +1670,8 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 
        amdgpu_rap_debugfs_init(adev);
 
+       amdgpu_securedisplay_debugfs_init(adev);
+
        amdgpu_fw_attestation_debugfs_init(adev);
 
        return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
index a10e0dd..bfaa993 100644 (file)
@@ -3119,7 +3119,10 @@ static int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
         */
        adev->gfx_timeout = msecs_to_jiffies(10000);
        adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
-       if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
+       if (amdgpu_sriov_vf(adev))
+               adev->compute_timeout = amdgpu_sriov_is_pp_one_vf(adev) ?
+                                       msecs_to_jiffies(60000) : msecs_to_jiffies(10000);
+       else if (amdgpu_passthrough(adev))
                adev->compute_timeout =  msecs_to_jiffies(60000);
        else
                adev->compute_timeout = MAX_SCHEDULE_TIMEOUT;
@@ -4208,6 +4211,8 @@ bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev)
                case CHIP_NAVI14:
                case CHIP_NAVI12:
                case CHIP_SIENNA_CICHLID:
+               case CHIP_NAVY_FLOUNDER:
+               case CHIP_VANGOGH:
                        break;
                default:
                        goto disabled;
index b4ea67e..effa906 100644 (file)
@@ -1085,6 +1085,8 @@ static const struct pci_device_id pciidlist[] = {
 
        /* Renoir */
        {0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
+       {0x1002, 0x1638, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
+       {0x1002, 0x164C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
 
        /* Navi12 */
        {0x1002, 0x7360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12},
index 7c6e02e..8d1ad29 100644 (file)
@@ -47,10 +47,9 @@ typedef struct FW_ATT_RECORD
        uint16_t AttFwIdV2;              /* V2 FW ID field */
        uint32_t AttFWVersion;           /* FW Version */
        uint16_t AttFWActiveFunctionID;  /* The VF ID (only in VF Attestation Table) */
-       uint16_t AttSource;              /* FW source indicator */
-       uint16_t RecordValid;            /* Indicates whether the record is a valid entry */
-       uint8_t  AttFwTaId;              /* Ta ID (only in TA Attestation Table) */
-       uint8_t  Reserved;
+       uint8_t  AttSource;              /* FW source indicator */
+       uint8_t  RecordValid;            /* Indicates whether the record is a valid entry */
+       uint32_t AttFwTaId;              /* Ta ID (only in TA Attestation Table) */
 } FW_ATT_RECORD;
 
 static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
index 725a9c7..dc852af 100644 (file)
@@ -209,6 +209,8 @@ restart_ih:
  * amdgpu_ih_decode_iv_helper - decode an interrupt vector
  *
  * @adev: amdgpu_device pointer
+ * @ih: ih ring to process
+ * @entry: IV entry
  *
  * Decodes the interrupt vector at the current rptr
  * position and also advance the position for for Vega10
index c2d9d07..839917e 100644 (file)
@@ -36,6 +36,7 @@
 #include "psp_v12_0.h"
 
 #include "amdgpu_ras.h"
+#include "amdgpu_securedisplay.h"
 
 static int psp_sysfs_init(struct amdgpu_device *adev);
 static void psp_sysfs_fini(struct amdgpu_device *adev);
@@ -1652,6 +1653,175 @@ int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
 }
 // RAP end
 
+/* securedisplay start */
+static int psp_securedisplay_init_shared_buf(struct psp_context *psp)
+{
+       int ret;
+
+       /*
+        * Allocate 16k memory aligned to 4k from Frame Buffer (local
+        * physical) for sa ta <-> Driver
+        */
+       ret = amdgpu_bo_create_kernel(psp->adev, PSP_SECUREDISPLAY_SHARED_MEM_SIZE,
+                                     PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
+                                     &psp->securedisplay_context.securedisplay_shared_bo,
+                                     &psp->securedisplay_context.securedisplay_shared_mc_addr,
+                                     &psp->securedisplay_context.securedisplay_shared_buf);
+
+       return ret;
+}
+
+static int psp_securedisplay_load(struct psp_context *psp)
+{
+       int ret;
+       struct psp_gfx_cmd_resp *cmd;
+
+       cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
+       if (!cmd)
+               return -ENOMEM;
+
+       memset(psp->fw_pri_buf, 0, PSP_1_MEG);
+       memcpy(psp->fw_pri_buf, psp->ta_securedisplay_start_addr, psp->ta_securedisplay_ucode_size);
+
+       psp_prep_ta_load_cmd_buf(cmd,
+                                psp->fw_pri_mc_addr,
+                                psp->ta_securedisplay_ucode_size,
+                                psp->securedisplay_context.securedisplay_shared_mc_addr,
+                                PSP_SECUREDISPLAY_SHARED_MEM_SIZE);
+
+       ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
+
+       if (ret)
+               goto failed;
+
+       psp->securedisplay_context.securedisplay_initialized = true;
+       psp->securedisplay_context.session_id = cmd->resp.session_id;
+       mutex_init(&psp->securedisplay_context.mutex);
+
+failed:
+       kfree(cmd);
+       return ret;
+}
+
+static int psp_securedisplay_unload(struct psp_context *psp)
+{
+       int ret;
+       struct psp_gfx_cmd_resp *cmd;
+
+       cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
+       if (!cmd)
+               return -ENOMEM;
+
+       psp_prep_ta_unload_cmd_buf(cmd, psp->securedisplay_context.session_id);
+
+       ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
+
+       kfree(cmd);
+
+       return ret;
+}
+
+static int psp_securedisplay_initialize(struct psp_context *psp)
+{
+       int ret;
+       struct securedisplay_cmd *securedisplay_cmd;
+
+       /*
+        * TODO: bypass the initialize in sriov for now
+        */
+       if (amdgpu_sriov_vf(psp->adev))
+               return 0;
+
+       if (!psp->adev->psp.ta_securedisplay_ucode_size ||
+           !psp->adev->psp.ta_securedisplay_start_addr) {
+               dev_info(psp->adev->dev, "SECUREDISPLAY: securedisplay ta ucode is not available\n");
+               return 0;
+       }
+
+       if (!psp->securedisplay_context.securedisplay_initialized) {
+               ret = psp_securedisplay_init_shared_buf(psp);
+               if (ret)
+                       return ret;
+       }
+
+       ret = psp_securedisplay_load(psp);
+       if (ret)
+               return ret;
+
+       psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd,
+                       TA_SECUREDISPLAY_COMMAND__QUERY_TA);
+
+       ret = psp_securedisplay_invoke(psp, TA_SECUREDISPLAY_COMMAND__QUERY_TA);
+       if (ret) {
+               psp_securedisplay_unload(psp);
+
+               amdgpu_bo_free_kernel(&psp->securedisplay_context.securedisplay_shared_bo,
+                             &psp->securedisplay_context.securedisplay_shared_mc_addr,
+                             &psp->securedisplay_context.securedisplay_shared_buf);
+
+               psp->securedisplay_context.securedisplay_initialized = false;
+
+               dev_err(psp->adev->dev, "SECUREDISPLAY TA initialize fail.\n");
+               return -EINVAL;
+       }
+
+       if (securedisplay_cmd->status != TA_SECUREDISPLAY_STATUS__SUCCESS) {
+               psp_securedisplay_parse_resp_status(psp, securedisplay_cmd->status);
+               dev_err(psp->adev->dev, "SECUREDISPLAY: query securedisplay TA failed. ret 0x%x\n",
+                       securedisplay_cmd->securedisplay_out_message.query_ta.query_cmd_ret);
+       }
+
+       return 0;
+}
+
+static int psp_securedisplay_terminate(struct psp_context *psp)
+{
+       int ret;
+
+       /*
+        * TODO:bypass the terminate in sriov for now
+        */
+       if (amdgpu_sriov_vf(psp->adev))
+               return 0;
+
+       if (!psp->securedisplay_context.securedisplay_initialized)
+               return 0;
+
+       ret = psp_securedisplay_unload(psp);
+       if (ret)
+               return ret;
+
+       psp->securedisplay_context.securedisplay_initialized = false;
+
+       /* free securedisplay shared memory */
+       amdgpu_bo_free_kernel(&psp->securedisplay_context.securedisplay_shared_bo,
+                             &psp->securedisplay_context.securedisplay_shared_mc_addr,
+                             &psp->securedisplay_context.securedisplay_shared_buf);
+
+       return ret;
+}
+
+int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
+{
+       int ret;
+
+       if (!psp->securedisplay_context.securedisplay_initialized)
+               return -EINVAL;
+
+       if (ta_cmd_id != TA_SECUREDISPLAY_COMMAND__QUERY_TA &&
+           ta_cmd_id != TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC)
+               return -EINVAL;
+
+       mutex_lock(&psp->securedisplay_context.mutex);
+
+       ret = psp_ta_invoke(psp, ta_cmd_id, psp->securedisplay_context.session_id);
+
+       mutex_unlock(&psp->securedisplay_context.mutex);
+
+       return ret;
+}
+/* SECUREDISPLAY end */
+
 static int psp_hw_start(struct psp_context *psp)
 {
        struct amdgpu_device *adev = psp->adev;
@@ -2126,6 +2296,11 @@ skip_memalloc:
                if (ret)
                        dev_err(psp->adev->dev,
                                "RAP: Failed to initialize RAP\n");
+
+               ret = psp_securedisplay_initialize(psp);
+               if (ret)
+                       dev_err(psp->adev->dev,
+                               "SECUREDISPLAY: Failed to initialize SECUREDISPLAY\n");
        }
 
        return 0;
@@ -2176,6 +2351,7 @@ static int psp_hw_fini(void *handle)
 
        if (psp->adev->psp.ta_fw) {
                psp_ras_terminate(psp);
+               psp_securedisplay_terminate(psp);
                psp_rap_terminate(psp);
                psp_dtm_terminate(psp);
                psp_hdcp_terminate(psp);
@@ -2240,6 +2416,11 @@ static int psp_suspend(void *handle)
                        DRM_ERROR("Failed to terminate rap ta\n");
                        return ret;
                }
+               ret = psp_securedisplay_terminate(psp);
+               if (ret) {
+                       DRM_ERROR("Failed to terminate securedisplay ta\n");
+                       return ret;
+               }
        }
 
        ret = psp_asd_unload(psp);
@@ -2323,6 +2504,11 @@ static int psp_resume(void *handle)
                if (ret)
                        dev_err(psp->adev->dev,
                                "RAP: Failed to initialize RAP\n");
+
+               ret = psp_securedisplay_initialize(psp);
+               if (ret)
+                       dev_err(psp->adev->dev,
+                               "SECUREDISPLAY: Failed to initialize SECUREDISPLAY\n");
        }
 
        mutex_unlock(&adev->firmware.mutex);
@@ -2629,6 +2815,11 @@ static int parse_ta_bin_descriptor(struct psp_context *psp,
                psp->ta_rap_ucode_size     = le32_to_cpu(desc->size_bytes);
                psp->ta_rap_start_addr     = ucode_start_addr;
                break;
+       case TA_FW_TYPE_PSP_SECUREDISPLAY:
+               psp->ta_securedisplay_ucode_version  = le32_to_cpu(desc->fw_version);
+               psp->ta_securedisplay_ucode_size     = le32_to_cpu(desc->size_bytes);
+               psp->ta_securedisplay_start_addr     = ucode_start_addr;
+               break;
        default:
                dev_warn(psp->adev->dev, "Unsupported TA type: %d\n", desc->fw_type);
                break;
index da250bc..cb50ba4 100644 (file)
@@ -30,6 +30,7 @@
 #include "ta_xgmi_if.h"
 #include "ta_ras_if.h"
 #include "ta_rap_if.h"
+#include "ta_secureDisplay_if.h"
 
 #define PSP_FENCE_BUFFER_SIZE  0x1000
 #define PSP_CMD_BUFFER_SIZE    0x1000
@@ -40,6 +41,7 @@
 #define PSP_HDCP_SHARED_MEM_SIZE       0x4000
 #define PSP_DTM_SHARED_MEM_SIZE        0x4000
 #define PSP_RAP_SHARED_MEM_SIZE        0x4000
+#define PSP_SECUREDISPLAY_SHARED_MEM_SIZE      0x4000
 #define PSP_SHARED_MEM_SIZE            0x4000
 #define PSP_FW_NAME_LEN                0x24
 
@@ -171,6 +173,15 @@ struct psp_rap_context {
        struct mutex            mutex;
 };
 
+struct psp_securedisplay_context {
+       bool                    securedisplay_initialized;
+       uint32_t                session_id;
+       struct amdgpu_bo        *securedisplay_shared_bo;
+       uint64_t                securedisplay_shared_mc_addr;
+       void                    *securedisplay_shared_buf;
+       struct mutex            mutex;
+};
+
 #define MEM_TRAIN_SYSTEM_SIGNATURE             0x54534942
 #define GDDR6_MEM_TRAINING_DATA_SIZE_IN_BYTES  0x1000
 #define GDDR6_MEM_TRAINING_OFFSET              0x8000
@@ -298,12 +309,17 @@ struct psp_context
        uint32_t                        ta_rap_ucode_size;
        uint8_t                         *ta_rap_start_addr;
 
+       uint32_t                        ta_securedisplay_ucode_version;
+       uint32_t                        ta_securedisplay_ucode_size;
+       uint8_t                         *ta_securedisplay_start_addr;
+
        struct psp_asd_context          asd_context;
        struct psp_xgmi_context         xgmi_context;
        struct psp_ras_context          ras;
        struct psp_hdcp_context         hdcp_context;
        struct psp_dtm_context          dtm_context;
        struct psp_rap_context          rap_context;
+       struct psp_securedisplay_context        securedisplay_context;
        struct mutex                    mutex;
        struct psp_memory_training_context mem_train_ctx;
 };
@@ -380,6 +396,7 @@ int psp_ras_trigger_error(struct psp_context *psp,
 int psp_hdcp_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
 int psp_dtm_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
 int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
+int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
 
 int psp_rlc_autoload_start(struct psp_context *psp);
 
index 82e9526..1fb2a91 100644 (file)
@@ -846,7 +846,7 @@ static int amdgpu_ras_error_inject_xgmi(struct amdgpu_device *adev,
        if (amdgpu_dpm_allow_xgmi_power_down(adev, true))
                dev_warn(adev->dev, "Failed to allow XGMI power down");
 
-       if (amdgpu_dpm_set_df_cstate(adev, DF_CSTATE_DISALLOW))
+       if (amdgpu_dpm_set_df_cstate(adev, DF_CSTATE_ALLOW))
                dev_warn(adev->dev, "Failed to allow df cstate");
 
        return ret;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
new file mode 100644 (file)
index 0000000..834440a
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2021 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ */
+#include <linux/debugfs.h>
+#include <linux/pm_runtime.h>
+
+#include "amdgpu.h"
+#include "amdgpu_securedisplay.h"
+
+/**
+ * DOC: AMDGPU SECUREDISPLAY debugfs test interface
+ *
+ * how to use?
+ * echo opcode <value> > <debugfs_dir>/dri/xxx/securedisplay_test
+ * eg. echo 1 > <debugfs_dir>/dri/xxx/securedisplay_test
+ * eg. echo 2 phy_id > <debugfs_dir>/dri/xxx/securedisplay_test
+ *
+ * opcode:
+ * 1:Query whether TA is responding used only for validation pupose
+ * 2: Send region of Interest and CRC value to I2C. (uint32)phy_id is
+ * send to determine which DIO scratch register should be used to get
+ * ROI and receive i2c_buf as the output.
+ *
+ * You can refer more detail from header file ta_securedisplay_if.h
+ *
+ */
+
+void psp_securedisplay_parse_resp_status(struct psp_context *psp,
+       enum ta_securedisplay_status status)
+{
+       switch (status) {
+       case TA_SECUREDISPLAY_STATUS__SUCCESS:
+               break;
+       case TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE:
+               dev_err(psp->adev->dev, "Secure display: Generic Failure.");
+               break;
+       case TA_SECUREDISPLAY_STATUS__INVALID_PARAMETER:
+               dev_err(psp->adev->dev, "Secure display: Invalid Parameter.");
+               break;
+       case TA_SECUREDISPLAY_STATUS__NULL_POINTER:
+               dev_err(psp->adev->dev, "Secure display: Null Pointer.");
+               break;
+       case TA_SECUREDISPLAY_STATUS__I2C_WRITE_ERROR:
+               dev_err(psp->adev->dev, "Secure display: Failed to write to I2C.");
+               break;
+       case TA_SECUREDISPLAY_STATUS__READ_DIO_SCRATCH_ERROR:
+               dev_err(psp->adev->dev, "Secure display: Failed to Read DIO Scratch Register.");
+               break;
+       case TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR:
+               dev_err(psp->adev->dev, "Secure display: Failed to Read CRC");
+               break;
+       default:
+               dev_err(psp->adev->dev, "Secure display: Failed to parse status: %d\n", status);
+       }
+}
+
+void psp_prep_securedisplay_cmd_buf(struct psp_context *psp, struct securedisplay_cmd **cmd,
+       enum ta_securedisplay_command command_id)
+{
+       *cmd = (struct securedisplay_cmd *)psp->securedisplay_context.securedisplay_shared_buf;
+       memset(*cmd, 0, sizeof(struct securedisplay_cmd));
+       (*cmd)->status = TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE;
+       (*cmd)->cmd_id = command_id;
+}
+
+static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __user *buf,
+               size_t size, loff_t *pos)
+{
+       struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
+       struct psp_context *psp = &adev->psp;
+       struct securedisplay_cmd *securedisplay_cmd;
+       struct drm_device *dev = adev_to_drm(adev);
+       uint32_t phy_id;
+       uint32_t op;
+       int i;
+       char str[64];
+       char i2c_output[256];
+       int ret;
+
+       if (*pos || size > sizeof(str) - 1)
+               return -EINVAL;
+
+       memset(str,  0, sizeof(str));
+       ret = copy_from_user(str, buf, size);
+       if (ret)
+               return -EFAULT;
+
+       ret = pm_runtime_get_sync(dev->dev);
+       if (ret < 0) {
+               pm_runtime_put_autosuspend(dev->dev);
+               return ret;
+       }
+
+       if (size < 3)
+               sscanf(str, "%u ", &op);
+       else
+               sscanf(str, "%u %u", &op, &phy_id);
+
+       switch (op) {
+       case 1:
+               psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd,
+                       TA_SECUREDISPLAY_COMMAND__QUERY_TA);
+               ret = psp_securedisplay_invoke(psp, TA_SECUREDISPLAY_COMMAND__QUERY_TA);
+               if (!ret) {
+                       if (securedisplay_cmd->status == TA_SECUREDISPLAY_STATUS__SUCCESS)
+                               dev_info(adev->dev, "SECUREDISPLAY: query securedisplay TA ret is 0x%X\n",
+                                       securedisplay_cmd->securedisplay_out_message.query_ta.query_cmd_ret);
+                       else
+                               psp_securedisplay_parse_resp_status(psp, securedisplay_cmd->status);
+               }
+               break;
+       case 2:
+               psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd,
+                       TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC);
+               securedisplay_cmd->securedisplay_in_message.send_roi_crc.phy_id = phy_id;
+               ret = psp_securedisplay_invoke(psp, TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC);
+               if (!ret) {
+                       if (securedisplay_cmd->status == TA_SECUREDISPLAY_STATUS__SUCCESS) {
+                               memset(i2c_output,  0, sizeof(i2c_output));
+                               for (i = 0; i < TA_SECUREDISPLAY_I2C_BUFFER_SIZE; i++)
+                                       sprintf(i2c_output, "%s 0x%X", i2c_output,
+                                               securedisplay_cmd->securedisplay_out_message.send_roi_crc.i2c_buf[i]);
+                               dev_info(adev->dev, "SECUREDISPLAY: I2C buffer out put is :%s\n", i2c_output);
+                       } else {
+                               psp_securedisplay_parse_resp_status(psp, securedisplay_cmd->status);
+                       }
+               }
+               break;
+       default:
+               dev_err(adev->dev, "Invalid input: %s\n", str);
+       }
+
+       pm_runtime_mark_last_busy(dev->dev);
+       pm_runtime_put_autosuspend(dev->dev);
+
+       return size;
+}
+
+static const struct file_operations amdgpu_securedisplay_debugfs_ops = {
+       .owner = THIS_MODULE,
+       .read = NULL,
+       .write = amdgpu_securedisplay_debugfs_write,
+       .llseek = default_llseek
+};
+
+void amdgpu_securedisplay_debugfs_init(struct amdgpu_device *adev)
+{
+#if defined(CONFIG_DEBUG_FS)
+
+       if (!adev->psp.securedisplay_context.securedisplay_initialized)
+               return;
+
+       debugfs_create_file("securedisplay_test", S_IWUSR, adev_to_drm(adev)->primary->debugfs_root,
+                               adev, &amdgpu_securedisplay_debugfs_ops);
+#endif
+}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.h
new file mode 100644 (file)
index 0000000..fe98574
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2021 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *
+ */
+#ifndef _AMDGPU_SECUREDISPLAY_H
+#define _AMDGPU_SECUREDISPLAY_H
+
+#include "amdgpu.h"
+#include "ta_secureDisplay_if.h"
+
+void amdgpu_securedisplay_debugfs_init(struct amdgpu_device *adev);
+void psp_securedisplay_parse_resp_status(struct psp_context *psp,
+               enum ta_securedisplay_status status);
+void psp_prep_securedisplay_cmd_buf(struct psp_context *psp, struct securedisplay_cmd **cmd,
+               enum ta_securedisplay_command command_id);
+
+#endif
index 0e43b46..46449e7 100644 (file)
@@ -122,6 +122,9 @@ struct ta_firmware_header_v1_0 {
        uint32_t ta_dtm_ucode_version;
        uint32_t ta_dtm_offset_bytes;
        uint32_t ta_dtm_size_bytes;
+       uint32_t ta_securedisplay_ucode_version;
+       uint32_t ta_securedisplay_offset_bytes;
+       uint32_t ta_securedisplay_size_bytes;
 };
 
 enum ta_fw_type {
@@ -132,6 +135,7 @@ enum ta_fw_type {
        TA_FW_TYPE_PSP_HDCP,
        TA_FW_TYPE_PSP_DTM,
        TA_FW_TYPE_PSP_RAP,
+       TA_FW_TYPE_PSP_SECUREDISPLAY,
 };
 
 struct ta_fw_bin_desc {
index 2d51b76..e223fca 100644 (file)
@@ -573,6 +573,7 @@ void amdgpu_virt_fini_data_exchange(struct amdgpu_device *adev)
                DRM_INFO("clean up the vf2pf work item\n");
                flush_delayed_work(&adev->virt.vf2pf_work);
                cancel_delayed_work_sync(&adev->virt.vf2pf_work);
+               adev->virt.vf2pf_update_interval_ms = 0;
        }
 }
 
index 10aae0a..4d3b30a 100644 (file)
 #define mmGCR_GENERAL_CNTL_Sienna_Cichlid                      0x1580
 #define mmGCR_GENERAL_CNTL_Sienna_Cichlid_BASE_IDX     0
 
+#define mmGOLDEN_TSC_COUNT_UPPER_Vangogh                0x0025
+#define mmGOLDEN_TSC_COUNT_UPPER_Vangogh_BASE_IDX       1
+#define mmGOLDEN_TSC_COUNT_LOWER_Vangogh                0x0026
+#define mmGOLDEN_TSC_COUNT_LOWER_Vangogh_BASE_IDX       1
 #define mmSPI_CONFIG_CNTL_1_Vangogh             0x2441
 #define mmSPI_CONFIG_CNTL_1_Vangogh_BASE_IDX    1
 #define mmVGT_TF_MEMORY_BASE_HI_Vangogh          0x2261
 #define mmGCVM_L2_CGTT_CLK_CTRL_Sienna_Cichlid          0x15db
 #define mmGCVM_L2_CGTT_CLK_CTRL_Sienna_Cichlid_BASE_IDX        0
 
+#define mmGC_THROTTLE_CTRL_Sienna_Cichlid              0x2030
+#define mmGC_THROTTLE_CTRL_Sienna_Cichlid_BASE_IDX     0
+
 MODULE_FIRMWARE("amdgpu/navi10_ce.bin");
 MODULE_FIRMWARE("amdgpu/navi10_pfp.bin");
 MODULE_FIRMWARE("amdgpu/navi10_me.bin");
@@ -3323,6 +3330,7 @@ static void gfx_v10_0_ring_emit_de_meta(struct amdgpu_ring *ring, bool resume);
 static void gfx_v10_0_ring_emit_frame_cntl(struct amdgpu_ring *ring, bool start, bool secure);
 static u32 gfx_v10_3_get_disabled_sa(struct amdgpu_device *adev);
 static void gfx_v10_3_program_pbb_mode(struct amdgpu_device *adev);
+static void gfx_v10_3_set_power_brake_sequence(struct amdgpu_device *adev);
 
 static void gfx10_kiq_set_resources(struct amdgpu_ring *kiq_ring, uint64_t queue_mask)
 {
@@ -7191,6 +7199,9 @@ static int gfx_v10_0_hw_init(void *handle)
        if (adev->asic_type == CHIP_SIENNA_CICHLID)
                gfx_v10_3_program_pbb_mode(adev);
 
+       if (adev->asic_type >= CHIP_SIENNA_CICHLID)
+               gfx_v10_3_set_power_brake_sequence(adev);
+
        return r;
 }
 
@@ -7376,8 +7387,16 @@ static uint64_t gfx_v10_0_get_gpu_clock_counter(struct amdgpu_device *adev)
 
        amdgpu_gfx_off_ctrl(adev, false);
        mutex_lock(&adev->gfx.gpu_clock_mutex);
-       clock = (uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_LOWER) |
-               ((uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER) << 32ULL);
+       switch (adev->asic_type) {
+       case CHIP_VANGOGH:
+               clock = (uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_LOWER_Vangogh) |
+                       ((uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER_Vangogh) << 32ULL);
+               break;
+       default:
+               clock = (uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_LOWER) |
+                       ((uint64_t)RREG32_SOC15(SMUIO, 0, mmGOLDEN_TSC_COUNT_UPPER) << 32ULL);
+               break;
+       }
        mutex_unlock(&adev->gfx.gpu_clock_mutex);
        amdgpu_gfx_off_ctrl(adev, true);
        return clock;
@@ -9168,6 +9187,31 @@ static void gfx_v10_3_program_pbb_mode(struct amdgpu_device *adev)
        }
 }
 
+static void gfx_v10_3_set_power_brake_sequence(struct amdgpu_device *adev)
+{
+       WREG32_SOC15(GC, 0, mmGRBM_GFX_INDEX,
+                    (0x1 << GRBM_GFX_INDEX__SA_BROADCAST_WRITES__SHIFT) |
+                    (0x1 << GRBM_GFX_INDEX__INSTANCE_BROADCAST_WRITES__SHIFT) |
+                    (0x1 << GRBM_GFX_INDEX__SE_BROADCAST_WRITES__SHIFT));
+
+       WREG32_SOC15(GC, 0, mmGC_CAC_IND_INDEX, ixPWRBRK_STALL_PATTERN_CTRL);
+       WREG32_SOC15(GC, 0, mmGC_CAC_IND_DATA,
+                    (0x1 << PWRBRK_STALL_PATTERN_CTRL__PWRBRK_STEP_INTERVAL__SHIFT) |
+                    (0x12 << PWRBRK_STALL_PATTERN_CTRL__PWRBRK_BEGIN_STEP__SHIFT) |
+                    (0x13 << PWRBRK_STALL_PATTERN_CTRL__PWRBRK_END_STEP__SHIFT) |
+                    (0xf << PWRBRK_STALL_PATTERN_CTRL__PWRBRK_THROTTLE_PATTERN_BIT_NUMS__SHIFT));
+
+       WREG32_SOC15(GC, 0, mmGC_THROTTLE_CTRL_Sienna_Cichlid,
+                    (0x1 << GC_THROTTLE_CTRL__PWRBRK_STALL_EN__SHIFT) |
+                    (0x1 << GC_THROTTLE_CTRL__PATTERN_MODE__SHIFT) |
+                    (0x5 << GC_THROTTLE_CTRL__RELEASE_STEP_INTERVAL__SHIFT));
+
+       WREG32_SOC15(GC, 0, mmDIDT_IND_INDEX, ixDIDT_SQ_THROTTLE_CTRL);
+
+       WREG32_SOC15(GC, 0, mmDIDT_IND_DATA,
+                    (0x1 << DIDT_SQ_THROTTLE_CTRL__PWRBRK_STALL_EN__SHIFT));
+}
+
 const struct amdgpu_ip_block_version gfx_v10_0_ip_block =
 {
        .type = AMD_IP_BLOCK_TYPE_GFX,
index 7767ccc..3ee4815 100644 (file)
@@ -255,6 +255,7 @@ static void xgpu_ai_mailbox_flr_work(struct work_struct *work)
        if (!down_read_trylock(&adev->reset_sem))
                return;
 
+       amdgpu_virt_fini_data_exchange(adev);
        atomic_set(&adev->in_gpu_reset, 1);
 
        do {
index dd5c1e6..48e588d 100644 (file)
@@ -276,6 +276,7 @@ static void xgpu_nv_mailbox_flr_work(struct work_struct *work)
        if (!down_read_trylock(&adev->reset_sem))
                return;
 
+       amdgpu_virt_fini_data_exchange(adev);
        atomic_set(&adev->in_gpu_reset, 1);
 
        do {
index 1d785f0..b972228 100644 (file)
@@ -335,6 +335,38 @@ static int nv_asic_mode1_reset(struct amdgpu_device *adev)
        return ret;
 }
 
+static int nv_asic_mode2_reset(struct amdgpu_device *adev)
+{
+       u32 i;
+       int ret = 0;
+
+       amdgpu_atombios_scratch_regs_engine_hung(adev, true);
+
+       /* disable BM */
+       pci_clear_master(adev->pdev);
+
+       amdgpu_device_cache_pci_state(adev->pdev);
+
+       ret = amdgpu_dpm_mode2_reset(adev);
+       if (ret)
+               dev_err(adev->dev, "GPU mode2 reset failed\n");
+
+       amdgpu_device_load_pci_state(adev->pdev);
+
+       /* wait for asic to come out of reset */
+       for (i = 0; i < adev->usec_timeout; i++) {
+               u32 memsize = adev->nbio.funcs->get_memsize(adev);
+
+               if (memsize != 0xffffffff)
+                       break;
+               udelay(1);
+       }
+
+       amdgpu_atombios_scratch_regs_engine_hung(adev, false);
+
+       return ret;
+}
+
 static bool nv_asic_supports_baco(struct amdgpu_device *adev)
 {
        struct smu_context *smu = &adev->smu;
@@ -351,6 +383,7 @@ nv_asic_reset_method(struct amdgpu_device *adev)
        struct smu_context *smu = &adev->smu;
 
        if (amdgpu_reset_method == AMD_RESET_METHOD_MODE1 ||
+           amdgpu_reset_method == AMD_RESET_METHOD_MODE2 ||
            amdgpu_reset_method == AMD_RESET_METHOD_BACO)
                return amdgpu_reset_method;
 
@@ -359,6 +392,8 @@ nv_asic_reset_method(struct amdgpu_device *adev)
                                  amdgpu_reset_method);
 
        switch (adev->asic_type) {
+       case CHIP_VANGOGH:
+               return AMD_RESET_METHOD_MODE2;
        case CHIP_SIENNA_CICHLID:
        case CHIP_NAVY_FLOUNDER:
        case CHIP_DIMGREY_CAVEFISH:
@@ -376,7 +411,8 @@ static int nv_asic_reset(struct amdgpu_device *adev)
        int ret = 0;
        struct smu_context *smu = &adev->smu;
 
-       if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
+       switch (nv_asic_reset_method(adev)) {
+       case AMD_RESET_METHOD_BACO:
                dev_info(adev->dev, "BACO reset\n");
 
                ret = smu_baco_enter(smu);
@@ -385,9 +421,15 @@ static int nv_asic_reset(struct amdgpu_device *adev)
                ret = smu_baco_exit(smu);
                if (ret)
                        return ret;
-       } else {
+               break;
+       case AMD_RESET_METHOD_MODE2:
+               dev_info(adev->dev, "MODE2 reset\n");
+               ret = nv_asic_mode2_reset(adev);
+               break;
+       default:
                dev_info(adev->dev, "MODE1 reset\n");
                ret = nv_asic_mode1_reset(adev);
+               break;
        }
 
        return ret;
index d7f9263..4b1cc5e 100644 (file)
@@ -92,8 +92,6 @@ static int psp_v10_0_init_microcode(struct psp_context *psp)
                        (uint8_t *)ta_hdr +
                        le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
 
-               adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
-
                adev->psp.ta_dtm_ucode_version =
                        le32_to_cpu(ta_hdr->ta_dtm_ucode_version);
                adev->psp.ta_dtm_ucode_size =
@@ -101,6 +99,16 @@ static int psp_v10_0_init_microcode(struct psp_context *psp)
                adev->psp.ta_dtm_start_addr =
                        (uint8_t *)adev->psp.ta_hdcp_start_addr +
                        le32_to_cpu(ta_hdr->ta_dtm_offset_bytes);
+
+               adev->psp.ta_securedisplay_ucode_version =
+                       le32_to_cpu(ta_hdr->ta_securedisplay_ucode_version);
+               adev->psp.ta_securedisplay_ucode_size =
+                       le32_to_cpu(ta_hdr->ta_securedisplay_size_bytes);
+               adev->psp.ta_securedisplay_start_addr =
+                       (uint8_t *)adev->psp.ta_hdcp_start_addr +
+                       le32_to_cpu(ta_hdr->ta_securedisplay_offset_bytes);
+
+               adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);
        }
 
        return 0;
index 9a25acc..2396be1 100644 (file)
@@ -1204,7 +1204,8 @@ static int soc15_common_early_init(void *handle)
                break;
        case CHIP_RENOIR:
                adev->asic_funcs = &soc15_asic_funcs;
-               if (adev->pdev->device == 0x1636)
+               if ((adev->pdev->device == 0x1636) ||
+                   (adev->pdev->device == 0x164c))
                        adev->apu_flags |= AMD_APU_IS_RENOIR;
                else
                        adev->apu_flags |= AMD_APU_IS_GREEN_SARDINE;
diff --git a/drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h b/drivers/gpu/drm/amd/amdgpu/ta_secureDisplay_if.h
new file mode 100644 (file)
index 0000000..5039375
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2019 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef _TA_SECUREDISPLAY_IF_H
+#define _TA_SECUREDISPLAY_IF_H
+
+/** Secure Display related enumerations */
+/**********************************************************/
+
+/** @enum ta_securedisplay_command
+ *    Secure Display Command ID
+ */
+enum ta_securedisplay_command {
+       /* Query whether TA is responding used only for validation purpose */
+       TA_SECUREDISPLAY_COMMAND__QUERY_TA              = 1,
+       /* Send region of Interest and CRC value to I2C */
+       TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC          = 2,
+       /* Maximum Command ID */
+       TA_SECUREDISPLAY_COMMAND__MAX_ID                = 0x7FFFFFFF,
+};
+
+/** @enum ta_securedisplay_status
+ *    Secure Display status returns in shared buffer status
+ */
+enum ta_securedisplay_status {
+       TA_SECUREDISPLAY_STATUS__SUCCESS                 = 0x00,         /* Success */
+       TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE         = 0x01,         /* Generic Failure */
+       TA_SECUREDISPLAY_STATUS__INVALID_PARAMETER       = 0x02,         /* Invalid Parameter */
+       TA_SECUREDISPLAY_STATUS__NULL_POINTER            = 0x03,         /* Null Pointer*/
+       TA_SECUREDISPLAY_STATUS__I2C_WRITE_ERROR         = 0x04,         /* Fail to Write to I2C */
+       TA_SECUREDISPLAY_STATUS__READ_DIO_SCRATCH_ERROR  = 0x05, /*Fail Read DIO Scratch Register*/
+       TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR          = 0x06,         /* Fail to Read CRC*/
+
+       TA_SECUREDISPLAY_STATUS__MAX                     = 0x7FFFFFFF,/* Maximum Value for status*/
+};
+
+/** @enum ta_securedisplay_max_phy
+ *    Physical ID number to use for reading corresponding DIO Scratch register for ROI
+ */
+enum  ta_securedisplay_max_phy {
+       TA_SECUREDISPLAY_PHY0                           = 0,
+       TA_SECUREDISPLAY_PHY1                           = 1,
+       TA_SECUREDISPLAY_PHY2                           = 2,
+       TA_SECUREDISPLAY_PHY3                           = 3,
+       TA_SECUREDISPLAY_MAX_PHY                        = 4,
+};
+
+/** @enum ta_securedisplay_ta_query_cmd_ret
+ *    A predefined specific reteurn value which is 0xAB only used to validate
+ *    communication to Secure Display TA is functional.
+ *    This value is used to validate whether TA is responding successfully
+ */
+enum ta_securedisplay_ta_query_cmd_ret {
+       /* This is a value to validate if TA is loaded successfully */
+       TA_SECUREDISPLAY_QUERY_CMD_RET                 = 0xAB,
+};
+
+/** @enum ta_securedisplay_buffer_size
+ *    I2C Buffer size which contains 8 bytes of ROI  (X start, X end, Y start, Y end)
+ *    and 6 bytes of CRC( R,G,B) and 1  byte for physical ID
+ */
+enum ta_securedisplay_buffer_size {
+       /* 15 bytes = 8 byte (ROI) + 6 byte(CRC) + 1 byte(phy_id) */
+       TA_SECUREDISPLAY_I2C_BUFFER_SIZE                = 15,
+};
+
+/** Input/output structures for Secure Display commands */
+/**********************************************************/
+/**
+ * Input structures
+ */
+
+/** @struct ta_securedisplay_send_roi_crc_input
+ *    Physical ID to determine which DIO scratch register should be used to get ROI
+ */
+struct ta_securedisplay_send_roi_crc_input {
+       uint32_t  phy_id;  /* Physical ID */
+};
+
+/** @union ta_securedisplay_cmd_input
+ *    Input buffer
+ */
+union ta_securedisplay_cmd_input {
+       /* send ROI and CRC input buffer format */
+       struct ta_securedisplay_send_roi_crc_input        send_roi_crc;
+       uint32_t                                          reserved[4];
+};
+
+/**
+ * Output structures
+ */
+
+/** @struct ta_securedisplay_query_ta_output
+ *  Output buffer format for query TA whether TA is responding used only for validation purpose
+ */
+struct ta_securedisplay_query_ta_output {
+       /* return value from TA when it is queried for validation purpose only */
+       uint32_t  query_cmd_ret;
+};
+
+/** @struct ta_securedisplay_send_roi_crc_output
+ *  Output buffer format for send ROI CRC command which will pass I2c buffer created inside TA
+ *  and used to write to I2C used only for validation purpose
+ */
+struct ta_securedisplay_send_roi_crc_output {
+       uint8_t  i2c_buf[TA_SECUREDISPLAY_I2C_BUFFER_SIZE];  /* I2C buffer */
+       uint8_t  reserved;
+};
+
+/** @union ta_securedisplay_cmd_output
+ *    Output buffer
+ */
+union ta_securedisplay_cmd_output {
+       /* Query TA output buffer format used only for validation purpose*/
+       struct ta_securedisplay_query_ta_output            query_ta;
+       /* Send ROI CRC output buffer format used only for validation purpose */
+       struct ta_securedisplay_send_roi_crc_output        send_roi_crc;
+       uint32_t                                           reserved[4];
+};
+
+/** @struct securedisplay_cmd
+ *    Secure Display Command which is shared buffer memory
+ */
+struct securedisplay_cmd {
+       uint32_t                             cmd_id;                    /* +0  Bytes Command ID */
+       enum ta_securedisplay_status         status;     /* +4  Bytes Status of Secure Display TA */
+       uint32_t                             reserved[2];               /* +8  Bytes Reserved */
+       union ta_securedisplay_cmd_input     securedisplay_in_message;  /* +16 Bytes Input Buffer */
+       union ta_securedisplay_cmd_output    securedisplay_out_message;/* +32 Bytes Output Buffer */
+       /**@note Total 48 Bytes */
+};
+
+#endif   //_TA_SECUREDISPLAY_IF_H
+
index 42032ca..5a3c867 100644 (file)
@@ -88,7 +88,7 @@ static void vega20_ih_init_register_offset(struct amdgpu_device *adev)
  * vega20_ih_toggle_ring_interrupts - toggle the interrupt ring buffer
  *
  * @adev: amdgpu_device pointer
- * @ih: amdgpu_ih_ring pointet
+ * @ih: amdgpu_ih_ring pointer
  * @enable: true - enable the interrupts, false - disable the interrupts
  *
  * Toggle the interrupt ring buffer (VEGA20)
@@ -367,6 +367,7 @@ static void vega20_ih_irq_disable(struct amdgpu_device *adev)
  * vega20_ih_get_wptr - get the IH ring buffer wptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: amdgpu_ih_ring pointer
  *
  * Get the IH ring buffer wptr from either the register
  * or the writeback memory buffer (VEGA20).  Also check for
@@ -414,6 +415,7 @@ out:
  * vega20_ih_irq_rearm - rearm IRQ if lost
  *
  * @adev: amdgpu_device pointer
+ * @ih: amdgpu_ih_ring pointer
  *
  */
 static void vega20_ih_irq_rearm(struct amdgpu_device *adev,
@@ -439,6 +441,7 @@ static void vega20_ih_irq_rearm(struct amdgpu_device *adev,
  * vega20_ih_set_rptr - set the IH ring buffer rptr
  *
  * @adev: amdgpu_device pointer
+ * @ih: amdgpu_ih_ring pointer
  *
  * Set the IH ring buffer rptr.
  */
index 8cac497..a5640a6 100644 (file)
@@ -1040,11 +1040,14 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size)
                                (struct crat_subtype_iolink *)sub_type_hdr);
                if (ret < 0)
                        return ret;
-               crat_table->length += (sub_type_hdr->length * entries);
-               crat_table->total_entries += entries;
 
-               sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr +
-                               sub_type_hdr->length * entries);
+               if (entries) {
+                       crat_table->length += (sub_type_hdr->length * entries);
+                       crat_table->total_entries += entries;
+
+                       sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr +
+                                       sub_type_hdr->length * entries);
+               }
 #else
                pr_info("IO link not available for non x86 platforms\n");
 #endif
index 6bd495d..c64e469 100644 (file)
@@ -938,41 +938,6 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_
 }
 #endif
 
-#ifdef CONFIG_DEBUG_FS
-static int create_crtc_crc_properties(struct amdgpu_display_manager *dm)
-{
-       dm->crc_win_x_start_property =
-               drm_property_create_range(adev_to_drm(dm->adev),
-                                         DRM_MODE_PROP_ATOMIC,
-                                         "AMD_CRC_WIN_X_START", 0, U16_MAX);
-       if (!dm->crc_win_x_start_property)
-               return -ENOMEM;
-
-       dm->crc_win_y_start_property =
-               drm_property_create_range(adev_to_drm(dm->adev),
-                                         DRM_MODE_PROP_ATOMIC,
-                                         "AMD_CRC_WIN_Y_START", 0, U16_MAX);
-       if (!dm->crc_win_y_start_property)
-               return -ENOMEM;
-
-       dm->crc_win_x_end_property =
-               drm_property_create_range(adev_to_drm(dm->adev),
-                                         DRM_MODE_PROP_ATOMIC,
-                                         "AMD_CRC_WIN_X_END", 0, U16_MAX);
-       if (!dm->crc_win_x_end_property)
-               return -ENOMEM;
-
-       dm->crc_win_y_end_property =
-               drm_property_create_range(adev_to_drm(dm->adev),
-                                         DRM_MODE_PROP_ATOMIC,
-                                         "AMD_CRC_WIN_Y_END", 0, U16_MAX);
-       if (!dm->crc_win_y_end_property)
-               return -ENOMEM;
-
-       return 0;
-}
-#endif
-
 static int amdgpu_dm_init(struct amdgpu_device *adev)
 {
        struct dc_init_data init_data;
@@ -1120,10 +1085,6 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
                dc_init_callbacks(adev->dm.dc, &init_params);
        }
 #endif
-#ifdef CONFIG_DEBUG_FS
-       if (create_crtc_crc_properties(&adev->dm))
-               DRM_ERROR("amdgpu: failed to create crc property.\n");
-#endif
        if (amdgpu_dm_initialize_drm_device(adev)) {
                DRM_ERROR(
                "amdgpu: failed to initialize sw for display support.\n");
@@ -1816,6 +1777,11 @@ static int dm_suspend(void *handle)
 
        if (amdgpu_in_reset(adev)) {
                mutex_lock(&dm->dc_lock);
+
+#if defined(CONFIG_DRM_AMD_DC_DCN)
+               dc_allow_idle_optimizations(adev->dm.dc, false);
+#endif
+
                dm->cached_dc_state = dc_copy_state(dm->dc->current_state);
 
                dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false);
@@ -5383,64 +5349,12 @@ dm_crtc_duplicate_state(struct drm_crtc *crtc)
        state->crc_src = cur->crc_src;
        state->cm_has_degamma = cur->cm_has_degamma;
        state->cm_is_degamma_srgb = cur->cm_is_degamma_srgb;
-#ifdef CONFIG_DEBUG_FS
-       state->crc_window = cur->crc_window;
-#endif
+
        /* TODO Duplicate dc_stream after objects are stream object is flattened */
 
        return &state->base;
 }
 
-#ifdef CONFIG_DEBUG_FS
-static int amdgpu_dm_crtc_atomic_set_property(struct drm_crtc *crtc,
-                                           struct drm_crtc_state *crtc_state,
-                                           struct drm_property *property,
-                                           uint64_t val)
-{
-       struct drm_device *dev = crtc->dev;
-       struct amdgpu_device *adev = drm_to_adev(dev);
-       struct dm_crtc_state *dm_new_state =
-               to_dm_crtc_state(crtc_state);
-
-       if (property == adev->dm.crc_win_x_start_property)
-               dm_new_state->crc_window.x_start = val;
-       else if (property == adev->dm.crc_win_y_start_property)
-               dm_new_state->crc_window.y_start = val;
-       else if (property == adev->dm.crc_win_x_end_property)
-               dm_new_state->crc_window.x_end = val;
-       else if (property == adev->dm.crc_win_y_end_property)
-               dm_new_state->crc_window.y_end = val;
-       else
-               return -EINVAL;
-
-       return 0;
-}
-
-static int amdgpu_dm_crtc_atomic_get_property(struct drm_crtc *crtc,
-                                           const struct drm_crtc_state *state,
-                                           struct drm_property *property,
-                                           uint64_t *val)
-{
-       struct drm_device *dev = crtc->dev;
-       struct amdgpu_device *adev = drm_to_adev(dev);
-       struct dm_crtc_state *dm_state =
-               to_dm_crtc_state(state);
-
-       if (property == adev->dm.crc_win_x_start_property)
-               *val = dm_state->crc_window.x_start;
-       else if (property == adev->dm.crc_win_y_start_property)
-               *val = dm_state->crc_window.y_start;
-       else if (property == adev->dm.crc_win_x_end_property)
-               *val = dm_state->crc_window.x_end;
-       else if (property == adev->dm.crc_win_y_end_property)
-               *val = dm_state->crc_window.y_end;
-       else
-               return -EINVAL;
-
-       return 0;
-}
-#endif
-
 static inline int dm_set_vupdate_irq(struct drm_crtc *crtc, bool enable)
 {
        enum dc_irq_source irq_source;
@@ -5483,6 +5397,10 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)
        if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))
                return -EBUSY;
 
+#if defined(CONFIG_DRM_AMD_DC_DCN)
+       if (amdgpu_in_reset(adev))
+               return 0;
+
        mutex_lock(&dm->dc_lock);
 
        if (enable)
@@ -5499,6 +5417,7 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)
 
        mutex_unlock(&dm->dc_lock);
 
+#endif
        return 0;
 }
 
@@ -5527,10 +5446,6 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
        .enable_vblank = dm_enable_vblank,
        .disable_vblank = dm_disable_vblank,
        .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
-#ifdef CONFIG_DEBUG_FS
-       .atomic_set_property = amdgpu_dm_crtc_atomic_set_property,
-       .atomic_get_property = amdgpu_dm_crtc_atomic_get_property,
-#endif
 };
 
 static enum drm_connector_status
@@ -6746,25 +6661,6 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
        return 0;
 }
 
-#ifdef CONFIG_DEBUG_FS
-static void attach_crtc_crc_properties(struct amdgpu_display_manager *dm,
-                               struct amdgpu_crtc *acrtc)
-{
-       drm_object_attach_property(&acrtc->base.base,
-                                  dm->crc_win_x_start_property,
-                                  0);
-       drm_object_attach_property(&acrtc->base.base,
-                                  dm->crc_win_y_start_property,
-                                  0);
-       drm_object_attach_property(&acrtc->base.base,
-                                  dm->crc_win_x_end_property,
-                                  0);
-       drm_object_attach_property(&acrtc->base.base,
-                                  dm->crc_win_y_end_property,
-                                  0);
-}
-#endif
-
 static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
                               struct drm_plane *plane,
                               uint32_t crtc_index)
@@ -6812,9 +6708,7 @@ static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
        drm_crtc_enable_color_mgmt(&acrtc->base, MAX_COLOR_LUT_ENTRIES,
                                   true, MAX_COLOR_LUT_ENTRIES);
        drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LEGACY_LUT_ENTRIES);
-#ifdef CONFIG_DEBUG_FS
-       attach_crtc_crc_properties(dm, acrtc);
-#endif
+
        return 0;
 
 fail:
@@ -8451,7 +8345,6 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
         */
        for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
                struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
-               bool configure_crc = false;
 
                dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
 
@@ -8461,27 +8354,20 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
                        dc_stream_retain(dm_new_crtc_state->stream);
                        acrtc->dm_irq_params.stream = dm_new_crtc_state->stream;
                        manage_dm_interrupts(adev, acrtc, true);
-               }
-               if (IS_ENABLED(CONFIG_DEBUG_FS) && new_crtc_state->active &&
-                       amdgpu_dm_is_valid_crc_source(dm_new_crtc_state->crc_src)) {
+
+#ifdef CONFIG_DEBUG_FS
                        /**
                         * Frontend may have changed so reapply the CRC capture
                         * settings for the stream.
                         */
                        dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
-                       dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
-
-                       if (amdgpu_dm_crc_window_is_default(dm_new_crtc_state)) {
-                               if (!old_crtc_state->active || drm_atomic_crtc_needs_modeset(new_crtc_state))
-                                       configure_crc = true;
-                       } else {
-                               if (amdgpu_dm_crc_window_changed(dm_new_crtc_state, dm_old_crtc_state))
-                                       configure_crc = true;
-                       }
 
-                       if (configure_crc)
+                       if (amdgpu_dm_is_valid_crc_source(dm_new_crtc_state->crc_src)) {
                                amdgpu_dm_crtc_configure_crc_source(
-                                       crtc, dm_new_crtc_state, dm_new_crtc_state->crc_src);
+                                       crtc, dm_new_crtc_state,
+                                       dm_new_crtc_state->crc_src);
+                       }
+#endif
                }
        }
 
index f084e2f..f72930c 100644 (file)
 /* Forward declarations */
 struct amdgpu_device;
 struct drm_device;
-struct amdgpu_dm_irq_handler_data;
 struct dc;
 struct amdgpu_bo;
 struct dmub_srv;
+struct dc_plane_state;
 
 struct common_irq_params {
        struct amdgpu_device *adev;
@@ -337,38 +337,12 @@ struct amdgpu_display_manager {
        const struct gpu_info_soc_bounding_box_v1_0 *soc_bounding_box;
 
        /**
-        * @active_vblank_irq_count
+        * @active_vblank_irq_count:
         *
         * number of currently active vblank irqs
         */
        uint32_t active_vblank_irq_count;
 
-#ifdef CONFIG_DEBUG_FS
-       /**
-        * @crc_win_x_start_property:
-        *
-        * X start of the crc calculation window
-        */
-       struct drm_property *crc_win_x_start_property;
-       /**
-        * @crc_win_y_start_property:
-        *
-        * Y start of the crc calculation window
-        */
-       struct drm_property *crc_win_y_start_property;
-       /**
-        * @crc_win_x_end_property:
-        *
-        * X end of the crc calculation window
-        */
-       struct drm_property *crc_win_x_end_property;
-       /**
-        * @crc_win_y_end_property:
-        *
-        * Y end of the crc calculation window
-        */
-       struct drm_property *crc_win_y_end_property;
-#endif
        /**
         * @mst_encoders:
         *
@@ -445,25 +419,11 @@ struct amdgpu_dm_connector {
 
 extern const struct amdgpu_ip_block_version dm_ip_block;
 
-struct amdgpu_framebuffer;
-struct amdgpu_display_manager;
-struct dc_validation_set;
-struct dc_plane_state;
-
 struct dm_plane_state {
        struct drm_plane_state base;
        struct dc_plane_state *dc_state;
 };
 
-#ifdef CONFIG_DEBUG_FS
-struct crc_rec {
-       uint16_t x_start;
-       uint16_t y_start;
-       uint16_t x_end;
-       uint16_t y_end;
-       };
-#endif
-
 struct dm_crtc_state {
        struct drm_crtc_state base;
        struct dc_stream_state *stream;
@@ -486,9 +446,6 @@ struct dm_crtc_state {
        struct dc_info_packet vrr_infopacket;
 
        int abm_level;
-#ifdef CONFIG_DEBUG_FS
-       struct crc_rec crc_window;
-#endif
 };
 
 #define to_dm_crtc_state(x) container_of(x, struct dm_crtc_state, base)
index 7b886a7..66cb873 100644 (file)
@@ -81,41 +81,6 @@ const char *const *amdgpu_dm_crtc_get_crc_sources(struct drm_crtc *crtc,
        return pipe_crc_sources;
 }
 
-static void amdgpu_dm_set_crc_window_default(struct dm_crtc_state *dm_crtc_state)
-{
-       dm_crtc_state->crc_window.x_start = 0;
-       dm_crtc_state->crc_window.y_start = 0;
-       dm_crtc_state->crc_window.x_end = 0;
-       dm_crtc_state->crc_window.y_end = 0;
-}
-
-bool amdgpu_dm_crc_window_is_default(struct dm_crtc_state *dm_crtc_state)
-{
-       bool ret = true;
-
-       if ((dm_crtc_state->crc_window.x_start != 0) ||
-               (dm_crtc_state->crc_window.y_start != 0) ||
-               (dm_crtc_state->crc_window.x_end != 0) ||
-               (dm_crtc_state->crc_window.y_end != 0))
-               ret = false;
-
-       return ret;
-}
-
-bool amdgpu_dm_crc_window_changed(struct dm_crtc_state *dm_new_crtc_state,
-                                       struct dm_crtc_state *dm_old_crtc_state)
-{
-       bool ret = false;
-
-       if ((dm_new_crtc_state->crc_window.x_start != dm_old_crtc_state->crc_window.x_start) ||
-               (dm_new_crtc_state->crc_window.y_start != dm_old_crtc_state->crc_window.y_start) ||
-               (dm_new_crtc_state->crc_window.x_end != dm_old_crtc_state->crc_window.x_end) ||
-               (dm_new_crtc_state->crc_window.y_end != dm_old_crtc_state->crc_window.y_end))
-               ret = true;
-
-       return ret;
-}
-
 int
 amdgpu_dm_crtc_verify_crc_source(struct drm_crtc *crtc, const char *src_name,
                                 size_t *values_cnt)
@@ -140,7 +105,6 @@ int amdgpu_dm_crtc_configure_crc_source(struct drm_crtc *crtc,
        struct dc_stream_state *stream_state = dm_crtc_state->stream;
        bool enable = amdgpu_dm_is_valid_crc_source(source);
        int ret = 0;
-       struct crc_params *crc_window = NULL, tmp_window;
 
        /* Configuration will be deferred to stream enable. */
        if (!stream_state)
@@ -150,24 +114,8 @@ int amdgpu_dm_crtc_configure_crc_source(struct drm_crtc *crtc,
 
        /* Enable CRTC CRC generation if necessary. */
        if (dm_is_crc_source_crtc(source) || source == AMDGPU_DM_PIPE_CRC_SOURCE_NONE) {
-               if (!enable)
-                       amdgpu_dm_set_crc_window_default(dm_crtc_state);
-
-               if (!amdgpu_dm_crc_window_is_default(dm_crtc_state)) {
-                       crc_window = &tmp_window;
-
-                       tmp_window.windowa_x_start = dm_crtc_state->crc_window.x_start;
-                       tmp_window.windowa_y_start = dm_crtc_state->crc_window.y_start;
-                       tmp_window.windowa_x_end = dm_crtc_state->crc_window.x_end;
-                       tmp_window.windowa_y_end = dm_crtc_state->crc_window.y_end;
-                       tmp_window.windowb_x_start = dm_crtc_state->crc_window.x_start;
-                       tmp_window.windowb_y_start = dm_crtc_state->crc_window.y_start;
-                       tmp_window.windowb_x_end = dm_crtc_state->crc_window.x_end;
-                       tmp_window.windowb_y_end = dm_crtc_state->crc_window.y_end;
-               }
-
                if (!dc_stream_configure_crc(stream_state->ctx->dc,
-                                            stream_state, crc_window, enable, enable)) {
+                                            stream_state, NULL, enable, enable)) {
                        ret = -EINVAL;
                        goto unlock;
                }
index eba2f1d..f7d7317 100644 (file)
@@ -46,13 +46,10 @@ static inline bool amdgpu_dm_is_valid_crc_source(enum amdgpu_dm_pipe_crc_source
 }
 
 /* amdgpu_dm_crc.c */
-bool amdgpu_dm_crc_window_is_default(struct dm_crtc_state *dm_crtc_state);
-bool amdgpu_dm_crc_window_changed(struct dm_crtc_state *dm_new_crtc_state,
-                                       struct dm_crtc_state *dm_old_crtc_state);
+#ifdef CONFIG_DEBUG_FS
 int amdgpu_dm_crtc_configure_crc_source(struct drm_crtc *crtc,
                                        struct dm_crtc_state *dm_crtc_state,
                                        enum amdgpu_dm_pipe_crc_source source);
-#ifdef CONFIG_DEBUG_FS
 int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name);
 int amdgpu_dm_crtc_verify_crc_source(struct drm_crtc *crtc,
                                     const char *src_name,
index 11459fb..d645f3e 100644 (file)
@@ -691,7 +691,7 @@ static ssize_t dp_phy_test_pattern_debugfs_write(struct file *f, const char __us
        return size;
 }
 
-/**
+/*
  * Returns the DMCUB tracebuffer contents.
  * Example usage: cat /sys/kernel/debug/dri/0/amdgpu_dm_dmub_tracebuffer
  */
@@ -735,7 +735,7 @@ static int dmub_tracebuffer_show(struct seq_file *m, void *data)
        return 0;
 }
 
-/**
+/*
  * Returns the DMCUB firmware state contents.
  * Example usage: cat /sys/kernel/debug/dri/0/amdgpu_dm_dmub_fw_state
  */
index 24ed03d..6767fab 100644 (file)
@@ -73,12 +73,9 @@ uint16_t fixed_point_to_int_frac(
 
        return result;
 }
-/**
-* convert_float_matrix
-* This converts a double into HW register spec defined format S2D13.
-* @param :
-* @return None
-*/
+/*
+ * convert_float_matrix - This converts a double into HW register spec defined format S2D13.
+ */
 void convert_float_matrix(
        uint16_t *matrix,
        struct fixed31_32 *flt,
index b2fc4f8..ad04ef9 100644 (file)
@@ -49,20 +49,24 @@ bool is_rgb_cspace(enum dc_color_space output_color_space)
        }
 }
 
-bool is_lower_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
+bool is_child_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
 {
        if (pipe_ctx->plane_state && pipe_ctx->plane_state->visible)
                return true;
-       if (pipe_ctx->bottom_pipe && is_lower_pipe_tree_visible(pipe_ctx->bottom_pipe))
+       if (pipe_ctx->bottom_pipe && is_child_pipe_tree_visible(pipe_ctx->bottom_pipe))
+               return true;
+       if (pipe_ctx->next_odm_pipe && is_child_pipe_tree_visible(pipe_ctx->next_odm_pipe))
                return true;
        return false;
 }
 
-bool is_upper_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
+bool is_parent_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
 {
        if (pipe_ctx->plane_state && pipe_ctx->plane_state->visible)
                return true;
-       if (pipe_ctx->top_pipe && is_upper_pipe_tree_visible(pipe_ctx->top_pipe))
+       if (pipe_ctx->top_pipe && is_parent_pipe_tree_visible(pipe_ctx->top_pipe))
+               return true;
+       if (pipe_ctx->prev_odm_pipe && is_parent_pipe_tree_visible(pipe_ctx->prev_odm_pipe))
                return true;
        return false;
 }
@@ -71,9 +75,13 @@ bool is_pipe_tree_visible(struct pipe_ctx *pipe_ctx)
 {
        if (pipe_ctx->plane_state && pipe_ctx->plane_state->visible)
                return true;
-       if (pipe_ctx->top_pipe && is_upper_pipe_tree_visible(pipe_ctx->top_pipe))
+       if (pipe_ctx->top_pipe && is_parent_pipe_tree_visible(pipe_ctx->top_pipe))
+               return true;
+       if (pipe_ctx->bottom_pipe && is_child_pipe_tree_visible(pipe_ctx->bottom_pipe))
+               return true;
+       if (pipe_ctx->prev_odm_pipe && is_parent_pipe_tree_visible(pipe_ctx->prev_odm_pipe))
                return true;
-       if (pipe_ctx->bottom_pipe && is_lower_pipe_tree_visible(pipe_ctx->bottom_pipe))
+       if (pipe_ctx->next_odm_pipe && is_child_pipe_tree_visible(pipe_ctx->next_odm_pipe))
                return true;
        return false;
 }
index 7c0cbf4..b061497 100644 (file)
@@ -30,9 +30,9 @@
 
 bool is_rgb_cspace(enum dc_color_space output_color_space);
 
-bool is_lower_pipe_tree_visible(struct pipe_ctx *pipe_ctx);
+bool is_child_pipe_tree_visible(struct pipe_ctx *pipe_ctx);
 
-bool is_upper_pipe_tree_visible(struct pipe_ctx *pipe_ctx);
+bool is_parent_pipe_tree_visible(struct pipe_ctx *pipe_ctx);
 
 bool is_pipe_tree_visible(struct pipe_ctx *pipe_ctx);
 
index 23a373c..c67d21a 100644 (file)
@@ -911,11 +911,11 @@ static enum bp_result get_ss_info_from_tbl(
  * ver 2.1 can co-exist with SS_Info table. Expect ASIC_InternalSS_Info ver 3.1,
  * there is only one entry for each signal /ss id.  However, there is
  * no planning of supporting multiple spread Sprectum entry for EverGreen
- * @param [in] this
- * @param [in] signal, ASSignalType to be converted to info index
- * @param [in] index, number of entries that match the converted info index
- * @param [out] ss_info, sprectrum information structure,
- * @return Bios parser result code
+ * @dcb:     pointer to the DC BIOS
+ * @signal:  ASSignalType to be converted to info index
+ * @index:   number of entries that match the converted info index
+ * @ss_info: sprectrum information structure,
+ * return:   Bios parser result code
  */
 static enum bp_result bios_parser_get_spread_spectrum_info(
        struct dc_bios *dcb,
@@ -985,10 +985,10 @@ static enum bp_result get_ss_info_from_internal_ss_info_tbl_V2_1(
  * There can not be more than 1 entry for  ASIC_InternalSS_Info Ver 2.1 or
  * SS_Info.
  *
- * @param this
- * @param id, spread sprectrum info index
- * @param pSSinfo, sprectrum information structure,
- * @return Bios parser result code
+ * @bp:      pointer to the BIOS parser
+ * @id:      spread sprectrum info index
+ * @ss_info: sprectrum information structure,
+ * return:   BIOS parser result code
  */
 static enum bp_result get_ss_info_from_tbl(
        struct bios_parser *bp,
@@ -1011,9 +1011,10 @@ static enum bp_result get_ss_info_from_tbl(
  * from the VBIOS
  * There will not be multiple entry for Ver 2.1
  *
- * @param id, spread sprectrum info index
- * @param pSSinfo, sprectrum information structure,
- * @return Bios parser result code
+ * @bp:    pointer to the Bios parser
+ * @id:    spread sprectrum info index
+ * @info:  sprectrum information structure,
+ * return: Bios parser result code
  */
 static enum bp_result get_ss_info_from_internal_ss_info_tbl_V2_1(
        struct bios_parser *bp,
@@ -1076,9 +1077,10 @@ static enum bp_result get_ss_info_from_internal_ss_info_tbl_V2_1(
  * of entries that matches the id
  * for, the SS_Info table, there should not be more than 1 entry match.
  *
- * @param [in] id, spread sprectrum id
- * @param [out] pSSinfo, sprectrum information structure,
- * @return Bios parser result code
+ * @bp:      pointer to the Bios parser
+ * @id:      spread sprectrum id
+ * @ss_info: sprectrum information structure,
+ * return:   Bios parser result code
  */
 static enum bp_result get_ss_info_from_ss_info_table(
        struct bios_parser *bp,
@@ -1451,16 +1453,14 @@ static enum bp_result get_embedded_panel_info_v1_3(
 }
 
 /**
- * bios_parser_get_encoder_cap_info
+ * bios_parser_get_encoder_cap_info - get encoder capability
+ *                                    information of input object id
  *
- * @brief
- *  Get encoder capability information of input object id
- *
- * @param object_id, Object id
- * @param object_id, encoder cap information structure
- *
- * @return Bios parser result code
+ * @dcb:       pointer to the DC BIOS
+ * @object_id: object id
+ * @info:      encoder cap information structure
  *
+ * return: Bios parser result code
  */
 static enum bp_result bios_parser_get_encoder_cap_info(
        struct dc_bios *dcb,
@@ -1490,17 +1490,12 @@ static enum bp_result bios_parser_get_encoder_cap_info(
 }
 
 /**
- * get_encoder_cap_record
- *
- * @brief
- *  Get encoder cap record for the object
- *
- * @param object, ATOM object
+ * get_encoder_cap_record - Get encoder cap record for the object
  *
- * @return atom encoder cap record
- *
- * @note
- *  search all records to find the ATOM_ENCODER_CAP_RECORD_V2 record
+ * @bp:      pointer to the BIOS parser
+ * @object:  ATOM object
+ * return:   atom encoder cap record
+ * note:     search all records to find the ATOM_ENCODER_CAP_RECORD_V2 record
  */
 static ATOM_ENCODER_CAP_RECORD_V2 *get_encoder_cap_record(
        struct bios_parser *bp,
@@ -1557,8 +1552,9 @@ static uint32_t get_ss_entry_number_from_ss_info_tbl(
  * Get Number of SpreadSpectrum Entry from the ASIC_InternalSS_Info table from
  * the VBIOS that match the SSid (to be converted from signal)
  *
- * @param[in] signal, ASSignalType to be converted to SSid
- * @return number of SS Entry that match the signal
+ * @dcb:    pointer to the DC BIOS
+ * @signal: ASSignalType to be converted to SSid
+ * return: number of SS Entry that match the signal
  */
 static uint32_t bios_parser_get_ss_entry_number(
        struct dc_bios *dcb,
@@ -1608,10 +1604,10 @@ static uint32_t bios_parser_get_ss_entry_number(
  * get_ss_entry_number_from_ss_info_tbl
  * Get Number of spread spectrum entry from the SS_Info table from the VBIOS.
  *
- * @note There can only be one entry for each id for SS_Info Table
- *
- * @param [in] id, spread spectrum id
- * @return number of SS Entry that match the id
+ * @bp:  pointer to the BIOS parser
+ * @id:  spread spectrum id
+ * return: number of SS Entry that match the id
+ * note: There can only be one entry for each id for SS_Info Table
  */
 static uint32_t get_ss_entry_number_from_ss_info_tbl(
        struct bios_parser *bp,
@@ -1679,8 +1675,9 @@ static uint32_t get_ss_entry_number_from_ss_info_tbl(
  * There can not be more than 1 entry for  ASIC_InternalSS_Info Ver 2.1 or
  * SS_Info.
  *
- * @param id, spread sprectrum info index
- * @return Bios parser result code
+ * @bp:    pointer to the BIOS parser
+ * @id:    spread sprectrum info index
+ * return: Bios parser result code
  */
 static uint32_t get_ss_entry_number(struct bios_parser *bp, uint32_t id)
 {
@@ -1696,8 +1693,9 @@ static uint32_t get_ss_entry_number(struct bios_parser *bp, uint32_t id)
  * Ver 2.1 from the VBIOS
  * There will not be multiple entry for Ver 2.1
  *
- * @param id, spread sprectrum info index
- * @return number of SS Entry that match the id
+ * @bp:    pointer to the BIOS parser
+ * @id:    spread sprectrum info index
+ * return: number of SS Entry that match the id
  */
 static uint32_t get_ss_entry_number_from_internal_ss_info_tbl_v2_1(
        struct bios_parser *bp,
@@ -1731,8 +1729,9 @@ static uint32_t get_ss_entry_number_from_internal_ss_info_tbl_v2_1(
  * Get Number of SpreadSpectrum Entry from the ASIC_InternalSS_Info table of
  * the VBIOS that matches id
  *
- * @param[in]  id, spread sprectrum id
- * @return number of SS Entry that match the id
+ * @bp:    pointer to the BIOS parser
+ * @id:    spread sprectrum id
+ * return: number of SS Entry that match the id
  */
 static uint32_t get_ss_entry_number_from_internal_ss_info_tbl_V3_1(
        struct bios_parser *bp,
@@ -1767,10 +1766,11 @@ static uint32_t get_ss_entry_number_from_internal_ss_info_tbl_V3_1(
  * bios_parser_get_gpio_pin_info
  * Get GpioPin information of input gpio id
  *
- * @param gpio_id, GPIO ID
- * @param info, GpioPin information structure
- * @return Bios parser result code
- * @note
+ * @dcb:     pointer to the DC BIOS
+ * @gpio_id: GPIO ID
+ * @info:    GpioPin information structure
+ * return:   Bios parser result code
+ * note:
  *  to get the GPIO PIN INFO, we need:
  *  1. get the GPIO_ID from other object table, see GetHPDInfo()
  *  2. in DATA_TABLE.GPIO_Pin_LUT, search all records, to get the registerA
@@ -2197,13 +2197,10 @@ static uint32_t get_support_mask_for_device_id(struct device_id device_id)
 }
 
 /**
- * bios_parser_set_scratch_critical_state
- *
- * @brief
- *  update critical state bit in VBIOS scratch register
- *
- * @param
- *  bool - to set or reset state
+ * bios_parser_set_scratch_critical_state - update critical state
+ *                                          bit in VBIOS scratch register
+ * @dcb:    pointer to the DC BIOS
+ * @state:  set or reset state
  */
 static void bios_parser_set_scratch_critical_state(
        struct dc_bios *dcb,
@@ -2222,7 +2219,7 @@ static void bios_parser_set_scratch_critical_state(
  * bios_parser *bp - [in]BIOS parser handler to get master data table
  * integrated_info *info - [out] store and output integrated info
  *
- * @return
+ * return:
  * enum bp_result - BP_RESULT_OK if information is available,
  *                  BP_RESULT_BADBIOSTABLE otherwise.
  */
@@ -2372,7 +2369,7 @@ static enum bp_result get_integrated_info_v8(
  * bios_parser *bp - [in]BIOS parser handler to get master data table
  * integrated_info *info - [out] store and output integrated info
  *
- * @return
+ * return:
  * enum bp_result - BP_RESULT_OK if information is available,
  *                  BP_RESULT_BADBIOSTABLE otherwise.
  */
@@ -2509,7 +2506,7 @@ static enum bp_result get_integrated_info_v9(
  * bios_parser *bp - [in]BIOS parser handler to get master data table
  * integrated_info *info - [out] store and output integrated info
  *
- * @return
+ * return:
  * enum bp_result - BP_RESULT_OK if information is available,
  *                  BP_RESULT_BADBIOSTABLE otherwise.
  */
@@ -2585,7 +2582,7 @@ static struct integrated_info *bios_parser_create_integrated_info(
        return NULL;
 }
 
-enum bp_result update_slot_layout_info(
+static enum bp_result update_slot_layout_info(
        struct dc_bios *dcb,
        unsigned int i,
        struct slot_layout_info *slot_layout_info,
@@ -2689,7 +2686,7 @@ enum bp_result update_slot_layout_info(
 }
 
 
-enum bp_result get_bracket_layout_record(
+static enum bp_result get_bracket_layout_record(
        struct dc_bios *dcb,
        unsigned int bracket_layout_id,
        struct slot_layout_info *slot_layout_info)
index 670c265..9f9fda3 100644 (file)
@@ -485,10 +485,11 @@ static struct atom_hpd_int_record *get_hpd_record(
  * bios_parser_get_gpio_pin_info
  * Get GpioPin information of input gpio id
  *
- * @param gpio_id, GPIO ID
- * @param info, GpioPin information structure
- * @return Bios parser result code
- * @note
+ * @dcb:     pointer to the DC BIOS
+ * @gpio_id: GPIO ID
+ * @info:    GpioPin information structure
+ * return: Bios parser result code
+ * note:
  *  to get the GPIO PIN INFO, we need:
  *  1. get the GPIO_ID from other object table, see GetHPDInfo()
  *  2. in DATA_TABLE.GPIO_Pin_LUT, search all records,
@@ -801,11 +802,11 @@ static enum bp_result get_ss_info_v4_2(
  * ver 3.1,
  * there is only one entry for each signal /ss id.  However, there is
  * no planning of supporting multiple spread Sprectum entry for EverGreen
- * @param [in] this
- * @param [in] signal, ASSignalType to be converted to info index
- * @param [in] index, number of entries that match the converted info index
- * @param [out] ss_info, sprectrum information structure,
- * @return Bios parser result code
+ * @dcb:     pointer to the DC BIOS
+ * @signal:  ASSignalType to be converted to info index
+ * @index:   number of entries that match the converted info index
+ * @ss_info: sprectrum information structure,
+ * return: Bios parser result code
  */
 static enum bp_result bios_parser_get_spread_spectrum_info(
        struct dc_bios *dcb,
@@ -1196,13 +1197,11 @@ static bool bios_parser_is_accelerated_mode(
 }
 
 /**
- * bios_parser_set_scratch_critical_state
+ * bios_parser_set_scratch_critical_state - update critical state bit
+ *                                          in VBIOS scratch register
  *
- * @brief
- *  update critical state bit in VBIOS scratch register
- *
- * @param
- *  bool - to set or reset state
+ * @dcb:   pointer to the DC BIO
+ * @state: set or reset state
  */
 static void bios_parser_set_scratch_critical_state(
        struct dc_bios *dcb,
index 48b4ef0..5b77251 100644 (file)
@@ -114,18 +114,14 @@ bool dal_cmd_table_helper_controller_id_to_atom(
 }
 
 /**
-* translate_transmitter_bp_to_atom
-*
-* @brief
-*  Translate the Transmitter to the corresponding ATOM BIOS value
-*
-* @param
-*   input transmitter
-*   output digitalTransmitter
-*    // =00: Digital Transmitter1 ( UNIPHY linkAB )
-*    // =01: Digital Transmitter2 ( UNIPHY linkCD )
-*    // =02: Digital Transmitter3 ( UNIPHY linkEF )
-*/
+ * translate_transmitter_bp_to_atom - Translate the Transmitter to the
+ *                                    corresponding ATOM BIOS value
+ * @t: transmitter
+ * returns: output digitalTransmitter
+ *    // =00: Digital Transmitter1 ( UNIPHY linkAB )
+ *    // =01: Digital Transmitter2 ( UNIPHY linkCD )
+ *    // =02: Digital Transmitter3 ( UNIPHY linkEF )
+ */
 uint8_t dal_cmd_table_helper_transmitter_bp_to_atom(
        enum transmitter t)
 {
index 7736c92..455ee2b 100644 (file)
@@ -128,18 +128,14 @@ bool dal_cmd_table_helper_controller_id_to_atom2(
 }
 
 /**
-* translate_transmitter_bp_to_atom
-*
-* @brief
-*  Translate the Transmitter to the corresponding ATOM BIOS value
-*
-* @param
-*   input transmitter
-*   output digitalTransmitter
-*    // =00: Digital Transmitter1 ( UNIPHY linkAB )
-*    // =01: Digital Transmitter2 ( UNIPHY linkCD )
-*    // =02: Digital Transmitter3 ( UNIPHY linkEF )
-*/
+ * translate_transmitter_bp_to_atom2 - Translate the Transmitter to the
+ *                                     corresponding ATOM BIOS value
+ *  @t: transmitter
+ *  returns: digitalTransmitter
+ *    // =00: Digital Transmitter1 ( UNIPHY linkAB )
+ *    // =01: Digital Transmitter2 ( UNIPHY linkCD )
+ *    // =02: Digital Transmitter3 ( UNIPHY linkEF )
+ */
 uint8_t dal_cmd_table_helper_transmitter_bp_to_atom2(
        enum transmitter t)
 {
index ef41b28..e633f8a 100644 (file)
@@ -106,7 +106,6 @@ static void calculate_bandwidth(
        bool lpt_enabled;
        enum bw_defines sclk_message;
        enum bw_defines yclk_message;
-       enum bw_defines v_filter_init_mode[maximum_number_of_surfaces];
        enum bw_defines tiling_mode[maximum_number_of_surfaces];
        enum bw_defines surface_type[maximum_number_of_surfaces];
        enum bw_defines voltage;
@@ -792,12 +791,8 @@ static void calculate_bandwidth(
                                data->v_filter_init[i] = bw_add(data->v_filter_init[i], bw_int_to_fixed(1));
                        }
                        if (data->stereo_mode[i] == bw_def_top_bottom) {
-                               v_filter_init_mode[i] = bw_def_manual;
                                data->v_filter_init[i] = bw_min2(data->v_filter_init[i], bw_int_to_fixed(4));
                        }
-                       else {
-                               v_filter_init_mode[i] = bw_def_auto;
-                       }
                        if (data->stereo_mode[i] == bw_def_top_bottom) {
                                data->num_lines_at_frame_start = bw_int_to_fixed(1);
                        }
@@ -2730,7 +2725,7 @@ void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 
 }
 
-/**
+/*
  * Compare calculated (required) clocks against the clocks available at
  * maximum voltage (max Performance Level).
  */
@@ -3001,13 +2996,12 @@ static bool all_displays_in_sync(const struct pipe_ctx pipe[],
        return true;
 }
 
-/**
+/*
  * Return:
  *     true -  Display(s) configuration supported.
  *             In this case 'calcs_output' contains data for HW programming
  *     false - Display(s) configuration not supported (not enough bandwidth).
  */
-
 bool bw_calcs(struct dc_context *ctx,
        const struct bw_calcs_dceip *dceip,
        const struct bw_calcs_vbios *vbios,
@@ -3028,7 +3022,7 @@ bool bw_calcs(struct dc_context *ctx,
                calcs_output->all_displays_in_sync = false;
 
        if (data->number_of_displays != 0) {
-               uint8_t yclk_lvl, sclk_lvl;
+               uint8_t yclk_lvl;
                struct bw_fixed high_sclk = vbios->high_sclk;
                struct bw_fixed mid1_sclk = vbios->mid1_sclk;
                struct bw_fixed mid2_sclk = vbios->mid2_sclk;
@@ -3049,7 +3043,6 @@ bool bw_calcs(struct dc_context *ctx,
                calculate_bandwidth(dceip, vbios, data);
 
                yclk_lvl = data->y_clk_level;
-               sclk_lvl = data->sclk_level;
 
                calcs_output->nbp_state_change_enable =
                        data->nbp_state_change_enable;
index f2114bc..ec9dc26 100644 (file)
@@ -257,8 +257,7 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base,
                        if (update_dppclk || update_dispclk)
                                dcn20_update_clocks_update_dentist(clk_mgr);
                        // always update dtos unless clock is lowered and not safe to lower
-                       if (new_clocks->dppclk_khz >= dc->current_state->bw_ctx.bw.dcn.clk.dppclk_khz)
-                               dcn20_update_clocks_update_dpp_dto(clk_mgr, context, safe_to_lower);
+                       dcn20_update_clocks_update_dpp_dto(clk_mgr, context, safe_to_lower);
                }
        }
 
index cfa8e02..68942bb 100644 (file)
@@ -103,7 +103,7 @@ int dcn301_smu_send_msg_with_param(
        /* Trigger the message transaction by writing the message ID */
        REG_WRITE(MP1_SMN_C2PMSG_67, msg_id);
 
-       result = dcn301_smu_wait_for_response(clk_mgr, 10, 1000);
+       result = dcn301_smu_wait_for_response(clk_mgr, 10, 200000);
 
        ASSERT(result == VBIOSSMC_Result_OK);
 
index 8f1cadb..a667480 100644 (file)
@@ -284,20 +284,16 @@ static void dc_perf_trace_destroy(struct dc_perf_trace **perf_trace)
 }
 
 /**
- *****************************************************************************
- *  Function: dc_stream_adjust_vmin_vmax
+ *  dc_stream_adjust_vmin_vmax:
  *
- *  @brief
- *     Looks up the pipe context of dc_stream_state and updates the
- *     vertical_total_min and vertical_total_max of the DRR, Dynamic Refresh
- *     Rate, which is a power-saving feature that targets reducing panel
- *     refresh rate while the screen is static
+ *  Looks up the pipe context of dc_stream_state and updates the
+ *  vertical_total_min and vertical_total_max of the DRR, Dynamic Refresh
+ *  Rate, which is a power-saving feature that targets reducing panel
+ *  refresh rate while the screen is static
  *
- *  @param [in] dc: dc reference
- *  @param [in] stream: Initial dc stream state
- *  @param [in] adjust: Updated parameters for vertical_total_min and
- *  vertical_total_max
- *****************************************************************************
+ *  @dc:     dc reference
+ *  @stream: Initial dc stream state
+ *  @adjust: Updated parameters for vertical_total_min and vertical_total_max
  */
 bool dc_stream_adjust_vmin_vmax(struct dc *dc,
                struct dc_stream_state *stream,
@@ -355,6 +351,7 @@ bool dc_stream_get_crtc_position(struct dc *dc,
  * @dc: DC Object
  * @stream: The stream to configure CRC on.
  * @enable: Enable CRC if true, disable otherwise.
+ * @crc_window: CRC window (x/y start/end) information
  * @continuous: Capture CRC on every frame if true. Otherwise, only capture
  *              once.
  *
@@ -420,7 +417,9 @@ bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream,
  * dc_stream_get_crc() - Get CRC values for the given stream.
  * @dc: DC object
  * @stream: The DC stream state of the stream to get CRCs from.
- * @r_cr, g_y, b_cb: CRC values for the three channels are stored here.
+ * @r_cr: CRC value for the first of the 3 channels stored here.
+ * @g_y:  CRC value for the second of the 3 channels stored here.
+ * @b_cb: CRC value for the third of the 3 channels stored here.
  *
  * dc_stream_configure_crc needs to be called beforehand to enable CRCs.
  * Return false if stream is not found, or if CRCs are not enabled.
@@ -803,7 +802,8 @@ static void disable_all_writeback_pipes_for_stream(
                stream->writeback_info[i].wb_enabled = false;
 }
 
-void apply_ctx_interdependent_lock(struct dc *dc, struct dc_state *context, struct dc_stream_state *stream, bool lock)
+static void apply_ctx_interdependent_lock(struct dc *dc, struct dc_state *context,
+                                         struct dc_stream_state *stream, bool lock)
 {
        int i = 0;
 
@@ -2011,7 +2011,7 @@ static enum surface_update_type check_update_surfaces_for_stream(
        return overall_type;
 }
 
-/**
+/*
  * dc_check_update_surfaces_for_stream() - Determine update type (fast, med, or full)
  *
  * See :c:type:`enum surface_update_type <surface_update_type>` for explanation of update types
@@ -2265,6 +2265,9 @@ static void copy_stream_update_to_stream(struct dc *dc,
 
        if (update->dither_option)
                stream->dither_option = *update->dither_option;
+
+       if (update->pending_test_pattern)
+               stream->test_pattern = *update->pending_test_pattern;
        /* update current stream with writeback info */
        if (update->wb_update) {
                int i;
@@ -2361,6 +2364,15 @@ static void commit_planes_do_stream_update(struct dc *dc,
                                }
                        }
 
+                       if (stream_update->pending_test_pattern) {
+                               dc_link_dp_set_test_pattern(stream->link,
+                                       stream->test_pattern.type,
+                                       stream->test_pattern.color_space,
+                                       stream->test_pattern.p_link_settings,
+                                       stream->test_pattern.p_custom_pattern,
+                                       stream->test_pattern.cust_pattern_size);
+                       }
+
                        /* Full fe update*/
                        if (update_type == UPDATE_TYPE_FAST)
                                continue;
@@ -2814,7 +2826,7 @@ enum dc_irq_source dc_interrupt_to_irq_source(
        return dal_irq_service_to_irq_source(dc->res_pool->irqs, src_id, ext_id);
 }
 
-/**
+/*
  * dc_interrupt_set() - Enable/disable an AMD hw interrupt source
  */
 bool dc_interrupt_set(struct dc *dc, enum dc_irq_source src, bool enable)
@@ -2948,7 +2960,7 @@ static bool link_add_remote_sink_helper(struct dc_link *dc_link, struct dc_sink
        return true;
 }
 
-/**
+/*
  * dc_link_add_remote_sink() - Create a sink and attach it to an existing link
  *
  * EDID length is in bytes
@@ -3011,7 +3023,7 @@ fail_add_sink:
        return NULL;
 }
 
-/**
+/*
  * dc_link_remove_remote_sink() - Remove a remote sink from a dc_link
  *
  * Note that this just removes the struct dc_sink - it doesn't
index f4a2088..9885ef2 100644 (file)
@@ -203,9 +203,21 @@ static bool program_hpd_filter(const struct dc_link *link)
        return result;
 }
 
+bool dc_link_wait_for_t12(struct dc_link *link)
+{
+       if (link->connector_signal == SIGNAL_TYPE_EDP && link->dc->hwss.edp_wait_for_T12) {
+               link->dc->hwss.edp_wait_for_T12(link);
+
+               return true;
+       }
+
+       return false;
+}
+
 /**
  * dc_link_detect_sink() - Determine if there is a sink connected
  *
+ * @link: pointer to the dc link
  * @type: Returned connection type
  * Does not detect downstream devices, such as MST sinks
  * or display connected through active dongles
@@ -342,7 +354,7 @@ static enum signal_type get_basic_signal_type(struct graphics_object_id encoder,
        return SIGNAL_TYPE_NONE;
 }
 
-/**
+/*
  * dc_link_is_dp_sink_present() - Check if there is a native DP
  * or passive DP-HDMI dongle connected
  */
@@ -596,8 +608,6 @@ static void query_hdcp_capability(enum signal_type signal, struct dc_link *link)
        dc_process_hdcp_msg(signal, link, &msg22);
 
        if (signal == SIGNAL_TYPE_DISPLAY_PORT || signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
-               enum hdcp_message_status status = HDCP_MESSAGE_UNSUPPORTED;
-
                msg14.data = &link->hdcp_caps.bcaps.raw;
                msg14.length = sizeof(link->hdcp_caps.bcaps.raw);
                msg14.msg_id = HDCP_MESSAGE_ID_READ_BCAPS;
@@ -605,7 +615,7 @@ static void query_hdcp_capability(enum signal_type signal, struct dc_link *link)
                msg14.link = HDCP_LINK_PRIMARY;
                msg14.max_retries = 5;
 
-               status = dc_process_hdcp_msg(signal, link, &msg14);
+               dc_process_hdcp_msg(signal, link, &msg14);
        }
 
 }
@@ -830,7 +840,7 @@ static bool wait_for_entering_dp_alt_mode(struct dc_link *link)
        return false;
 }
 
-/**
+/*
  * dc_link_detect() - Detect if a sink is attached to a given link
  *
  * link->local_sink is created or destroyed as needed.
@@ -1065,9 +1075,6 @@ static bool dc_link_detect_helper(struct dc_link *link,
                        break;
                }
 
-               if (link->local_sink->edid_caps.panel_patch.disable_fec)
-                       link->ctx->dc->debug.disable_fec = true;
-
                // Check if edid is the same
                if ((prev_sink) &&
                    (edid_status == EDID_THE_SAME || edid_status == EDID_OK))
@@ -1366,13 +1373,17 @@ static bool dc_link_construct(struct dc_link *link,
        struct dc_context *dc_ctx = init_params->ctx;
        struct encoder_init_data enc_init_data = { 0 };
        struct panel_cntl_init_data panel_cntl_init_data = { 0 };
-       struct integrated_info info = {{{ 0 }}};
+       struct integrated_info *info;
        struct dc_bios *bios = init_params->dc->ctx->dc_bios;
        const struct dc_vbios_funcs *bp_funcs = bios->funcs;
        struct bp_disp_connector_caps_info disp_connect_caps_info = { 0 };
 
        DC_LOGGER_INIT(dc_ctx->logger);
 
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
+       if (!info)
+               goto create_fail;
+
        link->irq_source_hpd = DC_IRQ_SOURCE_INVALID;
        link->irq_source_hpd_rx = DC_IRQ_SOURCE_INVALID;
 
@@ -1534,12 +1545,12 @@ static bool dc_link_construct(struct dc_link *link,
        }
 
        if (bios->integrated_info)
-               info = *bios->integrated_info;
+               memcpy(info, bios->integrated_info, sizeof(*info));
 
        /* Look for channel mapping corresponding to connector and device tag */
        for (i = 0; i < MAX_NUMBER_OF_EXT_DISPLAY_PATH; i++) {
                struct external_display_path *path =
-                       &info.ext_disp_conn_info.path[i];
+                       &info->ext_disp_conn_info.path[i];
 
                if (path->device_connector_id.enum_id == link->link_id.enum_id &&
                    path->device_connector_id.id == link->link_id.id &&
@@ -1586,6 +1597,8 @@ create_fail:
                link->hpd_gpio = NULL;
        }
 
+       kfree(info);
+
        return false;
 }
 
@@ -3396,10 +3409,7 @@ void core_link_set_avmute(struct pipe_ctx *pipe_ctx, bool enable)
 }
 
 /**
- *****************************************************************************
- *  Function: dc_link_enable_hpd_filter
- *
- *  @brief
+ *  dc_link_enable_hpd_filter:
  *     If enable is true, programs HPD filter on associated HPD line using
  *     delay_on_disconnect/delay_on_connect values dependent on
  *     link->connector_signal
@@ -3407,9 +3417,8 @@ void core_link_set_avmute(struct pipe_ctx *pipe_ctx, bool enable)
  *     If enable is false, programs HPD filter on associated HPD line with no
  *     delays on connect or disconnect
  *
- *  @param [in] link: pointer to the dc link
- *  @param [in] enable: boolean specifying whether to enable hbd
- *****************************************************************************
+ *  @link:   pointer to the dc link
+ *  @enable: boolean specifying whether to enable hbd
  */
 void dc_link_enable_hpd_filter(struct dc_link *link, bool enable)
 {
@@ -3635,7 +3644,7 @@ uint32_t dc_link_bandwidth_kbps(
        link_bw_kbps *= 8;   /* 8 bits per byte*/
        link_bw_kbps *= link_setting->lane_count;
 
-       if (dc_link_is_fec_supported(link) && !link->dc->debug.disable_fec) {
+       if (dc_link_should_enable_fec(link)) {
                /* Account for FEC overhead.
                 * We have to do it based on caps,
                 * and not based on FEC being set ready,
@@ -3687,3 +3696,18 @@ bool dc_link_is_fec_supported(const struct dc_link *link)
                        !IS_FPGA_MAXIMUS_DC(link->ctx->dce_environment));
 }
 
+bool dc_link_should_enable_fec(const struct dc_link *link)
+{
+       bool is_fec_disable = false;
+       bool ret = false;
+
+       if (link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT_MST &&
+                       link->local_sink &&
+                       link->local_sink->edid_caps.panel_patch.disable_fec)
+               is_fec_disable = true;
+
+       if (dc_link_is_fec_supported(link) && !link->dc->debug.disable_fec && !is_fec_disable)
+               ret = true;
+
+       return ret;
+}
index 2fc1223..3ce584e 100644 (file)
@@ -3707,7 +3707,7 @@ bool detect_dp_sink_caps(struct dc_link *link)
        /* TODO save sink caps in link->sink */
 }
 
-enum dc_link_rate linkRateInKHzToLinkRateMultiplier(uint32_t link_rate_in_khz)
+static enum dc_link_rate linkRateInKHzToLinkRateMultiplier(uint32_t link_rate_in_khz)
 {
        enum dc_link_rate link_rate;
        // LinkRate is normally stored as a multiplier of 0.27 Gbps per lane. Do the translation.
@@ -3992,7 +3992,7 @@ bool dc_link_dp_set_test_pattern(
        unsigned int cust_pattern_size)
 {
        struct pipe_ctx *pipes = link->dc->current_state->res_ctx.pipe_ctx;
-       struct pipe_ctx *pipe_ctx = &pipes[0];
+       struct pipe_ctx *pipe_ctx = NULL;
        unsigned int lane;
        unsigned int i;
        unsigned char link_qual_pattern[LANE_COUNT_DP_MAX] = {0};
@@ -4002,12 +4002,18 @@ bool dc_link_dp_set_test_pattern(
        memset(&training_pattern, 0, sizeof(training_pattern));
 
        for (i = 0; i < MAX_PIPES; i++) {
+               if (pipes[i].stream == NULL)
+                       continue;
+
                if (pipes[i].stream->link == link && !pipes[i].top_pipe && !pipes[i].prev_odm_pipe) {
                        pipe_ctx = &pipes[i];
                        break;
                }
        }
 
+       if (pipe_ctx == NULL)
+               return false;
+
        /* Reset CRTC Test Pattern if it is currently running and request is VideoMode */
        if (link->test_pattern_enabled && test_pattern ==
                        DP_TEST_PATTERN_VIDEO_MODE) {
@@ -4339,7 +4345,7 @@ void dp_set_fec_ready(struct dc_link *link, bool ready)
        struct link_encoder *link_enc = link->link_enc;
        uint8_t fec_config = 0;
 
-       if (!dc_link_is_fec_supported(link) || link->dc->debug.disable_fec)
+       if (!dc_link_should_enable_fec(link))
                return;
 
        if (link_enc->funcs->fec_set_ready &&
@@ -4374,7 +4380,7 @@ void dp_set_fec_enable(struct dc_link *link, bool enable)
 {
        struct link_encoder *link_enc = link->link_enc;
 
-       if (!dc_link_is_fec_supported(link) || link->dc->debug.disable_fec)
+       if (!dc_link_should_enable_fec(link))
                return;
 
        if (link_enc->funcs->fec_set_enable &&
@@ -4400,25 +4406,40 @@ void dp_set_fec_enable(struct dc_link *link, bool enable)
 void dpcd_set_source_specific_data(struct dc_link *link)
 {
        if (!link->dc->vendor_signature.is_valid) {
-               enum dc_status result_write_min_hblank = DC_NOT_SUPPORTED;
-               struct dpcd_amd_signature amd_signature;
-               amd_signature.AMD_IEEE_TxSignature_byte1 = 0x0;
-               amd_signature.AMD_IEEE_TxSignature_byte2 = 0x0;
-               amd_signature.AMD_IEEE_TxSignature_byte3 = 0x1A;
-               amd_signature.device_id_byte1 =
+               enum dc_status __maybe_unused result_write_min_hblank = DC_NOT_SUPPORTED;
+               struct dpcd_amd_signature amd_signature = {0};
+               struct dpcd_amd_device_id amd_device_id = {0};
+
+               amd_device_id.device_id_byte1 =
                                (uint8_t)(link->ctx->asic_id.chip_id);
-               amd_signature.device_id_byte2 =
+               amd_device_id.device_id_byte2 =
                                (uint8_t)(link->ctx->asic_id.chip_id >> 8);
-               memset(&amd_signature.zero, 0, 4);
-               amd_signature.dce_version =
+               amd_device_id.dce_version =
                                (uint8_t)(link->ctx->dce_version);
-               amd_signature.dal_version_byte1 = 0x0; // needed? where to get?
-               amd_signature.dal_version_byte2 = 0x0; // needed? where to get?
+               amd_device_id.dal_version_byte1 = 0x0; // needed? where to get?
+               amd_device_id.dal_version_byte2 = 0x0; // needed? where to get?
 
-               core_link_write_dpcd(link, DP_SOURCE_OUI,
+               core_link_read_dpcd(link, DP_SOURCE_OUI,
                                (uint8_t *)(&amd_signature),
                                sizeof(amd_signature));
 
+               if (!((amd_signature.AMD_IEEE_TxSignature_byte1 == 0x0) &&
+                       (amd_signature.AMD_IEEE_TxSignature_byte2 == 0x0) &&
+                       (amd_signature.AMD_IEEE_TxSignature_byte3 == 0x1A))) {
+
+                       amd_signature.AMD_IEEE_TxSignature_byte1 = 0x0;
+                       amd_signature.AMD_IEEE_TxSignature_byte2 = 0x0;
+                       amd_signature.AMD_IEEE_TxSignature_byte3 = 0x1A;
+
+                       core_link_write_dpcd(link, DP_SOURCE_OUI,
+                               (uint8_t *)(&amd_signature),
+                               sizeof(amd_signature));
+               }
+
+               core_link_write_dpcd(link, DP_SOURCE_OUI+0x03,
+                               (uint8_t *)(&amd_device_id),
+                               sizeof(amd_device_id));
+
                if (link->ctx->dce_version >= DCN_VERSION_2_0 &&
                        link->dc->caps.min_horizontal_blanking_period != 0) {
 
index 07c2255..68b65a0 100644 (file)
@@ -1117,7 +1117,7 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx)
  * We also need to make sure pipe_ctx->plane_res.scl_data.h_active uses the
  * original h_border_left value in its calculation.
  */
-int shift_border_left_to_dst(struct pipe_ctx *pipe_ctx)
+static int shift_border_left_to_dst(struct pipe_ctx *pipe_ctx)
 {
        int store_h_border_left = pipe_ctx->stream->timing.h_border_left;
 
@@ -1128,8 +1128,8 @@ int shift_border_left_to_dst(struct pipe_ctx *pipe_ctx)
        return store_h_border_left;
 }
 
-void restore_border_left_from_dst(struct pipe_ctx *pipe_ctx,
-                                  int store_h_border_left)
+static void restore_border_left_from_dst(struct pipe_ctx *pipe_ctx,
+                                        int store_h_border_left)
 {
        pipe_ctx->stream->dst.x -= store_h_border_left;
        pipe_ctx->stream->timing.h_border_left = store_h_border_left;
@@ -1697,7 +1697,7 @@ static bool are_stream_backends_same(
        return true;
 }
 
-/**
+/*
  * dc_is_stream_unchanged() - Compare two stream states for equivalence.
  *
  * Checks if there a difference between the two states
@@ -1718,7 +1718,7 @@ bool dc_is_stream_unchanged(
        return true;
 }
 
-/**
+/*
  * dc_is_stream_scaling_unchanged() - Compare scaling rectangles of two streams.
  */
 bool dc_is_stream_scaling_unchanged(
@@ -1833,7 +1833,7 @@ static struct audio *find_first_free_audio(
        return 0;
 }
 
-/**
+/*
  * dc_add_stream_to_ctx() - Add a new dc_stream_state to a dc_state.
  */
 enum dc_status dc_add_stream_to_ctx(
@@ -1860,7 +1860,7 @@ enum dc_status dc_add_stream_to_ctx(
        return res;
 }
 
-/**
+/*
  * dc_remove_stream_from_ctx() - Remove a stream from a dc_state.
  */
 enum dc_status dc_remove_stream_from_ctx(
@@ -2075,6 +2075,20 @@ static int acquire_resource_from_hw_enabled_state(
        return -1;
 }
 
+static void mark_seamless_boot_stream(
+               const struct dc  *dc,
+               struct dc_stream_state *stream)
+{
+       struct dc_bios *dcb = dc->ctx->dc_bios;
+
+       /* TODO: Check Linux */
+       if (dc->config.allow_seamless_boot_optimization &&
+                       !dcb->funcs->is_accelerated_mode(dcb)) {
+               if (dc_validate_seamless_boot_timing(dc, stream->sink, &stream->timing))
+                       stream->apply_seamless_boot_optimization = true;
+       }
+}
+
 enum dc_status resource_map_pool_resources(
                const struct dc  *dc,
                struct dc_state *context,
@@ -2085,22 +2099,20 @@ enum dc_status resource_map_pool_resources(
        struct dc_context *dc_ctx = dc->ctx;
        struct pipe_ctx *pipe_ctx = NULL;
        int pipe_idx = -1;
-       struct dc_bios *dcb = dc->ctx->dc_bios;
 
        calculate_phy_pix_clks(stream);
 
-       /* TODO: Check Linux */
-       if (dc->config.allow_seamless_boot_optimization &&
-                       !dcb->funcs->is_accelerated_mode(dcb)) {
-               if (dc_validate_seamless_boot_timing(dc, stream->sink, &stream->timing))
-                       stream->apply_seamless_boot_optimization = true;
-       }
+       mark_seamless_boot_stream(dc, stream);
 
-       if (stream->apply_seamless_boot_optimization)
+       if (stream->apply_seamless_boot_optimization) {
                pipe_idx = acquire_resource_from_hw_enabled_state(
                                &context->res_ctx,
                                pool,
                                stream);
+               if (pipe_idx < 0)
+                       /* hw resource was assigned to other stream */
+                       stream->apply_seamless_boot_optimization = false;
+       }
 
        if (pipe_idx < 0)
                /* acquire new resources */
index c103f85..25fa712 100644 (file)
@@ -244,7 +244,7 @@ struct dc_stream_status *dc_stream_get_status(
 }
 
 #ifndef TRIM_FSFT
-/**
+/*
  * dc_optimize_timing_for_fsft() - dc to optimize timing
  */
 bool dc_optimize_timing_for_fsft(
@@ -260,8 +260,7 @@ bool dc_optimize_timing_for_fsft(
 }
 #endif
 
-
-/**
+/*
  * dc_stream_set_cursor_attributes() - Update cursor attributes and set cursor surface address
  */
 bool dc_stream_set_cursor_attributes(
index 3d7d274..e6b9c6a 100644 (file)
@@ -115,7 +115,7 @@ struct dc_plane_state *dc_create_plane_state(struct dc *dc)
        return plane_state;
 }
 
-/**
+/*
  *****************************************************************************
  *  Function: dc_plane_get_status
  *
index 90fdddb..f3ba02c 100644 (file)
@@ -42,7 +42,7 @@
 #include "inc/hw/dmcu.h"
 #include "dml/display_mode_lib.h"
 
-#define DC_VER "3.2.116"
+#define DC_VER "3.2.118"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
@@ -484,7 +484,6 @@ struct dc_debug_options {
        bool performance_trace;
        bool az_endpoint_mute_only;
        bool always_use_regamma;
-       bool p010_mpo_support;
        bool recovery_enabled;
        bool avoid_vbios_exec_table;
        bool scl_reset_length10;
index 80a2191..cc6fb83 100644 (file)
@@ -451,6 +451,9 @@ struct dpcd_amd_signature {
        uint8_t AMD_IEEE_TxSignature_byte1;
        uint8_t AMD_IEEE_TxSignature_byte2;
        uint8_t AMD_IEEE_TxSignature_byte3;
+};
+
+struct dpcd_amd_device_id {
        uint8_t device_id_byte1;
        uint8_t device_id_byte2;
        uint8_t zero[4];
index 57edb25..a612ba6 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "dc.h"
 #include "dc_dmub_srv.h"
+#include "reg_helper.h"
 
 static inline void submit_dmub_read_modify_write(
        struct dc_reg_helper_state *offload,
index 6d9a60c..d5d8f0a 100644 (file)
@@ -259,6 +259,13 @@ enum dc_status dc_link_reallocate_mst_payload(struct dc_link *link);
 bool dc_link_handle_hpd_rx_irq(struct dc_link *dc_link,
                union hpd_irq_data *hpd_irq_dpcd_data, bool *out_link_loss);
 
+/*
+ * On eDP links this function call will stall until T12 has elapsed.
+ * If the panel is not in power off state, this function will return
+ * immediately.
+ */
+bool dc_link_wait_for_t12(struct dc_link *link);
+
 enum dc_status read_hpd_rx_irq_data(
        struct dc_link *link,
        union hpd_irq_data *irq_data);
@@ -369,5 +376,6 @@ uint32_t dc_bandwidth_in_kbps_from_timing(
        const struct dc_crtc_timing *timing);
 
 bool dc_link_is_fec_supported(const struct dc_link *link);
+bool dc_link_should_enable_fec(const struct dc_link *link);
 
 #endif /* DC_LINK_H_ */
index b791097..80b67b8 100644 (file)
@@ -130,6 +130,14 @@ union stream_update_flags {
        uint32_t raw;
 };
 
+struct test_pattern {
+       enum dp_test_pattern type;
+       enum dp_test_pattern_color_space color_space;
+       struct link_training_settings const *p_link_settings;
+       unsigned char const *p_custom_pattern;
+       unsigned int cust_pattern_size;
+};
+
 struct dc_stream_state {
        // sink is deprecated, new code should not reference
        // this pointer
@@ -227,6 +235,8 @@ struct dc_stream_state {
 
        uint32_t stream_id;
        bool is_dsc_enabled;
+
+       struct test_pattern test_pattern;
        union stream_update_flags update_flags;
 };
 
@@ -261,6 +271,7 @@ struct dc_stream_update {
        struct dc_dsc_config *dsc_config;
        struct dc_transfer_func *func_shaper;
        struct dc_3dlut *lut3d_func;
+       struct test_pattern *pending_test_pattern;
 };
 
 bool dc_is_stream_unchanged(
index 2a2a0fd..7866cf2 100644 (file)
@@ -868,7 +868,7 @@ void dce_aud_wall_dto_setup(
 }
 
 #if defined(CONFIG_DRM_AMD_DC_SI)
-void dce60_aud_wall_dto_setup(
+static void dce60_aud_wall_dto_setup(
        struct audio *audio,
        enum signal_type signal,
        const struct audio_crtc_info *crtc_info,
index cda5fd0..d51b5fe 100644 (file)
@@ -388,12 +388,6 @@ static enum aux_channel_operation_result get_channel_status(
        }
 }
 
-enum i2caux_engine_type get_engine_type(
-               const struct dce_aux *engine)
-{
-       return I2CAUX_ENGINE_TYPE_AUX;
-}
-
 static bool acquire(
        struct dce_aux *engine,
        struct ddc *ddc)
@@ -582,7 +576,7 @@ int dce_aux_transfer_raw(struct ddc_service *ddc,
        *operation_result = get_channel_status(aux_engine, &returned_bytes);
 
        if (*operation_result == AUX_CHANNEL_OPERATION_SUCCEEDED) {
-               int bytes_replied = 0;
+               int __maybe_unused bytes_replied = 0;
                bytes_replied = read_channel_reply(aux_engine, payload->length,
                                         payload->data, payload->reply,
                                         &status);
index 3824658..277484c 100644 (file)
@@ -124,7 +124,6 @@ struct dce110_aux_registers {
        AUX_SF(AUX_SW_CONTROL, AUX_SW_GO, mask_sh),\
        AUX_SF(AUX_SW_DATA, AUX_SW_AUTOINCREMENT_DISABLE, mask_sh),\
        AUX_SF(AUX_SW_DATA, AUX_SW_DATA_RW, mask_sh),\
-       AUX_SF(AUX_SW_DATA, AUX_SW_AUTOINCREMENT_DISABLE, mask_sh),\
        AUX_SF(AUX_SW_DATA, AUX_SW_INDEX, mask_sh),\
        AUX_SF(AUX_SW_DATA, AUX_SW_DATA, mask_sh),\
        AUX_SF(AUX_SW_STATUS, AUX_SW_REPLY_BYTE_COUNT, mask_sh),\
index fb733f5..10938a8 100644 (file)
@@ -113,20 +113,19 @@ static const struct spread_spectrum_data *get_ss_data_entry(
 }
 
 /**
- * Function: calculate_fb_and_fractional_fb_divider
+ * calculate_fb_and_fractional_fb_divider - Calculates feedback and fractional
+ *                                          feedback dividers values
  *
- * * DESCRIPTION: Calculates feedback and fractional feedback dividers values
+ * @calc_pll_cs:           Pointer to clock source information
+ * @target_pix_clk_100hz:   Desired frequency in 100 Hz
+ * @ref_divider:            Reference divider (already known)
+ * @post_divider:           Post Divider (already known)
+ * @feedback_divider_param: Pointer where to store
+ *                         calculated feedback divider value
+ * @fract_feedback_divider_param: Pointer where to store
+ *                         calculated fract feedback divider value
  *
- *PARAMETERS:
- * targetPixelClock             Desired frequency in 100 Hz
- * ref_divider                  Reference divider (already known)
- * postDivider                  Post Divider (already known)
- * feedback_divider_param       Pointer where to store
- *                                     calculated feedback divider value
- * fract_feedback_divider_param Pointer where to store
- *                                     calculated fract feedback divider value
- *
- *RETURNS:
+ * return:
  * It fills the locations pointed by feedback_divider_param
  *                                     and fract_feedback_divider_param
  * It returns  - true if feedback divider not 0
@@ -175,22 +174,22 @@ static bool calculate_fb_and_fractional_fb_divider(
 }
 
 /**
-*calc_fb_divider_checking_tolerance
-*
-*DESCRIPTION: Calculates Feedback and Fractional Feedback divider values
-*              for passed Reference and Post divider, checking for tolerance.
-*PARAMETERS:
-* pll_settings         Pointer to structure
-* ref_divider          Reference divider (already known)
-* postDivider          Post Divider (already known)
-* tolerance            Tolerance for Calculated Pixel Clock to be within
-*
-*RETURNS:
-* It fills the PLLSettings structure with PLL Dividers values
-* if calculated values are within required tolerance
-* It returns   - true if error is within tolerance
-             - false if error is not within tolerance
-*/
+ * calc_fb_divider_checking_tolerance - Calculates Feedback and
+ *                                      Fractional Feedback divider values
+ *                                     for passed Reference and Post divider,
+ *                                      checking for tolerance.
+ * @calc_pll_cs:       Pointer to clock source information
+ * @pll_settings:      Pointer to PLL settings
+ * @ref_divider:       Reference divider (already known)
+ * @post_divider:      Post Divider (already known)
+ * @tolerance:         Tolerance for Calculated Pixel Clock to be within
+ *
+ * return:
+ *  It fills the PLLSettings structure with PLL Dividers values
+ *  if calculated values are within required tolerance
+ *  It returns - true if error is within tolerance
+ *             - false if error is not within tolerance
+ */
 static bool calc_fb_divider_checking_tolerance(
                struct calc_pll_clock_source *calc_pll_cs,
                struct pll_settings *pll_settings,
@@ -460,7 +459,7 @@ static bool pll_adjust_pix_clk(
        return false;
 }
 
-/**
+/*
  * Calculate PLL Dividers for given Clock Value.
  * First will call VBIOS Adjust Exec table to check if requested Pixel clock
  * will be Adjusted based on usage.
index f3ed8b6..30264fc 100644 (file)
 //Register access policy version
 #define mmMP0_SMN_C2PMSG_91                            0x1609B
 
+#if defined(CONFIG_DRM_AMD_DC_DCN)
+static const uint32_t abm_gain_stepsize = 0x0060;
+#endif
+
 static bool dce_dmcu_init(struct dmcu *dmcu)
 {
        // Do nothing
        return true;
 }
 
-bool dce_dmcu_load_iram(struct dmcu *dmcu,
+static bool dce_dmcu_load_iram(struct dmcu *dmcu,
                unsigned int start_offset,
                const char *src,
                unsigned int bytes)
index 93e7f34..cefb7f5 100644 (file)
@@ -317,6 +317,4 @@ struct dmcu *dcn21_dmcu_create(
 
 void dce_dmcu_destroy(struct dmcu **dmcu);
 
-static const uint32_t abm_gain_stepsize = 0x0060;
-
 #endif /* _DCE_ABM_H_ */
index 7fbd92f..a524f47 100644 (file)
@@ -435,7 +435,7 @@ struct dce_i2c_hw *acquire_i2c_hw_engine(
        return dce_i2c_hw;
 }
 
-enum i2c_channel_operation_result dce_i2c_hw_engine_wait_on_operation_result(
+static enum i2c_channel_operation_result dce_i2c_hw_engine_wait_on_operation_result(
        struct dce_i2c_hw *dce_i2c_hw,
        uint32_t timeout,
        enum i2c_channel_operation_result expected_result)
@@ -502,7 +502,7 @@ static uint32_t get_transaction_timeout_hw(
        return period_timeout * num_of_clock_stretches;
 }
 
-bool dce_i2c_hw_engine_submit_payload(
+static bool dce_i2c_hw_engine_submit_payload(
        struct dce_i2c_hw *dce_i2c_hw,
        struct i2c_payload *payload,
        bool middle_of_transaction,
index 87d8428..6846afd 100644 (file)
@@ -339,7 +339,7 @@ static bool start_sync_sw(
        return false;
 }
 
-void dce_i2c_sw_engine_set_speed(
+static void dce_i2c_sw_engine_set_speed(
        struct dce_i2c_sw *engine,
        uint32_t speed)
 {
@@ -353,7 +353,7 @@ void dce_i2c_sw_engine_set_speed(
                engine->clock_delay = 12;
 }
 
-bool dce_i2c_sw_engine_acquire_engine(
+static bool dce_i2c_sw_engine_acquire_engine(
        struct dce_i2c_sw *engine,
        struct ddc *ddc)
 {
@@ -397,7 +397,7 @@ bool dce_i2c_engine_acquire_sw(
 
 
 
-void dce_i2c_sw_engine_submit_channel_request(
+static void dce_i2c_sw_engine_submit_channel_request(
        struct dce_i2c_sw *engine,
        struct i2c_request_transaction_data *req)
 {
@@ -440,7 +440,8 @@ void dce_i2c_sw_engine_submit_channel_request(
                I2C_CHANNEL_OPERATION_SUCCEEDED :
                I2C_CHANNEL_OPERATION_FAILED;
 }
-bool dce_i2c_sw_engine_submit_payload(
+
+static bool dce_i2c_sw_engine_submit_payload(
        struct dce_i2c_sw *engine,
        struct i2c_payload *payload,
        bool middle_of_transaction)
index 210466b..1e77ffe 100644 (file)
@@ -1197,7 +1197,7 @@ void dce110_link_encoder_enable_dp_mst_output(
 
 #if defined(CONFIG_DRM_AMD_DC_SI)
 /* enables DP PHY output */
-void dce60_link_encoder_enable_dp_output(
+static void dce60_link_encoder_enable_dp_output(
        struct link_encoder *enc,
        const struct dc_link_settings *link_settings,
        enum clock_source_id clock_source)
@@ -1236,7 +1236,7 @@ void dce60_link_encoder_enable_dp_output(
 }
 
 /* enables DP PHY output in MST mode */
-void dce60_link_encoder_enable_dp_mst_output(
+static void dce60_link_encoder_enable_dp_mst_output(
        struct link_encoder *enc,
        const struct dc_link_settings *link_settings,
        enum clock_source_id clock_source)
@@ -1426,7 +1426,7 @@ void dce110_link_encoder_dp_set_phy_pattern(
 
 #if defined(CONFIG_DRM_AMD_DC_SI)
 /* set DP PHY test and training patterns */
-void dce60_link_encoder_dp_set_phy_pattern(
+static void dce60_link_encoder_dp_set_phy_pattern(
        struct link_encoder *enc,
        const struct encoder_set_dp_phy_pattern_param *param)
 {
@@ -1503,7 +1503,6 @@ void dce110_link_encoder_update_mst_stream_allocation_table(
        const struct link_mst_stream_allocation_table *table)
 {
        struct dce110_link_encoder *enc110 = TO_DCE110_LINK_ENC(enc);
-       uint32_t value0 = 0;
        uint32_t value1 = 0;
        uint32_t value2 = 0;
        uint32_t slots = 0;
@@ -1604,7 +1603,7 @@ void dce110_link_encoder_update_mst_stream_allocation_table(
        do {
                udelay(10);
 
-               value0 = REG_READ(DP_MSE_SAT_UPDATE);
+               REG_READ(DP_MSE_SAT_UPDATE);
 
                REG_GET(DP_MSE_SAT_UPDATE,
                                DP_MSE_SAT_UPDATE, &value1);
index e459ae6..4600231 100644 (file)
@@ -97,7 +97,7 @@ enum {
 
 
 
-/**
+/*
  *     set_truncation
  *     1) set truncation depth: 0 for 18 bpp or 1 for 24 bpp
  *     2) enable truncation
@@ -142,7 +142,7 @@ static void set_truncation(
 }
 
 #if defined(CONFIG_DRM_AMD_DC_SI)
-/**
+/*
  *     dce60_set_truncation
  *     1) set truncation depth: 0 for 18 bpp or 1 for 24 bpp
  *     2) enable truncation
@@ -183,7 +183,7 @@ static void dce60_set_truncation(
 }
 #endif
 
-/**
+/*
  *     set_spatial_dither
  *     1) set spatial dithering mode: pattern of seed
  *     2) set spatial dithering depth: 0 for 18bpp or 1 for 24bpp
@@ -291,7 +291,7 @@ static void set_spatial_dither(
                FMT_SPATIAL_DITHER_EN, 1);
 }
 
-/**
+/*
  *     SetTemporalDither (Frame Modulation)
  *     1) set temporal dither depth
  *     2) select pattern: from hard-coded pattern or programmable pattern
@@ -355,7 +355,7 @@ static void set_temporal_dither(
                FMT_TEMPORAL_DITHER_EN, 1);
 }
 
-/**
+/*
  *     Set Clamping
  *     1) Set clamping format based on bpc - 0 for 6bpc (No clamping)
  *             1 for 8 bpc
@@ -415,7 +415,7 @@ void dce110_opp_set_clamping(
 }
 
 #if defined(CONFIG_DRM_AMD_DC_SI)
-/**
+/*
  *     Set Clamping for DCE6 parts
  *     1) Set clamping format based on bpc - 0 for 6bpc (No clamping)
  *             1 for 8 bpc
@@ -424,7 +424,7 @@ void dce110_opp_set_clamping(
  *             7 for programable
  *     2) Enable clamp if Limited range requested
  */
-void dce60_opp_set_clamping(
+static void dce60_opp_set_clamping(
        struct dce110_opp *opp110,
        const struct clamping_and_pixel_encoding_params *params)
 {
@@ -465,7 +465,7 @@ void dce60_opp_set_clamping(
 }
 #endif
 
-/**
+/*
  *     set_pixel_encoding
  *
  *     Set Pixel Encoding
@@ -501,7 +501,7 @@ static void set_pixel_encoding(
 }
 
 #if defined(CONFIG_DRM_AMD_DC_SI)
-/**
+/*
  *     dce60_set_pixel_encoding
  *     DCE6 has no FMT_SUBSAMPLING_{MODE,ORDER} bits in FMT_CONTROL reg
  *     Set Pixel Encoding
@@ -545,7 +545,7 @@ void dce110_opp_program_bit_depth_reduction(
 }
 
 #if defined(CONFIG_DRM_AMD_DC_SI)
-void dce60_opp_program_bit_depth_reduction(
+static void dce60_opp_program_bit_depth_reduction(
        struct output_pixel_processor *opp,
        const struct bit_depth_reduction_params *params)
 {
@@ -568,7 +568,7 @@ void dce110_opp_program_clamping_and_pixel_encoding(
 }
 
 #if defined(CONFIG_DRM_AMD_DC_SI)
-void dce60_opp_program_clamping_and_pixel_encoding(
+static void dce60_opp_program_clamping_and_pixel_encoding(
        struct output_pixel_processor *opp,
        const struct clamping_and_pixel_encoding_params *params)
 {
@@ -678,7 +678,7 @@ void dce110_opp_program_fmt(
 }
 
 #if defined(CONFIG_DRM_AMD_DC_SI)
-void dce60_opp_program_fmt(
+static void dce60_opp_program_fmt(
        struct output_pixel_processor *opp,
        struct bit_depth_reduction_params *fmt_bit_depth,
        struct clamping_and_pixel_encoding_params *clamping)
index 4d484ef..bf1ffc3 100644 (file)
@@ -111,7 +111,6 @@ enum dce110_opp_reg_type {
        OPP_SF(FMT_DITHER_RAND_R_SEED, FMT_RAND_R_SEED, mask_sh),\
        OPP_SF(FMT_DITHER_RAND_G_SEED, FMT_RAND_G_SEED, mask_sh),\
        OPP_SF(FMT_DITHER_RAND_B_SEED, FMT_RAND_B_SEED, mask_sh),\
-       OPP_SF(FMT_BIT_DEPTH_CONTROL, FMT_TEMPORAL_DITHER_EN, mask_sh),\
        OPP_SF(FMT_BIT_DEPTH_CONTROL, FMT_TEMPORAL_DITHER_RESET, mask_sh),\
        OPP_SF(FMT_BIT_DEPTH_CONTROL, FMT_TEMPORAL_DITHER_OFFSET, mask_sh),\
        OPP_SF(FMT_BIT_DEPTH_CONTROL, FMT_TEMPORAL_DITHER_DEPTH, mask_sh),\
@@ -219,7 +218,6 @@ enum dce110_opp_reg_type {
        OPP_SF(FMT_DITHER_RAND_R_SEED, FMT_RAND_R_SEED, mask_sh),\
        OPP_SF(FMT_DITHER_RAND_G_SEED, FMT_RAND_G_SEED, mask_sh),\
        OPP_SF(FMT_DITHER_RAND_B_SEED, FMT_RAND_B_SEED, mask_sh),\
-       OPP_SF(FMT_BIT_DEPTH_CONTROL, FMT_TEMPORAL_DITHER_EN, mask_sh),\
        OPP_SF(FMT_BIT_DEPTH_CONTROL, FMT_TEMPORAL_DITHER_RESET, mask_sh),\
        OPP_SF(FMT_BIT_DEPTH_CONTROL, FMT_TEMPORAL_DITHER_OFFSET, mask_sh),\
        OPP_SF(FMT_BIT_DEPTH_CONTROL, FMT_TEMPORAL_DITHER_DEPTH, mask_sh),\
index 761fdfc..e923392 100644 (file)
@@ -50,16 +50,16 @@ static unsigned int dce_get_16_bit_backlight_from_pwm(struct panel_cntl *panel_c
 {
        uint64_t current_backlight;
        uint32_t round_result;
-       uint32_t pwm_period_cntl, bl_period, bl_int_count;
-       uint32_t bl_pwm_cntl, bl_pwm, fractional_duty_cycle_en;
+       uint32_t bl_period, bl_int_count;
+       uint32_t bl_pwm, fractional_duty_cycle_en;
        uint32_t bl_period_mask, bl_pwm_mask;
        struct dce_panel_cntl *dce_panel_cntl = TO_DCE_PANEL_CNTL(panel_cntl);
 
-       pwm_period_cntl = REG_READ(BL_PWM_PERIOD_CNTL);
+       REG_READ(BL_PWM_PERIOD_CNTL);
        REG_GET(BL_PWM_PERIOD_CNTL, BL_PWM_PERIOD, &bl_period);
        REG_GET(BL_PWM_PERIOD_CNTL, BL_PWM_PERIOD_BITCNT, &bl_int_count);
 
-       bl_pwm_cntl = REG_READ(BL_PWM_CNTL);
+       REG_READ(BL_PWM_CNTL);
        REG_GET(BL_PWM_CNTL, BL_ACTIVE_INT_FRAC_CNT, (uint32_t *)(&bl_pwm));
        REG_GET(BL_PWM_CNTL, BL_PWM_FRACTIONAL_EN, &fractional_duty_cycle_en);
 
index ada57f7..265eaef 100644 (file)
@@ -67,7 +67,6 @@ static void dce110_update_generic_info_packet(
        uint32_t packet_index,
        const struct dc_info_packet *info_packet)
 {
-       uint32_t regval;
        /* TODOFPGA Figure out a proper number for max_retries polling for lock
         * use 50 for now.
         */
@@ -99,7 +98,7 @@ static void dce110_update_generic_info_packet(
        }
        /* choose which generic packet to use */
        {
-               regval = REG_READ(AFMT_VBI_PACKET_CONTROL);
+               REG_READ(AFMT_VBI_PACKET_CONTROL);
                REG_UPDATE(AFMT_VBI_PACKET_CONTROL,
                                AFMT_GENERIC_INDEX, packet_index);
        }
index 130a0a0..abbaa6b 100644 (file)
@@ -493,7 +493,6 @@ static void dce60_transform_set_scaler(
 {
        struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm);
        bool is_scaling_required;
-       bool filter_updated = false;
        const uint16_t *coeffs_v, *coeffs_h;
 
        /*Use whole line buffer memory always*/
@@ -558,7 +557,6 @@ static void dce60_transform_set_scaler(
 
                        xfm_dce->filter_v = coeffs_v;
                        xfm_dce->filter_h = coeffs_h;
-                       filter_updated = true;
                }
        }
 
@@ -1037,34 +1035,23 @@ static void dce60_transform_set_pixel_storage_depth(
        const struct bit_depth_reduction_params *bit_depth_params)
 {
        struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm);
-       int pixel_depth, expan_mode;
        enum dc_color_depth color_depth;
 
        switch (depth) {
        case LB_PIXEL_DEPTH_18BPP:
                color_depth = COLOR_DEPTH_666;
-               pixel_depth = 2;
-               expan_mode  = 1;
                break;
        case LB_PIXEL_DEPTH_24BPP:
                color_depth = COLOR_DEPTH_888;
-               pixel_depth = 1;
-               expan_mode  = 1;
                break;
        case LB_PIXEL_DEPTH_30BPP:
                color_depth = COLOR_DEPTH_101010;
-               pixel_depth = 0;
-               expan_mode  = 1;
                break;
        case LB_PIXEL_DEPTH_36BPP:
                color_depth = COLOR_DEPTH_121212;
-               pixel_depth = 3;
-               expan_mode  = 0;
                break;
        default:
                color_depth = COLOR_DEPTH_101010;
-               pixel_depth = 0;
-               expan_mode  = 1;
                BREAK_TO_DEBUGGER();
                break;
        }
@@ -1113,7 +1100,7 @@ static void program_gamut_remap(
 
 }
 
-/**
+/*
  *****************************************************************************
  *  Function: dal_transform_wide_gamut_set_gamut_remap
  *
index 17e84f3..4228caa 100644 (file)
@@ -31,7 +31,7 @@
 
 #define MAX_PIPES 6
 
-/**
+/*
  * Convert dmcub psr state to dmcu psr state.
  */
 static enum dc_psr_state convert_psr_state(uint32_t raw_state)
@@ -74,7 +74,7 @@ static enum dc_psr_state convert_psr_state(uint32_t raw_state)
        return state;
 }
 
-/**
+/*
  * Get PSR state from firmware.
  */
 static void dmub_psr_get_state(struct dmub_psr *dmub, enum dc_psr_state *state)
@@ -90,7 +90,7 @@ static void dmub_psr_get_state(struct dmub_psr *dmub, enum dc_psr_state *state)
        *state = convert_psr_state(raw_state);
 }
 
-/**
+/*
  * Set PSR version.
  */
 static bool dmub_psr_set_version(struct dmub_psr *dmub, struct dc_stream_state *stream)
@@ -121,7 +121,7 @@ static bool dmub_psr_set_version(struct dmub_psr *dmub, struct dc_stream_state *
        return true;
 }
 
-/**
+/*
  * Enable/Disable PSR.
  */
 static void dmub_psr_enable(struct dmub_psr *dmub, bool enable, bool wait)
@@ -170,7 +170,7 @@ static void dmub_psr_enable(struct dmub_psr *dmub, bool enable, bool wait)
        }
 }
 
-/**
+/*
  * Set PSR level.
  */
 static void dmub_psr_set_level(struct dmub_psr *dmub, uint16_t psr_level)
@@ -194,7 +194,7 @@ static void dmub_psr_set_level(struct dmub_psr *dmub, uint16_t psr_level)
        dc_dmub_srv_wait_idle(dc->dmub_srv);
 }
 
-/**
+/*
  * Setup PSR by programming phy registers and sending psr hw context values to firmware.
  */
 static bool dmub_psr_copy_settings(struct dmub_psr *dmub,
@@ -277,7 +277,7 @@ static bool dmub_psr_copy_settings(struct dmub_psr *dmub,
        return true;
 }
 
-/**
+/*
  * Send command to PSR to force static ENTER and ignore all state changes until exit
  */
 static void dmub_psr_force_static(struct dmub_psr *dmub)
@@ -294,7 +294,7 @@ static void dmub_psr_force_static(struct dmub_psr *dmub)
        dc_dmub_srv_wait_idle(dc->dmub_srv);
 }
 
-/**
+/*
  * Get PSR residency from firmware.
  */
 static void dmub_psr_get_residency(struct dmub_psr *dmub, uint32_t *residency)
@@ -316,7 +316,7 @@ static const struct dmub_psr_funcs psr_funcs = {
        .psr_get_residency              = dmub_psr_get_residency,
 };
 
-/**
+/*
  * Construct PSR object.
  */
 static void dmub_psr_construct(struct dmub_psr *psr, struct dc_context *ctx)
@@ -325,7 +325,7 @@ static void dmub_psr_construct(struct dmub_psr *psr, struct dc_context *ctx)
        psr->funcs = &psr_funcs;
 }
 
-/**
+/*
  * Allocate and initialize PSR object.
  */
 struct dmub_psr *dmub_psr_create(struct dc_context *ctx)
@@ -342,7 +342,7 @@ struct dmub_psr *dmub_psr_create(struct dc_context *ctx)
        return psr;
 }
 
-/**
+/*
  * Deallocate PSR object.
  */
 void dmub_psr_destroy(struct dmub_psr **dmub)
index a822d4e..ff20c47 100644 (file)
@@ -23,6 +23,8 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
+CFLAGS_$(AMDDALPATH)/dc/dce100/dce100_resource.o = $(call cc-disable-warning, override-init)
+
 DCE100 = dce100_resource.o dce100_hw_sequencer.o
 
 AMD_DAL_DCE100 = $(addprefix $(AMDDALPATH)/dc/dce100/,$(DCE100))
index f20ed05..635ef0e 100644 (file)
@@ -58,6 +58,8 @@
 #include "dce/dce_abm.h"
 #include "dce/dce_i2c.h"
 
+#include "dce100_resource.h"
+
 #ifndef mmMC_HUB_RDREQ_DMIF_LIMIT
 #include "gmc/gmc_8_2_d.h"
 #include "gmc/gmc_8_2_sh_mask.h"
@@ -611,7 +613,7 @@ static const struct encoder_feature_support link_enc_feature = {
                .flags.bits.IS_TPS3_CAPABLE = true
 };
 
-struct link_encoder *dce100_link_encoder_create(
+static struct link_encoder *dce100_link_encoder_create(
        const struct encoder_init_data *enc_init_data)
 {
        struct dce110_link_encoder *enc110 =
@@ -650,7 +652,7 @@ static struct panel_cntl *dce100_panel_cntl_create(const struct panel_cntl_init_
        return &panel_cntl->base;
 }
 
-struct output_pixel_processor *dce100_opp_create(
+static struct output_pixel_processor *dce100_opp_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -665,7 +667,7 @@ struct output_pixel_processor *dce100_opp_create(
        return &opp->base;
 }
 
-struct dce_aux *dce100_aux_engine_create(
+static struct dce_aux *dce100_aux_engine_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -703,7 +705,7 @@ static const struct dce_i2c_mask i2c_masks = {
                I2C_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK)
 };
 
-struct dce_i2c_hw *dce100_i2c_hw_create(
+static struct dce_i2c_hw *dce100_i2c_hw_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -718,7 +720,7 @@ struct dce_i2c_hw *dce100_i2c_hw_create(
 
        return dce_i2c_hw;
 }
-struct clock_source *dce100_clock_source_create(
+static struct clock_source *dce100_clock_source_create(
        struct dc_context *ctx,
        struct dc_bios *bios,
        enum clock_source_id id,
@@ -742,7 +744,7 @@ struct clock_source *dce100_clock_source_create(
        return NULL;
 }
 
-void dce100_clock_source_destroy(struct clock_source **clk_src)
+static void dce100_clock_source_destroy(struct clock_source **clk_src)
 {
        kfree(TO_DCE110_CLK_SRC(*clk_src));
        *clk_src = NULL;
@@ -831,7 +833,7 @@ static enum dc_status build_mapped_resource(
        return DC_OK;
 }
 
-bool dce100_validate_bandwidth(
+static bool dce100_validate_bandwidth(
        struct dc  *dc,
        struct dc_state *context,
        bool fast_validate)
@@ -876,7 +878,7 @@ static bool dce100_validate_surface_sets(
        return true;
 }
 
-enum dc_status dce100_validate_global(
+static enum dc_status dce100_validate_global(
                struct dc  *dc,
                struct dc_state *context)
 {
index d564c0e..84ab48d 100644 (file)
@@ -23,6 +23,8 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
+CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = $(call cc-disable-warning, override-init)
+
 DCE110 = dce110_timing_generator.o \
 dce110_compressor.o dce110_hw_sequencer.o dce110_resource.o \
 dce110_opp_regamma_v.o dce110_opp_csc_v.o dce110_timing_generator_v.o \
index 72b580a..44564a4 100644 (file)
@@ -412,36 +412,6 @@ void dce110_compressor_destroy(struct compressor **compressor)
        *compressor = NULL;
 }
 
-bool dce110_get_required_compressed_surfacesize(struct fbc_input_info fbc_input_info,
-                                               struct fbc_requested_compressed_size size)
-{
-       bool result = false;
-
-       unsigned int max_x = FBC_MAX_X, max_y = FBC_MAX_Y;
-
-       get_max_support_fbc_buffersize(&max_x, &max_y);
-
-       if (fbc_input_info.dynamic_fbc_buffer_alloc == 0) {
-               /*
-                * For DCE11 here use Max HW supported size:  HW Support up to 3840x2400 resolution
-                * or 18000 chunks.
-                */
-               size.preferred_size = size.min_size = align_to_chunks_number_per_line(max_x) * max_y * 4;  /* (For FBC when LPT not supported). */
-               size.preferred_size_alignment = size.min_size_alignment = 0x100;       /* For FBC when LPT not supported */
-               size.bits.preferred_must_be_framebuffer_pool = 1;
-               size.bits.min_must_be_framebuffer_pool = 1;
-
-               result = true;
-       }
-       /*
-        * Maybe to add registry key support with optional size here to override above
-        * for debugging purposes
-        */
-
-       return result;
-}
-
-
 void get_max_support_fbc_buffersize(unsigned int *max_x, unsigned int *max_y)
 {
        *max_x = FBC_MAX_X;
@@ -455,31 +425,6 @@ void get_max_support_fbc_buffersize(unsigned int *max_x, unsigned int *max_y)
         */
 }
 
-
-unsigned int controller_id_to_index(enum controller_id controller_id)
-{
-       unsigned int index = 0;
-
-       switch (controller_id) {
-       case CONTROLLER_ID_D0:
-               index = 0;
-               break;
-       case CONTROLLER_ID_D1:
-               index = 1;
-               break;
-       case CONTROLLER_ID_D2:
-               index = 2;
-               break;
-       case CONTROLLER_ID_D3:
-               index = 3;
-               break;
-       default:
-               break;
-       }
-       return index;
-}
-
-
 static const struct compressor_funcs dce110_compressor_funcs = {
        .power_up_fbc = dce110_compressor_power_up_fbc,
        .enable_fbc = dce110_compressor_enable_fbc,
index 4c230f1..caee1c9 100644 (file)
@@ -921,6 +921,37 @@ void dce110_edp_power_control(
        }
 }
 
+void dce110_edp_wait_for_T12(
+               struct dc_link *link)
+{
+       struct dc_context *ctx = link->ctx;
+
+       if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
+                       != CONNECTOR_ID_EDP) {
+               BREAK_TO_DEBUGGER();
+               return;
+       }
+
+       if (!link->panel_cntl)
+               return;
+
+       if (!link->panel_cntl->funcs->is_panel_powered_on(link->panel_cntl) &&
+                       link->link_trace.time_stamp.edp_poweroff != 0) {
+               unsigned int t12_duration = 500; // Default T12 as per spec
+               unsigned long long current_ts = dm_get_timestamp(ctx);
+               unsigned long long time_since_edp_poweroff_ms =
+                               div64_u64(dm_get_elapse_time_in_ns(
+                                               ctx,
+                                               current_ts,
+                                               link->link_trace.time_stamp.edp_poweroff), 1000000);
+
+               t12_duration += link->local_sink->edid_caps.panel_patch.extra_t12_ms; // Add extra T12
+
+               if (time_since_edp_poweroff_ms < t12_duration)
+                       msleep(t12_duration - time_since_edp_poweroff_ms);
+       }
+}
+
 /*todo: cloned in stream enc, fix*/
 /*
  * @brief
@@ -1628,7 +1659,7 @@ static struct dc_link *get_edp_link_with_sink(
        return link;
 }
 
-/**
+/*
  * When ASIC goes from VBIOS/VGA mode to driver/accelerated mode we need:
  *  1. Power down all DC HW blocks
  *  2. Disable VGA engine on all controllers
index d54172d..8bbb499 100644 (file)
@@ -34,6 +34,7 @@
 #include "inc/dce_calcs.h"
 
 #include "dce/dce_mem_input.h"
+#include "dce110_mem_input_v.h"
 
 static void set_flip_control(
        struct dce_mem_input *mem_input110,
@@ -468,7 +469,7 @@ static void program_pixel_format(
        }
 }
 
-bool dce_mem_input_v_is_surface_pending(struct mem_input *mem_input)
+static bool dce_mem_input_v_is_surface_pending(struct mem_input *mem_input)
 {
        struct dce_mem_input *mem_input110 = TO_DCE_MEM_INPUT(mem_input);
        uint32_t value;
@@ -483,7 +484,7 @@ bool dce_mem_input_v_is_surface_pending(struct mem_input *mem_input)
        return false;
 }
 
-bool dce_mem_input_v_program_surface_flip_and_addr(
+static bool dce_mem_input_v_program_surface_flip_and_addr(
        struct mem_input *mem_input,
        const struct dc_plane_address *address,
        bool flip_immediate)
@@ -560,7 +561,7 @@ static const unsigned int *get_dvmm_hw_setting(
        }
 }
 
-void dce_mem_input_v_program_pte_vm(
+static void dce_mem_input_v_program_pte_vm(
                struct mem_input *mem_input,
                enum surface_pixel_format format,
                union dc_tiling_info *tiling_info,
@@ -633,7 +634,7 @@ void dce_mem_input_v_program_pte_vm(
        dm_write_reg(mem_input110->base.ctx, mmUNP_DVMM_PTE_ARB_CONTROL_C, value);
 }
 
-void dce_mem_input_v_program_surface_config(
+static void dce_mem_input_v_program_surface_config(
        struct mem_input *mem_input,
        enum surface_pixel_format format,
        union dc_tiling_info *tiling_info,
@@ -919,7 +920,7 @@ static void program_nbp_watermark_c(
                        marks);
 }
 
-void dce_mem_input_v_program_display_marks(
+static void dce_mem_input_v_program_display_marks(
        struct mem_input *mem_input,
        struct dce_watermarks nbp,
        struct dce_watermarks stutter,
@@ -942,7 +943,7 @@ void dce_mem_input_v_program_display_marks(
 
 }
 
-void dce_mem_input_program_chroma_display_marks(
+static void dce_mem_input_program_chroma_display_marks(
        struct mem_input *mem_input,
        struct dce_watermarks nbp,
        struct dce_watermarks stutter,
@@ -963,7 +964,7 @@ void dce_mem_input_program_chroma_display_marks(
                stutter);
 }
 
-void dce110_allocate_mem_input_v(
+static void dce110_allocate_mem_input_v(
        struct mem_input *mi,
        uint32_t h_total,/* for current stream */
        uint32_t v_total,/* for current stream */
@@ -1005,7 +1006,7 @@ void dce110_allocate_mem_input_v(
 
 }
 
-void dce110_free_mem_input_v(
+static void dce110_free_mem_input_v(
        struct mem_input *mi,
        uint32_t total_stream_num)
 {
index af208f9..d7fcc5c 100644 (file)
@@ -715,7 +715,7 @@ static struct output_pixel_processor *dce110_opp_create(
        return &opp->base;
 }
 
-struct dce_aux *dce110_aux_engine_create(
+static struct dce_aux *dce110_aux_engine_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -753,7 +753,7 @@ static const struct dce_i2c_mask i2c_masks = {
                I2C_COMMON_MASK_SH_LIST_DCE110(_MASK)
 };
 
-struct dce_i2c_hw *dce110_i2c_hw_create(
+static struct dce_i2c_hw *dce110_i2c_hw_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -768,7 +768,7 @@ struct dce_i2c_hw *dce110_i2c_hw_create(
 
        return dce_i2c_hw;
 }
-struct clock_source *dce110_clock_source_create(
+static struct clock_source *dce110_clock_source_create(
        struct dc_context *ctx,
        struct dc_bios *bios,
        enum clock_source_id id,
@@ -792,7 +792,7 @@ struct clock_source *dce110_clock_source_create(
        return NULL;
 }
 
-void dce110_clock_source_destroy(struct clock_source **clk_src)
+static void dce110_clock_source_destroy(struct clock_source **clk_src)
 {
        struct dce110_clk_src *dce110_clk_src;
 
@@ -1034,8 +1034,8 @@ static bool dce110_validate_bandwidth(
        return result;
 }
 
-enum dc_status dce110_validate_plane(const struct dc_plane_state *plane_state,
-                                    struct dc_caps *caps)
+static enum dc_status dce110_validate_plane(const struct dc_plane_state *plane_state,
+                                           struct dc_caps *caps)
 {
        if (((plane_state->dst_rect.width * 2) < plane_state->src_rect.width) ||
            ((plane_state->dst_rect.height * 2) < plane_state->src_rect.height))
@@ -1089,7 +1089,7 @@ static bool dce110_validate_surface_sets(
        return true;
 }
 
-enum dc_status dce110_validate_global(
+static enum dc_status dce110_validate_global(
                struct dc *dc,
                struct dc_state *context)
 {
@@ -1272,7 +1272,6 @@ static bool underlay_create(struct dc_context *ctx, struct resource_pool *pool)
 
        /* update the public caps to indicate an underlay is available */
        ctx->dc->caps.max_slave_planes = 1;
-       ctx->dc->caps.max_slave_planes = 1;
 
        return true;
 }
@@ -1333,7 +1332,7 @@ static void bw_calcs_data_update_from_pplib(struct dc *dc)
                1000);
 }
 
-const struct resource_caps *dce110_resource_cap(
+static const struct resource_caps *dce110_resource_cap(
        struct hw_asic_id *asic_id)
 {
        if (ASIC_REV_IS_STONEY(asic_id->hw_internal_rev))
index 1ea7db8..d88a745 100644 (file)
@@ -75,7 +75,7 @@ static void dce110_timing_generator_apply_front_porch_workaround(
        }
 }
 
-/**
+/*
  *****************************************************************************
  *  Function: is_in_vertical_blank
  *
@@ -116,7 +116,7 @@ void dce110_timing_generator_set_early_control(
        dm_write_reg(tg->ctx, address, regval);
 }
 
-/**
+/*
  * Enable CRTC
  * Enable CRTC - call ASIC Control Object to enable Timing generator.
  */
@@ -175,7 +175,7 @@ void dce110_timing_generator_program_blank_color(
        dm_write_reg(tg->ctx, addr, value);
 }
 
-/**
+/*
  *****************************************************************************
  *  Function: disable_stereo
  *
@@ -226,7 +226,7 @@ static void disable_stereo(struct timing_generator *tg)
 }
 #endif
 
-/**
+/*
  * disable_crtc - call ASIC Control Object to disable Timing generator.
  */
 bool dce110_timing_generator_disable_crtc(struct timing_generator *tg)
@@ -247,11 +247,10 @@ bool dce110_timing_generator_disable_crtc(struct timing_generator *tg)
        return result == BP_RESULT_OK;
 }
 
-/**
-* program_horz_count_by_2
-* Programs DxCRTC_HORZ_COUNT_BY2_EN - 1 for DVI 30bpp mode, 0 otherwise
-*
-*/
+/*
+ * program_horz_count_by_2
+ * Programs DxCRTC_HORZ_COUNT_BY2_EN - 1 for DVI 30bpp mode, 0 otherwise
+ */
 static void program_horz_count_by_2(
        struct timing_generator *tg,
        const struct dc_crtc_timing *timing)
@@ -273,7 +272,7 @@ static void program_horz_count_by_2(
                        CRTC_REG(mmCRTC_COUNT_CONTROL), regval);
 }
 
-/**
+/*
  * program_timing_generator
  * Program CRTC Timing Registers - DxCRTC_H_*, DxCRTC_V_*, Pixel repetition.
  * Call ASIC Control Object to program Timings.
@@ -352,7 +351,7 @@ bool dce110_timing_generator_program_timing_generator(
        return result == BP_RESULT_OK;
 }
 
-/**
+/*
  *****************************************************************************
  *  Function: set_drr
  *
@@ -521,7 +520,7 @@ uint32_t dce110_timing_generator_get_vblank_counter(struct timing_generator *tg)
        return field;
 }
 
-/**
+/*
  *****************************************************************************
  *  Function: dce110_timing_generator_get_position
  *
@@ -557,7 +556,7 @@ void dce110_timing_generator_get_position(struct timing_generator *tg,
                        CRTC_VERT_COUNT_NOM);
 }
 
-/**
+/*
  *****************************************************************************
  *  Function: get_crtc_scanoutpos
  *
@@ -1106,11 +1105,11 @@ void dce110_timing_generator_set_test_pattern(
        }
 }
 
-/**
-* dce110_timing_generator_validate_timing
-* The timing generators support a maximum display size of is 8192 x 8192 pixels,
-* including both active display and blanking periods. Check H Total and V Total.
-*/
+/*
+ * dce110_timing_generator_validate_timing
+ * The timing generators support a maximum display size of is 8192 x 8192 pixels,
+ * including both active display and blanking periods. Check H Total and V Total.
+ */
 bool dce110_timing_generator_validate_timing(
        struct timing_generator *tg,
        const struct dc_crtc_timing *timing,
@@ -1167,9 +1166,9 @@ bool dce110_timing_generator_validate_timing(
        return true;
 }
 
-/**
-* Wait till we are at the beginning of VBlank.
-*/
+/*
+ * Wait till we are at the beginning of VBlank.
+ */
 void dce110_timing_generator_wait_for_vblank(struct timing_generator *tg)
 {
        /* We want to catch beginning of VBlank here, so if the first try are
@@ -1191,9 +1190,9 @@ void dce110_timing_generator_wait_for_vblank(struct timing_generator *tg)
        }
 }
 
-/**
-* Wait till we are in VActive (anywhere in VActive)
-*/
+/*
+ * Wait till we are in VActive (anywhere in VActive)
+ */
 void dce110_timing_generator_wait_for_vactive(struct timing_generator *tg)
 {
        while (dce110_timing_generator_is_in_vertical_blank(tg)) {
@@ -1204,7 +1203,7 @@ void dce110_timing_generator_wait_for_vactive(struct timing_generator *tg)
        }
 }
 
-/**
+/*
  *****************************************************************************
  *  Function: dce110_timing_generator_setup_global_swap_lock
  *
@@ -1215,7 +1214,6 @@ void dce110_timing_generator_wait_for_vactive(struct timing_generator *tg)
  *  @param [in] gsl_params: setup data
  *****************************************************************************
  */
-
 void dce110_timing_generator_setup_global_swap_lock(
        struct timing_generator *tg,
        const struct dcp_gsl_params *gsl_params)
@@ -1351,10 +1349,7 @@ void dce110_timing_generator_tear_down_global_swap_lock(
 
        /* Restore DCP_GSL_PURPOSE_SURFACE_FLIP */
        {
-               uint32_t value_crtc_vtotal;
-
-               value_crtc_vtotal = dm_read_reg(tg->ctx,
-                               CRTC_REG(mmCRTC_V_TOTAL));
+               dm_read_reg(tg->ctx, CRTC_REG(mmCRTC_V_TOTAL));
 
                set_reg_field_value(value,
                                0,
@@ -1385,7 +1380,7 @@ void dce110_timing_generator_tear_down_global_swap_lock(
 
        dm_write_reg(tg->ctx, address, value);
 }
-/**
+/*
  *****************************************************************************
  *  Function: is_counter_moving
  *
@@ -1767,7 +1762,7 @@ void dce110_timing_generator_disable_reset_trigger(
        dm_write_reg(tg->ctx, CRTC_REG(mmCRTC_TRIGB_CNTL), value);
 }
 
-/**
+/*
  *****************************************************************************
  *  @brief
  *     Checks whether CRTC triggered reset occurred
@@ -1794,7 +1789,7 @@ bool dce110_timing_generator_did_triggered_reset_occur(
        return (force || vert_sync);
 }
 
-/**
+/*
  * dce110_timing_generator_disable_vga
  * Turn OFF VGA Mode and Timing  - DxVGA_CONTROL
  * VGA Mode and VGA Timing is used by VBIOS on CRT Monitors;
@@ -1840,14 +1835,13 @@ void dce110_timing_generator_disable_vga(
        dm_write_reg(tg->ctx, addr, value);
 }
 
-/**
-* set_overscan_color_black
-*
-* @param :black_color is one of the color space
-*    :this routine will set overscan black color according to the color space.
-* @return none
-*/
-
+/*
+ * set_overscan_color_black
+ *
+ * @param :black_color is one of the color space
+ *    :this routine will set overscan black color according to the color space.
+ * @return none
+ */
 void dce110_timing_generator_set_overscan_color_black(
        struct timing_generator *tg,
        const struct tg_color *color)
index a13a2f5..c509384 100644 (file)
  *
  **********************************************************************************/
 
-/**
-* Enable CRTCV
-*/
+/*
+ * Enable CRTCV
+ */
 
 static bool dce110_timing_generator_v_enable_crtc(struct timing_generator *tg)
 {
 /*
-* Set MASTER_UPDATE_MODE to 0
-* This is needed for DRR, and also suggested to be default value by Syed.
-*/
-
+ * Set MASTER_UPDATE_MODE to 0
+ * This is needed for DRR, and also suggested to be default value by Syed.
+ */
        uint32_t value;
 
        value = 0;
@@ -209,9 +208,9 @@ static void dce110_timing_generator_v_wait_for_vblank(struct timing_generator *t
        }
 }
 
-/**
-* Wait till we are in VActive (anywhere in VActive)
-*/
+/*
+ * Wait till we are in VActive (anywhere in VActive)
+ */
 static void dce110_timing_generator_v_wait_for_vactive(struct timing_generator *tg)
 {
        while (dce110_timing_generator_v_is_in_vertical_blank(tg)) {
index b1aaab5..29438c6 100644 (file)
@@ -217,16 +217,15 @@ static bool setup_scaling_configuration(
        return is_scaling_needed;
 }
 
-/**
-* Function:
-* void program_overscan
-*
-* Purpose: Programs overscan border
-* Input:   overscan
-*
-* Output:
-   void
-*/
+/*
+ * Function:
+ * void program_overscan
+ *
+ * Purpose: Programs overscan border
+ * Input:   overscan
+ *
+ * Output: void
+ */
 static void program_overscan(
                struct dce_transform *xfm_dce,
                const struct scaler_data *data)
index 8e09044..9de6501 100644 (file)
@@ -23,6 +23,8 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
+CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = $(call cc-disable-warning, override-init)
+
 DCE112 = dce112_compressor.o dce112_hw_sequencer.o \
 dce112_resource.o
 
index f99b1c0..ee55cda 100644 (file)
@@ -59,7 +59,9 @@
 #include "dce/dce_11_2_sh_mask.h"
 
 #include "dce100/dce100_resource.h"
-#define DC_LOGGER \
+#include "dce112_resource.h"
+
+#define DC_LOGGER                              \
                dc->ctx->logger
 
 #ifndef mmDP_DPHY_INTERNAL_CTRL
@@ -617,7 +619,7 @@ static const struct encoder_feature_support link_enc_feature = {
                .flags.bits.IS_TPS4_CAPABLE = true
 };
 
-struct link_encoder *dce112_link_encoder_create(
+static struct link_encoder *dce112_link_encoder_create(
        const struct encoder_init_data *enc_init_data)
 {
        struct dce110_link_encoder *enc110 =
@@ -671,7 +673,7 @@ static struct input_pixel_processor *dce112_ipp_create(
        return &ipp->base;
 }
 
-struct output_pixel_processor *dce112_opp_create(
+static struct output_pixel_processor *dce112_opp_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -686,7 +688,7 @@ struct output_pixel_processor *dce112_opp_create(
        return &opp->base;
 }
 
-struct dce_aux *dce112_aux_engine_create(
+static struct dce_aux *dce112_aux_engine_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -724,7 +726,7 @@ static const struct dce_i2c_mask i2c_masks = {
                I2C_COMMON_MASK_SH_LIST_DCE110(_MASK)
 };
 
-struct dce_i2c_hw *dce112_i2c_hw_create(
+static struct dce_i2c_hw *dce112_i2c_hw_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -739,7 +741,7 @@ struct dce_i2c_hw *dce112_i2c_hw_create(
 
        return dce_i2c_hw;
 }
-struct clock_source *dce112_clock_source_create(
+static struct clock_source *dce112_clock_source_create(
        struct dc_context *ctx,
        struct dc_bios *bios,
        enum clock_source_id id,
@@ -763,7 +765,7 @@ struct clock_source *dce112_clock_source_create(
        return NULL;
 }
 
-void dce112_clock_source_destroy(struct clock_source **clk_src)
+static void dce112_clock_source_destroy(struct clock_source **clk_src)
 {
        kfree(TO_DCE110_CLK_SRC(*clk_src));
        *clk_src = NULL;
@@ -1024,7 +1026,7 @@ enum dc_status dce112_add_stream_to_ctx(
        return result;
 }
 
-enum dc_status dce112_validate_global(
+static enum dc_status dce112_validate_global(
                struct dc *dc,
                struct dc_state *context)
 {
@@ -1202,7 +1204,7 @@ static void bw_calcs_data_update_from_pplib(struct dc *dc)
        dm_pp_notify_wm_clock_changes(dc->ctx, &clk_ranges);
 }
 
-const struct resource_caps *dce112_resource_cap(
+static const struct resource_caps *dce112_resource_cap(
        struct hw_asic_id *asic_id)
 {
        if (ASIC_REV_IS_POLARIS11_M(asic_id->hw_internal_rev) ||
index 37db1f8..a9cc4b7 100644 (file)
@@ -24,6 +24,8 @@
 # It provides the control and status of HW CRTC block.
 
 
+CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = $(call cc-disable-warning, override-init)
+
 DCE120 = dce120_resource.o dce120_timing_generator.o \
 dce120_hw_sequencer.o
 
index 66a13aa..d4afe6c 100644 (file)
@@ -50,6 +50,7 @@ struct dce120_hw_seq_reg_offsets {
        uint32_t crtc;
 };
 
+#if 0
 static const struct dce120_hw_seq_reg_offsets reg_offsets[] = {
 {
        .crtc = (mmCRTC0_CRTC_GSL_CONTROL - mmCRTC0_CRTC_GSL_CONTROL),
@@ -79,7 +80,6 @@ static const struct dce120_hw_seq_reg_offsets reg_offsets[] = {
 /*******************************************************************************
  * Private definitions
  ******************************************************************************/
-#if 0
 static void dce120_init_pte(struct dc_context *ctx, uint8_t controller_id)
 {
        uint32_t addr;
index f1e3d28..c65e4d1 100644 (file)
@@ -423,7 +423,7 @@ static const struct dce110_clk_src_mask cs_mask = {
                CS_COMMON_MASK_SH_LIST_DCE_112(_MASK)
 };
 
-struct output_pixel_processor *dce120_opp_create(
+static struct output_pixel_processor *dce120_opp_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -437,7 +437,7 @@ struct output_pixel_processor *dce120_opp_create(
                             ctx, inst, &opp_regs[inst], &opp_shift, &opp_mask);
        return &opp->base;
 }
-struct dce_aux *dce120_aux_engine_create(
+static struct dce_aux *dce120_aux_engine_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -475,7 +475,7 @@ static const struct dce_i2c_mask i2c_masks = {
                I2C_COMMON_MASK_SH_LIST_DCE110(_MASK)
 };
 
-struct dce_i2c_hw *dce120_i2c_hw_create(
+static struct dce_i2c_hw *dce120_i2c_hw_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
index 915fbb8..b57c466 100644 (file)
@@ -69,7 +69,7 @@
 #define CRTC_REG_SET_3(reg, field1, val1, field2, val2, field3, val3)  \
                CRTC_REG_SET_N(reg, 3, FD(reg##__##field1), val1, FD(reg##__##field2), val2, FD(reg##__##field3), val3)
 
-/**
+/*
  *****************************************************************************
  *  Function: is_in_vertical_blank
  *
@@ -98,7 +98,7 @@ static bool dce120_timing_generator_is_in_vertical_blank(
 
 
 /* determine if given timing can be supported by TG */
-bool dce120_timing_generator_validate_timing(
+static bool dce120_timing_generator_validate_timing(
        struct timing_generator *tg,
        const struct dc_crtc_timing *timing,
        enum signal_type signal)
@@ -125,7 +125,7 @@ bool dce120_timing_generator_validate_timing(
        return true;
 }
 
-bool dce120_tg_validate_timing(struct timing_generator *tg,
+static bool dce120_tg_validate_timing(struct timing_generator *tg,
        const struct dc_crtc_timing *timing)
 {
        return dce120_timing_generator_validate_timing(tg, timing, SIGNAL_TYPE_NONE);
@@ -133,7 +133,7 @@ bool dce120_tg_validate_timing(struct timing_generator *tg,
 
 /******** HW programming ************/
 /* Disable/Enable Timing Generator */
-bool dce120_timing_generator_enable_crtc(struct timing_generator *tg)
+static bool dce120_timing_generator_enable_crtc(struct timing_generator *tg)
 {
        enum bp_result result;
        struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
@@ -153,7 +153,7 @@ bool dce120_timing_generator_enable_crtc(struct timing_generator *tg)
        return result == BP_RESULT_OK;
 }
 
-void dce120_timing_generator_set_early_control(
+static void dce120_timing_generator_set_early_control(
                struct timing_generator *tg,
                uint32_t early_cntl)
 {
@@ -166,7 +166,7 @@ void dce120_timing_generator_set_early_control(
 /**************** TG current status ******************/
 
 /* return the current frame counter. Used by Linux kernel DRM */
-uint32_t dce120_timing_generator_get_vblank_counter(
+static uint32_t dce120_timing_generator_get_vblank_counter(
                struct timing_generator *tg)
 {
        struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
@@ -181,7 +181,7 @@ uint32_t dce120_timing_generator_get_vblank_counter(
 }
 
 /* Get current H and V position */
-void dce120_timing_generator_get_crtc_position(
+static void dce120_timing_generator_get_crtc_position(
        struct timing_generator *tg,
        struct crtc_position *position)
 {
@@ -207,7 +207,7 @@ void dce120_timing_generator_get_crtc_position(
 }
 
 /* wait until TG is in beginning of vertical blank region */
-void dce120_timing_generator_wait_for_vblank(struct timing_generator *tg)
+static void dce120_timing_generator_wait_for_vblank(struct timing_generator *tg)
 {
        /* We want to catch beginning of VBlank here, so if the first try are
         * in VBlank, we might be very close to Active, in this case wait for
@@ -229,7 +229,7 @@ void dce120_timing_generator_wait_for_vblank(struct timing_generator *tg)
 }
 
 /* wait until TG is in beginning of active region */
-void dce120_timing_generator_wait_for_vactive(struct timing_generator *tg)
+static void dce120_timing_generator_wait_for_vactive(struct timing_generator *tg)
 {
        while (dce120_timing_generator_is_in_vertical_blank(tg)) {
                if (!tg->funcs->is_counter_moving(tg)) {
@@ -242,7 +242,7 @@ void dce120_timing_generator_wait_for_vactive(struct timing_generator *tg)
 /*********** Timing Generator Synchronization routines ****/
 
 /* Setups Global Swap Lock group, TimingServer or TimingClient*/
-void dce120_timing_generator_setup_global_swap_lock(
+static void dce120_timing_generator_setup_global_swap_lock(
        struct timing_generator *tg,
        const struct dcp_gsl_params *gsl_params)
 {
@@ -279,7 +279,7 @@ void dce120_timing_generator_setup_global_swap_lock(
 }
 
 /* Clear all the register writes done by setup_global_swap_lock */
-void dce120_timing_generator_tear_down_global_swap_lock(
+static void dce120_timing_generator_tear_down_global_swap_lock(
        struct timing_generator *tg)
 {
        struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
@@ -300,7 +300,7 @@ void dce120_timing_generator_tear_down_global_swap_lock(
 }
 
 /* Reset slave controllers on master VSync */
-void dce120_timing_generator_enable_reset_trigger(
+static void dce120_timing_generator_enable_reset_trigger(
        struct timing_generator *tg,
        int source)
 {
@@ -347,7 +347,7 @@ void dce120_timing_generator_enable_reset_trigger(
 }
 
 /* disabling trigger-reset */
-void dce120_timing_generator_disable_reset_trigger(
+static void dce120_timing_generator_disable_reset_trigger(
        struct timing_generator *tg)
 {
        struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
@@ -367,7 +367,7 @@ void dce120_timing_generator_disable_reset_trigger(
 }
 
 /* Checks whether CRTC triggered reset occurred */
-bool dce120_timing_generator_did_triggered_reset_occur(
+static bool dce120_timing_generator_did_triggered_reset_occur(
        struct timing_generator *tg)
 {
        struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
@@ -384,7 +384,7 @@ bool dce120_timing_generator_did_triggered_reset_occur(
 
 /******** Stuff to move to other virtual HW objects *****************/
 /* Move to enable accelerated mode */
-void dce120_timing_generator_disable_vga(struct timing_generator *tg)
+static void dce120_timing_generator_disable_vga(struct timing_generator *tg)
 {
        uint32_t offset = 0;
        uint32_t value = 0;
@@ -425,7 +425,7 @@ void dce120_timing_generator_disable_vga(struct timing_generator *tg)
 }
 /* TODO: Should we move it to transform */
 /* Fully program CRTC timing in timing generator */
-void dce120_timing_generator_program_blanking(
+static void dce120_timing_generator_program_blanking(
        struct timing_generator *tg,
        const struct dc_crtc_timing *timing)
 {
@@ -485,7 +485,7 @@ void dce120_timing_generator_program_blanking(
 
 /* TODO: Should we move it to opp? */
 /* Combine with below and move YUV/RGB color conversion to SW layer */
-void dce120_timing_generator_program_blank_color(
+static void dce120_timing_generator_program_blank_color(
        struct timing_generator *tg,
        const struct tg_color *black_color)
 {
@@ -498,7 +498,7 @@ void dce120_timing_generator_program_blank_color(
                CRTC_BLACK_COLOR_R_CR, black_color->color_r_cr);
 }
 /* Combine with above and move YUV/RGB color conversion to SW layer */
-void dce120_timing_generator_set_overscan_color_black(
+static void dce120_timing_generator_set_overscan_color_black(
        struct timing_generator *tg,
        const struct tg_color *color)
 {
@@ -540,7 +540,7 @@ void dce120_timing_generator_set_overscan_color_black(
         */
 }
 
-void dce120_timing_generator_set_drr(
+static void dce120_timing_generator_set_drr(
        struct timing_generator *tg,
        const struct drr_params *params)
 {
@@ -589,50 +589,7 @@ void dce120_timing_generator_set_drr(
        }
 }
 
-/**
- *****************************************************************************
- *  Function: dce120_timing_generator_get_position
- *
- *  @brief
- *     Returns CRTC vertical/horizontal counters
- *
- *  @param [out] position
- *****************************************************************************
- */
-void dce120_timing_generator_get_position(struct timing_generator *tg,
-       struct crtc_position *position)
-{
-       uint32_t value;
-       struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
-
-       value = dm_read_reg_soc15(
-                       tg->ctx,
-                       mmCRTC0_CRTC_STATUS_POSITION,
-                       tg110->offsets.crtc);
-
-       position->horizontal_count = get_reg_field_value(
-                       value,
-                       CRTC0_CRTC_STATUS_POSITION,
-                       CRTC_HORZ_COUNT);
-
-       position->vertical_count = get_reg_field_value(
-                       value,
-                       CRTC0_CRTC_STATUS_POSITION,
-                       CRTC_VERT_COUNT);
-
-       value = dm_read_reg_soc15(
-                       tg->ctx,
-                       mmCRTC0_CRTC_NOM_VERT_POSITION,
-                       tg110->offsets.crtc);
-
-       position->nominal_vcount = get_reg_field_value(
-                       value,
-                       CRTC0_CRTC_NOM_VERT_POSITION,
-                       CRTC_VERT_COUNT_NOM);
-}
-
-
-void dce120_timing_generator_get_crtc_scanoutpos(
+static void dce120_timing_generator_get_crtc_scanoutpos(
        struct timing_generator *tg,
        uint32_t *v_blank_start,
        uint32_t *v_blank_end,
@@ -661,7 +618,7 @@ void dce120_timing_generator_get_crtc_scanoutpos(
        *v_position = position.vertical_count;
 }
 
-void dce120_timing_generator_enable_advanced_request(
+static void dce120_timing_generator_enable_advanced_request(
        struct timing_generator *tg,
        bool enable,
        const struct dc_crtc_timing *timing)
@@ -699,7 +656,7 @@ void dce120_timing_generator_enable_advanced_request(
                        value);
 }
 
-void dce120_tg_program_blank_color(struct timing_generator *tg,
+static void dce120_tg_program_blank_color(struct timing_generator *tg,
        const struct tg_color *black_color)
 {
        struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
@@ -722,7 +679,7 @@ void dce120_tg_program_blank_color(struct timing_generator *tg,
                value);
 }
 
-void dce120_tg_set_overscan_color(struct timing_generator *tg,
+static void dce120_tg_set_overscan_color(struct timing_generator *tg,
        const struct tg_color *overscan_color)
 {
        struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
@@ -749,7 +706,7 @@ static void dce120_tg_program_timing(struct timing_generator *tg,
                dce120_timing_generator_program_blanking(tg, timing);
 }
 
-bool dce120_tg_is_blanked(struct timing_generator *tg)
+static bool dce120_tg_is_blanked(struct timing_generator *tg)
 {
        struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
        uint32_t value = dm_read_reg_soc15(
@@ -770,7 +727,7 @@ bool dce120_tg_is_blanked(struct timing_generator *tg)
        return false;
 }
 
-void dce120_tg_set_blank(struct timing_generator *tg,
+static void dce120_tg_set_blank(struct timing_generator *tg,
                bool enable_blanking)
 {
        struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
@@ -789,7 +746,7 @@ void dce120_tg_set_blank(struct timing_generator *tg,
 bool dce120_tg_validate_timing(struct timing_generator *tg,
        const struct dc_crtc_timing *timing);
 
-void dce120_tg_wait_for_state(struct timing_generator *tg,
+static void dce120_tg_wait_for_state(struct timing_generator *tg,
        enum crtc_state state)
 {
        switch (state) {
@@ -806,7 +763,7 @@ void dce120_tg_wait_for_state(struct timing_generator *tg,
        }
 }
 
-void dce120_tg_set_colors(struct timing_generator *tg,
+static void dce120_tg_set_colors(struct timing_generator *tg,
        const struct tg_color *blank_color,
        const struct tg_color *overscan_color)
 {
@@ -833,7 +790,7 @@ static void dce120_timing_generator_set_static_screen_control(
                        CRTC_STATIC_SCREEN_FRAME_COUNT, num_frames);
 }
 
-void dce120_timing_generator_set_test_pattern(
+static void dce120_timing_generator_set_test_pattern(
        struct timing_generator *tg,
        /* TODO: replace 'controller_dp_test_pattern' by 'test_pattern_mode'
         * because this is not DP-specific (which is probably somewhere in DP
index 7036c3b..dda596f 100644 (file)
@@ -23,6 +23,8 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
+CFLAGS_AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init)
+
 DCE60 = dce60_timing_generator.o dce60_hw_sequencer.o \
        dce60_resource.o
 
index e9dd78c..dcfa0a3 100644 (file)
@@ -60,6 +60,8 @@
 #include "dce/dce_i2c.h"
 /* TODO remove this include */
 
+#include "dce60_resource.h"
+
 #ifndef mmMC_HUB_RDREQ_DMIF_LIMIT
 #include "gmc/gmc_6_0_d.h"
 #include "gmc/gmc_6_0_sh_mask.h"
@@ -519,7 +521,7 @@ static struct output_pixel_processor *dce60_opp_create(
        return &opp->base;
 }
 
-struct dce_aux *dce60_aux_engine_create(
+static struct dce_aux *dce60_aux_engine_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -557,7 +559,7 @@ static const struct dce_i2c_mask i2c_masks = {
                I2C_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK)
 };
 
-struct dce_i2c_hw *dce60_i2c_hw_create(
+static struct dce_i2c_hw *dce60_i2c_hw_create(
        struct dc_context *ctx,
        uint32_t inst)
 {
@@ -573,7 +575,7 @@ struct dce_i2c_hw *dce60_i2c_hw_create(
        return dce_i2c_hw;
 }
 
-struct dce_i2c_sw *dce60_i2c_sw_create(
+static struct dce_i2c_sw *dce60_i2c_sw_create(
        struct dc_context *ctx)
 {
        struct dce_i2c_sw *dce_i2c_sw =
@@ -707,7 +709,7 @@ static const struct encoder_feature_support link_enc_feature = {
                .flags.bits.IS_TPS3_CAPABLE = true
 };
 
-struct link_encoder *dce60_link_encoder_create(
+static struct link_encoder *dce60_link_encoder_create(
        const struct encoder_init_data *enc_init_data)
 {
        struct dce110_link_encoder *enc110 =
@@ -746,7 +748,7 @@ static struct panel_cntl *dce60_panel_cntl_create(const struct panel_cntl_init_d
        return &panel_cntl->base;
 }
 
-struct clock_source *dce60_clock_source_create(
+static struct clock_source *dce60_clock_source_create(
        struct dc_context *ctx,
        struct dc_bios *bios,
        enum clock_source_id id,
@@ -770,7 +772,7 @@ struct clock_source *dce60_clock_source_create(
        return NULL;
 }
 
-void dce60_clock_source_destroy(struct clock_source **clk_src)
+static void dce60_clock_source_destroy(struct clock_source **clk_src)
 {
        kfree(TO_DCE110_CLK_SRC(*clk_src));
        *clk_src = NULL;
@@ -860,7 +862,7 @@ static void dce60_resource_destruct(struct dce110_resource_pool *pool)
        }
 }
 
-bool dce60_validate_bandwidth(
+static bool dce60_validate_bandwidth(
        struct dc *dc,
        struct dc_state *context,
        bool fast_validate)
@@ -905,7 +907,7 @@ static bool dce60_validate_surface_sets(
        return true;
 }
 
-enum dc_status dce60_validate_global(
+static enum dc_status dce60_validate_global(
                struct dc *dc,
                struct dc_state *context)
 {
index fc1af0f..c1a85ee 100644 (file)
@@ -189,8 +189,8 @@ static bool dce60_is_tg_enabled(struct timing_generator *tg)
        return field == 1;
 }
 
-bool dce60_configure_crc(struct timing_generator *tg,
-                         const struct crc_params *params)
+static bool dce60_configure_crc(struct timing_generator *tg,
+                               const struct crc_params *params)
 {
        /* Cannot configure crc on a CRTC that is disabled */
        if (!dce60_is_tg_enabled(tg))
index 666fcb2..0a9d1a3 100644 (file)
@@ -23,6 +23,8 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
+CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = $(call cc-disable-warning, override-init)
+
 DCE80 = dce80_timing_generator.o dce80_hw_sequencer.o \
        dce80_resource.o
 
index 26fe25c..612450f 100644 (file)
@@ -60,6 +60,8 @@
 #include "dce/dce_i2c.h"
 /* TODO remove this include */
 
+#include "dce80_resource.h"
+
 #ifndef mmMC_HUB_RDREQ_DMIF_LIMIT
 #include "gmc/gmc_7_1_d.h"
 #include "gmc/gmc_7_1_sh_mask.h"
index 4d3f7d5..904c2d2 100644 (file)
@@ -577,7 +577,7 @@ void dpp1_power_on_degamma_lut(
        struct dcn10_dpp *dpp = TO_DCN10_DPP(dpp_base);
 
        REG_SET(CM_MEM_PWR_CTRL, 0,
-                       SHARED_MEM_PWR_DIS, power_on == true ? 0:1);
+                       SHARED_MEM_PWR_DIS, power_on ? 0:1);
 
 }
 
index cfc130e..add86d4 100644 (file)
@@ -2624,7 +2624,7 @@ static void dcn10_update_dchubp_dpp(
        hws->funcs.update_plane_addr(dc, pipe_ctx);
 
        if (is_pipe_tree_visible(pipe_ctx))
-               hubp->funcs->set_blank(hubp, false);
+               dc->hwss.set_hubp_blank(dc, pipe_ctx, false);
 }
 
 void dcn10_blank_pixel_data(
@@ -3135,13 +3135,16 @@ void dcn10_setup_stereo(struct pipe_ctx *pipe_ctx, struct dc *dc)
        return;
 }
 
-static struct hubp *get_hubp_by_inst(struct resource_pool *res_pool, int mpcc_inst)
+static struct pipe_ctx *get_pipe_ctx_by_hubp_inst(struct dc_state *context, int mpcc_inst)
 {
        int i;
 
-       for (i = 0; i < res_pool->pipe_count; i++) {
-               if (res_pool->hubps[i]->inst == mpcc_inst)
-                       return res_pool->hubps[i];
+       for (i = 0; i < MAX_PIPES; i++) {
+               if (context->res_ctx.pipe_ctx[i].plane_res.hubp
+                               && context->res_ctx.pipe_ctx[i].plane_res.hubp->inst == mpcc_inst) {
+                       return &context->res_ctx.pipe_ctx[i];
+               }
+
        }
        ASSERT(false);
        return NULL;
@@ -3164,11 +3167,23 @@ void dcn10_wait_for_mpcc_disconnect(
 
        for (mpcc_inst = 0; mpcc_inst < MAX_PIPES; mpcc_inst++) {
                if (pipe_ctx->stream_res.opp->mpcc_disconnect_pending[mpcc_inst]) {
-                       struct hubp *hubp = get_hubp_by_inst(res_pool, mpcc_inst);
+                       struct pipe_ctx *restore_bottom_pipe;
+                       struct pipe_ctx *restore_top_pipe;
+                       struct pipe_ctx *inst_pipe_ctx = get_pipe_ctx_by_hubp_inst(dc->current_state, mpcc_inst);
 
+                       ASSERT(inst_pipe_ctx);
                        res_pool->mpc->funcs->wait_for_idle(res_pool->mpc, mpcc_inst);
                        pipe_ctx->stream_res.opp->mpcc_disconnect_pending[mpcc_inst] = false;
-                       hubp->funcs->set_blank(hubp, true);
+                       /*
+                        * Set top and bottom pipes NULL, as we don't want
+                        * to blank those pipes when disconnecting from MPCC
+                        */
+                       restore_bottom_pipe = inst_pipe_ctx->bottom_pipe;
+                       restore_top_pipe = inst_pipe_ctx->top_pipe;
+                       inst_pipe_ctx->top_pipe = inst_pipe_ctx->bottom_pipe = NULL;
+                       dc->hwss.set_hubp_blank(dc, inst_pipe_ctx, true);
+                       inst_pipe_ctx->top_pipe = restore_top_pipe;
+                       inst_pipe_ctx->bottom_pipe = restore_bottom_pipe;
                }
        }
 
@@ -3721,3 +3736,10 @@ void dcn10_get_clock(struct dc *dc,
                                dc->clk_mgr->funcs->get_clock(dc->clk_mgr, context, clock_type, clock_cfg);
 
 }
+
+void dcn10_set_hubp_blank(const struct dc *dc,
+                               struct pipe_ctx *pipe_ctx,
+                               bool blank_enable)
+{
+       pipe_ctx->plane_res.hubp->funcs->set_blank(pipe_ctx->plane_res.hubp, blank_enable);
+}
index e5691e4..89e6dfb 100644 (file)
@@ -163,6 +163,8 @@ void dcn10_wait_for_mpcc_disconnect(
 void dce110_edp_backlight_control(
                struct dc_link *link,
                bool enable);
+void dce110_edp_wait_for_T12(
+               struct dc_link *link);
 void dce110_edp_power_control(
                struct dc_link *link,
                bool power_up);
@@ -202,5 +204,8 @@ void dcn10_wait_for_pending_cleared(struct dc *dc,
                struct dc_state *context);
 void dcn10_set_hdr_multiplier(struct pipe_ctx *pipe_ctx);
 void dcn10_verify_allow_pstate_change_high(struct dc *dc);
+void dcn10_set_hubp_blank(const struct dc *dc,
+                               struct pipe_ctx *pipe_ctx,
+                               bool blank_enable);
 
 #endif /* __DC_HWSS_DCN10_H__ */
index 254300b..2f1b802 100644 (file)
@@ -79,6 +79,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = {
        .set_backlight_level = dce110_set_backlight_level,
        .set_abm_immediate_disable = dce110_set_abm_immediate_disable,
        .set_pipe = dce110_set_pipe,
+       .set_hubp_blank = dcn10_set_hubp_blank,
 };
 
 static const struct hwseq_private_funcs dcn10_private_funcs = {
index 100ce0e..b096011 100644 (file)
@@ -470,7 +470,7 @@ void mpc1_cursor_lock(struct mpc *mpc, int opp_id, bool lock)
 unsigned int mpc1_get_mpc_out_mux(struct mpc *mpc, int opp_id)
 {
        struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
-       uint32_t val = 0;
+       uint32_t val = 0xf;
 
        if (opp_id < MAX_OPP && REG(MUX[opp_id]))
                REG_GET(MUX[opp_id], MPC_OUT_MUX, &val);
index f033397..6138f48 100644 (file)
@@ -659,6 +659,16 @@ void optc1_unlock(struct timing_generator *optc)
                        OTG_MASTER_UPDATE_LOCK, 0);
 }
 
+bool optc1_is_locked(struct timing_generator *optc)
+{
+       struct optc *optc1 = DCN10TG_FROM_TG(optc);
+       uint32_t locked;
+
+       REG_GET(OTG_MASTER_UPDATE_LOCK, UPDATE_LOCK_STATUS, &locked);
+
+       return (locked == 1);
+}
+
 void optc1_get_position(struct timing_generator *optc,
                struct crtc_position *position)
 {
@@ -1513,6 +1523,7 @@ static const struct timing_generator_funcs dcn10_tg_funcs = {
                .enable_crtc_reset = optc1_enable_crtc_reset,
                .disable_reset_trigger = optc1_disable_reset_trigger,
                .lock = optc1_lock,
+               .is_locked = optc1_is_locked,
                .unlock = optc1_unlock,
                .enable_optc_clock = optc1_enable_optc_clock,
                .set_drr = optc1_set_drr,
index b12bd9a..b222c67 100644 (file)
@@ -638,6 +638,7 @@ void optc1_set_blank(struct timing_generator *optc,
                bool enable_blanking);
 
 bool optc1_is_blanked(struct timing_generator *optc);
+bool optc1_is_locked(struct timing_generator *optc);
 
 void optc1_program_blank_color(
                struct timing_generator *optc,
index 3674519..90e912f 100644 (file)
@@ -608,8 +608,8 @@ static const struct dc_debug_options debug_defaults_drv = {
                .disable_pplib_clock_request = false,
                .disable_pplib_wm_range = false,
                .pplib_wm_report_mode = WM_REPORT_DEFAULT,
-               .pipe_split_policy = MPC_SPLIT_DYNAMIC,
-               .force_single_disp_pipe_split = true,
+               .pipe_split_policy = MPC_SPLIT_AVOID,
+               .force_single_disp_pipe_split = false,
                .disable_dcc = DCC_ENABLE,
                .voltage_align_fclk = true,
                .disable_stereo_support = true,
index cb822df..18653c4 100644 (file)
@@ -1570,8 +1570,8 @@ static void dcn20_update_dchubp_dpp(
 
 
 
-       if (pipe_ctx->update_flags.bits.enable)
-               hubp->funcs->set_blank(hubp, false);
+       if (is_pipe_tree_visible(pipe_ctx))
+               dc->hwss.set_hubp_blank(dc, pipe_ctx, false);
 }
 
 
@@ -1765,6 +1765,14 @@ void dcn20_post_unlock_program_front_end(
                }
        }
 
+       for (i = 0; i < dc->res_pool->pipe_count; i++) {
+               struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
+
+               if (pipe->vtp_locked) {
+                       dc->hwss.set_hubp_blank(dc, pipe, true);
+                       pipe->vtp_locked = false;
+               }
+       }
        /* WA to apply WM setting*/
        if (hwseq->wa.DEGVIDCN21)
                dc->res_pool->hubbub->funcs->apply_DEDCN21_147_wa(dc->res_pool->hubbub);
index de9dcbe..51a4166 100644 (file)
@@ -94,6 +94,7 @@ static const struct hw_sequencer_funcs dcn20_funcs = {
        .optimize_timing_for_fsft = dcn20_optimize_timing_for_fsft,
 #endif
        .set_disp_pattern_generator = dcn20_set_disp_pattern_generator,
+       .set_hubp_blank = dcn10_set_hubp_blank,
 };
 
 static const struct hwseq_private_funcs dcn20_private_funcs = {
index 074e271..0597391 100644 (file)
@@ -99,6 +99,7 @@ static const struct hw_sequencer_funcs dcn21_funcs = {
 #endif
        .is_abm_supported = dcn21_is_abm_supported,
        .set_disp_pattern_generator = dcn20_set_disp_pattern_generator,
+       .set_hubp_blank = dcn10_set_hubp_blank,
 };
 
 static const struct hwseq_private_funcs dcn21_private_funcs = {
index 9da66e4..3398540 100644 (file)
@@ -133,7 +133,6 @@ static void dpp3_power_on_gamcor_lut(
                struct dpp *dpp_base,
        bool power_on)
 {
-       uint32_t power_status;
        struct dcn3_dpp *dpp = TO_DCN30_DPP(dpp_base);
 
        if (dpp_base->ctx->dc->debug.enable_mem_low_power.bits.cm) {
@@ -143,12 +142,6 @@ static void dpp3_power_on_gamcor_lut(
        } else
                REG_SET(CM_MEM_PWR_CTRL, 0,
                                GAMCOR_MEM_PWR_DIS, power_on == true ? 0:1);
-
-       REG_GET(CM_MEM_PWR_STATUS, GAMCOR_MEM_PWR_STATE, &power_status);
-       if (power_status != 0)
-               BREAK_TO_DEBUGGER();
-
-
 }
 
 void dpp3_program_cm_dealpha(
index 5fa150f..705fbfc 100644 (file)
@@ -62,6 +62,7 @@
        HUBP_SF(HUBP0_DCHUBP_CNTL, HUBP_NO_OUTSTANDING_REQ, mask_sh),\
        HUBP_SF(HUBP0_DCHUBP_CNTL, HUBP_VTG_SEL, mask_sh),\
        HUBP_SF(HUBP0_DCHUBP_CNTL, HUBP_DISABLE, mask_sh),\
+       HUBP_SF(HUBP0_DCHUBP_CNTL, HUBP_IN_BLANK, mask_sh),\
        HUBP_SF(HUBP0_DCSURF_ADDR_CONFIG, NUM_PIPES, mask_sh),\
        HUBP_SF(HUBP0_DCSURF_ADDR_CONFIG, PIPE_INTERLEAVE, mask_sh),\
        HUBP_SF(HUBP0_DCSURF_ADDR_CONFIG, MAX_COMPRESSED_FRAGS, mask_sh),\
index b83c13d..e5cc8f8 100644 (file)
@@ -836,6 +836,53 @@ void dcn30_hardware_release(struct dc *dc)
                                dc->res_pool->hubbub, true, true);
 }
 
+void dcn30_set_hubp_blank(const struct dc *dc,
+               struct pipe_ctx *pipe_ctx,
+               bool blank_enable)
+{
+       struct pipe_ctx *mpcc_pipe;
+       struct pipe_ctx *odm_pipe;
+
+       if (blank_enable) {
+               struct plane_resource *plane_res = &pipe_ctx->plane_res;
+               struct stream_resource *stream_res = &pipe_ctx->stream_res;
+
+               /* Wait for enter vblank */
+               stream_res->tg->funcs->wait_for_state(stream_res->tg, CRTC_STATE_VBLANK);
+
+               /* Blank HUBP to allow p-state during blank on all timings */
+               pipe_ctx->plane_res.hubp->funcs->set_blank(pipe_ctx->plane_res.hubp, true);
+               /* Confirm hubp in blank */
+               ASSERT(plane_res->hubp->funcs->hubp_in_blank(plane_res->hubp));
+               /* Toggle HUBP_DISABLE */
+               plane_res->hubp->funcs->hubp_soft_reset(plane_res->hubp, true);
+               plane_res->hubp->funcs->hubp_soft_reset(plane_res->hubp, false);
+               for (mpcc_pipe = pipe_ctx->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe) {
+                       mpcc_pipe->plane_res.hubp->funcs->set_blank(mpcc_pipe->plane_res.hubp, true);
+                       /* Confirm hubp in blank */
+                       ASSERT(mpcc_pipe->plane_res.hubp->funcs->hubp_in_blank(mpcc_pipe->plane_res.hubp));
+                       /* Toggle HUBP_DISABLE */
+                       mpcc_pipe->plane_res.hubp->funcs->hubp_soft_reset(mpcc_pipe->plane_res.hubp, true);
+                       mpcc_pipe->plane_res.hubp->funcs->hubp_soft_reset(mpcc_pipe->plane_res.hubp, false);
+
+               }
+               for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) {
+                       odm_pipe->plane_res.hubp->funcs->set_blank(odm_pipe->plane_res.hubp, true);
+                       /* Confirm hubp in blank */
+                       ASSERT(odm_pipe->plane_res.hubp->funcs->hubp_in_blank(odm_pipe->plane_res.hubp));
+                       /* Toggle HUBP_DISABLE */
+                       odm_pipe->plane_res.hubp->funcs->hubp_soft_reset(odm_pipe->plane_res.hubp, true);
+                       odm_pipe->plane_res.hubp->funcs->hubp_soft_reset(odm_pipe->plane_res.hubp, false);
+               }
+       } else {
+               pipe_ctx->plane_res.hubp->funcs->set_blank(pipe_ctx->plane_res.hubp, false);
+               for (mpcc_pipe = pipe_ctx->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe)
+                       mpcc_pipe->plane_res.hubp->funcs->set_blank(mpcc_pipe->plane_res.hubp, false);
+               for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe)
+                       odm_pipe->plane_res.hubp->funcs->set_blank(odm_pipe->plane_res.hubp, false);
+       }
+}
+
 void dcn30_set_disp_pattern_generator(const struct dc *dc,
                struct pipe_ctx *pipe_ctx,
                enum controller_dp_test_pattern test_pattern,
@@ -844,6 +891,25 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,
                const struct tg_color *solid_color,
                int width, int height, int offset)
 {
-       pipe_ctx->stream_res.opp->funcs->opp_set_disp_pattern_generator(pipe_ctx->stream_res.opp, test_pattern,
-                       color_space, color_depth, solid_color, width, height, offset);
+       struct stream_resource *stream_res = &pipe_ctx->stream_res;
+
+       if (test_pattern != CONTROLLER_DP_TEST_PATTERN_VIDEOMODE) {
+               pipe_ctx->vtp_locked = false;
+               /* turning on DPG */
+               stream_res->opp->funcs->opp_set_disp_pattern_generator(stream_res->opp, test_pattern, color_space,
+                               color_depth, solid_color, width, height, offset);
+
+               /* Defer hubp blank if tg is locked */
+               if (stream_res->tg->funcs->is_tg_enabled(stream_res->tg)) {
+                       if (stream_res->tg->funcs->is_locked(stream_res->tg))
+                               pipe_ctx->vtp_locked = true;
+                       else
+                               dc->hwss.set_hubp_blank(dc, pipe_ctx, true);
+               }
+       } else {
+               dc->hwss.set_hubp_blank(dc, pipe_ctx, false);
+               /* turning off DPG */
+               stream_res->opp->funcs->opp_set_disp_pattern_generator(stream_res->opp, test_pattern, color_space,
+                               color_depth, solid_color, width, height, offset);
+       }
 }
index bfc97e2..1103f63 100644 (file)
@@ -79,4 +79,8 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,
                const struct tg_color *solid_color,
                int width, int height, int offset);
 
+void dcn30_set_hubp_blank(const struct dc *dc,
+               struct pipe_ctx *pipe_ctx,
+               bool blank_enable);
+
 #endif /* __DC_HWSS_DCN30_H__ */
index 87c74aa..204444f 100644 (file)
@@ -71,6 +71,7 @@ static const struct hw_sequencer_funcs dcn30_funcs = {
        .edp_backlight_control = dce110_edp_backlight_control,
        .edp_power_control = dce110_edp_power_control,
        .edp_wait_for_hpd_ready = dce110_edp_wait_for_hpd_ready,
+       .edp_wait_for_T12 = dce110_edp_wait_for_T12,
        .set_cursor_position = dcn10_set_cursor_position,
        .set_cursor_attribute = dcn10_set_cursor_attribute,
        .set_cursor_sdr_white_level = dcn10_set_cursor_sdr_white_level,
@@ -97,6 +98,7 @@ static const struct hw_sequencer_funcs dcn30_funcs = {
        .hardware_release = dcn30_hardware_release,
        .set_pipe = dcn21_set_pipe,
        .set_disp_pattern_generator = dcn30_set_disp_pattern_generator,
+       .set_hubp_blank = dcn30_set_hubp_blank,
 };
 
 static const struct hwseq_private_funcs dcn30_private_funcs = {
index 3ba3991..8980c90 100644 (file)
@@ -309,6 +309,7 @@ static struct timing_generator_funcs dcn30_tg_funcs = {
                .enable_crtc_reset = optc1_enable_crtc_reset,
                .disable_reset_trigger = optc1_disable_reset_trigger,
                .lock = optc3_lock,
+               .is_locked = optc1_is_locked,
                .unlock = optc1_unlock,
                .lock_doublebuffer_enable = optc3_lock_doublebuffer_enable,
                .lock_doublebuffer_disable = optc3_lock_doublebuffer_disable,
index bdad721..b8bf6d6 100644 (file)
@@ -98,6 +98,7 @@ static const struct hw_sequencer_funcs dcn301_funcs = {
        .set_abm_immediate_disable = dcn21_set_abm_immediate_disable,
        .set_pipe = dcn21_set_pipe,
        .set_disp_pattern_generator = dcn30_set_disp_pattern_generator,
+       .set_hubp_blank = dcn30_set_hubp_blank,
 };
 
 static const struct hwseq_private_funcs dcn301_private_funcs = {
index 4825c5c..35f5bf0 100644 (file)
@@ -1731,6 +1731,7 @@ static struct resource_funcs dcn301_res_pool_funcs = {
        .populate_dml_pipes = dcn30_populate_dml_pipes_from_context,
        .acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer,
        .add_stream_to_ctx = dcn30_add_stream_to_ctx,
+       .add_dsc_to_stream_resource = dcn20_add_dsc_to_stream_resource,
        .remove_stream_from_ctx = dcn20_remove_stream_from_ctx,
        .populate_dml_writeback_from_context = dcn30_populate_dml_writeback_from_context,
        .set_mcif_arb_params = dcn30_set_mcif_arb_params,
index 45f0289..f33e3de 100644 (file)
@@ -3138,7 +3138,7 @@ static void CalculateFlipSchedule(
                                4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime + 0.125),
                                1) / 4.0;
 
-               if ((GPUVMEnable == true || DCCEnable == true)) {
+               if ((GPUVMEnable || DCCEnable)) {
                        mode_lib->vba.ImmediateFlipBW[0] = BandwidthAvailableForImmediateFlip
                                        * ImmediateFlipBytes / TotImmediateFlipBytes;
                        TimeForFetchingRowInVBlankImmediateFlip = dml_max(
index 860e72a..80170f9 100644 (file)
@@ -2635,14 +2635,15 @@ static void dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndP
        }
 
        if (mode_lib->vba.DRAMClockChangeSupportsVActive &&
-                       mode_lib->vba.MinActiveDRAMClockChangeMargin > 60 &&
-                       mode_lib->vba.PrefetchMode[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb] == 0) {
+                       mode_lib->vba.MinActiveDRAMClockChangeMargin > 60) {
                mode_lib->vba.DRAMClockChangeWatermark += 25;
 
                for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) {
-                       if (mode_lib->vba.DRAMClockChangeWatermark >
-                       dml_max(mode_lib->vba.StutterEnterPlusExitWatermark, mode_lib->vba.UrgentWatermark))
-                               mode_lib->vba.MinTTUVBlank[k] += 25;
+                       if (mode_lib->vba.PrefetchMode[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb] == 0) {
+                               if (mode_lib->vba.DRAMClockChangeWatermark >
+                               dml_max(mode_lib->vba.StutterEnterPlusExitWatermark, mode_lib->vba.UrgentWatermark))
+                                       mode_lib->vba.MinTTUVBlank[k] += 25;
+                       }
                }
 
                mode_lib->vba.DRAMClockChangeSupport[0][0] = dm_dram_clock_change_vactive;
index 86ff24d..0bcec11 100644 (file)
@@ -5121,48 +5121,48 @@ void dml21_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                for (j = 0; j < 2; j++) {
                        enum dm_validation_status status = DML_VALIDATION_OK;
 
-                       if (mode_lib->vba.ScaleRatioAndTapsSupport != true) {
+                       if (!mode_lib->vba.ScaleRatioAndTapsSupport) {
                                status = DML_FAIL_SCALE_RATIO_TAP;
-                       } else if (mode_lib->vba.SourceFormatPixelAndScanSupport != true) {
+                       } else if (!mode_lib->vba.SourceFormatPixelAndScanSupport) {
                                status = DML_FAIL_SOURCE_PIXEL_FORMAT;
-                       } else if (locals->ViewportSizeSupport[i][0] != true) {
+                       } else if (!locals->ViewportSizeSupport[i][0]) {
                                status = DML_FAIL_VIEWPORT_SIZE;
-                       } else if (locals->DIOSupport[i] != true) {
+                       } else if (!locals->DIOSupport[i]) {
                                status = DML_FAIL_DIO_SUPPORT;
-                       } else if (locals->NotEnoughDSCUnits[i] != false) {
+                       } else if (locals->NotEnoughDSCUnits[i]) {
                                status = DML_FAIL_NOT_ENOUGH_DSC;
-                       } else if (locals->DSCCLKRequiredMoreThanSupported[i] != false) {
+                       } else if (locals->DSCCLKRequiredMoreThanSupported[i]) {
                                status = DML_FAIL_DSC_CLK_REQUIRED;
-                       } else if (locals->ROBSupport[i][0] != true) {
+                       } else if (!locals->ROBSupport[i][0]) {
                                status = DML_FAIL_REORDERING_BUFFER;
-                       } else if (locals->DISPCLK_DPPCLK_Support[i][j] != true) {
+                       } else if (!locals->DISPCLK_DPPCLK_Support[i][j]) {
                                status = DML_FAIL_DISPCLK_DPPCLK;
-                       } else if (locals->TotalAvailablePipesSupport[i][j] != true) {
+                       } else if (!locals->TotalAvailablePipesSupport[i][j]) {
                                status = DML_FAIL_TOTAL_AVAILABLE_PIPES;
-                       } else if (mode_lib->vba.NumberOfOTGSupport != true) {
+                       } else if (!mode_lib->vba.NumberOfOTGSupport) {
                                status = DML_FAIL_NUM_OTG;
-                       } else if (mode_lib->vba.WritebackModeSupport != true) {
+                       } else if (!mode_lib->vba.WritebackModeSupport) {
                                status = DML_FAIL_WRITEBACK_MODE;
-                       } else if (mode_lib->vba.WritebackLatencySupport != true) {
+                       } else if (!mode_lib->vba.WritebackLatencySupport) {
                                status = DML_FAIL_WRITEBACK_LATENCY;
-                       } else if (mode_lib->vba.WritebackScaleRatioAndTapsSupport != true) {
+                       } else if (!mode_lib->vba.WritebackScaleRatioAndTapsSupport) {
                                status = DML_FAIL_WRITEBACK_SCALE_RATIO_TAP;
-                       } else if (mode_lib->vba.CursorSupport != true) {
+                       } else if (!mode_lib->vba.CursorSupport) {
                                status = DML_FAIL_CURSOR_SUPPORT;
-                       } else if (mode_lib->vba.PitchSupport != true) {
+                       } else if (!mode_lib->vba.PitchSupport) {
                                status = DML_FAIL_PITCH_SUPPORT;
-                       } else if (locals->TotalVerticalActiveBandwidthSupport[i][0] != true) {
+                       } else if (!locals->TotalVerticalActiveBandwidthSupport[i][0]) {
                                status = DML_FAIL_TOTAL_V_ACTIVE_BW;
-                       } else if (locals->PTEBufferSizeNotExceeded[i][j] != true) {
+                       } else if (!locals->PTEBufferSizeNotExceeded[i][j]) {
                                status = DML_FAIL_PTE_BUFFER_SIZE;
-                       } else if (mode_lib->vba.NonsupportedDSCInputBPC != false) {
+                       } else if (mode_lib->vba.NonsupportedDSCInputBPC) {
                                status = DML_FAIL_DSC_INPUT_BPC;
-                       } else if ((mode_lib->vba.HostVMEnable != false
-                                       && locals->ImmediateFlipSupportedForState[i][j] != true)) {
+                       } else if ((mode_lib->vba.HostVMEnable
+                                       && !locals->ImmediateFlipSupportedForState[i][j])) {
                                status = DML_FAIL_HOST_VM_IMMEDIATE_FLIP;
-                       } else if (locals->PrefetchSupported[i][j] != true) {
+                       } else if (!locals->PrefetchSupported[i][j]) {
                                status = DML_FAIL_PREFETCH_SUPPORT;
-                       } else if (locals->VRatioInPrefetchSupported[i][j] != true) {
+                       } else if (!locals->VRatioInPrefetchSupported[i][j]) {
                                status = DML_FAIL_V_RATIO_PREFETCH;
                        }
 
index 319dec5..8fdb34a 100644 (file)
@@ -1219,13 +1219,13 @@ static bool CalculatePrefetchSchedule(
                        dml_print("DML: prefetch_bw_equ: %f\n", prefetch_bw_equ);
 
                        if (prefetch_bw_equ > 0) {
-                               if (GPUVMEnable == true) {
+                               if (GPUVMEnable) {
                                        Tvm_equ = dml_max3(*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / prefetch_bw_equ, Tvm_trips, LineTime / 4);
                                } else {
                                        Tvm_equ = LineTime / 4;
                                }
 
-                               if ((GPUVMEnable == true || myPipe->DCCEnable == true)) {
+                               if ((GPUVMEnable || myPipe->DCCEnable)) {
                                        Tr0_equ = dml_max4(
                                                        (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / prefetch_bw_equ,
                                                        Tr0_trips,
@@ -5558,7 +5558,7 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
                }
        }
 
-       if (mode_lib->vba.MinActiveDRAMClockChangeMargin > 0 && PrefetchMode == 0) {
+       if (mode_lib->vba.MinActiveDRAMClockChangeMargin > 0) {
                *DRAMClockChangeSupport = dm_dram_clock_change_vactive;
        } else if (((mode_lib->vba.SynchronizedVBlank == true || mode_lib->vba.TotalNumberOfActiveOTG == 1 || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0)) {
                *DRAMClockChangeSupport = dm_dram_clock_change_vblank;
index df68430..c6e28f6 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include "dm_services.h"
+#include "hw_factory_diag.h"
 #include "include/gpio_types.h"
 #include "../hw_factory.h"
 
index 8a74f6a..bf68eb1 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef __DAL_HW_FACTORY_DIAG_FPGA_H__
 #define __DAL_HW_FACTORY_DIAG_FPGA_H__
 
+struct hw_factory;
+
 /* Initialize HW factory function pointers and pin info */
 void dal_hw_factory_diag_fpga_init(struct hw_factory *factory);
 
index bf90688..e5138a5 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include "dm_services.h"
+#include "hw_translate_diag.h"
 #include "include/gpio_types.h"
 
 #include "../hw_translate.h"
index 1ae153e..7a8cec2 100644 (file)
@@ -107,13 +107,12 @@ static enum gpio_result set_config(
                                        msleep(3);
                        }
                } else {
-                       uint32_t reg2;
                        uint32_t sda_pd_dis = 0;
                        uint32_t scl_pd_dis = 0;
 
-                       reg2 = REG_GET_2(gpio.MASK_reg,
-                                       DC_GPIO_SDA_PD_DIS, &sda_pd_dis,
-                                       DC_GPIO_SCL_PD_DIS, &scl_pd_dis);
+                       REG_GET_2(gpio.MASK_reg,
+                                 DC_GPIO_SDA_PD_DIS, &sda_pd_dis,
+                                 DC_GPIO_SCL_PD_DIS, &scl_pd_dis);
 
                        if (sda_pd_dis) {
                                REG_SET(gpio.MASK_reg, regval,
index da73bfb..92c65d2 100644 (file)
@@ -119,17 +119,3 @@ bool dal_hw_factory_init(
                return false;
        }
 }
-
-void dal_hw_factory_destroy(
-       struct dc_context *ctx,
-       struct hw_factory **factory)
-{
-       if (!factory || !*factory) {
-               BREAK_TO_DEBUGGER();
-               return;
-       }
-
-       kfree(*factory);
-
-       *factory = NULL;
-}
index 2d77eac..8efa1b8 100644 (file)
@@ -333,6 +333,7 @@ struct pipe_ctx {
        union pipe_update_flags update_flags;
        struct dwbc *dwbc;
        struct mcif_wb *mcif_wb;
+       bool vtp_locked;
 };
 
 struct resource_context {
index f7632fe..754832d 100644 (file)
@@ -190,6 +190,7 @@ struct timing_generator_funcs {
        void (*set_blank)(struct timing_generator *tg,
                                        bool enable_blanking);
        bool (*is_blanked)(struct timing_generator *tg);
+       bool (*is_locked)(struct timing_generator *tg);
        void (*set_overscan_blank_color) (struct timing_generator *tg, const struct tg_color *color);
        void (*set_blank_color)(struct timing_generator *tg, const struct tg_color *color);
        void (*set_colors)(struct timing_generator *tg,
index 7b12ffc..48378be 100644 (file)
@@ -54,6 +54,7 @@ struct hw_sequencer_funcs {
        /* Embedded Display Related */
        void (*edp_power_control)(struct dc_link *link, bool enable);
        void (*edp_wait_for_hpd_ready)(struct dc_link *link, bool power_up);
+       void (*edp_wait_for_T12)(struct dc_link *link);
 
        /* Pipe Programming Related */
        void (*init_hw)(struct dc *dc);
@@ -229,6 +230,10 @@ struct hw_sequencer_funcs {
                        enum dc_color_depth color_depth,
                        const struct tg_color *solid_color,
                        int width, int height, int offset);
+
+       void (*set_hubp_blank)(const struct dc *dc,
+                       struct pipe_ctx *pipe_ctx,
+                       bool blank_enable);
 };
 
 void color_space_to_black_color(
index 6bf27bd..5f245bd 100644 (file)
@@ -79,7 +79,7 @@ void dal_irq_service_destroy(struct irq_service **irq_service)
        *irq_service = NULL;
 }
 
-const struct irq_source_info *find_irq_source_info(
+static const struct irq_source_info *find_irq_source_info(
        struct irq_service *irq_service,
        enum dc_irq_source source)
 {
index f00df02..7e6f4db 100644 (file)
@@ -26,6 +26,7 @@
 #include "../dmub_srv.h"
 #include "dmub_reg.h"
 #include "dmub_dcn20.h"
+#include "dmub_dcn30.h"
 
 #include "sienna_cichlid_ip_offset.h"
 #include "dcn/dcn_3_0_0_offset.h"
index 0fdf7a3..57f198d 100644 (file)
@@ -409,16 +409,11 @@ void mod_build_vsc_infopacket(const struct dc_stream_state *stream,
 }
 
 /**
- *****************************************************************************
- *  Function: mod_build_hf_vsif_infopacket
+ *  mod_build_hf_vsif_infopacket - Prepare HDMI Vendor Specific info frame.
+ *                                 Follows HDMI Spec to build up Vendor Specific info frame
  *
- *  @brief
- *     Prepare HDMI Vendor Specific info frame.
- *     Follows HDMI Spec to build up Vendor Specific info frame
- *
- *  @param [in] stream: contains data we may need to construct VSIF (i.e. timing_3d_format, etc.)
- *  @param [out] info_packet:   output structure where to store VSIF
- *****************************************************************************
+ *  @stream:      contains data we may need to construct VSIF (i.e. timing_3d_format, etc.)
+ *  @info_packet: output structure where to store VSIF
  */
 void mod_build_hf_vsif_infopacket(const struct dc_stream_state *stream,
                struct dc_info_packet *info_packet)
index 4fd8bce..3d4c669 100644 (file)
@@ -278,7 +278,7 @@ static void fill_backlight_transform_table_v_2_2(struct dmcu_iram_parameters par
        }
 }
 
-void fill_iram_v_2(struct iram_table_v_2 *ram_table, struct dmcu_iram_parameters params)
+static void fill_iram_v_2(struct iram_table_v_2 *ram_table, struct dmcu_iram_parameters params)
 {
        unsigned int set = params.set;
 
@@ -452,7 +452,7 @@ void fill_iram_v_2(struct iram_table_v_2 *ram_table, struct dmcu_iram_parameters
                        params, ram_table);
 }
 
-void fill_iram_v_2_2(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parameters params)
+static void fill_iram_v_2_2(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parameters params)
 {
        unsigned int set = params.set;
 
@@ -598,7 +598,7 @@ void fill_iram_v_2_2(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame
                        params, ram_table, true);
 }
 
-void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parameters params, bool big_endian)
+static void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parameters params, bool big_endian)
 {
        unsigned int i, j;
        unsigned int set = params.set;
index 270f8db..a41875a 100644 (file)
@@ -103,6 +103,7 @@ enum pp_clock_type {
 
 enum amd_pp_sensors {
        AMDGPU_PP_SENSOR_GFX_SCLK = 0,
+       AMDGPU_PP_SENSOR_CPU_CLK,
        AMDGPU_PP_SENSOR_VDDNB,
        AMDGPU_PP_SENSOR_VDDGFX,
        AMDGPU_PP_SENSOR_UVD_VCLK,
@@ -155,6 +156,7 @@ enum {
 enum PP_OD_DPM_TABLE_COMMAND {
        PP_OD_EDIT_SCLK_VDDC_TABLE,
        PP_OD_EDIT_MCLK_VDDC_TABLE,
+       PP_OD_EDIT_CCLK_VDDC_TABLE,
        PP_OD_EDIT_VDDC_CURVE,
        PP_OD_RESTORE_DEFAULT_TABLE,
        PP_OD_COMMIT_DPM_TABLE,
index 07633e2..7dff85c 100644 (file)
@@ -33,7 +33,7 @@ struct IP_BASE_INSTANCE
 struct IP_BASE
 {
     struct IP_BASE_INSTANCE instance[MAX_INSTANCE];
-};
+} __maybe_unused;
 
 
 static const struct IP_BASE ACP_BASE ={ { { { 0x02403800, 0x00480000, 0, 0, 0 } },
index f5d97b9..e9b569b 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/hwmon-sysfs.h>
 #include <linux/nospec.h>
 #include <linux/pm_runtime.h>
+#include <asm/processor.h>
 #include "hwmgr.h"
 
 static const struct cg_flag_name clocks[] = {
@@ -799,6 +800,8 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
 
        if (*buf == 's')
                type = PP_OD_EDIT_SCLK_VDDC_TABLE;
+       else if (*buf == 'p')
+               type = PP_OD_EDIT_CCLK_VDDC_TABLE;
        else if (*buf == 'm')
                type = PP_OD_EDIT_MCLK_VDDC_TABLE;
        else if(*buf == 'r')
@@ -915,6 +918,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
                size += smu_print_clk_levels(&adev->smu, SMU_OD_VDDC_CURVE, buf+size);
                size += smu_print_clk_levels(&adev->smu, SMU_OD_VDDGFX_OFFSET, buf+size);
                size += smu_print_clk_levels(&adev->smu, SMU_OD_RANGE, buf+size);
+               size += smu_print_clk_levels(&adev->smu, SMU_OD_CCLK, buf+size);
        } else if (adev->powerplay.pp_funcs->print_clock_levels) {
                size = amdgpu_dpm_print_clock_levels(adev, OD_SCLK, buf);
                size += amdgpu_dpm_print_clock_levels(adev, OD_MCLK, buf+size);
@@ -2217,7 +2221,7 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
        } else if (DEVICE_ATTR_IS(pp_od_clk_voltage)) {
                *states = ATTR_STATE_UNSUPPORTED;
                if ((is_support_sw_smu(adev) && adev->smu.od_enabled) ||
-                   (is_support_sw_smu(adev) && adev->smu.fine_grain_enabled) ||
+                   (is_support_sw_smu(adev) && adev->smu.is_apu) ||
                        (!is_support_sw_smu(adev) && hwmgr->od_enabled))
                        *states = ATTR_STATE_SUPPORTED;
        } else if (DEVICE_ATTR_IS(mem_busy_percent)) {
@@ -3622,6 +3626,27 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
  */
 #if defined(CONFIG_DEBUG_FS)
 
+static void amdgpu_debugfs_prints_cpu_info(struct seq_file *m,
+                                          struct amdgpu_device *adev) {
+       uint16_t *p_val;
+       uint32_t size;
+       int i;
+
+       if (is_support_cclk_dpm(adev)) {
+               p_val = kcalloc(adev->smu.cpu_core_num, sizeof(uint16_t),
+                               GFP_KERNEL);
+
+               if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_CPU_CLK,
+                                           (void *)p_val, &size)) {
+                       for (i = 0; i < adev->smu.cpu_core_num; i++)
+                               seq_printf(m, "\t%u MHz (CPU%d)\n",
+                                          *(p_val + i), i);
+               }
+
+               kfree(p_val);
+       }
+}
+
 static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *adev)
 {
        uint32_t value;
@@ -3632,6 +3657,9 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a
        /* GPU Clocks */
        size = sizeof(value);
        seq_printf(m, "GFX Clocks and Power:\n");
+
+       amdgpu_debugfs_prints_cpu_info(m, adev);
+
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GFX_MCLK, (void *)&value, &size))
                seq_printf(m, "\t%u MHz (MCLK)\n", value/100);
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GFX_SCLK, (void *)&value, &size))
index e2e59fb..a087e00 100644 (file)
@@ -466,8 +466,13 @@ struct smu_context
        uint32_t gfx_actual_hard_min_freq;
        uint32_t gfx_actual_soft_max_freq;
 
-       bool fine_grain_enabled;
-       bool fine_grain_started;
+       /* APU only */
+       uint32_t cpu_default_soft_min_freq;
+       uint32_t cpu_default_soft_max_freq;
+       uint32_t cpu_actual_soft_min_freq;
+       uint32_t cpu_actual_soft_max_freq;
+       uint32_t cpu_core_id_select;
+       uint16_t cpu_core_num;
 };
 
 struct i2c_adapter;
@@ -1125,6 +1130,7 @@ typedef enum {
        METRICS_CURR_DCLK1,
        METRICS_CURR_FCLK,
        METRICS_CURR_DCEFCLK,
+       METRICS_AVERAGE_CPUCLK,
        METRICS_AVERAGE_GFXCLK,
        METRICS_AVERAGE_SOCCLK,
        METRICS_AVERAGE_FCLK,
@@ -1253,6 +1259,7 @@ extern const struct amdgpu_ip_block_version smu_v11_0_ip_block;
 extern const struct amdgpu_ip_block_version smu_v12_0_ip_block;
 
 bool is_support_sw_smu(struct amdgpu_device *adev);
+bool is_support_cclk_dpm(struct amdgpu_device *adev);
 int smu_reset(struct smu_context *smu);
 int smu_sys_get_pp_table(struct smu_context *smu, void **table);
 int smu_sys_set_pp_table(struct smu_context *smu,  void *buf, size_t size);
index 8e428c7..b76270e 100644 (file)
@@ -237,6 +237,7 @@ enum smu_clk_type {
        SMU_SCLK,
        SMU_MCLK,
        SMU_PCIE,
+       SMU_OD_CCLK,
        SMU_OD_SCLK,
        SMU_OD_MCLK,
        SMU_OD_VDDC_CURVE,
index 13de692..102a0cf 100644 (file)
@@ -31,7 +31,7 @@
 #define SMU11_DRIVER_IF_VERSION_NV12 0x36
 #define SMU11_DRIVER_IF_VERSION_NV14 0x36
 #define SMU11_DRIVER_IF_VERSION_Sienna_Cichlid 0x3D
-#define SMU11_DRIVER_IF_VERSION_Navy_Flounder 0xC
+#define SMU11_DRIVER_IF_VERSION_Navy_Flounder 0xE
 #define SMU11_DRIVER_IF_VERSION_VANGOGH 0x02
 #define SMU11_DRIVER_IF_VERSION_Dimgrey_Cavefish 0xF
 
index 6a7de8b..f2cef09 100644 (file)
@@ -33,6 +33,7 @@
 #include "ppsmc.h"
 #include "amd_acpi.h"
 #include "pp_psm.h"
+#include "vega10_hwmgr.h"
 
 extern const struct pp_smumgr_func ci_smu_funcs;
 extern const struct pp_smumgr_func smu8_smu_funcs;
@@ -46,7 +47,6 @@ extern const struct pp_smumgr_func vega12_smu_funcs;
 extern const struct pp_smumgr_func smu10_smu_funcs;
 extern const struct pp_smumgr_func vega20_smu_funcs;
 
-extern int vega10_hwmgr_init(struct pp_hwmgr *hwmgr);
 extern int smu10_init_function_pointers(struct pp_hwmgr *hwmgr);
 
 static int polaris_set_asic_special_caps(struct pp_hwmgr *hwmgr);
index 83a6504..b1038d3 100644 (file)
@@ -279,7 +279,7 @@ static const ATOM_VOLTAGE_OBJECT_V3 *atomctrl_lookup_voltage_type_v3(
  *
  * @hwmgr:           input parameter: pointer to HwMgr
  * @clock_value:     input parameter: memory clock
- * @dividers:        output parameter: memory PLL dividers
+ * @mpll_param:      output parameter: memory clock parameters
  * @strobe_mode:     input parameter: 1 for strobe mode,  0 for performance mode
  */
 int atomctrl_get_memory_pll_dividers_si(
@@ -332,7 +332,7 @@ int atomctrl_get_memory_pll_dividers_si(
  *
  * @hwmgr:                 input parameter: pointer to HwMgr
  * @clock_value:           input parameter: memory clock
- * @dividers:              output parameter: memory PLL dividers
+ * @mpll_param:            output parameter: memory clock parameters
  */
 int atomctrl_get_memory_pll_dividers_vi(struct pp_hwmgr *hwmgr,
                uint32_t clock_value, pp_atomctrl_memory_clock_param *mpll_param)
index 741e03a..f2a55c1 100644 (file)
@@ -1362,6 +1362,7 @@ static int ppt_get_vce_state_table_entry_v1_0(struct pp_hwmgr *hwmgr, uint32_t i
  * @hwmgr: Pointer to the hardware manager.
  * @entry_index: The index of the entry to be extracted from the table.
  * @power_state: The address of the PowerState instance being created.
+ * @call_back_func: The function to call into to fill power state
  * Return: -1 if the entry cannot be retrieved.
  */
 int get_powerplay_table_entry_v1_0(struct pp_hwmgr *hwmgr,
index 82676c0..c57dc9a 100644 (file)
@@ -235,7 +235,7 @@ static int smu7_get_current_pcie_lane_number(struct pp_hwmgr *hwmgr)
 /**
  * smu7_enable_smc_voltage_controller - Enable voltage control
  *
- * @hwmgr  the address of the powerplay hardware manager.
+ * @hwmgr:  the address of the powerplay hardware manager.
  * Return:   always PP_Result_OK
  */
 static int smu7_enable_smc_voltage_controller(struct pp_hwmgr *hwmgr)
@@ -4501,7 +4501,7 @@ static int smu7_display_configuration_changed_task(struct pp_hwmgr *hwmgr)
  * smu7_set_max_fan_rpm_output - Set maximum target operating fan output RPM
  *
  * @hwmgr:  the address of the powerplay hardware manager.
- * @usMaxFanRpm:  max operating fan RPM value.
+ * @us_max_fan_rpm:  max operating fan RPM value.
  * Return:   The response that came from the SMC.
  */
 static int smu7_set_max_fan_rpm_output(struct pp_hwmgr *hwmgr, uint16_t us_max_fan_rpm)
index 1b47f94..29c9964 100644 (file)
@@ -542,11 +542,11 @@ static int vega10_get_socclk_for_voltage_evv(struct pp_hwmgr *hwmgr,
 
 #define ATOM_VIRTUAL_VOLTAGE_ID0             0xff01
 /**
-* Get Leakage VDDC based on leakage ID.
-*
-* @param    hwmgr  the address of the powerplay hardware manager.
-* @return   always 0.
-*/
+ * Get Leakage VDDC based on leakage ID.
+ *
+ * @hwmgr:  the address of the powerplay hardware manager.
+ * return:  always 0.
+ */
 static int vega10_get_evv_voltages(struct pp_hwmgr *hwmgr)
 {
        struct vega10_hwmgr *data = hwmgr->backend;
@@ -600,9 +600,9 @@ static int vega10_get_evv_voltages(struct pp_hwmgr *hwmgr)
 /**
  * Change virtual leakage voltage to actual value.
  *
- * @param     hwmgr  the address of the powerplay hardware manager.
- * @param     pointer to changing voltage
- * @param     pointer to leakage table
+ * @hwmgr:         the address of the powerplay hardware manager.
+ * @voltage:       pointer to changing voltage
+ * @leakage_table: pointer to leakage table
  */
 static void vega10_patch_with_vdd_leakage(struct pp_hwmgr *hwmgr,
                uint16_t *voltage, struct vega10_leakage_voltage *leakage_table)
@@ -624,13 +624,13 @@ static void vega10_patch_with_vdd_leakage(struct pp_hwmgr *hwmgr,
 }
 
 /**
-* Patch voltage lookup table by EVV leakages.
-*
-* @param     hwmgr  the address of the powerplay hardware manager.
-* @param     pointer to voltage lookup table
-* @param     pointer to leakage table
-* @return     always 0
-*/
+ * Patch voltage lookup table by EVV leakages.
+ *
+ * @hwmgr:         the address of the powerplay hardware manager.
+ * @lookup_table:  pointer to voltage lookup table
+ * @leakage_table: pointer to leakage table
+ * return:         always 0
+ */
 static int vega10_patch_lookup_table_with_leakage(struct pp_hwmgr *hwmgr,
                phm_ppt_v1_voltage_lookup_table *lookup_table,
                struct vega10_leakage_voltage *leakage_table)
@@ -1001,13 +1001,12 @@ static int vega10_setup_asic_task(struct pp_hwmgr *hwmgr)
 }
 
 /**
-* Remove repeated voltage values and create table with unique values.
-*
-* @param    hwmgr  the address of the powerplay hardware manager.
-* @param    vol_table  the pointer to changing voltage table
-* @return    0 in success
-*/
-
+ * Remove repeated voltage values and create table with unique values.
+ *
+ * @hwmgr:      the address of the powerplay hardware manager.
+ * @vol_table:  the pointer to changing voltage table
+ * return:      0 in success
+ */
 static int vega10_trim_voltage_table(struct pp_hwmgr *hwmgr,
                struct pp_atomfwctrl_voltage_table *vol_table)
 {
@@ -1151,11 +1150,11 @@ static void vega10_trim_voltage_table_to_fit_state_table(
 }
 
 /**
-* Create Voltage Tables.
-*
-* @param    hwmgr  the address of the powerplay hardware manager.
-* @return   always 0
-*/
+ * Create Voltage Tables.
+ *
+ * @hwmgr:  the address of the powerplay hardware manager.
+ * return:  always 0
+ */
 static int vega10_construct_voltage_tables(struct pp_hwmgr *hwmgr)
 {
        struct vega10_hwmgr *data = hwmgr->backend;
@@ -1212,11 +1211,11 @@ static int vega10_construct_voltage_tables(struct pp_hwmgr *hwmgr)
 }
 
 /*
- * @fn vega10_init_dpm_state
- * @brief Function to initialize all Soft Min/Max and Hard Min/Max to 0xff.
+ * vega10_init_dpm_state
+ * Function to initialize all Soft Min/Max and Hard Min/Max to 0xff.
  *
- * @param    dpm_state - the address of the DPM Table to initiailize.
- * @return   None.
+ * @dpm_state: - the address of the DPM Table to initiailize.
+ * return:   None.
  */
 static void vega10_init_dpm_state(struct vega10_dpm_state *dpm_state)
 {
@@ -1460,11 +1459,11 @@ static int vega10_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)
 }
 
 /*
- * @fn vega10_populate_ulv_state
- * @brief Function to provide parameters for Utral Low Voltage state to SMC.
+ * vega10_populate_ulv_state
+ * Function to provide parameters for Utral Low Voltage state to SMC.
  *
- * @param    hwmgr - the address of the hardware manager.
- * @return   Always 0.
+ * @hwmgr: - the address of the hardware manager.
+ * return:   Always 0.
  */
 static int vega10_populate_ulv_state(struct pp_hwmgr *hwmgr)
 {
@@ -1545,13 +1544,13 @@ static int vega10_populate_smc_link_levels(struct pp_hwmgr *hwmgr)
 }
 
 /**
-* Populates single SMC GFXSCLK structure using the provided engine clock
-*
-* @param    hwmgr      the address of the hardware manager
-* @param    gfx_clock  the GFX clock to use to populate the structure.
-* @param    current_gfxclk_level  location in PPTable for the SMC GFXCLK structure.
-*/
-
+ * Populates single SMC GFXSCLK structure using the provided engine clock
+ *
+ * @hwmgr:      the address of the hardware manager
+ * @gfx_clock:  the GFX clock to use to populate the structure.
+ * @current_gfxclk_level:  location in PPTable for the SMC GFXCLK structure.
+ * @acg_freq:   ACG frequenty to return (MHz)
+ */
 static int vega10_populate_single_gfx_level(struct pp_hwmgr *hwmgr,
                uint32_t gfx_clock, PllSetting_t *current_gfxclk_level,
                uint32_t *acg_freq)
@@ -1610,12 +1609,13 @@ static int vega10_populate_single_gfx_level(struct pp_hwmgr *hwmgr,
 }
 
 /**
- * @brief Populates single SMC SOCCLK structure using the provided clock.
+ * Populates single SMC SOCCLK structure using the provided clock.
  *
- * @param    hwmgr - the address of the hardware manager.
- * @param    soc_clock - the SOC clock to use to populate the structure.
- * @param    current_socclk_level - location in PPTable for the SMC SOCCLK structure.
- * @return   0 on success..
+ * @hwmgr:     the address of the hardware manager.
+ * @soc_clock: the SOC clock to use to populate the structure.
+ * @current_soc_did:   DFS divider to pass back to caller
+ * @current_vol_index: index of current VDD to pass back to caller
+ * return:      0 on success
  */
 static int vega10_populate_single_soc_level(struct pp_hwmgr *hwmgr,
                uint32_t soc_clock, uint8_t *current_soc_did,
@@ -1659,10 +1659,10 @@ static int vega10_populate_single_soc_level(struct pp_hwmgr *hwmgr,
 }
 
 /**
-* Populates all SMC SCLK levels' structure based on the trimmed allowed dpm engine clock states
-*
-* @param    hwmgr      the address of the hardware manager
-*/
+ * Populates all SMC SCLK levels' structure based on the trimmed allowed dpm engine clock states
+ *
+ * @hwmgr:      the address of the hardware manager
+ */
 static int vega10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
 {
        struct vega10_hwmgr *data = hwmgr->backend;
@@ -1746,12 +1746,12 @@ static void vega10_populate_vddc_soc_levels(struct pp_hwmgr *hwmgr)
        }
 }
 
-/**
- * @brief Populates single SMC GFXCLK structure using the provided clock.
+/*
+ * Populates single SMC GFXCLK structure using the provided clock.
  *
- * @param    hwmgr - the address of the hardware manager.
- * @param    mem_clock - the memory clock to use to populate the structure.
- * @return   0 on success..
+ * @hwmgr:     the address of the hardware manager.
+ * @mem_clock: the memory clock to use to populate the structure.
+ * return:     0 on success..
  */
 static int vega10_populate_single_memory_level(struct pp_hwmgr *hwmgr,
                uint32_t mem_clock, uint8_t *current_mem_vid,
@@ -1808,10 +1808,10 @@ static int vega10_populate_single_memory_level(struct pp_hwmgr *hwmgr,
 }
 
 /**
- * @brief Populates all SMC MCLK levels' structure based on the trimmed allowed dpm memory clock states.
+ * Populates all SMC MCLK levels' structure based on the trimmed allowed dpm memory clock states.
  *
- * @param    pHwMgr - the address of the hardware manager.
- * @return   PP_Result_OK on success.
+ * @hwmgr:  the address of the hardware manager.
+ * return:   PP_Result_OK on success.
  */
 static int vega10_populate_all_memory_levels(struct pp_hwmgr *hwmgr)
 {
@@ -2486,12 +2486,11 @@ static void vega10_check_dpm_table_updated(struct pp_hwmgr *hwmgr)
 }
 
 /**
-* Initializes the SMC table and uploads it
-*
-* @param    hwmgr  the address of the powerplay hardware manager.
-* @param    pInput  the pointer to input data (PowerState)
-* @return   always 0
-*/
+ * Initializes the SMC table and uploads it
+ *
+ * @hwmgr:  the address of the powerplay hardware manager.
+ * return:  always 0
+ */
 static int vega10_init_smc_table(struct pp_hwmgr *hwmgr)
 {
        int result;
@@ -2864,11 +2863,11 @@ static int vega10_stop_dpm(struct pp_hwmgr *hwmgr, uint32_t bitmap)
 }
 
 /**
- * @brief Tell SMC to enabled the supported DPMs.
+ * Tell SMC to enabled the supported DPMs.
  *
- * @param    hwmgr - the address of the powerplay hardware manager.
- * @Param    bitmap - bitmap for the features to enabled.
- * @return   0 on at least one DPM is successfully enabled.
+ * @hwmgr:   the address of the powerplay hardware manager.
+ * @bitmap:  bitmap for the features to enabled.
+ * return:  0 on at least one DPM is successfully enabled.
  */
 static int vega10_start_dpm(struct pp_hwmgr *hwmgr, uint32_t bitmap)
 {
index f752b4a..07c06f8 100644 (file)
@@ -442,5 +442,6 @@ int vega10_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate);
 int vega10_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate);
 int vega10_update_acp_dpm(struct pp_hwmgr *hwmgr, bool bgate);
 int vega10_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable);
+int vega10_hwmgr_init(struct pp_hwmgr *hwmgr);
 
 #endif /* _VEGA10_HWMGR_H_ */
index dc206fa..c075302 100644 (file)
@@ -718,12 +718,11 @@ static int vega12_save_default_power_profile(struct pp_hwmgr *hwmgr)
 #endif
 
 /**
-* Initializes the SMC table and uploads it
-*
-* @param    hwmgr  the address of the powerplay hardware manager.
-* @param    pInput  the pointer to input data (PowerState)
-* @return   always 0
-*/
+ * Initializes the SMC table and uploads it
+ *
+ * @hwmgr:  the address of the powerplay hardware manager.
+ * return:  always 0
+ */
 static int vega12_init_smc_table(struct pp_hwmgr *hwmgr)
 {
        int result;
index da84012..87811b0 100644 (file)
@@ -771,12 +771,11 @@ static int vega20_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)
 }
 
 /**
-* Initializes the SMC table and uploads it
-*
-* @param    hwmgr  the address of the powerplay hardware manager.
-* @param    pInput  the pointer to input data (PowerState)
-* @return   always 0
-*/
+ * Initializes the SMC table and uploads it
+ *
+ * @hwmgr:  the address of the powerplay hardware manager.
+ * return:  always 0
+ */
 static int vega20_init_smc_table(struct pp_hwmgr *hwmgr)
 {
        int result;
index 8e1e97e..7fe61ad 100644 (file)
@@ -288,6 +288,20 @@ bool is_support_sw_smu(struct amdgpu_device *adev)
        return false;
 }
 
+bool is_support_cclk_dpm(struct amdgpu_device *adev)
+{
+       struct smu_context *smu = &adev->smu;
+
+       if (!is_support_sw_smu(adev))
+               return false;
+
+       if (!smu_feature_is_enabled(smu, SMU_FEATURE_CCLK_DPM_BIT))
+               return false;
+
+       return true;
+}
+
+
 int smu_sys_get_pp_table(struct smu_context *smu, void **table)
 {
        struct smu_table_context *smu_table = &smu->smu_table;
@@ -402,15 +416,9 @@ static int smu_set_funcs(struct amdgpu_device *adev)
                break;
        case CHIP_RENOIR:
                renoir_set_ppt_funcs(smu);
-               /* enable the fine grain tuning function by default */
-               smu->fine_grain_enabled = true;
-               /* close the fine grain tuning function by default */
-               smu->fine_grain_started = false;
                break;
        case CHIP_VANGOGH:
                vangogh_set_ppt_funcs(smu);
-               /* enable the OD by default to allow the fine grain tuning function */
-               smu->od_enabled = true;
                break;
        default:
                return -EINVAL;
index b279dbb..147efe1 100644 (file)
@@ -1119,6 +1119,7 @@ int smu_v11_0_gfx_off_control(struct smu_context *smu, bool enable)
        case CHIP_SIENNA_CICHLID:
        case CHIP_NAVY_FLOUNDER:
        case CHIP_DIMGREY_CAVEFISH:
+       case CHIP_VANGOGH:
                if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
                        return 0;
                if (enable)
index a79dd04..dc41abe 100644 (file)
@@ -34,6 +34,7 @@
 #include "soc15_common.h"
 #include "asic_reg/gc/gc_10_3_0_offset.h"
 #include "asic_reg/gc/gc_10_3_0_sh_mask.h"
+#include <asm/processor.h>
 
 /*
  * DO NOT use these for err/warn/info/debug messages.
@@ -62,7 +63,8 @@ static struct cmn2asic_msg_mapping vangogh_message_map[SMU_MSG_MAX_COUNT] = {
        MSG_MAP(GetSmuVersion,                  PPSMC_MSG_GetSmuVersion,                0),
        MSG_MAP(GetDriverIfVersion,             PPSMC_MSG_GetDriverIfVersion,   0),
        MSG_MAP(EnableGfxOff,                   PPSMC_MSG_EnableGfxOff,                 0),
-       MSG_MAP(DisallowGfxOff,                 PPSMC_MSG_DisableGfxOff,                0),
+       MSG_MAP(AllowGfxOff,                    PPSMC_MSG_AllowGfxOff,          0),
+       MSG_MAP(DisallowGfxOff,                 PPSMC_MSG_DisallowGfxOff,               0),
        MSG_MAP(PowerDownIspByTile,             PPSMC_MSG_PowerDownIspByTile,   0),
        MSG_MAP(PowerUpIspByTile,               PPSMC_MSG_PowerUpIspByTile,             0),
        MSG_MAP(PowerDownVcn,                   PPSMC_MSG_PowerDownVcn,                 0),
@@ -178,6 +180,14 @@ static struct cmn2asic_mapping vangogh_table_map[SMU_TABLE_COUNT] = {
        TAB_MAP_VALID(DPMCLOCKS),
 };
 
+static struct cmn2asic_mapping vangogh_workload_map[PP_SMC_POWER_PROFILE_COUNT] = {
+       WORKLOAD_MAP(PP_SMC_POWER_PROFILE_FULLSCREEN3D,         WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT),
+       WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VIDEO,                WORKLOAD_PPLIB_VIDEO_BIT),
+       WORKLOAD_MAP(PP_SMC_POWER_PROFILE_VR,                   WORKLOAD_PPLIB_VR_BIT),
+       WORKLOAD_MAP(PP_SMC_POWER_PROFILE_COMPUTE,              WORKLOAD_PPLIB_COMPUTE_BIT),
+       WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM,               WORKLOAD_PPLIB_CUSTOM_BIT),
+};
+
 static int vangogh_tables_init(struct smu_context *smu)
 {
        struct smu_table_context *smu_table = &smu->smu_table;
@@ -285,6 +295,10 @@ static int vangogh_get_smu_metrics_data(struct smu_context *smu,
        case METRICS_VOLTAGE_VDDSOC:
                *value = metrics->Voltage[1];
                break;
+       case METRICS_AVERAGE_CPUCLK:
+               memcpy(value, &metrics->CoreFrequency[0],
+                      smu->cpu_core_num * sizeof(uint16_t));
+               break;
        default:
                *value = UINT_MAX;
                break;
@@ -321,6 +335,13 @@ static int vangogh_init_smc_tables(struct smu_context *smu)
        if (ret)
                return ret;
 
+#ifdef CONFIG_X86
+       /* AMD x86 APU only */
+       smu->cpu_core_num = boot_cpu_data.x86_max_cores;
+#else
+       smu->cpu_core_num = 4;
+#endif
+
        return smu_v11_0_init_smc_tables(smu);
 }
 
@@ -330,17 +351,13 @@ static int vangogh_dpm_set_vcn_enable(struct smu_context *smu, bool enable)
 
        if (enable) {
                /* vcn dpm on is a prerequisite for vcn power gate messages */
-               if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT)) {
-                       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 0, NULL);
-                       if (ret)
-                               return ret;
-               }
+               ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 0, NULL);
+               if (ret)
+                       return ret;
        } else {
-               if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT)) {
-                       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerDownVcn, 0, NULL);
-                       if (ret)
-                               return ret;
-               }
+               ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerDownVcn, 0, NULL);
+               if (ret)
+                       return ret;
        }
 
        return ret;
@@ -351,64 +368,18 @@ static int vangogh_dpm_set_jpeg_enable(struct smu_context *smu, bool enable)
        int ret = 0;
 
        if (enable) {
-               if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_JPEG_PG_BIT)) {
-                       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerUpJpeg, 0, NULL);
-                       if (ret)
-                               return ret;
-               }
+               ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerUpJpeg, 0, NULL);
+               if (ret)
+                       return ret;
        } else {
-               if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_JPEG_PG_BIT)) {
-                       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerDownJpeg, 0, NULL);
-                       if (ret)
-                               return ret;
-               }
+               ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_PowerDownJpeg, 0, NULL);
+               if (ret)
+                       return ret;
        }
 
        return ret;
 }
 
-static int vangogh_get_allowed_feature_mask(struct smu_context *smu,
-                                           uint32_t *feature_mask,
-                                           uint32_t num)
-{
-       struct amdgpu_device *adev = smu->adev;
-
-       if (num > 2)
-               return -EINVAL;
-
-       memset(feature_mask, 0, sizeof(uint32_t) * num);
-
-       *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_GFX_DPM_BIT)
-                               | FEATURE_MASK(FEATURE_MP0CLK_DPM_BIT)
-                               | FEATURE_MASK(FEATURE_SOCCLK_DPM_BIT)
-                               | FEATURE_MASK(FEATURE_VCN_DPM_BIT)
-                               | FEATURE_MASK(FEATURE_FCLK_DPM_BIT)
-                               | FEATURE_MASK(FEATURE_DCFCLK_DPM_BIT)
-                               | FEATURE_MASK(FEATURE_DS_SOCCLK_BIT)
-                               | FEATURE_MASK(FEATURE_PPT_BIT)
-                               | FEATURE_MASK(FEATURE_TDC_BIT)
-                               | FEATURE_MASK(FEATURE_FAN_CONTROLLER_BIT)
-                               | FEATURE_MASK(FEATURE_DS_LCLK_BIT)
-                               | FEATURE_MASK(FEATURE_DS_DCFCLK_BIT);
-
-       if (adev->pm.pp_feature & PP_SOCCLK_DPM_MASK)
-               *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_SOCCLK_DPM_BIT);
-
-       if (adev->pm.pp_feature & PP_DCEFCLK_DPM_MASK)
-               *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DCFCLK_DPM_BIT);
-
-       if (adev->pm.pp_feature & PP_MCLK_DPM_MASK)
-               *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_FCLK_DPM_BIT);
-
-       if (adev->pm.pp_feature & PP_SCLK_DPM_MASK)
-               *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_GFX_DPM_BIT);
-
-       if (smu->adev->pg_flags & AMD_PG_SUPPORT_ATHUB)
-               *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_ATHUB_PG_BIT);
-
-       return 0;
-}
-
 static bool vangogh_is_dpm_running(struct smu_context *smu)
 {
        int ret = 0;
@@ -474,6 +445,7 @@ static int vangogh_print_fine_grain_clk(struct smu_context *smu,
 {
        DpmClocks_t *clk_table = smu->smu_table.clocks_table;
        SmuMetrics_t metrics;
+       struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
        int i, size = 0, ret = 0;
        uint32_t cur_value = 0, value = 0, count = 0;
        bool cur_value_match_level = false;
@@ -486,7 +458,7 @@ static int vangogh_print_fine_grain_clk(struct smu_context *smu,
 
        switch (clk_type) {
        case SMU_OD_SCLK:
-               if (smu->od_enabled) {
+               if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
                        size = sprintf(buf, "%s:\n", "OD_SCLK");
                        size += sprintf(buf + size, "0: %10uMhz\n",
                        (smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq);
@@ -494,11 +466,22 @@ static int vangogh_print_fine_grain_clk(struct smu_context *smu,
                        (smu->gfx_actual_soft_max_freq > 0) ? smu->gfx_actual_soft_max_freq : smu->gfx_default_soft_max_freq);
                }
                break;
+       case SMU_OD_CCLK:
+               if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
+                       size = sprintf(buf, "CCLK_RANGE in Core%d:\n",  smu->cpu_core_id_select);
+                       size += sprintf(buf + size, "0: %10uMhz\n",
+                       (smu->cpu_actual_soft_min_freq > 0) ? smu->cpu_actual_soft_min_freq : smu->cpu_default_soft_min_freq);
+                       size += sprintf(buf + size, "1: %10uMhz\n",
+                       (smu->cpu_actual_soft_max_freq > 0) ? smu->cpu_actual_soft_max_freq : smu->cpu_default_soft_max_freq);
+               }
+               break;
        case SMU_OD_RANGE:
-               if (smu->od_enabled) {
+               if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
                        size = sprintf(buf, "%s:\n", "OD_RANGE");
                        size += sprintf(buf + size, "SCLK: %7uMhz %10uMhz\n",
                                smu->gfx_default_hard_min_freq, smu->gfx_default_soft_max_freq);
+                       size += sprintf(buf + size, "CCLK: %7uMhz %10uMhz\n",
+                               smu->cpu_default_soft_min_freq, smu->cpu_default_soft_max_freq);
                }
                break;
        case SMU_SOCCLK:
@@ -610,7 +593,7 @@ static int vangogh_get_profiling_clk_mask(struct smu_context *smu,
        return 0;
 }
 
-bool vangogh_clk_dpm_is_enabled(struct smu_context *smu,
+static bool vangogh_clk_dpm_is_enabled(struct smu_context *smu,
                                enum smu_clk_type clk_type)
 {
        enum smu_feature_mask feature_id = 0;
@@ -774,7 +757,9 @@ static int vangogh_get_power_profile_mode(struct smu_context *smu,
                                           char *buf)
 {
        static const char *profile_name[] = {
-                                       "FULL_SCREEN_3D",
+                                       "BOOTUP_DEFAULT",
+                                       "3D_FULL_SCREEN",
+                                       "POWER_SAVING",
                                        "VIDEO",
                                        "VR",
                                        "COMPUTE",
@@ -814,6 +799,10 @@ static int vangogh_set_power_profile_mode(struct smu_context *smu, long *input,
                return -EINVAL;
        }
 
+       if (profile_mode == PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ||
+                       profile_mode == PP_SMC_POWER_PROFILE_POWERSAVING)
+               return 0;
+
        /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
        workload_type = smu_cmn_to_asic_specific_index(smu,
                                                       CMN2ASIC_MAPPING_WORKLOAD,
@@ -1146,15 +1135,39 @@ static int vangogh_set_performance_level(struct smu_context *smu,
 
        switch (level) {
        case AMD_DPM_FORCED_LEVEL_HIGH:
+               smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
+               smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
+
+               smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq;
+               smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq;
+
                ret = vangogh_force_dpm_limit_value(smu, true);
                break;
        case AMD_DPM_FORCED_LEVEL_LOW:
+               smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
+               smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
+
+               smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq;
+               smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq;
+
                ret = vangogh_force_dpm_limit_value(smu, false);
                break;
        case AMD_DPM_FORCED_LEVEL_AUTO:
+               smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
+               smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
+
+               smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq;
+               smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq;
+
                ret = vangogh_unforce_dpm_levels(smu);
                break;
        case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD:
+               smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
+               smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
+
+               smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq;
+               smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq;
+
                ret = smu_cmn_send_smc_msg_with_param(smu,
                                        SMU_MSG_SetHardMinGfxClk,
                                        VANGOGH_UMD_PSTATE_STANDARD_GFXCLK, NULL);
@@ -1184,6 +1197,12 @@ static int vangogh_set_performance_level(struct smu_context *smu,
 
                break;
        case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK:
+               smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
+               smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
+
+               smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq;
+               smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq;
+
                ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetHardMinVcn,
                                                                VANGOGH_UMD_PSTATE_PEAK_DCLK, NULL);
                if (ret)
@@ -1195,6 +1214,12 @@ static int vangogh_set_performance_level(struct smu_context *smu,
                        return ret;
                break;
        case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK:
+               smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
+               smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
+
+               smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq;
+               smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq;
+
                ret = vangogh_get_profiling_clk_mask(smu, level,
                                                        NULL,
                                                        NULL,
@@ -1208,6 +1233,12 @@ static int vangogh_set_performance_level(struct smu_context *smu,
                vangogh_force_clk_levels(smu, SMU_FCLK, 1 << fclk_mask);
                break;
        case AMD_DPM_FORCED_LEVEL_PROFILE_PEAK:
+               smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
+               smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
+
+               smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq;
+               smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq;
+
                ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetHardMinGfxClk,
                                VANGOGH_UMD_PSTATE_PEAK_GFXCLK, NULL);
                if (ret)
@@ -1289,6 +1320,12 @@ static int vangogh_read_sensor(struct smu_context *smu,
                                                   (uint32_t *)data);
                *size = 4;
                break;
+       case AMDGPU_PP_SENSOR_CPU_CLK:
+               ret = vangogh_get_smu_metrics_data(smu,
+                                                  METRICS_AVERAGE_CPUCLK,
+                                                  (uint32_t *)data);
+               *size = smu->cpu_core_num * sizeof(uint16_t);
+               break;
        default:
                ret = -EOPNOTSUPP;
                break;
@@ -1410,16 +1447,46 @@ static ssize_t vangogh_get_gpu_metrics(struct smu_context *smu,
 }
 
 static int vangogh_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABLE_COMMAND type,
-                                                       long input[], uint32_t size)
+                                       long input[], uint32_t size)
 {
        int ret = 0;
+       int i;
+       struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
 
-       if (!smu->od_enabled) {
+       if (!(smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL)) {
                dev_warn(smu->adev->dev, "Fine grain is not enabled!\n");
                return -EINVAL;
        }
 
        switch (type) {
+       case PP_OD_EDIT_CCLK_VDDC_TABLE:
+               if (size != 3) {
+                       dev_err(smu->adev->dev, "Input parameter number not correct (should be 4 for processor)\n");
+                       return -EINVAL;
+               }
+               if (input[0] >= smu->cpu_core_num) {
+                       dev_err(smu->adev->dev, "core index is overflow, should be less than %d\n",
+                               smu->cpu_core_num);
+               }
+               smu->cpu_core_id_select = input[0];
+               if (input[1] == 0) {
+                       if (input[2] < smu->cpu_default_soft_min_freq) {
+                               dev_warn(smu->adev->dev, "Fine grain setting minimum cclk (%ld) MHz is less than the minimum allowed (%d) MHz\n",
+                                       input[2], smu->cpu_default_soft_min_freq);
+                               return -EINVAL;
+                       }
+                       smu->cpu_actual_soft_min_freq = input[2];
+               } else if (input[1] == 1) {
+                       if (input[2] > smu->cpu_default_soft_max_freq) {
+                               dev_warn(smu->adev->dev, "Fine grain setting maximum cclk (%ld) MHz is greater than the maximum allowed (%d) MHz\n",
+                                       input[2], smu->cpu_default_soft_max_freq);
+                               return -EINVAL;
+                       }
+                       smu->cpu_actual_soft_max_freq = input[2];
+               } else {
+                       return -EINVAL;
+               }
+               break;
        case PP_OD_EDIT_SCLK_VDDC_TABLE:
                if (size != 2) {
                        dev_err(smu->adev->dev, "Input parameter number not correct\n");
@@ -1453,6 +1520,8 @@ static int vangogh_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TAB
                } else {
                        smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
                        smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
+                       smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq;
+                       smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq;
 
                        ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetHardMinGfxClk,
                                                                        smu->gfx_actual_hard_min_freq, NULL);
@@ -1467,6 +1536,29 @@ static int vangogh_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TAB
                                dev_err(smu->adev->dev, "Restore the default soft max sclk failed!");
                                return ret;
                        }
+
+                       if (smu->adev->pm.fw_version < 0x43f1b00) {
+                               dev_warn(smu->adev->dev, "CPUSoftMax/CPUSoftMin are not supported, please update SBIOS!\n");
+                               break;
+                       }
+
+                       for (i = 0; i < smu->cpu_core_num; i++) {
+                               ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetSoftMinCclk,
+                                                                     (i << 20) | smu->cpu_actual_soft_min_freq,
+                                                                     NULL);
+                               if (ret) {
+                                       dev_err(smu->adev->dev, "Set hard min cclk failed!");
+                                       return ret;
+                               }
+
+                               ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetSoftMaxCclk,
+                                                                     (i << 20) | smu->cpu_actual_soft_max_freq,
+                                                                     NULL);
+                               if (ret) {
+                                       dev_err(smu->adev->dev, "Set soft max cclk failed!");
+                                       return ret;
+                               }
+                       }
                }
                break;
        case PP_OD_COMMIT_DPM_TABLE:
@@ -1495,6 +1587,29 @@ static int vangogh_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TAB
                                dev_err(smu->adev->dev, "Set soft max sclk failed!");
                                return ret;
                        }
+
+                       if (smu->adev->pm.fw_version < 0x43f1b00) {
+                               dev_warn(smu->adev->dev, "CPUSoftMax/CPUSoftMin are not supported, please update SBIOS!\n");
+                               break;
+                       }
+
+                       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetSoftMinCclk,
+                                                             ((smu->cpu_core_id_select << 20)
+                                                              | smu->cpu_actual_soft_min_freq),
+                                                             NULL);
+                       if (ret) {
+                               dev_err(smu->adev->dev, "Set hard min cclk failed!");
+                               return ret;
+                       }
+
+                       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetSoftMaxCclk,
+                                                             ((smu->cpu_core_id_select << 20)
+                                                              | smu->cpu_actual_soft_max_freq),
+                                                             NULL);
+                       if (ret) {
+                               dev_err(smu->adev->dev, "Set soft max cclk failed!");
+                               return ret;
+                       }
                }
                break;
        default:
@@ -1520,6 +1635,11 @@ static int vangogh_set_fine_grain_gfx_freq_parameters(struct smu_context *smu)
        smu->gfx_actual_hard_min_freq = 0;
        smu->gfx_actual_soft_max_freq = 0;
 
+       smu->cpu_default_soft_min_freq = 1400;
+       smu->cpu_default_soft_max_freq = 3500;
+       smu->cpu_actual_soft_min_freq = 0;
+       smu->cpu_actual_soft_max_freq = 0;
+
        return 0;
 }
 
@@ -1553,24 +1673,50 @@ static int vangogh_get_dpm_clock_table(struct smu_context *smu, struct dpm_clock
 static int vangogh_system_features_control(struct smu_context *smu, bool en)
 {
        struct amdgpu_device *adev = smu->adev;
+       struct smu_feature *feature = &smu->smu_feature;
+       uint32_t feature_mask[2];
+       int ret = 0;
 
        if (adev->pm.fw_version >= 0x43f1700)
-               return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_RlcPowerNotify,
-                                               en ? RLC_STATUS_NORMAL : RLC_STATUS_OFF, NULL);
-       else
-               return 0;
+               ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_RlcPowerNotify,
+                                                     en ? RLC_STATUS_NORMAL : RLC_STATUS_OFF, NULL);
+
+       bitmap_zero(feature->enabled, feature->feature_num);
+       bitmap_zero(feature->supported, feature->feature_num);
+
+       if (!en)
+               return ret;
+
+       ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2);
+       if (ret)
+               return ret;
+
+       bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
+                   feature->feature_num);
+       bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
+                   feature->feature_num);
+
+       return 0;
 }
 
 static int vangogh_post_smu_init(struct smu_context *smu)
 {
        struct amdgpu_device *adev = smu->adev;
        uint32_t tmp;
+       int ret = 0;
        uint8_t aon_bits = 0;
        /* Two CUs in one WGP */
        uint32_t req_active_wgps = adev->gfx.cu_info.number/2;
        uint32_t total_cu = adev->gfx.config.max_cu_per_sh *
                adev->gfx.config.max_sh_per_se * adev->gfx.config.max_shader_engines;
 
+       /* allow message will be sent after enable message on Vangogh*/
+       ret = smu_cmn_send_smc_msg(smu, SMU_MSG_EnableGfxOff, NULL);
+       if (ret) {
+               dev_err(adev->dev, "Failed to Enable GfxOff!\n");
+               return ret;
+       }
+
        /* if all CUs are active, no need to power off any WGPs */
        if (total_cu == adev->gfx.cu_info.number)
                return 0;
@@ -1593,6 +1739,31 @@ static int vangogh_post_smu_init(struct smu_context *smu)
        }
 }
 
+static int vangogh_mode_reset(struct smu_context *smu, int type)
+{
+       int ret = 0, index = 0;
+
+       index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
+                                              SMU_MSG_GfxDeviceDriverReset);
+       if (index < 0)
+               return index == -EACCES ? 0 : index;
+
+       mutex_lock(&smu->message_lock);
+
+       ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, type);
+
+       mutex_unlock(&smu->message_lock);
+
+       mdelay(10);
+
+       return ret;
+}
+
+static int vangogh_mode2_reset(struct smu_context *smu)
+{
+       return vangogh_mode_reset(smu, SMU_RESET_MODE_2);
+}
+
 static const struct pptable_funcs vangogh_ppt_funcs = {
 
        .check_fw_status = smu_v11_0_check_fw_status,
@@ -1602,7 +1773,6 @@ static const struct pptable_funcs vangogh_ppt_funcs = {
        .init_power = smu_v11_0_init_power,
        .fini_power = smu_v11_0_fini_power,
        .register_irq_handler = smu_v11_0_register_irq_handler,
-       .get_allowed_feature_mask = vangogh_get_allowed_feature_mask,
        .notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,
        .send_smc_msg_with_param = smu_cmn_send_smc_msg_with_param,
        .send_smc_msg = smu_cmn_send_smc_msg,
@@ -1628,6 +1798,8 @@ static const struct pptable_funcs vangogh_ppt_funcs = {
        .force_clk_levels = vangogh_force_clk_levels,
        .set_performance_level = vangogh_set_performance_level,
        .post_init = vangogh_post_smu_init,
+       .mode2_reset = vangogh_mode2_reset,
+       .gfx_off_control = smu_v11_0_gfx_off_control,
 };
 
 void vangogh_set_ppt_funcs(struct smu_context *smu)
@@ -1636,5 +1808,6 @@ void vangogh_set_ppt_funcs(struct smu_context *smu)
        smu->message_map = vangogh_message_map;
        smu->feature_map = vangogh_feature_mask_map;
        smu->table_map = vangogh_table_map;
+       smu->workload_map = vangogh_workload_map;
        smu->is_apu = true;
 }
index 1f6a774..6c8a8cc 100644 (file)
@@ -349,17 +349,13 @@ static int renoir_od_edit_dpm_table(struct smu_context *smu,
                                                        long input[], uint32_t size)
 {
        int ret = 0;
+       struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
 
-       if (!smu->fine_grain_enabled) {
+       if (!(smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL)) {
                dev_warn(smu->adev->dev, "Fine grain is not enabled!\n");
                return -EINVAL;
        }
 
-       if (!smu->fine_grain_started) {
-               dev_warn(smu->adev->dev, "Fine grain is enabled but not started!\n");
-               return -EINVAL;
-       }
-
        switch (type) {
        case PP_OD_EDIT_SCLK_VDDC_TABLE:
                if (size != 2) {
@@ -482,6 +478,7 @@ static int renoir_print_clk_levels(struct smu_context *smu,
        int i, size = 0, ret = 0;
        uint32_t cur_value = 0, value = 0, count = 0, min = 0, max = 0;
        SmuMetrics_t metrics;
+       struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
        bool cur_value_match_level = false;
 
        memset(&metrics, 0, sizeof(metrics));
@@ -492,7 +489,7 @@ static int renoir_print_clk_levels(struct smu_context *smu,
 
        switch (clk_type) {
        case SMU_OD_RANGE:
-               if (smu->fine_grain_enabled) {
+               if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
                        ret = smu_cmn_send_smc_msg_with_param(smu,
                                                SMU_MSG_GetMinGfxclkFrequency,
                                                0, &min);
@@ -507,7 +504,7 @@ static int renoir_print_clk_levels(struct smu_context *smu,
                }
                break;
        case SMU_OD_SCLK:
-               if (smu->fine_grain_enabled) {
+               if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
                        min = (smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq;
                        max = (smu->gfx_actual_soft_max_freq > 0) ? smu->gfx_actual_soft_max_freq : smu->gfx_default_soft_max_freq;
                        size += sprintf(buf + size, "OD_SCLK\n");
@@ -835,6 +832,10 @@ static int renoir_set_power_profile_mode(struct smu_context *smu, long *input, u
                return -EINVAL;
        }
 
+       if (profile_mode == PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ||
+                       profile_mode == PP_SMC_POWER_PROFILE_POWERSAVING)
+               return 0;
+
        /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
        workload_type = smu_cmn_to_asic_specific_index(smu,
                                                       CMN2ASIC_MAPPING_WORKLOAD,
@@ -893,28 +894,24 @@ static int renoir_set_performance_level(struct smu_context *smu,
 
        switch (level) {
        case AMD_DPM_FORCED_LEVEL_HIGH:
-               smu->fine_grain_started = 0;
                smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
                smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
 
                ret = renoir_force_dpm_limit_value(smu, true);
                break;
        case AMD_DPM_FORCED_LEVEL_LOW:
-               smu->fine_grain_started = 0;
                smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
                smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
 
                ret = renoir_force_dpm_limit_value(smu, false);
                break;
        case AMD_DPM_FORCED_LEVEL_AUTO:
-               smu->fine_grain_started = 0;
                smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
                smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
 
                ret = renoir_unforce_dpm_levels(smu);
                break;
        case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD:
-               smu->fine_grain_started = 0;
                smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
                smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
 
@@ -970,7 +967,6 @@ static int renoir_set_performance_level(struct smu_context *smu,
                break;
        case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK:
        case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK:
-               smu->fine_grain_started = 0;
                smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
                smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
 
@@ -985,14 +981,12 @@ static int renoir_set_performance_level(struct smu_context *smu,
                renoir_force_clk_levels(smu, SMU_SOCCLK, 1 << soc_mask);
                break;
        case AMD_DPM_FORCED_LEVEL_PROFILE_PEAK:
-               smu->fine_grain_started = 0;
                smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq;
                smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq;
 
                ret = renoir_set_peak_clock_by_device(smu);
                break;
        case AMD_DPM_FORCED_LEVEL_MANUAL:
-               smu->fine_grain_started = 1;
        case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
        default:
                break;
index f826076..e4eff6d 100644 (file)
@@ -68,14 +68,6 @@ static const char *smu_get_message_name(struct smu_context *smu,
        return __smu_message_names[type];
 }
 
-static void smu_cmn_send_msg_without_waiting(struct smu_context *smu,
-                                            uint16_t msg)
-{
-       struct amdgpu_device *adev = smu->adev;
-
-       WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_66, msg);
-}
-
 static void smu_cmn_read_arg(struct smu_context *smu,
                             uint32_t *arg)
 {
@@ -92,7 +84,7 @@ static int smu_cmn_wait_for_response(struct smu_context *smu)
        for (i = 0; i < timeout; i++) {
                cur_value = RREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_90);
                if ((cur_value & MP1_C2PMSG_90__CONTENT_MASK) != 0)
-                       return cur_value == 0x1 ? 0 : -EIO;
+                       return cur_value;
 
                udelay(1);
        }
@@ -101,7 +93,29 @@ static int smu_cmn_wait_for_response(struct smu_context *smu)
        if (i == timeout)
                return -ETIME;
 
-       return RREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_90) == 0x1 ? 0 : -EIO;
+       return RREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_90);
+}
+
+int smu_cmn_send_msg_without_waiting(struct smu_context *smu,
+                                    uint16_t msg, uint32_t param)
+{
+       struct amdgpu_device *adev = smu->adev;
+       int ret;
+
+       ret = smu_cmn_wait_for_response(smu);
+       if (ret != 0x1) {
+               dev_err(adev->dev, "Msg issuing pre-check failed and "
+                      "SMU may be not in the right state!\n");
+               if (ret != -ETIME)
+                       ret = -EIO;
+               return ret;
+       }
+
+       WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
+       WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_82, param);
+       WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_66, msg);
+
+       return 0;
 }
 
 int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
@@ -122,29 +136,23 @@ int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
                return index == -EACCES ? 0 : index;
 
        mutex_lock(&smu->message_lock);
-       ret = smu_cmn_wait_for_response(smu);
-       if (ret) {
-               dev_err(adev->dev, "Msg issuing pre-check failed and "
-                      "SMU may be not in the right state!\n");
+       ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, param);
+       if (ret)
                goto out;
-       }
-
-       WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
-
-       WREG32_SOC15_NO_KIQ(MP1, 0, mmMP1_SMN_C2PMSG_82, param);
-
-       smu_cmn_send_msg_without_waiting(smu, (uint16_t)index);
 
        ret = smu_cmn_wait_for_response(smu);
-       if (ret) {
+       if (ret != 0x1) {
                dev_err(adev->dev, "failed send message: %10s (%d) \tparam: 0x%08x response %#x\n",
-                      smu_get_message_name(smu, msg), index, param, ret);
+                       smu_get_message_name(smu, msg), index, param, ret);
+               if (ret != -ETIME)
+                       ret = -EIO;
                goto out;
        }
 
        if (read_arg)
                smu_cmn_read_arg(smu, read_arg);
 
+       ret = 0; /* 0 as driver return value */
 out:
        mutex_unlock(&smu->message_lock);
        return ret;
@@ -269,11 +277,13 @@ int smu_cmn_feature_is_enabled(struct smu_context *smu,
                               enum smu_feature_mask mask)
 {
        struct smu_feature *feature = &smu->smu_feature;
+       struct amdgpu_device *adev = smu->adev;
        int feature_id;
        int ret = 0;
 
-       if (smu->is_apu)
+       if (smu->is_apu && adev->family < AMDGPU_FAMILY_VGH)
                return 1;
+
        feature_id = smu_cmn_to_asic_specific_index(smu,
                                                    CMN2ASIC_MAPPING_FEATURE,
                                                    mask);
index 01e825d..08ccf2d 100644 (file)
@@ -26,6 +26,8 @@
 #include "amdgpu_smu.h"
 
 #if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3) || defined(SWSMU_CODE_LAYER_L4)
+int smu_cmn_send_msg_without_waiting(struct smu_context *smu,
+                                    uint16_t msg, uint32_t param);
 int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
                                    enum smu_message_type msg,
                                    uint32_t param,