Commit 396a1200 authored by Paulo Zanoni's avatar Paulo Zanoni

drm/i915: simplify intel_ddi_pll_select()

Because {hsw,skl,bxt}_ddi_pll_select all pretty much do the same thing
in slightly different ways. Replace everything with a simple copy of
the function and inline it inside intle_ddi_pll_select().

v2: s/return pll/return pll != NULL/ (Ville)
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1490209125-20046-1-git-send-email-paulo.r.zanoni@intel.com
parent 8cbeb06d
...@@ -1127,47 +1127,6 @@ void intel_ddi_clock_get(struct intel_encoder *encoder, ...@@ -1127,47 +1127,6 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
bxt_ddi_clock_get(encoder, pipe_config); bxt_ddi_clock_get(encoder, pipe_config);
} }
static bool
hsw_ddi_pll_select(struct intel_crtc *intel_crtc,
struct intel_crtc_state *crtc_state,
struct intel_encoder *encoder)
{
struct intel_shared_dpll *pll;
pll = intel_get_shared_dpll(intel_crtc, crtc_state,
encoder);
if (!pll)
DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
pipe_name(intel_crtc->pipe));
return pll;
}
static bool
skl_ddi_pll_select(struct intel_crtc *intel_crtc,
struct intel_crtc_state *crtc_state,
struct intel_encoder *encoder)
{
struct intel_shared_dpll *pll;
pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
if (pll == NULL) {
DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
pipe_name(intel_crtc->pipe));
return false;
}
return true;
}
static bool
bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
struct intel_crtc_state *crtc_state,
struct intel_encoder *encoder)
{
return !!intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
}
/* /*
* Tries to find a *shared* PLL for the CRTC and store it in * Tries to find a *shared* PLL for the CRTC and store it in
* intel_crtc->ddi_pll_sel. * intel_crtc->ddi_pll_sel.
...@@ -1178,19 +1137,16 @@ bxt_ddi_pll_select(struct intel_crtc *intel_crtc, ...@@ -1178,19 +1137,16 @@ bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
bool intel_ddi_pll_select(struct intel_crtc *intel_crtc, bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
struct intel_crtc_state *crtc_state) struct intel_crtc_state *crtc_state)
{ {
struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
struct intel_encoder *encoder = struct intel_encoder *encoder =
intel_ddi_get_crtc_new_encoder(crtc_state); intel_ddi_get_crtc_new_encoder(crtc_state);
struct intel_shared_dpll *pll;
if (IS_GEN9_BC(dev_priv)) pll = intel_get_shared_dpll(intel_crtc, crtc_state, encoder);
return skl_ddi_pll_select(intel_crtc, crtc_state, if (!pll)
encoder); DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
else if (IS_GEN9_LP(dev_priv)) pipe_name(intel_crtc->pipe));
return bxt_ddi_pll_select(intel_crtc, crtc_state,
encoder); return pll != NULL;
else
return hsw_ddi_pll_select(intel_crtc, crtc_state,
encoder);
} }
void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state) void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment