drivers/gpu/drm/i915/display/intel_dpll_mgr.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_dpll_mgr.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/i915/display/intel_dpll_mgr.c
Extension
.c
Size
149878 bytes
Lines
5191
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct intel_dpll_funcs {
	/*
	 * Hook for enabling the pll, called from intel_enable_dpll() if
	 * the pll is not already enabled.
	 */
	void (*enable)(struct intel_display *display,
		       struct intel_dpll *pll,
		       const struct intel_dpll_hw_state *dpll_hw_state);

	/*
	 * Hook for disabling the pll, called from intel_disable_dpll()
	 * only when it is safe to disable the pll, i.e., there are no more
	 * tracked users for it.
	 */
	void (*disable)(struct intel_display *display,
			struct intel_dpll *pll);

	/*
	 * Hook for reading the values currently programmed to the DPLL
	 * registers. This is used for initial hw state readout and state
	 * verification after a mode set.
	 */
	bool (*get_hw_state)(struct intel_display *display,
			     struct intel_dpll *pll,
			     struct intel_dpll_hw_state *dpll_hw_state);

	/*
	 * Hook for calculating the pll's output frequency based on its passed
	 * in state.
	 */
	int (*get_freq)(struct intel_display *i915,
			const struct intel_dpll *pll,
			const struct intel_dpll_hw_state *dpll_hw_state);
};

struct intel_dpll_mgr {
	const struct dpll_info *dpll_info;

	int (*compute_dplls)(struct intel_atomic_state *state,
			     struct intel_crtc *crtc,
			     struct intel_encoder *encoder);
	int (*get_dplls)(struct intel_atomic_state *state,
			 struct intel_crtc *crtc,
			 struct intel_encoder *encoder);
	void (*put_dplls)(struct intel_atomic_state *state,
			  struct intel_crtc *crtc);
	void (*update_active_dpll)(struct intel_atomic_state *state,
				   struct intel_crtc *crtc,
				   struct intel_encoder *encoder);
	void (*update_ref_clks)(struct intel_display *display);
	void (*dump_hw_state)(struct drm_printer *p,
			      const struct intel_dpll_hw_state *dpll_hw_state);
	bool (*compare_hw_state)(const struct intel_dpll_hw_state *a,
				 const struct intel_dpll_hw_state *b);
};

static void
intel_atomic_duplicate_dpll_state(struct intel_display *display,
				  struct intel_dpll_state *dpll_state)
{
	struct intel_dpll *pll;
	int i;

	/* Copy dpll state */
	for_each_dpll(display, pll, i)
		dpll_state[pll->index] = pll->state;
}

static struct intel_dpll_state *
intel_atomic_get_dpll_state(struct drm_atomic_commit *s)
{
	struct intel_atomic_state *state = to_intel_atomic_state(s);
	struct intel_display *display = to_intel_display(state);

	drm_WARN_ON(s->dev, !drm_modeset_is_locked(&s->dev->mode_config.connection_mutex));

	if (!state->dpll_set) {
		state->dpll_set = true;

		intel_atomic_duplicate_dpll_state(display,
						  state->dpll_state);
	}

	return state->dpll_state;
}

/**
 * intel_get_dpll_by_id - get a DPLL given its id
 * @display: intel_display device instance
 * @id: pll id

Annotation

Implementation Notes