Commit 28694070 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

drm/i915: Use intel_panel for DVO fixed mode handling

Replace intel_dvo->panel_fixed_mode with the appropriate intel_panel
stuff. Now all connectors that have a fixed mode use intel_panel.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarMika Kahola <mika.kahola@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 08aef7ca
...@@ -97,7 +97,8 @@ struct intel_dvo { ...@@ -97,7 +97,8 @@ struct intel_dvo {
struct intel_dvo_device dev; struct intel_dvo_device dev;
struct drm_display_mode *panel_fixed_mode; struct intel_connector *attached_connector;
bool panel_wants_dither; bool panel_wants_dither;
}; };
...@@ -201,6 +202,8 @@ intel_dvo_mode_valid(struct drm_connector *connector, ...@@ -201,6 +202,8 @@ intel_dvo_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
struct intel_dvo *intel_dvo = intel_attached_dvo(connector); struct intel_dvo *intel_dvo = intel_attached_dvo(connector);
const struct drm_display_mode *fixed_mode =
to_intel_connector(connector)->panel.fixed_mode;
int max_dotclk = to_i915(connector->dev)->max_dotclk_freq; int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
int target_clock = mode->clock; int target_clock = mode->clock;
...@@ -209,13 +212,13 @@ intel_dvo_mode_valid(struct drm_connector *connector, ...@@ -209,13 +212,13 @@ intel_dvo_mode_valid(struct drm_connector *connector,
/* XXX: Validate clock range */ /* XXX: Validate clock range */
if (intel_dvo->panel_fixed_mode) { if (fixed_mode) {
if (mode->hdisplay > intel_dvo->panel_fixed_mode->hdisplay) if (mode->hdisplay > fixed_mode->hdisplay)
return MODE_PANEL; return MODE_PANEL;
if (mode->vdisplay > intel_dvo->panel_fixed_mode->vdisplay) if (mode->vdisplay > fixed_mode->vdisplay)
return MODE_PANEL; return MODE_PANEL;
target_clock = intel_dvo->panel_fixed_mode->clock; target_clock = fixed_mode->clock;
} }
if (target_clock > max_dotclk) if (target_clock > max_dotclk)
...@@ -228,6 +231,8 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder, ...@@ -228,6 +231,8 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
struct intel_crtc_state *pipe_config) struct intel_crtc_state *pipe_config)
{ {
struct intel_dvo *intel_dvo = enc_to_dvo(encoder); struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
const struct drm_display_mode *fixed_mode =
intel_dvo->attached_connector->panel.fixed_mode;
struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
/* If we have timings from the BIOS for the panel, put them in /* If we have timings from the BIOS for the panel, put them in
...@@ -235,21 +240,8 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder, ...@@ -235,21 +240,8 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
* with the panel scaling set up to source from the H/VDisplay * with the panel scaling set up to source from the H/VDisplay
* of the original mode. * of the original mode.
*/ */
if (intel_dvo->panel_fixed_mode != NULL) { if (fixed_mode)
#define C(x) adjusted_mode->x = intel_dvo->panel_fixed_mode->x intel_fixed_panel_mode(fixed_mode, adjusted_mode);
C(hdisplay);
C(hsync_start);
C(hsync_end);
C(htotal);
C(vdisplay);
C(vsync_start);
C(vsync_end);
C(vtotal);
C(clock);
#undef C
drm_mode_set_crtcinfo(adjusted_mode, 0);
}
return true; return true;
} }
...@@ -318,8 +310,9 @@ intel_dvo_detect(struct drm_connector *connector, bool force) ...@@ -318,8 +310,9 @@ intel_dvo_detect(struct drm_connector *connector, bool force)
static int intel_dvo_get_modes(struct drm_connector *connector) static int intel_dvo_get_modes(struct drm_connector *connector)
{ {
struct intel_dvo *intel_dvo = intel_attached_dvo(connector);
struct drm_i915_private *dev_priv = connector->dev->dev_private; struct drm_i915_private *dev_priv = connector->dev->dev_private;
const struct drm_display_mode *fixed_mode =
to_intel_connector(connector)->panel.fixed_mode;
/* We should probably have an i2c driver get_modes function for those /* We should probably have an i2c driver get_modes function for those
* devices which will have a fixed set of modes determined by the chip * devices which will have a fixed set of modes determined by the chip
...@@ -331,9 +324,9 @@ static int intel_dvo_get_modes(struct drm_connector *connector) ...@@ -331,9 +324,9 @@ static int intel_dvo_get_modes(struct drm_connector *connector)
if (!list_empty(&connector->probed_modes)) if (!list_empty(&connector->probed_modes))
return 1; return 1;
if (intel_dvo->panel_fixed_mode != NULL) { if (fixed_mode) {
struct drm_display_mode *mode; struct drm_display_mode *mode;
mode = drm_mode_duplicate(connector->dev, intel_dvo->panel_fixed_mode); mode = drm_mode_duplicate(connector->dev, fixed_mode);
if (mode) { if (mode) {
drm_mode_probed_add(connector, mode); drm_mode_probed_add(connector, mode);
return 1; return 1;
...@@ -346,6 +339,7 @@ static int intel_dvo_get_modes(struct drm_connector *connector) ...@@ -346,6 +339,7 @@ static int intel_dvo_get_modes(struct drm_connector *connector)
static void intel_dvo_destroy(struct drm_connector *connector) static void intel_dvo_destroy(struct drm_connector *connector)
{ {
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
intel_panel_fini(&to_intel_connector(connector)->panel);
kfree(connector); kfree(connector);
} }
...@@ -372,8 +366,6 @@ static void intel_dvo_enc_destroy(struct drm_encoder *encoder) ...@@ -372,8 +366,6 @@ static void intel_dvo_enc_destroy(struct drm_encoder *encoder)
if (intel_dvo->dev.dev_ops->destroy) if (intel_dvo->dev.dev_ops->destroy)
intel_dvo->dev.dev_ops->destroy(&intel_dvo->dev); intel_dvo->dev.dev_ops->destroy(&intel_dvo->dev);
kfree(intel_dvo->panel_fixed_mode);
intel_encoder_destroy(encoder); intel_encoder_destroy(encoder);
} }
...@@ -438,6 +430,8 @@ void intel_dvo_init(struct drm_device *dev) ...@@ -438,6 +430,8 @@ void intel_dvo_init(struct drm_device *dev)
return; return;
} }
intel_dvo->attached_connector = intel_connector;
intel_encoder = &intel_dvo->base; intel_encoder = &intel_dvo->base;
drm_encoder_init(dev, &intel_encoder->base, drm_encoder_init(dev, &intel_encoder->base,
&intel_dvo_enc_funcs, encoder_type); &intel_dvo_enc_funcs, encoder_type);
...@@ -542,8 +536,9 @@ void intel_dvo_init(struct drm_device *dev) ...@@ -542,8 +536,9 @@ void intel_dvo_init(struct drm_device *dev)
* headers, likely), so for now, just get the current * headers, likely), so for now, just get the current
* mode being output through DVO. * mode being output through DVO.
*/ */
intel_dvo->panel_fixed_mode = intel_panel_init(&intel_connector->panel,
intel_dvo_get_current_mode(connector); intel_dvo_get_current_mode(connector),
NULL);
intel_dvo->panel_wants_dither = true; intel_dvo->panel_wants_dither = true;
} }
......
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