linux/drivers/gpu/drm/radeon/kv_dpm.c

/*
 * Copyright 2013 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/pci.h>
#include <linux/seq_file.h>

#include "cikd.h"
#include "kv_dpm.h"
#include "r600_dpm.h"
#include "radeon.h"
#include "radeon_asic.h"

#define KV_MAX_DEEPSLEEP_DIVIDER_ID
#define KV_MINIMUM_ENGINE_CLOCK
#define SMC_RAM_END

static int kv_enable_nb_dpm(struct radeon_device *rdev,
			    bool enable);
static void kv_init_graphics_levels(struct radeon_device *rdev);
static int kv_calculate_ds_divider(struct radeon_device *rdev);
static int kv_calculate_nbps_level_settings(struct radeon_device *rdev);
static int kv_calculate_dpm_settings(struct radeon_device *rdev);
static void kv_enable_new_levels(struct radeon_device *rdev);
static void kv_program_nbps_index_settings(struct radeon_device *rdev,
					   struct radeon_ps *new_rps);
static int kv_set_enabled_level(struct radeon_device *rdev, u32 level);
static int kv_set_enabled_levels(struct radeon_device *rdev);
static int kv_force_dpm_highest(struct radeon_device *rdev);
static int kv_force_dpm_lowest(struct radeon_device *rdev);
static void kv_apply_state_adjust_rules(struct radeon_device *rdev,
					struct radeon_ps *new_rps,
					struct radeon_ps *old_rps);
static int kv_set_thermal_temperature_range(struct radeon_device *rdev,
					    int min_temp, int max_temp);
static int kv_init_fps_limits(struct radeon_device *rdev);

void kv_dpm_powergate_uvd(struct radeon_device *rdev, bool gate);
static void kv_dpm_powergate_vce(struct radeon_device *rdev, bool gate);
static void kv_dpm_powergate_samu(struct radeon_device *rdev, bool gate);
static void kv_dpm_powergate_acp(struct radeon_device *rdev, bool gate);

extern void cik_enter_rlc_safe_mode(struct radeon_device *rdev);
extern void cik_exit_rlc_safe_mode(struct radeon_device *rdev);
extern void cik_update_cg(struct radeon_device *rdev,
			  u32 block, bool enable);

static const struct kv_pt_config_reg didt_config_kv[] =;

static struct kv_ps *kv_get_ps(struct radeon_ps *rps)
{}

static struct kv_power_info *kv_get_pi(struct radeon_device *rdev)
{}

static int kv_program_pt_config_registers(struct radeon_device *rdev,
					  const struct kv_pt_config_reg *cac_config_regs)
{}

static void kv_do_enable_didt(struct radeon_device *rdev, bool enable)
{}

static int kv_enable_didt(struct radeon_device *rdev, bool enable)
{}

static int kv_enable_smc_cac(struct radeon_device *rdev, bool enable)
{}

static int kv_process_firmware_header(struct radeon_device *rdev)
{}

static int kv_enable_dpm_voltage_scaling(struct radeon_device *rdev)
{}

static int kv_set_dpm_interval(struct radeon_device *rdev)
{}

static int kv_set_dpm_boot_state(struct radeon_device *rdev)
{}

static void kv_program_vc(struct radeon_device *rdev)
{}

static void kv_clear_vc(struct radeon_device *rdev)
{}

static int kv_set_divider_value(struct radeon_device *rdev,
				u32 index, u32 sclk)
{}

static u32 kv_convert_vid2_to_vid7(struct radeon_device *rdev,
				   struct sumo_vid_mapping_table *vid_mapping_table,
				   u32 vid_2bit)
{}

static u32 kv_convert_vid7_to_vid2(struct radeon_device *rdev,
				   struct sumo_vid_mapping_table *vid_mapping_table,
				   u32 vid_7bit)
{}

static u16 kv_convert_8bit_index_to_voltage(struct radeon_device *rdev,
					    u16 voltage)
{}

static u16 kv_convert_2bit_index_to_voltage(struct radeon_device *rdev,
					    u32 vid_2bit)
{}


static int kv_set_vid(struct radeon_device *rdev, u32 index, u32 vid)
{}

static int kv_set_at(struct radeon_device *rdev, u32 index, u32 at)
{}

static void kv_dpm_power_level_enable(struct radeon_device *rdev,
				      u32 index, bool enable)
{}

static void kv_start_dpm(struct radeon_device *rdev)
{}

static void kv_stop_dpm(struct radeon_device *rdev)
{}

static void kv_start_am(struct radeon_device *rdev)
{}

static void kv_reset_am(struct radeon_device *rdev)
{}

static int kv_freeze_sclk_dpm(struct radeon_device *rdev, bool freeze)
{}

static int kv_force_lowest_valid(struct radeon_device *rdev)
{}

static int kv_unforce_levels(struct radeon_device *rdev)
{}

static int kv_update_sclk_t(struct radeon_device *rdev)
{}

static int kv_program_bootup_state(struct radeon_device *rdev)
{}

static int kv_enable_auto_thermal_throttling(struct radeon_device *rdev)
{}

static int kv_upload_dpm_settings(struct radeon_device *rdev)
{}

static u32 kv_get_clock_difference(u32 a, u32 b)
{}

static u32 kv_get_clk_bypass(struct radeon_device *rdev, u32 clk)
{}

static int kv_populate_uvd_table(struct radeon_device *rdev)
{}

static int kv_populate_vce_table(struct radeon_device *rdev)
{}

static int kv_populate_samu_table(struct radeon_device *rdev)
{}


static int kv_populate_acp_table(struct radeon_device *rdev)
{}

static void kv_calculate_dfs_bypass_settings(struct radeon_device *rdev)
{}

static int kv_enable_ulv(struct radeon_device *rdev, bool enable)
{}

static void kv_reset_acp_boot_level(struct radeon_device *rdev)
{}

static void kv_update_current_ps(struct radeon_device *rdev,
				 struct radeon_ps *rps)
{}

static void kv_update_requested_ps(struct radeon_device *rdev,
				   struct radeon_ps *rps)
{}

void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable)
{}

static void kv_enable_thermal_int(struct radeon_device *rdev, bool enable)
{}

int kv_dpm_enable(struct radeon_device *rdev)
{}

int kv_dpm_late_enable(struct radeon_device *rdev)
{}

void kv_dpm_disable(struct radeon_device *rdev)
{}

static void kv_init_sclk_t(struct radeon_device *rdev)
{}

static int kv_init_fps_limits(struct radeon_device *rdev)
{}

static void kv_init_powergate_state(struct radeon_device *rdev)
{}

static int kv_enable_uvd_dpm(struct radeon_device *rdev, bool enable)
{}

static int kv_enable_vce_dpm(struct radeon_device *rdev, bool enable)
{}

static int kv_enable_samu_dpm(struct radeon_device *rdev, bool enable)
{}

static int kv_enable_acp_dpm(struct radeon_device *rdev, bool enable)
{}

static int kv_update_uvd_dpm(struct radeon_device *rdev, bool gate)
{}

static u8 kv_get_vce_boot_level(struct radeon_device *rdev, u32 evclk)
{}

static int kv_update_vce_dpm(struct radeon_device *rdev,
			     struct radeon_ps *radeon_new_state,
			     struct radeon_ps *radeon_current_state)
{}

static int kv_update_samu_dpm(struct radeon_device *rdev, bool gate)
{}

static u8 kv_get_acp_boot_level(struct radeon_device *rdev)
{}

static void kv_update_acp_boot_level(struct radeon_device *rdev)
{}

static int kv_update_acp_dpm(struct radeon_device *rdev, bool gate)
{}

void kv_dpm_powergate_uvd(struct radeon_device *rdev, bool gate)
{}

static void kv_dpm_powergate_vce(struct radeon_device *rdev, bool gate)
{}

static void kv_dpm_powergate_samu(struct radeon_device *rdev, bool gate)
{}

static void kv_dpm_powergate_acp(struct radeon_device *rdev, bool gate)
{}

static void kv_set_valid_clock_range(struct radeon_device *rdev,
				     struct radeon_ps *new_rps)
{}

static int kv_update_dfs_bypass_settings(struct radeon_device *rdev,
					 struct radeon_ps *new_rps)
{}

static int kv_enable_nb_dpm(struct radeon_device *rdev,
			    bool enable)
{}

int kv_dpm_force_performance_level(struct radeon_device *rdev,
				   enum radeon_dpm_forced_level level)
{}

int kv_dpm_pre_set_power_state(struct radeon_device *rdev)
{}

int kv_dpm_set_power_state(struct radeon_device *rdev)
{}

void kv_dpm_post_set_power_state(struct radeon_device *rdev)
{}

void kv_dpm_setup_asic(struct radeon_device *rdev)
{}

//XXX use sumo_dpm_display_configuration_changed

static void kv_construct_max_power_limits_table(struct radeon_device *rdev,
						struct radeon_clock_and_voltage_limits *table)
{}

static void kv_patch_voltage_values(struct radeon_device *rdev)
{}

static void kv_construct_boot_state(struct radeon_device *rdev)
{}

static int kv_force_dpm_highest(struct radeon_device *rdev)
{}

static int kv_force_dpm_lowest(struct radeon_device *rdev)
{}

static u8 kv_get_sleep_divider_id_from_clock(struct radeon_device *rdev,
					     u32 sclk, u32 min_sclk_in_sr)
{}

static int kv_get_high_voltage_limit(struct radeon_device *rdev, int *limit)
{}

static void kv_apply_state_adjust_rules(struct radeon_device *rdev,
					struct radeon_ps *new_rps,
					struct radeon_ps *old_rps)
{}

static void kv_dpm_power_level_enabled_for_throttle(struct radeon_device *rdev,
						    u32 index, bool enable)
{}

static int kv_calculate_ds_divider(struct radeon_device *rdev)
{}

static int kv_calculate_nbps_level_settings(struct radeon_device *rdev)
{}

static int kv_calculate_dpm_settings(struct radeon_device *rdev)
{}

static void kv_init_graphics_levels(struct radeon_device *rdev)
{}

static void kv_enable_new_levels(struct radeon_device *rdev)
{}

static int kv_set_enabled_level(struct radeon_device *rdev, u32 level)
{}

static int kv_set_enabled_levels(struct radeon_device *rdev)
{}

static void kv_program_nbps_index_settings(struct radeon_device *rdev,
					   struct radeon_ps *new_rps)
{}

static int kv_set_thermal_temperature_range(struct radeon_device *rdev,
					    int min_temp, int max_temp)
{}

igp_info;

static int kv_parse_sys_info_table(struct radeon_device *rdev)
{}

power_info;

pplib_clock_info;

pplib_power_state;

static void kv_patch_boot_state(struct radeon_device *rdev,
				struct kv_ps *ps)
{}

static void kv_parse_pplib_non_clock_info(struct radeon_device *rdev,
					  struct radeon_ps *rps,
					  struct _ATOM_PPLIB_NONCLOCK_INFO *non_clock_info,
					  u8 table_rev)
{}

static void kv_parse_pplib_clock_info(struct radeon_device *rdev,
				      struct radeon_ps *rps, int index,
					union pplib_clock_info *clock_info)
{}

static int kv_parse_power_table(struct radeon_device *rdev)
{}

int kv_dpm_init(struct radeon_device *rdev)
{}

void kv_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
						    struct seq_file *m)
{}

u32 kv_dpm_get_current_sclk(struct radeon_device *rdev)
{}

u32 kv_dpm_get_current_mclk(struct radeon_device *rdev)
{}

void kv_dpm_print_power_state(struct radeon_device *rdev,
			      struct radeon_ps *rps)
{}

void kv_dpm_fini(struct radeon_device *rdev)
{}

void kv_dpm_display_configuration_changed(struct radeon_device *rdev)
{}

u32 kv_dpm_get_sclk(struct radeon_device *rdev, bool low)
{}

u32 kv_dpm_get_mclk(struct radeon_device *rdev, bool low)
{}