From 24fda2a0b28466c49f6112e012b62b269544281c Mon Sep 17 00:00:00 2001 From: Michael Adisumarta Date: Fri, 18 May 2018 14:39:27 -0700 Subject: [PATCH] msm: ipa4: IPA PM Unit tests init fix Destroy the PM before unit testing since every test case will re-init the PM with their own parameters. Take out rpmh dependency for unit tests and move in ipa.c. Change-Id: I4975340b7ba0210aebe0631778fe85c4023feb11 CRs-fixed: 2238471 Signed-off-by: Michael Adisumarta --- drivers/platform/msm/ipa/ipa_v3/ipa.c | 8 +++-- drivers/platform/msm/ipa/test/ipa_pm_ut.c | 38 ++++++++++++++++------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 0cbbb42e5261..5cbcbaa9db54 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -3879,16 +3879,18 @@ int ipa3_set_clock_plan_from_pm(int idx) { u32 clk_rate; - if (!ipa3_ctx->enable_clock_scaling) + IPADBG_LOW("idx = %d\n", idx); + + if (!ipa3_ctx->enable_clock_scaling) { + ipa3_ctx->ipa3_active_clients.bus_vote_idx = idx; return 0; + } if (ipa3_ctx->ipa3_hw_mode != IPA_HW_MODE_NORMAL) { IPAERR("not supported in this mode\n"); return 0; } - IPADBG_LOW("idx = %d\n", idx); - if (idx <= 0 || idx >= ipa3_ctx->ctrl->msm_bus_data_ptr->num_usecases) { IPAERR("bad voltage\n"); return -EINVAL; diff --git a/drivers/platform/msm/ipa/test/ipa_pm_ut.c b/drivers/platform/msm/ipa/test/ipa_pm_ut.c index f9f2742eb60e..348655749c7b 100644 --- a/drivers/platform/msm/ipa/test/ipa_pm_ut.c +++ b/drivers/platform/msm/ipa/test/ipa_pm_ut.c @@ -23,18 +23,32 @@ struct callback_param { static int ipa_pm_ut_setup(void **ppriv) { + int i; IPA_UT_DBG("Start Setup\n"); /* decrement UT vote */ IPA_ACTIVE_CLIENTS_DEC_SPECIAL("IPA_UT"); + /*decouple PM from RPM */ + ipa3_ctx->enable_clock_scaling = false; + + if (ipa3_ctx->use_ipa_pm) { + for (i = 0; i < IPA_PM_MAX_CLIENTS; i++) { + ipa_pm_deactivate_sync(i); + ipa_pm_deregister(i); + } + + ipa_pm_destroy(); + } + return 0; } static int ipa_pm_ut_teardown(void *priv) { IPA_UT_DBG("Start Teardown\n"); + IPA_UT_ERR("WARNING: IPA_PM HAS BEEN DESTROYED, REBOOT TO RE_INIT\n"); /* undo UT vote */ IPA_ACTIVE_CLIENTS_INC_SPECIAL("IPA_UT"); @@ -106,7 +120,7 @@ static int ipa_pm_ut_single_registration(void *priv) struct callback_param user_data; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -223,7 +237,7 @@ static int ipa_pm_ut_double_register_activate(void *priv) struct callback_param user_data; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -327,7 +341,7 @@ static int ipa_pm_ut_deferred_deactivate(void *priv) struct callback_param user_data; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -436,7 +450,7 @@ static int ipa_pm_ut_two_clients_activate(void *priv) struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -648,7 +662,7 @@ static int ipa_pm_ut_deactivate_all_deferred(void *priv) struct callback_param user_data; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -797,7 +811,7 @@ static int ipa_pm_ut_deactivate_after_activate(void *priv) struct callback_param user_data; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -885,7 +899,7 @@ static int ipa_pm_ut_atomic_activate(void *priv) unsigned long flags; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -957,7 +971,7 @@ static int ipa_pm_ut_deactivate_loop(void *priv) int i, hdl_USB, hdl_WLAN, vote; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -1095,7 +1109,7 @@ static int ipa_pm_ut_set_perf_profile(void *priv) int hdl_USB, hdl_WLAN, vote, idx; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -1210,7 +1224,7 @@ static int ipa_pm_ut_group_tput(void *priv) int hdl_USB, hdl_WLAN, hdl_MODEM, vote, idx; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -1377,7 +1391,7 @@ static int ipa_pm_ut_skip_clk_vote_tput(void *priv) int hdl_USB, hdl_WLAN, hdl_MODEM, vote, idx; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000} }; @@ -1542,7 +1556,7 @@ static int ipa_pm_ut_simple_exception(void *priv) }; struct ipa_pm_init_params init_params = { - .threshold_size = IPA_PM_THRESHOLD_MAX, + .threshold_size = 2, .default_threshold = {600, 1000}, .exception_size = 1, .exceptions[0] = exceptions,