drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c- Extension
.c- Size
- 18748 bytes
- Lines
- 649
- 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
dt-bindings/clock/qcom,dsi-phy-28nm.hlinux/clk-provider.hlinux/delay.hdsi_phy.hdsi.xml.hdsi_phy_28nm_8960.xml.h
Detected Declarations
struct pll_28nm_cached_statestruct clk_bytedivstruct dsi_pll_28nmfunction pll_28nm_poll_for_readyfunction dsi_pll_28nm_clk_set_ratefunction dsi_pll_28nm_clk_is_enabledfunction dsi_pll_28nm_clk_recalc_ratefunction dsi_pll_28nm_vco_preparefunction dsi_pll_28nm_vco_unpreparefunction dsi_pll_28nm_clk_determine_ratefunction parentfunction get_vco_mul_factorfunction clk_bytediv_determine_ratefunction clk_bytediv_set_ratefunction dsi_28nm_pll_save_statefunction dsi_28nm_pll_restore_statefunction pll_28nm_registerfunction dsi_pll_28nm_8960_initfunction dsi_28nm_dphy_set_timingfunction dsi_28nm_phy_regulator_initfunction dsi_28nm_phy_regulator_ctrlfunction dsi_28nm_phy_calibrationfunction dsi_28nm_phy_lane_configfunction dsi_28nm_phy_enablefunction dsi_28nm_phy_disable
Annotated Snippet
struct pll_28nm_cached_state {
unsigned long vco_rate;
u8 postdiv3;
u8 postdiv2;
u8 postdiv1;
};
struct clk_bytediv {
struct clk_hw hw;
void __iomem *reg;
};
struct dsi_pll_28nm {
struct clk_hw clk_hw;
struct msm_dsi_phy *phy;
struct pll_28nm_cached_state cached_state;
};
#define to_pll_28nm(x) container_of(x, struct dsi_pll_28nm, clk_hw)
static bool pll_28nm_poll_for_ready(struct dsi_pll_28nm *pll_28nm,
int nb_tries, int timeout_us)
{
bool pll_locked = false;
u32 val;
while (nb_tries--) {
val = readl(pll_28nm->phy->pll_base + REG_DSI_28nm_8960_PHY_PLL_RDY);
pll_locked = !!(val & DSI_28nm_8960_PHY_PLL_RDY_PLL_RDY);
if (pll_locked)
break;
udelay(timeout_us);
}
DBG("DSI PLL is %slocked", pll_locked ? "" : "*not* ");
return pll_locked;
}
/*
* Clock Callbacks
*/
static int dsi_pll_28nm_clk_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct dsi_pll_28nm *pll_28nm = to_pll_28nm(hw);
void __iomem *base = pll_28nm->phy->pll_base;
u32 val, temp, fb_divider;
DBG("rate=%lu, parent's=%lu", rate, parent_rate);
temp = rate / 10;
val = VCO_REF_CLK_RATE / 10;
fb_divider = (temp * VCO_PREF_DIV_RATIO) / val;
fb_divider = fb_divider / 2 - 1;
writel(fb_divider & 0xff, base + REG_DSI_28nm_8960_PHY_PLL_CTRL_1);
val = readl(base + REG_DSI_28nm_8960_PHY_PLL_CTRL_2);
val |= (fb_divider >> 8) & 0x07;
writel(val, base + REG_DSI_28nm_8960_PHY_PLL_CTRL_2);
val = readl(base + REG_DSI_28nm_8960_PHY_PLL_CTRL_3);
val |= (VCO_PREF_DIV_RATIO - 1) & 0x3f;
writel(val, base + REG_DSI_28nm_8960_PHY_PLL_CTRL_3);
writel(0xf, base + REG_DSI_28nm_8960_PHY_PLL_CTRL_6);
val = readl(base + REG_DSI_28nm_8960_PHY_PLL_CTRL_8);
val |= 0x7 << 4;
writel(val, base + REG_DSI_28nm_8960_PHY_PLL_CTRL_8);
return 0;
}
static int dsi_pll_28nm_clk_is_enabled(struct clk_hw *hw)
{
struct dsi_pll_28nm *pll_28nm = to_pll_28nm(hw);
return pll_28nm_poll_for_ready(pll_28nm, POLL_MAX_READS,
POLL_TIMEOUT_US);
}
static unsigned long dsi_pll_28nm_clk_recalc_rate(struct clk_hw *hw,
Annotation
- Immediate include surface: `dt-bindings/clock/qcom,dsi-phy-28nm.h`, `linux/clk-provider.h`, `linux/delay.h`, `dsi_phy.h`, `dsi.xml.h`, `dsi_phy_28nm_8960.xml.h`.
- Detected declarations: `struct pll_28nm_cached_state`, `struct clk_bytediv`, `struct dsi_pll_28nm`, `function pll_28nm_poll_for_ready`, `function dsi_pll_28nm_clk_set_rate`, `function dsi_pll_28nm_clk_is_enabled`, `function dsi_pll_28nm_clk_recalc_rate`, `function dsi_pll_28nm_vco_prepare`, `function dsi_pll_28nm_vco_unprepare`, `function dsi_pll_28nm_clk_determine_rate`.
- 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.