Commit 74e07f9d authored by Huang Rui's avatar Huang Rui Committed by Alex Deucher

drm/amd/powerplay: add vega20 pptable function file

This patch adds the vega20_ppt.c to support ATOM_Vega20_POWERPLAYTABLE format
for vega20 on smu11. It will be used to implement to asic specific pptable
helpers.
Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
Reviewed-by: default avatarLikun Gao <Likun.Gao@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d72e91c5
...@@ -35,7 +35,7 @@ AMD_POWERPLAY = $(addsuffix /Makefile,$(addprefix $(FULL_AMD_PATH)/powerplay/,$( ...@@ -35,7 +35,7 @@ AMD_POWERPLAY = $(addsuffix /Makefile,$(addprefix $(FULL_AMD_PATH)/powerplay/,$(
include $(AMD_POWERPLAY) include $(AMD_POWERPLAY)
POWER_MGR = amd_powerplay.o amdgpu_smu.o smu_v11_0.o POWER_MGR = amd_powerplay.o amdgpu_smu.o smu_v11_0.o vega20_ppt.o
AMD_PP_POWER = $(addprefix $(AMD_PP_PATH)/,$(POWER_MGR)) AMD_PP_POWER = $(addprefix $(AMD_PP_PATH)/,$(POWER_MGR))
......
...@@ -48,16 +48,11 @@ static int smu_early_init(void *handle) ...@@ -48,16 +48,11 @@ static int smu_early_init(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct smu_context *smu = &adev->smu; struct smu_context *smu = &adev->smu;
int ret;
ret = smu_set_funcs(adev);
if (ret)
return ret;
smu->adev = adev; smu->adev = adev;
mutex_init(&smu->mutex); mutex_init(&smu->mutex);
return 0; return smu_set_funcs(adev);
} }
int smu_get_atom_data_table(struct smu_context *smu, uint32_t table, int smu_get_atom_data_table(struct smu_context *smu, uint32_t table,
......
...@@ -90,6 +90,7 @@ struct smu_context ...@@ -90,6 +90,7 @@ struct smu_context
struct amdgpu_device *adev; struct amdgpu_device *adev;
const struct smu_funcs *funcs; const struct smu_funcs *funcs;
const struct pptable_funcs *ppt_funcs;
struct mutex mutex; struct mutex mutex;
uint64_t pool_size; uint64_t pool_size;
...@@ -98,6 +99,10 @@ struct smu_context ...@@ -98,6 +99,10 @@ struct smu_context
struct smu_power_context smu_power; struct smu_power_context smu_power;
}; };
struct pptable_funcs {
int (*store_powerplay_table)(struct smu_context *smu);
};
struct smu_funcs struct smu_funcs
{ {
int (*init_microcode)(struct smu_context *smu); int (*init_microcode)(struct smu_context *smu);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "smu11_driver_if.h" #include "smu11_driver_if.h"
#include "soc15_common.h" #include "soc15_common.h"
#include "atom.h" #include "atom.h"
#include "vega20_ppt.h"
#include "asic_reg/thm/thm_11_0_2_offset.h" #include "asic_reg/thm/thm_11_0_2_offset.h"
#include "asic_reg/thm/thm_11_0_2_sh_mask.h" #include "asic_reg/thm/thm_11_0_2_sh_mask.h"
...@@ -504,5 +505,15 @@ static const struct smu_funcs smu_v11_0_funcs = { ...@@ -504,5 +505,15 @@ static const struct smu_funcs smu_v11_0_funcs = {
void smu_v11_0_set_smu_funcs(struct smu_context *smu) void smu_v11_0_set_smu_funcs(struct smu_context *smu)
{ {
struct amdgpu_device *adev = smu->adev;
smu->funcs = &smu_v11_0_funcs; smu->funcs = &smu_v11_0_funcs;
switch (adev->asic_type) {
case CHIP_VEGA20:
vega20_set_ppt_funcs(smu);
break;
default:
pr_warn("Unknow asic for smu11\n");
}
} }
/*
* 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.
*
*/
#include "pp_debug.h"
#include <linux/firmware.h>
#include "amdgpu.h"
#include "amdgpu_smu.h"
#include "atomfirmware.h"
#include "amdgpu_atomfirmware.h"
#include "smu_v11_0.h"
#include "smu_v11_0_ppsmc.h"
#include "smu11_driver_if.h"
#include "soc15_common.h"
#include "atom.h"
#include "vega20_ppt.h"
#include "vega20_pptable.h"
#include "vega20_ppt.h"
static int vega20_store_powerplay_table(struct smu_context *smu)
{
return 0;
}
static const struct pptable_funcs vega20_ppt_funcs = {
.store_powerplay_table = vega20_store_powerplay_table,
};
void vega20_set_ppt_funcs(struct smu_context *smu)
{
smu->ppt_funcs = &vega20_ppt_funcs;
}
/*
* 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 __VEGA20_PPT_H__
#define __VEGA20_PPT_H__
extern void vega20_set_ppt_funcs(struct smu_context *smu);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment