msm: ipa2: add active clients logging

add framework for IPAv2 active clients history logging
logging is enabled by default
cat /sys/kernel/debugfs/ipa/active_clients in order to view logs
echo anything to /sys/kernel/debugfs/ipa/active_clients in order
to clear the history log buffer

Change-Id: I975271798aee56ac9889d34203a32c99a30fc958
Signed-off-by: Valery Gorohovsky <valeryg@codeaurora.org>
This commit is contained in:
Valery Gorohovsky 2015-11-26 18:27:15 +02:00 committed by David Keitel
parent bc9586706d
commit 7e727e1acb
14 changed files with 531 additions and 155 deletions

View file

@ -31,6 +31,7 @@
#include <linux/netdevice.h>
#include <linux/delay.h>
#include <linux/qcom_iommu.h>
#include <linux/time.h>
#include "ipa_i.h"
#include "ipa_rm_i.h"
@ -191,6 +192,160 @@ static bool smmu_present;
static bool arm_smmu;
static bool smmu_disable_htw;
const char *ipa2_clients_strings[IPA_CLIENT_MAX] = {
__stringify(IPA_CLIENT_HSIC1_PROD),
__stringify(IPA_CLIENT_WLAN1_PROD),
__stringify(IPA_CLIENT_USB2_PROD),
__stringify(IPA_CLIENT_HSIC3_PROD),
__stringify(IPA_CLIENT_HSIC2_PROD),
__stringify(IPA_CLIENT_USB3_PROD),
__stringify(IPA_CLIENT_HSIC4_PROD),
__stringify(IPA_CLIENT_USB4_PROD),
__stringify(IPA_CLIENT_HSIC5_PROD),
__stringify(IPA_CLIENT_USB_PROD),
__stringify(IPA_CLIENT_A5_WLAN_AMPDU_PROD),
__stringify(IPA_CLIENT_A2_EMBEDDED_PROD),
__stringify(IPA_CLIENT_A2_TETHERED_PROD),
__stringify(IPA_CLIENT_APPS_LAN_WAN_PROD),
__stringify(IPA_CLIENT_APPS_CMD_PROD),
__stringify(IPA_CLIENT_ODU_PROD),
__stringify(IPA_CLIENT_MHI_PROD),
__stringify(IPA_CLIENT_Q6_LAN_PROD),
__stringify(IPA_CLIENT_Q6_WAN_PROD),
__stringify(IPA_CLIENT_Q6_CMD_PROD),
__stringify(IPA_CLIENT_MEMCPY_DMA_SYNC_PROD),
__stringify(IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD),
__stringify(IPA_CLIENT_Q6_DECOMP_PROD),
__stringify(IPA_CLIENT_Q6_DECOMP2_PROD),
__stringify(IPA_CLIENT_UC_USB_PROD),
/* Below PROD client type is only for test purpose */
__stringify(IPA_CLIENT_TEST_PROD),
__stringify(IPA_CLIENT_TEST1_PROD),
__stringify(IPA_CLIENT_TEST2_PROD),
__stringify(IPA_CLIENT_TEST3_PROD),
__stringify(IPA_CLIENT_TEST4_PROD),
__stringify(IPA_CLIENT_HSIC1_CONS),
__stringify(IPA_CLIENT_WLAN1_CONS),
__stringify(IPA_CLIENT_HSIC2_CONS),
__stringify(IPA_CLIENT_USB2_CONS),
__stringify(IPA_CLIENT_WLAN2_CONS),
__stringify(IPA_CLIENT_HSIC3_CONS),
__stringify(IPA_CLIENT_USB3_CONS),
__stringify(IPA_CLIENT_WLAN3_CONS),
__stringify(IPA_CLIENT_HSIC4_CONS),
__stringify(IPA_CLIENT_USB4_CONS),
__stringify(IPA_CLIENT_WLAN4_CONS),
__stringify(IPA_CLIENT_HSIC5_CONS),
__stringify(IPA_CLIENT_USB_CONS),
__stringify(IPA_CLIENT_USB_DPL_CONS),
__stringify(IPA_CLIENT_A2_EMBEDDED_CONS),
__stringify(IPA_CLIENT_A2_TETHERED_CONS),
__stringify(IPA_CLIENT_A5_LAN_WAN_CONS),
__stringify(IPA_CLIENT_APPS_LAN_CONS),
__stringify(IPA_CLIENT_APPS_WAN_CONS),
__stringify(IPA_CLIENT_ODU_EMB_CONS),
__stringify(IPA_CLIENT_ODU_TETH_CONS),
__stringify(IPA_CLIENT_MHI_CONS),
__stringify(IPA_CLIENT_Q6_LAN_CONS),
__stringify(IPA_CLIENT_Q6_WAN_CONS),
__stringify(IPA_CLIENT_Q6_DUN_CONS),
__stringify(IPA_CLIENT_MEMCPY_DMA_SYNC_CONS),
__stringify(IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS),
__stringify(IPA_CLIENT_Q6_DECOMP_CONS),
__stringify(IPA_CLIENT_Q6_DECOMP2_CONS),
__stringify(IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS),
/* Below CONS client type is only for test purpose */
__stringify(IPA_CLIENT_TEST_CONS),
__stringify(IPA_CLIENT_TEST1_CONS),
__stringify(IPA_CLIENT_TEST2_CONS),
__stringify(IPA_CLIENT_TEST3_CONS),
__stringify(IPA_CLIENT_TEST4_CONS),
};
static int ipa2_active_clients_log_insert(const char *string)
{
if (!ipa_ctx->ipa2_active_clients_logging.log_rdy)
return -EPERM;
strlcpy(ipa_ctx->ipa2_active_clients_logging.log_buffer
[ipa_ctx->ipa2_active_clients_logging.log_head],
string,
(size_t)IPA2_ACTIVE_CLIENTS_LOG_LINE_LEN);
ipa_ctx->ipa2_active_clients_logging.log_head =
(ipa_ctx->ipa2_active_clients_logging.log_head + 1) %
IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES;
if (ipa_ctx->ipa2_active_clients_logging.log_tail ==
ipa_ctx->ipa2_active_clients_logging.log_head) {
ipa_ctx->ipa2_active_clients_logging.log_tail =
(ipa_ctx->ipa2_active_clients_logging.log_tail + 1) %
IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES;
}
return 0;
}
static int ipa2_active_clients_log_init(void)
{
int i;
ipa_ctx->ipa2_active_clients_logging.log_buffer[0] = kzalloc(
IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES *
sizeof(char[IPA2_ACTIVE_CLIENTS_LOG_LINE_LEN]),
GFP_KERNEL);
if (ipa_ctx->ipa2_active_clients_logging.log_buffer == NULL) {
IPAERR("Active Clients Logging memory allocation failed");
goto bail;
}
for (i = 0; i < IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES; i++) {
ipa_ctx->ipa2_active_clients_logging.log_buffer[i] =
ipa_ctx->ipa2_active_clients_logging.log_buffer[0] +
(IPA2_ACTIVE_CLIENTS_LOG_LINE_LEN * i);
}
ipa_ctx->ipa2_active_clients_logging.log_head = 0;
ipa_ctx->ipa2_active_clients_logging.log_tail =
IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES - 1;
ipa_ctx->ipa2_active_clients_logging.log_rdy = 1;
return 0;
bail:
return -ENOMEM;
}
void ipa2_active_clients_log_clear(void)
{
ipa_active_clients_lock();
ipa_ctx->ipa2_active_clients_logging.log_head = 0;
ipa_ctx->ipa2_active_clients_logging.log_tail =
IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES - 1;
ipa_active_clients_unlock();
}
static void ipa2_active_clients_log_destroy(void)
{
ipa_ctx->ipa2_active_clients_logging.log_rdy = 0;
kfree(ipa_ctx->ipa2_active_clients_logging.log_buffer[0]);
ipa_ctx->ipa2_active_clients_logging.log_head = 0;
ipa_ctx->ipa2_active_clients_logging.log_tail =
IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES - 1;
}
void ipa2_active_clients_log_print_buffer(void)
{
int i;
ipa_active_clients_lock();
for (i = (ipa_ctx->ipa2_active_clients_logging.log_tail + 1) %
IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES;
i != ipa_ctx->ipa2_active_clients_logging.log_head;
i = (i + 1) % IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES) {
pr_err("%s\n", ipa_ctx->ipa2_active_clients_logging
.log_buffer[i]);
}
ipa_active_clients_unlock();
}
enum ipa_smmu_cb_type {
IPA_SMMU_CB_AP,
IPA_SMMU_CB_WLAN,
@ -384,7 +539,7 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (_IOC_NR(cmd) >= IPA_IOCTL_MAX)
return -ENOTTY;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
switch (cmd) {
case IPA_IOC_ALLOC_NAT_MEM:
@ -1087,12 +1242,12 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
break;
default: /* redundant, as cmd was checked against MAXNR */
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return -ENOTTY;
}
kfree(param);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return retval;
}
@ -1279,7 +1434,7 @@ int ipa_init_q6_smem(void)
{
int rc;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
if (ipa_ctx->ipa_hw_type == IPA_HW_v2_0)
rc = ipa_init_smem_region(IPA_MEM_PART(modem_size) -
@ -1291,7 +1446,7 @@ int ipa_init_q6_smem(void)
if (rc) {
IPAERR("failed to initialize Modem RAM memory\n");
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return rc;
}
@ -1299,7 +1454,7 @@ int ipa_init_q6_smem(void)
IPA_MEM_PART(modem_hdr_ofst));
if (rc) {
IPAERR("failed to initialize Modem HDRs RAM memory\n");
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return rc;
}
@ -1307,7 +1462,7 @@ int ipa_init_q6_smem(void)
IPA_MEM_PART(modem_hdr_proc_ctx_ofst));
if (rc) {
IPAERR("failed to initialize Modem proc ctx RAM memory\n");
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return rc;
}
@ -1315,11 +1470,11 @@ int ipa_init_q6_smem(void)
IPA_MEM_PART(modem_comp_decomp_ofst));
if (rc) {
IPAERR("failed to initialize Modem Comp/Decomp RAM memory\n");
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return rc;
}
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return rc;
}
@ -1711,7 +1866,7 @@ int ipa_q6_pre_shutdown_cleanup(void)
if (ipa_ctx->uc_ctx.uc_zip_error)
BUG();
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SPECIAL("Q6");
/*
* pipe delay and holb discard for ZIP pipes are handled
* in post shutdown callback.
@ -2764,7 +2919,7 @@ static void ipa_start_tag_process(struct work_struct *work)
if (res)
IPAERR("ipa_tag_aggr_force_close failed %d\n", res);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
IPADBG("TAG process done\n");
}
@ -2773,12 +2928,28 @@ static void ipa_start_tag_process(struct work_struct *work)
* ipa_inc_client_enable_clks() - Increase active clients counter, and
* enable ipa clocks if necessary
*
* Please do not use this API, use the wrapper macros instead (ipa_i.h)
* IPA2_ACTIVE_CLIENTS_INC_XXXX();
*
* Return codes:
* None
*/
void ipa_inc_client_enable_clks(void)
void ipa2_inc_client_enable_clks(struct ipa2_active_client_logging_info *id)
{
char temp_str[IPA2_ACTIVE_CLIENTS_LOG_LINE_LEN];
unsigned long long t;
unsigned long nanosec_rem;
ipa_active_clients_lock();
if (id->type != SIMPLE) {
t = cpu_clock(smp_processor_id());
nanosec_rem = do_div(t, 1000000000) / 1000;
snprintf(temp_str, IPA2_ACTIVE_CLIENTS_LOG_LINE_LEN,
"[%5lu.%06lu] ^ %s, %s: %d",
(unsigned long)t, nanosec_rem,
id->id_string, id->file, id->line);
ipa2_active_clients_log_insert(temp_str);
}
ipa_ctx->ipa_active_clients.cnt++;
if (ipa_ctx->ipa_active_clients.cnt == 1)
ipa_enable_clks();
@ -2791,13 +2962,20 @@ void ipa_inc_client_enable_clks(void)
* clients if no asynchronous actions should be done. Asynchronous actions are
* locking a mutex and waking up IPA HW.
*
* Please do not use this API, use the wrapper macros instead (ipa_i.h)
*
*
* Return codes: 0 for success
* -EPERM if an asynchronous action should have been done
*/
int ipa_inc_client_enable_clks_no_block(void)
int ipa2_inc_client_enable_clks_no_block(struct ipa2_active_client_logging_info
*id)
{
int res = 0;
unsigned long flags;
char temp_str[IPA2_ACTIVE_CLIENTS_LOG_LINE_LEN];
unsigned long long t;
unsigned long nanosec_rem;
if (ipa_active_clients_trylock(&flags) == 0)
return -EPERM;
@ -2807,6 +2985,16 @@ int ipa_inc_client_enable_clks_no_block(void)
goto bail;
}
if (id->type != SIMPLE) {
t = cpu_clock(smp_processor_id());
nanosec_rem = do_div(t, 1000000000) / 1000;
snprintf(temp_str, IPA2_ACTIVE_CLIENTS_LOG_LINE_LEN,
"[%5lu.%06lu] ^ %s, %s: %d",
(unsigned long)t, nanosec_rem,
id->id_string, id->file, id->line);
ipa2_active_clients_log_insert(temp_str);
}
ipa_ctx->ipa_active_clients.cnt++;
IPADBG("active clients = %d\n", ipa_ctx->ipa_active_clients.cnt);
bail:
@ -2823,12 +3011,28 @@ bail:
* start_tag_process_again flag is set during this function to signal TAG
* process to start again as there was another client that may send data to ipa
*
* Please do not use this API, use the wrapper macros instead (ipa_i.h)
* IPA2_ACTIVE_CLIENTS_DEC_XXXX();
*
* Return codes:
* None
*/
void ipa_dec_client_disable_clks(void)
void ipa2_dec_client_disable_clks(struct ipa2_active_client_logging_info *id)
{
char temp_str[IPA2_ACTIVE_CLIENTS_LOG_LINE_LEN];
unsigned long long t;
unsigned long nanosec_rem;
ipa_active_clients_lock();
if (id->type != SIMPLE) {
t = cpu_clock(smp_processor_id());
nanosec_rem = do_div(t, 1000000000) / 1000;
snprintf(temp_str, IPA2_ACTIVE_CLIENTS_LOG_LINE_LEN,
"[%5lu.%06lu] v %s, %s: %d",
(unsigned long)t, nanosec_rem,
id->id_string, id->file, id->line);
ipa2_active_clients_log_insert(temp_str);
}
ipa_ctx->ipa_active_clients.cnt--;
IPADBG("active clients = %d\n", ipa_ctx->ipa_active_clients.cnt);
if (ipa_ctx->ipa_active_clients.cnt == 0) {
@ -3109,7 +3313,8 @@ void ipa_suspend_handler(enum ipa_irq_type interrupt,
if (!atomic_read(
&ipa_ctx->sps_pm.dec_clients)
) {
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(
ipa_ctx->ep[i].client);
IPADBG("Pipes un-suspended.\n");
IPADBG("Enter poll mode.\n");
atomic_set(
@ -3185,7 +3390,7 @@ static void ipa_sps_release_resource(struct work_struct *work)
ipa_sps_process_irq_schedule_rel();
} else {
atomic_set(&ipa_ctx->sps_pm.dec_clients, 0);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SPECIAL("SPS_RESOURCE");
}
}
atomic_set(&ipa_ctx->sps_pm.eot_activity, 0);
@ -3290,6 +3495,7 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
ipa_ctx->aggregation_type = IPA_MBIM_16;
ipa_ctx->aggregation_byte_limit = 1;
ipa_ctx->aggregation_time_limit = 0;
ipa_ctx->ipa2_active_clients_logging.log_rdy = false;
ipa_ctx->ctrl = kzalloc(sizeof(*ipa_ctx->ctrl), GFP_KERNEL);
if (!ipa_ctx->ctrl) {
@ -3329,6 +3535,9 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
IPADBG("Skipping bus scaling registration on Virtual plat\n");
}
if (ipa2_active_clients_log_init())
goto fail_init_active_client;
/* get IPA clocks */
result = ipa_get_clks(master_dev);
if (result)
@ -3759,6 +3968,8 @@ fail_init_hw:
fail_remap:
ipa_disable_clks();
fail_clk:
ipa2_active_clients_log_destroy();
fail_init_active_client:
msm_bus_scale_unregister_client(ipa_ctx->ipa_bus_hdl);
fail_bus_reg:
if (bus_scale_table) {

View file

@ -289,7 +289,8 @@ int ipa2_connect(const struct ipa_connect_params *in,
}
memset(&ipa_ctx->ep[ipa_ep_idx], 0, sizeof(struct ipa_ep_context));
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(in->client);
ep->skip_ep_cfg = in->skip_ep_cfg;
ep->valid = 1;
@ -430,7 +431,7 @@ int ipa2_connect(const struct ipa_connect_params *in,
ipa_install_dflt_flt_rules(ipa_ep_idx);
if (!ep->keep_ipa_awake)
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(in->client);
IPADBG("client %d (ep: %d) connected\n", in->client, ipa_ep_idx);
@ -484,7 +485,7 @@ desc_mem_alloc_fail:
sps_free_endpoint(ep->ep_hdl);
ipa_cfg_ep_fail:
memset(&ipa_ctx->ep[ipa_ep_idx], 0, sizeof(struct ipa_ep_context));
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(in->client);
fail:
return result;
}
@ -553,7 +554,8 @@ int ipa2_disconnect(u32 clnt_hdl)
ep = &ipa_ctx->ep[clnt_hdl];
if (!ep->keep_ipa_awake)
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
/* Set Disconnect in Progress flag. */
spin_lock(&ipa_ctx->disconnect_lock);
@ -660,7 +662,7 @@ int ipa2_disconnect(u32 clnt_hdl)
memset(&ipa_ctx->ep[clnt_hdl], 0, sizeof(struct ipa_ep_context));
spin_unlock(&ipa_ctx->disconnect_lock);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
IPADBG("client (ep: %d) disconnected\n", clnt_hdl);
@ -691,7 +693,7 @@ int ipa2_reset_endpoint(u32 clnt_hdl)
}
ep = &ipa_ctx->ep[clnt_hdl];
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
res = sps_disconnect(ep->ep_hdl);
if (res) {
IPAERR("sps_disconnect() failed, res=%d.\n", res);
@ -706,7 +708,7 @@ int ipa2_reset_endpoint(u32 clnt_hdl)
}
bail:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return res;
}
@ -758,8 +760,7 @@ int ipa2_clear_endpoint_delay(u32 clnt_hdl)
ep->qmi_request_sent = true;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
/* Set disconnect in progress flag so further flow control events are
* not honored.
*/
@ -772,7 +773,7 @@ int ipa2_clear_endpoint_delay(u32 clnt_hdl)
ep_ctrl.ipa_ep_suspend = false;
ipa2_cfg_ep_ctrl(clnt_hdl, &ep_ctrl);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
IPADBG("client (ep: %d) removed ep delay\n", clnt_hdl);

View file

@ -106,6 +106,7 @@ static struct dentry *dfile_msg;
static struct dentry *dfile_ip4_nat;
static struct dentry *dfile_rm_stats;
static struct dentry *dfile_status_stats;
static struct dentry *dfile_active_clients;
static char dbg_buff[IPA_MAX_MSG_LEN];
static s8 ep_reg_idx;
@ -153,9 +154,9 @@ static ssize_t ipa_read_gen_reg(struct file *file, char __user *ubuf,
{
int nbytes;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
nbytes = ipa_ctx->ctrl->ipa_read_gen_reg(dbg_buff, IPA_MAX_MSG_LEN);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, nbytes);
}
@ -323,7 +324,7 @@ static ssize_t ipa_read_ep_reg(struct file *file, char __user *ubuf,
end_idx = start_idx + 1;
}
pos = *ppos;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
for (i = start_idx; i < end_idx; i++) {
nbytes = ipa_ctx->ctrl->ipa_read_ep_reg(dbg_buff,
@ -333,7 +334,7 @@ static ssize_t ipa_read_ep_reg(struct file *file, char __user *ubuf,
ret = simple_read_from_buffer(ubuf, count, ppos, dbg_buff,
nbytes);
if (ret < 0) {
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return ret;
}
@ -341,7 +342,7 @@ static ssize_t ipa_read_ep_reg(struct file *file, char __user *ubuf,
ubuf += nbytes;
count -= nbytes;
}
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
*ppos = pos + size;
return size;
@ -365,9 +366,9 @@ static ssize_t ipa_write_keep_awake(struct file *file, const char __user *buf,
return -EFAULT;
if (option == 1)
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
else if (option == 0)
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
else
return -EFAULT;
@ -1225,9 +1226,9 @@ static ssize_t ipa_write_dbg_cnt(struct file *file, const char __user *buf,
if (kstrtou32(dbg_buff, 0, &option))
return -EFAULT;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
ipa_ctx->ctrl->ipa_write_dbg_cnt(option);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return count;
}
@ -1259,9 +1260,9 @@ static ssize_t ipa_read_dbg_cnt(struct file *file, char __user *ubuf,
{
int nbytes;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
nbytes = ipa_ctx->ctrl->ipa_read_dbg_cnt(dbg_buff, IPA_MAX_MSG_LEN);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, nbytes);
}
@ -1548,6 +1549,35 @@ static ssize_t ipa_status_stats_read(struct file *file, char __user *ubuf,
return 0;
}
static ssize_t ipa2_print_active_clients_log(struct file *file,
char __user *ubuf, size_t count, loff_t *ppos)
{
ipa2_active_clients_log_print_buffer();
return 0;
}
static ssize_t ipa2_clear_active_clients_log(struct file *file,
const char __user *ubuf, size_t count, loff_t *ppos)
{
unsigned long missing;
s8 option = 0;
if (sizeof(dbg_buff) < count + 1)
return -EFAULT;
missing = copy_from_user(dbg_buff, ubuf, count);
if (missing)
return -EFAULT;
dbg_buff[count] = '\0';
if (kstrtos8(dbg_buff, 0, &option))
return -EFAULT;
ipa2_active_clients_log_clear();
return count;
}
const struct file_operations ipa_gen_reg_ops = {
.read = ipa_read_gen_reg,
@ -1618,6 +1648,11 @@ const struct file_operations ipa_status_stats_ops = {
.read = ipa_status_stats_read,
};
const struct file_operations ipa2_active_clients = {
.read = ipa2_print_active_clients_log,
.write = ipa2_clear_active_clients_log,
};
void ipa_debugfs_init(void)
{
const mode_t read_only_mode = S_IRUSR | S_IRGRP | S_IROTH;
@ -1647,6 +1682,13 @@ void ipa_debugfs_init(void)
goto fail;
}
dfile_ep_reg = debugfs_create_file("active_clients",
read_write_mode, dent, 0, &ipa2_active_clients);
if (!dfile_ep_reg || IS_ERR(dfile_active_clients)) {
IPAERR("fail to create file for debug_fs ep_reg\n");
goto fail;
}
dfile_ep_reg = debugfs_create_file("ep_reg", read_write_mode, dent, 0,
&ipa_ep_reg_ops);
if (!dfile_ep_reg || IS_ERR(dfile_ep_reg)) {

View file

@ -274,7 +274,7 @@ int ipa2_dma_enable(void)
mutex_unlock(&ipa_dma_ctx->enable_lock);
return -EPERM;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SPECIAL("DMA");
ipa_dma_ctx->is_enabled = true;
mutex_unlock(&ipa_dma_ctx->enable_lock);
@ -337,7 +337,7 @@ int ipa2_dma_disable(void)
}
ipa_dma_ctx->is_enabled = false;
spin_unlock_irqrestore(&ipa_dma_ctx->pending_lock, flags);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SPECIAL("DMA");
mutex_unlock(&ipa_dma_ctx->enable_lock);
IPADMA_FUNC_EXIT();
return 0;

View file

@ -254,7 +254,7 @@ static void ipa_handle_tx(struct ipa_sys_context *sys)
int inactive_cycles = 0;
int cnt;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
do {
cnt = ipa_handle_tx_core(sys, true, true);
if (cnt == 0) {
@ -267,7 +267,7 @@ static void ipa_handle_tx(struct ipa_sys_context *sys)
} while (inactive_cycles <= POLLING_INACTIVITY_TX);
ipa_tx_switch_to_intr_mode(sys);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
}
static void ipa_wq_handle_tx(struct work_struct *work)
@ -653,7 +653,7 @@ int ipa_send_cmd(u16 num_desc, struct ipa_desc *descr)
}
sys = ipa_ctx->ep[ep_idx].sys;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
if (num_desc == 1) {
init_completion(&descr->xfer_done);
@ -687,7 +687,7 @@ int ipa_send_cmd(u16 num_desc, struct ipa_desc *descr)
}
bail:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return result;
}
@ -992,7 +992,7 @@ static void ipa_handle_rx(struct ipa_sys_context *sys)
int inactive_cycles = 0;
int cnt;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
do {
cnt = ipa_handle_rx_core(sys, true, true);
if (cnt == 0) {
@ -1013,7 +1013,7 @@ static void ipa_handle_rx(struct ipa_sys_context *sys)
} while (inactive_cycles <= POLLING_INACTIVITY_RX);
ipa_rx_switch_to_intr_mode(sys);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
}
static void switch_to_intr_rx_work_func(struct work_struct *work)
@ -1105,7 +1105,7 @@ int ipa2_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
ep = &ipa_ctx->ep[ipa_ep_idx];
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(sys_in->client);
if (ep->valid == 1) {
if (sys_in->client != IPA_CLIENT_APPS_LAN_WAN_PROD) {
@ -1130,7 +1130,7 @@ int ipa2_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
ep->priv = sys_in->priv;
*clnt_hdl = ipa_ep_idx;
if (!ep->keep_ipa_awake)
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(sys_in->client);
return 0;
}
@ -1344,7 +1344,7 @@ int ipa2_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
}
if (!ep->keep_ipa_awake)
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(sys_in->client);
IPADBG("client %d (ep: %d) connected sys=%p\n", sys_in->client,
ipa_ep_idx, ep->sys);
@ -1367,7 +1367,7 @@ fail_wq:
kfree(ep->sys);
memset(&ipa_ctx->ep[ipa_ep_idx], 0, sizeof(struct ipa_ep_context));
fail_and_disable_clocks:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(sys_in->client);
fail_gen:
return result;
}
@ -1397,7 +1397,7 @@ int ipa2_teardown_sys_pipe(u32 clnt_hdl)
ep = &ipa_ctx->ep[clnt_hdl];
if (!ep->keep_ipa_awake)
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_disable_data_path(clnt_hdl);
ep->valid = 0;
@ -1441,7 +1441,7 @@ int ipa2_teardown_sys_pipe(u32 clnt_hdl)
if (!atomic_read(&ipa_ctx->wc_memb.active_clnt_cnt))
ipa_cleanup_wlan_rx_common_cache();
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
IPADBG("client (ep: %d) disconnected\n", clnt_hdl);
@ -2050,9 +2050,9 @@ static void replenish_rx_work_func(struct work_struct *work)
dwork = container_of(work, struct delayed_work, work);
sys = container_of(dwork, struct ipa_sys_context, replenish_rx_work);
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
sys->repl_hdlr(sys);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
}
/**
@ -3268,7 +3268,7 @@ int ipa2_sys_setup(struct ipa_sys_connect_params *sys_in,
ep = &ipa_ctx->ep[ipa_ep_idx];
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(sys_in->client);
if (ep->valid == 1) {
if (sys_in->client != IPA_CLIENT_APPS_LAN_WAN_PROD) {
@ -3295,7 +3295,7 @@ int ipa2_sys_setup(struct ipa_sys_connect_params *sys_in,
ep->priv = sys_in->priv;
*clnt_hdl = ipa_ep_idx;
if (!ep->keep_ipa_awake)
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(sys_in->client);
return 0;
}
@ -3336,7 +3336,7 @@ int ipa2_sys_setup(struct ipa_sys_connect_params *sys_in,
*ipa_bam_hdl = ipa_ctx->bam_handle;
if (!ep->keep_ipa_awake)
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(sys_in->client);
ipa_ctx->skip_ep_cfg_shadow[ipa_ep_idx] = ep->skip_ep_cfg;
IPADBG("client %d (ep: %d) connected sys=%p\n", sys_in->client,
@ -3346,7 +3346,7 @@ int ipa2_sys_setup(struct ipa_sys_connect_params *sys_in,
fail_gen2:
fail_and_disable_clocks:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(sys_in->client);
fail_gen:
return result;
}
@ -3364,12 +3364,12 @@ int ipa2_sys_teardown(u32 clnt_hdl)
ep = &ipa_ctx->ep[clnt_hdl];
if (!ep->keep_ipa_awake)
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_disable_data_path(clnt_hdl);
ep->valid = 0;
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
IPADBG("client (ep: %d) disconnected\n", clnt_hdl);

View file

@ -150,6 +150,117 @@
#define IPA_SMMU_UC_VA_SIZE 0x20000000
#define IPA_SMMU_UC_VA_END (IPA_SMMU_UC_VA_START + IPA_SMMU_UC_VA_SIZE)
#define __FILENAME__ \
(strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#define IPA2_ACTIVE_CLIENTS_PREP_EP(log_info, client) \
log_info.file = __FILENAME__; \
log_info.line = __LINE__; \
log_info.type = EP; \
log_info.id_string = ipa2_clients_strings[client]
#define IPA2_ACTIVE_CLIENTS_PREP_SIMPLE(log_info) \
log_info.file = __FILENAME__; \
log_info.line = __LINE__; \
log_info.type = SIMPLE; \
log_info.id_string = __func__
#define IPA2_ACTIVE_CLIENTS_PREP_RESOURCE(log_info, resource_name) \
log_info.file = __FILENAME__; \
log_info.line = __LINE__; \
log_info.type = RESOURCE; \
log_info.id_string = resource_name
#define IPA2_ACTIVE_CLIENTS_PREP_SPECIAL(log_info, id_str) \
log_info.file = __FILENAME__; \
log_info.line = __LINE__; \
log_info.type = SPECIAL; \
log_info.id_string = id_str
#define IPA2_ACTIVE_CLIENTS_INC_EP(client) \
do { \
struct ipa2_active_client_logging_info log_info; \
IPA2_ACTIVE_CLIENTS_PREP_EP(log_info, client); \
ipa2_inc_client_enable_clks(&log_info); \
} while (0)
#define IPA2_ACTIVE_CLIENTS_DEC_EP(client) \
do { \
struct ipa2_active_client_logging_info log_info; \
IPA2_ACTIVE_CLIENTS_PREP_EP(log_info, client); \
ipa2_dec_client_disable_clks(&log_info); \
} while (0)
#define IPA2_ACTIVE_CLIENTS_INC_SIMPLE() \
do { \
struct ipa2_active_client_logging_info log_info; \
IPA2_ACTIVE_CLIENTS_PREP_SIMPLE(log_info); \
ipa2_inc_client_enable_clks(&log_info); \
} while (0)
#define IPA2_ACTIVE_CLIENTS_DEC_SIMPLE() \
do { \
struct ipa2_active_client_logging_info log_info; \
IPA2_ACTIVE_CLIENTS_PREP_SIMPLE(log_info); \
ipa2_dec_client_disable_clks(&log_info); \
} while (0)
#define IPA2_ACTIVE_CLIENTS_INC_RESOURCE(resource_name) \
do { \
struct ipa2_active_client_logging_info log_info; \
IPA2_ACTIVE_CLIENTS_PREP_RESOURCE(log_info, resource_name); \
ipa2_inc_client_enable_clks(&log_info); \
} while (0)
#define IPA2_ACTIVE_CLIENTS_DEC_RESOURCE(resource_name) \
do { \
struct ipa2_active_client_logging_info log_info; \
IPA2_ACTIVE_CLIENTS_PREP_RESOURCE(log_info, resource_name); \
ipa2_dec_client_disable_clks(&log_info); \
} while (0)
#define IPA2_ACTIVE_CLIENTS_INC_SPECIAL(id_str) \
do { \
struct ipa2_active_client_logging_info log_info; \
IPA2_ACTIVE_CLIENTS_PREP_SPECIAL(log_info, id_str); \
ipa2_inc_client_enable_clks(&log_info); \
} while (0)
#define IPA2_ACTIVE_CLIENTS_DEC_SPECIAL(id_str) \
do { \
struct ipa2_active_client_logging_info log_info; \
IPA2_ACTIVE_CLIENTS_PREP_SPECIAL(log_info, id_str); \
ipa2_dec_client_disable_clks(&log_info); \
} while (0)
#define IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES 120
#define IPA2_ACTIVE_CLIENTS_LOG_LINE_LEN 100
extern const char *ipa2_clients_strings[];
enum ipa2_active_client_log_type {
EP,
SIMPLE,
RESOURCE,
SPECIAL,
INVALID
};
struct ipa2_active_client_logging_info {
const char *id_string;
char *file;
int line;
enum ipa2_active_client_log_type type;
};
struct ipa2_active_clients_log_ctx {
char *log_buffer[IPA2_ACTIVE_CLIENTS_LOG_BUFFER_SIZE_LINES];
int log_head;
int log_tail;
bool log_rdy;
};
struct ipa_client_names {
enum ipa_client_type names[MAX_RESOURCE_TO_CLIENTS];
@ -1224,6 +1335,7 @@ struct ipa_context {
struct gen_pool *pipe_mem_pool;
struct dma_pool *dma_pool;
struct ipa_active_clients ipa_active_clients;
struct ipa2_active_clients_log_ctx ipa2_active_clients_logging;
struct workqueue_struct *power_mgmt_wq;
struct workqueue_struct *sps_power_mgmt_wq;
bool tag_process_before_gating;
@ -1829,9 +1941,12 @@ int ipa_straddle_boundary(u32 start, u32 end, u32 boundary);
struct ipa_context *ipa_get_ctx(void);
void ipa_enable_clks(void);
void ipa_disable_clks(void);
void ipa_inc_client_enable_clks(void);
int ipa_inc_client_enable_clks_no_block(void);
void ipa_dec_client_disable_clks(void);
void ipa2_inc_client_enable_clks(struct ipa2_active_client_logging_info *id);
int ipa2_inc_client_enable_clks_no_block(struct ipa2_active_client_logging_info
*id);
void ipa2_dec_client_disable_clks(struct ipa2_active_client_logging_info *id);
void ipa2_active_clients_log_print_buffer(void);
void ipa2_active_clients_log_clear(void);
int ipa_interrupts_init(u32 ipa_irq, u32 ee, struct device *ipa_dev);
int __ipa_del_rt_rule(u32 rule_hdl);
int __ipa_del_hdr(u32 hdr_hdl);
@ -2005,4 +2120,5 @@ int ipa2_restore_suspend_handler(void);
void ipa_sps_irq_control_all(bool enable);
void ipa_inc_acquire_wakelock(void);
void ipa_dec_release_wakelock(void);
const char *ipa_rm_resource_str(enum ipa_rm_resource_name resource_name);
#endif /* _IPA_I_H_ */

View file

@ -184,9 +184,9 @@ static void ipa_process_interrupts(bool isr_context)
static void ipa_interrupt_defer(struct work_struct *work)
{
IPADBG("processing interrupts in wq\n");
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
ipa_process_interrupts(false);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
IPADBG("Done\n");
}

View file

@ -1240,7 +1240,7 @@ int ipa2_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl)
IPA_MHI_DBG("client %d channelHandle %d channelIndex %d\n",
channel->client, channel->hdl, channel->id);
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(in->sys.client);
if (ep->valid == 1) {
IPA_MHI_ERR("EP already allocated.\n");
@ -1310,7 +1310,7 @@ int ipa2_mhi_connect_pipe(struct ipa_mhi_connect_params *in, u32 *clnt_hdl)
ipa_install_dflt_flt_rules(ipa_ep_idx);
if (!ep->keep_ipa_awake)
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(in->sys.client);
ipa_ctx->skip_ep_cfg_shadow[ipa_ep_idx] = ep->skip_ep_cfg;
IPA_MHI_DBG("client %d (ep: %d) connected\n", in->sys.client,
@ -1328,7 +1328,7 @@ fail_enable_dp:
fail_init_channel:
memset(ep, 0, offsetof(struct ipa_ep_context, sys));
fail_ep_exists:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(in->sys.client);
return -EPERM;
}
@ -1379,7 +1379,7 @@ int ipa2_mhi_disconnect_pipe(u32 clnt_hdl)
ep = &ipa_ctx->ep[clnt_hdl];
if (!ep->keep_ipa_awake)
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
res = ipa_mhi_reset_channel(channel);
if (res) {
@ -1390,7 +1390,7 @@ int ipa2_mhi_disconnect_pipe(u32 clnt_hdl)
ep->valid = 0;
ipa_delete_dflt_flt_rules(clnt_hdl);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
IPA_MHI_DBG("client (ep: %d) disconnected\n", clnt_hdl);
IPA_MHI_FUNC_EXIT();
@ -1398,7 +1398,7 @@ int ipa2_mhi_disconnect_pipe(u32 clnt_hdl)
fail_reset_channel:
if (!ep->keep_ipa_awake)
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return res;
}
@ -1653,7 +1653,7 @@ int ipa2_mhi_suspend(bool force)
* IPA RM resource are released to make sure tag process will not start
*/
if (!bam_empty)
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
IPA_MHI_DBG("release prod\n");
res = ipa_mhi_release_prod();
@ -1696,7 +1696,7 @@ int ipa2_mhi_suspend(bool force)
if (!bam_empty) {
ipa_ctx->tag_process_before_gating = false;
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
}
res = ipa_mhi_set_state(IPA_MHI_STATE_SUSPENDED);

View file

@ -705,14 +705,16 @@ static void ipa_rm_wq_resume_handler(struct work_struct *work)
IPA_RM_ERR("resource is not CONS\n");
return;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_RESOURCE(ipa_rm_resource_str(
ipa_rm_work->resource_name));
spin_lock_irqsave(&ipa_rm_ctx->ipa_rm_lock, flags);
if (ipa_rm_dep_graph_get_resource(ipa_rm_ctx->dep_graph,
ipa_rm_work->resource_name,
&resource) != 0){
IPA_RM_ERR("resource does not exists\n");
spin_unlock_irqrestore(&ipa_rm_ctx->ipa_rm_lock, flags);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_RESOURCE(ipa_rm_resource_str(
ipa_rm_work->resource_name));
goto bail;
}
ipa_rm_resource_consumer_request_work(

View file

@ -147,6 +147,7 @@ int ipa_rm_resource_consumer_request(
{
int result = 0;
enum ipa_rm_resource_state prev_state;
struct ipa2_active_client_logging_info log_info;
IPA_RM_DBG("%s state: %d\n",
ipa_rm_resource_str(consumer->resource.name),
@ -159,8 +160,10 @@ int ipa_rm_resource_consumer_request(
case IPA_RM_RELEASE_IN_PROGRESS:
reinit_completion(&consumer->request_consumer_in_progress);
consumer->resource.state = IPA_RM_REQUEST_IN_PROGRESS;
IPA2_ACTIVE_CLIENTS_PREP_RESOURCE(log_info,
ipa_rm_resource_str(consumer->resource.name));
if (prev_state == IPA_RM_RELEASE_IN_PROGRESS ||
ipa_inc_client_enable_clks_no_block() != 0) {
ipa2_inc_client_enable_clks_no_block(&log_info) != 0) {
IPA_RM_DBG("async resume work for %s\n",
ipa_rm_resource_str(consumer->resource.name));
ipa_rm_wq_send_resume_cmd(consumer->resource.name,

View file

@ -326,7 +326,7 @@ static void ipa_uc_event_handler(enum ipa_irq_type interrupt,
WARN_ON(private_data != ipa_ctx);
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
IPADBG("uC evt opcode=%u\n",
ipa_ctx->uc_ctx.uc_sram_mmio->eventOp);
@ -337,7 +337,7 @@ static void ipa_uc_event_handler(enum ipa_irq_type interrupt,
if (0 > feature || IPA_HW_FEATURE_MAX <= feature) {
IPAERR("Invalid feature %u for event %u\n",
feature, ipa_ctx->uc_ctx.uc_sram_mmio->eventOp);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return;
}
/* Feature specific handling */
@ -367,7 +367,7 @@ static void ipa_uc_event_handler(enum ipa_irq_type interrupt,
IPADBG("unsupported uC evt opcode=%u\n",
ipa_ctx->uc_ctx.uc_sram_mmio->eventOp);
}
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
}
@ -375,14 +375,15 @@ static int ipa_uc_panic_notifier(struct notifier_block *this,
unsigned long event, void *ptr)
{
int result = 0;
struct ipa2_active_client_logging_info log_info;
IPADBG("this=%p evt=%lu ptr=%p\n", this, event, ptr);
result = ipa_uc_state_check();
if (result)
goto fail;
if (ipa_inc_client_enable_clks_no_block())
IPA2_ACTIVE_CLIENTS_PREP_SIMPLE(log_info);
if (ipa2_inc_client_enable_clks_no_block(&log_info))
goto fail;
ipa_ctx->uc_ctx.uc_sram_mmio->cmdOp =
@ -393,7 +394,7 @@ static int ipa_uc_panic_notifier(struct notifier_block *this,
/* give uc enough time to save state */
udelay(IPA_PKT_FLUSH_TO_US);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
IPADBG("err_fatal issued\n");
fail:
@ -421,7 +422,7 @@ static void ipa_uc_response_hdlr(enum ipa_irq_type interrupt,
WARN_ON(private_data != ipa_ctx);
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
IPADBG("uC rsp opcode=%u\n",
ipa_ctx->uc_ctx.uc_sram_mmio->responseOp);
@ -430,7 +431,7 @@ static void ipa_uc_response_hdlr(enum ipa_irq_type interrupt,
if (0 > feature || IPA_HW_FEATURE_MAX <= feature) {
IPAERR("Invalid feature %u for event %u\n",
feature, ipa_ctx->uc_ctx.uc_sram_mmio->eventOp);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return;
}
@ -443,7 +444,7 @@ static void ipa_uc_response_hdlr(enum ipa_irq_type interrupt,
IPADBG("feature %d specific response handler\n",
feature);
complete_all(&ipa_ctx->uc_ctx.uc_completion);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return;
}
}
@ -483,7 +484,7 @@ static void ipa_uc_response_hdlr(enum ipa_irq_type interrupt,
IPAERR("Unsupported uC rsp opcode = %u\n",
ipa_ctx->uc_ctx.uc_sram_mmio->responseOp);
}
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
}
/**

View file

@ -614,7 +614,7 @@ int ipa_uc_mhi_init_engine(struct ipa_mhi_msi_info *msi, u32 mmio_addr,
return -EFAULT;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
res = ipa_uc_update_hw_flags(0);
if (res) {
@ -677,7 +677,7 @@ int ipa_uc_mhi_init_engine(struct ipa_mhi_msi_info *msi, u32 mmio_addr,
res = 0;
disable_clks:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return res;
}
@ -700,7 +700,7 @@ int ipa_uc_mhi_init_channel(int ipa_ep_idx, int channelHandle,
return -EINVAL;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
memset(&uc_rsp, 0, sizeof(uc_rsp));
uc_rsp.params.state = IPA_HW_MHI_CHANNEL_STATE_RUN;
@ -725,7 +725,7 @@ int ipa_uc_mhi_init_channel(int ipa_ep_idx, int channelHandle,
res = 0;
disable_clks:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return res;
}
@ -741,7 +741,7 @@ int ipa_uc_mhi_reset_channel(int channelHandle)
return -EFAULT;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
memset(&uc_rsp, 0, sizeof(uc_rsp));
uc_rsp.params.state = IPA_HW_MHI_CHANNEL_STATE_DISABLE;
@ -763,7 +763,7 @@ int ipa_uc_mhi_reset_channel(int channelHandle)
res = 0;
disable_clks:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return res;
}
@ -778,7 +778,7 @@ int ipa_uc_mhi_suspend_channel(int channelHandle)
return -EFAULT;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
memset(&uc_rsp, 0, sizeof(uc_rsp));
uc_rsp.params.state = IPA_HW_MHI_CHANNEL_STATE_SUSPEND;
@ -800,7 +800,7 @@ int ipa_uc_mhi_suspend_channel(int channelHandle)
res = 0;
disable_clks:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return res;
}
@ -815,7 +815,7 @@ int ipa_uc_mhi_resume_channel(int channelHandle, bool LPTransitionRejected)
return -EFAULT;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
memset(&uc_rsp, 0, sizeof(uc_rsp));
uc_rsp.params.state = IPA_HW_MHI_CHANNEL_STATE_RUN;
@ -838,7 +838,7 @@ int ipa_uc_mhi_resume_channel(int channelHandle, bool LPTransitionRejected)
res = 0;
disable_clks:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return res;
}
@ -852,7 +852,7 @@ int ipa_uc_mhi_stop_event_update_channel(int channelHandle)
return -EFAULT;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
memset(&cmd, 0, sizeof(cmd));
cmd.params.channelHandle = channelHandle;
@ -870,7 +870,7 @@ int ipa_uc_mhi_stop_event_update_channel(int channelHandle)
res = 0;
disable_clks:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return res;
}
@ -888,7 +888,7 @@ int ipa_uc_mhi_send_dl_ul_sync_info(union IpaHwMhiDlUlSyncCmdData_t cmd)
IPADBG("ulMsiEventThreshold=0x%x dlMsiEventThreshold=0x%x\n",
cmd.params.ulMsiEventThreshold, cmd.params.dlMsiEventThreshold);
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
res = ipa_uc_send_cmd(cmd.raw32b,
IPA_CPU_2_HW_CMD_MHI_DL_UL_SYNC_INFO, 0, false, HZ);
@ -899,7 +899,7 @@ int ipa_uc_mhi_send_dl_ul_sync_info(union IpaHwMhiDlUlSyncCmdData_t cmd)
res = 0;
disable_clks:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return res;
}

View file

@ -407,7 +407,7 @@ int ipa2_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats)
return -EINVAL;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
TX_STATS(num_pkts_processed);
TX_STATS(copy_engine_doorbell_value);
@ -449,7 +449,7 @@ int ipa2_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats)
RX_STATS(reserved1);
RX_STATS(reserved2);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return 0;
}
@ -747,7 +747,7 @@ int ipa2_connect_wdi_pipe(struct ipa_wdi_in_params *in,
}
memset(&ipa_ctx->ep[ipa_ep_idx], 0, sizeof(struct ipa_ep_context));
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(in->sys.client);
IPADBG("client=%d ep=%d\n", in->sys.client, ipa_ep_idx);
if (IPA_CLIENT_IS_CONS(in->sys.client)) {
@ -951,7 +951,7 @@ int ipa2_connect_wdi_pipe(struct ipa_wdi_in_params *in,
ipa_install_dflt_flt_rules(ipa_ep_idx);
if (!ep->keep_ipa_awake)
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(in->sys.client);
dma_free_coherent(ipa_ctx->uc_pdev, cmd.size, cmd.base, cmd.phys_base);
ep->wdi_state |= IPA_WDI_CONNECTED;
@ -965,7 +965,7 @@ uc_timeout:
ipa_release_uc_smmu_mappings(in->sys.client);
dma_free_coherent(ipa_ctx->uc_pdev, cmd.size, cmd.base, cmd.phys_base);
dma_alloc_fail:
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(in->sys.client);
fail:
return result;
}
@ -1010,7 +1010,7 @@ int ipa2_disconnect_wdi_pipe(u32 clnt_hdl)
}
if (!ep->keep_ipa_awake)
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
tear.params.ipa_pipe_number = clnt_hdl;
@ -1028,7 +1028,7 @@ int ipa2_disconnect_wdi_pipe(u32 clnt_hdl)
ipa_release_uc_smmu_mappings(ep->client);
memset(&ipa_ctx->ep[clnt_hdl], 0, sizeof(struct ipa_ep_context));
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
IPADBG("client (ep: %d) disconnected\n", clnt_hdl);
@ -1075,7 +1075,7 @@ int ipa2_enable_wdi_pipe(u32 clnt_hdl)
return -EFAULT;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
enable.params.ipa_pipe_number = clnt_hdl;
result = ipa_uc_send_cmd(enable.raw32b,
@ -1095,7 +1095,7 @@ int ipa2_enable_wdi_pipe(u32 clnt_hdl)
result = ipa2_cfg_ep_holb(clnt_hdl, &holb_cfg);
}
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
ep->wdi_state |= IPA_WDI_ENABLED;
IPADBG("client (ep: %d) enabled\n", clnt_hdl);
@ -1143,7 +1143,7 @@ int ipa2_disable_wdi_pipe(u32 clnt_hdl)
return -EFAULT;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
result = ipa_disable_data_path(clnt_hdl);
if (result) {
@ -1196,7 +1196,7 @@ int ipa2_disable_wdi_pipe(u32 clnt_hdl)
ipa2_cfg_ep_ctrl(clnt_hdl, &ep_cfg_ctrl);
}
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
ep->wdi_state &= ~IPA_WDI_ENABLED;
IPADBG("client (ep: %d) disabled\n", clnt_hdl);
@ -1243,7 +1243,7 @@ int ipa2_resume_wdi_pipe(u32 clnt_hdl)
return -EFAULT;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
resume.params.ipa_pipe_number = clnt_hdl;
result = ipa_uc_send_cmd(resume.raw32b,
@ -1359,7 +1359,7 @@ int ipa2_suspend_wdi_pipe(u32 clnt_hdl)
}
ipa_ctx->tag_process_before_gating = true;
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
ep->wdi_state &= ~IPA_WDI_RESUMED;
IPADBG("client (ep: %d) suspended\n", clnt_hdl);
@ -1392,7 +1392,7 @@ int ipa_write_qmapid_wdi_pipe(u32 clnt_hdl, u8 qmap_id)
return -EFAULT;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
qmap.params.ipa_pipe_number = clnt_hdl;
qmap.params.qmap_id = qmap_id;
@ -1406,7 +1406,7 @@ int ipa_write_qmapid_wdi_pipe(u32 clnt_hdl, u8 qmap_id)
goto uc_timeout;
}
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
IPADBG("client (ep: %d) qmap_id %d updated\n", clnt_hdl, qmap_id);

View file

@ -546,7 +546,7 @@ int ipa_suspend_resource_sync(enum ipa_rm_resource_name resource)
/* before gating IPA clocks do TAG process */
ipa_ctx->tag_process_before_gating = true;
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_RESOURCE(ipa_rm_resource_str(resource));
return 0;
}
@ -817,11 +817,11 @@ int ipa_cfg_route(struct ipa_route *route)
route->route_def_hdr_ofst,
route->route_frag_def_pipe);
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
ipa_ctx->ctrl->ipa_cfg_route(route);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return 0;
}
@ -837,12 +837,12 @@ int ipa_cfg_filter(u32 disable)
{
u32 ipa_filter_ofst = IPA_FILTER_OFST_v1_1;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
ipa_write_reg(ipa_ctx->mmio, ipa_filter_ofst,
IPA_SETFIELD(!disable,
IPA_FILTER_FILTER_EN_SHFT,
IPA_FILTER_FILTER_EN_BMSK));
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return 0;
}
@ -2492,11 +2492,11 @@ int ipa2_cfg_ep_nat(u32 clnt_hdl, const struct ipa_ep_cfg_nat *ep_nat)
/* copy over EP cfg */
ipa_ctx->ep[clnt_hdl].cfg.nat = *ep_nat;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_nat(clnt_hdl, ep_nat);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -2552,11 +2552,11 @@ int ipa2_cfg_ep_status(u32 clnt_hdl, const struct ipa_ep_cfg_status *ep_status)
/* copy over EP cfg */
ipa_ctx->ep[clnt_hdl].status = *ep_status;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_status(clnt_hdl, ep_status);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -2614,11 +2614,11 @@ int ipa2_cfg_ep_cfg(u32 clnt_hdl, const struct ipa_ep_cfg_cfg *cfg)
/* copy over EP cfg */
ipa_ctx->ep[clnt_hdl].cfg.cfg = *cfg;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_cfg(clnt_hdl, cfg);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -2670,11 +2670,11 @@ int ipa2_cfg_ep_metadata_mask(u32 clnt_hdl,
/* copy over EP cfg */
ipa_ctx->ep[clnt_hdl].cfg.metadata_mask = *metadata_mask;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_metadata_mask(clnt_hdl, metadata_mask);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -2793,11 +2793,11 @@ int ipa2_cfg_ep_hdr(u32 clnt_hdl, const struct ipa_ep_cfg_hdr *ep_hdr)
/* copy over EP cfg */
ep->cfg.hdr = *ep_hdr;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_hdr(clnt_hdl, &ep->cfg.hdr);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -2919,11 +2919,11 @@ int ipa2_cfg_ep_hdr_ext(u32 clnt_hdl,
/* copy over EP cfg */
ep->cfg.hdr_ext = *ep_hdr_ext;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_hdr_ext(clnt_hdl, &ep->cfg.hdr_ext);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -3134,13 +3134,13 @@ int ipa2_cfg_ep_mode(u32 clnt_hdl, const struct ipa_ep_cfg_mode *ep_mode)
ipa_ctx->ep[clnt_hdl].cfg.mode = *ep_mode;
ipa_ctx->ep[clnt_hdl].dst_pipe_index = ep;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_mode(clnt_hdl,
ipa_ctx->ep[clnt_hdl].dst_pipe_index,
ep_mode);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -3262,11 +3262,11 @@ int ipa2_cfg_ep_aggr(u32 clnt_hdl, const struct ipa_ep_cfg_aggr *ep_aggr)
/* copy over EP cfg */
ipa_ctx->ep[clnt_hdl].cfg.aggr = *ep_aggr;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_aggr(clnt_hdl, ep_aggr);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -3345,12 +3345,12 @@ int ipa2_cfg_ep_route(u32 clnt_hdl, const struct ipa_ep_cfg_route *ep_route)
else
ipa_ctx->ep[clnt_hdl].rt_tbl_idx = 0;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_route(clnt_hdl,
ipa_ctx->ep[clnt_hdl].rt_tbl_idx);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -3439,11 +3439,11 @@ int ipa2_cfg_ep_holb(u32 clnt_hdl, const struct ipa_ep_cfg_holb *ep_holb)
ipa_ctx->ep[clnt_hdl].holb = *ep_holb;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_holb(clnt_hdl, ep_holb);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
IPADBG("cfg holb %u ep=%d tmr=%d\n", ep_holb->en, clnt_hdl,
ep_holb->tmr_val);
@ -3540,11 +3540,11 @@ int ipa2_cfg_ep_deaggr(u32 clnt_hdl,
/* copy over EP cfg */
ep->cfg.deaggr = *ep_deaggr;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_deaggr(clnt_hdl, &ep->cfg.deaggr);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -3592,13 +3592,13 @@ int ipa2_cfg_ep_metadata(u32 clnt_hdl, const struct ipa_ep_cfg_metadata *ep_md)
/* copy over EP cfg */
ipa_ctx->ep[clnt_hdl].cfg.meta = *ep_md;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_EP(ipa2_get_client_mapping(clnt_hdl));
ipa_ctx->ctrl->ipa_cfg_ep_metadata(clnt_hdl, ep_md);
ipa_ctx->ep[clnt_hdl].cfg.hdr.hdr_metadata_reg_valid = 1;
ipa_ctx->ctrl->ipa_cfg_ep_hdr(clnt_hdl, &ipa_ctx->ep[clnt_hdl].cfg.hdr);
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_EP(ipa2_get_client_mapping(clnt_hdl));
return 0;
}
@ -3780,11 +3780,11 @@ int ipa2_set_aggr_mode(enum ipa_aggr_mode mode)
{
u32 reg_val;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
reg_val = ipa_read_reg(ipa_ctx->mmio, IPA_QCNCM_OFST);
ipa_write_reg(ipa_ctx->mmio, IPA_QCNCM_OFST, (mode & 0x1) |
(reg_val & 0xfffffffe));
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return 0;
}
@ -3808,12 +3808,12 @@ int ipa2_set_qcncm_ndp_sig(char sig[3])
IPAERR("bad argument for ipa_set_qcncm_ndp_sig/n");
return -EINVAL;
}
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
reg_val = ipa_read_reg(ipa_ctx->mmio, IPA_QCNCM_OFST);
ipa_write_reg(ipa_ctx->mmio, IPA_QCNCM_OFST, sig[0] << 20 |
(sig[1] << 12) | (sig[2] << 4) |
(reg_val & 0xf000000f));
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return 0;
}
@ -3829,11 +3829,11 @@ int ipa2_set_single_ndp_per_mbim(bool enable)
{
u32 reg_val;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
reg_val = ipa_read_reg(ipa_ctx->mmio, IPA_SINGLE_NDP_MODE_OFST);
ipa_write_reg(ipa_ctx->mmio, IPA_SINGLE_NDP_MODE_OFST,
(enable & 0x1) | (reg_val & 0xfffffffe));
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return 0;
}
@ -3849,12 +3849,12 @@ int ipa_set_hw_timer_fix_for_mbim_aggr(bool enable)
{
u32 reg_val;
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
reg_val = ipa_read_reg(ipa_ctx->mmio, IPA_AGGREGATION_SPARE_REG_1_OFST);
ipa_write_reg(ipa_ctx->mmio, IPA_AGGREGATION_SPARE_REG_1_OFST,
(enable << IPA_AGGREGATION_HW_TIMER_FIX_MBIM_AGGR_SHFT) |
(reg_val & ~IPA_AGGREGATION_HW_TIMER_FIX_MBIM_AGGR_BMSK));
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
return 0;
}
EXPORT_SYMBOL(ipa_set_hw_timer_fix_for_mbim_aggr);
@ -3897,7 +3897,7 @@ void ipa2_bam_reg_dump(void)
{
static DEFINE_RATELIMIT_STATE(_rs, 500*HZ, 1);
if (__ratelimit(&_rs)) {
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SIMPLE();
pr_err("IPA BAM START\n");
if (ipa_ctx->ipa_hw_type < IPA_HW_v2_0) {
sps_get_bam_debug_info(ipa_ctx->bam_handle, 5,
@ -3911,7 +3911,7 @@ void ipa2_bam_reg_dump(void)
SPS_BAM_PIPE(ipa_get_ep_mapping(IPA_CLIENT_USB_PROD))),
0, 2);
}
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SIMPLE();
}
}
@ -4813,7 +4813,7 @@ bool ipa2_is_client_handle_valid(u32 clnt_hdl)
void ipa2_proxy_clk_unvote(void)
{
if (ipa2_is_ready() && ipa_ctx->q6_proxy_clk_vote_valid) {
ipa_dec_client_disable_clks();
IPA2_ACTIVE_CLIENTS_DEC_SPECIAL("PROXY_CLK_VOTE");
ipa_ctx->q6_proxy_clk_vote_valid = false;
}
}
@ -4826,7 +4826,7 @@ void ipa2_proxy_clk_unvote(void)
void ipa2_proxy_clk_vote(void)
{
if (ipa2_is_ready() && !ipa_ctx->q6_proxy_clk_vote_valid) {
ipa_inc_client_enable_clks();
IPA2_ACTIVE_CLIENTS_INC_SPECIAL("PROXY_CLK_VOTE");
ipa_ctx->q6_proxy_clk_vote_valid = true;
}
}