You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.5 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
* Description: header file of drv_dvfs
*/
#ifndef __DRV_DVFS_H__
#define __DRV_DVFS_H__
#include <linux/cpufreq.h>
#ifndef CONFIG_SOCT_COMMON_KERNEL
#include <linux/efi.h>
#endif
#include "td_type.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#define CLOCK_24M (24 * 1000) /* 24 KHz */
#define MAX_DIFF_VALUE CLOCK_24M
#define VOLT_UV_TO_MV 1000
#define VOLT_MV_TO_UV 1000
#define VOLT_DIFF_VALUE 10
struct hl_dvfs_info {
struct cpumask cpus;
struct device *cpu_dev;
struct clk *cpu_clk;
struct regulator *cpu_reg;
struct mutex dvfs_lock;
struct list_head list;
};
struct hl_dvfs_info *dvfs_get_info(td_u32 cpu);
struct hl_dvfs_info *dvfs_get_cluster(td_u32 cpu);
td_s32 dvfs_init_volt_cal_info(td_void);
td_s32 dvfs_round_freq(td_u32 cpu, td_u32 *rate);
td_s32 dvfs_get_volt_for_new_freq(td_u32 *volt, td_u32 new_freq);
td_s32 dvfs_enter_active_standby(td_u32 model);
td_s32 dvfs_quit_active_standby(td_void);
td_void dvfs_freq_volt_matching_check(td_void);
#ifdef CONFIG_SOCT_CPU_DVFS_SUPPORT
td_s32 dvfs_set_governor(const char *buf);
#endif
#ifndef CONFIG_SOCT_COMMON_KERNEL
#define EFI_VARIABLE_BUTE (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)
td_void dvfs_set_agint_test_volt(td_bool increase, td_u32 volt);
td_void dvfs_get_agint_test_volt(td_void);
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */
#endif /* End of #ifndef __DRV_DVFS_H__ */