aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/stmpe-gpio.c5
-rw-r--r--include/linux/mfd/stmpe.h6
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpio/stmpe-gpio.c b/drivers/gpio/stmpe-gpio.c
index 4e1f1b9d5e67..65b996083918 100644
--- a/drivers/gpio/stmpe-gpio.c
+++ b/drivers/gpio/stmpe-gpio.c
@@ -30,6 +30,7 @@ struct stmpe_gpio {
30 struct mutex irq_lock; 30 struct mutex irq_lock;
31 31
32 int irq_base; 32 int irq_base;
33 unsigned norequest_mask;
33 34
34 /* Caches of interrupt control registers for bus_lock */ 35 /* Caches of interrupt control registers for bus_lock */
35 u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS]; 36 u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS];
@@ -103,6 +104,9 @@ static int stmpe_gpio_request(struct gpio_chip *chip, unsigned offset)
103 struct stmpe_gpio *stmpe_gpio = to_stmpe_gpio(chip); 104 struct stmpe_gpio *stmpe_gpio = to_stmpe_gpio(chip);
104 struct stmpe *stmpe = stmpe_gpio->stmpe; 105 struct stmpe *stmpe = stmpe_gpio->stmpe;
105 106
107 if (stmpe_gpio->norequest_mask & (1 << offset))
108 return -EINVAL;
109
106 return stmpe_set_altfunc(stmpe, 1 << offset, STMPE_BLOCK_GPIO); 110 return stmpe_set_altfunc(stmpe, 1 << offset, STMPE_BLOCK_GPIO);
107} 111}
108 112
@@ -302,6 +306,7 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev)
302 306
303 stmpe_gpio->dev = &pdev->dev; 307 stmpe_gpio->dev = &pdev->dev;
304 stmpe_gpio->stmpe = stmpe; 308 stmpe_gpio->stmpe = stmpe;
309 stmpe_gpio->norequest_mask = pdata ? pdata->norequest_mask : 0;
305 310
306 stmpe_gpio->chip = template_chip; 311 stmpe_gpio->chip = template_chip;
307 stmpe_gpio->chip.ngpio = stmpe->num_gpios; 312 stmpe_gpio->chip.ngpio = stmpe->num_gpios;
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 39ca7588659b..e762c270d8d4 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -112,13 +112,19 @@ struct stmpe_keypad_platform_data {
112 bool no_autorepeat; 112 bool no_autorepeat;
113}; 113};
114 114
115#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)
116
115/** 117/**
116 * struct stmpe_gpio_platform_data - STMPE GPIO platform data 118 * struct stmpe_gpio_platform_data - STMPE GPIO platform data
117 * @gpio_base: first gpio number assigned. A maximum of 119 * @gpio_base: first gpio number assigned. A maximum of
118 * %STMPE_NR_GPIOS GPIOs will be allocated. 120 * %STMPE_NR_GPIOS GPIOs will be allocated.
121 * @norequest_mask: bitmask specifying which GPIOs should _not_ be
122 * requestable due to different usage (e.g. touch, keypad)
123 * STMPE_GPIO_NOREQ_* macros can be used here.
119 */ 124 */
120struct stmpe_gpio_platform_data { 125struct stmpe_gpio_platform_data {
121 int gpio_base; 126 int gpio_base;
127 unsigned norequest_mask;
122 void (*setup)(struct stmpe *stmpe, unsigned gpio_base); 128 void (*setup)(struct stmpe *stmpe, unsigned gpio_base);
123 void (*remove)(struct stmpe *stmpe, unsigned gpio_base); 129 void (*remove)(struct stmpe *stmpe, unsigned gpio_base);
124}; 130};