1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright © 2006-2011 Intel Corporation
6 * Eric Anholt <eric@anholt.net>
7 * Dave Airlie <airlied@linux.ie>
8 * Jesse Barnes <jesse.barnes@intel.com>
11 #include <linux/dmi.h>
12 #include <linux/i2c.h>
13 #include <linux/pm_runtime.h>
15 #include "cdv_device.h"
16 #include "intel_bios.h"
19 #include "psb_intel_drv.h"
20 #include "psb_intel_reg.h"
23 * LVDS I2C backlight control macros
25 #define BRIGHTNESS_MAX_LEVEL 100
26 #define BRIGHTNESS_MASK 0xFF
27 #define BLC_I2C_TYPE 0x01
28 #define BLC_PWM_TYPT 0x02
30 #define BLC_POLARITY_NORMAL 0
31 #define BLC_POLARITY_INVERSE 1
33 #define PSB_BLC_MAX_PWM_REG_FREQ (0xFFFE)
34 #define PSB_BLC_MIN_PWM_REG_FREQ (0x2)
35 #define PSB_BLC_PWM_PRECISION_FACTOR (10)
36 #define PSB_BACKLIGHT_PWM_CTL_SHIFT (16)
37 #define PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR (0xFFFE)
39 struct cdv_intel_lvds_priv
{
41 * Saved LVDO output states
46 uint32_t savePP_CONTROL
;
47 uint32_t savePP_CYCLE
;
48 uint32_t savePFIT_CONTROL
;
49 uint32_t savePFIT_PGM_RATIOS
;
50 uint32_t saveBLC_PWM_CTL
;
54 * Returns the maximum level of the backlight duty cycle field.
56 static u32
cdv_intel_lvds_get_max_backlight(struct drm_device
*dev
)
58 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
61 if (gma_power_begin(dev
, false)) {
62 retval
= ((REG_READ(BLC_PWM_CTL
) &
63 BACKLIGHT_MODULATION_FREQ_MASK
) >>
64 BACKLIGHT_MODULATION_FREQ_SHIFT
) * 2;
68 retval
= ((dev_priv
->regs
.saveBLC_PWM_CTL
&
69 BACKLIGHT_MODULATION_FREQ_MASK
) >>
70 BACKLIGHT_MODULATION_FREQ_SHIFT
) * 2;
77 * Set LVDS backlight level by I2C command
79 static int cdv_lvds_i2c_set_brightness(struct drm_device
*dev
,
82 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
83 struct psb_intel_i2c_chan
*lvds_i2c_bus
= dev_priv
->lvds_i2c_bus
;
85 unsigned int blc_i2c_brightness
;
87 struct i2c_msg msgs
[] = {
89 .addr
= lvds_i2c_bus
->slave_addr
,
96 blc_i2c_brightness
= BRIGHTNESS_MASK
& ((unsigned int)level
*
98 BRIGHTNESS_MAX_LEVEL
);
100 if (dev_priv
->lvds_bl
->pol
== BLC_POLARITY_INVERSE
)
101 blc_i2c_brightness
= BRIGHTNESS_MASK
- blc_i2c_brightness
;
103 out_buf
[0] = dev_priv
->lvds_bl
->brightnesscmd
;
104 out_buf
[1] = (u8
)blc_i2c_brightness
;
106 if (i2c_transfer(&lvds_i2c_bus
->adapter
, msgs
, 1) == 1)
109 DRM_ERROR("I2C transfer error\n");
114 static int cdv_lvds_pwm_set_brightness(struct drm_device
*dev
, int level
)
116 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
119 u32 blc_pwm_duty_cycle
;
121 max_pwm_blc
= cdv_intel_lvds_get_max_backlight(dev
);
123 /*BLC_PWM_CTL Should be initiated while backlight device init*/
124 BUG_ON((max_pwm_blc
& PSB_BLC_MAX_PWM_REG_FREQ
) == 0);
126 blc_pwm_duty_cycle
= level
* max_pwm_blc
/ BRIGHTNESS_MAX_LEVEL
;
128 if (dev_priv
->lvds_bl
->pol
== BLC_POLARITY_INVERSE
)
129 blc_pwm_duty_cycle
= max_pwm_blc
- blc_pwm_duty_cycle
;
131 blc_pwm_duty_cycle
&= PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR
;
132 REG_WRITE(BLC_PWM_CTL
,
133 (max_pwm_blc
<< PSB_BACKLIGHT_PWM_CTL_SHIFT
) |
134 (blc_pwm_duty_cycle
));
140 * Set LVDS backlight level either by I2C or PWM
142 void cdv_intel_lvds_set_brightness(struct drm_device
*dev
, int level
)
144 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
146 if (!dev_priv
->lvds_bl
) {
147 DRM_ERROR("NO LVDS Backlight Info\n");
151 if (dev_priv
->lvds_bl
->type
== BLC_I2C_TYPE
)
152 cdv_lvds_i2c_set_brightness(dev
, level
);
154 cdv_lvds_pwm_set_brightness(dev
, level
);
159 * Sets the backlight level.
161 * level backlight level, from 0 to cdv_intel_lvds_get_max_backlight().
163 static void cdv_intel_lvds_set_backlight(struct drm_device
*dev
, int level
)
165 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
168 if (gma_power_begin(dev
, false)) {
170 REG_READ(BLC_PWM_CTL
) & ~BACKLIGHT_DUTY_CYCLE_MASK
;
171 REG_WRITE(BLC_PWM_CTL
,
173 (level
<< BACKLIGHT_DUTY_CYCLE_SHIFT
)));
176 blc_pwm_ctl
= dev_priv
->regs
.saveBLC_PWM_CTL
&
177 ~BACKLIGHT_DUTY_CYCLE_MASK
;
178 dev_priv
->regs
.saveBLC_PWM_CTL
= (blc_pwm_ctl
|
179 (level
<< BACKLIGHT_DUTY_CYCLE_SHIFT
));
184 * Sets the power state for the panel.
186 static void cdv_intel_lvds_set_power(struct drm_device
*dev
,
187 struct drm_encoder
*encoder
, bool on
)
189 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
192 if (!gma_power_begin(dev
, true))
196 REG_WRITE(PP_CONTROL
, REG_READ(PP_CONTROL
) |
199 pp_status
= REG_READ(PP_STATUS
);
200 } while ((pp_status
& PP_ON
) == 0);
202 cdv_intel_lvds_set_backlight(dev
,
203 dev_priv
->mode_dev
.backlight_duty_cycle
);
205 cdv_intel_lvds_set_backlight(dev
, 0);
207 REG_WRITE(PP_CONTROL
, REG_READ(PP_CONTROL
) &
210 pp_status
= REG_READ(PP_STATUS
);
211 } while (pp_status
& PP_ON
);
216 static void cdv_intel_lvds_encoder_dpms(struct drm_encoder
*encoder
, int mode
)
218 struct drm_device
*dev
= encoder
->dev
;
219 if (mode
== DRM_MODE_DPMS_ON
)
220 cdv_intel_lvds_set_power(dev
, encoder
, true);
222 cdv_intel_lvds_set_power(dev
, encoder
, false);
223 /* XXX: We never power down the LVDS pairs. */
226 static void cdv_intel_lvds_save(struct drm_connector
*connector
)
230 static void cdv_intel_lvds_restore(struct drm_connector
*connector
)
234 static enum drm_mode_status
cdv_intel_lvds_mode_valid(struct drm_connector
*connector
,
235 struct drm_display_mode
*mode
)
237 struct drm_device
*dev
= connector
->dev
;
238 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
239 struct drm_display_mode
*fixed_mode
=
240 dev_priv
->mode_dev
.panel_fixed_mode
;
243 if (mode
->flags
& DRM_MODE_FLAG_DBLSCAN
)
244 return MODE_NO_DBLESCAN
;
247 if (mode
->flags
& DRM_MODE_FLAG_INTERLACE
)
248 return MODE_NO_INTERLACE
;
251 if (mode
->hdisplay
> fixed_mode
->hdisplay
)
253 if (mode
->vdisplay
> fixed_mode
->vdisplay
)
259 static bool cdv_intel_lvds_mode_fixup(struct drm_encoder
*encoder
,
260 const struct drm_display_mode
*mode
,
261 struct drm_display_mode
*adjusted_mode
)
263 struct drm_device
*dev
= encoder
->dev
;
264 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
265 struct psb_intel_mode_device
*mode_dev
= &dev_priv
->mode_dev
;
266 struct drm_encoder
*tmp_encoder
;
267 struct drm_display_mode
*panel_fixed_mode
= mode_dev
->panel_fixed_mode
;
269 /* Should never happen!! */
270 list_for_each_entry(tmp_encoder
, &dev
->mode_config
.encoder_list
,
272 if (tmp_encoder
!= encoder
273 && tmp_encoder
->crtc
== encoder
->crtc
) {
274 pr_err("Can't enable LVDS and another encoder on the same pipe\n");
280 * If we have timings from the BIOS for the panel, put them in
281 * to the adjusted mode. The CRTC will be set up for this mode,
282 * with the panel scaling set up to source from the H/VDisplay
283 * of the original mode.
285 if (panel_fixed_mode
!= NULL
) {
286 adjusted_mode
->hdisplay
= panel_fixed_mode
->hdisplay
;
287 adjusted_mode
->hsync_start
= panel_fixed_mode
->hsync_start
;
288 adjusted_mode
->hsync_end
= panel_fixed_mode
->hsync_end
;
289 adjusted_mode
->htotal
= panel_fixed_mode
->htotal
;
290 adjusted_mode
->vdisplay
= panel_fixed_mode
->vdisplay
;
291 adjusted_mode
->vsync_start
= panel_fixed_mode
->vsync_start
;
292 adjusted_mode
->vsync_end
= panel_fixed_mode
->vsync_end
;
293 adjusted_mode
->vtotal
= panel_fixed_mode
->vtotal
;
294 adjusted_mode
->clock
= panel_fixed_mode
->clock
;
295 drm_mode_set_crtcinfo(adjusted_mode
,
296 CRTC_INTERLACE_HALVE_V
);
300 * XXX: It would be nice to support lower refresh rates on the
301 * panels to reduce power consumption, and perhaps match the
302 * user's requested refresh rate.
308 static void cdv_intel_lvds_prepare(struct drm_encoder
*encoder
)
310 struct drm_device
*dev
= encoder
->dev
;
311 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
312 struct psb_intel_mode_device
*mode_dev
= &dev_priv
->mode_dev
;
314 if (!gma_power_begin(dev
, true))
317 mode_dev
->saveBLC_PWM_CTL
= REG_READ(BLC_PWM_CTL
);
318 mode_dev
->backlight_duty_cycle
= (mode_dev
->saveBLC_PWM_CTL
&
319 BACKLIGHT_DUTY_CYCLE_MASK
);
321 cdv_intel_lvds_set_power(dev
, encoder
, false);
326 static void cdv_intel_lvds_commit(struct drm_encoder
*encoder
)
328 struct drm_device
*dev
= encoder
->dev
;
329 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
330 struct psb_intel_mode_device
*mode_dev
= &dev_priv
->mode_dev
;
332 if (mode_dev
->backlight_duty_cycle
== 0)
333 mode_dev
->backlight_duty_cycle
=
334 cdv_intel_lvds_get_max_backlight(dev
);
336 cdv_intel_lvds_set_power(dev
, encoder
, true);
339 static void cdv_intel_lvds_mode_set(struct drm_encoder
*encoder
,
340 struct drm_display_mode
*mode
,
341 struct drm_display_mode
*adjusted_mode
)
343 struct drm_device
*dev
= encoder
->dev
;
344 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
345 struct gma_crtc
*gma_crtc
= to_gma_crtc(encoder
->crtc
);
349 * The LVDS pin pair will already have been turned on in the
350 * cdv_intel_crtc_mode_set since it has a large impact on the DPLL
355 * Enable automatic panel scaling so that non-native modes fill the
356 * screen. Should be enabled before the pipe is enabled, according to
357 * register description and PRM.
359 if (mode
->hdisplay
!= adjusted_mode
->hdisplay
||
360 mode
->vdisplay
!= adjusted_mode
->vdisplay
)
361 pfit_control
= (PFIT_ENABLE
| VERT_AUTO_SCALE
|
362 HORIZ_AUTO_SCALE
| VERT_INTERP_BILINEAR
|
363 HORIZ_INTERP_BILINEAR
);
367 pfit_control
|= gma_crtc
->pipe
<< PFIT_PIPE_SHIFT
;
369 if (dev_priv
->lvds_dither
)
370 pfit_control
|= PANEL_8TO6_DITHER_ENABLE
;
372 REG_WRITE(PFIT_CONTROL
, pfit_control
);
376 * Return the list of DDC modes if available, or the BIOS fixed mode otherwise.
378 static int cdv_intel_lvds_get_modes(struct drm_connector
*connector
)
380 struct drm_device
*dev
= connector
->dev
;
381 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
382 struct gma_encoder
*gma_encoder
= gma_attached_encoder(connector
);
383 struct psb_intel_mode_device
*mode_dev
= &dev_priv
->mode_dev
;
386 ret
= psb_intel_ddc_get_modes(connector
, &gma_encoder
->i2c_bus
->adapter
);
391 if (mode_dev
->panel_fixed_mode
!= NULL
) {
392 struct drm_display_mode
*mode
=
393 drm_mode_duplicate(dev
, mode_dev
->panel_fixed_mode
);
394 drm_mode_probed_add(connector
, mode
);
402 * cdv_intel_lvds_destroy - unregister and free LVDS structures
403 * @connector: connector to free
405 * Unregister the DDC bus for this connector then free the driver private
408 static void cdv_intel_lvds_destroy(struct drm_connector
*connector
)
410 struct gma_encoder
*gma_encoder
= gma_attached_encoder(connector
);
412 psb_intel_i2c_destroy(gma_encoder
->i2c_bus
);
413 drm_connector_unregister(connector
);
414 drm_connector_cleanup(connector
);
418 static int cdv_intel_lvds_set_property(struct drm_connector
*connector
,
419 struct drm_property
*property
,
422 struct drm_encoder
*encoder
= connector
->encoder
;
424 if (!strcmp(property
->name
, "scaling mode") && encoder
) {
425 struct gma_crtc
*crtc
= to_gma_crtc(encoder
->crtc
);
432 case DRM_MODE_SCALE_FULLSCREEN
:
434 case DRM_MODE_SCALE_NO_SCALE
:
436 case DRM_MODE_SCALE_ASPECT
:
442 if (drm_object_property_get_value(&connector
->base
,
447 if (curValue
== value
)
450 if (drm_object_property_set_value(&connector
->base
,
455 if (crtc
->saved_mode
.hdisplay
!= 0 &&
456 crtc
->saved_mode
.vdisplay
!= 0) {
457 if (!drm_crtc_helper_set_mode(encoder
->crtc
,
461 encoder
->crtc
->primary
->fb
))
464 } else if (!strcmp(property
->name
, "backlight") && encoder
) {
465 if (drm_object_property_set_value(&connector
->base
,
470 gma_backlight_set(encoder
->dev
, value
);
471 } else if (!strcmp(property
->name
, "DPMS") && encoder
) {
472 const struct drm_encoder_helper_funcs
*helpers
=
473 encoder
->helper_private
;
474 helpers
->dpms(encoder
, value
);
479 static const struct drm_encoder_helper_funcs
480 cdv_intel_lvds_helper_funcs
= {
481 .dpms
= cdv_intel_lvds_encoder_dpms
,
482 .mode_fixup
= cdv_intel_lvds_mode_fixup
,
483 .prepare
= cdv_intel_lvds_prepare
,
484 .mode_set
= cdv_intel_lvds_mode_set
,
485 .commit
= cdv_intel_lvds_commit
,
488 static const struct drm_connector_helper_funcs
489 cdv_intel_lvds_connector_helper_funcs
= {
490 .get_modes
= cdv_intel_lvds_get_modes
,
491 .mode_valid
= cdv_intel_lvds_mode_valid
,
492 .best_encoder
= gma_best_encoder
,
495 static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs
= {
496 .dpms
= drm_helper_connector_dpms
,
497 .fill_modes
= drm_helper_probe_single_connector_modes
,
498 .set_property
= cdv_intel_lvds_set_property
,
499 .destroy
= cdv_intel_lvds_destroy
,
503 static void cdv_intel_lvds_enc_destroy(struct drm_encoder
*encoder
)
505 drm_encoder_cleanup(encoder
);
508 static const struct drm_encoder_funcs cdv_intel_lvds_enc_funcs
= {
509 .destroy
= cdv_intel_lvds_enc_destroy
,
513 * Enumerate the child dev array parsed from VBT to check whether
514 * the LVDS is present.
515 * If it is present, return 1.
516 * If it is not present, return false.
517 * If no child dev is parsed from VBT, it assumes that the LVDS is present.
519 static bool lvds_is_present_in_vbt(struct drm_device
*dev
,
522 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
525 if (!dev_priv
->child_dev_num
)
528 for (i
= 0; i
< dev_priv
->child_dev_num
; i
++) {
529 struct child_device_config
*child
= dev_priv
->child_dev
+ i
;
531 /* If the device type is not LFP, continue.
532 * We have to check both the new identifiers as well as the
533 * old for compatibility with some BIOSes.
535 if (child
->device_type
!= DEVICE_TYPE_INT_LFP
&&
536 child
->device_type
!= DEVICE_TYPE_LFP
)
540 *i2c_pin
= child
->i2c_pin
;
542 /* However, we cannot trust the BIOS writers to populate
543 * the VBT correctly. Since LVDS requires additional
544 * information from AIM blocks, a non-zero addin offset is
545 * a good indicator that the LVDS is actually present.
547 if (child
->addin_offset
)
550 /* But even then some BIOS writers perform some black magic
551 * and instantiate the device without reference to any
552 * additional data. Trust that if the VBT was written into
553 * the OpRegion then they have validated the LVDS's existence.
555 if (dev_priv
->opregion
.vbt
)
563 * cdv_intel_lvds_init - setup LVDS connectors on this device
566 * Create the connector, register the LVDS DDC bus, and try to figure out what
567 * modes we can display on the LVDS panel (if present).
569 void cdv_intel_lvds_init(struct drm_device
*dev
,
570 struct psb_intel_mode_device
*mode_dev
)
572 struct gma_encoder
*gma_encoder
;
573 struct gma_connector
*gma_connector
;
574 struct cdv_intel_lvds_priv
*lvds_priv
;
575 struct drm_connector
*connector
;
576 struct drm_encoder
*encoder
;
577 struct drm_display_mode
*scan
;
578 struct drm_crtc
*crtc
;
579 struct drm_psb_private
*dev_priv
= dev
->dev_private
;
584 if (!dev_priv
->lvds_enabled_in_vbt
)
587 pin
= GMBUS_PORT_PANEL
;
588 if (!lvds_is_present_in_vbt(dev
, &pin
)) {
589 DRM_DEBUG_KMS("LVDS is not present in VBT\n");
593 gma_encoder
= kzalloc(sizeof(struct gma_encoder
),
598 gma_connector
= kzalloc(sizeof(struct gma_connector
),
601 goto failed_connector
;
603 lvds_priv
= kzalloc(sizeof(struct cdv_intel_lvds_priv
), GFP_KERNEL
);
605 goto failed_lvds_priv
;
607 gma_encoder
->dev_priv
= lvds_priv
;
609 connector
= &gma_connector
->base
;
610 gma_connector
->save
= cdv_intel_lvds_save
;
611 gma_connector
->restore
= cdv_intel_lvds_restore
;
612 encoder
= &gma_encoder
->base
;
615 drm_connector_init(dev
, connector
,
616 &cdv_intel_lvds_connector_funcs
,
617 DRM_MODE_CONNECTOR_LVDS
);
619 drm_encoder_init(dev
, encoder
,
620 &cdv_intel_lvds_enc_funcs
,
621 DRM_MODE_ENCODER_LVDS
, NULL
);
624 gma_connector_attach_encoder(gma_connector
, gma_encoder
);
625 gma_encoder
->type
= INTEL_OUTPUT_LVDS
;
627 drm_encoder_helper_add(encoder
, &cdv_intel_lvds_helper_funcs
);
628 drm_connector_helper_add(connector
,
629 &cdv_intel_lvds_connector_helper_funcs
);
630 connector
->display_info
.subpixel_order
= SubPixelHorizontalRGB
;
631 connector
->interlace_allowed
= false;
632 connector
->doublescan_allowed
= false;
634 /*Attach connector properties*/
635 drm_object_attach_property(&connector
->base
,
636 dev
->mode_config
.scaling_mode_property
,
637 DRM_MODE_SCALE_FULLSCREEN
);
638 drm_object_attach_property(&connector
->base
,
639 dev_priv
->backlight_property
,
640 BRIGHTNESS_MAX_LEVEL
);
644 * FIXME: distroy i2c_bus when exit
646 gma_encoder
->i2c_bus
= psb_intel_i2c_create(dev
,
649 if (!gma_encoder
->i2c_bus
) {
651 &dev
->pdev
->dev
, "I2C bus registration failed.\n");
654 gma_encoder
->i2c_bus
->slave_addr
= 0x2C;
655 dev_priv
->lvds_i2c_bus
= gma_encoder
->i2c_bus
;
659 * 1) check for EDID on DDC
660 * 2) check for VBT data
661 * 3) check to see if LVDS is already on
662 * if none of the above, no panel
663 * 4) make sure lid is open
664 * if closed, act like it's not there for now
667 /* Set up the DDC bus. */
668 gma_encoder
->ddc_bus
= psb_intel_i2c_create(dev
,
671 if (!gma_encoder
->ddc_bus
) {
672 dev_printk(KERN_ERR
, &dev
->pdev
->dev
,
673 "DDC bus registration " "failed.\n");
678 * Attempt to get the fixed panel mode from DDC. Assume that the
679 * preferred mode is the right one.
681 mutex_lock(&dev
->mode_config
.mutex
);
682 psb_intel_ddc_get_modes(connector
,
683 &gma_encoder
->ddc_bus
->adapter
);
684 list_for_each_entry(scan
, &connector
->probed_modes
, head
) {
685 if (scan
->type
& DRM_MODE_TYPE_PREFERRED
) {
686 mode_dev
->panel_fixed_mode
=
687 drm_mode_duplicate(dev
, scan
);
688 goto out
; /* FIXME: check for quirks */
692 /* Failed to get EDID, what about VBT? do we need this?*/
693 if (dev_priv
->lfp_lvds_vbt_mode
) {
694 mode_dev
->panel_fixed_mode
=
695 drm_mode_duplicate(dev
, dev_priv
->lfp_lvds_vbt_mode
);
696 if (mode_dev
->panel_fixed_mode
) {
697 mode_dev
->panel_fixed_mode
->type
|=
698 DRM_MODE_TYPE_PREFERRED
;
699 goto out
; /* FIXME: check for quirks */
703 * If we didn't get EDID, try checking if the panel is already turned
704 * on. If so, assume that whatever is currently programmed is the
707 lvds
= REG_READ(LVDS
);
708 pipe
= (lvds
& LVDS_PIPEB_SELECT
) ? 1 : 0;
709 crtc
= psb_intel_get_crtc_from_pipe(dev
, pipe
);
711 if (crtc
&& (lvds
& LVDS_PORT_EN
)) {
712 mode_dev
->panel_fixed_mode
=
713 cdv_intel_crtc_mode_get(dev
, crtc
);
714 if (mode_dev
->panel_fixed_mode
) {
715 mode_dev
->panel_fixed_mode
->type
|=
716 DRM_MODE_TYPE_PREFERRED
;
717 goto out
; /* FIXME: check for quirks */
721 /* If we still don't have a mode after all that, give up. */
722 if (!mode_dev
->panel_fixed_mode
) {
724 ("Found no modes on the lvds, ignoring the LVDS\n");
732 pwm
= REG_READ(BLC_PWM_CTL2
);
738 REG_WRITE(BLC_PWM_CTL2
, pwm
);
742 mutex_unlock(&dev
->mode_config
.mutex
);
743 drm_connector_register(connector
);
747 mutex_unlock(&dev
->mode_config
.mutex
);
748 pr_err("Failed find\n");
749 psb_intel_i2c_destroy(gma_encoder
->ddc_bus
);
751 pr_err("Failed DDC\n");
752 psb_intel_i2c_destroy(gma_encoder
->i2c_bus
);
754 pr_err("Failed BLC\n");
755 drm_encoder_cleanup(encoder
);
756 drm_connector_cleanup(connector
);
759 kfree(gma_connector
);