@@ -704,6 +704,13 @@ typedef struct drm_i915_private {
struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
+ /* Backlight driver */
+ u32 (*get_backlight)(struct drm_device *dev);
+ u32 (*get_max_backlight)(struct drm_device *dev);
+ void (*set_backlight)(struct drm_device *dev, u32 level);
+ void (*disable_backlight)(struct drm_device *dev);
+ void (*enable_backlight)(struct drm_device *dev, enum pipe pipe);
+
/* Feature bits from the VBIOS */
unsigned int int_tv_support:1;
unsigned int lvds_dither:1;
@@ -915,7 +922,6 @@ typedef struct drm_i915_private {
struct drm_property *broadcast_rgb_property;
struct drm_property *force_audio_property;
-
bool hw_contexts_disabled;
uint32_t hw_context_size;
@@ -1196,7 +1196,7 @@ void ironlake_edp_backlight_on(struct intel_dp *intel_dp)
I915_WRITE(PCH_PP_CONTROL, pp);
POSTING_READ(PCH_PP_CONTROL);
- intel_panel_enable_backlight(dev, pipe);
+ dev_priv->enable_backlight(dev, pipe);
}
void ironlake_edp_backlight_off(struct intel_dp *intel_dp)
@@ -1208,7 +1208,7 @@ void ironlake_edp_backlight_off(struct intel_dp *intel_dp)
if (!is_edp(intel_dp))
return;
- intel_panel_disable_backlight(dev);
+ dev_priv->disable_backlight(dev);
DRM_DEBUG_KMS("\n");
pp = ironlake_get_pp_control(dev_priv);
@@ -488,9 +488,6 @@ extern void intel_pch_panel_fitting(struct drm_device *dev,
extern u32 intel_panel_get_max_backlight(struct drm_device *dev);
extern void intel_panel_set_backlight(struct drm_device *dev, u32 level);
extern int intel_panel_setup_backlight(struct drm_connector *connector);
-extern void intel_panel_enable_backlight(struct drm_device *dev,
- enum pipe pipe);
-extern void intel_panel_disable_backlight(struct drm_device *dev);
extern void intel_panel_destroy_backlight(struct drm_device *dev);
extern enum drm_connector_status intel_panel_detect(struct drm_device *dev);
@@ -136,7 +136,7 @@ static void intel_enable_lvds(struct intel_encoder *encoder)
if (wait_for((I915_READ(stat_reg) & PP_ON) != 0, 1000))
DRM_ERROR("timed out waiting for panel to power on\n");
- intel_panel_enable_backlight(dev, intel_crtc->pipe);
+ dev_priv->enable_backlight(dev, intel_crtc->pipe);
}
static void intel_disable_lvds(struct intel_encoder *encoder)
@@ -156,7 +156,7 @@ static void intel_disable_lvds(struct intel_encoder *encoder)
stat_reg = PP_STATUS;
}
- intel_panel_disable_backlight(dev);
+ dev_priv->disable_backlight(dev);
I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON);
if (wait_for((I915_READ(stat_reg) & PP_ON) == 0, 1000))
@@ -126,3 +126,4 @@ intel_attach_broadcast_rgb_property(struct drm_connector *connector)
drm_object_attach_property(&connector->base, prop, 0);
}
+
@@ -32,6 +32,7 @@
#include <linux/moduleparam.h>
#include "intel_drv.h"
+#include "i915_drv.h"
#define PCI_LBPC 0xf4 /* legacy/combination backlight modes */
@@ -245,7 +246,7 @@ static u32 intel_panel_compute_brightness(struct drm_device *dev, u32 val)
if (i915_panel_invert_brightness > 0 ||
dev_priv->quirks & QUIRK_INVERT_BRIGHTNESS)
- return intel_panel_get_max_backlight(dev) - val;
+ return dev_priv->get_max_backlight(dev) - val;
return val;
}
@@ -294,7 +295,7 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, u32 level
return intel_pch_panel_set_backlight(dev, level);
if (is_backlight_combination_mode(dev)) {
- u32 max = intel_panel_get_max_backlight(dev);
+ u32 max = dev_priv->get_max_backlight(dev);
u8 lbpc;
lbpc = level * 0xfe / max + 1;
@@ -318,7 +319,7 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level)
intel_panel_actually_set_backlight(dev, level);
}
-void intel_panel_disable_backlight(struct drm_device *dev)
+static void intel_panel_disable_backlight(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
@@ -340,13 +341,13 @@ void intel_panel_disable_backlight(struct drm_device *dev)
}
}
-void intel_panel_enable_backlight(struct drm_device *dev,
- enum pipe pipe)
+static void intel_panel_enable_backlight(struct drm_device *dev,
+ enum pipe pipe)
{
struct drm_i915_private *dev_priv = dev->dev_private;
if (dev_priv->backlight_level == 0)
- dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
+ dev_priv->backlight_level = dev_priv->get_max_backlight(dev);
if (INTEL_INFO(dev)->gen >= 4) {
uint32_t reg, tmp;
@@ -395,7 +396,13 @@ static void intel_panel_init_backlight(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
- dev_priv->backlight_level = intel_panel_get_backlight(dev);
+ dev_priv->get_backlight = intel_panel_get_backlight;
+ dev_priv->get_max_backlight = intel_panel_get_max_backlight;
+ dev_priv->set_backlight = intel_panel_set_backlight;
+ dev_priv->disable_backlight = intel_panel_disable_backlight;
+ dev_priv->enable_backlight = intel_panel_enable_backlight;
+
+ dev_priv->backlight_level = dev_priv->get_backlight(dev);
dev_priv->backlight_enabled = dev_priv->backlight_level != 0;
}
@@ -425,7 +432,9 @@ intel_panel_detect(struct drm_device *dev)
static int intel_panel_update_status(struct backlight_device *bd)
{
struct drm_device *dev = bl_get_data(bd);
- intel_panel_set_backlight(dev, bd->props.brightness);
+ struct drm_i915_private *dev_priv = dev->dev_private;
+
+ dev_priv->set_backlight(dev, bd->props.brightness);
return 0;
}