[PATCH 7/7] drm/i915/dp: Limit brightness level to vbt min brightness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Limit minimum brightness to vbt min brightness when using aux
based brightness control to avoid letting the screen
from going completely blank.
Sometimes vbt can have some bogus values hence clamping the value
for sanity in case of corner case.

--v2
-Use something same mechanism to limit minimum brightness
that PWM method uses [Jani]

Signed-off-by: Suraj Kandpal <suraj.kandpal@xxxxxxxxx>
---
 drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
index 20dd5a6a0f3f..eb2a7225dfaa 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
@@ -411,6 +411,8 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi
 	struct intel_panel *panel = &connector->panel;
 	struct drm_luminance_range_info *luminance_range =
 		&connector->base.display_info.luminance_range;
+	u32 min_level = clamp_t(u32,
+				connector->panel.vbt.backlight.min_brightness, 0, 64);
 	int ret;
 
 	drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] SDR backlight is controlled through %s\n",
@@ -427,14 +429,12 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi
 		}
 	}
 
-	if (luminance_range->max_luminance) {
+	if (luminance_range->max_luminance)
 		panel->backlight.max = luminance_range->max_luminance;
-		panel->backlight.min = luminance_range->min_luminance;
-	} else {
+	else
 		panel->backlight.max = 512;
-		panel->backlight.min = 0;
-	}
 
+	panel->backlight.min = min_level;
 	intel_dp_aux_write_panel_luminance_override(connector);
 
 	drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] Using AUX HDR interface for backlight control (range %d..%d)\n",
-- 
2.43.2




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux