msm: ipa4: IPA PM naming fixes

Change the max_clients from a define to part of the clients enum.
Change the function name set_perf_profile to set_throughput since
it only changes throughput and perf_profile has been deprecated.

Change-Id: I425f438001d5e0024c09cd822b3f813de2840361
Signed-off-by: Michael Adisumarta <madisuma@codeaurora.org>
This commit is contained in:
Michael Adisumarta 2018-10-30 11:38:12 -07:00 committed by Gerrit - the friendly Code Review server
parent 43200c3024
commit 91ea98be98
10 changed files with 55 additions and 55 deletions

View File

@ -1135,7 +1135,7 @@ int ipa_bridge_set_perf_profile(u32 hdl, u32 bandwidth)
mutex_lock(&ipa_gsb_ctx->iface_lock[hdl]);
ret = ipa_pm_set_perf_profile(ipa_gsb_ctx->pm_hdl,
ret = ipa_pm_set_throughput(ipa_gsb_ctx->pm_hdl,
bandwidth);
if (ret)
IPA_GSB_ERR("fail to set perf profile\n");

View File

@ -2596,7 +2596,7 @@ static int ipa_mhi_register_pm(void)
goto fail_pm_cons;
}
res = ipa_pm_set_perf_profile(ipa_mhi_client_ctx->pm_hdl, 1000);
res = ipa_pm_set_throughput(ipa_mhi_client_ctx->pm_hdl, 1000);
if (res) {
IPA_MHI_ERR("fail to set perf profile to PM %d\n", res);
goto fail_pm_cons;

View File

@ -595,7 +595,7 @@ int ipa_set_perf_profile(struct ipa_perf_profile *profile)
}
if (ipa_pm_is_used())
return ipa_pm_set_perf_profile(
return ipa_pm_set_throughput(
ipa_uc_offload_ctx[IPA_UC_NTN]->pm_hdl,
profile->max_supported_bw_mbps);

View File

@ -1848,7 +1848,7 @@ static int ipa3_usb_xdci_connect_internal(
if (ipa_pm_is_used()) {
/* perf profile is not set on USB DPL pipe */
if (ttype != IPA_USB_TRANSPORT_DPL) {
result = ipa_pm_set_perf_profile(
result = ipa_pm_set_throughput(
ipa3_usb_ctx->ttype_ctx[ttype].pm_ctx.hdl,
params->max_supported_bandwidth_mbps);
if (result) {

View File

@ -846,7 +846,7 @@ int ipa_wdi_set_perf_profile(struct ipa_wdi_perf_profile *profile)
return -EFAULT;
}
} else {
if (ipa_pm_set_perf_profile(ipa_wdi_ctx->ipa_pm_hdl,
if (ipa_pm_set_throughput(ipa_wdi_ctx->ipa_pm_hdl,
profile->max_supported_bw_mbps)) {
IPA_WDI_ERR("fail to setup pm perf profile\n");
return -EFAULT;

View File

@ -1001,7 +1001,7 @@ int ipa3_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
}
}
result = ipa_pm_set_perf_profile(ep->sys->pm_hdl,
result = ipa_pm_set_throughput(ep->sys->pm_hdl,
IPA_APPS_BW_FOR_PM);
if (result) {
IPAERR("failed to set profile IPA PM client\n");

View File

@ -14,22 +14,6 @@
#include "ipa_pm.h"
#include "ipa_i.h"
static const char *client_state_to_str[IPA_PM_STATE_MAX] = {
__stringify(IPA_PM_DEACTIVATED),
__stringify(IPA_PM_DEACTIVATE_IN_PROGRESS),
__stringify(IPA_PM_ACTIVATE_IN_PROGRESS),
__stringify(IPA_PM_ACTIVATED),
__stringify(IPA_PM_ACTIVATED_PENDING_DEACTIVATION),
__stringify(IPA_PM_ACTIVATED_TIMER_SET),
__stringify(IPA_PM_ACTIVATED_PENDING_RESCHEDULE),
};
static const char *ipa_pm_group_to_str[IPA_PM_GROUP_MAX] = {
__stringify(IPA_PM_GROUP_DEFAULT),
__stringify(IPA_PM_GROUP_APPS),
__stringify(IPA_PM_GROUP_MODEM),
};
#define IPA_PM_DRV_NAME "ipa_pm"
@ -130,6 +114,7 @@ enum ipa_pm_state {
IPA_PM_ACTIVATED_PENDING_DEACTIVATION,
IPA_PM_ACTIVATED_TIMER_SET,
IPA_PM_ACTIVATED_PENDING_RESCHEDULE,
IPA_PM_STATE_MAX
};
#define IPA_PM_STATE_ACTIVE(state) \
@ -196,6 +181,22 @@ struct ipa_pm_ctx {
static struct ipa_pm_ctx *ipa_pm_ctx;
static const char *client_state_to_str[IPA_PM_STATE_MAX] = {
__stringify(IPA_PM_DEACTIVATED),
__stringify(IPA_PM_DEACTIVATE_IN_PROGRESS),
__stringify(IPA_PM_ACTIVATE_IN_PROGRESS),
__stringify(IPA_PM_ACTIVATED),
__stringify(IPA_PM_ACTIVATED_PENDING_DEACTIVATION),
__stringify(IPA_PM_ACTIVATED_TIMER_SET),
__stringify(IPA_PM_ACTIVATED_PENDING_RESCHEDULE),
};
static const char *ipa_pm_group_to_str[IPA_PM_GROUP_MAX] = {
__stringify(IPA_PM_GROUP_DEFAULT),
__stringify(IPA_PM_GROUP_APPS),
__stringify(IPA_PM_GROUP_MODEM),
};
/**
* pop_max_from_array() -pop the max and move the last element to where the
* max was popped
@ -705,11 +706,6 @@ int ipa_pm_register(struct ipa_pm_register_params *params, u32 *hdl)
return -EINVAL;
}
if (ipa_pm_ctx == NULL) {
IPA_PM_ERR("PM_ctx is null\n");
return -EINVAL;
}
if (params == NULL || hdl == NULL || params->name == NULL) {
IPA_PM_ERR("Invalid Params\n");
return -EINVAL;
@ -853,9 +849,13 @@ int ipa_pm_associate_ipa_cons_to_client(u32 hdl, enum ipa_client_type consumer)
}
mutex_lock(&ipa_pm_ctx->client_mutex);
idx = ipa_get_ep_mapping(consumer);
if (ipa_pm_ctx->clients[hdl] == NULL) {
mutex_unlock(&ipa_pm_ctx->client_mutex);
IPA_PM_ERR("Client is NULL\n");
return -EPERM;
}
IPA_PM_DBG("Mapping pipe %d to client %d\n", idx, hdl);
idx = ipa_get_ep_mapping(consumer);
if (idx < 0) {
mutex_unlock(&ipa_pm_ctx->client_mutex);
@ -863,11 +863,7 @@ int ipa_pm_associate_ipa_cons_to_client(u32 hdl, enum ipa_client_type consumer)
return 0;
}
if (ipa_pm_ctx->clients[hdl] == NULL) {
mutex_unlock(&ipa_pm_ctx->client_mutex);
IPA_PM_ERR("Client is NULL\n");
return -EPERM;
}
IPA_PM_DBG("Mapping pipe %d to client %d\n", idx, hdl);
if (ipa_pm_ctx->clients_by_pipe[idx] != NULL) {
mutex_unlock(&ipa_pm_ctx->client_mutex);
@ -1051,6 +1047,11 @@ int ipa_pm_deferred_deactivate(u32 hdl)
case IPA_PM_DEACTIVATE_IN_PROGRESS:
case IPA_PM_ACTIVATED_PENDING_RESCHEDULE:
break;
case IPA_PM_STATE_MAX:
default:
IPA_PM_ERR("Bad State");
spin_unlock_irqrestore(&client->state_lock, flags);
return -EINVAL;
}
IPA_PM_DBG_STATE(hdl, client->name, client->state);
spin_unlock_irqrestore(&client->state_lock, flags);
@ -1220,14 +1221,14 @@ int ipa_pm_handle_suspend(u32 pipe_bitmask)
}
/**
* ipa_pm_set_perf_profile(): Adds/changes the throughput requirement to IPA PM
* ipa_pm_set_throughput(): Adds/changes the throughput requirement to IPA PM
* to be used for clock scaling
* @hdl: index of the client in the array
* @throughput: the new throughput value to be set for that client
*
* Returns: 0 on success, negative on failure
*/
int ipa_pm_set_perf_profile(u32 hdl, int throughput)
int ipa_pm_set_throughput(u32 hdl, int throughput)
{
struct ipa_pm_client *client;
unsigned long flags;

View File

@ -21,7 +21,6 @@
#define IPA_PM_THRESHOLD_MAX 5
#define IPA_PM_EXCEPTION_MAX 2
#define IPA_PM_DEFERRED_TIMEOUT 10
#define IPA_PM_STATE_MAX 7
/*
* ipa_pm group names
@ -98,7 +97,7 @@ int ipa_pm_activate(u32 hdl);
int ipa_pm_activate_sync(u32 hdl);
int ipa_pm_deferred_deactivate(u32 hdl);
int ipa_pm_deactivate_sync(u32 hdl);
int ipa_pm_set_perf_profile(u32 hdl, int throughput);
int ipa_pm_set_throughput(u32 hdl, int throughput);
int ipa_pm_deregister(u32 hdl);
/* IPA Internal Functions */
@ -143,7 +142,7 @@ static inline int ipa_pm_deactivate_sync(u32 hdl)
return -EPERM;
}
static inline int ipa_pm_set_perf_profile(u32 hdl, int throughput)
static inline int ipa_pm_set_throughput(u32 hdl, int throughput)
{
return -EPERM;
}

View File

@ -1963,11 +1963,11 @@ int ipa3_wwan_set_modem_perf_profile(int throughput)
int ret;
if (ipa3_ctx->use_ipa_pm) {
ret = ipa_pm_set_perf_profile(rmnet_ipa3_ctx->q6_pm_hdl,
ret = ipa_pm_set_throughput(rmnet_ipa3_ctx->q6_pm_hdl,
throughput);
if (ret)
return ret;
ret = ipa_pm_set_perf_profile(rmnet_ipa3_ctx->q6_teth_pm_hdl,
ret = ipa_pm_set_throughput(rmnet_ipa3_ctx->q6_teth_pm_hdl,
throughput);
} else {
memset(&profile, 0, sizeof(profile));

View File

@ -1030,7 +1030,7 @@ static int ipa_pm_ut_deactivate_loop(void *priv)
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_USB, 1200);
rc = ipa_pm_set_throughput(hdl_USB, 1200);
if (rc) {
IPA_UT_ERR("fail to set tput for client 1 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
@ -1044,7 +1044,7 @@ static int ipa_pm_ut_deactivate_loop(void *priv)
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_WLAN, 800);
rc = ipa_pm_set_throughput(hdl_WLAN, 800);
if (rc) {
IPA_UT_ERR("fail to set tput for client 2 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
@ -1168,7 +1168,7 @@ static int ipa_pm_ut_set_perf_profile(void *priv)
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_USB, 1200);
rc = ipa_pm_set_throughput(hdl_USB, 1200);
if (rc) {
IPA_UT_ERR("fail to set tput for client 1 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
@ -1182,7 +1182,7 @@ static int ipa_pm_ut_set_perf_profile(void *priv)
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_WLAN, 800);
rc = ipa_pm_set_throughput(hdl_WLAN, 800);
if (rc) {
IPA_UT_ERR("fail to set tput for client 2 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
@ -1226,7 +1226,7 @@ static int ipa_pm_ut_set_perf_profile(void *priv)
return -EINVAL;
}
rc = ipa_pm_set_perf_profile(hdl_WLAN, 1200);
rc = ipa_pm_set_throughput(hdl_WLAN, 1200);
if (rc) {
IPA_UT_ERR("fail to set tput for client 2 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
@ -1297,14 +1297,14 @@ static int ipa_pm_ut_group_tput(void *priv)
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_USB, 500);
rc = ipa_pm_set_throughput(hdl_USB, 500);
if (rc) {
IPA_UT_ERR("fail to set tput for client 1 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_WLAN, 800);
rc = ipa_pm_set_throughput(hdl_WLAN, 800);
if (rc) {
IPA_UT_ERR("fail to set tput for client 2 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
@ -1355,7 +1355,7 @@ static int ipa_pm_ut_group_tput(void *priv)
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_MODEM, 1000);
rc = ipa_pm_set_throughput(hdl_MODEM, 1000);
if (rc) {
IPA_UT_ERR("fail to set tput for client 2 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
@ -1464,14 +1464,14 @@ static int ipa_pm_ut_skip_clk_vote_tput(void *priv)
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_USB, 1200);
rc = ipa_pm_set_throughput(hdl_USB, 1200);
if (rc) {
IPA_UT_ERR("fail to set tput for client 1 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_WLAN, 800);
rc = ipa_pm_set_throughput(hdl_WLAN, 800);
if (rc) {
IPA_UT_ERR("fail to set tput for client 2 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
@ -1522,7 +1522,7 @@ static int ipa_pm_ut_skip_clk_vote_tput(void *priv)
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_MODEM, 2000);
rc = ipa_pm_set_throughput(hdl_MODEM, 2000);
if (rc) {
IPA_UT_ERR("fail to set tput for client 2 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
@ -1631,14 +1631,14 @@ static int ipa_pm_ut_simple_exception(void *priv)
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_USB, 1200);
rc = ipa_pm_set_throughput(hdl_USB, 1200);
if (rc) {
IPA_UT_ERR("fail to set tput for client 1 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_WLAN, 2000);
rc = ipa_pm_set_throughput(hdl_WLAN, 2000);
if (rc) {
IPA_UT_ERR("fail to set tput for client 2 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");
@ -1689,7 +1689,7 @@ static int ipa_pm_ut_simple_exception(void *priv)
return -EFAULT;
}
rc = ipa_pm_set_perf_profile(hdl_MODEM, 800);
rc = ipa_pm_set_throughput(hdl_MODEM, 800);
if (rc) {
IPA_UT_ERR("fail to set tput for client 2 rc = %d\n", rc);
IPA_UT_TEST_FAIL_REPORT("fail to set perf profile");