Skip to content

Commit

Permalink
gpio: stmpe: enforce device tree only mode
Browse files Browse the repository at this point in the history
Require that device tree be used with STMPE (all platforms use this)
and enforce OF_GPIO, then delete the platform data.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Linus Walleij committed Jan 20, 2015
1 parent ee65ef6 commit 1dfb4a0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
1 change: 1 addition & 0 deletions drivers/gpio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ config GPIO_SX150X
config GPIO_STMPE
bool "STMPE GPIOs"
depends on MFD_STMPE
depends on OF_GPIO
select GPIOLIB_IRQCHIP
help
This enables support for the GPIOs found on the STMPE I/O
Expand Down
23 changes: 3 additions & 20 deletions drivers/gpio/gpio-stmpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct stmpe_gpio {
struct stmpe *stmpe;
struct device *dev;
struct mutex irq_lock;
unsigned norequest_mask;
u32 norequest_mask;
/* Caches of interrupt control registers for bus_lock */
u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS];
u8 oldregs[CACHE_NR_REGS][CACHE_NR_BANKS];
Expand Down Expand Up @@ -340,13 +340,10 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
{
struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent);
struct device_node *np = pdev->dev.of_node;
struct stmpe_gpio_platform_data *pdata;
struct stmpe_gpio *stmpe_gpio;
int ret;
int irq = 0;

pdata = stmpe->pdata->gpio;

irq = platform_get_irq(pdev, 0);

stmpe_gpio = kzalloc(sizeof(struct stmpe_gpio), GFP_KERNEL);
Expand All @@ -360,19 +357,14 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
stmpe_gpio->chip = template_chip;
stmpe_gpio->chip.ngpio = stmpe->num_gpios;
stmpe_gpio->chip.dev = &pdev->dev;
#ifdef CONFIG_OF
stmpe_gpio->chip.of_node = np;
#endif
stmpe_gpio->chip.base = -1;

if (IS_ENABLED(CONFIG_DEBUG_FS))
stmpe_gpio->chip.dbg_show = stmpe_dbg_show;

if (pdata)
stmpe_gpio->norequest_mask = pdata->norequest_mask;
else if (np)
of_property_read_u32(np, "st,norequest-mask",
&stmpe_gpio->norequest_mask);
of_property_read_u32(np, "st,norequest-mask",
&stmpe_gpio->norequest_mask);

if (irq < 0)
dev_info(&pdev->dev,
Expand Down Expand Up @@ -414,9 +406,6 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
NULL);
}

if (pdata && pdata->setup)
pdata->setup(stmpe, stmpe_gpio->chip.base);

platform_set_drvdata(pdev, stmpe_gpio);

return 0;
Expand All @@ -433,15 +422,9 @@ static int stmpe_gpio_remove(struct platform_device *pdev)
{
struct stmpe_gpio *stmpe_gpio = platform_get_drvdata(pdev);
struct stmpe *stmpe = stmpe_gpio->stmpe;
struct stmpe_gpio_platform_data *pdata = stmpe->pdata->gpio;

if (pdata && pdata->remove)
pdata->remove(stmpe, stmpe_gpio->chip.base);

gpiochip_remove(&stmpe_gpio->chip);

stmpe_disable(stmpe, STMPE_BLOCK_GPIO);

kfree(stmpe_gpio);

return 0;
Expand Down
16 changes: 0 additions & 16 deletions include/linux/mfd/stmpe.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,6 @@ extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);

#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)

/**
* struct stmpe_gpio_platform_data - STMPE GPIO platform data
* @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.
* @setup: board specific setup callback.
* @remove: board specific remove callback
*/
struct stmpe_gpio_platform_data {
unsigned norequest_mask;
void (*setup)(struct stmpe *stmpe, unsigned gpio_base);
void (*remove)(struct stmpe *stmpe, unsigned gpio_base);
};

/**
* struct stmpe_ts_platform_data - stmpe811 touch screen controller platform
* data
Expand Down Expand Up @@ -182,7 +168,6 @@ struct stmpe_ts_platform_data {
* @irq_over_gpio: true if gpio is used to get irq
* @irq_gpio: gpio number over which irq will be requested (significant only if
* irq_over_gpio is true)
* @gpio: GPIO-specific platform data
* @ts: touchscreen-specific platform data
*/
struct stmpe_platform_data {
Expand All @@ -194,7 +179,6 @@ struct stmpe_platform_data {
int irq_gpio;
int autosleep_timeout;

struct stmpe_gpio_platform_data *gpio;
struct stmpe_ts_platform_data *ts;
};

Expand Down

0 comments on commit 1dfb4a0

Please sign in to comment.