diff mbox

drm/i915: Parsing LFP brightness control from VBT

Message ID 1436180709-18905-1-git-send-email-vandana.kannan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

vandana.kannan@intel.com July 6, 2015, 11:05 a.m. UTC
From: Deepak M <m.deepak@intel.com>

LFP brighness control from the VBT block 43 indicates which
controller is used for brightness.
LFP1 brightness control method:
Bit 7-4 = This field controller number of the brightnes controller.
0 = Controller 0
1 = Controller 1
2 = Controller 2
3 = Controller 3
Others = Reserved

Bits 3-0 are for Control pin
0 = PMIC pin is used for brightness control
1 = LPSS PWM is used for brightness control
2 = Display DDI is used for brightness control
3 = CABC method to control brightness
Others = Reserved

History:
This patch was submitted earlier including a check for control pin.
http://lists.freedesktop.org/archives/intel-gfx/2014-December/057530.html
Since it caused the issue, https://bugs.freedesktop.org/show_bug.cgi?id=87671,
it was reverted in
http://lists.freedesktop.org/archives/intel-gfx/2015-January/058110.html

The current patch reads controller and control pin from VBT (version >= 191)

From VBT version >= 197, default value of control pin is set to DDI, so the
corresponding check during backlight setup will be made in a future patch

Signed-off-by: Deepak M <m.deepak@intel.com>
Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |  2 ++
 drivers/gpu/drm/i915/intel_bios.c |  9 +++++++++
 drivers/gpu/drm/i915/intel_bios.h | 11 +++++++++++
 3 files changed, 22 insertions(+)

Comments

Shuang He July 7, 2015, 8:55 a.m. UTC | #1
Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6725
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
ILK                                  302/302              302/302
SNB                                  312/316              312/316
IVB                                  345/345              345/345
BYT                 -1              289/289              288/289
HSW                                  382/382              382/382
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
*BYT  igt@gem_partial_pwrite_pread@reads-uncached      PASS(1)      FAIL(1)
Note: You need to pay more attention to line start with '*'
vandana.kannan@intel.com July 24, 2015, 9:01 a.m. UTC | #2
Any inputs on this patch ?

- Vandana

On 7/6/2015 4:35 PM, Vandana Kannan wrote:
> From: Deepak M <m.deepak@intel.com>
>
> LFP brighness control from the VBT block 43 indicates which
> controller is used for brightness.
> LFP1 brightness control method:
> Bit 7-4 = This field controller number of the brightnes controller.
> 0 = Controller 0
> 1 = Controller 1
> 2 = Controller 2
> 3 = Controller 3
> Others = Reserved
>
> Bits 3-0 are for Control pin
> 0 = PMIC pin is used for brightness control
> 1 = LPSS PWM is used for brightness control
> 2 = Display DDI is used for brightness control
> 3 = CABC method to control brightness
> Others = Reserved
>
> History:
> This patch was submitted earlier including a check for control pin.
> http://lists.freedesktop.org/archives/intel-gfx/2014-December/057530.html
> Since it caused the issue, https://bugs.freedesktop.org/show_bug.cgi?id=87671,
> it was reverted in
> http://lists.freedesktop.org/archives/intel-gfx/2015-January/058110.html
>
> The current patch reads controller and control pin from VBT (version >= 191)
>
>  From VBT version >= 197, default value of control pin is set to DDI, so the
> corresponding check during backlight setup will be made in a future patch
>
> Signed-off-by: Deepak M <m.deepak@intel.com>
> Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_drv.h   |  2 ++
>   drivers/gpu/drm/i915/intel_bios.c |  9 +++++++++
>   drivers/gpu/drm/i915/intel_bios.h | 11 +++++++++++
>   3 files changed, 22 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 950a981..a89e9a9 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1461,6 +1461,8 @@ struct intel_vbt_data {
>   		bool present;
>   		bool active_low_pwm;
>   		u8 min_brightness;	/* min_brightness/255 of max */
> +		u8 controller;		/* brightness controller number */
> +		u8 control_pin;         /* brightness control pin */
>   	} backlight;
>
>   	/* MIPI DSI */
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 2ff9eb0..32c1ef2 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -256,6 +256,7 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
>   {
>   	const struct bdb_lfp_backlight_data *backlight_data;
>   	const struct bdb_lfp_backlight_data_entry *entry;
> +	const struct bdb_lfp_backlight_control_data *bl_ctrl_data;
>
>   	backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
>   	if (!backlight_data)
> @@ -268,6 +269,7 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
>   	}
>
>   	entry = &backlight_data->data[panel_type];
> +	bl_ctrl_data = &backlight_data->blc_ctl[panel_type];
>
>   	dev_priv->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM;
>   	if (!dev_priv->vbt.backlight.present) {
> @@ -279,12 +281,19 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
>   	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;
> +	dev_priv->vbt.backlight.controller = bl_ctrl_data->controller;
> +	dev_priv->vbt.backlight.control_pin = bl_ctrl_data->pin;
> +
>   	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,
>   		      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, BL control pin %u\n",
> +			dev_priv->vbt.backlight.controller,
> +			dev_priv->vbt.backlight.control_pin);
>   }
>
>   /* Try to find sdvo panel data */
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index af0b476..e97c1c0 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -402,10 +402,21 @@ struct bdb_lfp_backlight_data_entry {
>   	u8 obsolete3;
>   } __packed;
>
> +#define BLC_CONTROL_PIN_PMIC           0
> +#define BLC_CONTROL_PIN_LPSS_PWM       1
> +#define BLC_CONTROL_PIN_DDI            2
> +#define BLC_CONTROL_PIN_CABC           3
> +
> +struct bdb_lfp_backlight_control_data {
> +	u8 controller:4;
> +	u8 pin: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_data blc_ctl[16];
>   } __packed;
>
>   struct aimdb_header {
>
Sivakumar Thulasimani July 27, 2015, 4:38 a.m. UTC | #3
On 7/6/2015 4:35 PM, Vandana Kannan wrote:
> From: Deepak M <m.deepak@intel.com>
>
> LFP brighness control from the VBT block 43 indicates which
> controller is used for brightness.
> LFP1 brightness control method:
> Bit 7-4 = This field controller number of the brightnes controller.
> 0 = Controller 0
> 1 = Controller 1
> 2 = Controller 2
> 3 = Controller 3
> Others = Reserved
>
> Bits 3-0 are for Control pin
> 0 = PMIC pin is used for brightness control
> 1 = LPSS PWM is used for brightness control
> 2 = Display DDI is used for brightness control
> 3 = CABC method to control brightness
> Others = Reserved
>
> History:
> This patch was submitted earlier including a check for control pin.
> http://lists.freedesktop.org/archives/intel-gfx/2014-December/057530.html
> Since it caused the issue, https://bugs.freedesktop.org/show_bug.cgi?id=87671,
> it was reverted in
> http://lists.freedesktop.org/archives/intel-gfx/2015-January/058110.html
>
> The current patch reads controller and control pin from VBT (version >= 191)
>
>  From VBT version >= 197, default value of control pin is set to DDI, so the
> corresponding check during backlight setup will be made in a future patch
>
> Signed-off-by: Deepak M <m.deepak@intel.com>
> Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_drv.h   |  2 ++
>   drivers/gpu/drm/i915/intel_bios.c |  9 +++++++++
>   drivers/gpu/drm/i915/intel_bios.h | 11 +++++++++++
>   3 files changed, 22 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 950a981..a89e9a9 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1461,6 +1461,8 @@ struct intel_vbt_data {
>   		bool present;
>   		bool active_low_pwm;
>   		u8 min_brightness;	/* min_brightness/255 of max */
> +		u8 controller;		/* brightness controller number */
> +		u8 control_pin;         /* brightness control pin */
>   	} backlight;
>   
>   	/* MIPI DSI */
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 2ff9eb0..32c1ef2 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -256,6 +256,7 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
>   {
>   	const struct bdb_lfp_backlight_data *backlight_data;
>   	const struct bdb_lfp_backlight_data_entry *entry;
> +	const struct bdb_lfp_backlight_control_data *bl_ctrl_data;
>   
>   	backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
>   	if (!backlight_data)
> @@ -268,6 +269,7 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
>   	}
>   
>   	entry = &backlight_data->data[panel_type];
> +	bl_ctrl_data = &backlight_data->blc_ctl[panel_type];
>   
>   	dev_priv->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM;
>   	if (!dev_priv->vbt.backlight.present) {
> @@ -279,12 +281,19 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv,
>   	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;
> +	dev_priv->vbt.backlight.controller = bl_ctrl_data->controller;
> +	dev_priv->vbt.backlight.control_pin = bl_ctrl_data->pin;
> +
>   	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,
>   		      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, BL control pin %u\n",
> +			dev_priv->vbt.backlight.controller,
> +			dev_priv->vbt.backlight.control_pin);
>   }
>   
>   /* Try to find sdvo panel data */
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index af0b476..e97c1c0 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -402,10 +402,21 @@ struct bdb_lfp_backlight_data_entry {
>   	u8 obsolete3;
>   } __packed;
>   
> +#define BLC_CONTROL_PIN_PMIC           0
> +#define BLC_CONTROL_PIN_LPSS_PWM       1
> +#define BLC_CONTROL_PIN_DDI            2
> +#define BLC_CONTROL_PIN_CABC           3
> +
> +struct bdb_lfp_backlight_control_data {
> +	u8 controller:4;
> +	u8 pin:4;
the pin should be first half of this struct.
pin - 0:3
controller - 4:7
> +} __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_data blc_ctl[16];
>   } __packed;
>   
>   struct aimdb_header {
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 950a981..a89e9a9 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1461,6 +1461,8 @@  struct intel_vbt_data {
 		bool present;
 		bool active_low_pwm;
 		u8 min_brightness;	/* min_brightness/255 of max */
+		u8 controller;		/* brightness controller number */
+		u8 control_pin;         /* brightness control pin */
 	} backlight;
 
 	/* MIPI DSI */
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 2ff9eb0..32c1ef2 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -256,6 +256,7 @@  parse_lfp_backlight(struct drm_i915_private *dev_priv,
 {
 	const struct bdb_lfp_backlight_data *backlight_data;
 	const struct bdb_lfp_backlight_data_entry *entry;
+	const struct bdb_lfp_backlight_control_data *bl_ctrl_data;
 
 	backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
 	if (!backlight_data)
@@ -268,6 +269,7 @@  parse_lfp_backlight(struct drm_i915_private *dev_priv,
 	}
 
 	entry = &backlight_data->data[panel_type];
+	bl_ctrl_data = &backlight_data->blc_ctl[panel_type];
 
 	dev_priv->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM;
 	if (!dev_priv->vbt.backlight.present) {
@@ -279,12 +281,19 @@  parse_lfp_backlight(struct drm_i915_private *dev_priv,
 	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;
+	dev_priv->vbt.backlight.controller = bl_ctrl_data->controller;
+	dev_priv->vbt.backlight.control_pin = bl_ctrl_data->pin;
+
 	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,
 		      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, BL control pin %u\n",
+			dev_priv->vbt.backlight.controller,
+			dev_priv->vbt.backlight.control_pin);
 }
 
 /* Try to find sdvo panel data */
diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
index af0b476..e97c1c0 100644
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -402,10 +402,21 @@  struct bdb_lfp_backlight_data_entry {
 	u8 obsolete3;
 } __packed;
 
+#define BLC_CONTROL_PIN_PMIC           0
+#define BLC_CONTROL_PIN_LPSS_PWM       1
+#define BLC_CONTROL_PIN_DDI            2
+#define BLC_CONTROL_PIN_CABC           3
+
+struct bdb_lfp_backlight_control_data {
+	u8 controller:4;
+	u8 pin: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_data blc_ctl[16];
 } __packed;
 
 struct aimdb_header {