]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Parse panel backlight controller from VBT
authorVidya Srinivas <vidya.srinivas@intel.com>
Thu, 8 Dec 2016 09:26:18 +0000 (11:26 +0200)
committerJani Nikula <jani.nikula@intel.com>
Mon, 12 Dec 2016 15:22:08 +0000 (17:22 +0200)
Currently the backlight controller is taken as 0. It needs to derive
value from the VBT. Adding the necessary changes.

v2 by Jani:
 - drop obsolete comments, drop redundant initialization (Bob)
 - merge debug logging into one

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Tested-by: Bob Paauwe <bob.j.paauwe@intel.com>
Tested-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1481189178-426-1-git-send-email-jani.nikula@intel.com
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_panel.c

index 40c55c9c9eb4749e8a86a35b2e51a12c6db0500f..20bc04d5e6175927b885f768299dd8a266065fce 100644 (file)
@@ -1716,6 +1716,7 @@ struct intel_vbt_data {
                bool present;
                bool active_low_pwm;
                u8 min_brightness;      /* min_brightness/255 of max */
+               u8 controller;          /* brightness controller number */
                enum intel_backlight_type type;
        } backlight;
 
index eaade27af3869cdbd1198ac1217d6c49bc06a179..1cf2fa6ec28f80407b2e31f4010c8863b60b9587 100644 (file)
@@ -330,17 +330,19 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
 
                method = &backlight_data->backlight_control[panel_type];
                dev_priv->vbt.backlight.type = method->type;
+               dev_priv->vbt.backlight.controller = method->controller;
        }
 
        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;
        DRM_DEBUG_KMS("VBT backlight PWM modulation frequency %u Hz, "
-                     "active %s, min brightness %u, level %u\n",
+                     "active %s, min brightness %u, level %u, controller %u\n",
                      dev_priv->vbt.backlight.pwm_freq_hz,
                      dev_priv->vbt.backlight.active_low_pwm ? "low" : "high",
                      dev_priv->vbt.backlight.min_brightness,
-                     backlight_data->level[panel_type]);
+                     backlight_data->level[panel_type],
+                     dev_priv->vbt.backlight.controller);
 }
 
 /* Try to find sdvo panel data */
index 3578b402d41298dbe2275dac7cc402ab85d67391..b01edceac6507385c06194777599e42b064504b1 100644 (file)
@@ -1039,10 +1039,7 @@ static void bxt_enable_backlight(struct intel_connector *connector)
        enum pipe pipe = intel_get_pipe_from_connector(connector);
        u32 pwm_ctl, val;
 
-       /* To use 2nd set of backlight registers, utility pin has to be
-        * enabled with PWM mode.
-        * The field should only be changed when the utility pin is disabled
-        */
+       /* Controller 1 uses the utility pin. */
        if (panel->backlight.controller == 1) {
                val = I915_READ(UTIL_PIN_CTL);
                if (val & UTIL_PIN_ENABLE) {
@@ -1608,19 +1605,11 @@ bxt_setup_backlight(struct intel_connector *connector, enum pipe unused)
        struct intel_panel *panel = &connector->panel;
        u32 pwm_ctl, val;
 
-       /*
-        * For BXT hard coding the Backlight controller to 0.
-        * TODO : Read the controller value from VBT and generalize
-        */
-       panel->backlight.controller = 0;
+       panel->backlight.controller = dev_priv->vbt.backlight.controller;
 
        pwm_ctl = I915_READ(BXT_BLC_PWM_CTL(panel->backlight.controller));
 
-       /* Keeping the check if controller 1 is to be programmed.
-        * This will come into affect once the VBT parsing
-        * is fixed for controller selection, and controller 1 is used
-        * for a prticular display configuration.
-        */
+       /* Controller 1 uses the utility pin. */
        if (panel->backlight.controller == 1) {
                val = I915_READ(UTIL_PIN_CTL);
                panel->backlight.util_pin_active_low =