forked from nuttx/nuttx-update
clk:optimized the clk_set_rate for mux
clk_mux_determine_rate->clk_get_parent_by_index this path consume time too much Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
This commit is contained in:
parent
a6cf57dbac
commit
347154c01e
2 changed files with 27 additions and 1 deletions
|
@ -727,6 +727,11 @@ static void clk_init_parent(FAR struct clk_s *clk)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (index = 0; index < clk->num_parents; index++)
|
||||||
|
{
|
||||||
|
clk->parents[index] = clk_get(clk->parent_names[index]);
|
||||||
|
}
|
||||||
|
|
||||||
if (!clk->ops->get_parent)
|
if (!clk->ops->get_parent)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -1205,7 +1210,12 @@ FAR struct clk_s *clk_get_parent_by_index(FAR struct clk_s *clk,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return clk_get(clk->parent_names[index]);
|
if (clk->parents[index] == NULL)
|
||||||
|
{
|
||||||
|
clk->parents[index] = clk_get(clk->parent_names[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return clk->parents[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
FAR struct clk_s *clk_get_parent(FAR struct clk_s *clk)
|
FAR struct clk_s *clk_get_parent(FAR struct clk_s *clk)
|
||||||
|
@ -1308,6 +1318,15 @@ FAR struct clk_s *clk_register(FAR const char *name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (num_parents > 0)
|
||||||
|
{
|
||||||
|
clk->parents = kmm_zalloc(sizeof(struct clk_s *) * num_parents);
|
||||||
|
if (clk->parents == NULL)
|
||||||
|
{
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
list_initialize(&clk->node);
|
list_initialize(&clk->node);
|
||||||
list_initialize(&clk->children);
|
list_initialize(&clk->children);
|
||||||
|
|
||||||
|
@ -1318,7 +1337,13 @@ FAR struct clk_s *clk_register(FAR const char *name,
|
||||||
return clk;
|
return clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
clk_list_unlock(irqflags);
|
clk_list_unlock(irqflags);
|
||||||
|
if (clk->parents)
|
||||||
|
{
|
||||||
|
kmm_free(clk->parents);
|
||||||
|
}
|
||||||
|
|
||||||
kmm_free(clk);
|
kmm_free(clk);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,7 @@ struct clk_s
|
||||||
FAR const char *name;
|
FAR const char *name;
|
||||||
FAR const struct clk_ops_s *ops;
|
FAR const struct clk_ops_s *ops;
|
||||||
FAR struct clk_s *parent;
|
FAR struct clk_s *parent;
|
||||||
|
FAR struct clk_s **parents;
|
||||||
uint8_t num_parents;
|
uint8_t num_parents;
|
||||||
uint8_t new_parent_index;
|
uint8_t new_parent_index;
|
||||||
uint8_t enable_count;
|
uint8_t enable_count;
|
||||||
|
|
Loading…
Reference in a new issue