drivers/gpu/drm/i915/display/intel_snps_phy.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_snps_phy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_snps_phy.c- Extension
.c- Size
- 72370 bytes
- Lines
- 2029
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/math.hdrm/drm_print.hintel_ddi.hintel_ddi_buf_trans.hintel_de.hintel_display_regs.hintel_display_types.hintel_display_utils.hintel_snps_hdmi_pll.hintel_snps_phy.hintel_snps_phy_regs.h
Detected Declarations
function intel_snps_phy_wait_for_calibrationfunction for_each_phy_maskedfunction intel_snps_phy_update_psr_power_statefunction intel_snps_phy_set_signal_levelsfunction intel_mpllb_tables_getfunction intel_mpllb_calc_statefunction intel_mpllb_enablefunction bxt_set_cdclkfunction bxt_set_cdclkfunction intel_mpllb_readout_hw_statefunction intel_mpllb_state_verify
Annotated Snippet
if (crtc_state->port_clock == tables[i]->clock) {
crtc_state->dpll_hw_state.mpllb = *tables[i];
return 0;
}
}
/* For HDMI PLLs try SNPS PHY algorithm, if there are no precomputed tables */
if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
intel_snps_hdmi_pll_compute_mpllb(&crtc_state->dpll_hw_state.mpllb,
crtc_state->port_clock);
return 0;
}
return -EINVAL;
}
void intel_mpllb_enable(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state)
{
struct intel_display *display = to_intel_display(encoder);
const struct intel_mpllb_state *pll_state = &crtc_state->dpll_hw_state.mpllb;
enum phy phy = intel_encoder_to_phy(encoder);
intel_reg_t enable_reg = (phy <= PHY_D ?
DG2_PLL_ENABLE(phy) : MG_PLL_ENABLE(0));
/*
* 3. Software programs the following PLL registers for the desired
* frequency.
*/
intel_de_write(display, SNPS_PHY_MPLLB_CP(phy), pll_state->mpllb_cp);
intel_de_write(display, SNPS_PHY_MPLLB_DIV(phy), pll_state->mpllb_div);
intel_de_write(display, SNPS_PHY_MPLLB_DIV2(phy), pll_state->mpllb_div2);
intel_de_write(display, SNPS_PHY_MPLLB_SSCEN(phy), pll_state->mpllb_sscen);
intel_de_write(display, SNPS_PHY_MPLLB_SSCSTEP(phy), pll_state->mpllb_sscstep);
intel_de_write(display, SNPS_PHY_MPLLB_FRACN1(phy), pll_state->mpllb_fracn1);
intel_de_write(display, SNPS_PHY_MPLLB_FRACN2(phy), pll_state->mpllb_fracn2);
/*
* 4. If the frequency will result in a change to the voltage
* requirement, follow the Display Voltage Frequency Switching -
* Sequence Before Frequency Change.
*
* We handle this step in bxt_set_cdclk().
*/
/* 5. Software sets DPLL_ENABLE [PLL Enable] to "1". */
intel_de_rmw(display, enable_reg, 0, PLL_ENABLE);
/*
* 9. Software sets SNPS_PHY_MPLLB_DIV dp_mpllb_force_en to "1". This
* will keep the PLL running during the DDI lane programming and any
* typeC DP cable disconnect. Do not set the force before enabling the
* PLL because that will start the PLL before it has sampled the
* divider values.
*/
intel_de_write(display, SNPS_PHY_MPLLB_DIV(phy),
pll_state->mpllb_div | SNPS_PHY_MPLLB_FORCE_EN);
/*
* 10. Software polls on register DPLL_ENABLE [PLL Lock] to confirm PLL
* is locked at new settings. This register bit is sampling PHY
* dp_mpllb_state interface signal.
*/
if (intel_de_wait_for_set_ms(display, enable_reg, PLL_LOCK, 5))
drm_dbg_kms(display->drm, "Port %c PLL not locked\n", phy_name(phy));
/*
* 11. If the frequency will result in a change to the voltage
* requirement, follow the Display Voltage Frequency Switching -
* Sequence After Frequency Change.
*
* We handle this step in bxt_set_cdclk().
*/
}
void intel_mpllb_disable(struct intel_encoder *encoder)
{
struct intel_display *display = to_intel_display(encoder);
enum phy phy = intel_encoder_to_phy(encoder);
intel_reg_t enable_reg = (phy <= PHY_D ?
DG2_PLL_ENABLE(phy) : MG_PLL_ENABLE(0));
/*
* 1. If the frequency will result in a change to the voltage
* requirement, follow the Display Voltage Frequency Switching -
* Sequence Before Frequency Change.
*
* We handle this step in bxt_set_cdclk().
*/
Annotation
- Immediate include surface: `linux/math.h`, `drm/drm_print.h`, `intel_ddi.h`, `intel_ddi_buf_trans.h`, `intel_de.h`, `intel_display_regs.h`, `intel_display_types.h`, `intel_display_utils.h`.
- Detected declarations: `function intel_snps_phy_wait_for_calibration`, `function for_each_phy_masked`, `function intel_snps_phy_update_psr_power_state`, `function intel_snps_phy_set_signal_levels`, `function intel_mpllb_tables_get`, `function intel_mpllb_calc_state`, `function intel_mpllb_enable`, `function bxt_set_cdclk`, `function bxt_set_cdclk`, `function intel_mpllb_readout_hw_state`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.