[Intel-gfx] [PATCH 06/11] CHROMIUM: drm/i915: Provide valleyview backlight fallback value
clinton.a.taylor at intel.com
clinton.a.taylor at intel.com
Wed Jul 16 23:49:42 CEST 2014
From: Ben Widawsky <benjamin.widawsky at intel.com>
The fallback values for VLV reflect the Rambi3 panel values.
This patch introduces min_brightness member, which defined a part of VBT
that has some confusion. The field itself is a byte ranging from 0-255.
How this value is supposed to be used by the driver is unclear. Though
no code uses it yet, I've written a comment explaining that I intend to
use the number in there as an absolute value that represents the minimum
duty cycle ratio of the panel.
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
Signed-off-by: Wayne Boyer <wayne.boyer at intel.com>
BUG=chrome-os-partner:25159
TEST=suspend/resume test on instrumented system shows correct
signaling on oscope. Manual brightness checks.
Change-Id: I9f0d8d4fe2778c4768b06459b0a83293b1c6f023
Reviewed-on: https://chromium-review.googlesource.com/196607
Reviewed-by: Aaron Durbin <adurbin at chromium.org>
Tested-by: Wayne Boyer <wayne.boyer at intel.com>
Commit-Queue: Wayne Boyer <wayne.boyer at intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 10 ++++++++++
drivers/gpu/drm/i915/intel_bios.c | 35 ++++++++++++++++++++++++++++++++++-
2 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 90216bb..1962024 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1261,6 +1261,16 @@ struct intel_vbt_data {
u16 pwm_freq_hz;
bool present;
bool active_low_pwm;
+
+ /* NB: We expect this to be an absolute value (percentage)
+ * indicating the minimum duty cycle. This value is provided by
+ * the panel spec, and should be provided in some way/shape/form
+ * from VBIOS. It's unclear as of this point whether or not
+ * this is the proper way.
+ *
+ * Example, 5 = 5% = .05
+ */
+ u8 min_duty_cycle_percentage;
} backlight;
/* MIPI DSI */
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 827498e..557338a 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -309,6 +309,20 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
}
}
+#define VLV_DEFAULT_MIN_DUTY_CYCLE_RATIO 5
+static void fake_vlv_backlight(struct drm_i915_private *dev_priv)
+{
+ dev_priv->vbt.backlight.pwm_freq_hz = 200;
+ dev_priv->vbt.backlight.active_low_pwm = 0;
+ dev_priv->vbt.backlight.min_duty_cycle_percentage = VLV_DEFAULT_MIN_DUTY_CYCLE_RATIO;
+
+ DRM_DEBUG_KMS("VBT backlight PWM modulation frequency %u Hz, "
+ "active %s, min brightness %u\n",
+ dev_priv->vbt.backlight.pwm_freq_hz,
+ dev_priv->vbt.backlight.active_low_pwm ? "low" : "high",
+ dev_priv->vbt.backlight.min_duty_cycle_percentage);
+}
+
static void
parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
{
@@ -316,8 +330,10 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
const struct bdb_lfp_backlight_data_entry *entry;
backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
- if (!backlight_data)
+ if (!backlight_data && IS_VALLEYVIEW(dev_priv->dev)) {
+ fake_vlv_backlight(dev_priv);
return;
+ }
if (backlight_data->entry_size != sizeof(backlight_data->data[0])) {
DRM_DEBUG_KMS("Unsupported backlight data entry size %u\n",
@@ -336,6 +352,23 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz;
dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm;
+
+ /* NB: It's probably safe to do this for !VLV platforms too. */
+ if (IS_VALLEYVIEW(dev_priv->dev) && !entry->min_brightness)
+ dev_priv->vbt.backlight.min_duty_cycle_percentage = VLV_DEFAULT_MIN_DUTY_CYCLE_RATIO;
+ else if (entry->min_brightness) {
+ /* Scale min_duty_cycle_percentage down to an absolute value */
+ u32 scaled_bright = entry->min_brightness;
+ u32 abs_bright = scaled_bright * 100 / 255;
+ DRM_DEBUG_KMS("Scaling VBT brightness from %d down to absolute %d\n",
+ scaled_bright, abs_bright);
+ dev_priv->vbt.backlight.min_duty_cycle_percentage = abs_bright;
+ }
+
+ /* All platforms should have a PWM */
+ if (WARN_ON(!dev_priv->vbt.backlight.pwm_freq_hz))
+ dev_priv->vbt.backlight.pwm_freq_hz = 200;
+
DRM_DEBUG_KMS("VBT backlight PWM modulation frequency %u Hz, "
"active %s, min brightness %u, level %u\n",
dev_priv->vbt.backlight.pwm_freq_hz,
--
1.7.9.5
More information about the Intel-gfx
mailing list