drivers/clk/clk-lmk04832.c
Source file repositories/reference/linux-study-clean/drivers/clk/clk-lmk04832.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/clk-lmk04832.c- Extension
.c- Size
- 44430 bytes
- Lines
- 1580
- 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/device.hlinux/gcd.hlinux/gpio/consumer.hlinux/module.hlinux/regmap.hlinux/spi/spi.h
Detected Declarations
struct lmk04832_device_infostruct lmk_dclkstruct lmk_clkoutstruct lmk04832enum lmk04832_device_typesenum lmk04832_rdbk_typefunction lmk04832_regmap_rd_regsfunction lmk04832_regmap_wr_regsfunction lmk04832_vco_is_enabledfunction lmk04832_vco_preparefunction lmk04832_vco_unpreparefunction lmk04832_vco_recalc_ratefunction lmk04832_check_vco_rangesfunction lmk04832_calc_pll2_paramsfunction lmk04832_vco_determine_ratefunction lmk04832_vco_set_ratefunction lmk04832_register_vcofunction lmk04832_clkout_set_ddlyfunction lmk04832_sclk_sync_sequencefunction lmk04832_sclk_is_enabledfunction lmk04832_sclk_preparefunction lmk04832_sclk_unpreparefunction lmk04832_sclk_recalc_ratefunction lmk04832_sclk_determine_ratefunction lmk04832_sclk_set_ratefunction lmk04832_register_sclkfunction lmk04832_dclk_is_enabledfunction lmk04832_dclk_preparefunction lmk04832_dclk_unpreparefunction lmk04832_dclk_recalc_ratefunction lmk04832_dclk_determine_ratefunction lmk04832_dclk_set_ratefunction lmk04832_clkout_is_enabledfunction lmk04832_clkout_preparefunction lmk04832_clkout_unpreparefunction lmk04832_clkout_set_parentfunction lmk04832_clkout_get_parentfunction lmk04832_register_clkoutfunction lmk04832_set_spi_rdbkfunction lmk04832_probefunction for_each_child_of_node_scoped
Annotated Snippet
struct lmk04832_device_info {
u16 pid;
u8 maskrev;
size_t num_channels;
unsigned int vco0_range[2];
unsigned int vco1_range[2];
};
static const struct lmk04832_device_info lmk04832_device_info[] = {
[LMK04832] = {
.pid = 0x63d1, /* WARNING PROD_ID is inverted in the datasheet */
.maskrev = 0x70,
.num_channels = 14,
.vco0_range = { 2440, 2580 },
.vco1_range = { 2945, 3255 },
},
};
enum lmk04832_rdbk_type {
RDBK_CLKIN_SEL0,
RDBK_CLKIN_SEL1,
RDBK_RESET,
RDBK_PLL1_LD,
};
struct lmk_dclk {
struct lmk04832 *lmk;
struct clk_hw hw;
u8 id;
};
struct lmk_clkout {
struct lmk04832 *lmk;
struct clk_hw hw;
bool sysref;
u32 format;
u8 id;
};
/**
* struct lmk04832 - The LMK04832 device structure
*
* @dev: reference to a struct device, linked to the spi_device
* @regmap: struct regmap instance use to access the chip
* @sync_mode: operational mode for SYNC signal
* @sysref_mux: select SYSREF source
* @sysref_pulse_cnt: number of SYSREF pulses generated while not in continuous
* mode.
* @sysref_ddly: SYSREF digital delay value
* @oscin: PLL2 input clock
* @vco: reference to the internal VCO clock
* @sclk: reference to the internal sysref clock (SCLK)
* @vco_rate: user provided VCO rate
* @reset_gpio: reference to the reset GPIO
* @dclk: list of internal device clock references.
* Each pair of clkout clocks share a single device clock (DCLKX_Y)
* @clkout: list of output clock references
* @clk_data: holds clkout related data like clk_hw* and number of clocks
*/
struct lmk04832 {
struct device *dev;
struct regmap *regmap;
unsigned int sync_mode;
unsigned int sysref_mux;
unsigned int sysref_pulse_cnt;
unsigned int sysref_ddly;
struct clk *oscin;
struct clk_hw vco;
struct clk_hw sclk;
unsigned int vco_rate;
struct gpio_desc *reset_gpio;
struct lmk_dclk *dclk;
struct lmk_clkout *clkout;
struct clk_hw_onecell_data *clk_data;
};
static bool lmk04832_regmap_rd_regs(struct device *dev, unsigned int reg)
{
switch (reg) {
case LMK04832_REG_RST3W ... LMK04832_REG_ID_MASKREV:
case LMK04832_REG_ID_VNDR_MSB:
case LMK04832_REG_ID_VNDR_LSB:
case LMK04832_REG_CLKOUT_CTRL0(0) ... LMK04832_REG_PLL2_DLD_CNT_LSB:
case LMK04832_REG_PLL2_LD:
case LMK04832_REG_PLL2_PD:
case LMK04832_REG_PLL1R_RST:
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/clk-provider.h`, `linux/device.h`, `linux/gcd.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/regmap.h`.
- Detected declarations: `struct lmk04832_device_info`, `struct lmk_dclk`, `struct lmk_clkout`, `struct lmk04832`, `enum lmk04832_device_types`, `enum lmk04832_rdbk_type`, `function lmk04832_regmap_rd_regs`, `function lmk04832_regmap_wr_regs`, `function lmk04832_vco_is_enabled`, `function lmk04832_vco_prepare`.
- 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.