Rev 3037 | Rev 3482 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3037 | Rev 3243 | ||
---|---|---|---|
Line 128... | Line 128... | ||
128 | return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE; |
128 | return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE; |
Line 129... | Line 129... | ||
129 | 129 | ||
130 | return 0; |
130 | return 0; |
Line 131... | Line 131... | ||
131 | } |
131 | } |
132 | 132 | ||
- | 133 | static u32 i915_read_blc_pwm_ctl(struct drm_device *dev) |
|
133 | static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv) |
134 | { |
Line 134... | Line 135... | ||
134 | { |
135 | struct drm_i915_private *dev_priv = dev->dev_private; |
Line 135... | Line 136... | ||
135 | u32 val; |
136 | u32 val; |
136 | 137 | ||
137 | /* Restore the CTL value if it lost, e.g. GPU reset */ |
138 | /* Restore the CTL value if it lost, e.g. GPU reset */ |
138 | 139 | ||
139 | if (HAS_PCH_SPLIT(dev_priv->dev)) { |
140 | if (HAS_PCH_SPLIT(dev_priv->dev)) { |
140 | val = I915_READ(BLC_PWM_PCH_CTL2); |
- | |
141 | if (dev_priv->saveBLC_PWM_CTL2 == 0) { |
141 | val = I915_READ(BLC_PWM_PCH_CTL2); |
142 | dev_priv->saveBLC_PWM_CTL2 = val; |
142 | if (dev_priv->regfile.saveBLC_PWM_CTL2 == 0) { |
143 | } else if (val == 0) { |
143 | dev_priv->regfile.saveBLC_PWM_CTL2 = val; |
144 | I915_WRITE(BLC_PWM_PCH_CTL2, |
144 | } else if (val == 0) { |
145 | dev_priv->saveBLC_PWM_CTL2); |
145 | val = dev_priv->regfile.saveBLC_PWM_CTL2; |
146 | val = dev_priv->saveBLC_PWM_CTL2; |
146 | I915_WRITE(BLC_PWM_PCH_CTL2, val); |
147 | } |
147 | } |
- | 148 | } else { |
|
148 | } else { |
149 | val = I915_READ(BLC_PWM_CTL); |
- | 150 | if (dev_priv->regfile.saveBLC_PWM_CTL == 0) { |
|
149 | val = I915_READ(BLC_PWM_CTL); |
151 | dev_priv->regfile.saveBLC_PWM_CTL = val; |
- | 152 | if (INTEL_INFO(dev)->gen >= 4) |
|
150 | if (dev_priv->saveBLC_PWM_CTL == 0) { |
153 | dev_priv->regfile.saveBLC_PWM_CTL2 = |
151 | dev_priv->saveBLC_PWM_CTL = val; |
154 | I915_READ(BLC_PWM_CTL2); |
152 | dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2); |
155 | } else if (val == 0) { |
153 | } else if (val == 0) { |
156 | val = dev_priv->regfile.saveBLC_PWM_CTL; |
154 | I915_WRITE(BLC_PWM_CTL, |
- | |
155 | dev_priv->saveBLC_PWM_CTL); |
157 | I915_WRITE(BLC_PWM_CTL, val); |
156 | I915_WRITE(BLC_PWM_CTL2, |
158 | if (INTEL_INFO(dev)->gen >= 4) |
Line 157... | Line 159... | ||
157 | dev_priv->saveBLC_PWM_CTL2); |
159 | I915_WRITE(BLC_PWM_CTL2, |
158 | val = dev_priv->saveBLC_PWM_CTL; |
160 | dev_priv->regfile.saveBLC_PWM_CTL2); |
Line 159... | Line 161... | ||
159 | } |
161 | } |
160 | } |
162 | } |
161 | - | ||
162 | return val; |
163 | |
Line 163... | Line 164... | ||
163 | } |
164 | return val; |
Line 164... | Line 165... | ||
164 | 165 | } |
|
165 | static u32 _intel_panel_get_max_backlight(struct drm_device *dev) |
166 | |
166 | { |
167 | static u32 _intel_panel_get_max_backlight(struct drm_device *dev) |
167 | struct drm_i915_private *dev_priv = dev->dev_private; |
168 | { |
Line 372... | Line 373... | ||
372 | } |
373 | } |
Line 373... | Line 374... | ||
373 | 374 | ||
374 | enum drm_connector_status |
375 | enum drm_connector_status |
375 | intel_panel_detect(struct drm_device *dev) |
376 | intel_panel_detect(struct drm_device *dev) |
376 | { |
- | |
377 | #if 0 |
377 | { |
378 | struct drm_i915_private *dev_priv = dev->dev_private; |
- | |
379 | #endif |
- | |
380 | - | ||
381 | if (i915_panel_ignore_lid) |
- | |
382 | return i915_panel_ignore_lid > 0 ? |
- | |
383 | connector_status_connected : |
- | |
Line 384... | Line -... | ||
384 | connector_status_disconnected; |
- | |
385 | - | ||
386 | /* opregion lid state on HP 2540p is wrong at boot up, |
- | |
387 | * appears to be either the BIOS or Linux ACPI fault */ |
378 | struct drm_i915_private *dev_priv = dev->dev_private; |
388 | #if 0 |
379 | |
389 | /* Assume that the BIOS does not lie through the OpRegion... */ |
380 | /* Assume that the BIOS does not lie through the OpRegion... */ |
390 | if (dev_priv->opregion.lid_state) |
381 | if (!i915_panel_ignore_lid && dev_priv->opregion.lid_state) { |
391 | return ioread32(dev_priv->opregion.lid_state) & 0x1 ? |
382 | return ioread32(dev_priv->opregion.lid_state) & 0x1 ? |
392 | connector_status_connected : |
383 | connector_status_connected : |
Line -... | Line 384... | ||
- | 384 | connector_status_disconnected; |
|
- | 385 | } |
|
- | 386 | ||
- | 387 | switch (i915_panel_ignore_lid) { |
|
- | 388 | case -2: |
|
- | 389 | return connector_status_connected; |
|
393 | connector_status_disconnected; |
390 | case -1: |
394 | #endif |
391 | return connector_status_disconnected; |
- | 392 | default: |
|
Line 395... | Line 393... | ||
395 | 393 | return connector_status_unknown; |
|
396 | return connector_status_unknown; |
394 | } |
397 | } |
395 | } |
398 | 396 | ||
Line 414... | Line 412... | ||
414 | static const struct backlight_ops intel_panel_bl_ops = { |
412 | static const struct backlight_ops intel_panel_bl_ops = { |
415 | .update_status = intel_panel_update_status, |
413 | .update_status = intel_panel_update_status, |
416 | .get_brightness = intel_panel_get_brightness, |
414 | .get_brightness = intel_panel_get_brightness, |
417 | }; |
415 | }; |
Line 418... | Line 416... | ||
418 | 416 | ||
419 | int intel_panel_setup_backlight(struct drm_device *dev) |
417 | int intel_panel_setup_backlight(struct drm_connector *connector) |
- | 418 | { |
|
420 | { |
419 | struct drm_device *dev = connector->dev; |
421 | struct drm_i915_private *dev_priv = dev->dev_private; |
420 | struct drm_i915_private *dev_priv = dev->dev_private; |
422 | struct backlight_properties props; |
- | |
Line 423... | Line 421... | ||
423 | struct drm_connector *connector; |
421 | struct backlight_properties props; |
Line 424... | Line -... | ||
424 | - | ||
425 | intel_panel_init_backlight(dev); |
- | |
426 | - | ||
427 | if (dev_priv->int_lvds_connector) |
- | |
428 | connector = dev_priv->int_lvds_connector; |
- | |
429 | else if (dev_priv->int_edp_connector) |
- | |
430 | connector = dev_priv->int_edp_connector; |
- | |
431 | else |
422 | |
432 | return -ENODEV; |
423 | intel_panel_init_backlight(dev); |
433 | 424 | ||
434 | memset(&props, 0, sizeof(props)); |
425 | memset(&props, 0, sizeof(props)); |
435 | props.type = BACKLIGHT_RAW; |
426 | props.type = BACKLIGHT_RAW; |
Line 458... | Line 449... | ||
458 | struct drm_i915_private *dev_priv = dev->dev_private; |
449 | struct drm_i915_private *dev_priv = dev->dev_private; |
459 | if (dev_priv->backlight) |
450 | if (dev_priv->backlight) |
460 | backlight_device_unregister(dev_priv->backlight); |
451 | backlight_device_unregister(dev_priv->backlight); |
461 | } |
452 | } |
462 | #else |
453 | #else |
463 | int intel_panel_setup_backlight(struct drm_device *dev) |
454 | int intel_panel_setup_backlight(struct drm_connector *connector) |
464 | { |
455 | { |
465 | intel_panel_init_backlight(dev); |
456 | intel_panel_init_backlight(connector->dev); |
466 | return 0; |
457 | return 0; |
467 | } |
458 | } |
Line 468... | Line 459... | ||
468 | 459 | ||
469 | void intel_panel_destroy_backlight(struct drm_device *dev) |
460 | void intel_panel_destroy_backlight(struct drm_device *dev) |
470 | { |
461 | { |
471 | return; |
462 | return; |
472 | } |
463 | } |
- | 464 | #endif |
|
- | 465 | ||
- | 466 | int intel_panel_init(struct intel_panel *panel, |
|
- | 467 | struct drm_display_mode *fixed_mode) |
|
- | 468 | { |
|
- | 469 | panel->fixed_mode = fixed_mode; |
|
- | 470 | ||
- | 471 | return 0; |
|
- | 472 | } |
|
- | 473 | ||
- | 474 | void intel_panel_fini(struct intel_panel *panel) |
|
- | 475 | { |
|
- | 476 | struct intel_connector *intel_connector = |
|
- | 477 | container_of(panel, struct intel_connector, panel); |
|
- | 478 | ||
- | 479 | if (panel->fixed_mode) |
|
- | 480 | drm_mode_destroy(intel_connector->base.dev, panel->fixed_mode); |