mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
tools/power/x86/intel-speed-select: Allow api_version based platform callbacks
Different api_version suggests different kernel driver used and different interface is used to communication with the hardware. Allow setting platform specific callbacks based on api_version. Currently, all platforms with api_version 1 uses Mbox/MMIO interfaces. No functional changes are expected. Signed-off-by: Zhang Rui <rui.zhang@intel.com> [srinivas.pandruvada@linux.intel.com: changelog edits] Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
This commit is contained in:
parent
2b86ed225e
commit
05aab5b8c1
3 changed files with 15 additions and 10 deletions
|
@ -803,8 +803,10 @@ static int isst_fill_platform_info(void)
|
||||||
const char *pathname = "/dev/isst_interface";
|
const char *pathname = "/dev/isst_interface";
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (is_clx_n_platform())
|
if (is_clx_n_platform()) {
|
||||||
|
isst_platform_info.api_version = 1;
|
||||||
goto set_platform_ops;
|
goto set_platform_ops;
|
||||||
|
}
|
||||||
|
|
||||||
fd = open(pathname, O_RDWR);
|
fd = open(pathname, O_RDWR);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
@ -824,7 +826,7 @@ static int isst_fill_platform_info(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_platform_ops:
|
set_platform_ops:
|
||||||
if (isst_set_platform_ops()) {
|
if (isst_set_platform_ops(isst_platform_info.api_version)) {
|
||||||
fprintf(stderr, "Failed to set platform callbacks\n");
|
fprintf(stderr, "Failed to set platform callbacks\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,16 @@ static struct isst_platform_ops *isst_ops;
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
int isst_set_platform_ops(void)
|
int isst_set_platform_ops(int api_version)
|
||||||
{
|
{
|
||||||
isst_ops = mbox_get_platform_ops();
|
switch (api_version) {
|
||||||
|
case 1:
|
||||||
|
isst_ops = mbox_get_platform_ops();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
isst_ops = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isst_ops)
|
if (!isst_ops)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -185,6 +185,7 @@ struct isst_platform_ops {
|
||||||
int (*get_disp_freq_multiplier)(void);
|
int (*get_disp_freq_multiplier)(void);
|
||||||
int (*get_trl_max_levels)(void);
|
int (*get_trl_max_levels)(void);
|
||||||
char *(*get_trl_level_name)(int level);
|
char *(*get_trl_level_name)(int level);
|
||||||
|
void (*update_platform_param)(enum isst_platform_param param, int value);
|
||||||
int (*is_punit_valid)(struct isst_id *id);
|
int (*is_punit_valid)(struct isst_id *id);
|
||||||
int (*read_pm_config)(struct isst_id *id, int *cp_state, int *cp_cap);
|
int (*read_pm_config)(struct isst_id *id, int *cp_state, int *cp_cap);
|
||||||
int (*get_config_levels)(struct isst_id *id, struct isst_pkg_ctdp *pkg_ctdp);
|
int (*get_config_levels)(struct isst_id *id, struct isst_pkg_ctdp *pkg_ctdp);
|
||||||
|
@ -226,15 +227,10 @@ extern void set_cpu_mask_from_punit_coremask(struct isst_id *id,
|
||||||
size_t core_cpumask_size,
|
size_t core_cpumask_size,
|
||||||
cpu_set_t *core_cpumask,
|
cpu_set_t *core_cpumask,
|
||||||
int *cpu_cnt);
|
int *cpu_cnt);
|
||||||
extern int isst_send_mbox_command(unsigned int cpu, unsigned char command,
|
|
||||||
unsigned char sub_command,
|
|
||||||
unsigned int write,
|
|
||||||
unsigned int req_data, unsigned int *resp);
|
|
||||||
|
|
||||||
extern int isst_send_msr_command(unsigned int cpu, unsigned int command,
|
extern int isst_send_msr_command(unsigned int cpu, unsigned int command,
|
||||||
int write, unsigned long long *req_resp);
|
int write, unsigned long long *req_resp);
|
||||||
|
|
||||||
extern int isst_set_platform_ops(void);
|
extern int isst_set_platform_ops(int api_version);
|
||||||
extern void isst_update_platform_param(enum isst_platform_param, int vale);
|
extern void isst_update_platform_param(enum isst_platform_param, int vale);
|
||||||
extern int isst_get_disp_freq_multiplier(void);
|
extern int isst_get_disp_freq_multiplier(void);
|
||||||
extern int isst_get_trl_max_levels(void);
|
extern int isst_get_trl_max_levels(void);
|
||||||
|
|
Loading…
Reference in a new issue