#include <linux/debugfs.h>
#include <linux/hwmon-sysfs.h>
#include <linux/hwmon.h>
#include <linux/pci.h>
#include <linux/power_supply.h>
#include <drm/drm_vblank.h>
#include "atom.h"
#include "avivod.h"
#include "r600_dpm.h"
#include "radeon.h"
#include "radeon_pm.h"
#define RADEON_IDLE_LOOP_MS …
#define RADEON_RECLOCK_DELAY_MS …
#define RADEON_WAIT_VBLANK_TIMEOUT …
static const char *radeon_pm_state_type_name[5] = …;
static void radeon_dynpm_idle_work_handler(struct work_struct *work);
static void radeon_debugfs_pm_init(struct radeon_device *rdev);
static bool radeon_pm_in_vbl(struct radeon_device *rdev);
static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish);
static void radeon_pm_update_profile(struct radeon_device *rdev);
static void radeon_pm_set_clocks(struct radeon_device *rdev);
int radeon_pm_get_type_index(struct radeon_device *rdev,
enum radeon_pm_state_type ps_type,
int instance)
{ … }
void radeon_pm_acpi_event_handler(struct radeon_device *rdev)
{ … }
static void radeon_pm_update_profile(struct radeon_device *rdev)
{ … }
static void radeon_unmap_vram_bos(struct radeon_device *rdev)
{ … }
static void radeon_sync_with_vblank(struct radeon_device *rdev)
{ … }
static void radeon_set_power_state(struct radeon_device *rdev)
{ … }
static void radeon_pm_set_clocks(struct radeon_device *rdev)
{ … }
static void radeon_pm_print_states(struct radeon_device *rdev)
{ … }
static ssize_t radeon_get_pm_profile(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t radeon_set_pm_profile(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{ … }
static ssize_t radeon_get_pm_method(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t radeon_set_pm_method(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{ … }
static ssize_t radeon_get_dpm_state(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t radeon_set_dpm_state(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{ … }
static ssize_t radeon_get_dpm_forced_performance_level(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t radeon_set_dpm_forced_performance_level(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{ … }
static ssize_t radeon_hwmon_get_pwm1_enable(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t radeon_hwmon_set_pwm1_enable(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{ … }
static ssize_t radeon_hwmon_get_pwm1_min(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t radeon_hwmon_get_pwm1_max(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t radeon_hwmon_set_pwm1(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t radeon_hwmon_get_pwm1(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR(power_profile, S_IRUGO | S_IWUSR, radeon_get_pm_profile, radeon_set_pm_profile);
static DEVICE_ATTR(power_method, S_IRUGO | S_IWUSR, radeon_get_pm_method, radeon_set_pm_method);
static DEVICE_ATTR(power_dpm_state, S_IRUGO | S_IWUSR, radeon_get_dpm_state, radeon_set_dpm_state);
static DEVICE_ATTR(power_dpm_force_performance_level, S_IRUGO | S_IWUSR,
radeon_get_dpm_forced_performance_level,
radeon_set_dpm_forced_performance_level);
static ssize_t radeon_hwmon_show_temp(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t radeon_hwmon_show_temp_thresh(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, radeon_hwmon_show_temp, NULL, 0);
static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, radeon_hwmon_show_temp_thresh, NULL, 0);
static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, radeon_hwmon_show_temp_thresh, NULL, 1);
static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, radeon_hwmon_get_pwm1, radeon_hwmon_set_pwm1, 0);
static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, radeon_hwmon_get_pwm1_enable, radeon_hwmon_set_pwm1_enable, 0);
static SENSOR_DEVICE_ATTR(pwm1_min, S_IRUGO, radeon_hwmon_get_pwm1_min, NULL, 0);
static SENSOR_DEVICE_ATTR(pwm1_max, S_IRUGO, radeon_hwmon_get_pwm1_max, NULL, 0);
static ssize_t radeon_hwmon_show_sclk(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static SENSOR_DEVICE_ATTR(freq1_input, S_IRUGO, radeon_hwmon_show_sclk, NULL,
0);
static ssize_t radeon_hwmon_show_vddc(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, radeon_hwmon_show_vddc, NULL,
0);
static struct attribute *hwmon_attributes[] = …;
static umode_t hwmon_attributes_visible(struct kobject *kobj,
struct attribute *attr, int index)
{ … }
static const struct attribute_group hwmon_attrgroup = …;
static const struct attribute_group *hwmon_groups[] = …;
static int radeon_hwmon_init(struct radeon_device *rdev)
{ … }
static void radeon_hwmon_fini(struct radeon_device *rdev)
{ … }
static void radeon_dpm_thermal_work_handler(struct work_struct *work)
{ … }
static bool radeon_dpm_single_display(struct radeon_device *rdev)
{ … }
static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
enum radeon_pm_state_type dpm_state)
{ … }
static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
{ … }
void radeon_dpm_enable_uvd(struct radeon_device *rdev, bool enable)
{ … }
void radeon_dpm_enable_vce(struct radeon_device *rdev, bool enable)
{ … }
static void radeon_pm_suspend_old(struct radeon_device *rdev)
{ … }
static void radeon_pm_suspend_dpm(struct radeon_device *rdev)
{ … }
void radeon_pm_suspend(struct radeon_device *rdev)
{ … }
static void radeon_pm_resume_old(struct radeon_device *rdev)
{ … }
static void radeon_pm_resume_dpm(struct radeon_device *rdev)
{ … }
void radeon_pm_resume(struct radeon_device *rdev)
{ … }
static int radeon_pm_init_old(struct radeon_device *rdev)
{ … }
static void radeon_dpm_print_power_states(struct radeon_device *rdev)
{ … }
static int radeon_pm_init_dpm(struct radeon_device *rdev)
{ … }
struct radeon_dpm_quirk { … };
static struct radeon_dpm_quirk radeon_dpm_quirk_list[] = …;
int radeon_pm_init(struct radeon_device *rdev)
{ … }
int radeon_pm_late_init(struct radeon_device *rdev)
{ … }
static void radeon_pm_fini_old(struct radeon_device *rdev)
{ … }
static void radeon_pm_fini_dpm(struct radeon_device *rdev)
{ … }
void radeon_pm_fini(struct radeon_device *rdev)
{ … }
static void radeon_pm_compute_clocks_old(struct radeon_device *rdev)
{ … }
static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev)
{ … }
void radeon_pm_compute_clocks(struct radeon_device *rdev)
{ … }
static bool radeon_pm_in_vbl(struct radeon_device *rdev)
{ … }
static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish)
{ … }
static void radeon_dynpm_idle_work_handler(struct work_struct *work)
{ … }
#if defined(CONFIG_DEBUG_FS)
static int radeon_debugfs_pm_info_show(struct seq_file *m, void *unused)
{ … }
DEFINE_SHOW_ATTRIBUTE(…);
#endif
static void radeon_debugfs_pm_init(struct radeon_device *rdev)
{ … }