Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 220574
b: refs/heads/master
c: b8e9cf0
h: refs/heads/master
v: v3
  • Loading branch information
Wolfram Sang authored and Samuel Ortiz committed Oct 28, 2010
1 parent 9af6e35 commit 7acc7cb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8c96aefbe79becf940d27cd8ad2c5aba48322162
refs/heads/master: b8e9cf0b28173fc25dae9f3ac44de6fc4e9fc385
5 changes: 5 additions & 0 deletions trunk/drivers/gpio/stmpe-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct stmpe_gpio {
struct mutex irq_lock;

int irq_base;
unsigned norequest_mask;

/* Caches of interrupt control registers for bus_lock */
u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS];
Expand Down Expand Up @@ -103,6 +104,9 @@ static int stmpe_gpio_request(struct gpio_chip *chip, unsigned offset)
struct stmpe_gpio *stmpe_gpio = to_stmpe_gpio(chip);
struct stmpe *stmpe = stmpe_gpio->stmpe;

if (stmpe_gpio->norequest_mask & (1 << offset))
return -EINVAL;

return stmpe_set_altfunc(stmpe, 1 << offset, STMPE_BLOCK_GPIO);
}

Expand Down Expand Up @@ -302,6 +306,7 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev)

stmpe_gpio->dev = &pdev->dev;
stmpe_gpio->stmpe = stmpe;
stmpe_gpio->norequest_mask = pdata ? pdata->norequest_mask : 0;

stmpe_gpio->chip = template_chip;
stmpe_gpio->chip.ngpio = stmpe->num_gpios;
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/linux/mfd/stmpe.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,19 @@ struct stmpe_keypad_platform_data {
bool no_autorepeat;
};

#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)

/**
* struct stmpe_gpio_platform_data - STMPE GPIO platform data
* @gpio_base: first gpio number assigned. A maximum of
* %STMPE_NR_GPIOS GPIOs will be allocated.
* @norequest_mask: bitmask specifying which GPIOs should _not_ be
* requestable due to different usage (e.g. touch, keypad)
* STMPE_GPIO_NOREQ_* macros can be used here.
*/
struct stmpe_gpio_platform_data {
int gpio_base;
unsigned norequest_mask;
void (*setup)(struct stmpe *stmpe, unsigned gpio_base);
void (*remove)(struct stmpe *stmpe, unsigned gpio_base);
};
Expand Down

0 comments on commit 7acc7cb

Please sign in to comment.