drivers/clk/zynqmp/clkc.c
Source file repositories/reference/linux-study-clean/drivers/clk/zynqmp/clkc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/zynqmp/clkc.c- Extension
.c- Size
- 20174 bytes
- Lines
- 804
- Domain
- Driver Families
- Bucket
- drivers/clk
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/clk.hlinux/clk-provider.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/slab.hlinux/string.hclk-zynqmp.h
Detected Declarations
struct clock_parentstruct zynqmp_clockstruct name_respstruct topology_respstruct parents_respstruct attr_respenum clk_typefunction zynqmp_is_valid_clockfunction zynqmp_get_clock_namefunction zynqmp_get_clock_typefunction zynqmp_pm_clock_get_num_clocksfunction zynqmp_pm_clock_get_namefunction zynqmp_pm_clock_get_topologyfunction zynqmp_clk_map_common_ccf_flagsfunction zynqmp_clk_register_fixed_factorfunction zynqmp_pm_clock_get_parentsfunction zynqmp_pm_clock_get_attributesfunction __zynqmp_clock_get_topologyfunction zynqmp_clock_get_topologyfunction __zynqmp_clock_get_parentsfunction zynqmp_clock_get_parentsfunction zynqmp_get_parent_listfunction zynqmp_register_clk_topologyfunction zynqmp_register_clocksfunction zynqmp_get_clock_infofunction zynqmp_clk_setupfunction zynqmp_clock_probe
Annotated Snippet
struct clock_parent {
char name[MAX_NAME_LEN];
int id;
u32 flag;
};
/**
* struct zynqmp_clock - Clock
* @clk_name: Clock name
* @valid: Validity flag of clock
* @type: Clock type (Output/External)
* @node: Clock topology nodes
* @num_nodes: Number of nodes present in topology
* @parent: Parent of clock
* @num_parents: Number of parents of clock
* @clk_id: Clock id
*/
struct zynqmp_clock {
char clk_name[MAX_NAME_LEN];
u32 valid;
enum clk_type type;
struct clock_topology node[MAX_NODES];
u32 num_nodes;
struct clock_parent parent[MAX_PARENT];
u32 num_parents;
u32 clk_id;
};
struct name_resp {
char name[CLK_GET_NAME_RESP_LEN];
};
struct topology_resp {
#define CLK_TOPOLOGY_TYPE GENMASK(3, 0)
#define CLK_TOPOLOGY_CUSTOM_TYPE_FLAGS GENMASK(7, 4)
#define CLK_TOPOLOGY_FLAGS GENMASK(23, 8)
#define CLK_TOPOLOGY_TYPE_FLAGS GENMASK(31, 24)
u32 topology[CLK_GET_TOPOLOGY_RESP_WORDS];
};
struct parents_resp {
#define NA_PARENT 0xFFFFFFFF
#define DUMMY_PARENT 0xFFFFFFFE
#define CLK_PARENTS_ID GENMASK(15, 0)
#define CLK_PARENTS_FLAGS GENMASK(31, 16)
u32 parents[CLK_GET_PARENTS_RESP_WORDS];
};
struct attr_resp {
#define CLK_ATTR_VALID BIT(0)
#define CLK_ATTR_TYPE BIT(2)
#define CLK_ATTR_NODE_INDEX GENMASK(13, 0)
#define CLK_ATTR_NODE_TYPE GENMASK(19, 14)
#define CLK_ATTR_NODE_SUBCLASS GENMASK(25, 20)
#define CLK_ATTR_NODE_CLASS GENMASK(31, 26)
u32 attr[CLK_GET_ATTR_RESP_WORDS];
};
static const char clk_type_postfix[][10] = {
[TYPE_INVALID] = "",
[TYPE_MUX] = "_mux",
[TYPE_GATE] = "",
[TYPE_DIV1] = "_div1",
[TYPE_DIV2] = "_div2",
[TYPE_FIXEDFACTOR] = "_ff",
[TYPE_PLL] = ""
};
static struct clk_hw *(* const clk_topology[]) (const char *name, u32 clk_id,
const char * const *parents,
u8 num_parents,
const struct clock_topology *nodes)
= {
[TYPE_INVALID] = NULL,
[TYPE_MUX] = zynqmp_clk_register_mux,
[TYPE_PLL] = zynqmp_clk_register_pll,
[TYPE_FIXEDFACTOR] = zynqmp_clk_register_fixed_factor,
[TYPE_DIV1] = zynqmp_clk_register_divider,
[TYPE_DIV2] = zynqmp_clk_register_divider,
[TYPE_GATE] = zynqmp_clk_register_gate
};
static struct zynqmp_clock *clock;
static struct clk_hw_onecell_data *zynqmp_data;
static unsigned int clock_max_idx;
/**
* zynqmp_is_valid_clock() - Check whether clock is valid or not
* @clk_id: Clock index
*
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/clk-provider.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/slab.h`, `linux/string.h`.
- Detected declarations: `struct clock_parent`, `struct zynqmp_clock`, `struct name_resp`, `struct topology_resp`, `struct parents_resp`, `struct attr_resp`, `enum clk_type`, `function zynqmp_is_valid_clock`, `function zynqmp_get_clock_name`, `function zynqmp_get_clock_type`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.