drivers/clk/clk-si5341.c
Source file repositories/reference/linux-study-clean/drivers/clk/clk-si5341.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/clk-si5341.c- Extension
.c- Size
- 47987 bytes
- Lines
- 1861
- 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/clk.hlinux/clk-provider.hlinux/delay.hlinux/gcd.hlinux/math64.hlinux/i2c.hlinux/module.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/unaligned.h
Detected Declarations
struct clk_si5341_synthstruct clk_si5341_outputstruct clk_si5341struct clk_si5341_output_configstruct si5341_reg_defaultfunction si5341_decode_44_32function si5341_encode_44_32function si5341_clk_recalc_ratefunction si5341_clk_get_selected_inputfunction si5341_clk_get_parentfunction si5341_clk_reparentfunction si5341_clk_set_parentfunction si5341_synth_clk_is_onfunction si5341_synth_clk_unpreparefunction si5341_synth_clk_preparefunction si5341_synth_clk_recalc_ratefunction si5341_synth_clk_determine_ratefunction si5341_synth_programfunction si5341_synth_clk_set_ratefunction si5341_output_clk_is_onfunction si5341_output_clk_unpreparefunction si5341_output_clk_preparefunction si5341_output_clk_recalc_ratefunction si5341_output_clk_determine_ratefunction si5341_output_clk_set_ratefunction si5341_output_reparentfunction si5341_output_set_parentfunction si5341_output_get_parentfunction si5341_is_programmed_alreadyfunction of_clk_si5341_getfunction si5341_probe_chip_idfunction si5341_read_settingsfunction si5341_write_multiplefunction si5341_send_preamblefunction si5341_finalize_defaultsfunction si5341_wait_device_readyfunction si5341_dt_parse_dtfunction for_each_child_of_nodefunction si5341_initialize_pllfunction si5341_clk_select_active_inputfunction input_present_showfunction input_present_sticky_showfunction pll_locked_showfunction pll_locked_sticky_showfunction clear_sticky_storefunction si5341_probefunction si5341_remove
Annotated Snippet
struct clk_si5341_synth {
struct clk_hw hw;
struct clk_si5341 *data;
u8 index;
};
#define to_clk_si5341_synth(_hw) \
container_of(_hw, struct clk_si5341_synth, hw)
/* The output stages can be connected to any synth (full mux) */
struct clk_si5341_output {
struct clk_hw hw;
struct clk_si5341 *data;
struct regulator *vddo_reg;
u8 index;
};
#define to_clk_si5341_output(_hw) \
container_of(_hw, struct clk_si5341_output, hw)
struct clk_si5341 {
struct clk_hw hw;
struct regmap *regmap;
struct i2c_client *i2c_client;
struct clk_si5341_synth synth[SI5341_NUM_SYNTH];
struct clk_si5341_output clk[SI5341_MAX_NUM_OUTPUTS];
struct clk *input_clk[SI5341_NUM_INPUTS];
const char *input_clk_name[SI5341_NUM_INPUTS];
const u16 *reg_output_offset;
const u16 *reg_rdiv_offset;
u64 freq_vco; /* 13500–14256 MHz */
u8 num_outputs;
u8 num_synth;
u16 chip_id;
bool xaxb_ext_clk;
bool iovdd_33;
};
#define to_clk_si5341(_hw) container_of(_hw, struct clk_si5341, hw)
struct clk_si5341_output_config {
u8 out_format_drv_bits;
u8 out_cm_ampl_bits;
u8 vdd_sel_bits;
bool synth_master;
bool always_on;
};
#define SI5341_PAGE 0x0001
#define SI5341_PN_BASE 0x0002
#define SI5341_DEVICE_REV 0x0005
#define SI5341_STATUS 0x000C
#define SI5341_LOS 0x000D
#define SI5341_STATUS_STICKY 0x0011
#define SI5341_LOS_STICKY 0x0012
#define SI5341_SOFT_RST 0x001C
#define SI5341_IN_SEL 0x0021
#define SI5341_DEVICE_READY 0x00FE
#define SI5341_XAXB_CFG 0x090E
#define SI5341_IO_VDD_SEL 0x0943
#define SI5341_IN_EN 0x0949
#define SI5341_INX_TO_PFD_EN 0x094A
/* Status bits */
#define SI5341_STATUS_SYSINCAL BIT(0)
#define SI5341_STATUS_LOSXAXB BIT(1)
#define SI5341_STATUS_LOSREF BIT(2)
#define SI5341_STATUS_LOL BIT(3)
/* Input selection */
#define SI5341_IN_SEL_MASK 0x06
#define SI5341_IN_SEL_SHIFT 1
#define SI5341_IN_SEL_REGCTRL 0x01
#define SI5341_INX_TO_PFD_SHIFT 4
/* XTAL config bits */
#define SI5341_XAXB_CFG_EXTCLK_EN BIT(0)
#define SI5341_XAXB_CFG_PDNB BIT(1)
/* Input dividers (48-bit) */
#define SI5341_IN_PDIV(x) (0x0208 + ((x) * 10))
#define SI5341_IN_PSET(x) (0x020E + ((x) * 10))
#define SI5341_PX_UPD 0x0230
/* PLL configuration */
#define SI5341_PLL_M_NUM 0x0235
#define SI5341_PLL_M_DEN 0x023B
/* Output configuration */
#define SI5341_OUT_CONFIG(output) \
((output)->data->reg_output_offset[(output)->index])
#define SI5341_OUT_FORMAT(output) (SI5341_OUT_CONFIG(output) + 1)
#define SI5341_OUT_CM(output) (SI5341_OUT_CONFIG(output) + 2)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/delay.h`, `linux/gcd.h`, `linux/math64.h`, `linux/i2c.h`, `linux/module.h`, `linux/regmap.h`.
- Detected declarations: `struct clk_si5341_synth`, `struct clk_si5341_output`, `struct clk_si5341`, `struct clk_si5341_output_config`, `struct si5341_reg_default`, `function si5341_decode_44_32`, `function si5341_encode_44_32`, `function si5341_clk_recalc_rate`, `function si5341_clk_get_selected_input`, `function si5341_clk_get_parent`.
- 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.