2 * Copyright © 2006-2011 Intel Corporation
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * Eric Anholt <eric@anholt.net>
19 * Dave Airlie <airlied@linux.ie>
20 * Jesse Barnes <jesse.barnes@intel.com>
23 #include <linux/i2c.h>
24 #include <linux/dmi.h>
27 #include "intel_bios.h"
29 #include "psb_intel_drv.h"
30 #include "psb_intel_reg.h"
32 #include <linux/pm_runtime.h>
33 #include "cdv_device.h"
36 * LVDS I2C backlight control macros
38 #define BRIGHTNESS_MAX_LEVEL 100
39 #define BRIGHTNESS_MASK 0xFF
40 #define BLC_I2C_TYPE 0x01
41 #define BLC_PWM_TYPT 0x02
43 #define BLC_POLARITY_NORMAL 0
44 #define BLC_POLARITY_INVERSE 1
46 #define PSB_BLC_MAX_PWM_REG_FREQ (0xFFFE)
47 #define PSB_BLC_MIN_PWM_REG_FREQ (0x2)
48 #define PSB_BLC_PWM_PRECISION_FACTOR (10)
49 #define PSB_BACKLIGHT_PWM_CTL_SHIFT (16)
50 #define PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR (0xFFFE)
52 struct cdv_intel_lvds_priv {
54 * Saved LVDO output states
59 uint32_t savePP_CONTROL;
60 uint32_t savePP_CYCLE;
61 uint32_t savePFIT_CONTROL;
62 uint32_t savePFIT_PGM_RATIOS;
63 uint32_t saveBLC_PWM_CTL;
67 * Returns the maximum level of the backlight duty cycle field.
69 static u32 cdv_intel_lvds_get_max_backlight(struct drm_device *dev)
71 struct drm_psb_private *dev_priv = dev->dev_private;
74 if (gma_power_begin(dev, false)) {
75 retval = ((REG_READ(BLC_PWM_CTL) &
76 BACKLIGHT_MODULATION_FREQ_MASK) >>
77 BACKLIGHT_MODULATION_FREQ_SHIFT) * 2;
81 retval = ((dev_priv->regs.saveBLC_PWM_CTL &
82 BACKLIGHT_MODULATION_FREQ_MASK) >>
83 BACKLIGHT_MODULATION_FREQ_SHIFT) * 2;
90 * Set LVDS backlight level by I2C command
92 static int cdv_lvds_i2c_set_brightness(struct drm_device *dev,
95 struct drm_psb_private *dev_priv = dev->dev_private;
96 struct psb_intel_i2c_chan *lvds_i2c_bus = dev_priv->lvds_i2c_bus;
98 unsigned int blc_i2c_brightness;
100 struct i2c_msg msgs[] = {
102 .addr = lvds_i2c_bus->slave_addr,
109 blc_i2c_brightness = BRIGHTNESS_MASK & ((unsigned int)level *
111 BRIGHTNESS_MAX_LEVEL);
113 if (dev_priv->lvds_bl->pol == BLC_POLARITY_INVERSE)
114 blc_i2c_brightness = BRIGHTNESS_MASK - blc_i2c_brightness;
116 out_buf[0] = dev_priv->lvds_bl->brightnesscmd;
117 out_buf[1] = (u8)blc_i2c_brightness;
119 if (i2c_transfer(&lvds_i2c_bus->adapter, msgs, 1) == 1)
122 DRM_ERROR("I2C transfer error\n");
127 static int cdv_lvds_pwm_set_brightness(struct drm_device *dev, int level)
129 struct drm_psb_private *dev_priv = dev->dev_private;
132 u32 blc_pwm_duty_cycle;
134 max_pwm_blc = cdv_intel_lvds_get_max_backlight(dev);
136 /*BLC_PWM_CTL Should be initiated while backlight device init*/
137 BUG_ON((max_pwm_blc & PSB_BLC_MAX_PWM_REG_FREQ) == 0);
139 blc_pwm_duty_cycle = level * max_pwm_blc / BRIGHTNESS_MAX_LEVEL;
141 if (dev_priv->lvds_bl->pol == BLC_POLARITY_INVERSE)
142 blc_pwm_duty_cycle = max_pwm_blc - blc_pwm_duty_cycle;
144 blc_pwm_duty_cycle &= PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR;
145 REG_WRITE(BLC_PWM_CTL,
146 (max_pwm_blc << PSB_BACKLIGHT_PWM_CTL_SHIFT) |
147 (blc_pwm_duty_cycle));
153 * Set LVDS backlight level either by I2C or PWM
155 void cdv_intel_lvds_set_brightness(struct drm_device *dev, int level)
157 struct drm_psb_private *dev_priv = dev->dev_private;
159 if (!dev_priv->lvds_bl) {
160 DRM_ERROR("NO LVDS Backlight Info\n");
164 if (dev_priv->lvds_bl->type == BLC_I2C_TYPE)
165 cdv_lvds_i2c_set_brightness(dev, level);
167 cdv_lvds_pwm_set_brightness(dev, level);
172 * Sets the backlight level.
174 * level backlight level, from 0 to cdv_intel_lvds_get_max_backlight().
176 static void cdv_intel_lvds_set_backlight(struct drm_device *dev, int level)
178 struct drm_psb_private *dev_priv = dev->dev_private;
181 if (gma_power_begin(dev, false)) {
183 REG_READ(BLC_PWM_CTL) & ~BACKLIGHT_DUTY_CYCLE_MASK;
184 REG_WRITE(BLC_PWM_CTL,
186 (level << BACKLIGHT_DUTY_CYCLE_SHIFT)));
189 blc_pwm_ctl = dev_priv->regs.saveBLC_PWM_CTL &
190 ~BACKLIGHT_DUTY_CYCLE_MASK;
191 dev_priv->regs.saveBLC_PWM_CTL = (blc_pwm_ctl |
192 (level << BACKLIGHT_DUTY_CYCLE_SHIFT));
197 * Sets the power state for the panel.
199 static void cdv_intel_lvds_set_power(struct drm_device *dev,
200 struct drm_encoder *encoder, bool on)
202 struct drm_psb_private *dev_priv = dev->dev_private;
205 if (!gma_power_begin(dev, true))
209 REG_WRITE(PP_CONTROL, REG_READ(PP_CONTROL) |
212 pp_status = REG_READ(PP_STATUS);
213 } while ((pp_status & PP_ON) == 0);
215 cdv_intel_lvds_set_backlight(dev,
216 dev_priv->mode_dev.backlight_duty_cycle);
218 cdv_intel_lvds_set_backlight(dev, 0);
220 REG_WRITE(PP_CONTROL, REG_READ(PP_CONTROL) &
223 pp_status = REG_READ(PP_STATUS);
224 } while (pp_status & PP_ON);
229 static void cdv_intel_lvds_encoder_dpms(struct drm_encoder *encoder, int mode)
231 struct drm_device *dev = encoder->dev;
232 if (mode == DRM_MODE_DPMS_ON)
233 cdv_intel_lvds_set_power(dev, encoder, true);
235 cdv_intel_lvds_set_power(dev, encoder, false);
236 /* XXX: We never power down the LVDS pairs. */
239 static void cdv_intel_lvds_save(struct drm_connector *connector)
243 static void cdv_intel_lvds_restore(struct drm_connector *connector)
247 static int cdv_intel_lvds_mode_valid(struct drm_connector *connector,
248 struct drm_display_mode *mode)
250 struct drm_device *dev = connector->dev;
251 struct drm_psb_private *dev_priv = dev->dev_private;
252 struct drm_display_mode *fixed_mode =
253 dev_priv->mode_dev.panel_fixed_mode;
256 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
257 return MODE_NO_DBLESCAN;
260 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
261 return MODE_NO_INTERLACE;
264 if (mode->hdisplay > fixed_mode->hdisplay)
266 if (mode->vdisplay > fixed_mode->vdisplay)
272 static bool cdv_intel_lvds_mode_fixup(struct drm_encoder *encoder,
273 const struct drm_display_mode *mode,
274 struct drm_display_mode *adjusted_mode)
276 struct drm_device *dev = encoder->dev;
277 struct drm_psb_private *dev_priv = dev->dev_private;
278 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
279 struct drm_encoder *tmp_encoder;
280 struct drm_display_mode *panel_fixed_mode = mode_dev->panel_fixed_mode;
282 /* Should never happen!! */
283 list_for_each_entry(tmp_encoder, &dev->mode_config.encoder_list,
285 if (tmp_encoder != encoder
286 && tmp_encoder->crtc == encoder->crtc) {
287 printk(KERN_ERR "Can't enable LVDS and another "
288 "encoder on the same pipe\n");
294 * If we have timings from the BIOS for the panel, put them in
295 * to the adjusted mode. The CRTC will be set up for this mode,
296 * with the panel scaling set up to source from the H/VDisplay
297 * of the original mode.
299 if (panel_fixed_mode != NULL) {
300 adjusted_mode->hdisplay = panel_fixed_mode->hdisplay;
301 adjusted_mode->hsync_start = panel_fixed_mode->hsync_start;
302 adjusted_mode->hsync_end = panel_fixed_mode->hsync_end;
303 adjusted_mode->htotal = panel_fixed_mode->htotal;
304 adjusted_mode->vdisplay = panel_fixed_mode->vdisplay;
305 adjusted_mode->vsync_start = panel_fixed_mode->vsync_start;
306 adjusted_mode->vsync_end = panel_fixed_mode->vsync_end;
307 adjusted_mode->vtotal = panel_fixed_mode->vtotal;
308 adjusted_mode->clock = panel_fixed_mode->clock;
309 drm_mode_set_crtcinfo(adjusted_mode,
310 CRTC_INTERLACE_HALVE_V);
314 * XXX: It would be nice to support lower refresh rates on the
315 * panels to reduce power consumption, and perhaps match the
316 * user's requested refresh rate.
322 static void cdv_intel_lvds_prepare(struct drm_encoder *encoder)
324 struct drm_device *dev = encoder->dev;
325 struct drm_psb_private *dev_priv = dev->dev_private;
326 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
328 if (!gma_power_begin(dev, true))
331 mode_dev->saveBLC_PWM_CTL = REG_READ(BLC_PWM_CTL);
332 mode_dev->backlight_duty_cycle = (mode_dev->saveBLC_PWM_CTL &
333 BACKLIGHT_DUTY_CYCLE_MASK);
335 cdv_intel_lvds_set_power(dev, encoder, false);
340 static void cdv_intel_lvds_commit(struct drm_encoder *encoder)
342 struct drm_device *dev = encoder->dev;
343 struct drm_psb_private *dev_priv = dev->dev_private;
344 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
346 if (mode_dev->backlight_duty_cycle == 0)
347 mode_dev->backlight_duty_cycle =
348 cdv_intel_lvds_get_max_backlight(dev);
350 cdv_intel_lvds_set_power(dev, encoder, true);
353 static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder,
354 struct drm_display_mode *mode,
355 struct drm_display_mode *adjusted_mode)
357 struct drm_device *dev = encoder->dev;
358 struct drm_psb_private *dev_priv = dev->dev_private;
359 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(
364 * The LVDS pin pair will already have been turned on in the
365 * cdv_intel_crtc_mode_set since it has a large impact on the DPLL
370 * Enable automatic panel scaling so that non-native modes fill the
371 * screen. Should be enabled before the pipe is enabled, according to
372 * register description and PRM.
374 if (mode->hdisplay != adjusted_mode->hdisplay ||
375 mode->vdisplay != adjusted_mode->vdisplay)
376 pfit_control = (PFIT_ENABLE | VERT_AUTO_SCALE |
377 HORIZ_AUTO_SCALE | VERT_INTERP_BILINEAR |
378 HORIZ_INTERP_BILINEAR);
382 pfit_control |= psb_intel_crtc->pipe << PFIT_PIPE_SHIFT;
384 if (dev_priv->lvds_dither)
385 pfit_control |= PANEL_8TO6_DITHER_ENABLE;
387 REG_WRITE(PFIT_CONTROL, pfit_control);
391 * Detect the LVDS connection.
393 * This always returns CONNECTOR_STATUS_CONNECTED.
394 * This connector should only have
395 * been set up if the LVDS was actually connected anyway.
397 static enum drm_connector_status cdv_intel_lvds_detect(
398 struct drm_connector *connector, bool force)
400 return connector_status_connected;
404 * Return the list of DDC modes if available, or the BIOS fixed mode otherwise.
406 static int cdv_intel_lvds_get_modes(struct drm_connector *connector)
408 struct drm_device *dev = connector->dev;
409 struct drm_psb_private *dev_priv = dev->dev_private;
410 struct psb_intel_encoder *psb_intel_encoder =
411 psb_intel_attached_encoder(connector);
412 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
415 ret = psb_intel_ddc_get_modes(connector, &psb_intel_encoder->i2c_bus->adapter);
420 /* Didn't get an EDID, so
421 * Set wide sync ranges so we get all modes
422 * handed to valid_mode for checking
424 connector->display_info.min_vfreq = 0;
425 connector->display_info.max_vfreq = 200;
426 connector->display_info.min_hfreq = 0;
427 connector->display_info.max_hfreq = 200;
428 if (mode_dev->panel_fixed_mode != NULL) {
429 struct drm_display_mode *mode =
430 drm_mode_duplicate(dev, mode_dev->panel_fixed_mode);
431 drm_mode_probed_add(connector, mode);
439 * cdv_intel_lvds_destroy - unregister and free LVDS structures
440 * @connector: connector to free
442 * Unregister the DDC bus for this connector then free the driver private
445 static void cdv_intel_lvds_destroy(struct drm_connector *connector)
447 struct psb_intel_encoder *psb_intel_encoder =
448 psb_intel_attached_encoder(connector);
450 if (psb_intel_encoder->i2c_bus)
451 psb_intel_i2c_destroy(psb_intel_encoder->i2c_bus);
452 drm_sysfs_connector_remove(connector);
453 drm_connector_cleanup(connector);
457 static int cdv_intel_lvds_set_property(struct drm_connector *connector,
458 struct drm_property *property,
461 struct drm_encoder *encoder = connector->encoder;
463 if (!strcmp(property->name, "scaling mode") && encoder) {
464 struct psb_intel_crtc *crtc =
465 to_psb_intel_crtc(encoder->crtc);
472 case DRM_MODE_SCALE_FULLSCREEN:
474 case DRM_MODE_SCALE_NO_SCALE:
476 case DRM_MODE_SCALE_ASPECT:
482 if (drm_object_property_get_value(&connector->base,
487 if (curValue == value)
490 if (drm_object_property_set_value(&connector->base,
495 if (crtc->saved_mode.hdisplay != 0 &&
496 crtc->saved_mode.vdisplay != 0) {
497 if (!drm_crtc_helper_set_mode(encoder->crtc,
504 } else if (!strcmp(property->name, "backlight") && encoder) {
505 if (drm_object_property_set_value(&connector->base,
510 gma_backlight_set(encoder->dev, value);
511 } else if (!strcmp(property->name, "DPMS") && encoder) {
512 struct drm_encoder_helper_funcs *helpers =
513 encoder->helper_private;
514 helpers->dpms(encoder, value);
519 static const struct drm_encoder_helper_funcs
520 cdv_intel_lvds_helper_funcs = {
521 .dpms = cdv_intel_lvds_encoder_dpms,
522 .mode_fixup = cdv_intel_lvds_mode_fixup,
523 .prepare = cdv_intel_lvds_prepare,
524 .mode_set = cdv_intel_lvds_mode_set,
525 .commit = cdv_intel_lvds_commit,
528 static const struct drm_connector_helper_funcs
529 cdv_intel_lvds_connector_helper_funcs = {
530 .get_modes = cdv_intel_lvds_get_modes,
531 .mode_valid = cdv_intel_lvds_mode_valid,
532 .best_encoder = psb_intel_best_encoder,
535 static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs = {
536 .dpms = drm_helper_connector_dpms,
537 .save = cdv_intel_lvds_save,
538 .restore = cdv_intel_lvds_restore,
539 .detect = cdv_intel_lvds_detect,
540 .fill_modes = drm_helper_probe_single_connector_modes,
541 .set_property = cdv_intel_lvds_set_property,
542 .destroy = cdv_intel_lvds_destroy,
546 static void cdv_intel_lvds_enc_destroy(struct drm_encoder *encoder)
548 drm_encoder_cleanup(encoder);
551 static const struct drm_encoder_funcs cdv_intel_lvds_enc_funcs = {
552 .destroy = cdv_intel_lvds_enc_destroy,
556 * Enumerate the child dev array parsed from VBT to check whether
557 * the LVDS is present.
558 * If it is present, return 1.
559 * If it is not present, return false.
560 * If no child dev is parsed from VBT, it assumes that the LVDS is present.
562 static bool lvds_is_present_in_vbt(struct drm_device *dev,
565 struct drm_psb_private *dev_priv = dev->dev_private;
568 if (!dev_priv->child_dev_num)
571 for (i = 0; i < dev_priv->child_dev_num; i++) {
572 struct child_device_config *child = dev_priv->child_dev + i;
574 /* If the device type is not LFP, continue.
575 * We have to check both the new identifiers as well as the
576 * old for compatibility with some BIOSes.
578 if (child->device_type != DEVICE_TYPE_INT_LFP &&
579 child->device_type != DEVICE_TYPE_LFP)
583 *i2c_pin = child->i2c_pin;
585 /* However, we cannot trust the BIOS writers to populate
586 * the VBT correctly. Since LVDS requires additional
587 * information from AIM blocks, a non-zero addin offset is
588 * a good indicator that the LVDS is actually present.
590 if (child->addin_offset)
593 /* But even then some BIOS writers perform some black magic
594 * and instantiate the device without reference to any
595 * additional data. Trust that if the VBT was written into
596 * the OpRegion then they have validated the LVDS's existence.
598 if (dev_priv->opregion.vbt)
606 * cdv_intel_lvds_init - setup LVDS connectors on this device
609 * Create the connector, register the LVDS DDC bus, and try to figure out what
610 * modes we can display on the LVDS panel (if present).
612 void cdv_intel_lvds_init(struct drm_device *dev,
613 struct psb_intel_mode_device *mode_dev)
615 struct psb_intel_encoder *psb_intel_encoder;
616 struct psb_intel_connector *psb_intel_connector;
617 struct cdv_intel_lvds_priv *lvds_priv;
618 struct drm_connector *connector;
619 struct drm_encoder *encoder;
620 struct drm_display_mode *scan;
621 struct drm_crtc *crtc;
622 struct drm_psb_private *dev_priv = dev->dev_private;
627 pin = GMBUS_PORT_PANEL;
628 if (!lvds_is_present_in_vbt(dev, &pin)) {
629 DRM_DEBUG_KMS("LVDS is not present in VBT\n");
633 psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder),
635 if (!psb_intel_encoder)
638 psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector),
640 if (!psb_intel_connector)
641 goto failed_connector;
643 lvds_priv = kzalloc(sizeof(struct cdv_intel_lvds_priv), GFP_KERNEL);
645 goto failed_lvds_priv;
647 psb_intel_encoder->dev_priv = lvds_priv;
649 connector = &psb_intel_connector->base;
650 encoder = &psb_intel_encoder->base;
653 drm_connector_init(dev, connector,
654 &cdv_intel_lvds_connector_funcs,
655 DRM_MODE_CONNECTOR_LVDS);
657 drm_encoder_init(dev, encoder,
658 &cdv_intel_lvds_enc_funcs,
659 DRM_MODE_ENCODER_LVDS);
662 psb_intel_connector_attach_encoder(psb_intel_connector,
664 psb_intel_encoder->type = INTEL_OUTPUT_LVDS;
666 drm_encoder_helper_add(encoder, &cdv_intel_lvds_helper_funcs);
667 drm_connector_helper_add(connector,
668 &cdv_intel_lvds_connector_helper_funcs);
669 connector->display_info.subpixel_order = SubPixelHorizontalRGB;
670 connector->interlace_allowed = false;
671 connector->doublescan_allowed = false;
673 /*Attach connector properties*/
674 drm_object_attach_property(&connector->base,
675 dev->mode_config.scaling_mode_property,
676 DRM_MODE_SCALE_FULLSCREEN);
677 drm_object_attach_property(&connector->base,
678 dev_priv->backlight_property,
679 BRIGHTNESS_MAX_LEVEL);
683 * FIXME: distroy i2c_bus when exit
685 psb_intel_encoder->i2c_bus = psb_intel_i2c_create(dev,
688 if (!psb_intel_encoder->i2c_bus) {
690 &dev->pdev->dev, "I2C bus registration failed.\n");
693 psb_intel_encoder->i2c_bus->slave_addr = 0x2C;
694 dev_priv->lvds_i2c_bus = psb_intel_encoder->i2c_bus;
698 * 1) check for EDID on DDC
699 * 2) check for VBT data
700 * 3) check to see if LVDS is already on
701 * if none of the above, no panel
702 * 4) make sure lid is open
703 * if closed, act like it's not there for now
706 /* Set up the DDC bus. */
707 psb_intel_encoder->ddc_bus = psb_intel_i2c_create(dev,
710 if (!psb_intel_encoder->ddc_bus) {
711 dev_printk(KERN_ERR, &dev->pdev->dev,
712 "DDC bus registration " "failed.\n");
717 * Attempt to get the fixed panel mode from DDC. Assume that the
718 * preferred mode is the right one.
720 psb_intel_ddc_get_modes(connector,
721 &psb_intel_encoder->ddc_bus->adapter);
722 list_for_each_entry(scan, &connector->probed_modes, head) {
723 if (scan->type & DRM_MODE_TYPE_PREFERRED) {
724 mode_dev->panel_fixed_mode =
725 drm_mode_duplicate(dev, scan);
726 goto out; /* FIXME: check for quirks */
730 /* Failed to get EDID, what about VBT? do we need this?*/
731 if (dev_priv->lfp_lvds_vbt_mode) {
732 mode_dev->panel_fixed_mode =
733 drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);
734 if (mode_dev->panel_fixed_mode) {
735 mode_dev->panel_fixed_mode->type |=
736 DRM_MODE_TYPE_PREFERRED;
737 goto out; /* FIXME: check for quirks */
741 * If we didn't get EDID, try checking if the panel is already turned
742 * on. If so, assume that whatever is currently programmed is the
745 lvds = REG_READ(LVDS);
746 pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0;
747 crtc = psb_intel_get_crtc_from_pipe(dev, pipe);
749 if (crtc && (lvds & LVDS_PORT_EN)) {
750 mode_dev->panel_fixed_mode =
751 cdv_intel_crtc_mode_get(dev, crtc);
752 if (mode_dev->panel_fixed_mode) {
753 mode_dev->panel_fixed_mode->type |=
754 DRM_MODE_TYPE_PREFERRED;
755 goto out; /* FIXME: check for quirks */
759 /* If we still don't have a mode after all that, give up. */
760 if (!mode_dev->panel_fixed_mode) {
762 ("Found no modes on the lvds, ignoring the LVDS\n");
770 pwm = REG_READ(BLC_PWM_CTL2);
776 REG_WRITE(BLC_PWM_CTL2, pwm);
780 drm_sysfs_connector_add(connector);
784 printk(KERN_ERR "Failed find\n");
785 if (psb_intel_encoder->ddc_bus)
786 psb_intel_i2c_destroy(psb_intel_encoder->ddc_bus);
788 printk(KERN_ERR "Failed DDC\n");
789 if (psb_intel_encoder->i2c_bus)
790 psb_intel_i2c_destroy(psb_intel_encoder->i2c_bus);
792 printk(KERN_ERR "Failed BLC\n");
793 drm_encoder_cleanup(encoder);
794 drm_connector_cleanup(connector);
797 kfree(psb_intel_connector);
799 kfree(psb_intel_encoder);