drivers/clk/qcom/a53-pll.c
Source file repositories/reference/linux-study-clean/drivers/clk/qcom/a53-pll.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/qcom/a53-pll.c- Extension
.c- Size
- 3858 bytes
- Lines
- 171
- 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/kernel.hlinux/platform_device.hlinux/pm_opp.hlinux/regmap.hlinux/module.hclk-pll.hclk-regmap.h
Detected Declarations
function qcom_a53pll_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Qualcomm A53 PLL driver
*
* Copyright (c) 2017, Linaro Limited
* Author: Georgi Djakov <georgi.djakov@linaro.org>
*/
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/pm_opp.h>
#include <linux/regmap.h>
#include <linux/module.h>
#include "clk-pll.h"
#include "clk-regmap.h"
static const struct pll_freq_tbl a53pll_freq[] = {
{ 998400000, 52, 0x0, 0x1, 0 },
{ 1094400000, 57, 0x0, 0x1, 0 },
{ 1152000000, 62, 0x0, 0x1, 0 },
{ 1209600000, 63, 0x0, 0x1, 0 },
{ 1248000000, 65, 0x0, 0x1, 0 },
{ 1363200000, 71, 0x0, 0x1, 0 },
{ 1401600000, 73, 0x0, 0x1, 0 },
{ }
};
static const struct regmap_config a53pll_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.max_register = 0x40,
};
static struct pll_freq_tbl *qcom_a53pll_get_freq_tbl(struct device *dev)
{
struct pll_freq_tbl *freq_tbl;
unsigned long xo_freq;
unsigned long freq;
struct clk *xo_clk;
int count;
int ret;
int i;
xo_clk = devm_clk_get(dev, "xo");
if (IS_ERR(xo_clk))
return NULL;
xo_freq = clk_get_rate(xo_clk);
ret = devm_pm_opp_of_add_table(dev);
if (ret)
return NULL;
count = dev_pm_opp_get_opp_count(dev);
if (count <= 0)
return NULL;
freq_tbl = devm_kcalloc(dev, count + 1, sizeof(*freq_tbl), GFP_KERNEL);
if (!freq_tbl)
return NULL;
for (i = 0, freq = 0; i < count; i++, freq++) {
struct dev_pm_opp *opp;
opp = dev_pm_opp_find_freq_ceil(dev, &freq);
if (IS_ERR(opp))
return NULL;
/* Skip the freq that is not divisible */
if (freq % xo_freq)
continue;
freq_tbl[i].freq = freq;
freq_tbl[i].l = freq / xo_freq;
freq_tbl[i].n = 1;
dev_pm_opp_put(opp);
}
return freq_tbl;
}
static int qcom_a53pll_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk-provider.h`, `linux/kernel.h`, `linux/platform_device.h`, `linux/pm_opp.h`, `linux/regmap.h`, `linux/module.h`, `clk-pll.h`.
- Detected declarations: `function qcom_a53pll_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.