Skip to contentSkip to conversation

Add btgpio driver

PATCH In review Michael Buesch 5 participants 7 messages Jul 1, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add btgpio driver

This adds the btgpio driver.
The purpose of the btgpio driver is to export all of the 24 GPIO pins available on Brooktree 8xx chips to the kernel GPIO infrastructure.

This makes it possible to use a physically modified BT8xx card as cheap digital GPIO card.

---

Andrew, can we queue this for inclusion into 2.6.27?
I'm not sure how linux-next works, yet. My favourite web search engine also didn't find anything useful on how to submit stuff for linux-next. What are the gateway people and mailinglists for linux-next?

A patch adding a Documentation/ file with some hardware descriptions will follow this one (once I got to write it :)

I could not find a GPIO maintainer. Neither in the MAINTAINERS file nor in any GPIO source file. So I didn't CC any GPIO guy, as I don't know who that is. :)

drivers/gpio/Kconfig +18 -0
Index: linux-2.6/drivers/gpio/Kconfig
===================================================================
@@ -61,6 +61,24 @@ config GPIO_PCF857X
 	  This driver provides an in-kernel interface to those GPIOs using
 	  platform-neutral GPIO calls.
 
+comment "PCI GPIO expanders:"
+
+config GPIO_BT8XX
+	tristate "BT8XX GPIO abuser"
+	depends on PCI && VIDEO_BT848=n
+	help
+	  The BT8xx frame grabber chip has 24 GPIO pins than can be abused
+	  as a cheap PCI GPIO card.
+
+	  This chip can be found on Miro, Hauppauge and STB TV-cards.
+
+	  The card needs to be physically altered for using it as a
+	  GPIO card. For more information on how to build a GPIO card
+	  from a BT8xx TV card, see the following link:
+	  http://bu3sch.de/btgpio.php
+
+	  If unsure, say N.
+
 comment "SPI GPIO expanders:"
 
 config GPIO_MCP23S08
drivers/gpio/Makefile +1 -0
Index: linux-2.6/drivers/gpio/Makefile
===================================================================
@@ -7,3 +7,4 @@ obj-$(CONFIG_HAVE_GPIO_LIB)	+= gpiolib.o
 obj-$(CONFIG_GPIO_MCP23S08)	+= mcp23s08.o
 obj-$(CONFIG_GPIO_PCA953X)	+= pca953x.o
 obj-$(CONFIG_GPIO_PCF857X)	+= pcf857x.o
+obj-$(CONFIG_GPIO_BT8XX)	+= btgpio.o
drivers/gpio/btgpio.c new file +346 -0

346 lines not on this page · raw message

MAINTAINERS +6 -0
Index: linux-2.6/MAINTAINERS
===================================================================
@@ -1012,6 +1012,12 @@ M:	[email protected]
 L:	[email protected]
 S:	Supported
 
+BT8XX GPIO DRIVER (BTGPIO)
+P:	Michael Buesch
+M:	[email protected]
+W:	http://bu3sch.de/btgpio.php
+S:	Maintained
+
 BTTV VIDEO4LINUX DRIVER
 P:	Mauro Carvalho Chehab
 M:	[email protected]
Signature · 1 line
Greetings Michael.
#1 lore raw
Quoted 8 lines · Michael Buesch

This adds the btgpio driver.
The purpose of the btgpio driver is to export all of the 24 GPIO pins available on Brooktree 8xx chips to the kernel GPIO infrastructure.

This makes it possible to use a physically modified BT8xx card as cheap digital GPIO card.

How one is supposed to test this driver? I am unable to switch on the GIPO lib support in my config. I tried also allyesconfig but no trace of gpio lib stuff.

thanks,
Domenico

