msm: ipa: Add turbo mode clock voting

Add support in ipa to vote for turbo mode bimc/snoc clocks and
ipa clock based on different aggregated BW values.

Change-Id: I645befb0d06f3b40d685a873f2920c765075e92d
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
This commit is contained in:
Skylar Chang 2015-03-23 22:11:39 -07:00
parent f94dd90cce
commit 14a3df8d21
5 changed files with 50 additions and 24 deletions

View file

@ -2408,16 +2408,17 @@ static unsigned int ipa_get_bus_vote(void)
{
unsigned int idx = 1;
if (ipa_ctx->curr_ipa_clk_rate == ipa_ctx->ctrl->ipa_clk_rate_lo) {
if (ipa_ctx->curr_ipa_clk_rate == ipa_ctx->ctrl->ipa_clk_rate_svs) {
idx = 1;
} else if (ipa_ctx->curr_ipa_clk_rate ==
ipa_ctx->ctrl->ipa_clk_rate_hi) {
if (ipa_ctx->ctrl->msm_bus_data_ptr->num_usecases == 2)
ipa_ctx->ctrl->ipa_clk_rate_nominal) {
if (ipa_ctx->ctrl->msm_bus_data_ptr->num_usecases <= 2)
idx = 1;
else if (ipa_ctx->ctrl->msm_bus_data_ptr->num_usecases == 3)
idx = 2;
else
WARN_ON(1);
idx = 2;
} else if (ipa_ctx->curr_ipa_clk_rate ==
ipa_ctx->ctrl->ipa_clk_rate_turbo) {
idx = ipa_ctx->ctrl->msm_bus_data_ptr->num_usecases - 1;
} else {
WARN_ON(1);
}
@ -2651,7 +2652,11 @@ int ipa_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
if (ipa_ctx->enable_clock_scaling) {
IPADBG("Clock scaling is enabled\n");
if (bandwidth_mbps >= ipa_ctx->ctrl->clock_scaling_bw_threshold)
if (bandwidth_mbps >=
ipa_ctx->ctrl->clock_scaling_bw_threshold_turbo)
needed_voltage = IPA_VOLTAGE_TURBO;
else if (bandwidth_mbps >=
ipa_ctx->ctrl->clock_scaling_bw_threshold_nominal)
needed_voltage = IPA_VOLTAGE_NOMINAL;
else
needed_voltage = IPA_VOLTAGE_SVS;
@ -2663,10 +2668,13 @@ int ipa_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
needed_voltage = max(needed_voltage, floor_voltage);
switch (needed_voltage) {
case IPA_VOLTAGE_SVS:
clk_rate = ipa_ctx->ctrl->ipa_clk_rate_lo;
clk_rate = ipa_ctx->ctrl->ipa_clk_rate_svs;
break;
case IPA_VOLTAGE_NOMINAL:
clk_rate = ipa_ctx->ctrl->ipa_clk_rate_hi;
clk_rate = ipa_ctx->ctrl->ipa_clk_rate_nominal;
break;
case IPA_VOLTAGE_TURBO:
clk_rate = ipa_ctx->ctrl->ipa_clk_rate_turbo;
break;
default:
IPAERR("bad voltage\n");
@ -3063,7 +3071,7 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
/* Enable ipa_ctx->enable_clock_scaling */
ipa_ctx->enable_clock_scaling = 1;
ipa_ctx->curr_ipa_clk_rate = ipa_ctx->ctrl->ipa_clk_rate_hi;
ipa_ctx->curr_ipa_clk_rate = ipa_ctx->ctrl->ipa_clk_rate_turbo;
/* enable IPA clocks explicitly to allow the initialization */
ipa_enable_clks();

View file

@ -1667,11 +1667,19 @@ void ipa_debugfs_init(void)
goto fail;
}
file = debugfs_create_u32("clock_scaling_bw_threshold_mbps",
file = debugfs_create_u32("clock_scaling_bw_threshold_nominal_mbps",
read_write_mode, dent,
&ipa_ctx->ctrl->clock_scaling_bw_threshold);
&ipa_ctx->ctrl->clock_scaling_bw_threshold_nominal);
if (!file) {
IPAERR("could not create clock_scaling_bw_threshold_mbps\n");
IPAERR("could not create bw_threshold_nominal_mbps\n");
goto fail;
}
file = debugfs_create_u32("clock_scaling_bw_threshold_turbo_mbps",
read_write_mode, dent,
&ipa_ctx->ctrl->clock_scaling_bw_threshold_turbo);
if (!file) {
IPAERR("could not create bw_threshold_turbo_mbps\n");
goto fail;
}

View file

@ -1307,9 +1307,11 @@ struct ipa_mem_partition {
struct ipa_controller {
struct ipa_mem_partition mem_partition;
u32 ipa_clk_rate_hi;
u32 ipa_clk_rate_lo;
u32 clock_scaling_bw_threshold;
u32 ipa_clk_rate_turbo;
u32 ipa_clk_rate_nominal;
u32 ipa_clk_rate_svs;
u32 clock_scaling_bw_threshold_turbo;
u32 clock_scaling_bw_threshold_nominal;
u32 ipa_reg_base_ofst;
u32 max_holb_tmr_val;
void (*ipa_sram_read_settings)(void);

View file

@ -20,14 +20,16 @@
#define IPA_V1_CLK_RATE (92.31 * 1000 * 1000UL)
#define IPA_V1_1_CLK_RATE (100 * 1000 * 1000UL)
#define IPA_V2_0_CLK_RATE_LOW (75 * 1000 * 1000UL)
#define IPA_V2_0_CLK_RATE_HIGH (150 * 1000 * 1000UL)
#define IPA_V2_0_CLK_RATE_SVS (75 * 1000 * 1000UL)
#define IPA_V2_0_CLK_RATE_NOMINAL (150 * 1000 * 1000UL)
#define IPA_V2_0_CLK_RATE_TURBO (200 * 1000 * 1000UL)
#define IPA_V1_MAX_HOLB_TMR_VAL (512 - 1)
#define IPA_V2_0_MAX_HOLB_TMR_VAL (65536 - 1)
#define IPA_V2_5_MAX_HOLB_TMR_VAL (4294967296 - 1)
#define IPA_V2_6L_MAX_HOLB_TMR_VAL IPA_V2_5_MAX_HOLB_TMR_VAL
#define IPA_V2_0_BW_THRESHOLD_MBPS (800)
#define IPA_V2_0_BW_THRESHOLD_TURBO_MBPS (1200)
#define IPA_V2_0_BW_THRESHOLD_NOMINAL_MBPS (600)
/* Max pipes + ICs for TAG process */
#define IPA_TAG_MAX_DESC (IPA_MAX_NUM_PIPES + 6)
@ -4190,8 +4192,9 @@ void ipa_controller_shared_static_bind(struct ipa_controller *ctrl)
ctrl->ipa_cfg_ep_status = _ipa_cfg_ep_status_v2_0;
ctrl->ipa_cfg_ep_cfg = _ipa_cfg_ep_cfg_v2_0;
ctrl->ipa_cfg_ep_metadata_mask = _ipa_cfg_ep_metadata_mask_v2_0;
ctrl->ipa_clk_rate_hi = IPA_V2_0_CLK_RATE_HIGH;
ctrl->ipa_clk_rate_lo = IPA_V2_0_CLK_RATE_LOW;
ctrl->ipa_clk_rate_turbo = IPA_V2_0_CLK_RATE_TURBO;
ctrl->ipa_clk_rate_nominal = IPA_V2_0_CLK_RATE_NOMINAL;
ctrl->ipa_clk_rate_svs = IPA_V2_0_CLK_RATE_SVS;
ctrl->ipa_read_gen_reg = _ipa_read_gen_reg_v2_0;
ctrl->ipa_read_ep_reg = _ipa_read_ep_reg_v2_0;
ctrl->ipa_write_dbg_cnt = _ipa_write_dbg_cnt_v2_0;
@ -4203,7 +4206,10 @@ void ipa_controller_shared_static_bind(struct ipa_controller *ctrl)
ctrl->ipa_disable_clks = _ipa_disable_clks_v2_0;
ctrl->msm_bus_data_ptr = &ipa_bus_client_pdata_v2_0;
ctrl->ipa_cfg_ep_metadata = _ipa_cfg_ep_metadata_v2_0;
ctrl->clock_scaling_bw_threshold = IPA_V2_0_BW_THRESHOLD_MBPS;
ctrl->clock_scaling_bw_threshold_nominal =
IPA_V2_0_BW_THRESHOLD_NOMINAL_MBPS;
ctrl->clock_scaling_bw_threshold_turbo =
IPA_V2_0_BW_THRESHOLD_TURBO_MBPS;
}
/**
@ -4235,8 +4241,9 @@ int ipa_controller_static_bind(struct ipa_controller *ctrl,
ctrl->ipa_cfg_ep_status = _ipa_cfg_ep_status_v1_1;
ctrl->ipa_cfg_ep_cfg = _ipa_cfg_ep_cfg_v1_1;
ctrl->ipa_cfg_ep_metadata_mask = _ipa_cfg_ep_metadata_mask_v1_1;
ctrl->ipa_clk_rate_hi = IPA_V1_1_CLK_RATE;
ctrl->ipa_clk_rate_lo = IPA_V1_1_CLK_RATE;
ctrl->ipa_clk_rate_turbo = IPA_V1_1_CLK_RATE;
ctrl->ipa_clk_rate_nominal = IPA_V1_1_CLK_RATE;
ctrl->ipa_clk_rate_svs = IPA_V1_1_CLK_RATE;
ctrl->ipa_read_gen_reg = _ipa_read_gen_reg_v1_1;
ctrl->ipa_read_ep_reg = _ipa_read_ep_reg_v1_1;
ctrl->ipa_write_dbg_cnt = _ipa_write_dbg_cnt_v1_1;

View file

@ -552,6 +552,7 @@ enum ipa_voltage_level {
IPA_VOLTAGE_UNSPECIFIED,
IPA_VOLTAGE_SVS = IPA_VOLTAGE_UNSPECIFIED,
IPA_VOLTAGE_NOMINAL,
IPA_VOLTAGE_TURBO,
IPA_VOLTAGE_MAX,
};