drivers/clk/qcom/videocc-sm7150.c

Source file repositories/reference/linux-study-clean/drivers/clk/qcom/videocc-sm7150.c

File Facts

System
Linux kernel
Corpus path
drivers/clk/qcom/videocc-sm7150.c
Extension
.c
Size
8875 bytes
Lines
358
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.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2024, Danila Tikhonov <danila@jiaxyga.com>
 */

#include <linux/clk-provider.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>

#include <dt-bindings/clock/qcom,sm7150-videocc.h>

#include "common.h"
#include "clk-alpha-pll.h"
#include "clk-branch.h"
#include "clk-rcg.h"
#include "clk-regmap.h"
#include "clk-pll.h"
#include "gdsc.h"

enum {
	DT_BI_TCXO,
	DT_BI_TCXO_AO,
};

enum {
	P_BI_TCXO,
	P_VIDEOCC_PLL0_OUT_EVEN,
	P_VIDEOCC_PLL0_OUT_MAIN,
	P_VIDEOCC_PLL0_OUT_ODD,
};

static const struct pll_vco fabia_vco[] = {
	{ 249600000, 2000000000, 0 },
	{ 125000000, 1000000000, 1 },
};

static struct alpha_pll_config videocc_pll0_config = {
	.l = 0x19,
	.alpha = 0x0,
	.config_ctl_val = 0x20485699,
	.config_ctl_hi_val = 0x00002067,
	.user_ctl_val = 0x00000001,
	.user_ctl_hi_val = 0x00004805,
	.test_ctl_hi_val = 0x40000000,
};

static struct clk_alpha_pll videocc_pll0 = {
	.offset = 0x42c,
	.vco_table = fabia_vco,
	.num_vco = ARRAY_SIZE(fabia_vco),
	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
	.clkr = {
		.hw.init = &(const struct clk_init_data) {
			.name = "videocc_pll0",
			.parent_data = &(const struct clk_parent_data) {
				.index = DT_BI_TCXO,
			},
			.num_parents = 1,
			.ops = &clk_alpha_pll_fabia_ops,
		},
	},
};

static const struct parent_map videocc_parent_map_0[] = {
	{ P_BI_TCXO, 0 },
	{ P_VIDEOCC_PLL0_OUT_MAIN, 1 },
	{ P_VIDEOCC_PLL0_OUT_EVEN, 2 },
	{ P_VIDEOCC_PLL0_OUT_ODD, 3 },
};

static const struct clk_parent_data videocc_parent_data_0[] = {
	{ .index = DT_BI_TCXO },
	{ .hw = &videocc_pll0.clkr.hw },
	{ .hw = &videocc_pll0.clkr.hw },
	{ .hw = &videocc_pll0.clkr.hw },
};

static const struct parent_map videocc_parent_map_1[] = {
	{ P_BI_TCXO, 0 },
};

static const struct clk_parent_data videocc_parent_data_1[] = {
	{ .index = DT_BI_TCXO_AO },
};

static const struct freq_tbl ftbl_videocc_iris_clk_src[] = {
	F(240000000, P_VIDEOCC_PLL0_OUT_MAIN, 2, 0, 0),

Annotation

Implementation Notes