aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/Kconfig1
-rw-r--r--drivers/gpio/gpio-stmpe.c23
-rw-r--r--include/linux/mfd/stmpe.h16
3 files changed, 4 insertions, 36 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 4187fcbc88fd..22b46567b3bb 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -644,6 +644,7 @@ config GPIO_SX150X
644config GPIO_STMPE 644config GPIO_STMPE
645 bool "STMPE GPIOs" 645 bool "STMPE GPIOs"
646 depends on MFD_STMPE 646 depends on MFD_STMPE
647 depends on OF_GPIO
647 select GPIOLIB_IRQCHIP 648 select GPIOLIB_IRQCHIP
648 help 649 help
649 This enables support for the GPIOs found on the STMPE I/O 650 This enables support for the GPIOs found on the STMPE I/O
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index 85c5b1974294..dabfb99dddef 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -30,7 +30,7 @@ struct stmpe_gpio {
30 struct stmpe *stmpe; 30 struct stmpe *stmpe;
31 struct device *dev; 31 struct device *dev;
32 struct mutex irq_lock; 32 struct mutex irq_lock;
33 unsigned norequest_mask; 33 u32 norequest_mask;
34 /* Caches of interrupt control registers for bus_lock */ 34 /* Caches of interrupt control registers for bus_lock */
35 u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS]; 35 u8 regs[CACHE_NR_REGS][CACHE_NR_BANKS];
36 u8 oldregs[CACHE_NR_REGS][CACHE_NR_BANKS]; 36 u8 oldregs[CACHE_NR_REGS][CACHE_NR_BANKS];
@@ -340,13 +340,10 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
340{ 340{
341 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); 341 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent);
342 struct device_node *np = pdev->dev.of_node; 342 struct device_node *np = pdev->dev.of_node;
343 struct stmpe_gpio_platform_data *pdata;
344 struct stmpe_gpio *stmpe_gpio; 343 struct stmpe_gpio *stmpe_gpio;
345 int ret; 344 int ret;
346 int irq = 0; 345 int irq = 0;
347 346
348 pdata = stmpe->pdata->gpio;
349
350 irq = platform_get_irq(pdev, 0); 347 irq = platform_get_irq(pdev, 0);
351 348
352 stmpe_gpio = kzalloc(sizeof(struct stmpe_gpio), GFP_KERNEL); 349 stmpe_gpio = kzalloc(sizeof(struct stmpe_gpio), GFP_KERNEL);
@@ -360,19 +357,14 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
360 stmpe_gpio->chip = template_chip; 357 stmpe_gpio->chip = template_chip;
361 stmpe_gpio->chip.ngpio = stmpe->num_gpios; 358 stmpe_gpio->chip.ngpio = stmpe->num_gpios;
362 stmpe_gpio->chip.dev = &pdev->dev; 359 stmpe_gpio->chip.dev = &pdev->dev;
363#ifdef CONFIG_OF
364 stmpe_gpio->chip.of_node = np; 360 stmpe_gpio->chip.of_node = np;
365#endif
366 stmpe_gpio->chip.base = -1; 361 stmpe_gpio->chip.base = -1;
367 362
368 if (IS_ENABLED(CONFIG_DEBUG_FS)) 363 if (IS_ENABLED(CONFIG_DEBUG_FS))
369 stmpe_gpio->chip.dbg_show = stmpe_dbg_show; 364 stmpe_gpio->chip.dbg_show = stmpe_dbg_show;
370 365
371 if (pdata) 366 of_property_read_u32(np, "st,norequest-mask",
372 stmpe_gpio->norequest_mask = pdata->norequest_mask; 367 &stmpe_gpio->norequest_mask);
373 else if (np)
374 of_property_read_u32(np, "st,norequest-mask",
375 &stmpe_gpio->norequest_mask);
376 368
377 if (irq < 0) 369 if (irq < 0)
378 dev_info(&pdev->dev, 370 dev_info(&pdev->dev,
@@ -414,9 +406,6 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
414 NULL); 406 NULL);
415 } 407 }
416 408
417 if (pdata && pdata->setup)
418 pdata->setup(stmpe, stmpe_gpio->chip.base);
419
420 platform_set_drvdata(pdev, stmpe_gpio); 409 platform_set_drvdata(pdev, stmpe_gpio);
421 410
422 return 0; 411 return 0;
@@ -433,15 +422,9 @@ static int stmpe_gpio_remove(struct platform_device *pdev)
433{ 422{
434 struct stmpe_gpio *stmpe_gpio = platform_get_drvdata(pdev); 423 struct stmpe_gpio *stmpe_gpio = platform_get_drvdata(pdev);
435 struct stmpe *stmpe = stmpe_gpio->stmpe; 424 struct stmpe *stmpe = stmpe_gpio->stmpe;
436 struct stmpe_gpio_platform_data *pdata = stmpe->pdata->gpio;
437
438 if (pdata && pdata->remove)
439 pdata->remove(stmpe, stmpe_gpio->chip.base);
440 425
441 gpiochip_remove(&stmpe_gpio->chip); 426 gpiochip_remove(&stmpe_gpio->chip);
442
443 stmpe_disable(stmpe, STMPE_BLOCK_GPIO); 427 stmpe_disable(stmpe, STMPE_BLOCK_GPIO);
444
445 kfree(stmpe_gpio); 428 kfree(stmpe_gpio);
446 429
447 return 0; 430 return 0;
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index f742b6717d52..c9d869027300 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -118,20 +118,6 @@ extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);
118#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0) 118#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)
119 119
120/** 120/**
121 * struct stmpe_gpio_platform_data - STMPE GPIO platform data
122 * @norequest_mask: bitmask specifying which GPIOs should _not_ be
123 * requestable due to different usage (e.g. touch, keypad)
124 * STMPE_GPIO_NOREQ_* macros can be used here.
125 * @setup: board specific setup callback.
126 * @remove: board specific remove callback
127 */
128struct stmpe_gpio_platform_data {
129 unsigned norequest_mask;
130 void (*setup)(struct stmpe *stmpe, unsigned gpio_base);
131 void (*remove)(struct stmpe *stmpe, unsigned gpio_base);
132};
133
134/**
135 * struct stmpe_ts_platform_data - stmpe811 touch screen controller platform 121 * struct stmpe_ts_platform_data - stmpe811 touch screen controller platform
136 * data 122 * data
137 * @sample_time: ADC converstion time in number of clock. 123 * @sample_time: ADC converstion time in number of clock.
@@ -182,7 +168,6 @@ struct stmpe_ts_platform_data {
182 * @irq_over_gpio: true if gpio is used to get irq 168 * @irq_over_gpio: true if gpio is used to get irq
183 * @irq_gpio: gpio number over which irq will be requested (significant only if 169 * @irq_gpio: gpio number over which irq will be requested (significant only if
184 * irq_over_gpio is true) 170 * irq_over_gpio is true)
185 * @gpio: GPIO-specific platform data
186 * @ts: touchscreen-specific platform data 171 * @ts: touchscreen-specific platform data
187 */ 172 */
188struct stmpe_platform_data { 173struct stmpe_platform_data {
@@ -194,7 +179,6 @@ struct stmpe_platform_data {
194 int irq_gpio; 179 int irq_gpio;
195 int autosleep_timeout; 180 int autosleep_timeout;
196 181
197 struct stmpe_gpio_platform_data *gpio;
198 struct stmpe_ts_platform_data *ts; 182 struct stmpe_ts_platform_data *ts;
199}; 183};
200 184