Skip to contentSkip to conversation

drm/i915/bxt: add bxt dsi gpio element support

PATCH Applied Mika Kahola 4 participants 6 messages Dec 5, 2016 – Dec 21, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/i915/bxt: add bxt dsi gpio element support

From: Jani Nikula <[email protected]>

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.

v2: switch *NULL* to *"panel"* when requesting gpio for MIPI/DSI panel. (Mika)

---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 38 +++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +32 -6
index 0d8ff00..dda678b 100644
@@ -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,
+						 "panel", 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;
 }
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: warning for drm/i915/bxt: add bxt dsi gpio element support (rev4)

== Series Details ==

== Series Details ==

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

== Summary ==

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

Test drv_module_reload:

        Subgroup basic-reload-inject:
                pass       -> DMESG-WARN (fi-ilk-650)
fi-bdw-5557u     total:247  pass:232  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:247  pass:207  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700     total:247  pass:219  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900     total:247  pass:219  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:247  pass:215  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:247  pass:227  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:247  pass:227  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650       total:247  pass:193  dwarn:1   dfail:0   fail:0   skip:53 
fi-ivb-3520m     total:247  pass:225  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770      total:247  pass:225  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7500u     total:247  pass:225  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:247  pass:233  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:247  pass:223  dwarn:3   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:247  pass:233  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m     total:247  pass:215  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600      total:247  pass:214  dwarn:0   dfail:0   fail:0   skip:33 

78c588b7383745c70d2a6b144c4c2032b120b949 drm-tip: 2016y-12m-02d-20h-20m-21s UTC integration manifest 2c16c35 drm/i915/bxt: add bxt dsi gpio element support

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3185/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Applied
#2 lore raw
In reply to Mika Kahola
Quoted 10 lines · Mika Kahola

From: Jani Nikula <[email protected]>

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.

v2: switch *NULL* to *"panel"* when requesting gpio for MIPI/DSI panel. (Mika)

Pushed to dinq.

BR,
Jani.

Quoted 79 lines
---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 38 +++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +32 -6
index 0d8ff00..dda678b 100644
@@ -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,
+						 "panel", 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;
 }
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 9 lines · On Tue, 13 Dec 2016 16:11:20 +0200 Jani Nikula <[email protected]> wrote:
Quoted 8 lines · Mika Kahola

From: Jani Nikula <[email protected]>

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.

v2: switch *NULL* to *"panel"* when requesting gpio for MIPI/DSI panel. (Mika)

Jani, Mika,

I'm working on getting a dual-link MIPI panel working on BXT and have a problem getting the proper GPIO pins set. This patch gets things closer, but at least for the platform I'm working on, there's one GPIO pin (backlight/panel control) that doesn't seem to be available via the consumer API. If I use the alternate#2 method that Jani posted (legacy GPIO API) along with the proper defines I can set this pin. I'm using:

#define BXT_PANEL1_VDDEN_PIN       196
#define BXT_PANEL1_BKLTEN_PIN      197
#define BXT_PANEL1_BKLTCTL_PIN     198
#define BXT_PANEL1_VDDEN_OFFSET    366
#define BXT_PANEL1_BKLTEN_OFFSET   367
#define BXT_PANEL1_BKLTCTL_OFFSET  368

to create my GPIO table.

These three pins need to be set VDDEN, BKLTCTL, BKLTEN, in that order to get the panel to turn on.

For testing, I have a call in the vbt_panel_prepare() to set the pin and one in vbt_panel_unprepare() to clear it. That works but that doesn't seem like the right solution. I was wondering if either of you have any insights?

Bob

Quoted 88 lines
Quoted 2 lines

Pushed to dinq.

BR,
Jani.

Quoted 79 lines
---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 38 +++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +32 -6
index 0d8ff00..dda678b 100644
@@ -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,
+						 "panel", 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;
 }  
Signature · 11 lines
--
Bob Paauwe                  
[email protected]
IOTG / PED Software Organization
Intel Corp.  Folsom, CA
(916) 356-6193    

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Hi Bob,

Quoted 42 lines · Bob Paauwe
Quoted 11 lines · On Tue, 13 Dec 2016 16:11:20 +0200 Jani Nikula <[email protected]> wrote:
Quoted 9 lines · Mika Kahola

From: Jani Nikula <[email protected]>

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.

Quoted 3 lines
Quoted 3 lines

v2: switch *NULL* to *"panel"* when requesting gpio for MIPI/DSI panel. (Mika)

