intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Deepak M <m.deepak@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [Generic GPIO patch 3/3] drm/i915: BXT GPIO support for backlight and panel control
Date: Fri, 19 Feb 2016 16:53:52 +0530	[thread overview]
Message-ID: <1455881032-3192-3-git-send-email-m.deepak@intel.com> (raw)
In-Reply-To: <1455881032-3192-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.

Cc: Jani Nikula <jani.nikula@intel.com>
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 7fd1fae..c6e18fe 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 <asm/intel-mid.h>
+#include <linux/gpio.h>
 #include <video/mipi_display.h>
 #include "i915_drv.h"
 #include "intel_drv.h"
@@ -593,6 +594,16 @@ static struct gpio_table gtable[] = {
 	{ VLV_USB_ULPI_0_REFCLK_GPIOS_43_PCONF0, VLV_USB_ULPI_0_REFCLK_GPIOS_43_PAD, 0}
 };
 
+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;
@@ -812,6 +823,39 @@ out:
 	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;
@@ -825,6 +869,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.9.1

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

  parent reply	other threads:[~2016-02-19 11:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-19 11:23 [Generic GPIO patch 1/3] drm/i915/dsi: Added the generic gpio sequence support and gpio table Deepak M
2016-02-19 11:23 ` [Generic GPIO patch 2/3] drm/i915: GPIO for CHT generic MIPI Deepak M
2016-02-19 13:25   ` Jani Nikula
2016-02-22 13:25     ` [GPIO PATCH 1/2] " Deepak M
2016-02-22 13:40       ` Jani Nikula
2016-02-19 11:23 ` Deepak M [this message]
2016-02-19 13:34   ` [Generic GPIO patch 3/3] drm/i915: BXT GPIO support for backlight and panel control Jani Nikula
2016-02-22 13:26     ` [GPIO PATCH 2/2] drm/i915: GPIO for BXT generic MIPI Deepak M
2016-02-22 14:04       ` Jani Nikula
2016-02-19 12:14 ` ✓ Fi.CI.BAT: success for series starting with [Generic,GPIO,1/3] drm/i915/dsi: Added the generic gpio sequence support and gpio table Patchwork
2016-02-19 13:21 ` [Generic GPIO patch 1/3] " Jani Nikula
2016-02-19 13:31   ` Deepak, M
2016-02-19 13:36     ` Jani Nikula
2016-02-19 13:46       ` [PATCH] " Deepak M
2016-02-19 15:15 ` ✗ Fi.CI.BAT: warning for series starting with drm/i915/dsi: Added the generic gpio sequence support and gpio table (rev2) Patchwork
2016-02-22 13:47 ` ✗ Fi.CI.BAT: failure for series starting with drm/i915/dsi: Added the generic gpio sequence support and gpio table (rev4) Patchwork

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=1455881032-3192-3-git-send-email-m.deepak@intel.com \
    --to=m.deepak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).