Merge "msm_mmrm: Added debug support for multiple register calls of same client"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

當前提交
21bc3dcd43
@@ -58,6 +58,7 @@ struct mmrm_sw_clk_client_tbl_entry {
|
||||
u64 clk_rate;
|
||||
u32 vdd_level;
|
||||
bool reserve;
|
||||
u32 ref_count;
|
||||
};
|
||||
|
||||
struct mmrm_sw_peak_current_data {
|
||||
|
@@ -188,6 +188,14 @@ static struct mmrm_client *mmrm_sw_clk_client_register(
|
||||
|
||||
/* entry already registered */
|
||||
if (tbl_entry->client) {
|
||||
if (msm_mmrm_allow_multiple_register) {
|
||||
tbl_entry->ref_count++;
|
||||
d_mpr_h("%s: client csid(%d) already registered ref:%d\n",
|
||||
__func__, tbl_entry->clk_src_id, tbl_entry->ref_count);
|
||||
clk_client = tbl_entry->client;
|
||||
goto exit_found;
|
||||
}
|
||||
|
||||
d_mpr_e("%s: client csid(%d) already registered\n",
|
||||
__func__, tbl_entry->clk_src_id);
|
||||
rc = -EINVAL;
|
||||
@@ -205,6 +213,7 @@ static struct mmrm_client *mmrm_sw_clk_client_register(
|
||||
|
||||
clk_client->client_uid = c;
|
||||
clk_client->client_type = MMRM_CLIENT_CLOCK;
|
||||
tbl_entry->ref_count = 1;
|
||||
|
||||
/* copy the entries provided by client */
|
||||
tbl_entry->client = clk_client;
|
||||
@@ -239,15 +248,20 @@ static struct mmrm_client *mmrm_sw_clk_client_register(
|
||||
goto err_fail_update_entry;
|
||||
}
|
||||
|
||||
exit_found:
|
||||
mutex_unlock(&sw_clk_mgr->lock);
|
||||
|
||||
d_mpr_h("%s: exiting with success\n", __func__);
|
||||
return clk_client;
|
||||
|
||||
err_fail_update_entry:
|
||||
kfree(clk_client);
|
||||
|
||||
err_fail_alloc_clk_client:
|
||||
err_already_registered:
|
||||
memset(tbl_entry, 0x0, sizeof(struct mmrm_sw_clk_client_tbl_entry));
|
||||
|
||||
err_nofree_entry:
|
||||
err_already_registered:
|
||||
mutex_unlock(&sw_clk_mgr->lock);
|
||||
|
||||
d_mpr_h("%s: error exit\n", __func__);
|
||||
@@ -280,12 +294,16 @@ static int mmrm_sw_clk_client_deregister(struct mmrm_clk_mgr *sw_clk_mgr,
|
||||
mutex_lock(&sw_clk_mgr->lock);
|
||||
|
||||
tbl_entry = &sinfo->clk_client_tbl[client->client_uid];
|
||||
kfree(tbl_entry->client);
|
||||
tbl_entry->client = NULL;
|
||||
tbl_entry->clk = NULL;
|
||||
tbl_entry->pri = 0x0;
|
||||
tbl_entry->pvt_data = NULL;
|
||||
tbl_entry->notifier_cb_fn = NULL;
|
||||
if (tbl_entry->ref_count > 0) {
|
||||
tbl_entry->ref_count--;
|
||||
}
|
||||
|
||||
if (tbl_entry->ref_count == 0) {
|
||||
|
||||
kfree(tbl_entry->client);
|
||||
|
||||
memset(tbl_entry, 0x0, sizeof(struct mmrm_sw_clk_client_tbl_entry));
|
||||
}
|
||||
|
||||
mutex_unlock(&sw_clk_mgr->lock);
|
||||
|
||||
@@ -319,7 +337,7 @@ static int mmrm_sw_get_req_level(
|
||||
|
||||
/* voltage corner is below svsl1 */
|
||||
if (voltage_corner < mmrm_sw_vdd_corner[MMRM_VDD_LEVEL_SVS_L1]) {
|
||||
d_mpr_w("%s: csid(%d): lower voltage corner(%d)\n",
|
||||
d_mpr_h("%s: csid(%d): lower voltage corner(%d)\n",
|
||||
__func__,
|
||||
tbl_entry->clk_src_id,
|
||||
voltage_corner);
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include "mmrm_debug.h"
|
||||
|
||||
int msm_mmrm_debug = MMRM_ERR | MMRM_WARN | MMRM_PRINTK;
|
||||
u8 msm_mmrm_allow_multiple_register = 0;
|
||||
|
||||
#define MAX_DBG_BUF_SIZE 4096
|
||||
|
||||
@@ -59,6 +60,7 @@ struct dentry *msm_mmrm_debugfs_init(void)
|
||||
|
||||
/* add other params here */
|
||||
debugfs_create_u32("debug_level", 0644, dir, &msm_mmrm_debug);
|
||||
debugfs_create_u8("allow_multiple_register", 0644, dir, &msm_mmrm_allow_multiple_register);
|
||||
|
||||
d_mpr_h("%s: exiting\n", __func__);
|
||||
return dir;
|
||||
|
@@ -28,6 +28,7 @@ enum mmrm_msg_prio {
|
||||
};
|
||||
|
||||
extern int msm_mmrm_debug;
|
||||
extern u8 msm_mmrm_allow_multiple_register;
|
||||
|
||||
#define dprintk(__level, __fmt, ...) \
|
||||
do { \
|
||||
|
Reference in New Issue
Block a user