All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/bxt: add bxt dsi gpio element support
@ 2016-11-15 15:44 Jani Nikula
  2016-11-15 16:45 ` ✓ Fi.CI.BAT: success for drm/i915/bxt: add bxt dsi gpio element support (rev3) Patchwork
  0 siblings, 1 reply; 5+ messages in thread
From: Jani Nikula @ 2016-11-15 15:44 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Request the GPIO by index through the consumer API. For now, use a quick
hack to store the already requested ones, simply because I have no idea
whether this actually works or not, and I have no way to test it.

Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 38 +++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index 9f279a3d0f74..41e0eeac97f4 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -29,6 +29,7 @@
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
 #include <drm/drm_panel.h>
+#include <linux/gpio/consumer.h>
 #include <linux/slab.h>
 #include <video/mipi_display.h>
 #include <asm/intel-mid.h>
@@ -304,19 +305,44 @@ static void chv_exec_gpio(struct drm_i915_private *dev_priv,
 	mutex_unlock(&dev_priv->sb_lock);
 }
 
+static void bxt_exec_gpio(struct drm_i915_private *dev_priv,
+			  u8 gpio_source, u8 gpio_index, bool value)
+{
+	/* XXX: this table is a quick ugly hack. */
+	static struct gpio_desc *bxt_gpio_table[U8_MAX + 1];
+	struct gpio_desc *gpio_desc = bxt_gpio_table[gpio_index];
+
+	if (!gpio_desc) {
+		gpio_desc = devm_gpiod_get_index(dev_priv->drm.dev,
+						 NULL, gpio_index,
+						 value ? GPIOD_OUT_LOW :
+						 GPIOD_OUT_HIGH);
+
+		if (IS_ERR_OR_NULL(gpio_desc)) {
+			DRM_ERROR("GPIO index %u request failed (%ld)\n",
+				  gpio_index, PTR_ERR(gpio_desc));
+			return;
+		}
+
+		bxt_gpio_table[gpio_index] = gpio_desc;
+	}
+
+	gpiod_set_value(gpio_desc, value);
+}
+
 static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
 {
 	struct drm_device *dev = intel_dsi->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	u8 gpio_source, gpio_index;
+	u8 gpio_source, gpio_index = 0, gpio_number;
 	bool value;
 
 	DRM_DEBUG_KMS("\n");
 
 	if (dev_priv->vbt.dsi.seq_version >= 3)
-		data++;
+		gpio_index = *data++;
 
-	gpio_index = *data++;
+	gpio_number = *data++;
 
 	/* gpio source in sequence v2 only */
 	if (dev_priv->vbt.dsi.seq_version == 2)
@@ -328,11 +354,11 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
 	value = *data++ & 1;
 
 	if (IS_VALLEYVIEW(dev_priv))
-		vlv_exec_gpio(dev_priv, gpio_source, gpio_index, value);
+		vlv_exec_gpio(dev_priv, gpio_source, gpio_number, value);
 	else if (IS_CHERRYVIEW(dev_priv))
-		chv_exec_gpio(dev_priv, gpio_source, gpio_index, value);
+		chv_exec_gpio(dev_priv, gpio_source, gpio_number, value);
 	else
-		DRM_DEBUG_KMS("GPIO element not supported on this platform\n");
+		bxt_exec_gpio(dev_priv, gpio_source, gpio_index, value);
 
 	return data;
 }
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915/bxt: add bxt dsi gpio element support (rev3)
  2016-11-15 15:44 [PATCH] drm/i915/bxt: add bxt dsi gpio element support Jani Nikula
@ 2016-11-15 16:45 ` Patchwork
  0 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2016-11-15 16:45 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/bxt: add bxt dsi gpio element support (rev3)
URL   : https://patchwork.freedesktop.org/series/15338/
State : success

== Summary ==

Series 15338v3 drm/i915/bxt: add bxt dsi gpio element support
https://patchwork.freedesktop.org/api/1.0/series/15338/revisions/3/mbox/


fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:204  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900     total:244  pass:216  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:244  pass:224  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650       total:244  pass:191  dwarn:0   dfail:0   fail:0   skip:53 
fi-ivb-3520m     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7200u     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:223  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:244  pass:222  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m     total:244  pass:212  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600      total:244  pass:211  dwarn:0   dfail:0   fail:0   skip:33 

04145fe15cf8c81c221e62fc9d65d93053f9bd1a drm-intel-nightly: 2016y-11m-15d-14h-47m-07s UTC integration manifest
e572238 drm/i915/bxt: add bxt dsi gpio element support

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3003/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915/bxt: add bxt dsi gpio element support
  2016-04-07 12:21   ` Ville Syrjälä
@ 2016-04-07 12:55     ` Jani Nikula
  0 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2016-04-07 12:55 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

On Thu, 07 Apr 2016, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Apr 07, 2016 at 02:47:52PM +0300, Jani Nikula wrote:
>> Request the GPIO by index through the consumer API. For now, use a quick
>> hack to store the already requested ones, simply because I have no idea
>> whether this actually works or not, and I have no way to test it.
>
> Would be cool if someone dumped out the relevant ACPI table(s) on
> a machine that needs this stuff, so that we can see if things look
> sane on that level.

I know, I've been asking.

BR,
Jani.

>
>> 
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 28 +++++++++++++++++++++++++++-
>>  1 file changed, 27 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>> index 5e2c31d9a748..7e6a21c05c6a 100644
>> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>> @@ -29,6 +29,7 @@
>>  #include <drm/drm_edid.h>
>>  #include <drm/i915_drm.h>
>>  #include <drm/drm_panel.h>
>> +#include <linux/gpio.h>
>>  #include <linux/slab.h>
>>  #include <video/mipi_display.h>
>>  #include <asm/intel-mid.h>
>> @@ -295,6 +296,31 @@ static void chv_exec_gpio(struct drm_i915_private *dev_priv,
>>  	mutex_unlock(&dev_priv->sb_lock);
>>  }
>>  
>> +static void bxt_exec_gpio(struct drm_i915_private *dev_priv,
>> +			  u8 gpio_source, u8 gpio_index, bool value)
>> +{
>> +	/* XXX: this table is a quick ugly hack. */
>> +	static struct gpio_desc *bxt_gpio_table[U8_MAX + 1];
>> +	struct gpio_desc *gpio_desc = bxt_gpio_table[gpio_index];
>> +
>> +	if (!gpio_desc) {
>> +		gpio_desc = devm_gpiod_get_index(dev_priv->dev->dev,
>> +						 NULL, gpio_index,
>> +						 value ? GPIOD_OUT_LOW :
>> +						 GPIOD_OUT_HIGH);
>> +
>> +		if (IS_ERR_OR_NULL(gpio_desc)) {
>> +			DRM_ERROR("GPIO index %u request failed (%ld)\n",
>> +				  gpio_index, PTR_ERR(gpio_desc));
>> +			return;
>> +		}
>> +
>> +		bxt_gpio_table[gpio_index] = gpio_desc;
>> +	}
>> +
>> +	gpiod_set_value(gpio_desc, value);
>> +}
>> +
>>  static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
>>  {
>>  	struct drm_device *dev = intel_dsi->base.base.dev;
>> @@ -321,7 +347,7 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
>>  	else if (IS_CHERRYVIEW(dev_priv))
>>  		chv_exec_gpio(dev_priv, gpio_source, gpio_index, value);
>>  	else
>> -		DRM_DEBUG_KMS("GPIO element not supported on this platform\n");
>> +		bxt_exec_gpio(dev_priv, gpio_source, gpio_index, value);
>>  
>>  	return data;
>>  }
>> -- 
>> 2.1.4

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915/bxt: add bxt dsi gpio element support
  2016-04-07 11:47 ` [PATCH] " Jani Nikula
@ 2016-04-07 12:21   ` Ville Syrjälä
  2016-04-07 12:55     ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Ville Syrjälä @ 2016-04-07 12:21 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Thu, Apr 07, 2016 at 02:47:52PM +0300, Jani Nikula wrote:
> Request the GPIO by index through the consumer API. For now, use a quick
> hack to store the already requested ones, simply because I have no idea
> whether this actually works or not, and I have no way to test it.

Would be cool if someone dumped out the relevant ACPI table(s) on
a machine that needs this stuff, so that we can see if things look
sane on that level.

> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 28 +++++++++++++++++++++++++++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index 5e2c31d9a748..7e6a21c05c6a 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -29,6 +29,7 @@
>  #include <drm/drm_edid.h>
>  #include <drm/i915_drm.h>
>  #include <drm/drm_panel.h>
> +#include <linux/gpio.h>
>  #include <linux/slab.h>
>  #include <video/mipi_display.h>
>  #include <asm/intel-mid.h>
> @@ -295,6 +296,31 @@ static void chv_exec_gpio(struct drm_i915_private *dev_priv,
>  	mutex_unlock(&dev_priv->sb_lock);
>  }
>  
> +static void bxt_exec_gpio(struct drm_i915_private *dev_priv,
> +			  u8 gpio_source, u8 gpio_index, bool value)
> +{
> +	/* XXX: this table is a quick ugly hack. */
> +	static struct gpio_desc *bxt_gpio_table[U8_MAX + 1];
> +	struct gpio_desc *gpio_desc = bxt_gpio_table[gpio_index];
> +
> +	if (!gpio_desc) {
> +		gpio_desc = devm_gpiod_get_index(dev_priv->dev->dev,
> +						 NULL, gpio_index,
> +						 value ? GPIOD_OUT_LOW :
> +						 GPIOD_OUT_HIGH);
> +
> +		if (IS_ERR_OR_NULL(gpio_desc)) {
> +			DRM_ERROR("GPIO index %u request failed (%ld)\n",
> +				  gpio_index, PTR_ERR(gpio_desc));
> +			return;
> +		}
> +
> +		bxt_gpio_table[gpio_index] = gpio_desc;
> +	}
> +
> +	gpiod_set_value(gpio_desc, value);
> +}
> +
>  static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
>  {
>  	struct drm_device *dev = intel_dsi->base.base.dev;
> @@ -321,7 +347,7 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
>  	else if (IS_CHERRYVIEW(dev_priv))
>  		chv_exec_gpio(dev_priv, gpio_source, gpio_index, value);
>  	else
> -		DRM_DEBUG_KMS("GPIO element not supported on this platform\n");
> +		bxt_exec_gpio(dev_priv, gpio_source, gpio_index, value);
>  
>  	return data;
>  }
> -- 
> 2.1.4

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] drm/i915/bxt: add bxt dsi gpio element support
  2016-04-05 19:30 [PATCH v3 6/6] drm/i915/bxt: add bxt dsi gpio element support Jani Nikula
@ 2016-04-07 11:47 ` Jani Nikula
  2016-04-07 12:21   ` Ville Syrjälä
  0 siblings, 1 reply; 5+ messages in thread
From: Jani Nikula @ 2016-04-07 11:47 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx

Request the GPIO by index through the consumer API. For now, use a quick
hack to store the already requested ones, simply because I have no idea
whether this actually works or not, and I have no way to test it.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index 5e2c31d9a748..7e6a21c05c6a 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -29,6 +29,7 @@
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
 #include <drm/drm_panel.h>
+#include <linux/gpio.h>
 #include <linux/slab.h>
 #include <video/mipi_display.h>
 #include <asm/intel-mid.h>
@@ -295,6 +296,31 @@ static void chv_exec_gpio(struct drm_i915_private *dev_priv,
 	mutex_unlock(&dev_priv->sb_lock);
 }
 
+static void bxt_exec_gpio(struct drm_i915_private *dev_priv,
+			  u8 gpio_source, u8 gpio_index, bool value)
+{
+	/* XXX: this table is a quick ugly hack. */
+	static struct gpio_desc *bxt_gpio_table[U8_MAX + 1];
+	struct gpio_desc *gpio_desc = bxt_gpio_table[gpio_index];
+
+	if (!gpio_desc) {
+		gpio_desc = devm_gpiod_get_index(dev_priv->dev->dev,
+						 NULL, gpio_index,
+						 value ? GPIOD_OUT_LOW :
+						 GPIOD_OUT_HIGH);
+
+		if (IS_ERR_OR_NULL(gpio_desc)) {
+			DRM_ERROR("GPIO index %u request failed (%ld)\n",
+				  gpio_index, PTR_ERR(gpio_desc));
+			return;
+		}
+
+		bxt_gpio_table[gpio_index] = gpio_desc;
+	}
+
+	gpiod_set_value(gpio_desc, value);
+}
+
 static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
 {
 	struct drm_device *dev = intel_dsi->base.base.dev;
@@ -321,7 +347,7 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
 	else if (IS_CHERRYVIEW(dev_priv))
 		chv_exec_gpio(dev_priv, gpio_source, gpio_index, value);
 	else
-		DRM_DEBUG_KMS("GPIO element not supported on this platform\n");
+		bxt_exec_gpio(dev_priv, gpio_source, gpio_index, value);
 
 	return data;
 }
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-15 16:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-15 15:44 [PATCH] drm/i915/bxt: add bxt dsi gpio element support Jani Nikula
2016-11-15 16:45 ` ✓ Fi.CI.BAT: success for drm/i915/bxt: add bxt dsi gpio element support (rev3) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2016-04-05 19:30 [PATCH v3 6/6] drm/i915/bxt: add bxt dsi gpio element support Jani Nikula
2016-04-07 11:47 ` [PATCH] " Jani Nikula
2016-04-07 12:21   ` Ville Syrjälä
2016-04-07 12:55     ` Jani Nikula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.