Lines Matching +full:panel +full:- +full:lvds
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright © 2006-2011 Intel Corporation
25 * LVDS I2C backlight control macros
60 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_lvds_get_max_backlight()
70 retval = ((dev_priv->regs.saveBLC_PWM_CTL & in cdv_intel_lvds_get_max_backlight()
84 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_lvds_set_backlight()
95 blc_pwm_ctl = dev_priv->regs.saveBLC_PWM_CTL & in cdv_intel_lvds_set_backlight()
97 dev_priv->regs.saveBLC_PWM_CTL = (blc_pwm_ctl | in cdv_intel_lvds_set_backlight()
103 * Sets the power state for the panel.
108 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_lvds_set_power()
122 dev_priv->mode_dev.backlight_duty_cycle); in cdv_intel_lvds_set_power()
137 struct drm_device *dev = encoder->dev; in cdv_intel_lvds_encoder_dpms()
142 /* XXX: We never power down the LVDS pairs. */ in cdv_intel_lvds_encoder_dpms()
156 struct drm_device *dev = connector->dev; in cdv_intel_lvds_mode_valid()
157 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_lvds_mode_valid()
159 dev_priv->mode_dev.panel_fixed_mode; in cdv_intel_lvds_mode_valid()
162 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) in cdv_intel_lvds_mode_valid()
166 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in cdv_intel_lvds_mode_valid()
170 if (mode->hdisplay > fixed_mode->hdisplay) in cdv_intel_lvds_mode_valid()
172 if (mode->vdisplay > fixed_mode->vdisplay) in cdv_intel_lvds_mode_valid()
182 struct drm_device *dev = encoder->dev; in cdv_intel_lvds_mode_fixup()
183 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_lvds_mode_fixup()
184 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; in cdv_intel_lvds_mode_fixup()
186 struct drm_display_mode *panel_fixed_mode = mode_dev->panel_fixed_mode; in cdv_intel_lvds_mode_fixup()
189 list_for_each_entry(tmp_encoder, &dev->mode_config.encoder_list, in cdv_intel_lvds_mode_fixup()
192 && tmp_encoder->crtc == encoder->crtc) { in cdv_intel_lvds_mode_fixup()
193 pr_err("Can't enable LVDS and another encoder on the same pipe\n"); in cdv_intel_lvds_mode_fixup()
199 * If we have timings from the BIOS for the panel, put them in in cdv_intel_lvds_mode_fixup()
201 * with the panel scaling set up to source from the H/VDisplay in cdv_intel_lvds_mode_fixup()
205 adjusted_mode->hdisplay = panel_fixed_mode->hdisplay; in cdv_intel_lvds_mode_fixup()
206 adjusted_mode->hsync_start = panel_fixed_mode->hsync_start; in cdv_intel_lvds_mode_fixup()
207 adjusted_mode->hsync_end = panel_fixed_mode->hsync_end; in cdv_intel_lvds_mode_fixup()
208 adjusted_mode->htotal = panel_fixed_mode->htotal; in cdv_intel_lvds_mode_fixup()
209 adjusted_mode->vdisplay = panel_fixed_mode->vdisplay; in cdv_intel_lvds_mode_fixup()
210 adjusted_mode->vsync_start = panel_fixed_mode->vsync_start; in cdv_intel_lvds_mode_fixup()
211 adjusted_mode->vsync_end = panel_fixed_mode->vsync_end; in cdv_intel_lvds_mode_fixup()
212 adjusted_mode->vtotal = panel_fixed_mode->vtotal; in cdv_intel_lvds_mode_fixup()
213 adjusted_mode->clock = panel_fixed_mode->clock; in cdv_intel_lvds_mode_fixup()
229 struct drm_device *dev = encoder->dev; in cdv_intel_lvds_prepare()
230 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_lvds_prepare()
231 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; in cdv_intel_lvds_prepare()
236 mode_dev->saveBLC_PWM_CTL = REG_READ(BLC_PWM_CTL); in cdv_intel_lvds_prepare()
237 mode_dev->backlight_duty_cycle = (mode_dev->saveBLC_PWM_CTL & in cdv_intel_lvds_prepare()
247 struct drm_device *dev = encoder->dev; in cdv_intel_lvds_commit()
248 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_lvds_commit()
249 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; in cdv_intel_lvds_commit()
251 if (mode_dev->backlight_duty_cycle == 0) in cdv_intel_lvds_commit()
252 mode_dev->backlight_duty_cycle = in cdv_intel_lvds_commit()
262 struct drm_device *dev = encoder->dev; in cdv_intel_lvds_mode_set()
263 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_lvds_mode_set()
264 struct gma_crtc *gma_crtc = to_gma_crtc(encoder->crtc); in cdv_intel_lvds_mode_set()
268 * The LVDS pin pair will already have been turned on in the in cdv_intel_lvds_mode_set()
274 * Enable automatic panel scaling so that non-native modes fill the in cdv_intel_lvds_mode_set()
278 if (mode->hdisplay != adjusted_mode->hdisplay || in cdv_intel_lvds_mode_set()
279 mode->vdisplay != adjusted_mode->vdisplay) in cdv_intel_lvds_mode_set()
286 pfit_control |= gma_crtc->pipe << PFIT_PIPE_SHIFT; in cdv_intel_lvds_mode_set()
288 if (dev_priv->lvds_dither) in cdv_intel_lvds_mode_set()
299 struct drm_device *dev = connector->dev; in cdv_intel_lvds_get_modes()
300 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_lvds_get_modes()
302 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; in cdv_intel_lvds_get_modes()
305 ret = psb_intel_ddc_get_modes(connector, &gma_encoder->i2c_bus->adapter); in cdv_intel_lvds_get_modes()
310 if (mode_dev->panel_fixed_mode != NULL) { in cdv_intel_lvds_get_modes()
312 drm_mode_duplicate(dev, mode_dev->panel_fixed_mode); in cdv_intel_lvds_get_modes()
321 * cdv_intel_lvds_destroy - unregister and free LVDS structures
331 psb_intel_i2c_destroy(gma_encoder->i2c_bus); in cdv_intel_lvds_destroy()
341 struct drm_encoder *encoder = connector->encoder; in cdv_intel_lvds_set_property()
343 if (!strcmp(property->name, "scaling mode") && encoder) { in cdv_intel_lvds_set_property()
344 struct gma_crtc *crtc = to_gma_crtc(encoder->crtc); in cdv_intel_lvds_set_property()
348 return -1; in cdv_intel_lvds_set_property()
358 return -1; in cdv_intel_lvds_set_property()
361 if (drm_object_property_get_value(&connector->base, in cdv_intel_lvds_set_property()
364 return -1; in cdv_intel_lvds_set_property()
369 if (drm_object_property_set_value(&connector->base, in cdv_intel_lvds_set_property()
372 return -1; in cdv_intel_lvds_set_property()
374 if (crtc->saved_mode.hdisplay != 0 && in cdv_intel_lvds_set_property()
375 crtc->saved_mode.vdisplay != 0) { in cdv_intel_lvds_set_property()
376 if (!drm_crtc_helper_set_mode(encoder->crtc, in cdv_intel_lvds_set_property()
377 &crtc->saved_mode, in cdv_intel_lvds_set_property()
378 encoder->crtc->x, in cdv_intel_lvds_set_property()
379 encoder->crtc->y, in cdv_intel_lvds_set_property()
380 encoder->crtc->primary->fb)) in cdv_intel_lvds_set_property()
381 return -1; in cdv_intel_lvds_set_property()
383 } else if (!strcmp(property->name, "backlight") && encoder) { in cdv_intel_lvds_set_property()
384 if (drm_object_property_set_value(&connector->base, in cdv_intel_lvds_set_property()
387 return -1; in cdv_intel_lvds_set_property()
389 gma_backlight_set(encoder->dev, value); in cdv_intel_lvds_set_property()
390 } else if (!strcmp(property->name, "DPMS") && encoder) { in cdv_intel_lvds_set_property()
392 encoder->helper_private; in cdv_intel_lvds_set_property()
393 helpers->dpms(encoder, value); in cdv_intel_lvds_set_property()
423 * the LVDS is present.
426 * If no child dev is parsed from VBT, it assumes that the LVDS is present.
431 struct drm_psb_private *dev_priv = dev->dev_private; in lvds_is_present_in_vbt()
434 if (!dev_priv->child_dev_num) in lvds_is_present_in_vbt()
437 for (i = 0; i < dev_priv->child_dev_num; i++) { in lvds_is_present_in_vbt()
438 struct child_device_config *child = dev_priv->child_dev + i; in lvds_is_present_in_vbt()
444 if (child->device_type != DEVICE_TYPE_INT_LFP && in lvds_is_present_in_vbt()
445 child->device_type != DEVICE_TYPE_LFP) in lvds_is_present_in_vbt()
448 if (child->i2c_pin) in lvds_is_present_in_vbt()
449 *i2c_pin = child->i2c_pin; in lvds_is_present_in_vbt()
452 * the VBT correctly. Since LVDS requires additional in lvds_is_present_in_vbt()
453 * information from AIM blocks, a non-zero addin offset is in lvds_is_present_in_vbt()
454 * a good indicator that the LVDS is actually present. in lvds_is_present_in_vbt()
456 if (child->addin_offset) in lvds_is_present_in_vbt()
462 * the OpRegion then they have validated the LVDS's existence. in lvds_is_present_in_vbt()
464 if (dev_priv->opregion.vbt) in lvds_is_present_in_vbt()
472 * cdv_intel_lvds_init - setup LVDS connectors on this device
475 * Create the connector, register the LVDS DDC bus, and try to figure out what
476 * modes we can display on the LVDS panel (if present).
488 struct drm_psb_private *dev_priv = dev->dev_private; in cdv_intel_lvds_init()
489 u32 lvds; in cdv_intel_lvds_init() local
493 if (!dev_priv->lvds_enabled_in_vbt) in cdv_intel_lvds_init()
498 DRM_DEBUG_KMS("LVDS is not present in VBT\n"); in cdv_intel_lvds_init()
516 gma_encoder->dev_priv = lvds_priv; in cdv_intel_lvds_init()
518 connector = &gma_connector->base; in cdv_intel_lvds_init()
519 gma_connector->save = cdv_intel_lvds_save; in cdv_intel_lvds_init()
520 gma_connector->restore = cdv_intel_lvds_restore; in cdv_intel_lvds_init()
521 encoder = &gma_encoder->base; in cdv_intel_lvds_init()
531 gma_encoder->type = INTEL_OUTPUT_LVDS; in cdv_intel_lvds_init()
536 connector->display_info.subpixel_order = SubPixelHorizontalRGB; in cdv_intel_lvds_init()
537 connector->interlace_allowed = false; in cdv_intel_lvds_init()
538 connector->doublescan_allowed = false; in cdv_intel_lvds_init()
541 drm_object_attach_property(&connector->base, in cdv_intel_lvds_init()
542 dev->mode_config.scaling_mode_property, in cdv_intel_lvds_init()
544 drm_object_attach_property(&connector->base, in cdv_intel_lvds_init()
545 dev_priv->backlight_property, in cdv_intel_lvds_init()
552 gma_encoder->i2c_bus = psb_intel_i2c_create(dev, in cdv_intel_lvds_init()
555 if (!gma_encoder->i2c_bus) { in cdv_intel_lvds_init()
557 &dev->pdev->dev, "I2C bus registration failed.\n"); in cdv_intel_lvds_init()
560 gma_encoder->i2c_bus->slave_addr = 0x2C; in cdv_intel_lvds_init()
561 dev_priv->lvds_i2c_bus = gma_encoder->i2c_bus; in cdv_intel_lvds_init()
564 * LVDS discovery: in cdv_intel_lvds_init()
567 * 3) check to see if LVDS is already on in cdv_intel_lvds_init()
568 * if none of the above, no panel in cdv_intel_lvds_init()
574 gma_encoder->ddc_bus = psb_intel_i2c_create(dev, in cdv_intel_lvds_init()
577 if (!gma_encoder->ddc_bus) { in cdv_intel_lvds_init()
578 dev_printk(KERN_ERR, &dev->pdev->dev, in cdv_intel_lvds_init()
584 * Attempt to get the fixed panel mode from DDC. Assume that the in cdv_intel_lvds_init()
587 mutex_lock(&dev->mode_config.mutex); in cdv_intel_lvds_init()
589 &gma_encoder->ddc_bus->adapter); in cdv_intel_lvds_init()
590 list_for_each_entry(scan, &connector->probed_modes, head) { in cdv_intel_lvds_init()
591 if (scan->type & DRM_MODE_TYPE_PREFERRED) { in cdv_intel_lvds_init()
592 mode_dev->panel_fixed_mode = in cdv_intel_lvds_init()
599 if (dev_priv->lfp_lvds_vbt_mode) { in cdv_intel_lvds_init()
600 mode_dev->panel_fixed_mode = in cdv_intel_lvds_init()
601 drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode); in cdv_intel_lvds_init()
602 if (mode_dev->panel_fixed_mode) { in cdv_intel_lvds_init()
603 mode_dev->panel_fixed_mode->type |= in cdv_intel_lvds_init()
609 * If we didn't get EDID, try checking if the panel is already turned in cdv_intel_lvds_init()
613 lvds = REG_READ(LVDS); in cdv_intel_lvds_init()
614 pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0; in cdv_intel_lvds_init()
617 if (crtc && (lvds & LVDS_PORT_EN)) { in cdv_intel_lvds_init()
618 mode_dev->panel_fixed_mode = in cdv_intel_lvds_init()
620 if (mode_dev->panel_fixed_mode) { in cdv_intel_lvds_init()
621 mode_dev->panel_fixed_mode->type |= in cdv_intel_lvds_init()
628 if (!mode_dev->panel_fixed_mode) { in cdv_intel_lvds_init()
630 ("Found no modes on the lvds, ignoring the LVDS\n"); in cdv_intel_lvds_init()
648 mutex_unlock(&dev->mode_config.mutex); in cdv_intel_lvds_init()
653 mutex_unlock(&dev->mode_config.mutex); in cdv_intel_lvds_init()
655 psb_intel_i2c_destroy(gma_encoder->ddc_bus); in cdv_intel_lvds_init()
658 psb_intel_i2c_destroy(gma_encoder->i2c_bus); in cdv_intel_lvds_init()