[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <ea9c188e8ed12eccb6807f975285fb6274b21de4.1372211451.git.dvhart@linux.intel.com>
Date: Tue, 25 Jun 2013 18:53:23 -0700
From: Darren Hart <dvhart@...ux.intel.com>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"H. Peter Anvin" <hpa@...or.com>, peter.p.waskiewicz.jr@...el.com,
andriy.shevchenko@...ux.intel.com, danders@...cuitco.com,
vishal.l.verma@...el.com, dvhart@...ux.intel.com
Cc: Grant Likely <grant.likely@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>
Subject: [PATCH 3/8] gpio-sch: Add sch_gpio_resume_set_enable()
Allow for enabling and disabling of the resume well GPIOs. The E6xx Atom
CPUs multiplex the resume GPIO 2:0 lines with LVDS and individual board
drivers need to be able to enable or disable the lines appropriately.
Unfortunately, the information regarding if the pins are being used for
LVDS or GPIO is board specific and may not be available to the gpio-sch
driver at probe time.
Signed-off-by: Darren Hart <dvhart@...ux.intel.com>
Cc: Grant Likely <grant.likely@...aro.org>
Cc: Linus Walleij <linus.walleij@...aro.org>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Peter Waskiewicz <peter.p.waskiewicz.jr@...el.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/gpio/gpio-sch.c | 24 ++++++++++++++++++++++++
include/linux/gpio-sch.h | 6 ++++++
2 files changed, 30 insertions(+)
create mode 100644 include/linux/gpio-sch.h
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
index 5af6571..90785f8 100644
--- a/drivers/gpio/gpio-sch.c
+++ b/drivers/gpio/gpio-sch.c
@@ -41,6 +41,30 @@ static DEFINE_SPINLOCK(gpio_lock);
static unsigned short gpio_ba;
+void sch_gpio_resume_set_enable(unsigned gpio_num, int val)
+{
+ u8 curr_en;
+ unsigned short offset, bit;
+
+ spin_lock(&gpio_lock);
+
+ offset = RGEN + gpio_num / 8;
+ bit = gpio_num % 8;
+
+ curr_en = inb(gpio_ba + offset);
+
+ if (val) {
+ if (!(curr_en & (1 << bit)))
+ outb(curr_en | (1 << bit), gpio_ba + offset);
+ } else {
+ if ((curr_en & (1 << bit)))
+ outb(curr_en & ~(1 << bit), gpio_ba + offset);
+ }
+
+ spin_unlock(&gpio_lock);
+}
+EXPORT_SYMBOL_GPL(sch_gpio_resume_set_enable);
+
static int sch_gpio_core_direction_in(struct gpio_chip *gc, unsigned gpio_num)
{
u8 curr_dirs;
diff --git a/include/linux/gpio-sch.h b/include/linux/gpio-sch.h
new file mode 100644
index 0000000..79e042f
--- /dev/null
+++ b/include/linux/gpio-sch.h
@@ -0,0 +1,6 @@
+#ifndef _LINUX_GPIO_SCH_
+#define _LINUX_GPIO_SCH_
+
+void sch_gpio_resume_set_enable(unsigned gpio_num, int val);
+
+#endif /* _LINUX_GPIO_SCH_ */
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists