drm/i915: Parse LFP brightness control field in VBT
authorDeepak M <m.deepak@intel.com>
Tue, 26 Apr 2016 13:14:24 +0000 (16:14 +0300)
committerJani Nikula <jani.nikula@intel.com>
Mon, 2 May 2016 13:17:38 +0000 (16:17 +0300)
These fields in VBT indicates the PWM source which
is used and also the controller number.

v2 by Jani: check for out of bounds access, some renames, change default
type, etc.

v3 by Jani: s/INTEL_BACKLIGHT_CABC/INTEL_BACKLIGHT_DSI_DCS/

Signed-off-by: Deepak M <m.deepak@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/eee2f7b683a081f006a7df1ddad9b20fbf53c48c.1461676337.git.jani.nikula@intel.com
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_bios.h
drivers/gpu/drm/i915/intel_vbt_defs.h

index 02c619e7af0540e35c924d9778ecd6b04bd2f85e..ff6aaf0c4e1e55bca7e1e31efc5a2e8945427448 100644 (file)
@@ -1492,6 +1492,7 @@ struct intel_vbt_data {
                bool present;
                bool active_low_pwm;
                u8 min_brightness;      /* min_brightness/255 of max */
+               enum intel_backlight_type type;
        } backlight;
 
        /* MIPI DSI */
index dbbd591717222dc619ace63f6fe5a77ec0a369c5..81518116e00de372ceed84b6cf98e73eabbe63a4 100644 (file)
@@ -318,6 +318,15 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
                return;
        }
 
+       dev_priv->vbt.backlight.type = INTEL_BACKLIGHT_DISPLAY_DDI;
+       if (bdb->version >= 191 &&
+           get_blocksize(backlight_data) >= sizeof(*backlight_data)) {
+               const struct bdb_lfp_backlight_control_method *method;
+
+               method = &backlight_data->backlight_control[panel_type];
+               dev_priv->vbt.backlight.type = method->type;
+       }
+
        dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz;
        dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm;
        dev_priv->vbt.backlight.min_brightness = entry->min_brightness;
index 149c3226e895e569c7a38cb1cc7e3708deb844b8..8405b5a367d7164a15df16ea5c453b472e965916 100644 (file)
 #ifndef _INTEL_BIOS_H_
 #define _INTEL_BIOS_H_
 
+enum intel_backlight_type {
+       INTEL_BACKLIGHT_PMIC,
+       INTEL_BACKLIGHT_LPSS,
+       INTEL_BACKLIGHT_DISPLAY_DDI,
+       INTEL_BACKLIGHT_DSI_DCS,
+       INTEL_BACKLIGHT_PANEL_DRIVER_INTERFACE,
+};
+
 struct edp_power_seq {
        u16 t1_t3;
        u16 t8;
index 9ff1e960d61774cb356f4875d522e75b9c6f11ba..a4a42f254c357744c85b7137e7229cc5d5470bc4 100644 (file)
@@ -446,10 +446,16 @@ struct bdb_lfp_backlight_data_entry {
        u8 obsolete3;
 } __packed;
 
+struct bdb_lfp_backlight_control_method {
+       u8 type:4;
+       u8 controller:4;
+} __packed;
+
 struct bdb_lfp_backlight_data {
        u8 entry_size;
        struct bdb_lfp_backlight_data_entry data[16];
        u8 level[16];
+       struct bdb_lfp_backlight_control_method backlight_control[16];
 } __packed;
 
 struct aimdb_header {