Skip to contentSkip to conversation

gpiolib: append SFI helpers for GPIO API

PATCH In review David Cohen 3 participants 6 messages Oct 17, 2013 – Nov 13, 2013 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: append SFI helpers for GPIO API

From: Andy Shevchenko <[email protected]>

To support some (legacy) firmwares and platforms let's make life easier for their customers.

Cc Kuppuswamy Sathyanarayanan <[email protected]>
Cc David Cohen <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Len Brown <[email protected]>
---
 drivers/gpio/Kconfig       |  4 +++
 drivers/gpio/Makefile      |  1 +
 drivers/gpio/gpiolib-sfi.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/sfi/sfi_core.c     |  7 +++++
 include/linux/sfi_gpio.h   | 27 ++++++++++++++++
 5 files changed, 115 insertions(+)
 create mode 100644 drivers/gpio/gpiolib-sfi.c
 create mode 100644 include/linux/sfi_gpio.h
drivers/gpio/Kconfig +4 -0
index 3471962..3fa2a0d 100644
@@ -51,6 +51,10 @@ config OF_GPIO
 	def_bool y
 	depends on OF
 
+config GPIO_SFI
+	def_bool y
+	depends on SFI
+
 config GPIO_ACPI
 	def_bool y
 	depends on ACPI
drivers/gpio/Makefile +1 -0
index f951866..d548ff3 100644
@@ -5,6 +5,7 @@ ccflags-$(CONFIG_DEBUG_GPIO)	+= -DDEBUG
 obj-$(CONFIG_GPIO_DEVRES)	+= devres.o
 obj-$(CONFIG_GPIOLIB)		+= gpiolib.o
 obj-$(CONFIG_OF_GPIO)		+= gpiolib-of.o
+obj-$(CONFIG_GPIO_SFI)		+= gpiolib-sfi.o
 obj-$(CONFIG_GPIO_ACPI)		+= gpiolib-acpi.o
 
 # Device drivers. Generally keep list sorted alphabetically
drivers/gpio/gpiolib-sfi.c new file +76 -0

76 lines not on this page · raw message

drivers/sfi/sfi_core.c +7 -0
index 296db7a..2828da0 100644
@@ -67,6 +67,7 @@
 #include <linux/acpi.h>
 #include <linux/init.h>
 #include <linux/sfi.h>
+#include <linux/sfi_gpio.h>
 #include <linux/slab.h>
 
 #include "sfi_core.h"
@@ -512,6 +513,12 @@ void __init sfi_init_late(void)
 	syst_va = sfi_map_memory(syst_pa, length);
 
 	sfi_acpi_init();
+
+	/*
+	 * Parsing GPIO table first, since the DEVS table will need this table
+	 * to map the pin name to the actual pin.
+	 */
+	sfi_gpio_init();
 }
 
 /*
include/linux/sfi_gpio.h new file +27 -0
new file mode 100644
index 0000000..ef7e497
@@ -0,0 +1,27 @@
+#ifndef _LINUX_SFI_GPIO_H_
+#define _LINUX_SFI_GPIO_H_
+
+#include <linux/errno.h>
+#include <linux/gpio.h>
+#include <linux/sfi.h>
+
+#ifdef CONFIG_GPIO_SFI
+
+int sfi_get_gpio_by_name(const char *name);
+int __init sfi_gpio_init(void);
+
+#else /* CONFIG_GPIO_SFI */
+
+static inline int sfi_get_gpio_by_name(const char *name);
+{
+	return -1;
+}
+
+static inline int __init sfi_gpio_init(void)
+{
+	return -ENODEV;
+}
+
+#endif /* CONFIG_GPIO_SFI */
+
+#endif /* _LINUX_SFI_GPIO_H_ */
Signature · 1 line
1.8.4.rc3
#1 lore raw
Quoted 7 lines · David Cohen

From: Andy Shevchenko <[email protected]>

To support some (legacy) firmwares and platforms let's make life easier for their customers.

drivers/gpio/gpiolib-sfi.c line 34

Quoted 7 lines
drivers/gpio/gpiolib-sfi.c new file +7 -0
+int sfi_get_gpio_by_name(const char *name)
+{
+	struct sfi_gpio_table_entry *pentry = sfi_gpio_table;
+	int i;
+
+	if (!pentry)
+		return -1;

^^^^ It seems an old version.

New version was published while ago and even has an ACK from Linus:

http://www.spinics.net/lists/kernel/msg1545960.html

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#2 lore raw
Quoted 18 lines · Andy Shevchenko
Quoted 7 lines · David Cohen

From: Andy Shevchenko <[email protected]>

To support some (legacy) firmwares and platforms let's make life easier for their customers.

drivers/gpio/gpiolib-sfi.c line 34

Quoted 7 lines
drivers/gpio/gpiolib-sfi.c new file +7 -0
+int sfi_get_gpio_by_name(const char *name)
+{
+	struct sfi_gpio_table_entry *pentry = sfi_gpio_table;
+	int i;
+
+	if (!pentry)
+		return -1;

^^^^ It seems an old version.

Quoted 3 lines

New version was published while ago and even has an ACK from Linus:

http://www.spinics.net/lists/kernel/msg1545960.html

Interesting :)
I got this patch cooking in our internal tree for quite some time. Didn't realize about the new version. I'm waiting it to be merged to send an Intel Mid patch that depends on that.

Please, ignore this version and consider the one pointed out by Andy.

Br, David Cohen

Quoted 2 lines
#3 lore raw
In reply to Andy Shevchenko
Quoted 16 lines · Andy Shevchenko

drivers/gpio/gpiolib-sfi.c line 34

Quoted 12 lines · David Cohen

From: Andy Shevchenko <[email protected]>

To support some (legacy) firmwares and platforms let's make life easier for their customers.

drivers/gpio/gpiolib-sfi.c new file +7 -0
+int sfi_get_gpio_by_name(const char *name)
+{
+     struct sfi_gpio_table_entry *pentry = sfi_gpio_table;
+     int i;
+
+     if (!pentry)
+             return -1;

^^^^ It seems an old version.

Quoted 3 lines

New version was published while ago and even has an ACK from Linus:

http://www.spinics.net/lists/kernel/msg1545960.html

So what is happening to this thing?

Is there some newer patch I should be merging?

Yours,
Linus Walleij

#4 lore raw
Quoted 18 lines · Linus Walleij
Quoted 16 lines · Andy Shevchenko

drivers/gpio/gpiolib-sfi.c line 34

Quoted 12 lines · David Cohen

From: Andy Shevchenko <[email protected]>

To support some (legacy) firmwares and platforms let's make life easier for their customers.

drivers/gpio/gpiolib-sfi.c new file +7 -0
+int sfi_get_gpio_by_name(const char *name)
+{
+     struct sfi_gpio_table_entry *pentry = sfi_gpio_table;
+     int i;
+
+     if (!pentry)
+             return -1;

^^^^ It seems an old version.

Quoted 5 lines
Quoted 3 lines

New version was published while ago and even has an ACK from Linus:

http://www.spinics.net/lists/kernel/msg1545960.html

So what is happening to this thing?

Actually David now coordinates work done for Medfield & Co. Perhaps he is not absent and could answer fast to this.

Quoted 1 line

Is there some newer patch I should be merging?

I'm pretty sure there is no newest version of patch.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#5 lore raw
Quoted 23 lines · Andy Shevchenko
Quoted 22 lines · Linus Walleij
Quoted 19 lines · Andy Shevchenko

drivers/gpio/gpiolib-sfi.c line 34

Quoted 12 lines · David Cohen

From: Andy Shevchenko <[email protected]>

To support some (legacy) firmwares and platforms let's make life easier for their customers.

drivers/gpio/gpiolib-sfi.c new file +7 -0
+int sfi_get_gpio_by_name(const char *name)
+{
+     struct sfi_gpio_table_entry *pentry = sfi_gpio_table;
+     int i;
+
+     if (!pentry)
+             return -1;

^^^^ It seems an old version.

New version was published while ago and even has an ACK from Linus:

http://www.spinics.net/lists/kernel/msg1545960.html

Quoted 8 lines
Quoted 1 line

So what is happening to this thing?

Actually David now coordinates work done for Medfield & Co. Perhaps he is not absent and could answer fast to this.

Quoted 1 line

Is there some newer patch I should be merging?

I'm pretty sure there is no newest version of patch.

Yeah, there is no newer version.
Linus, you're free to stick with the version pointed out by Andy on this thread:
http://www.spinics.net/lists/kernel/msg1545960.html

Br, David