diff mbox series

[RFC,3/5] drm/i915/display: Use panel index to parse lfp backlight

Message ID 20220602141850.21301-4-animesh.manna@intel.com (mailing list archive)
State New, archived
Headers show
Series Dual LFP/EDP enablement | expand

Commit Message

Manna, Animesh June 2, 2022, 2:18 p.m. UTC
There will be separate entry of backlight info for each
LFP in VBT. Panel index is used for deriving backlight info
of the respective panel.

Signed-off-by: Animesh Manna <animesh.manna@intel.com>
---
 drivers/gpu/drm/i915/display/intel_bios.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

Comments

Jani Nikula June 2, 2022, 3:13 p.m. UTC | #1
On Thu, 02 Jun 2022, Animesh Manna <animesh.manna@intel.com> wrote:
> There will be separate entry of backlight info for each
> LFP in VBT. Panel index is used for deriving backlight info
> of the respective panel.

Same here, unnecessary. panel_type *is* panel index.

BR,
Jani.

>
> Signed-off-by: Animesh Manna <animesh.manna@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_bios.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 943c5584f242..34160dc6b092 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -957,11 +957,11 @@ parse_generic_dtd(struct drm_i915_private *i915,
>  
>  static void
>  parse_lfp_backlight(struct drm_i915_private *i915,
> -		    struct intel_panel *panel)
> +		    struct intel_panel *panel,
> +		    int panel_index)
>  {
>  	const struct bdb_lfp_backlight_data *backlight_data;
>  	const struct lfp_backlight_data_entry *entry;
> -	int panel_type = panel->vbt.panel_type;
>  	u16 level;
>  
>  	backlight_data = find_section(i915, BDB_LVDS_BACKLIGHT);
> @@ -975,7 +975,7 @@ parse_lfp_backlight(struct drm_i915_private *i915,
>  		return;
>  	}
>  
> -	entry = &backlight_data->data[panel_type];
> +	entry = &backlight_data->data[panel_index];
>  
>  	panel->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM;
>  	if (!panel->vbt.backlight.present) {
> @@ -999,7 +999,7 @@ parse_lfp_backlight(struct drm_i915_private *i915,
>  		if (get_blocksize(backlight_data) >= exp_size) {
>  			const struct lfp_backlight_control_method *method;
>  
> -			method = &backlight_data->backlight_control[panel_type];
> +			method = &backlight_data->backlight_control[panel_index];
>  			panel->vbt.backlight.type = method->type;
>  			panel->vbt.backlight.controller = method->controller;
>  		}
> @@ -1012,11 +1012,11 @@ parse_lfp_backlight(struct drm_i915_private *i915,
>  		u16 min_level;
>  		bool scale;
>  
> -		level = backlight_data->brightness_level[panel_type].level;
> -		min_level = backlight_data->brightness_min_level[panel_type].level;
> +		level = backlight_data->brightness_level[panel_index].level;
> +		min_level = backlight_data->brightness_min_level[panel_index].level;
>  
>  		if (i915->vbt.version >= 236)
> -			scale = backlight_data->brightness_precision_bits[panel_type] == 16;
> +			scale = backlight_data->brightness_precision_bits[panel_index] == 16;
>  		else
>  			scale = level > 255;
>  
> @@ -1028,11 +1028,8 @@ parse_lfp_backlight(struct drm_i915_private *i915,
>  			level = 255;
>  		}
>  		panel->vbt.backlight.min_brightness = min_level;
> -
> -		panel->vbt.backlight.brightness_precision_bits =
> -			backlight_data->brightness_precision_bits[panel_type];
>  	} else {
> -		level = backlight_data->level[panel_type];
> +		level = backlight_data->level[panel_index];
>  		panel->vbt.backlight.min_brightness = entry->min_brightness;
>  	}
>  
> @@ -3117,7 +3114,7 @@ void intel_bios_init_panel(struct drm_i915_private *i915,
>  	parse_panel_options(i915, panel, edid, panel_index);
>  	parse_generic_dtd(i915, panel, panel_index);
>  	parse_lfp_data(i915, panel, panel_index);
> -	parse_lfp_backlight(i915, panel);
> +	parse_lfp_backlight(i915, panel, panel_index);
>  	parse_sdvo_panel_data(i915, panel);
>  	parse_panel_driver_features(i915, panel);
>  	parse_power_conservation_features(i915, panel);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 943c5584f242..34160dc6b092 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -957,11 +957,11 @@  parse_generic_dtd(struct drm_i915_private *i915,
 
 static void
 parse_lfp_backlight(struct drm_i915_private *i915,
-		    struct intel_panel *panel)
+		    struct intel_panel *panel,
+		    int panel_index)
 {
 	const struct bdb_lfp_backlight_data *backlight_data;
 	const struct lfp_backlight_data_entry *entry;
-	int panel_type = panel->vbt.panel_type;
 	u16 level;
 
 	backlight_data = find_section(i915, BDB_LVDS_BACKLIGHT);
@@ -975,7 +975,7 @@  parse_lfp_backlight(struct drm_i915_private *i915,
 		return;
 	}
 
-	entry = &backlight_data->data[panel_type];
+	entry = &backlight_data->data[panel_index];
 
 	panel->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM;
 	if (!panel->vbt.backlight.present) {
@@ -999,7 +999,7 @@  parse_lfp_backlight(struct drm_i915_private *i915,
 		if (get_blocksize(backlight_data) >= exp_size) {
 			const struct lfp_backlight_control_method *method;
 
-			method = &backlight_data->backlight_control[panel_type];
+			method = &backlight_data->backlight_control[panel_index];
 			panel->vbt.backlight.type = method->type;
 			panel->vbt.backlight.controller = method->controller;
 		}
@@ -1012,11 +1012,11 @@  parse_lfp_backlight(struct drm_i915_private *i915,
 		u16 min_level;
 		bool scale;
 
-		level = backlight_data->brightness_level[panel_type].level;
-		min_level = backlight_data->brightness_min_level[panel_type].level;
+		level = backlight_data->brightness_level[panel_index].level;
+		min_level = backlight_data->brightness_min_level[panel_index].level;
 
 		if (i915->vbt.version >= 236)
-			scale = backlight_data->brightness_precision_bits[panel_type] == 16;
+			scale = backlight_data->brightness_precision_bits[panel_index] == 16;
 		else
 			scale = level > 255;
 
@@ -1028,11 +1028,8 @@  parse_lfp_backlight(struct drm_i915_private *i915,
 			level = 255;
 		}
 		panel->vbt.backlight.min_brightness = min_level;
-
-		panel->vbt.backlight.brightness_precision_bits =
-			backlight_data->brightness_precision_bits[panel_type];
 	} else {
-		level = backlight_data->level[panel_type];
+		level = backlight_data->level[panel_index];
 		panel->vbt.backlight.min_brightness = entry->min_brightness;
 	}
 
@@ -3117,7 +3114,7 @@  void intel_bios_init_panel(struct drm_i915_private *i915,
 	parse_panel_options(i915, panel, edid, panel_index);
 	parse_generic_dtd(i915, panel, panel_index);
 	parse_lfp_data(i915, panel, panel_index);
-	parse_lfp_backlight(i915, panel);
+	parse_lfp_backlight(i915, panel, panel_index);
 	parse_sdvo_panel_data(i915, panel);
 	parse_panel_driver_features(i915, panel);
 	parse_power_conservation_features(i915, panel);