Skip to contentSkip to conversation

XRA1403,gpio - add XRA1403 gpio expander driver

PATCH In review Nandor Han 2 participants 5 messages May 15, 2017 – May 22, 2017 GPIO

lore
Share & tools
lore

Nandor Han

author
#0 lore raw

v3 cover XRA1403,gpio - add XRA1403 gpio expander driver

The patchset will add a driver to support basic functionality for XRA1403 device. Features supported:
- get/set GPIO direction (input, output)
- get/set GPIO level (low, high)

Documentation: A gpio-xra1403.txt file was added to document the DTS
bindings related to driver.

Testing:

1.1 XRA1403 connected to iMX53 MCU
1.2 Use the GPIO tools provided by kernel from tools/gpio dir

2.1 lsgpio

root@csmon ppd:~# lsgpio
GPIO chip: gpiochip8, "xra1403", 16 GPIO lines

        line  0: unnamed unused [output]
        line  1: unnamed unused [output]
        line  2: unnamed unused [output]
        line  3: unnamed unused [output]
        line  4: unnamed unused [output]
        line  5: unnamed unused
        line  6: unnamed unused
        line  7: unnamed unused [output]
        line  8: unnamed unused [output]
        line  9: unnamed unused

line 10: unnamed unused [output]
line 11: unnamed unused
line 12: unnamed unused
line 13: unnamed unused
line 14: unnamed unused
line 15: unnamed unused [output]
GPIO chip: gpiochip7, "xra1403", 16 GPIO lines

        line  0: unnamed unused
        line  1: unnamed unused
        line  2: unnamed unused
        line  3: unnamed unused
        line  4: unnamed unused
        line  5: unnamed unused
        line  6: unnamed unused
        line  7: unnamed unused
        line  8: unnamed unused
        line  9: unnamed unused

line 10: unnamed unused
line 11: unnamed unused
line 12: unnamed unused
line 13: unnamed unused
line 14: unnamed unused
line 15: unnamed unused

3.1 gpio-hammer

root@csmon ppd:~# gpio-hammer -n gpiochip8 -o0 -o1 -o2 -o3 Hammer lines [0, 1, 2, 3] on gpiochip8, initial states: [0, 0, 0, 0] [\] [0: 0, 1: 0, 2: 0, 3: 0]
...
[\] [0: 1, 1: 1, 2: 1, 3: 1]

When using gpio-hammer I also attached an oscilloscope to one of the pins and I was able to monitor and validate the GPIO status.

Changes since v2: - improve the commit message by removing the "sysfs"
dependency and be more clear.
- include "seq_file.h" header.
Note: documentation patches were accepted already.

Changes since v1: - use regmap for driver
- small changes to documentation

Nandor Han (2):
gpio - Add EXAR XRA1403 SPI GPIO expander driver Add XRA1403 support to MAINTAINERS file

 MAINTAINERS                 |   8 ++
 drivers/gpio/Kconfig        |   5 +
 drivers/gpio/Makefile       |   1 +
 drivers/gpio/gpio-xra1403.c | 237 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 251 insertions(+)
 create mode 100644 drivers/gpio/gpio-xra1403.c
Signature · 1 line
2.10.1
author
#1 lore raw

PATCH v3 1/2 gpio - Add EXAR XRA1403 SPI GPIO expander driver

This driver support basic XRA1403 functionalities:
- set gpio direction
- get gpio direction
- set gpio high/low
- get gpio status

---
 drivers/gpio/Kconfig        |   5 +
 drivers/gpio/Makefile       |   1 +
 drivers/gpio/gpio-xra1403.c | 237 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 243 insertions(+)
 create mode 100644 drivers/gpio/gpio-xra1403.c
drivers/gpio/Kconfig +5 -0
index 23ca51e..dbde3ae 100644
@@ -1225,6 +1225,11 @@ config GPIO_PISOSR
 	  GPIO driver for SPI compatible parallel-in/serial-out shift
 	  registers. These are input only devices.
 
+config GPIO_XRA1403
+	tristate "EXAR XRA1403 16-bit GPIO expander"
+	help
+	  GPIO driver for EXAR XRA1403 16-bit SPI-based GPIO expander.
+
 endmenu
 
 menu "SPI or I2C GPIO expanders"
drivers/gpio/Makefile +1 -0
index 68b9627..4d9adc6 100644
@@ -141,6 +141,7 @@ obj-$(CONFIG_GPIO_XGENE)	+= gpio-xgene.o
 obj-$(CONFIG_GPIO_XGENE_SB)	+= gpio-xgene-sb.o
 obj-$(CONFIG_GPIO_XILINX)	+= gpio-xilinx.o
 obj-$(CONFIG_GPIO_XLP)		+= gpio-xlp.o
+obj-$(CONFIG_GPIO_XRA1403)	+= gpio-xra1403.o
 obj-$(CONFIG_GPIO_XTENSA)	+= gpio-xtensa.o
 obj-$(CONFIG_GPIO_ZEVIO)	+= gpio-zevio.o
 obj-$(CONFIG_GPIO_ZYNQ)		+= gpio-zynq.o
drivers/gpio/gpio-xra1403.c new file +237 -0

237 lines not on this page · raw message

Signature · 6 lines
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#3 lore raw

PATCH v3 2/2 Add XRA1403 support to MAINTAINERS file

In reply to Nandor Han

Add XRA1403 support to MAINTAINERS list.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index f9deb67..db86335 100644
@@ -14078,6 +14078,14 @@ L:	[email protected]
 S:	Supported
 F:	drivers/char/xillybus/
 
+XRA1403 GPIO EXPANDER
+M:	Nandor Han <[email protected]>
+M:	Semi Malinen <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/gpio/gpio-xra1403.c
+F:	Documentation/devicetree/bindings/gpio/gpio-xra1403.txt
+
 XTENSA XTFPGA PLATFORM SUPPORT
 M:	Max Filippov <[email protected]>
 L:	linux-xtensa-PjhNF2WwrV/[email protected]
Signature · 6 lines
2.10.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

Re: [PATCH v3 2/2] Add XRA1403 support to MAINTAINERS file

Quoted 3 lines · Nandor Han

Add XRA1403 support to MAINTAINERS list.

Patch applied for kernel v4.13.

Yours,
Linus Walleij