mmrm: Resolve for invalid voltage corner values
- When qcom_clk_get_voltage encounters an error, return the error. - When qcom_clk_get_voltage returns a level higher than supported, return an error. - Added warning debug level. - Minor formatting changes. Change-Id: I6d7147f6af83bff2d84ef40c3a11cfef7faca391
This commit is contained in:
@@ -164,12 +164,23 @@ static int mmrm_sw_get_req_level(
|
||||
|
||||
/* get voltage corner */
|
||||
voltage_corner = qcom_clk_get_voltage(tbl_entry->clk, clk_val);
|
||||
if (voltage_corner < 0 || voltage_corner > mmrm_sw_vdd_corner[MMRM_VDD_LEVEL_TURBO]) {
|
||||
d_mpr_e("%s: csid(%d): invalid voltage corner(%d) for clk rate(%llu)\n",
|
||||
__func__,
|
||||
tbl_entry->clk_src_id,
|
||||
voltage_corner,
|
||||
clk_val);
|
||||
rc = voltage_corner;
|
||||
goto err_invalid_corner;
|
||||
}
|
||||
|
||||
/* voltage corner is below svsl1 */
|
||||
if (voltage_corner < mmrm_sw_vdd_corner[MMRM_VDD_LEVEL_SVS_L1]) {
|
||||
/* TBD: remove this when scaling calculations are added */
|
||||
d_mpr_e("%s: csid(%d): lower voltage corner(%d)\n",
|
||||
__func__, tbl_entry->clk_src_id, voltage_corner);
|
||||
d_mpr_w("%s: csid(%d): lower voltage corner(%d)\n",
|
||||
__func__,
|
||||
tbl_entry->clk_src_id,
|
||||
voltage_corner);
|
||||
*req_level = MMRM_VDD_LEVEL_SVS_L1;
|
||||
goto exit_no_err;
|
||||
}
|
||||
@@ -182,7 +193,10 @@ static int mmrm_sw_get_req_level(
|
||||
|
||||
if (level == MMRM_VDD_LEVEL_MAX) {
|
||||
d_mpr_e("%s: csid(%d): invalid voltage corner(%d) for clk rate(%llu)\n",
|
||||
__func__, tbl_entry->clk_src_id, voltage_corner, clk_val);
|
||||
__func__,
|
||||
tbl_entry->clk_src_id,
|
||||
voltage_corner,
|
||||
clk_val);
|
||||
rc = -EINVAL;
|
||||
goto err_invalid_corner;
|
||||
}
|
||||
|
@@ -7,21 +7,18 @@
|
||||
|
||||
#include "mmrm_debug.h"
|
||||
|
||||
int msm_mmrm_debug = MMRM_ERR | MMRM_PRINTK;
|
||||
int msm_mmrm_debug = MMRM_ERR | MMRM_WARN | MMRM_PRINTK;
|
||||
|
||||
#define MAX_DBG_BUF_SIZE 4096
|
||||
|
||||
static ssize_t msm_mmrm_debugfs_info_read(struct file *file,
|
||||
char __user *buf,
|
||||
size_t count,
|
||||
loff_t *ppos)
|
||||
static ssize_t msm_mmrm_debugfs_info_read(
|
||||
struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
char *dbuf, *cur, *end;
|
||||
ssize_t len = 0;
|
||||
|
||||
dbuf = kzalloc(MAX_DBG_BUF_SIZE, GFP_KERNEL);
|
||||
if (!dbuf)
|
||||
{
|
||||
if (!dbuf) {
|
||||
d_mpr_e("%s: Allocation failed!\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
@@ -50,32 +47,32 @@ struct dentry *msm_mmrm_debugfs_init(void)
|
||||
|
||||
/* create a directory in debugfs root (/sys/kernel/debug) */
|
||||
dir = debugfs_create_dir("msm_mmrm", NULL);
|
||||
if (IS_ERR_OR_NULL(dir))
|
||||
{
|
||||
if (IS_ERR_OR_NULL(dir)) {
|
||||
d_mpr_e("%s: Call to debugfs_create_dir(%s) failed!\n", __func__, "mmrm");
|
||||
goto failed_create_dir;
|
||||
}
|
||||
|
||||
/* basic info */
|
||||
if (!debugfs_create_file("info", 0444, dir, &file_val, &msm_mmrm_debugfs_info_fops))
|
||||
{
|
||||
if (!debugfs_create_file("info", 0444, dir, &file_val, &msm_mmrm_debugfs_info_fops)) {
|
||||
d_mpr_e("%s: Call to debugfs_create_file(%s) failed!\n", __func__, "info");
|
||||
goto failed_create_dir;
|
||||
}
|
||||
|
||||
#define __debugfs_create(__type, __name, __value) ({ \
|
||||
#define __debugfs_create(__type, __name, __value) \
|
||||
({ \
|
||||
struct dentry *f = debugfs_create_##__type(__name, 0644, dir, __value); \
|
||||
if (IS_ERR_OR_NULL(f)) { \
|
||||
d_mpr_e("%s: Failed creating debugfs file '%pd/%s'\n", \
|
||||
__func__, dir, __name); \
|
||||
__func__, \
|
||||
dir, \
|
||||
__name); \
|
||||
f = NULL; \
|
||||
} \
|
||||
f; \
|
||||
})
|
||||
})
|
||||
|
||||
/* add other params here */
|
||||
ok =
|
||||
__debugfs_create(u32, "debug_level", &msm_mmrm_debug);
|
||||
ok = __debugfs_create(u32, "debug_level", &msm_mmrm_debug);
|
||||
|
||||
#undef __debugfs_create
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include <linux/printk.h>
|
||||
|
||||
#ifndef MMRM_DBG_LABEL
|
||||
#define MMRM_DBG_LABEL "msm_mmrm: "
|
||||
#define MMRM_DBG_LABEL "msm_mmrm"
|
||||
#endif
|
||||
|
||||
#define MMRM_DBG_TAG MMRM_DBG_LABEL ": %4s: "
|
||||
@@ -18,11 +18,11 @@
|
||||
/* To enable messages OR these values and
|
||||
* echo the result to debugfs file.
|
||||
*/
|
||||
enum mmrm_msg_prio
|
||||
{
|
||||
enum mmrm_msg_prio {
|
||||
MMRM_ERR = 0x000001,
|
||||
MMRM_HIGH = 0x000002,
|
||||
MMRM_LOW = 0x000004,
|
||||
MMRM_WARN = 0x000008,
|
||||
MMRM_PRINTK = 0x010000,
|
||||
MMRM_FTRACE = 0x020000,
|
||||
};
|
||||
@@ -30,14 +30,12 @@ enum mmrm_msg_prio
|
||||
extern int msm_mmrm_debug;
|
||||
|
||||
#define dprintk(__level, __fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
if (msm_mmrm_debug & __level) \
|
||||
{ \
|
||||
if (msm_mmrm_debug & MMRM_PRINTK) \
|
||||
{ \
|
||||
do { \
|
||||
if (msm_mmrm_debug & __level) { \
|
||||
if (msm_mmrm_debug & MMRM_PRINTK) { \
|
||||
pr_info(MMRM_DBG_TAG __fmt, \
|
||||
get_debug_level_str(__level), ##__VA_ARGS__); \
|
||||
get_debug_level_str(__level), \
|
||||
##__VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -45,17 +43,19 @@ extern int msm_mmrm_debug;
|
||||
#define d_mpr_e(__fmt, ...) dprintk(MMRM_ERR, __fmt, ##__VA_ARGS__)
|
||||
#define d_mpr_h(__fmt, ...) dprintk(MMRM_HIGH, __fmt, ##__VA_ARGS__)
|
||||
#define d_mpr_l(__fmt, ...) dprintk(MMRM_LOW, __fmt, ##__VA_ARGS__)
|
||||
#define d_mpr_w(__fmt, ...) dprintk(MMRM_WARN, __fmt, ##__VA_ARGS__)
|
||||
|
||||
static inline char *get_debug_level_str(int level)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
switch (level) {
|
||||
case MMRM_ERR:
|
||||
return "err ";
|
||||
case MMRM_HIGH:
|
||||
return "high";
|
||||
case MMRM_LOW:
|
||||
return "low ";
|
||||
case MMRM_WARN:
|
||||
return "warn";
|
||||
default:
|
||||
return "????";
|
||||
}
|
||||
|
@@ -34,13 +34,16 @@ static int mmrm_read_clk_pltfrm_rsrc_frm_drv_data(
|
||||
|
||||
pdata = ddata->platform_data;
|
||||
cres = &ddata->clk_res;
|
||||
|
||||
cres->threshold = mmrm_find_key_value(pdata,
|
||||
"qcom,mmrm_clk_threshold");
|
||||
d_mpr_e("%s: configured mmrm clk threshold %d\n",
|
||||
__func__, cres->threshold);
|
||||
|
||||
cres->scheme = mmrm_find_key_value(pdata,
|
||||
"qcom,mmrm clk mgr scheme");
|
||||
"qcom,mmrm_clk_mgr_scheme");
|
||||
d_mpr_e("%s: configured mmrm scheme %d\n",
|
||||
__func__, cres->scheme);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user