drm/i915: group backlight related stuff into a struct
authorJani Nikula <jani.nikula@intel.com>
Tue, 2 Apr 2013 12:48:09 +0000 (15:48 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 2 Apr 2013 13:49:00 +0000 (15:49 +0200)
No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_panel.c

index 2962a9ab44d5455cada1a0d7aeddc05da9b932d7..5e38a2cf95f463d8aba33acd517a1774726525c9 100644 (file)
@@ -939,9 +939,14 @@ typedef struct drm_i915_private {
        struct intel_overlay *overlay;
        unsigned int sprite_scaling_enabled;
 
+       /* backlight */
+       struct {
+               int level;
+               bool enabled;
+               struct backlight_device *device;
+       } backlight;
+
        /* LVDS info */
-       int backlight_level;  /* restore backlight to this value */
-       bool backlight_enabled;
        struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
        struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
 
@@ -1043,8 +1048,6 @@ typedef struct drm_i915_private {
         */
        struct work_struct console_resume_work;
 
-       struct backlight_device *backlight;
-
        struct drm_property *broadcast_rgb_property;
        struct drm_property *force_audio_property;
 
index 21f415ad80a3418d815dbb31047c8bc1585b19b4..0e7e873b06f5158db145f5a51c93d60e43f7f9a8 100644 (file)
@@ -286,11 +286,11 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
 
-       dev_priv->backlight_level = level;
-       if (dev_priv->backlight)
-               dev_priv->backlight->props.brightness = level;
+       dev_priv->backlight.level = level;
+       if (dev_priv->backlight.device)
+               dev_priv->backlight.device->props.brightness = level;
 
-       if (dev_priv->backlight_enabled)
+       if (dev_priv->backlight.enabled)
                intel_panel_actually_set_backlight(dev, level);
 }
 
@@ -298,7 +298,7 @@ void intel_panel_disable_backlight(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
 
-       dev_priv->backlight_enabled = false;
+       dev_priv->backlight.enabled = false;
        intel_panel_actually_set_backlight(dev, 0);
 
        if (INTEL_INFO(dev)->gen >= 4) {
@@ -321,15 +321,15 @@ void intel_panel_enable_backlight(struct drm_device *dev,
 {
        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);
-               if (dev_priv->backlight)
-                       dev_priv->backlight->props.brightness =
-                               dev_priv->backlight_level;
+       if (dev_priv->backlight.level == 0) {
+               dev_priv->backlight.level = intel_panel_get_max_backlight(dev);
+               if (dev_priv->backlight.device)
+                       dev_priv->backlight.device->props.brightness =
+                               dev_priv->backlight.level;
        }
 
-       dev_priv->backlight_enabled = true;
-       intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
+       dev_priv->backlight.enabled = true;
+       intel_panel_actually_set_backlight(dev, dev_priv->backlight.level);
 
        if (INTEL_INFO(dev)->gen >= 4) {
                uint32_t reg, tmp;
@@ -371,15 +371,15 @@ set_level:
         * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written.
         */
        if (!intel_panel_get_backlight(dev))
-               intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
+               intel_panel_actually_set_backlight(dev, dev_priv->backlight.level);
 }
 
 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->backlight_enabled = dev_priv->backlight_level != 0;
+       dev_priv->backlight.level = intel_panel_get_backlight(dev);
+       dev_priv->backlight.enabled = dev_priv->backlight.level != 0;
 }
 
 enum drm_connector_status
@@ -433,21 +433,21 @@ int intel_panel_setup_backlight(struct drm_connector *connector)
 
        memset(&props, 0, sizeof(props));
        props.type = BACKLIGHT_RAW;
-       props.brightness = dev_priv->backlight_level;
+       props.brightness = dev_priv->backlight.level;
        props.max_brightness = _intel_panel_get_max_backlight(dev);
        if (props.max_brightness == 0) {
                DRM_DEBUG_DRIVER("Failed to get maximum backlight value\n");
                return -ENODEV;
        }
-       dev_priv->backlight =
+       dev_priv->backlight.device =
                backlight_device_register("intel_backlight",
                                          &connector->kdev, dev,
                                          &intel_panel_bl_ops, &props);
 
-       if (IS_ERR(dev_priv->backlight)) {
+       if (IS_ERR(dev_priv->backlight.device)) {
                DRM_ERROR("Failed to register backlight: %ld\n",
-                         PTR_ERR(dev_priv->backlight));
-               dev_priv->backlight = NULL;
+                         PTR_ERR(dev_priv->backlight.device));
+               dev_priv->backlight.device = NULL;
                return -ENODEV;
        }
        return 0;
@@ -456,8 +456,8 @@ int intel_panel_setup_backlight(struct drm_connector *connector)
 void intel_panel_destroy_backlight(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
-       if (dev_priv->backlight)
-               backlight_device_unregister(dev_priv->backlight);
+       if (dev_priv->backlight.device)
+               backlight_device_unregister(dev_priv->backlight.device);
 }
 #else
 int intel_panel_setup_backlight(struct drm_connector *connector)