drivers/clk/sophgo/clk-cv1800.c
Source file repositories/reference/linux-study-clean/drivers/clk/sophgo/clk-cv1800.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/sophgo/clk-cv1800.c- Extension
.c- Size
- 47491 bytes
- Lines
- 1541
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/module.hlinux/clk-provider.hlinux/platform_device.hlinux/io.hlinux/spinlock.hclk-cv1800.hclk-cv18xx-common.hclk-cv18xx-ip.hclk-cv18xx-pll.h
Detected Declarations
struct cv1800_clk_ctrlstruct cv1800_clk_descstruct cv1800_clk_ctrlfunction cv18xx_clk_disable_auto_pdfunction cv18xx_clk_disable_a53function cv1800_pre_initfunction cv1810_pre_initfunction sg2000_pre_initfunction cv1800_clk_init_ctrlfunction cv1800_clk_probe
Annotated Snippet
struct cv1800_clk_desc {
struct clk_hw_onecell_data *clks_data;
int (*pre_init)(struct device *dev, void __iomem *base,
struct cv1800_clk_ctrl *ctrl,
const struct cv1800_clk_desc *desc);
};
struct cv1800_clk_ctrl {
const struct cv1800_clk_desc *desc;
spinlock_t lock;
};
#define CV1800_DIV_FLAG \
(CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ROUND_CLOSEST)
static const struct clk_parent_data osc_parents[] = {
{ .index = 0 },
};
static const struct cv1800_clk_pll_limit pll_limits[] = {
{
.pre_div = _CV1800_PLL_LIMIT(1, 127),
.div = _CV1800_PLL_LIMIT(6, 127),
.post_div = _CV1800_PLL_LIMIT(1, 127),
.ictrl = _CV1800_PLL_LIMIT(0, 7),
.mode = _CV1800_PLL_LIMIT(0, 3),
},
{
.pre_div = _CV1800_PLL_LIMIT(1, 127),
.div = _CV1800_PLL_LIMIT(6, 127),
.post_div = _CV1800_PLL_LIMIT(1, 127),
.ictrl = _CV1800_PLL_LIMIT(0, 7),
.mode = _CV1800_PLL_LIMIT(0, 3),
},
};
static CV1800_INTEGRAL_PLL(clk_fpll, osc_parents,
REG_FPLL_CSR,
REG_PLL_G6_CTRL, 8,
REG_PLL_G6_STATUS, 2,
pll_limits,
CLK_IS_CRITICAL);
static CV1800_INTEGRAL_PLL(clk_mipimpll, osc_parents,
REG_MIPIMPLL_CSR,
REG_PLL_G2_CTRL, 0,
REG_PLL_G2_STATUS, 0,
pll_limits,
CLK_IS_CRITICAL);
static const struct clk_parent_data clk_mipimpll_parents[] = {
{ .hw = &clk_mipimpll.common.hw },
};
static const struct clk_parent_data clk_bypass_mipimpll_parents[] = {
{ .index = 0 },
{ .hw = &clk_mipimpll.common.hw },
};
static const struct clk_parent_data clk_bypass_fpll_parents[] = {
{ .index = 0 },
{ .hw = &clk_fpll.common.hw },
};
static struct cv1800_clk_pll_synthesizer clk_mpll_synthesizer = {
.en = CV1800_CLK_BIT(REG_PLL_G6_SSC_SYN_CTRL, 2),
.clk_half = CV1800_CLK_BIT(REG_PLL_G6_SSC_SYN_CTRL, 0),
.ctrl = REG_MPLL_SSC_SYN_CTRL,
.set = REG_MPLL_SSC_SYN_SET,
};
static CV1800_FACTIONAL_PLL(clk_mpll, clk_bypass_mipimpll_parents,
REG_MPLL_CSR,
REG_PLL_G6_CTRL, 0,
REG_PLL_G6_STATUS, 0,
pll_limits,
&clk_mpll_synthesizer,
CLK_IS_CRITICAL);
static struct cv1800_clk_pll_synthesizer clk_tpll_synthesizer = {
.en = CV1800_CLK_BIT(REG_PLL_G6_SSC_SYN_CTRL, 3),
.clk_half = CV1800_CLK_BIT(REG_PLL_G6_SSC_SYN_CTRL, 0),
.ctrl = REG_TPLL_SSC_SYN_CTRL,
.set = REG_TPLL_SSC_SYN_SET,
};
static CV1800_FACTIONAL_PLL(clk_tpll, clk_bypass_mipimpll_parents,
REG_TPLL_CSR,
REG_PLL_G6_CTRL, 4,
REG_PLL_G6_STATUS, 1,
pll_limits,
&clk_tpll_synthesizer,
CLK_IS_CRITICAL);
Annotation
- Immediate include surface: `linux/module.h`, `linux/clk-provider.h`, `linux/platform_device.h`, `linux/io.h`, `linux/spinlock.h`, `clk-cv1800.h`, `clk-cv18xx-common.h`, `clk-cv18xx-ip.h`.
- Detected declarations: `struct cv1800_clk_ctrl`, `struct cv1800_clk_desc`, `struct cv1800_clk_ctrl`, `function cv18xx_clk_disable_auto_pd`, `function cv18xx_clk_disable_a53`, `function cv1800_pre_init`, `function cv1810_pre_init`, `function sg2000_pre_init`, `function cv1800_clk_init_ctrl`, `function cv1800_clk_probe`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.