Lines Matching +full:fixed +full:- +full:factor +full:- +full:clock
2 * Copyright © 2006-2007 Intel Corporation
73 struct drm_device *dev = intel_lvds->base.base.dev; in intel_lvds_enable()
74 struct drm_i915_private *dev_priv = dev->dev_private; in intel_lvds_enable()
89 if (intel_lvds->pfit_dirty) { in intel_lvds_enable()
91 * Enable automatic panel scaling so that non-native modes in intel_lvds_enable()
96 DRM_DEBUG_KMS("applying panel-fitter: %x, %x\n", in intel_lvds_enable()
97 intel_lvds->pfit_control, in intel_lvds_enable()
98 intel_lvds->pfit_pgm_ratios); in intel_lvds_enable()
100 I915_WRITE(PFIT_PGM_RATIOS, intel_lvds->pfit_pgm_ratios); in intel_lvds_enable()
101 I915_WRITE(PFIT_CONTROL, intel_lvds->pfit_control); in intel_lvds_enable()
102 intel_lvds->pfit_dirty = false; in intel_lvds_enable()
115 struct drm_device *dev = intel_lvds->base.base.dev; in intel_lvds_disable()
116 struct drm_i915_private *dev_priv = dev->dev_private; in intel_lvds_disable()
135 if (intel_lvds->pfit_control) { in intel_lvds_disable()
137 intel_lvds->pfit_dirty = true; in intel_lvds_disable()
160 struct drm_display_mode *fixed_mode = intel_lvds->fixed_mode; in intel_lvds_mode_valid()
162 if (mode->hdisplay > fixed_mode->hdisplay) in intel_lvds_mode_valid()
164 if (mode->vdisplay > fixed_mode->vdisplay) in intel_lvds_mode_valid()
177 sync_width = mode->crtc_hsync_end - mode->crtc_hsync_start; in centre_horizontally()
178 blank_width = mode->crtc_hblank_end - mode->crtc_hblank_start; in centre_horizontally()
179 sync_pos = (blank_width - sync_width + 1) / 2; in centre_horizontally()
181 border = (mode->hdisplay - width + 1) / 2; in centre_horizontally()
184 mode->crtc_hdisplay = width; in centre_horizontally()
185 mode->crtc_hblank_start = width + border; in centre_horizontally()
186 mode->crtc_hblank_end = mode->crtc_hblank_start + blank_width; in centre_horizontally()
188 mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; in centre_horizontally()
189 mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; in centre_horizontally()
199 sync_width = mode->crtc_vsync_end - mode->crtc_vsync_start; in centre_vertically()
200 blank_width = mode->crtc_vblank_end - mode->crtc_vblank_start; in centre_vertically()
201 sync_pos = (blank_width - sync_width + 1) / 2; in centre_vertically()
203 border = (mode->vdisplay - height + 1) / 2; in centre_vertically()
205 mode->crtc_vdisplay = height; in centre_vertically()
206 mode->crtc_vblank_start = height + border; in centre_vertically()
207 mode->crtc_vblank_end = mode->crtc_vblank_start + blank_width; in centre_vertically()
209 mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; in centre_vertically()
210 mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; in centre_vertically()
216 * Floating point operation is not supported. So the FACTOR in panel_fitter_scaling()
221 #define FACTOR (1 << ACCURACY) in panel_fitter_scaling() macro
222 u32 ratio = source * FACTOR / target; in panel_fitter_scaling()
223 return (FACTOR * ratio + FACTOR/2) / FACTOR; in panel_fitter_scaling()
230 struct drm_device *dev = encoder->dev; in intel_lvds_mode_fixup()
231 struct drm_i915_private *dev_priv = dev->dev_private; in intel_lvds_mode_fixup()
232 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); in intel_lvds_mode_fixup()
239 if (INTEL_INFO(dev)->gen < 4 && intel_crtc->pipe == 0) { in intel_lvds_mode_fixup()
245 list_for_each_entry(tmp_encoder, &dev->mode_config.encoder_list, head) { in intel_lvds_mode_fixup()
246 if (tmp_encoder != encoder && tmp_encoder->crtc == encoder->crtc) { in intel_lvds_mode_fixup()
259 intel_fixed_panel_mode(intel_lvds->fixed_mode, adjusted_mode); in intel_lvds_mode_fixup()
262 intel_pch_panel_fitting(dev, intel_lvds->fitting_mode, in intel_lvds_mode_fixup()
268 if (adjusted_mode->hdisplay == mode->hdisplay && in intel_lvds_mode_fixup()
269 adjusted_mode->vdisplay == mode->vdisplay) in intel_lvds_mode_fixup()
273 if (INTEL_INFO(dev)->gen >= 4) in intel_lvds_mode_fixup()
274 pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) | in intel_lvds_mode_fixup()
278 * Enable automatic panel scaling for non-native modes so that they fill in intel_lvds_mode_fixup()
286 switch (intel_lvds->fitting_mode) { in intel_lvds_mode_fixup()
292 centre_horizontally(adjusted_mode, mode->hdisplay); in intel_lvds_mode_fixup()
293 centre_vertically(adjusted_mode, mode->vdisplay); in intel_lvds_mode_fixup()
299 if (INTEL_INFO(dev)->gen >= 4) { in intel_lvds_mode_fixup()
300 u32 scaled_width = adjusted_mode->hdisplay * mode->vdisplay; in intel_lvds_mode_fixup()
301 u32 scaled_height = mode->hdisplay * adjusted_mode->vdisplay; in intel_lvds_mode_fixup()
308 else if (adjusted_mode->hdisplay != mode->hdisplay) in intel_lvds_mode_fixup()
311 u32 scaled_width = adjusted_mode->hdisplay * mode->vdisplay; in intel_lvds_mode_fixup()
312 u32 scaled_height = mode->hdisplay * adjusted_mode->vdisplay; in intel_lvds_mode_fixup()
319 centre_horizontally(adjusted_mode, scaled_height / mode->vdisplay); in intel_lvds_mode_fixup()
322 if (mode->vdisplay != adjusted_mode->vdisplay) { in intel_lvds_mode_fixup()
323 u32 bits = panel_fitter_scaling(mode->vdisplay, adjusted_mode->vdisplay); in intel_lvds_mode_fixup()
331 centre_vertically(adjusted_mode, scaled_width / mode->hdisplay); in intel_lvds_mode_fixup()
334 if (mode->hdisplay != adjusted_mode->hdisplay) { in intel_lvds_mode_fixup()
335 u32 bits = panel_fitter_scaling(mode->hdisplay, adjusted_mode->hdisplay); in intel_lvds_mode_fixup()
356 if (mode->vdisplay != adjusted_mode->vdisplay || in intel_lvds_mode_fixup()
357 mode->hdisplay != adjusted_mode->hdisplay) { in intel_lvds_mode_fixup()
359 if (INTEL_INFO(dev)->gen >= 4) in intel_lvds_mode_fixup()
380 /* Make sure pre-965 set dither correctly */ in intel_lvds_mode_fixup()
381 if (INTEL_INFO(dev)->gen < 4 && dev_priv->lvds_dither) in intel_lvds_mode_fixup()
384 if (pfit_control != intel_lvds->pfit_control || in intel_lvds_mode_fixup()
385 pfit_pgm_ratios != intel_lvds->pfit_pgm_ratios) { in intel_lvds_mode_fixup()
386 intel_lvds->pfit_control = pfit_control; in intel_lvds_mode_fixup()
387 intel_lvds->pfit_pgm_ratios = pfit_pgm_ratios; in intel_lvds_mode_fixup()
388 intel_lvds->pfit_dirty = true; in intel_lvds_mode_fixup()
390 dev_priv->lvds_border_bits = border; in intel_lvds_mode_fixup()
410 if (!HAS_PCH_SPLIT(encoder->dev) && intel_lvds->pfit_dirty) in intel_lvds_prepare()
445 struct drm_device *dev = connector->dev; in intel_lvds_detect()
456 * Return the list of DDC modes if available, or the BIOS fixed mode otherwise.
461 struct drm_device *dev = connector->dev; in intel_lvds_get_modes()
464 if (intel_lvds->edid) in intel_lvds_get_modes()
465 return drm_add_edid_modes(connector, intel_lvds->edid); in intel_lvds_get_modes()
467 mode = drm_mode_duplicate(dev, intel_lvds->fixed_mode); in intel_lvds_get_modes()
477 DRM_DEBUG_KMS("Skipping forced modeset for %s\n", id->ident); in intel_no_modeset_on_lid_dmi_callback()
497 * - we set it on lid close, and reset it on open
498 * - we use it as a "only once" bit (ie we ignore
501 * - the suspend/resume paths will also set it to
509 struct drm_device *dev = dev_priv->dev; in intel_lid_notify()
510 struct drm_connector *connector = dev_priv->int_lvds_connector; in intel_lid_notify()
512 if (dev->switch_power_state != DRM_SWITCH_POWER_ON) in intel_lid_notify()
520 connector->status = connector->funcs->detect(connector, in intel_lid_notify()
527 dev_priv->modeset_on_lid = 1; in intel_lid_notify()
531 if (!dev_priv->modeset_on_lid) in intel_lid_notify()
534 dev_priv->modeset_on_lid = 0; in intel_lid_notify()
536 mutex_lock(&dev->mode_config.mutex); in intel_lid_notify()
538 mutex_unlock(&dev->mode_config.mutex); in intel_lid_notify()
544 * intel_lvds_destroy - unregister and free LVDS structures
552 struct drm_device *dev = connector->dev; in intel_lvds_destroy()
553 struct drm_i915_private *dev_priv = dev->dev_private; in intel_lvds_destroy()
557 if (dev_priv->lid_notifier.notifier_call) in intel_lvds_destroy()
558 acpi_lid_notifier_unregister(&dev_priv->lid_notifier); in intel_lvds_destroy()
569 struct drm_device *dev = connector->dev; in intel_lvds_set_property()
571 if (property == dev->mode_config.scaling_mode_property) { in intel_lvds_set_property()
572 struct drm_crtc *crtc = intel_lvds->base.base.crtc; in intel_lvds_set_property()
576 return -EINVAL; in intel_lvds_set_property()
579 if (intel_lvds->fitting_mode == value) { in intel_lvds_set_property()
583 intel_lvds->fitting_mode = value; in intel_lvds_set_property()
584 if (crtc && crtc->enabled) { in intel_lvds_set_property()
589 drm_crtc_helper_set_mode(crtc, &crtc->mode, in intel_lvds_set_property()
590 crtc->x, crtc->y, crtc->fb); in intel_lvds_set_property()
625 DRM_DEBUG_KMS("Skipping LVDS initialization for %s\n", id->ident); in intel_no_lvds_dmi_callback()
649 .ident = "MSI IM-945GSE-A",
676 DMI_MATCH(DMI_PRODUCT_NAME, "i965GMx-IF"),
684 DMI_MATCH(DMI_BOARD_NAME, "i915GMx-F"),
689 .ident = "AOpen i915GMm-HFS",
692 DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
697 .ident = "AOpen i45GMx-I",
700 DMI_MATCH(DMI_BOARD_NAME, "i45GMx-I"),
705 .ident = "Aopen i945GTt-VFA",
736 .ident = "Asus AT5NM10T-I",
739 DMI_MATCH(DMI_BOARD_NAME, "AT5NM10T-I"),
747 * intel_find_lvds_downclock - find the reduced downclock for LVDS in EDID
757 struct drm_i915_private *dev_priv = dev->dev_private; in intel_find_lvds_downclock()
761 temp_downclock = fixed_mode->clock; in intel_find_lvds_downclock()
762 list_for_each_entry(scan, &connector->probed_modes, head) { in intel_find_lvds_downclock()
770 if (scan->hdisplay == fixed_mode->hdisplay && in intel_find_lvds_downclock()
771 scan->hsync_start == fixed_mode->hsync_start && in intel_find_lvds_downclock()
772 scan->hsync_end == fixed_mode->hsync_end && in intel_find_lvds_downclock()
773 scan->htotal == fixed_mode->htotal && in intel_find_lvds_downclock()
774 scan->vdisplay == fixed_mode->vdisplay && in intel_find_lvds_downclock()
775 scan->vsync_start == fixed_mode->vsync_start && in intel_find_lvds_downclock()
776 scan->vsync_end == fixed_mode->vsync_end && in intel_find_lvds_downclock()
777 scan->vtotal == fixed_mode->vtotal) { in intel_find_lvds_downclock()
778 if (scan->clock < temp_downclock) { in intel_find_lvds_downclock()
783 temp_downclock = scan->clock; in intel_find_lvds_downclock()
787 if (temp_downclock < fixed_mode->clock && i915_lvds_downclock) { in intel_find_lvds_downclock()
789 dev_priv->lvds_downclock_avail = 1; in intel_find_lvds_downclock()
790 dev_priv->lvds_downclock = temp_downclock; in intel_find_lvds_downclock()
792 "Normal clock %dKhz, downclock %dKhz\n", in intel_find_lvds_downclock()
793 fixed_mode->clock, temp_downclock); in intel_find_lvds_downclock()
807 struct drm_i915_private *dev_priv = dev->dev_private; in lvds_is_present_in_vbt()
810 if (!dev_priv->child_dev_num) in lvds_is_present_in_vbt()
813 for (i = 0; i < dev_priv->child_dev_num; i++) { in lvds_is_present_in_vbt()
814 struct child_device_config *child = dev_priv->child_dev + i; in lvds_is_present_in_vbt()
820 if (child->device_type != DEVICE_TYPE_INT_LFP && in lvds_is_present_in_vbt()
821 child->device_type != DEVICE_TYPE_LFP) in lvds_is_present_in_vbt()
824 if (child->i2c_pin) in lvds_is_present_in_vbt()
825 *i2c_pin = child->i2c_pin; in lvds_is_present_in_vbt()
829 * information from AIM blocks, a non-zero addin offset is in lvds_is_present_in_vbt()
832 if (child->addin_offset) in lvds_is_present_in_vbt()
840 if (dev_priv->opregion.vbt) in lvds_is_present_in_vbt()
848 * intel_lvds_init - setup LVDS connectors on this device
856 struct drm_i915_private *dev_priv = dev->dev_private; in intel_lvds_init()
881 if (dev_priv->edp.support) { in intel_lvds_init()
899 intel_lvds->pfit_control = I915_READ(PFIT_CONTROL); in intel_lvds_init()
902 intel_encoder = &intel_lvds->base; in intel_lvds_init()
903 encoder = &intel_encoder->base; in intel_lvds_init()
904 connector = &intel_connector->base; in intel_lvds_init()
905 drm_connector_init(dev, &intel_connector->base, &intel_lvds_connector_funcs, in intel_lvds_init()
908 drm_encoder_init(dev, &intel_encoder->base, &intel_lvds_enc_funcs, in intel_lvds_init()
912 intel_encoder->type = INTEL_OUTPUT_LVDS; in intel_lvds_init()
914 intel_encoder->clone_mask = (1 << INTEL_LVDS_CLONE_BIT); in intel_lvds_init()
916 intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); in intel_lvds_init()
918 intel_encoder->crtc_mask = (1 << 1); in intel_lvds_init()
922 connector->display_info.subpixel_order = SubPixelHorizontalRGB; in intel_lvds_init()
923 connector->interlace_allowed = false; in intel_lvds_init()
924 connector->doublescan_allowed = false; in intel_lvds_init()
932 drm_connector_attach_property(&intel_connector->base, in intel_lvds_init()
933 dev->mode_config.scaling_mode_property, in intel_lvds_init()
935 intel_lvds->fitting_mode = DRM_MODE_SCALE_ASPECT; in intel_lvds_init()
947 * Attempt to get the fixed panel mode from DDC. Assume that the in intel_lvds_init()
950 intel_lvds->edid = drm_get_edid(connector, in intel_lvds_init()
951 &dev_priv->gmbus[pin].adapter); in intel_lvds_init()
952 if (intel_lvds->edid) { in intel_lvds_init()
954 intel_lvds->edid)) { in intel_lvds_init()
956 intel_lvds->edid); in intel_lvds_init()
958 kfree(intel_lvds->edid); in intel_lvds_init()
959 intel_lvds->edid = NULL; in intel_lvds_init()
962 if (!intel_lvds->edid) { in intel_lvds_init()
967 connector->display_info.min_vfreq = 0; in intel_lvds_init()
968 connector->display_info.max_vfreq = 200; in intel_lvds_init()
969 connector->display_info.min_hfreq = 0; in intel_lvds_init()
970 connector->display_info.max_hfreq = 200; in intel_lvds_init()
973 list_for_each_entry(scan, &connector->probed_modes, head) { in intel_lvds_init()
974 if (scan->type & DRM_MODE_TYPE_PREFERRED) { in intel_lvds_init()
975 intel_lvds->fixed_mode = in intel_lvds_init()
978 intel_lvds->fixed_mode, in intel_lvds_init()
985 if (dev_priv->lfp_lvds_vbt_mode) { in intel_lvds_init()
986 intel_lvds->fixed_mode = in intel_lvds_init()
987 drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode); in intel_lvds_init()
988 if (intel_lvds->fixed_mode) { in intel_lvds_init()
989 intel_lvds->fixed_mode->type |= in intel_lvds_init()
1010 intel_lvds->fixed_mode = intel_crtc_mode_get(dev, crtc); in intel_lvds_init()
1011 if (intel_lvds->fixed_mode) { in intel_lvds_init()
1012 intel_lvds->fixed_mode->type |= in intel_lvds_init()
1019 if (!intel_lvds->fixed_mode) in intel_lvds_init()
1055 dev_priv->lid_notifier.notifier_call = intel_lid_notify; in intel_lvds_init()
1056 if (acpi_lid_notifier_register(&dev_priv->lid_notifier)) { in intel_lvds_init()
1058 dev_priv->lid_notifier.notifier_call = NULL; in intel_lvds_init()
1061 dev_priv->int_lvds_connector = connector; in intel_lvds_init()