drivers/clk/clk-si521xx.c
Source file repositories/reference/linux-study-clean/drivers/clk/clk-si521xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/clk-si521xx.c- Extension
.c- Size
- 10273 bytes
- Lines
- 399
- 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/bitrev.hlinux/clk-provider.hlinux/i2c.hlinux/mod_devicetable.hlinux/module.hlinux/of.hlinux/regmap.h
Detected Declarations
struct si521xxstruct si_clkstruct si521xxenum si521xx_modelfunction si521xx_regmap_i2c_writefunction si521xx_regmap_i2c_readfunction si521xx_diff_recalc_ratefunction si521xx_diff_determine_ratefunction si521xx_diff_set_ratefunction si521xx_diff_preparefunction si521xx_diff_unpreparefunction si521xx_get_common_configfunction si521xx_update_configfunction si521xx_diff_idx_to_reg_bitfunction for_each_set_bitfunction si521xx_of_clk_getfunction si521xx_probefunction si521xx_suspendfunction si521xx_resume
Annotated Snippet
struct si_clk {
struct clk_hw hw;
struct si521xx *si;
u8 reg;
u8 bit;
};
struct si521xx {
struct i2c_client *client;
struct regmap *regmap;
struct si_clk clk_dif[9];
u16 chip_info;
u8 pll_amplitude;
};
/*
* Si521xx i2c regmap
*/
static const struct regmap_range si521xx_readable_ranges[] = {
regmap_reg_range(SI521XX_REG_OE(0), SI521XX_REG_DA),
};
static const struct regmap_access_table si521xx_readable_table = {
.yes_ranges = si521xx_readable_ranges,
.n_yes_ranges = ARRAY_SIZE(si521xx_readable_ranges),
};
static const struct regmap_range si521xx_writeable_ranges[] = {
regmap_reg_range(SI521XX_REG_OE(0), SI521XX_REG_OE(1)),
regmap_reg_range(SI521XX_REG_BC, SI521XX_REG_DA),
};
static const struct regmap_access_table si521xx_writeable_table = {
.yes_ranges = si521xx_writeable_ranges,
.n_yes_ranges = ARRAY_SIZE(si521xx_writeable_ranges),
};
static int si521xx_regmap_i2c_write(void *context, unsigned int reg,
unsigned int val)
{
struct i2c_client *i2c = context;
const u8 data[2] = { reg, val };
const int count = ARRAY_SIZE(data);
int ret;
ret = i2c_master_send(i2c, data, count);
if (ret == count)
return 0;
else if (ret < 0)
return ret;
else
return -EIO;
}
static int si521xx_regmap_i2c_read(void *context, unsigned int reg,
unsigned int *val)
{
struct i2c_client *i2c = context;
struct i2c_msg xfer[2];
u8 txdata = reg;
u8 rxdata[2];
int ret;
xfer[0].addr = i2c->addr;
xfer[0].flags = 0;
xfer[0].len = 1;
xfer[0].buf = (void *)&txdata;
xfer[1].addr = i2c->addr;
xfer[1].flags = I2C_M_RD;
xfer[1].len = 2;
xfer[1].buf = (void *)rxdata;
ret = i2c_transfer(i2c->adapter, xfer, 2);
if (ret < 0)
return ret;
if (ret != 2)
return -EIO;
/*
* Byte 0 is transfer length, which is always 1 due
* to BCP register programming to 1 in si521xx_probe(),
* ignore it and use data from Byte 1.
*/
*val = rxdata[1];
return 0;
}
static const struct regmap_config si521xx_regmap_config = {
.reg_bits = 8,
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitrev.h`, `linux/clk-provider.h`, `linux/i2c.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/of.h`, `linux/regmap.h`.
- Detected declarations: `struct si521xx`, `struct si_clk`, `struct si521xx`, `enum si521xx_model`, `function si521xx_regmap_i2c_write`, `function si521xx_regmap_i2c_read`, `function si521xx_diff_recalc_rate`, `function si521xx_diff_determine_rate`, `function si521xx_diff_set_rate`, `function si521xx_diff_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.