drm/amdgpu: delete pp_enable in adev
amdgpu not care powerplay or dpm is enabled. just check ip functions and pp functions Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
790d84fdc9
commit
6d07fe7bca
@ -1525,7 +1525,6 @@ struct amdgpu_device {
|
|||||||
|
|
||||||
/* powerplay */
|
/* powerplay */
|
||||||
struct amd_powerplay powerplay;
|
struct amd_powerplay powerplay;
|
||||||
bool pp_enabled;
|
|
||||||
bool pp_force_state_enabled;
|
bool pp_force_state_enabled;
|
||||||
|
|
||||||
/* dpm */
|
/* dpm */
|
||||||
|
@ -64,10 +64,6 @@ static const struct cg_flag_name clocks[] = {
|
|||||||
|
|
||||||
void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev)
|
void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev)
|
||||||
{
|
{
|
||||||
if (adev->pp_enabled)
|
|
||||||
/* TODO */
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (adev->pm.dpm_enabled) {
|
if (adev->pm.dpm_enabled) {
|
||||||
mutex_lock(&adev->pm.mutex);
|
mutex_lock(&adev->pm.mutex);
|
||||||
if (power_supply_is_system_supplied() > 0)
|
if (power_supply_is_system_supplied() > 0)
|
||||||
@ -118,7 +114,7 @@ static ssize_t amdgpu_set_dpm_state(struct device *dev,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adev->pp_enabled) {
|
if (adev->powerplay.pp_funcs->dispatch_tasks) {
|
||||||
amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_ENABLE_USER_STATE, &state, NULL);
|
amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_ENABLE_USER_STATE, &state, NULL);
|
||||||
} else {
|
} else {
|
||||||
mutex_lock(&adev->pm.mutex);
|
mutex_lock(&adev->pm.mutex);
|
||||||
@ -303,7 +299,8 @@ static ssize_t amdgpu_set_pp_force_state(struct device *dev,
|
|||||||
|
|
||||||
if (strlen(buf) == 1)
|
if (strlen(buf) == 1)
|
||||||
adev->pp_force_state_enabled = false;
|
adev->pp_force_state_enabled = false;
|
||||||
else if (adev->pp_enabled) {
|
else if (adev->powerplay.pp_funcs->dispatch_tasks &&
|
||||||
|
adev->powerplay.pp_funcs->get_pp_num_states) {
|
||||||
struct pp_states_info data;
|
struct pp_states_info data;
|
||||||
|
|
||||||
ret = kstrtoul(buf, 0, &idx);
|
ret = kstrtoul(buf, 0, &idx);
|
||||||
@ -531,7 +528,7 @@ static ssize_t amdgpu_set_pp_sclk_od(struct device *dev,
|
|||||||
if (adev->powerplay.pp_funcs->set_sclk_od)
|
if (adev->powerplay.pp_funcs->set_sclk_od)
|
||||||
amdgpu_dpm_set_sclk_od(adev, (uint32_t)value);
|
amdgpu_dpm_set_sclk_od(adev, (uint32_t)value);
|
||||||
|
|
||||||
if (adev->pp_enabled) {
|
if (adev->powerplay.pp_funcs->dispatch_tasks) {
|
||||||
amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_READJUST_POWER_STATE, NULL, NULL);
|
amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_READJUST_POWER_STATE, NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
adev->pm.dpm.current_ps = adev->pm.dpm.boot_ps;
|
adev->pm.dpm.current_ps = adev->pm.dpm.boot_ps;
|
||||||
@ -575,7 +572,7 @@ static ssize_t amdgpu_set_pp_mclk_od(struct device *dev,
|
|||||||
if (adev->powerplay.pp_funcs->set_mclk_od)
|
if (adev->powerplay.pp_funcs->set_mclk_od)
|
||||||
amdgpu_dpm_set_mclk_od(adev, (uint32_t)value);
|
amdgpu_dpm_set_mclk_od(adev, (uint32_t)value);
|
||||||
|
|
||||||
if (adev->pp_enabled) {
|
if (adev->powerplay.pp_funcs->dispatch_tasks) {
|
||||||
amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_READJUST_POWER_STATE, NULL, NULL);
|
amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_READJUST_POWER_STATE, NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
adev->pm.dpm.current_ps = adev->pm.dpm.boot_ps;
|
adev->pm.dpm.current_ps = adev->pm.dpm.boot_ps;
|
||||||
@ -959,9 +956,6 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
|
|||||||
attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
|
attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (adev->pp_enabled)
|
|
||||||
return effective_mode;
|
|
||||||
|
|
||||||
/* Skip fan attributes if fan is not present */
|
/* Skip fan attributes if fan is not present */
|
||||||
if (adev->pm.no_fan &&
|
if (adev->pm.no_fan &&
|
||||||
(attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
|
(attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
|
||||||
@ -1344,27 +1338,26 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adev->pp_enabled) {
|
|
||||||
ret = device_create_file(adev->dev, &dev_attr_pp_num_states);
|
ret = device_create_file(adev->dev, &dev_attr_pp_num_states);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DRM_ERROR("failed to create device file pp_num_states\n");
|
DRM_ERROR("failed to create device file pp_num_states\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = device_create_file(adev->dev, &dev_attr_pp_cur_state);
|
ret = device_create_file(adev->dev, &dev_attr_pp_cur_state);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DRM_ERROR("failed to create device file pp_cur_state\n");
|
DRM_ERROR("failed to create device file pp_cur_state\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = device_create_file(adev->dev, &dev_attr_pp_force_state);
|
ret = device_create_file(adev->dev, &dev_attr_pp_force_state);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DRM_ERROR("failed to create device file pp_force_state\n");
|
DRM_ERROR("failed to create device file pp_force_state\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = device_create_file(adev->dev, &dev_attr_pp_table);
|
ret = device_create_file(adev->dev, &dev_attr_pp_table);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DRM_ERROR("failed to create device file pp_table\n");
|
DRM_ERROR("failed to create device file pp_table\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = device_create_file(adev->dev, &dev_attr_pp_dpm_sclk);
|
ret = device_create_file(adev->dev, &dev_attr_pp_dpm_sclk);
|
||||||
@ -1427,12 +1420,12 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev)
|
|||||||
hwmon_device_unregister(adev->pm.int_hwmon_dev);
|
hwmon_device_unregister(adev->pm.int_hwmon_dev);
|
||||||
device_remove_file(adev->dev, &dev_attr_power_dpm_state);
|
device_remove_file(adev->dev, &dev_attr_power_dpm_state);
|
||||||
device_remove_file(adev->dev, &dev_attr_power_dpm_force_performance_level);
|
device_remove_file(adev->dev, &dev_attr_power_dpm_force_performance_level);
|
||||||
if (adev->pp_enabled) {
|
|
||||||
device_remove_file(adev->dev, &dev_attr_pp_num_states);
|
device_remove_file(adev->dev, &dev_attr_pp_num_states);
|
||||||
device_remove_file(adev->dev, &dev_attr_pp_cur_state);
|
device_remove_file(adev->dev, &dev_attr_pp_cur_state);
|
||||||
device_remove_file(adev->dev, &dev_attr_pp_force_state);
|
device_remove_file(adev->dev, &dev_attr_pp_force_state);
|
||||||
device_remove_file(adev->dev, &dev_attr_pp_table);
|
device_remove_file(adev->dev, &dev_attr_pp_table);
|
||||||
}
|
|
||||||
device_remove_file(adev->dev, &dev_attr_pp_dpm_sclk);
|
device_remove_file(adev->dev, &dev_attr_pp_dpm_sclk);
|
||||||
device_remove_file(adev->dev, &dev_attr_pp_dpm_mclk);
|
device_remove_file(adev->dev, &dev_attr_pp_dpm_mclk);
|
||||||
device_remove_file(adev->dev, &dev_attr_pp_dpm_pcie);
|
device_remove_file(adev->dev, &dev_attr_pp_dpm_pcie);
|
||||||
@ -1463,7 +1456,7 @@ void amdgpu_pm_compute_clocks(struct amdgpu_device *adev)
|
|||||||
amdgpu_fence_wait_empty(ring);
|
amdgpu_fence_wait_empty(ring);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adev->pp_enabled) {
|
if (adev->powerplay.pp_funcs->dispatch_tasks) {
|
||||||
amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_DISPLAY_CONFIG_CHANGE, NULL, NULL);
|
amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_DISPLAY_CONFIG_CHANGE, NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
mutex_lock(&adev->pm.mutex);
|
mutex_lock(&adev->pm.mutex);
|
||||||
@ -1598,15 +1591,15 @@ static int amdgpu_debugfs_pm_info(struct seq_file *m, void *data)
|
|||||||
if ((adev->flags & AMD_IS_PX) &&
|
if ((adev->flags & AMD_IS_PX) &&
|
||||||
(ddev->switch_power_state != DRM_SWITCH_POWER_ON)) {
|
(ddev->switch_power_state != DRM_SWITCH_POWER_ON)) {
|
||||||
seq_printf(m, "PX asic powered off\n");
|
seq_printf(m, "PX asic powered off\n");
|
||||||
} else if (adev->pp_enabled) {
|
} else if (adev->powerplay.pp_funcs->debugfs_print_current_performance_level) {
|
||||||
return amdgpu_debugfs_pm_info_pp(m, adev);
|
|
||||||
} else {
|
|
||||||
mutex_lock(&adev->pm.mutex);
|
mutex_lock(&adev->pm.mutex);
|
||||||
if (adev->powerplay.pp_funcs->debugfs_print_current_performance_level)
|
if (adev->powerplay.pp_funcs->debugfs_print_current_performance_level)
|
||||||
adev->powerplay.pp_funcs->debugfs_print_current_performance_level(adev, m);
|
adev->powerplay.pp_funcs->debugfs_print_current_performance_level(adev, m);
|
||||||
else
|
else
|
||||||
seq_printf(m, "Debugfs support not implemented for this asic\n");
|
seq_printf(m, "Debugfs support not implemented for this asic\n");
|
||||||
mutex_unlock(&adev->pm.mutex);
|
mutex_unlock(&adev->pm.mutex);
|
||||||
|
} else {
|
||||||
|
return amdgpu_debugfs_pm_info_pp(m, adev);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -59,7 +59,6 @@ static int amdgpu_pp_early_init(void *handle)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
amd_pp = &(adev->powerplay);
|
amd_pp = &(adev->powerplay);
|
||||||
adev->pp_enabled = false;
|
|
||||||
amd_pp->pp_handle = (void *)adev;
|
amd_pp->pp_handle = (void *)adev;
|
||||||
|
|
||||||
switch (adev->asic_type) {
|
switch (adev->asic_type) {
|
||||||
@ -73,7 +72,6 @@ static int amdgpu_pp_early_init(void *handle)
|
|||||||
case CHIP_STONEY:
|
case CHIP_STONEY:
|
||||||
case CHIP_VEGA10:
|
case CHIP_VEGA10:
|
||||||
case CHIP_RAVEN:
|
case CHIP_RAVEN:
|
||||||
adev->pp_enabled = true;
|
|
||||||
amd_pp->cgs_device = amdgpu_cgs_create_device(adev);
|
amd_pp->cgs_device = amdgpu_cgs_create_device(adev);
|
||||||
if (amdgpu_create_pp_handle(adev))
|
if (amdgpu_create_pp_handle(adev))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -138,9 +136,6 @@ static int amdgpu_pp_late_init(void *handle)
|
|||||||
ret = adev->powerplay.ip_funcs->late_init(
|
ret = adev->powerplay.ip_funcs->late_init(
|
||||||
adev->powerplay.pp_handle);
|
adev->powerplay.pp_handle);
|
||||||
|
|
||||||
if (adev->pp_enabled && adev->pm.dpm_enabled)
|
|
||||||
amdgpu_dpm_dispatch_task(adev, AMD_PP_TASK_COMPLETE_INIT, NULL, NULL);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +207,7 @@ static void amdgpu_pp_late_fini(void *handle)
|
|||||||
adev->powerplay.pp_handle);
|
adev->powerplay.pp_handle);
|
||||||
|
|
||||||
|
|
||||||
if (adev->pp_enabled) {
|
if (adev->powerplay.cgs_device) {
|
||||||
amd_powerplay_destroy(adev->powerplay.pp_handle);
|
amd_powerplay_destroy(adev->powerplay.pp_handle);
|
||||||
amdgpu_cgs_destroy_device(adev->powerplay.cgs_device);
|
amdgpu_cgs_destroy_device(adev->powerplay.cgs_device);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
#include "pp_instance.h"
|
#include "pp_instance.h"
|
||||||
#include "power_state.h"
|
#include "power_state.h"
|
||||||
|
|
||||||
|
static int pp_dpm_dispatch_tasks(void *handle, enum amd_pp_task task_id,
|
||||||
|
void *input, void *output);
|
||||||
|
|
||||||
static inline int pp_check(struct pp_instance *handle)
|
static inline int pp_check(struct pp_instance *handle)
|
||||||
{
|
{
|
||||||
if (handle == NULL || handle->pp_valid != PP_VALID)
|
if (handle == NULL || handle->pp_valid != PP_VALID)
|
||||||
@ -146,6 +149,19 @@ static int pp_hw_fini(void *handle)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int pp_late_init(void *handle)
|
||||||
|
{
|
||||||
|
struct pp_instance *pp_handle = (struct pp_instance *)handle;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
ret = pp_check(pp_handle);
|
||||||
|
if (ret == 0)
|
||||||
|
pp_dpm_dispatch_tasks(pp_handle,
|
||||||
|
AMD_PP_TASK_COMPLETE_INIT, NULL, NULL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static bool pp_is_idle(void *handle)
|
static bool pp_is_idle(void *handle)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -254,7 +270,7 @@ static int pp_resume(void *handle)
|
|||||||
const struct amd_ip_funcs pp_ip_funcs = {
|
const struct amd_ip_funcs pp_ip_funcs = {
|
||||||
.name = "powerplay",
|
.name = "powerplay",
|
||||||
.early_init = pp_early_init,
|
.early_init = pp_early_init,
|
||||||
.late_init = NULL,
|
.late_init = pp_late_init,
|
||||||
.sw_init = pp_sw_init,
|
.sw_init = pp_sw_init,
|
||||||
.sw_fini = pp_sw_fini,
|
.sw_fini = pp_sw_fini,
|
||||||
.hw_init = pp_hw_init,
|
.hw_init = pp_hw_init,
|
||||||
|
Loading…
Reference in New Issue
Block a user