[Intel-gfx] [PATCH 4/8] drm/i915: track is_dual_link in intel_lvds
Paulo Zanoni
przanoni at gmail.com
Fri Nov 16 18:41:58 CET 2012
Hi
2012/11/5 Daniel Vetter <daniel.vetter at ffwll.ch>:
> Yeah, all users (both the clock selection special cases and the lvds
> pin pair stuff) are still in common code, but this will change.
>
> v2: Rebase on top of Jani Nikula's panel rework.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/i915/intel_lvds.c | 43 +++++++++++++++++++++++++++------------
> 1 file changed, 30 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 2303984..e4ae3a6 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -52,6 +52,7 @@ struct intel_lvds_encoder {
> u32 pfit_control;
> u32 pfit_pgm_ratios;
> bool pfit_dirty;
> + bool is_dual_link;
>
> struct intel_lvds_connector *attached_connector;
> };
> @@ -920,6 +921,23 @@ static const struct dmi_system_id intel_dual_link_lvds[] = {
>
> bool is_dual_link_lvds(struct drm_device *dev)
> {
> + struct intel_encoder *encoder;
> + struct intel_lvds_encoder *lvds_encoder;
> +
> + list_for_each_entry(encoder, &dev->mode_config.encoder_list,
> + base.head) {
> + if (encoder->type == INTEL_OUTPUT_LVDS) {
> + lvds_encoder = to_lvds_encoder(&encoder->base);
> +
> + return lvds_encoder->is_dual_link;
> + }
> + }
> +
> + return false;
> +}
> +
> +static bool __is_dual_link_lvds(struct drm_device *dev)
How about "compute_is_dual_link_lvds" or "check_dual_link_lvds" ?
> +{
> unsigned int val;
> struct drm_i915_private *dev_priv = dev->dev_private;
> u32 lvds_reg;
> @@ -937,19 +955,15 @@ bool is_dual_link_lvds(struct drm_device *dev)
> if (dmi_check_system(intel_dual_link_lvds))
> return true;
>
> - if (dev_priv->lvds_val)
> - val = dev_priv->lvds_val;
> - else {
> - /* BIOS should set the proper LVDS register value at boot, but
> - * in reality, it doesn't set the value when the lid is closed;
> - * we need to check "the value to be set" in VBT when LVDS
> - * register is uninitialized.
> - */
> - val = I915_READ(lvds_reg);
> - if (!(val & ~(LVDS_PIPE_MASK | LVDS_DETECTED)))
> - val = dev_priv->bios_lvds_val;
> - dev_priv->lvds_val = val;
> - }
> + /* BIOS should set the proper LVDS register value at boot, but
> + * in reality, it doesn't set the value when the lid is closed;
> + * we need to check "the value to be set" in VBT when LVDS
> + * register is uninitialized.
> + */
> + val = I915_READ(lvds_reg);
> + if (!(val & ~(LVDS_PIPE_MASK | LVDS_DETECTED)))
> + val = dev_priv->bios_lvds_val;
> +
> return (val & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP;
> }
>
> @@ -1148,6 +1162,8 @@ bool intel_lvds_init(struct drm_device *dev)
> goto failed;
>
> out:
> + lvds_encoder->is_dual_link = __is_dual_link_lvds(dev);
> +
> /*
> * Unlock registers and just
> * leave them unlocked
> @@ -1164,6 +1180,7 @@ out:
> DRM_DEBUG_KMS("lid notifier registration failed\n");
> lvds_connector->lid_notifier.notifier_call = NULL;
> }
> +
Was this chunk on purpose?
> drm_sysfs_connector_add(connector);
>
> intel_panel_init(&intel_connector->panel, fixed_mode);
> --
Please also add this chunk to your patch:
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ab3c6a6..d39dfa9 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -707,7 +707,6 @@ typedef struct drm_i915_private {
unsigned int display_clock_mode:1;
int lvds_ssc_freq;
unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
- unsigned int lvds_val; /* used for checking LVDS channel mode */
struct {
int rate;
int lanes;
> 1.7.11.7
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Paulo Zanoni
More information about the Intel-gfx
mailing list