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: Abstract read_pm_config
Allow platform specific implementation to get SST-CP capability and current state. 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
a59a6c0cad
commit
8f54104f7a
3 changed files with 22 additions and 14 deletions
|
@ -40,6 +40,24 @@ static int mbox_is_punit_valid(struct isst_id *id)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mbox_read_pm_config(struct isst_id *id, int *cp_state, int *cp_cap)
|
||||||
|
{
|
||||||
|
unsigned int resp;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = isst_send_mbox_command(id->cpu, READ_PM_CONFIG, PM_FEATURE, 0, 0,
|
||||||
|
&resp);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
debug_printf("cpu:%d READ_PM_CONFIG resp:%x\n", id->cpu, resp);
|
||||||
|
|
||||||
|
*cp_state = resp & BIT(16);
|
||||||
|
*cp_cap = resp & BIT(0) ? 1 : 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int mbox_get_config_levels(struct isst_id *id, struct isst_pkg_ctdp *pkg_dev)
|
static int mbox_get_config_levels(struct isst_id *id, struct isst_pkg_ctdp *pkg_dev)
|
||||||
{
|
{
|
||||||
unsigned int resp;
|
unsigned int resp;
|
||||||
|
@ -803,6 +821,7 @@ static struct isst_platform_ops mbox_ops = {
|
||||||
.get_trl_max_levels = mbox_get_trl_max_levels,
|
.get_trl_max_levels = mbox_get_trl_max_levels,
|
||||||
.get_trl_level_name = mbox_get_trl_level_name,
|
.get_trl_level_name = mbox_get_trl_level_name,
|
||||||
.is_punit_valid = mbox_is_punit_valid,
|
.is_punit_valid = mbox_is_punit_valid,
|
||||||
|
.read_pm_config = mbox_read_pm_config,
|
||||||
.get_config_levels = mbox_get_config_levels,
|
.get_config_levels = mbox_get_config_levels,
|
||||||
.get_ctdp_control = mbox_get_ctdp_control,
|
.get_ctdp_control = mbox_get_ctdp_control,
|
||||||
.get_tdp_info = mbox_get_tdp_info,
|
.get_tdp_info = mbox_get_tdp_info,
|
||||||
|
|
|
@ -249,20 +249,8 @@ int isst_send_msr_command(unsigned int cpu, unsigned int msr, int write,
|
||||||
|
|
||||||
int isst_read_pm_config(struct isst_id *id, int *cp_state, int *cp_cap)
|
int isst_read_pm_config(struct isst_id *id, int *cp_state, int *cp_cap)
|
||||||
{
|
{
|
||||||
unsigned int resp;
|
CHECK_CB(read_pm_config);
|
||||||
int ret;
|
return isst_ops->read_pm_config(id, cp_state, cp_cap);
|
||||||
|
|
||||||
ret = isst_send_mbox_command(id->cpu, READ_PM_CONFIG, PM_FEATURE, 0, 0,
|
|
||||||
&resp);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
debug_printf("cpu:%d READ_PM_CONFIG resp:%x\n", id->cpu, resp);
|
|
||||||
|
|
||||||
*cp_state = resp & BIT(16);
|
|
||||||
*cp_cap = resp & BIT(0) ? 1 : 0;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int isst_get_ctdp_levels(struct isst_id *id, struct isst_pkg_ctdp *pkg_dev)
|
int isst_get_ctdp_levels(struct isst_id *id, struct isst_pkg_ctdp *pkg_dev)
|
||||||
|
|
|
@ -186,6 +186,7 @@ struct isst_platform_ops {
|
||||||
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);
|
||||||
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 (*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);
|
||||||
int (*get_ctdp_control)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
|
int (*get_ctdp_control)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
|
||||||
int (*get_tdp_info)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
|
int (*get_tdp_info)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
|
||||||
|
|
Loading…
Reference in a new issue