Jani, Mika,

I'm working on getting a dual-link MIPI panel working on BXT and have a
problem getting the proper GPIO pins set.  This patch gets things closer, but at least for the platform I'm working on, there's one GPIO
pin (backlight/panel control) that doesn't seem to be available via the
consumer API.  If I use the alternate#2 method that Jani posted (legacy GPIO API) along with the proper defines I can set this pin. I'm
using:

#define BXT_PANEL1_VDDEN_PIN       196
#define BXT_PANEL1_BKLTEN_PIN      197
#define BXT_PANEL1_BKLTCTL_PIN     198

#define BXT_PANEL1_VDDEN_OFFSET    366
#define BXT_PANEL1_BKLTEN_OFFSET   367
#define BXT_PANEL1_BKLTCTL_OFFSET  368

to create my GPIO table.

Quoted 8 lines

These three pins need to be set VDDEN, BKLTCTL, BKLTEN, in that order to get the panel to turn on.

For testing, I have a call in the vbt_panel_prepare() to set the pin and one in vbt_panel_unprepare() to clear it.  That works but that doesn't seem like the right solution.  I was wondering if either of you
have any insights?

Do you see these warnings in dmesg such as 'GPIO index x request failed'? This is what you should see if the pin can't be accessed.

Can you see  all of these GPIO pins in /sys/kernel/debug/gpio file?

And you also need to enable pincontrol for Broxton in kernel config

CONFIG_PINCTRL_BROXTON=y

Quoted 112 lines

Bob

Quoted 108 lines
Quoted 4 lines

Pushed to dinq.

BR,
Jani.

Quoted 99 lines

---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 38
+++++++++++++++++++++++++-----

 1 file changed, 32 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
index 0d8ff00..dda678b 100644
@@ -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);
  }

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +2 -0
+static void bxt_exec_gpio(struct drm_i915_private *dev_priv,
+			  u8 gpio_source, u8 gpio_index, bool

value)

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +4 -0
+{
+	/* 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];

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +3 -0
+
+	if (!gpio_desc) {
+		gpio_desc = devm_gpiod_get_index(dev_priv-
Quoted 1 line

drm.dev,

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+						 "panel",

gpio_index,

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+						 value ?

GPIOD_OUT_LOW :

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+						 GPIOD_OUT_HIGH)

;

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +3 -0
+
+		if (IS_ERR_OR_NULL(gpio_desc)) {
+			DRM_ERROR("GPIO index %u request failed

(%ld)\n",

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+				  gpio_index,

PTR_ERR(gpio_desc));

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +9 -0
+			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);

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -1
-	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)

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -1
-		data++;
+		gpio_index = *data++;

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -1
-	gpio_index = *data++;
+	gpio_number = *data++;


  /* gpio source in sequence v2 only */
  if (dev_priv->vbt.dsi.seq_version == 2)

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +0 -0
@@ -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))

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +0 -1
-		vlv_exec_gpio(dev_priv, gpio_source, gpio_index,

value);

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+		vlv_exec_gpio(dev_priv, gpio_source,

gpio_number, value);
  else if (IS_CHERRYVIEW(dev_priv))

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +0 -1
-		chv_exec_gpio(dev_priv, gpio_source, gpio_index,

value);

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+		chv_exec_gpio(dev_priv, gpio_source,

gpio_number, value);
  else

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +0 -1
-		DRM_DEBUG_KMS("GPIO element not supported on

this platform\n");

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+		bxt_exec_gpio(dev_priv, gpio_source, gpio_index,

value);

  return data;
 }

Signature · 6 lines
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 48 lines · On Wed, 21 Dec 2016 08:45:46 +0200 Mika Kahola <[email protected]> wrote:

Hi Bob,

Quoted 45 lines · Bob Paauwe
Quoted 11 lines · On Tue, 13 Dec 2016 16:11:20 +0200 Jani Nikula <[email protected]> wrote:
Quoted 9 lines · Mika Kahola

From: Jani Nikula <[email protected]>

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.

Quoted 3 lines
Quoted 3 lines

v2: switch *NULL* to *"panel"* when requesting gpio for MIPI/DSI panel. (Mika)

Jani, Mika,

I'm working on getting a dual-link MIPI panel working on BXT and have a
problem getting the proper GPIO pins set.  This patch gets things closer, but at least for the platform I'm working on, there's one GPIO
pin (backlight/panel control) that doesn't seem to be available via the
consumer API.  If I use the alternate#2 method that Jani posted (legacy GPIO API) along with the proper defines I can set this pin. I'm
using:

#define BXT_PANEL1_VDDEN_PIN       196
#define BXT_PANEL1_BKLTEN_PIN      197
#define BXT_PANEL1_BKLTCTL_PIN     198

#define BXT_PANEL1_VDDEN_OFFSET    366
#define BXT_PANEL1_BKLTEN_OFFSET   367
#define BXT_PANEL1_BKLTCTL_OFFSET  368

to create my GPIO table.

These three pins need to be set VDDEN, BKLTCTL, BKLTEN, in that order to get the panel to turn on.

Quoted 7 lines
Quoted 5 lines

For testing, I have a call in the vbt_panel_prepare() to set the pin and one in vbt_panel_unprepare() to clear it.  That works but that doesn't seem like the right solution.  I was wondering if either of you
have any insights?

Do you see these warnings in dmesg such as 'GPIO index x request failed'? This is what you should see if the pin can't be accessed.

Yes, I get that message. I dumped some additional information in the gpio code and it shows that the pin count is 3 (and it's zero index based). Through the power on and backlight sequences, bxt_exec_gpio is called with index 1 and 2. Both of those work and correspond to the 196 and 197 defines I listed above. If I call bxt_exec_gpio with index 0, it fails and I've also tried using index 3 and it fails.

Using

devm_gpio_request_one(dev_priv->drm.dev, 368, GPIOF_DIR_OUT, "MIPI DSI"); gpio_set_value(368, 1);

does work and lets me set the third pin.

My guess is that the ACPI table is missing an entry for this third pin and hence, why devm_gpiod_get_index() fails. It also seems like setting this pin should be included in one of the MIPI sequences. But I don't understand all of this well enough to be sure.

Quoted 2 lines

Can you see  all of these GPIO pins in /sys/kernel/debug/gpio file?

Yes. I even have scripts to query and set the 3 pins. Those work fine (if the driver isn't running and has control over the pins).

Quoted 4 lines

And you also need to enable pincontrol for Broxton in kernel config

CONFIG_PINCTRL_BROXTON=y

Yes, that is enabled.

Quoted 115 lines
Quoted 115 lines

Bob

Quoted 108 lines
Quoted 4 lines

Pushed to dinq.

BR,
Jani.

Quoted 99 lines

---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 38
+++++++++++++++++++++++++-----

 1 file changed, 32 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
index 0d8ff00..dda678b 100644
@@ -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);
  }

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +2 -0
+static void bxt_exec_gpio(struct drm_i915_private *dev_priv,
+			  u8 gpio_source, u8 gpio_index, bool

value)

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +4 -0
+{
+	/* 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];

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +3 -0
+
+	if (!gpio_desc) {
+		gpio_desc = devm_gpiod_get_index(dev_priv-  
Quoted 1 line

drm.dev,

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+						 "panel",

gpio_index,

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+						 value ?

GPIOD_OUT_LOW :

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+						 GPIOD_OUT_HIGH)

;

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +3 -0
+
+		if (IS_ERR_OR_NULL(gpio_desc)) {
+			DRM_ERROR("GPIO index %u request failed

(%ld)\n",

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+				  gpio_index,

PTR_ERR(gpio_desc));

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +9 -0
+			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);

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -1
-	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)

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -1
-		data++;
+		gpio_index = *data++;

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -1
-	gpio_index = *data++;
+	gpio_number = *data++;


  /* gpio source in sequence v2 only */
  if (dev_priv->vbt.dsi.seq_version == 2)

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +0 -0
@@ -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))

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +0 -1
-		vlv_exec_gpio(dev_priv, gpio_source, gpio_index,

value);

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+		vlv_exec_gpio(dev_priv, gpio_source,

gpio_number, value);
  else if (IS_CHERRYVIEW(dev_priv))

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +0 -1
-		chv_exec_gpio(dev_priv, gpio_source, gpio_index,

value);

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+		chv_exec_gpio(dev_priv, gpio_source,

gpio_number, value);
  else

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +0 -1
-		DRM_DEBUG_KMS("GPIO element not supported on

this platform\n");

drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
+		bxt_exec_gpio(dev_priv, gpio_source, gpio_index,

value);

  return data;
 }

Signature · 11 lines
--
Bob Paauwe                  
[email protected]
IOTG / PED Software Organization
Intel Corp.  Folsom, CA
(916) 356-6193    

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx