basic_mmio_gpio: Add hook for simple debounce register

From: H Hartley Sweeten
Date: Wed Nov 16 2011 - 14:02:55 EST


Some platforms using the basic memory-mapped GPIO library have
simple input debounce support that is enabled/disabled, per-input,
by setting/clearing bits in a control register. Add a hook in the
bgpio_chip structure to hold the void __iomem * for this register.

This register, and the gc.set_debounce callback should set by the
platform after calling bgpio_init() and before calling gpiochip_add().

...
err = bgpio_chip(bgc, ...);
if (err)
return err;

bgc->reg_db = platform_debounce_reg;
bgc->gc.set_debounce = platform_set_debounce_func;

return gpiochip_add(&bgc->gc);
}

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Grant Likely <grant.likely@xxxxxxxxxxxx>
Cc: Jamie Iles <jamie@xxxxxxxxxxxxx>
Cc: Anton Vorontsov <cbouatmailru@xxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
CC: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>

---

diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
index feb91219..9bec937 100644
--- a/include/linux/basic_mmio_gpio.h
+++ b/include/linux/basic_mmio_gpio.h
@@ -35,6 +35,7 @@ struct bgpio_chip {
void __iomem *reg_set;
void __iomem *reg_clr;
void __iomem *reg_dir;
+ void __iomem *reg_db;

/* Number of bits (GPIOs): <register width> * 8. */
int bits;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/