drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c- Extension
.c- Size
- 30009 bytes
- Lines
- 1077
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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
subdev/clk.hsubdev/volt.hsubdev/timer.hcore/device.hcore/tegra.hpriv.hgk20a_devfreq.hgk20a.h
Detected Declarations
struct gm20b_clk_dvfs_paramsstruct gm20b_pllstruct gm20b_clk_dvfsstruct gm20b_clkfunction pl_to_divfunction div_to_plfunction gm20b_pllg_read_mnpfunction gm20b_pllg_write_mnpfunction gm20b_dvfs_calc_det_coefffunction gm20b_dvfs_calc_ndivfunction gm20b_pllg_slidefunction gm20b_pllg_enablefunction gm20b_pllg_disablefunction gm20b_pllg_program_mnpfunction gm20b_pllg_program_mnp_slidefunction gm20b_clk_calcfunction gm20b_dvfs_calc_safe_pllfunction gm20b_dvfs_program_coefffunction gm20b_dvfs_program_ext_calfunction gm20b_dvfs_program_dfs_detectionfunction gm20b_clk_progfunction gm20b_clk_finifunction gm20b_clk_init_dvfsfunction gm20b_clk_initfunction gm20b_clk_new_speedo0function gm20b_clk_init_fused_paramsfunction gm20b_clk_init_safe_fmaxfunction gm20b_clk_new
Annotated Snippet
struct gm20b_clk_dvfs_params {
s32 coeff_slope;
s32 coeff_offs;
u32 vco_ctrl;
};
static const struct gm20b_clk_dvfs_params gm20b_dvfs_params = {
.coeff_slope = -165230,
.coeff_offs = 214007,
.vco_ctrl = 0x7 << 3,
};
/*
* base.n is now the *integer* part of the N factor.
* sdm_din contains n's decimal part.
*/
struct gm20b_pll {
struct gk20a_pll base;
u32 sdm_din;
};
struct gm20b_clk_dvfs {
u32 dfs_coeff;
s32 dfs_det_max;
s32 dfs_ext_cal;
};
struct gm20b_clk {
/* currently applied parameters */
struct gk20a_clk base;
struct gm20b_clk_dvfs dvfs;
u32 uv;
/* new parameters to apply */
struct gk20a_pll new_pll;
struct gm20b_clk_dvfs new_dvfs;
u32 new_uv;
const struct gm20b_clk_dvfs_params *dvfs_params;
/* fused parameters */
s32 uvdet_slope;
s32 uvdet_offs;
/* safe frequency we can use at minimum voltage */
u32 safe_fmax_vmin;
};
#define gm20b_clk(p) container_of((gk20a_clk(p)), struct gm20b_clk, base)
static u32 pl_to_div(u32 pl)
{
return pl;
}
static u32 div_to_pl(u32 div)
{
return div;
}
static const struct gk20a_clk_pllg_params gm20b_pllg_params = {
.min_vco = 1300000, .max_vco = 2600000,
.min_u = 12000, .max_u = 38400,
.min_m = 1, .max_m = 255,
.min_n = 8, .max_n = 255,
.min_pl = 1, .max_pl = 31,
};
static void
gm20b_pllg_read_mnp(struct gm20b_clk *clk, struct gm20b_pll *pll)
{
struct nvkm_subdev *subdev = &clk->base.base.subdev;
struct nvkm_device *device = subdev->device;
u32 val;
gk20a_pllg_read_mnp(&clk->base, &pll->base);
val = nvkm_rd32(device, GPCPLL_CFG2);
pll->sdm_din = (val >> GPCPLL_CFG2_SDM_DIN_SHIFT) &
MASK(GPCPLL_CFG2_SDM_DIN_WIDTH);
}
static void
gm20b_pllg_write_mnp(struct gm20b_clk *clk, const struct gm20b_pll *pll)
{
struct nvkm_device *device = clk->base.base.subdev.device;
nvkm_mask(device, GPCPLL_CFG2, GPCPLL_CFG2_SDM_DIN_MASK,
pll->sdm_din << GPCPLL_CFG2_SDM_DIN_SHIFT);
gk20a_pllg_write_mnp(&clk->base, &pll->base);
}
Annotation
- Immediate include surface: `subdev/clk.h`, `subdev/volt.h`, `subdev/timer.h`, `core/device.h`, `core/tegra.h`, `priv.h`, `gk20a_devfreq.h`, `gk20a.h`.
- Detected declarations: `struct gm20b_clk_dvfs_params`, `struct gm20b_pll`, `struct gm20b_clk_dvfs`, `struct gm20b_clk`, `function pl_to_div`, `function div_to_pl`, `function gm20b_pllg_read_mnp`, `function gm20b_pllg_write_mnp`, `function gm20b_dvfs_calc_det_coeff`, `function gm20b_dvfs_calc_ndiv`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.