Skip to contentSkip to conversation

gpiolib: Add support for Wolfson Microelectronics Arizona class devices

PATCH Applied Mark Brown 2 participants 5 messages Jun 23, 2012 – Jul 5, 2012

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 gpiolib: Add support for Wolfson Microelectronics Arizona class devices

The Arizona class devices provide some GPIOs for use in the system. This driver provides support for these via gpiolib. Currently interrupts are not supported, normally the GPIOs are outputs only.

---
 drivers/gpio/Kconfig        |    6 ++
 drivers/gpio/Makefile       |    1 +
 drivers/gpio/gpio-arizona.c |  162 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 169 insertions(+)
 create mode 100644 drivers/gpio/gpio-arizona.c
drivers/gpio/Kconfig +6 -0
index c4067d0..9c713e9 100644
@@ -253,6 +253,12 @@ config GPIO_GE_FPGA
 
 comment "I2C GPIO expanders:"
 
+config GPIO_ARIZONA
+	tristate "Wolfson Microelectronics Arizona class devices"
+	depends on MFD_ARIZONA
+	help
+	  Support for GPIOs on Wolfson Arizona class devices.
+
 config GPIO_MAX7300
 	tristate "Maxim MAX7300 GPIO expander"
 	depends on I2C
drivers/gpio/Makefile +1 -0
index 0f55662..e173970 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_GPIO_74X164)	+= gpio-74x164.o
 obj-$(CONFIG_GPIO_AB8500)	+= gpio-ab8500.o
 obj-$(CONFIG_GPIO_ADP5520)	+= gpio-adp5520.o
 obj-$(CONFIG_GPIO_ADP5588)	+= gpio-adp5588.o
+obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
 obj-$(CONFIG_GPIO_BT8XX)	+= gpio-bt8xx.o
 obj-$(CONFIG_GPIO_CS5535)	+= gpio-cs5535.o
 obj-$(CONFIG_GPIO_DA9052)	+= gpio-da9052.o
drivers/gpio/gpio-arizona.c new file +162 -0

162 lines not on this page · raw message

Signature · 1 line
1.7.10
Acked-by on v1 1/1
#1 lore raw

On Sat, Jun 23, 2012 at 8:29 PM, Mark Brown
<[email protected]> wrote:

I'm uncertain when it comes to the semantics of these babies, and can't really tell what's going on:

Quoted 2 lines

+       return regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
+                                 ARIZONA_GPN_DIR, ARIZONA_GPN_DIR);

(...)

Quoted 2 lines

+       return regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
+                                 ARIZONA_GPN_DIR | ARIZONA_GPN_LVL, value);

(...)

Quoted 2 lines

+       regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
+                          ARIZONA_GPN_LVL, value);

I'm guessing that regmap is caching, selectively updating volatile regs and marshalling the writes in the background.

The rest looks simple and flawless, and of course I trust that you're doing the right thing with regmap anyway so:

Yours,
Linus Walleij

author
#2 lore raw
Quoted 7 lines · Linus Walleij

On Sat, Jun 23, 2012 at 8:29 PM, Mark Brown

Quoted 2 lines

+       regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
+                          ARIZONA_GPN_LVL, value);

I'm guessing that regmap is caching, selectively updating volatile regs and marshalling the writes in the background.

It's just the standard read/modify/write operation (the same as you've got for ab8500 IIRC). As far as the immediate user is concerned it's just doing the I/O, the API will work with cache or the hardware depending on how the chip register map is configured.

author
#3 lore raw
In reply to Linus Walleij
Quoted 2 lines · Linus Walleij
Quoted 2 lines

+       regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset,
+                          ARIZONA_GPN_LVL, value);

I should also have said that's (map, register, mask, value) which updates the bits specified by mask in register to value.

#4 lore raw
In reply to Mark Brown
Quoted 5 lines · Mark Brown

The Arizona class devices provide some GPIOs for use in the system. This driver provides support for these via gpiolib. Currently interrupts are not supported, normally the GPIOs are outputs only.

Applied.

Thanks,
Linus Walleij