drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c- Extension
.c- Size
- 28292 bytes
- Lines
- 957
- 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.hlinux/clk-provider.hdsi_phy.hdsi.xml.hdsi_phy_28nm.xml.h
Detected Declarations
struct lpfr_cfgstruct pll_28nm_cached_statestruct dsi_pll_28nmfunction pll_28nm_poll_for_readyfunction pll_28nm_software_resetfunction dsi_pll_28nm_clk_set_ratefunction dsi_pll_28nm_clk_is_enabledfunction dsi_pll_28nm_clk_recalc_ratefunction _dsi_pll_28nm_vco_prepare_hpmfunction dsi_pll_28nm_vco_prepare_hpmfunction dsi_pll_28nm_vco_prepare_8226function dsi_pll_28nm_vco_prepare_lpfunction dsi_pll_28nm_vco_unpreparefunction dsi_pll_28nm_clk_determine_ratefunction dsi_28nm_pll_save_statefunction dsi_28nm_pll_restore_statefunction pll_28nm_registerfunction dsi_pll_28nm_initfunction dsi_28nm_dphy_set_timingfunction dsi_28nm_phy_regulator_enable_dcdcfunction dsi_28nm_phy_regulator_enable_ldofunction dsi_28nm_phy_regulator_ctrlfunction dsi_28nm_phy_enablefunction dsi_28nm_phy_disable
Annotated Snippet
struct lpfr_cfg {
unsigned long vco_rate;
u32 resistance;
};
/* Loop filter resistance: */
static const struct lpfr_cfg lpfr_lut[LPFR_LUT_SIZE] = {
{ 479500000, 8 },
{ 480000000, 11 },
{ 575500000, 8 },
{ 576000000, 12 },
{ 610500000, 8 },
{ 659500000, 9 },
{ 671500000, 10 },
{ 672000000, 14 },
{ 708500000, 10 },
{ 750000000, 11 },
};
struct pll_28nm_cached_state {
unsigned long vco_rate;
u8 postdiv3;
u8 postdiv1;
u8 byte_mux;
};
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,
u32 nb_tries, u32 timeout_us)
{
bool pll_locked = false;
u32 val;
while (nb_tries--) {
val = readl(pll_28nm->phy->pll_base + REG_DSI_28nm_PHY_PLL_STATUS);
pll_locked = !!(val & DSI_28nm_PHY_PLL_STATUS_PLL_RDY);
if (pll_locked)
break;
udelay(timeout_us);
}
DBG("DSI PLL is %slocked", pll_locked ? "" : "*not* ");
return pll_locked;
}
static void pll_28nm_software_reset(struct dsi_pll_28nm *pll_28nm)
{
void __iomem *base = pll_28nm->phy->pll_base;
/*
* Add HW recommended delays after toggling the software
* reset bit off and back on.
*/
writel(DSI_28nm_PHY_PLL_TEST_CFG_PLL_SW_RESET, base + REG_DSI_28nm_PHY_PLL_TEST_CFG);
udelay(1);
writel(0, base + REG_DSI_28nm_PHY_PLL_TEST_CFG);
udelay(1);
}
/*
* 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);
struct device *dev = &pll_28nm->phy->pdev->dev;
void __iomem *base = pll_28nm->phy->pll_base;
unsigned long div_fbx1000, gen_vco_clk;
u32 refclk_cfg, frac_n_mode, frac_n_value;
u32 sdm_cfg0, sdm_cfg1, sdm_cfg2, sdm_cfg3;
u32 cal_cfg10, cal_cfg11;
u32 rem;
int i;
VERB("rate=%lu, parent's=%lu", rate, parent_rate);
/* Force postdiv2 to be div-4 */
writel(3, base + REG_DSI_28nm_PHY_PLL_POSTDIV2_CFG);
Annotation
- Immediate include surface: `dt-bindings/clock/qcom,dsi-phy-28nm.h`, `linux/clk.h`, `linux/clk-provider.h`, `dsi_phy.h`, `dsi.xml.h`, `dsi_phy_28nm.xml.h`.
- Detected declarations: `struct lpfr_cfg`, `struct pll_28nm_cached_state`, `struct dsi_pll_28nm`, `function pll_28nm_poll_for_ready`, `function pll_28nm_software_reset`, `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_hpm`, `function dsi_pll_28nm_vco_prepare_hpm`.
- 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.