msm-mmrm: add max num hw block into device tree file
Add max num hw block into device tree file. Change-Id: I9d57cf6cdd962bc470214c0cb93df09981f106bb Signed-off-by: mbao <mbao@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
4758d42c05
commit
61d63855a0
@@ -51,6 +51,7 @@ struct mmrm_sw_clk_client_tbl_entry {
|
|||||||
bool pass_through;
|
bool pass_through;
|
||||||
u32 min_level;
|
u32 min_level;
|
||||||
u32 max_level;
|
u32 max_level;
|
||||||
|
u32 max_num_hw_blocks;
|
||||||
u64 freq[MMRM_VDD_LEVEL_MAX];
|
u64 freq[MMRM_VDD_LEVEL_MAX];
|
||||||
u32 dyn_pwr[MMRM_VDD_LEVEL_MAX];
|
u32 dyn_pwr[MMRM_VDD_LEVEL_MAX];
|
||||||
u32 leak_pwr[MMRM_VDD_LEVEL_MAX];
|
u32 leak_pwr[MMRM_VDD_LEVEL_MAX];
|
||||||
|
@@ -788,32 +788,6 @@ err_peak_overshoot:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool mmrm_sw_is_valid_num_hw_block(struct mmrm_sw_clk_client_tbl_entry *tbl_entry,
|
|
||||||
struct mmrm_client_data *client_data)
|
|
||||||
{
|
|
||||||
bool rc = false;
|
|
||||||
u32 num_hw_blocks = client_data->num_hw_blocks;
|
|
||||||
|
|
||||||
if (num_hw_blocks == 1) {
|
|
||||||
rc = true;
|
|
||||||
} else if (tbl_entry->clk_src_id == 0x10025) { // CAM_CC_IFE_CSID_CLK_SRC
|
|
||||||
if (num_hw_blocks > 1 && num_hw_blocks <= 3)
|
|
||||||
rc = true;
|
|
||||||
} else if ((tbl_entry->clk_src_id == 0x10040) || // CAM_CC_IFE_LITE_CLK_SRC
|
|
||||||
(tbl_entry->clk_src_id == 0x10043)) { // CAM_CC_IFE_LITE_CSID_CLK_SRC
|
|
||||||
if (num_hw_blocks > 1 && num_hw_blocks <= 5)
|
|
||||||
rc = true;
|
|
||||||
} else if (tbl_entry->clk_src_id == 0x1004B) { // CAM_CC_JPEG_CLK_SRC
|
|
||||||
if (num_hw_blocks > 1 && num_hw_blocks <= 2)
|
|
||||||
rc = true;
|
|
||||||
} else if (tbl_entry->clk_src_id == 0x10017) { // CAM_CC_CPHY_RX_CLK_SRC
|
|
||||||
if (num_hw_blocks > 1 && num_hw_blocks <= 9)
|
|
||||||
rc = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int mmrm_sw_clk_client_setval(struct mmrm_clk_mgr *sw_clk_mgr,
|
static int mmrm_sw_clk_client_setval(struct mmrm_clk_mgr *sw_clk_mgr,
|
||||||
struct mmrm_client *client,
|
struct mmrm_client *client,
|
||||||
struct mmrm_client_data *client_data,
|
struct mmrm_client_data *client_data,
|
||||||
@@ -896,8 +870,8 @@ static int mmrm_sw_clk_client_setval(struct mmrm_clk_mgr *sw_clk_mgr,
|
|||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto err_invalid_clk_val;
|
goto err_invalid_clk_val;
|
||||||
}
|
}
|
||||||
|
if (!((client_data->num_hw_blocks >= 1) &&
|
||||||
if (!mmrm_sw_is_valid_num_hw_block(tbl_entry, client_data)) {
|
(client_data->num_hw_blocks <= tbl_entry->max_num_hw_blocks))) {
|
||||||
d_mpr_e("%s: csid(0x%x) num_hw_block:%d\n",
|
d_mpr_e("%s: csid(0x%x) num_hw_block:%d\n",
|
||||||
__func__, tbl_entry->clk_src_id, client_data->num_hw_blocks);
|
__func__, tbl_entry->clk_src_id, client_data->num_hw_blocks);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
@@ -1080,12 +1054,14 @@ static int mmrm_sw_prepare_table(struct mmrm_clk_platform_resources *cres,
|
|||||||
nom_tbl_entry->nom_dyn_pwr;
|
nom_tbl_entry->nom_dyn_pwr;
|
||||||
tbl_entry->leak_pwr[MMRM_VDD_LEVEL_NOM] =
|
tbl_entry->leak_pwr[MMRM_VDD_LEVEL_NOM] =
|
||||||
nom_tbl_entry->nom_leak_pwr;
|
nom_tbl_entry->nom_leak_pwr;
|
||||||
|
tbl_entry->max_num_hw_blocks = nom_tbl_entry->num_hw_block;
|
||||||
|
|
||||||
d_mpr_h("%s: updating csid(0x%x) dyn_pwr(%d) leak_pwr(%d)\n",
|
d_mpr_h("%s: updating csid(0x%x) dyn_pwr(%d) leak_pwr(%d) num(%d)\n",
|
||||||
__func__,
|
__func__,
|
||||||
tbl_entry->clk_src_id,
|
tbl_entry->clk_src_id,
|
||||||
tbl_entry->dyn_pwr[MMRM_VDD_LEVEL_NOM],
|
tbl_entry->dyn_pwr[MMRM_VDD_LEVEL_NOM],
|
||||||
tbl_entry->leak_pwr[MMRM_VDD_LEVEL_NOM]);
|
tbl_entry->leak_pwr[MMRM_VDD_LEVEL_NOM],
|
||||||
|
tbl_entry->num_hw_blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@@ -129,7 +129,7 @@ static void mmrm_free_nom_clk_src_table(
|
|||||||
static int mmrm_load_nom_clk_src_table(
|
static int mmrm_load_nom_clk_src_table(
|
||||||
struct mmrm_clk_platform_resources *cres)
|
struct mmrm_clk_platform_resources *cres)
|
||||||
{
|
{
|
||||||
int rc = 0, num_clk_src = 0, c = 0, size_clk_src = 0, entry_offset = 4;
|
int rc = 0, num_clk_src = 0, c = 0, size_clk_src = 0, entry_offset = 5;
|
||||||
|
|
||||||
struct platform_device *pdev = cres->pdev;
|
struct platform_device *pdev = cres->pdev;
|
||||||
struct nom_clk_src_set *clk_srcs = &cres->nom_clk_set;
|
struct nom_clk_src_set *clk_srcs = &cres->nom_clk_set;
|
||||||
@@ -168,6 +168,9 @@ static int mmrm_load_nom_clk_src_table(
|
|||||||
of_property_read_u32_index(pdev->dev.of_node,
|
of_property_read_u32_index(pdev->dev.of_node,
|
||||||
"mmrm-client-info", (c*entry_offset+3),
|
"mmrm-client-info", (c*entry_offset+3),
|
||||||
&ci->nom_leak_pwr);
|
&ci->nom_leak_pwr);
|
||||||
|
of_property_read_u32_index(pdev->dev.of_node,
|
||||||
|
"mmrm-client-info", (c*entry_offset+4),
|
||||||
|
&ci->num_hw_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print corner tables */
|
/* print corner tables */
|
||||||
|
@@ -26,6 +26,7 @@ struct nom_clk_src_info {
|
|||||||
u32 clk_src_id;
|
u32 clk_src_id;
|
||||||
u32 nom_dyn_pwr;
|
u32 nom_dyn_pwr;
|
||||||
u32 nom_leak_pwr;
|
u32 nom_leak_pwr;
|
||||||
|
u32 num_hw_block;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nom_clk_src_set {
|
struct nom_clk_src_set {
|
||||||
|
@@ -333,6 +333,29 @@ static ssize_t dump_enabled_client_info_show(struct device *dev,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ssize_t dump_clk_res_info_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
int i, len;
|
||||||
|
struct mmrm_clk_platform_resources *cres = &drv_data->clk_res;
|
||||||
|
struct nom_clk_src_set *clk_set = &cres->nom_clk_set;
|
||||||
|
struct nom_clk_src_info *pclk;
|
||||||
|
int left_spaces = MMRM_SYSFS_ENTRY_MAX_LEN;
|
||||||
|
|
||||||
|
for (i=0, pclk=clk_set->clk_src_tbl; i < clk_set->count && left_spaces > 1; i++, pclk++) {
|
||||||
|
len = scnprintf(buf, left_spaces, "%d %d %d %d %d\n",
|
||||||
|
pclk->domain,
|
||||||
|
pclk->clk_src_id,
|
||||||
|
pclk->nom_dyn_pwr,
|
||||||
|
pclk->nom_leak_pwr,
|
||||||
|
pclk->num_hw_block);
|
||||||
|
left_spaces -= len;
|
||||||
|
buf += len;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MMRM_SYSFS_ENTRY_MAX_LEN - left_spaces;
|
||||||
|
}
|
||||||
|
|
||||||
static DEVICE_ATTR(debug, 0644,
|
static DEVICE_ATTR(debug, 0644,
|
||||||
mmrm_sysfs_debug_get,
|
mmrm_sysfs_debug_get,
|
||||||
mmrm_sysfs_debug_set);
|
mmrm_sysfs_debug_set);
|
||||||
@@ -346,6 +369,7 @@ static DEVICE_ATTR(allow_multiple_register, 0644,
|
|||||||
mmrm_sysfs_allow_multiple_set);
|
mmrm_sysfs_allow_multiple_set);
|
||||||
|
|
||||||
static DEVICE_ATTR_RO(dump_enabled_client_info);
|
static DEVICE_ATTR_RO(dump_enabled_client_info);
|
||||||
|
static DEVICE_ATTR_RO(dump_clk_res_info);
|
||||||
|
|
||||||
|
|
||||||
static struct attribute *mmrm_fs_attrs[] = {
|
static struct attribute *mmrm_fs_attrs[] = {
|
||||||
@@ -353,6 +377,7 @@ static struct attribute *mmrm_fs_attrs[] = {
|
|||||||
&dev_attr_enable_throttle_feature.attr,
|
&dev_attr_enable_throttle_feature.attr,
|
||||||
&dev_attr_allow_multiple_register.attr,
|
&dev_attr_allow_multiple_register.attr,
|
||||||
&dev_attr_dump_enabled_client_info.attr,
|
&dev_attr_dump_enabled_client_info.attr,
|
||||||
|
&dev_attr_dump_clk_res_info.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user