drivers/clk/mediatek/clk-mtk.h
Source file repositories/reference/linux-study-clean/drivers/clk/mediatek/clk-mtk.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/mediatek/clk-mtk.h- Extension
.h- Size
- 7609 bytes
- Lines
- 272
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk-provider.hlinux/io.hlinux/kernel.hlinux/spinlock.hlinux/types.hreset.h
Detected Declarations
struct platform_devicestruct mtk_fixed_clkstruct mtk_fixed_factorstruct mtk_compositestruct mtk_clk_dividerstruct mtk_clk_descfunction MUX_GATE_FLAGS_2
Annotated Snippet
struct mtk_fixed_clk {
int id;
const char *name;
const char *parent;
unsigned long rate;
};
#define FIXED_CLK(_id, _name, _parent, _rate) { \
.id = _id, \
.name = _name, \
.parent = _parent, \
.rate = _rate, \
}
int mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, int num,
struct clk_hw_onecell_data *clk_data);
void mtk_clk_unregister_fixed_clks(const struct mtk_fixed_clk *clks, int num,
struct clk_hw_onecell_data *clk_data);
struct mtk_fixed_factor {
int id;
const char *name;
const char *parent_name;
int mult;
int div;
unsigned long flags;
};
#define FACTOR_FLAGS(_id, _name, _parent, _mult, _div, _fl) { \
.id = _id, \
.name = _name, \
.parent_name = _parent, \
.mult = _mult, \
.div = _div, \
.flags = _fl, \
}
#define FACTOR(_id, _name, _parent, _mult, _div) \
FACTOR_FLAGS(_id, _name, _parent, _mult, _div, CLK_SET_RATE_PARENT)
int mtk_clk_register_factors(const struct mtk_fixed_factor *clks, int num,
struct clk_hw_onecell_data *clk_data);
void mtk_clk_unregister_factors(const struct mtk_fixed_factor *clks, int num,
struct clk_hw_onecell_data *clk_data);
struct mtk_composite {
int id;
const char *name;
const char * const *parent_names;
const char *parent;
unsigned flags;
uint32_t mux_reg;
uint32_t divider_reg;
uint32_t gate_reg;
signed char mux_shift;
signed char mux_width;
signed char gate_shift;
signed char divider_shift;
signed char divider_width;
u8 mux_flags;
signed char num_parents;
};
#define MUX_GATE_FLAGS_2(_id, _name, _parents, _reg, _shift, \
_width, _gate, _flags, _muxflags) { \
.id = _id, \
.name = _name, \
.mux_reg = _reg, \
.mux_shift = _shift, \
.mux_width = _width, \
.gate_reg = _reg, \
.gate_shift = _gate, \
.divider_shift = -1, \
.parent_names = _parents, \
.num_parents = ARRAY_SIZE(_parents), \
.flags = _flags, \
.mux_flags = _muxflags, \
}
/*
* In case the rate change propagation to parent clocks is undesirable,
* this macro allows to specify the clock flags manually.
*/
#define MUX_GATE_FLAGS(_id, _name, _parents, _reg, _shift, _width, \
_gate, _flags) \
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/io.h`, `linux/kernel.h`, `linux/spinlock.h`, `linux/types.h`, `reset.h`.
- Detected declarations: `struct platform_device`, `struct mtk_fixed_clk`, `struct mtk_fixed_factor`, `struct mtk_composite`, `struct mtk_clk_divider`, `struct mtk_clk_desc`, `function MUX_GATE_FLAGS_2`.
- 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.