Linux时钟管理clk devm_clk_get clk_prepare_enable等学习
一、查看系统clk命令 cat d/clk/clk_summary
二、clock获取有关的API。
struct clk *clk_get(struct device *dev, const char *id);
struct clk *devm_clk_get(struct device *dev, const char *id);
void clk_put(struct clk *clk);
void devm_clk_put(struct device *dev, struct clk *clk);
struct clk *clk_get_sys(const char *dev_id, const char *con_id);
struct clk *of_clk_get(struct device_node *np, int index);
struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
clock控制有关的API:
int clk_prepare(struct clk *clk)
void clk_unprepare(struct clk *clk)
static inline int clk_enable(struct clk *clk)
static inline void clk_disable(struct clk *clk)
static inline unsigned long clk_get_rate(struct clk *clk)
static inline int clk_set_rate(struct clk *clk, unsigned long rate)
static inline long clk_round_rate(struct clk *clk, unsigned long rate)
static inline int clk_set_parent(struct clk *clk, struct clk *parent)
static inline struct clk *clk_get_parent(struct clk *clk)
三、常规调用步骤:
1、
2、
3、
4、
5、测试,i2s1频率是11289800
四、参考文章: