drivers/clk/qcom/common.c
Source file repositories/reference/linux-study-clean/drivers/clk/qcom/common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/qcom/common.c- Extension
.c- Size
- 10838 bytes
- Lines
- 469
- Domain
- Driver Families
- Bucket
- drivers/clk
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/export.hlinux/module.hlinux/regmap.hlinux/platform_device.hlinux/clk-provider.hlinux/interconnect-clk.hlinux/pm_runtime.hlinux/reset-controller.hlinux/of.hcommon.hclk-alpha-pll.hclk-branch.hclk-rcg.hclk-regmap.hreset.hgdsc.h
Detected Declarations
struct qcom_ccfunction qcom_find_src_indexfunction qcom_find_cfg_indexfunction qcom_cc_mapfunction qcom_pll_set_fsm_modefunction qcom_cc_gdsc_unregisterfunction _qcom_cc_register_board_clkfunction qcom_cc_register_board_clkfunction qcom_cc_register_sleep_clkfunction qcom_cc_drop_protectedfunction of_property_for_each_u32function qcom_cc_icc_registerfunction qcom_cc_clk_pll_configurefunction qcom_cc_clk_regs_configurefunction qcom_cc_really_probefunction qcom_cc_probefunction qcom_cc_probe_by_indexexport qcom_find_freqexport qcom_find_freq_multiexport qcom_find_freq_floorexport qcom_find_src_indexexport qcom_find_cfg_indexexport qcom_cc_mapexport qcom_pll_set_fsm_modeexport qcom_cc_register_board_clkexport qcom_cc_register_sleep_clkexport qcom_cc_really_probeexport qcom_cc_probeexport qcom_cc_probe_by_index
Annotated Snippet
struct qcom_cc {
struct qcom_reset_controller reset;
struct clk_regmap **rclks;
size_t num_rclks;
struct dev_pm_domain_list *pd_list;
};
const
struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate)
{
if (!f)
return NULL;
if (!f->freq)
return f;
for (; f->freq; f++)
if (rate <= f->freq)
return f;
/* Default to our fastest rate */
return f - 1;
}
EXPORT_SYMBOL_GPL(qcom_find_freq);
const struct freq_multi_tbl *qcom_find_freq_multi(const struct freq_multi_tbl *f,
unsigned long rate)
{
if (!f)
return NULL;
if (!f->freq)
return f;
for (; f->freq; f++)
if (rate <= f->freq)
return f;
/* Default to our fastest rate */
return f - 1;
}
EXPORT_SYMBOL_GPL(qcom_find_freq_multi);
const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f,
unsigned long rate)
{
const struct freq_tbl *best = NULL;
for ( ; f->freq; f++) {
if (rate >= f->freq)
best = f;
else
break;
}
return best;
}
EXPORT_SYMBOL_GPL(qcom_find_freq_floor);
int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, u8 src)
{
int i, num_parents = clk_hw_get_num_parents(hw);
for (i = 0; i < num_parents; i++)
if (src == map[i].src)
return i;
return -ENOENT;
}
EXPORT_SYMBOL_GPL(qcom_find_src_index);
int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, u8 cfg)
{
int i, num_parents = clk_hw_get_num_parents(hw);
for (i = 0; i < num_parents; i++)
if (cfg == map[i].cfg)
return i;
return -ENOENT;
}
EXPORT_SYMBOL_GPL(qcom_find_cfg_index);
struct regmap *
qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc)
{
void __iomem *base;
struct device *dev = &pdev->dev;
base = devm_platform_ioremap_resource(pdev, 0);
Annotation
- Immediate include surface: `linux/export.h`, `linux/module.h`, `linux/regmap.h`, `linux/platform_device.h`, `linux/clk-provider.h`, `linux/interconnect-clk.h`, `linux/pm_runtime.h`, `linux/reset-controller.h`.
- Detected declarations: `struct qcom_cc`, `function qcom_find_src_index`, `function qcom_find_cfg_index`, `function qcom_cc_map`, `function qcom_pll_set_fsm_mode`, `function qcom_cc_gdsc_unregister`, `function _qcom_cc_register_board_clk`, `function qcom_cc_register_board_clk`, `function qcom_cc_register_sleep_clk`, `function qcom_cc_drop_protected`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: integration 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.