diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_panel.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 8e374449c6b5..18784470a760 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -751,6 +751,8 @@ void intel_panel_disable_backlight(struct intel_connector *connector) | |||
751 | 751 | ||
752 | spin_lock_irqsave(&dev_priv->backlight_lock, flags); | 752 | spin_lock_irqsave(&dev_priv->backlight_lock, flags); |
753 | 753 | ||
754 | if (panel->backlight.device) | ||
755 | panel->backlight.device->props.power = FB_BLANK_POWERDOWN; | ||
754 | panel->backlight.enabled = false; | 756 | panel->backlight.enabled = false; |
755 | dev_priv->display.disable_backlight(connector); | 757 | dev_priv->display.disable_backlight(connector); |
756 | 758 | ||
@@ -957,6 +959,8 @@ void intel_panel_enable_backlight(struct intel_connector *connector) | |||
957 | 959 | ||
958 | dev_priv->display.enable_backlight(connector); | 960 | dev_priv->display.enable_backlight(connector); |
959 | panel->backlight.enabled = true; | 961 | panel->backlight.enabled = true; |
962 | if (panel->backlight.device) | ||
963 | panel->backlight.device->props.power = FB_BLANK_UNBLANK; | ||
960 | 964 | ||
961 | spin_unlock_irqrestore(&dev_priv->backlight_lock, flags); | 965 | spin_unlock_irqrestore(&dev_priv->backlight_lock, flags); |
962 | } | 966 | } |
@@ -965,6 +969,7 @@ void intel_panel_enable_backlight(struct intel_connector *connector) | |||
965 | static int intel_backlight_device_update_status(struct backlight_device *bd) | 969 | static int intel_backlight_device_update_status(struct backlight_device *bd) |
966 | { | 970 | { |
967 | struct intel_connector *connector = bl_get_data(bd); | 971 | struct intel_connector *connector = bl_get_data(bd); |
972 | struct intel_panel *panel = &connector->panel; | ||
968 | struct drm_device *dev = connector->base.dev; | 973 | struct drm_device *dev = connector->base.dev; |
969 | 974 | ||
970 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | 975 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); |
@@ -972,6 +977,23 @@ static int intel_backlight_device_update_status(struct backlight_device *bd) | |||
972 | bd->props.brightness, bd->props.max_brightness); | 977 | bd->props.brightness, bd->props.max_brightness); |
973 | intel_panel_set_backlight(connector, bd->props.brightness, | 978 | intel_panel_set_backlight(connector, bd->props.brightness, |
974 | bd->props.max_brightness); | 979 | bd->props.max_brightness); |
980 | |||
981 | /* | ||
982 | * Allow flipping bl_power as a sub-state of enabled. Sadly the | ||
983 | * backlight class device does not make it easy to to differentiate | ||
984 | * between callbacks for brightness and bl_power, so our backlight_power | ||
985 | * callback needs to take this into account. | ||
986 | */ | ||
987 | if (panel->backlight.enabled) { | ||
988 | if (panel->backlight_power) { | ||
989 | bool enable = bd->props.power == FB_BLANK_UNBLANK && | ||
990 | bd->props.brightness != 0; | ||
991 | panel->backlight_power(connector, enable); | ||
992 | } | ||
993 | } else { | ||
994 | bd->props.power = FB_BLANK_POWERDOWN; | ||
995 | } | ||
996 | |||
975 | drm_modeset_unlock(&dev->mode_config.connection_mutex); | 997 | drm_modeset_unlock(&dev->mode_config.connection_mutex); |
976 | return 0; | 998 | return 0; |
977 | } | 999 | } |
@@ -1023,6 +1045,11 @@ static int intel_backlight_device_register(struct intel_connector *connector) | |||
1023 | panel->backlight.level, | 1045 | panel->backlight.level, |
1024 | props.max_brightness); | 1046 | props.max_brightness); |
1025 | 1047 | ||
1048 | if (panel->backlight.enabled) | ||
1049 | props.power = FB_BLANK_UNBLANK; | ||
1050 | else | ||
1051 | props.power = FB_BLANK_POWERDOWN; | ||
1052 | |||
1026 | /* | 1053 | /* |
1027 | * Note: using the same name independent of the connector prevents | 1054 | * Note: using the same name independent of the connector prevents |
1028 | * registration of multiple backlight devices in the driver. | 1055 | * registration of multiple backlight devices in the driver. |
@@ -1203,7 +1230,7 @@ static int vlv_setup_backlight(struct intel_connector *connector) | |||
1203 | enum pipe pipe; | 1230 | enum pipe pipe; |
1204 | u32 ctl, ctl2, val; | 1231 | u32 ctl, ctl2, val; |
1205 | 1232 | ||
1206 | for_each_pipe(pipe) { | 1233 | for_each_pipe(dev_priv, pipe) { |
1207 | u32 cur_val = I915_READ(VLV_BLC_PWM_CTL(pipe)); | 1234 | u32 cur_val = I915_READ(VLV_BLC_PWM_CTL(pipe)); |
1208 | 1235 | ||
1209 | /* Skip if the modulation freq is already set */ | 1236 | /* Skip if the modulation freq is already set */ |