diff mbox

[2/3] drm/i915: Replace the static panel_type variable with dev_priv->vbt.panel_type

Message ID 1460122093-26497-2-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä April 8, 2016, 1:28 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Store the extracted panel_type under dev_priv.vbt instead of keeping
around a static variable for it.

Cc: Rob Kramer <rob@solution-space.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |  1 +
 drivers/gpu/drm/i915/intel_bios.c | 13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

Comments

Jani Nikula April 8, 2016, 2:29 p.m. UTC | #1
On Fri, 08 Apr 2016, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Store the extracted panel_type under dev_priv.vbt instead of keeping
> around a static variable for it.
>
> Cc: Rob Kramer <rob@solution-space.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Yes please.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  1 +
>  drivers/gpu/drm/i915/intel_bios.c | 13 +++++++++----
>  2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 4ebd3ff02803..53ace572b292 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1443,6 +1443,7 @@ struct intel_vbt_data {
>  	unsigned int lvds_use_ssc:1;
>  	unsigned int display_clock_mode:1;
>  	unsigned int fdi_rx_polarity_inverted:1;
> +	unsigned int panel_type:4;
>  	int lvds_ssc_freq;
>  	unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
>  
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 13bdd4316092..d9568be4b33b 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -58,8 +58,6 @@
>  #define	SLAVE_ADDR1	0x70
>  #define	SLAVE_ADDR2	0x72
>  
> -static int panel_type;
> -
>  /* Get BDB block size given a pointer to Block ID. */
>  static u32 _get_blocksize(const u8 *block_base)
>  {
> @@ -205,6 +203,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
>  	const struct lvds_dvo_timing *panel_dvo_timing;
>  	const struct lvds_fp_timing *fp_timing;
>  	struct drm_display_mode *panel_fixed_mode;
> +	int panel_type;
>  	int drrs_mode;
>  
>  	lvds_options = find_section(bdb, BDB_LVDS_OPTIONS);
> @@ -216,6 +215,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
>  		return;
>  
>  	panel_type = lvds_options->panel_type;
> +	dev_priv->vbt.panel_type = panel_type;
>  
>  	drrs_mode = (lvds_options->dps_panel_type_bits
>  				>> (panel_type * 2)) & MODE_MASK;
> @@ -251,7 +251,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
>  
>  	panel_dvo_timing = get_lvds_dvo_timing(lvds_lfp_data,
>  					       lvds_lfp_data_ptrs,
> -					       lvds_options->panel_type);
> +					       panel_type);
>  
>  	panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL);
>  	if (!panel_fixed_mode)
> @@ -266,7 +266,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
>  
>  	fp_timing = get_lvds_fp_timing(bdb, lvds_lfp_data,
>  				       lvds_lfp_data_ptrs,
> -				       lvds_options->panel_type);
> +				       panel_type);
>  	if (fp_timing) {
>  		/* check the resolution, just to be sure */
>  		if (fp_timing->x_res == panel_fixed_mode->hdisplay &&
> @@ -284,6 +284,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;
> +	int panel_type = dev_priv->vbt.panel_type;
>  
>  	backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
>  	if (!backlight_data)
> @@ -546,6 +547,7 @@ parse_edp(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
>  	const struct bdb_edp *edp;
>  	const struct edp_power_seq *edp_pps;
>  	const struct edp_link_params *edp_link_params;
> +	int panel_type = dev_priv->vbt.panel_type;
>  
>  	edp = find_section(bdb, BDB_EDP);
>  	if (!edp) {
> @@ -657,6 +659,7 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
>  {
>  	const struct bdb_psr *psr;
>  	const struct psr_table *psr_table;
> +	int panel_type = dev_priv->vbt.panel_type;
>  
>  	psr = find_section(bdb, BDB_PSR);
>  	if (!psr) {
> @@ -703,6 +706,7 @@ parse_mipi_config(struct drm_i915_private *dev_priv,
>  	const struct bdb_mipi_config *start;
>  	const struct mipi_config *config;
>  	const struct mipi_pps_data *pps;
> +	int panel_type = dev_priv->vbt.panel_type;
>  
>  	/* parse MIPI blocks only if LFP type is MIPI */
>  	if (!intel_bios_is_dsi_present(dev_priv, NULL))
> @@ -910,6 +914,7 @@ static void
>  parse_mipi_sequence(struct drm_i915_private *dev_priv,
>  		    const struct bdb_header *bdb)
>  {
> +	int panel_type = dev_priv->vbt.panel_type;
>  	const struct bdb_mipi_sequence *sequence;
>  	const u8 *seq_data;
>  	u32 seq_size;
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4ebd3ff02803..53ace572b292 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1443,6 +1443,7 @@  struct intel_vbt_data {
 	unsigned int lvds_use_ssc:1;
 	unsigned int display_clock_mode:1;
 	unsigned int fdi_rx_polarity_inverted:1;
+	unsigned int panel_type:4;
 	int lvds_ssc_freq;
 	unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
 
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 13bdd4316092..d9568be4b33b 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -58,8 +58,6 @@ 
 #define	SLAVE_ADDR1	0x70
 #define	SLAVE_ADDR2	0x72
 
-static int panel_type;
-
 /* Get BDB block size given a pointer to Block ID. */
 static u32 _get_blocksize(const u8 *block_base)
 {
@@ -205,6 +203,7 @@  parse_lfp_panel_data(struct drm_i915_private *dev_priv,
 	const struct lvds_dvo_timing *panel_dvo_timing;
 	const struct lvds_fp_timing *fp_timing;
 	struct drm_display_mode *panel_fixed_mode;
+	int panel_type;
 	int drrs_mode;
 
 	lvds_options = find_section(bdb, BDB_LVDS_OPTIONS);
@@ -216,6 +215,7 @@  parse_lfp_panel_data(struct drm_i915_private *dev_priv,
 		return;
 
 	panel_type = lvds_options->panel_type;
+	dev_priv->vbt.panel_type = panel_type;
 
 	drrs_mode = (lvds_options->dps_panel_type_bits
 				>> (panel_type * 2)) & MODE_MASK;
@@ -251,7 +251,7 @@  parse_lfp_panel_data(struct drm_i915_private *dev_priv,
 
 	panel_dvo_timing = get_lvds_dvo_timing(lvds_lfp_data,
 					       lvds_lfp_data_ptrs,
-					       lvds_options->panel_type);
+					       panel_type);
 
 	panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL);
 	if (!panel_fixed_mode)
@@ -266,7 +266,7 @@  parse_lfp_panel_data(struct drm_i915_private *dev_priv,
 
 	fp_timing = get_lvds_fp_timing(bdb, lvds_lfp_data,
 				       lvds_lfp_data_ptrs,
-				       lvds_options->panel_type);
+				       panel_type);
 	if (fp_timing) {
 		/* check the resolution, just to be sure */
 		if (fp_timing->x_res == panel_fixed_mode->hdisplay &&
@@ -284,6 +284,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;
+	int panel_type = dev_priv->vbt.panel_type;
 
 	backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
 	if (!backlight_data)
@@ -546,6 +547,7 @@  parse_edp(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
 	const struct bdb_edp *edp;
 	const struct edp_power_seq *edp_pps;
 	const struct edp_link_params *edp_link_params;
+	int panel_type = dev_priv->vbt.panel_type;
 
 	edp = find_section(bdb, BDB_EDP);
 	if (!edp) {
@@ -657,6 +659,7 @@  parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
 {
 	const struct bdb_psr *psr;
 	const struct psr_table *psr_table;
+	int panel_type = dev_priv->vbt.panel_type;
 
 	psr = find_section(bdb, BDB_PSR);
 	if (!psr) {
@@ -703,6 +706,7 @@  parse_mipi_config(struct drm_i915_private *dev_priv,
 	const struct bdb_mipi_config *start;
 	const struct mipi_config *config;
 	const struct mipi_pps_data *pps;
+	int panel_type = dev_priv->vbt.panel_type;
 
 	/* parse MIPI blocks only if LFP type is MIPI */
 	if (!intel_bios_is_dsi_present(dev_priv, NULL))
@@ -910,6 +914,7 @@  static void
 parse_mipi_sequence(struct drm_i915_private *dev_priv,
 		    const struct bdb_header *bdb)
 {
+	int panel_type = dev_priv->vbt.panel_type;
 	const struct bdb_mipi_sequence *sequence;
 	const u8 *seq_data;
 	u32 seq_size;