gpio: adp5588-gpio: support interrupt controller

Implement irq_chip functionality on ADP5588/5587 GPIO expanders.  Only
level sensitive interrupts are supported.  Interrupts provided by this
irq_chip must be requested using request_threaded_irq().

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Michael Hennerich
2010-10-27 15:33:19 -07:00
committed by Linus Torvalds
parent ead6db0843
commit 459773ae8d
3 changed files with 278 additions and 21 deletions

View File

@@ -74,6 +74,20 @@
#define ADP5588_DEVICE_ID_MASK 0xF
/* Configuration Register1 */
#define ADP5588_AUTO_INC (1 << 7)
#define ADP5588_GPIEM_CFG (1 << 6)
#define ADP5588_INT_CFG (1 << 4)
#define ADP5588_GPI_IEN (1 << 1)
/* Interrupt Status Register */
#define ADP5588_GPI_INT (1 << 1)
#define ADP5588_KE_INT (1 << 0)
#define ADP5588_MAXGPIO 18
#define ADP5588_BANK(offs) ((offs) >> 3)
#define ADP5588_BIT(offs) (1u << ((offs) & 0x7))
/* Put one of these structures in i2c_board_info platform_data */
#define ADP5588_KEYMAPSIZE 80
@@ -128,6 +142,7 @@ struct adp5588_kpad_platform_data {
struct adp5588_gpio_platform_data {
unsigned gpio_start; /* GPIO Chip base # */
unsigned irq_base; /* interrupt base # */
unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
int (*setup)(struct i2c_client *client,
int gpio, unsigned ngpio,