mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-07 21:33:54 +00:00
feat(clk): add set_rate callback
This callback will be used to set a clock's rate if the underlying clock driver supports this option. The function's last parameter is an output parameter, storing the actual frequency set by the clock driver, as it may not precisely match the requested rate in some cases. Change-Id: I6a399bf6f64407d5fbff36407561e4bf18104cf1 Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
This commit is contained in:
parent
a2c6016f92
commit
19f9e2e657
2 changed files with 17 additions and 0 deletions
|
@ -34,6 +34,20 @@ unsigned long clk_get_rate(unsigned long id)
|
|||
return ops->get_rate(id);
|
||||
}
|
||||
|
||||
int clk_set_rate(unsigned long id, unsigned long rate, unsigned long *orate)
|
||||
{
|
||||
unsigned long lrate;
|
||||
|
||||
assert((ops != NULL) && (ops->set_rate != NULL));
|
||||
|
||||
if (orate != NULL) {
|
||||
return ops->set_rate(id, rate, orate);
|
||||
}
|
||||
|
||||
/* In case the caller is not interested in the output rate */
|
||||
return ops->set_rate(id, rate, &lrate);
|
||||
}
|
||||
|
||||
int clk_get_parent(unsigned long id)
|
||||
{
|
||||
assert((ops != NULL) && (ops->get_parent != NULL));
|
||||
|
|
|
@ -13,6 +13,8 @@ struct clk_ops {
|
|||
int (*enable)(unsigned long id);
|
||||
void (*disable)(unsigned long id);
|
||||
unsigned long (*get_rate)(unsigned long id);
|
||||
int (*set_rate)(unsigned long id, unsigned long rate,
|
||||
unsigned long *orate);
|
||||
int (*get_parent)(unsigned long id);
|
||||
int (*set_parent)(unsigned long id, unsigned long parent_id);
|
||||
bool (*is_enabled)(unsigned long id);
|
||||
|
@ -21,6 +23,7 @@ struct clk_ops {
|
|||
int clk_enable(unsigned long id);
|
||||
void clk_disable(unsigned long id);
|
||||
unsigned long clk_get_rate(unsigned long id);
|
||||
int clk_set_rate(unsigned long id, unsigned long rate, unsigned long *orate);
|
||||
bool clk_is_enabled(unsigned long id);
|
||||
int clk_get_parent(unsigned long id);
|
||||
int clk_set_parent(unsigned long id, unsigned long parent_id);
|
||||
|
|
Loading…
Add table
Reference in a new issue