Re: [PATCH 1/2] drm/i915: Parse DSI backlight/cabc ports.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Oct 2017, Madhav Chauhan <madhav.chauhan@xxxxxxxxx> wrote:
> This patch parse DSI backlight/cabc ports info from
> VBT and save them inside local structure. This saved info
> can be directly used while initializing DSI for different
> platforms instead of parsing for each platform.
>
> V2: Changes:
>     - Typo fix in commit message.
>     - Move up newly added port variables (Jani N)
>     - Remove redundant initialization (Jani N)
>     - Don't parse CABC ports if not supported (Jani N)
>
> Signed-off-by: Madhav Chauhan <madhav.chauhan@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  2 ++
>  drivers/gpu/drm/i915/intel_bios.c | 58 ++++++++++++++++++++++++++++++++-------
>  2 files changed, 50 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index b7cba89..4fe2e13 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1748,6 +1748,8 @@ struct intel_vbt_data {
>  		u16 panel_id;
>  		struct mipi_config *config;
>  		struct mipi_pps_data *pps;
> +		u16 bl_ports;
> +		u16 cabc_ports;
>  		u8 seq_version;
>  		u32 size;
>  		u8 *data;
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 3747d8d..dcfc6fa 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -730,6 +730,51 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
>  	dev_priv->vbt.psr.tp2_tp3_wakeup_time = psr_table->tp2_tp3_wakeup_time;
>  }
>  
> +static void parse_dsi_backlight_ports(struct drm_i915_private *dev_priv,
> +				      u16 version, enum port port)
> +{
> +	if (dev_priv->vbt.dsi.config->dual_link && version < 197) {
> +		/*
> +		 * These fields are introduced from the VBT version 197 onwards,
> +		 * so don't parse in older versions
> +		 */
> +		return;

You can't remove the initialization of dl_dcs_backlight_ports and
dl_dcs_cabc_ports in patch 1 because the code in intel_dsi.c still uses
them. As I said, you need to remove the initialization in patch 2 where
you stop using them.

I had something like this in mind. Please chat on IRC if you have any
questions.

if (!dual_link || version < 197) {
   initialize bl_ports
   if (cabc)
      initialize cabc_ports
   initialize dl_dcs_backlight_ports and dl_dcs_cabc_ports to 0 (remove
   this in patch 2/2)
   return
}

switch (dl_dcs_backlight_ports) {
   initialize bl_ports for dual link
}

if (!cabc)
   return

switch (dl_dcs_cabc_ports) {
   initialize cabc_ports for dual link
}


> +	} else if (dev_priv->vbt.dsi.config->dual_link) {
> +		switch (dev_priv->vbt.dsi.config->dl_dcs_backlight_ports) {
> +		case DL_DCS_PORT_A:
> +			dev_priv->vbt.dsi.bl_ports = BIT(PORT_A);
> +			break;
> +		case DL_DCS_PORT_C:
> +			dev_priv->vbt.dsi.bl_ports = BIT(PORT_C);
> +			break;
> +		default:
> +		case DL_DCS_PORT_A_AND_C:
> +			dev_priv->vbt.dsi.bl_ports = BIT(PORT_A) | BIT(PORT_C);
> +			break;
> +		}
> +
> +		if (!dev_priv->vbt.dsi.config->cabc_supported)
> +			return;
> +
> +		switch (dev_priv->vbt.dsi.config->dl_dcs_cabc_ports) {
> +		case DL_DCS_PORT_A:
> +			dev_priv->vbt.dsi.cabc_ports = BIT(PORT_A);
> +			break;
> +		case DL_DCS_PORT_C:
> +			dev_priv->vbt.dsi.cabc_ports = BIT(PORT_C);
> +			break;
> +		default:
> +		case DL_DCS_PORT_A_AND_C:
> +			dev_priv->vbt.dsi.cabc_ports =
> +						BIT(PORT_A) | BIT(PORT_C);
> +			break;
> +		}
> +	} else {
> +		dev_priv->vbt.dsi.bl_ports = BIT(port);
> +		dev_priv->vbt.dsi.cabc_ports = BIT(port);
> +	}
> +}
> +
>  static void
>  parse_mipi_config(struct drm_i915_private *dev_priv,
>  		  const struct bdb_header *bdb)
> @@ -738,9 +783,10 @@ parse_mipi_config(struct drm_i915_private *dev_priv,
>  	const struct mipi_config *config;
>  	const struct mipi_pps_data *pps;
>  	int panel_type = dev_priv->vbt.panel_type;
> +	enum port port;
>  
>  	/* parse MIPI blocks only if LFP type is MIPI */
> -	if (!intel_bios_is_dsi_present(dev_priv, NULL))
> +	if (!intel_bios_is_dsi_present(dev_priv, &port))
>  		return;
>  
>  	/* Initialize this to undefined indicating no generic MIPI support */
> @@ -781,15 +827,7 @@ parse_mipi_config(struct drm_i915_private *dev_priv,
>  		return;
>  	}
>  
> -	/*
> -	 * These fields are introduced from the VBT version 197 onwards,
> -	 * so making sure that these bits are set zero in the previous
> -	 * versions.
> -	 */
> -	if (dev_priv->vbt.dsi.config->dual_link && bdb->version < 197) {
> -		dev_priv->vbt.dsi.config->dl_dcs_cabc_ports = 0;
> -		dev_priv->vbt.dsi.config->dl_dcs_backlight_ports = 0;
> -	}
> +	parse_dsi_backlight_ports(dev_priv, bdb->version, port);
>  
>  	/* We have mandatory mipi config blocks. Initialize as generic panel */
>  	dev_priv->vbt.dsi.panel_id = MIPI_DSI_GENERIC_PANEL_ID;

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux