All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepak M <m.deepak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [MIPI SEQ PARSING v1 PATCH 9/9] BXT GPIO support for backlight and panel control
Date: Tue, 28 Jul 2015 15:31:10 +0530	[thread overview]
Message-ID: <1438077670-12953-10-git-send-email-m.deepak@intel.com> (raw)
In-Reply-To: <1438077670-12953-1-git-send-email-m.deepak@intel.com>

From: Uma Shankar <uma.shankar@intel.com>

Added the BXT GPIO pin configuration and programming logic for
backlight and panel control.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |   46 ++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index c6f66e4..f27a568 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -32,6 +32,7 @@
 #include <linux/slab.h>
 #include <video/mipi_display.h>
 #include <linux/i2c.h>
+#include <linux/gpio.h>
 #include <asm/intel-mid.h>
 #include <video/mipi_display.h>
 #include "i915_drv.h"
@@ -325,6 +326,16 @@ out:
 	return data;
 }
 
+struct bxt_gpio_table {
+	u16 gpio_pin;
+	u16 offset;
+};
+
+static struct bxt_gpio_table bxt_gtable[] = {
+	{0xC1, 270},
+	{0x1B, 456}
+};
+
 static inline enum port intel_dsi_seq_port_to_port(u8 port)
 {
 	return port ? PORT_C : PORT_A;
@@ -537,6 +548,39 @@ static int vlv_program_gpio(struct intel_dsi *intel_dsi,
 	return 0;
 }
 
+static int bxt_program_gpio(struct intel_dsi *intel_dsi,
+				const u8 *data, const u8 **cur_data)
+{
+	struct drm_device *dev = intel_dsi->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	u8 gpio, action;
+	u16 function;
+
+	/*
+	 * Skipping the first byte as it is of no
+	 * interest for android in new version
+	 */
+	if (dev_priv->vbt.dsi.seq_version >= 3)
+		data++;
+
+	gpio = *data++;
+
+	/* pull up/down */
+	action = *data++;
+	function = (bxt_gtable[0].gpio_pin == gpio) ?
+		bxt_gtable[0].offset :
+		(bxt_gtable[1].gpio_pin == gpio) ?
+		bxt_gtable[1].offset : 0;
+	if (!function)
+		return -1;
+
+	gpio_request_one(function, GPIOF_DIR_OUT, "MIPI");
+	gpio_set_value(function, action);
+
+	*cur_data = data;
+	return 0;
+}
+
 static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
 {
 	struct drm_device *dev = intel_dsi->base.base.dev;
@@ -550,6 +594,8 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
 		ret = chv_program_gpio(intel_dsi, data, &data);
 	else if (IS_VALLEYVIEW(dev))
 		ret = vlv_program_gpio(intel_dsi, data, &data);
+	else if (IS_BROXTON(dev))
+		ret = bxt_program_gpio(intel_dsi, data, &data);
 	else
 		DRM_ERROR("GPIO programming missing for this platform.\n");
 
-- 
1.7.9.5

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

      parent reply	other threads:[~2015-07-28  9:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 10:01 [MIPI SEQ V3 PARSING PATCH 0/9] Patches to support the version 3 of MIPI sequence in VBT Deepak M
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 1/9] drm/i915: Adding the parsing logic for the i2c element Deepak M
2015-07-28 15:22   ` Jani Nikula
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 2/9] drm/i915: Parsing VBT if size of VBT exceeds 6KB Deepak M
2015-07-28 15:12   ` Jani Nikula
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 3/9] drm/i915: Using the approprite vbt size if vbt is not in mailbox4 of opregion Deepak M
2015-07-28 15:18   ` Jani Nikula
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 4/9] drm/i915: Added support the v3 mipi sequence block Deepak M
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 5/9] drm/i915: Added the generic gpio sequence support and gpio table Deepak M
2015-07-28 15:48   ` Jani Nikula
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 6/9] drm/i915: GPIO for CHT generic MIPI Deepak M
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 7/9] drm: Add few more wrapper functions for drm panel Deepak M
2015-07-28 10:01 ` [MIPI SEQ PARSING v1 PATCH 8/9] drm/i915: Add functions to execute the new sequences from VBT Deepak M
2015-07-28 10:01 ` Deepak M [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438077670-12953-10-git-send-email-m.deepak@intel.com \
    --to=m.deepak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.