[Intel-gfx] [PATCH 2/8] drm/i915/dsi: add support for DSI sequence block v2 gpio element

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Mar 17 15:12:33 UTC 2016


On Thu, Mar 17, 2016 at 05:04:40PM +0200, Jani Nikula wrote:
> In sequence block v2, and only in v2, the gpio source (i.e. IOSF port)
> is specified separately.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index f687b2e9d8ca..765dd5cd23ac 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -198,7 +198,7 @@ static const u8 *mipi_exec_delay(struct intel_dsi *intel_dsi, const u8 *data)
>  
>  static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
>  {
> -	u8 gpio_index, action;
> +	u8 gpio_source, gpio_index, action, port;
>  	u16 function, pad;
>  	u32 val;
>  	struct drm_device *dev = intel_dsi->base.base.dev;
> @@ -209,6 +209,9 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
>  
>  	gpio_index = *data++;
>  
> +	/* gpio source in sequence v2 only */
> +	gpio_source = (*data >> 1) & 3;
> +

Would it perhaps be cleaner to do the version check here and
just leave gpio_source==0 for v1?

>  	/* pull up/down */
>  	action = *data++ & 1;
>  
> @@ -225,6 +228,17 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
>  	if (dev_priv->vbt.dsi.seq_version >= 3) {
>  		DRM_DEBUG_KMS("GPIO element v3 not supported\n");
>  		goto out;
> +	} else if (dev_priv->vbt.dsi.seq_version == 2) {
> +		if (gpio_source == 0) {
> +			port = IOSF_PORT_GPIO_NC;
> +		} else if (gpio_source == 1) {
> +			port = IOSF_PORT_GPIO_SC;
> +		} else {
> +			DRM_DEBUG_KMS("unknown gpio source %u\n", gpio_source);
> +			goto out;
> +		}
> +	} else {
> +		port = IOSF_PORT_GPIO_NC;
>  	}
>  
>  	function = gtable[gpio_index].function_reg;
> @@ -234,15 +248,14 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
>  	if (!gtable[gpio_index].init) {
>  		/* program the function */
>  		/* FIXME: remove constant below */
> -		vlv_iosf_sb_write(dev_priv, IOSF_PORT_GPIO_NC, function,
> -				  0x2000CC00);
> +		vlv_iosf_sb_write(dev_priv, port, function, 0x2000CC00);
>  		gtable[gpio_index].init = 1;
>  	}
>  
>  	val = 0x4 | action;
>  
>  	/* pull up/down */
> -	vlv_iosf_sb_write(dev_priv, IOSF_PORT_GPIO_NC, pad, val);
> +	vlv_iosf_sb_write(dev_priv, port, pad, val);
>  	mutex_unlock(&dev_priv->sb_lock);
>  
>  out:
> -- 
> 2.1.4

-- 
Ville Syrjälä
Intel OTC


More information about the Intel-gfx mailing list