-----[ Domenico Andreoli, aka cavok
--[ http://www.dandreoli.com/gpgkey.asc
---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50

#2 lore raw
Quoted 5 lines · Domenico Andreoli
Quoted 4 lines · Michael Buesch

This adds the btgpio driver.
The purpose of the btgpio driver is to export all of the 24 GPIO pins available on Brooktree 8xx chips to the kernel GPIO infrastructure.

Quoted 8 lines
Quoted 4 lines

This makes it possible to use a physically modified BT8xx card as cheap digital GPIO card.

How one is supposed to test this driver? I am unable to switch on the GIPO lib support in my config. I tried also allyesconfig but no trace of gpio lib stuff.

Really, GPIO menu is no present anywhere. While searching for GPIO finds stuff, I am unable to locate and select it. I am using 2.6.26-rc8.

regards,
Domenico

-----[ Domenico Andreoli, aka cavok
--[ http://www.dandreoli.com/gpgkey.asc
---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50

#3 lore raw
Quoted 9 lines · Domenico Andreoli
Quoted 8 lines · Domenico Andreoli
Quoted 7 lines · Michael Buesch

This adds the btgpio driver.
The purpose of the btgpio driver is to export all of the 24 GPIO pins available on Brooktree 8xx chips to the kernel GPIO infrastructure.

This makes it possible to use a physically modified BT8xx card as cheap digital GPIO card.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

How one is supposed to test this driver? I am unable to switch on the GIPO lib support in my config. I tried also allyesconfig but no trace of gpio lib stuff.

Really, GPIO menu is no present anywhere. While searching for GPIO finds stuff, I am unable to locate and select it. I am using 2.6.26-rc8.

For what $ARCH? GPIO menu says this:

config HAVE_GPIO_LIB
bool
help
Platforms select gpiolib if they use this infrastructure for all their GPIOs, usually starting with ones integrated into SOC processors.

and then the arch-es that select HAVE_GPIO_LIB are these:

./arch/powerpc/platforms/52xx/Kconfig:50: select HAVE_GPIO_LIB

./arch/mips/Kconfig:803:        select HAVE_GPIO_LIB
./arch/avr32/Kconfig:90:        select HAVE_GPIO_LIB
./arch/avr32/Kconfig.orig:85:   select HAVE_GPIO_LIB

./arch/arm/Kconfig:257: select HAVE_GPIO_LIB
./arch/arm/Kconfig:396: select HAVE_GPIO_LIB
./arch/arm/Kconfig:426: select HAVE_GPIO_LIB
./arch/arm/Kconfig:466: select HAVE_GPIO_LIB
./arch/arm/Kconfig.orig:401: select HAVE_GPIO_LIB

so are you using one of those arches?

Signature · 1 line
~Randy
#4 lore raw
Quoted 35 lines · Randy.Dunlap
Quoted 9 lines · Domenico Andreoli
Quoted 8 lines · Domenico Andreoli
Quoted 7 lines · Michael Buesch

This adds the btgpio driver.
The purpose of the btgpio driver is to export all of the 24 GPIO pins available on Brooktree 8xx chips to the kernel GPIO infrastructure.

This makes it possible to use a physically modified BT8xx card as cheap digital GPIO card.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

How one is supposed to test this driver? I am unable to switch on the GIPO lib support in my config. I tried also allyesconfig but no trace of gpio lib stuff.

Really, GPIO menu is no present anywhere. While searching for GPIO finds stuff, I am unable to locate and select it. I am using 2.6.26-rc8.

For what $ARCH? GPIO menu says this:

config HAVE_GPIO_LIB
bool
help
Platforms select gpiolib if they use this infrastructure for all their GPIOs, usually starting with ones integrated into SOC processors.

and then the arch-es that select HAVE_GPIO_LIB are these:

./arch/powerpc/platforms/52xx/Kconfig:50: select HAVE_GPIO_LIB

./arch/mips/Kconfig:803:        select HAVE_GPIO_LIB
./arch/avr32/Kconfig:90:        select HAVE_GPIO_LIB
./arch/avr32/Kconfig.orig:85:   select HAVE_GPIO_LIB
Quoted 7 lines

./arch/arm/Kconfig:257: select HAVE_GPIO_LIB
./arch/arm/Kconfig:396: select HAVE_GPIO_LIB
./arch/arm/Kconfig:426: select HAVE_GPIO_LIB
./arch/arm/Kconfig:466: select HAVE_GPIO_LIB
./arch/arm/Kconfig.orig:401: select HAVE_GPIO_LIB

so are you using one of those arches?

ah.. this explains, i am using x86_64. my Kconfig-foo is still too young.

thanks,
Domenico

-----[ Domenico Andreoli, aka cavok
--[ http://www.dandreoli.com/gpgkey.asc
---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50

#5 lore raw
In reply to Domenico Andreoli
Quoted 7 lines · Domenico Andreoli
Quoted 4 lines

How one is supposed to test this driver? I am unable to switch on the GPIO lib support in my config. I tried also allyesconfig but no trace of gpio lib stuff.

Really, GPIO menu is no present anywhere. While searching for GPIO finds stuff, I am unable to locate and select it. I am using 2.6.26-rc8

Appended is what I use on x86 PCs. It's not quite suitable for merge as-is since there's some x86 system with a nonstandard setup.

- Dave

====== CUT HERE
DEBUG ONLY -- make X86_PC use gpiolib.

It's not clear to me how the various x86-ish platforms should be made to work here, since there seems to be no convention that each platform type has its own <asm/arch/...> subdir.

---
 arch/x86/Kconfig       |    2 ++
 include/asm-x86/gpio.h |   20 +++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
arch/x86/Kconfig +2 -0
@@ -236,6 +236,8 @@ choice
 
 config X86_PC
 	bool "PC-compatible"
+	select GENERIC_GPIO
+	select HAVE_GPIO_LIB
 	help
 	  Choose this option if your computer is a standard PC or compatible.
 
include/asm-x86/gpio.h +19 -1
@@ -1,6 +1,24 @@
 #ifndef _ASM_I386_GPIO_H
 #define _ASM_I386_GPIO_H
 
-#include <gpio.h>
+// #include <gpio.h>
+
+#include <linux/errno.h>
+#include <asm-generic/gpio.h>           /* cansleep wrappers */
+
+#define gpio_get_value	__gpio_get_value
+#define gpio_set_value	__gpio_set_value
+#define gpio_cansleep	__gpio_cansleep
+
+static inline int gpio_to_irq(unsigned gpio)
+{
+	return -ENOSYS;
+}
+
+static inline int irq_to_gpio(unsigned irq)
+{
+	return -EINVAL;
+}
+
 
 #endif /* _ASM_I386_GPIO_H */
#6 lore raw
In reply to Michael Buesch

Hi Michael,

Quoted 6 lines

This adds the btgpio driver.
The purpose of the btgpio driver is to export all of the 24 GPIO pins available on Brooktree 8xx chips to the kernel GPIO infrastructure.

This makes it possible to use a physically modified BT8xx card as cheap digital GPIO card.

do you mind calling the driver bt8xxgpio. I am a little bit worried that we otherwise clash with a potential Bluetooth GPIO driver at some point. The new generation of generic Bluetooth drivers are using bt* as names (like btsdio, btusb etc.).

Regards

Marcel