[PATCH] drm/i915: Parse panel BL controller from VBT

Vidya Srinivas
2016-12-07T14:57:53Z

Currently the backlight controller is taken as 0. It needs to derive
value from the VBT. Adding the necessary changes.

v2: Updated the commit header

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/intel_bios.c | 5 +++++
drivers/gpu/drm/i915/intel_panel.c | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8daa4fb..6a85fdf 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1633,6 +1633,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;

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index eaade27..130db0f 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -330,6 +330,8 @@ static u32 get_blocksize(const void *block_data)

method = &backlight_data->backlight_control[panel_type];
dev_priv->vbt.backlight.type = method->type;
+ dev_priv->vbt.backlight.controller = 0;
+ dev_priv->vbt.backlight.controller = method->controller;
}

dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz;
@@ -341,6 +343,9 @@ static u32 get_blocksize(const void *block_data)
dev_priv->vbt.backlight.active_low_pwm ? "low" : "high",
dev_priv->vbt.backlight.min_brightness,
backlight_data->level[panel_type]);
+
+ DRM_DEBUG_KMS("VBT BL controller %u\n",
+ dev_priv->vbt.backlight.controller);
}

/* Try to find sdvo panel data */
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 3578b40..6a7d4c3 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -1612,7 +1612,7 @@ static int vlv_setup_backlight(struct intel_connector *connector, enum pipe pipe
* 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));

--
1.9.1