Linux 内核clk相关数据结构描述

对Linux内核整个clk框架来说,clk框架层看到的核心数据结构为struct clk,并且每个clk都有一个这样
的对象。平台需要向clk框架层注册这些clk,但是平台或者硬件相关的是struct clk_hw,以及对应的ops对象
struct clk_ops。
 
drivers/clk/clk.c
struct clk {
 struct clk_core *core;
 const char *dev_id;
 const char *con_id;
 unsigned long min_rate;
 unsigned long max_rate;
 struct hlist_node clks_node;
};
/***private data structures***/

struct clk_core {  const char  *name;  const struct clk_ops *ops;  struct clk_hw  *hw;  struct module  *owner;  struct clk_core  *parent;  const char  **parent_names;  struct clk_core  **parents;  u8   num_parents;  u8   new_parent_index;  unsigned long  rate;  unsigned long  req_rate;  unsigned long  new_rate;  struct clk_core  *new_parent;  struct clk_core  *new_child;  unsigned long  flags;  bool   orphan;  unsigned int  enable_count;  unsigned int  prepare_count;  unsigned long  min_rate;  unsigned long  max_rate;  unsigned long  accuracy;  int   phase;  struct hlist_head children;  struct hlist_node child_node;  struct hlist_head clks;  unsigned int  notifier_count; #ifdef CONFIG_DEBUG_FS  struct dentry  *dentry;  struct hlist_node debug_node; #endif  struct kref  ref; };

     驱动实现      私有数据块                        clk框架层实现,接口 clk_register      clk_priv           |           |________struct clk_hw           | core |----------------------------------------------->struct clk_core           |------|                                              |name            |           | clk  |-------------------------->struct clk____     |ops             |           |------|                            |  core     |     |hw              |           | init |                            | dev_id    |     |owner           |           |_____ |-->_____________________    | con_id    |     |parent          |                     |         name        |   |min_rate   |     |parent_names    |                     |---------------------    |max_rate   |     |parents         | 驱动<-------------  |struct clk_ops *ops  |   |clks_node  |     |                | 实现     |---------------------    |------------     |----------------                     |    parent_names     |                     |---------------------                     |     num_parents     |                     |---------------------                     |       flags         |                     ----------------------

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值