linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: gbean@codeaurora.org (Gregory Bean)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] msm: gpio: Add gpiomux calls to request and free.
Date: Mon, 30 Aug 2010 17:18:26 -0700	[thread overview]
Message-ID: <1283213906-17671-2-git-send-email-gbean@codeaurora.org> (raw)
In-Reply-To: <1283213906-17671-1-git-send-email-gbean@codeaurora.org>

Add gpiomux get and put calls to msmgpio request and free,
in order to allow gpio lines to be properly reference-counted
and power-managed.

Signed-off-by: Gregory Bean <gbean@codeaurora.org>
---
 arch/arm/mach-msm/gpio.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-msm/gpio.c b/arch/arm/mach-msm/gpio.c
index fd899a1..ea93ecb 100644
--- a/arch/arm/mach-msm/gpio.c
+++ b/arch/arm/mach-msm/gpio.c
@@ -21,6 +21,7 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include "gpio_hw.h"
+#include "gpiomux.h"
 #include "proc_comm.h"
 #include "smd_private.h"
 
@@ -157,6 +158,16 @@ static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 	return MSM_GPIO_TO_INT(chip->base + offset);
 }
 
+static int msm_gpio_request(struct gpio_chip *chip, unsigned offset)
+{
+        return msm_gpiomux_get(chip->base + offset);
+}
+
+static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
+{
+        msm_gpiomux_put(chip->base + offset);
+}
+
 struct msm_gpio_chip msm_gpio_chips[] = {
 	{
 		.regs = {
@@ -177,6 +188,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -202,6 +215,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -228,6 +243,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -249,6 +266,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -274,6 +293,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -306,6 +327,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 #if defined(CONFIG_ARCH_QSD8X50) || defined(CONFIG_ARCH_MSM7X30)
@@ -333,6 +356,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 	{
@@ -359,6 +384,8 @@ struct msm_gpio_chip msm_gpio_chips[] = {
 			.direction_input = msm_gpio_direction_input,
 			.direction_output = msm_gpio_direction_output,
 			.to_irq = msm_gpio_to_irq,
+			.request = msm_gpio_request,
+			.free = msm_gpio_free,
 		}
 	},
 #endif
-- 
1.7.0.4

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  reply	other threads:[~2010-08-31  0:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31  0:18 [PATCH 1/2] msm: Install the Google-Android gpio driver Gregory Bean
2010-08-31  0:18 ` Gregory Bean [this message]
2010-08-31 16:46 ` Daniel Walker
2010-08-31 16:50 ` Daniel Walker
2010-08-31 21:50 ` Daniel Walker
2010-09-01 18:59 ` H Hartley Sweeten
2010-09-01 21:13   ` Daniel Walker
2010-09-01 21:30     ` Ryan Mallon

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=1283213906-17671-2-git-send-email-gbean@codeaurora.org \
    --to=gbean@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.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 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).