Commit eebe6f0b authored by Daniel Vetter's avatar Daniel Vetter

drm/i915/crt: use native encoder->mode_set callback

Also drop the intel_ prefix from the local intel_crtc variable and
reorder the upcast macros a bit for more reuse.
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent cd91ef23
...@@ -52,15 +52,14 @@ struct intel_crt { ...@@ -52,15 +52,14 @@ struct intel_crt {
u32 adpa_reg; u32 adpa_reg;
}; };
static struct intel_crt *intel_attached_crt(struct drm_connector *connector) static struct intel_crt *intel_encoder_to_crt(struct intel_encoder *encoder)
{ {
return container_of(intel_attached_encoder(connector), return container_of(encoder, struct intel_crt, base);
struct intel_crt, base);
} }
static struct intel_crt *intel_encoder_to_crt(struct intel_encoder *encoder) static struct intel_crt *intel_attached_crt(struct drm_connector *connector)
{ {
return container_of(encoder, struct intel_crt, base); return intel_encoder_to_crt(intel_attached_encoder(connector));
} }
static bool intel_crt_get_hw_state(struct intel_encoder *encoder, static bool intel_crt_get_hw_state(struct intel_encoder *encoder,
...@@ -238,17 +237,14 @@ static bool intel_crt_compute_config(struct intel_encoder *encoder, ...@@ -238,17 +237,14 @@ static bool intel_crt_compute_config(struct intel_encoder *encoder,
return true; return true;
} }
static void intel_crt_mode_set(struct drm_encoder *encoder, static void intel_crt_mode_set(struct intel_encoder *encoder)
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->base.dev;
struct drm_crtc *crtc = encoder->crtc; struct intel_crt *crt = intel_encoder_to_crt(encoder);
struct intel_crt *crt = struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
intel_encoder_to_crt(to_intel_encoder(encoder));
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;
u32 adpa; u32 adpa;
if (HAS_PCH_SPLIT(dev)) if (HAS_PCH_SPLIT(dev))
...@@ -265,14 +261,14 @@ static void intel_crt_mode_set(struct drm_encoder *encoder, ...@@ -265,14 +261,14 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
if (HAS_PCH_LPT(dev)) if (HAS_PCH_LPT(dev))
; /* Those bits don't exist here */ ; /* Those bits don't exist here */
else if (HAS_PCH_CPT(dev)) else if (HAS_PCH_CPT(dev))
adpa |= PORT_TRANS_SEL_CPT(intel_crtc->pipe); adpa |= PORT_TRANS_SEL_CPT(crtc->pipe);
else if (intel_crtc->pipe == 0) else if (crtc->pipe == 0)
adpa |= ADPA_PIPE_A_SELECT; adpa |= ADPA_PIPE_A_SELECT;
else else
adpa |= ADPA_PIPE_B_SELECT; adpa |= ADPA_PIPE_B_SELECT;
if (!HAS_PCH_SPLIT(dev)) if (!HAS_PCH_SPLIT(dev))
I915_WRITE(BCLRPAT(intel_crtc->pipe), 0); I915_WRITE(BCLRPAT(crtc->pipe), 0);
I915_WRITE(crt->adpa_reg, adpa); I915_WRITE(crt->adpa_reg, adpa);
} }
...@@ -711,10 +707,6 @@ static void intel_crt_reset(struct drm_connector *connector) ...@@ -711,10 +707,6 @@ static void intel_crt_reset(struct drm_connector *connector)
* Routines for controlling stuff on the analog port * Routines for controlling stuff on the analog port
*/ */
static const struct drm_encoder_helper_funcs crt_encoder_funcs = {
.mode_set = intel_crt_mode_set,
};
static const struct drm_connector_funcs intel_crt_connector_funcs = { static const struct drm_connector_funcs intel_crt_connector_funcs = {
.reset = intel_crt_reset, .reset = intel_crt_reset,
.dpms = intel_crt_dpms, .dpms = intel_crt_dpms,
...@@ -804,6 +796,7 @@ void intel_crt_init(struct drm_device *dev) ...@@ -804,6 +796,7 @@ void intel_crt_init(struct drm_device *dev)
crt->adpa_reg = ADPA; crt->adpa_reg = ADPA;
crt->base.compute_config = intel_crt_compute_config; crt->base.compute_config = intel_crt_compute_config;
crt->base.mode_set = intel_crt_mode_set;
crt->base.disable = intel_disable_crt; crt->base.disable = intel_disable_crt;
crt->base.enable = intel_enable_crt; crt->base.enable = intel_enable_crt;
crt->base.get_config = intel_crt_get_config; crt->base.get_config = intel_crt_get_config;
...@@ -815,7 +808,6 @@ void intel_crt_init(struct drm_device *dev) ...@@ -815,7 +808,6 @@ void intel_crt_init(struct drm_device *dev)
crt->base.get_hw_state = intel_crt_get_hw_state; crt->base.get_hw_state = intel_crt_get_hw_state;
intel_connector->get_hw_state = intel_connector_get_hw_state; intel_connector->get_hw_state = intel_connector_get_hw_state;
drm_encoder_helper_add(&crt->base.base, &crt_encoder_funcs);
drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
......
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