drivers/clk/clk-max77686.c
Source file repositories/reference/linux-study-clean/drivers/clk/clk-max77686.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/clk-max77686.c- Extension
.c- Size
- 7328 bytes
- Lines
- 293
- 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/kernel.hlinux/slab.hlinux/err.hlinux/module.hlinux/platform_device.hlinux/mfd/max77620.hlinux/mfd/max77686.hlinux/mfd/max77686-private.hlinux/clk-provider.hlinux/mutex.hlinux/clkdev.hlinux/of.hlinux/regmap.hdt-bindings/clock/maxim,max77686.hdt-bindings/clock/maxim,max77802.hdt-bindings/clock/maxim,max77620.h
Detected Declarations
struct max77686_hw_clk_infostruct max77686_clk_init_datastruct max77686_clk_driver_dataenum max77686_chip_namefunction max77686_clk_preparefunction max77686_clk_unpreparefunction max77686_clk_is_preparedfunction max77686_recalc_ratefunction of_clk_max77686_getfunction max77686_clk_probe
Annotated Snippet
struct max77686_hw_clk_info {
const char *name;
u32 clk_reg;
u32 clk_enable_mask;
u32 flags;
};
struct max77686_clk_init_data {
struct regmap *regmap;
struct clk_hw hw;
struct clk_init_data clk_idata;
const struct max77686_hw_clk_info *clk_info;
};
struct max77686_clk_driver_data {
enum max77686_chip_name chip;
struct max77686_clk_init_data *max_clk_data;
size_t num_clks;
};
static const struct
max77686_hw_clk_info max77686_hw_clks_info[MAX77686_CLKS_NUM] = {
[MAX77686_CLK_AP] = {
.name = "32khz_ap",
.clk_reg = MAX77686_REG_32KHZ,
.clk_enable_mask = BIT(MAX77686_CLK_AP),
},
[MAX77686_CLK_CP] = {
.name = "32khz_cp",
.clk_reg = MAX77686_REG_32KHZ,
.clk_enable_mask = BIT(MAX77686_CLK_CP),
},
[MAX77686_CLK_PMIC] = {
.name = "32khz_pmic",
.clk_reg = MAX77686_REG_32KHZ,
.clk_enable_mask = BIT(MAX77686_CLK_PMIC),
},
};
static const struct
max77686_hw_clk_info max77802_hw_clks_info[MAX77802_CLKS_NUM] = {
[MAX77802_CLK_32K_AP] = {
.name = "32khz_ap",
.clk_reg = MAX77802_REG_32KHZ,
.clk_enable_mask = BIT(MAX77802_CLK_32K_AP),
},
[MAX77802_CLK_32K_CP] = {
.name = "32khz_cp",
.clk_reg = MAX77802_REG_32KHZ,
.clk_enable_mask = BIT(MAX77802_CLK_32K_CP),
},
};
static const struct
max77686_hw_clk_info max77620_hw_clks_info[MAX77620_CLKS_NUM] = {
[MAX77620_CLK_32K_OUT0] = {
.name = "32khz_out0",
.clk_reg = MAX77620_REG_CNFG1_32K,
.clk_enable_mask = MAX77620_CNFG1_32K_OUT0_EN,
},
};
static struct max77686_clk_init_data *to_max77686_clk_init_data(
struct clk_hw *hw)
{
return container_of(hw, struct max77686_clk_init_data, hw);
}
static int max77686_clk_prepare(struct clk_hw *hw)
{
struct max77686_clk_init_data *max77686 = to_max77686_clk_init_data(hw);
return regmap_update_bits(max77686->regmap, max77686->clk_info->clk_reg,
max77686->clk_info->clk_enable_mask,
max77686->clk_info->clk_enable_mask);
}
static void max77686_clk_unprepare(struct clk_hw *hw)
{
struct max77686_clk_init_data *max77686 = to_max77686_clk_init_data(hw);
regmap_update_bits(max77686->regmap, max77686->clk_info->clk_reg,
max77686->clk_info->clk_enable_mask,
~max77686->clk_info->clk_enable_mask);
}
static int max77686_clk_is_prepared(struct clk_hw *hw)
{
struct max77686_clk_init_data *max77686 = to_max77686_clk_init_data(hw);
int ret;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/err.h`, `linux/module.h`, `linux/platform_device.h`, `linux/mfd/max77620.h`, `linux/mfd/max77686.h`, `linux/mfd/max77686-private.h`.
- Detected declarations: `struct max77686_hw_clk_info`, `struct max77686_clk_init_data`, `struct max77686_clk_driver_data`, `enum max77686_chip_name`, `function max77686_clk_prepare`, `function max77686_clk_unprepare`, `function max77686_clk_is_prepared`, `function max77686_recalc_rate`, `function of_clk_max77686_get`, `function max77686_clk_probe`.
- 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.