Linux clk子系统(2)--相关数据结构

it2025-10-21  10

目录

1. struct clk

2. struct clk_hw

3. struct clk_fixed_rate

4.  struct clk_fixed_factor

5. struct clk_init_data

6. struct clk_core

7. struct of_clk_provider

8. struct clock_provider


1. struct clk

/** *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; };

2. struct clk_hw

/** * "include/linux/clk-provider.h" */ struct clk_hw { struct clk_core *core; struct clk *clk; const struct clk_init_data *init; };

3. struct clk_fixed_rate

/** * include/linux/clk-provider.h */ /** * struct clk_fixed_rate - fixed-rate clock * @hw: handle between common and hardware-specific interfaces * @fixed_rate: constant frequency of clock */ struct clk_fixed_rate { struct clk_hw hw; unsigned long fixed_rate; unsigned long fixed_accuracy; u8 flags; };

4.  struct clk_fixed_factor

/** * include/linux/clk-provider */ struct clk_fixed_factor { struct clk_hw hw; unsigned int mult; unsigned int div; };

5. struct clk_init_data

/** * include/linux/clk-provider.h */ struct clk_init_data { const char *name; const struct clk_ops *ops; const char * const *parent_names; u8 num_parents; unsigned long flags; };

6. struct clk_core

/** * drivers/clk/clk.c */ 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; };

7. struct of_clk_provider

/** * drivers/clk/clk.c */ /** * struct of_clk_provider - Clock provider registration structure * @link: Entry in global list of clock providers * @node: Pointer to device tree node of clock provider * @get: Get clock callback. Returns NULL or a struct clk for the * given clock specifier * @data: context pointer to be passed into @get callback */ struct of_clk_provider { struct list_head link; struct device_node *node; struct clk *(*get)(struct of_phandle_args *clkspec, void *data); void *data; };

8. struct clock_provider

/** * drivers/clk/clk.c */ struct clock_provider { of_clk_init_cb_t clk_init_cb; struct device_node *np; struct list_head node; };
最新回复(0)