Commit f0a7a98d authored by Rabin Vincent's avatar Rabin Vincent Committed by Russell King

ARM: 6373/1: tc35892-gpio: add setup/remove callbacks

For board-specific initialization.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: linux-kernel@vger.kernel.org
Acked-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: default avatarRabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent f066439c
...@@ -322,6 +322,9 @@ static int __devinit tc35892_gpio_probe(struct platform_device *pdev) ...@@ -322,6 +322,9 @@ static int __devinit tc35892_gpio_probe(struct platform_device *pdev)
goto out_freeirq; goto out_freeirq;
} }
if (pdata->setup)
pdata->setup(tc35892, tc35892_gpio->chip.base);
platform_set_drvdata(pdev, tc35892_gpio); platform_set_drvdata(pdev, tc35892_gpio);
return 0; return 0;
...@@ -338,9 +341,14 @@ static int __devinit tc35892_gpio_probe(struct platform_device *pdev) ...@@ -338,9 +341,14 @@ static int __devinit tc35892_gpio_probe(struct platform_device *pdev)
static int __devexit tc35892_gpio_remove(struct platform_device *pdev) static int __devexit tc35892_gpio_remove(struct platform_device *pdev)
{ {
struct tc35892_gpio *tc35892_gpio = platform_get_drvdata(pdev); struct tc35892_gpio *tc35892_gpio = platform_get_drvdata(pdev);
struct tc35892 *tc35892 = tc35892_gpio->tc35892;
struct tc35892_gpio_platform_data *pdata = tc35892->pdata->gpio;
int irq = platform_get_irq(pdev, 0); int irq = platform_get_irq(pdev, 0);
int ret; int ret;
if (pdata->remove)
pdata->remove(tc35892, tc35892_gpio->chip.base);
ret = gpiochip_remove(&tc35892_gpio->chip); ret = gpiochip_remove(&tc35892_gpio->chip);
if (ret < 0) { if (ret < 0) {
dev_err(tc35892_gpio->dev, dev_err(tc35892_gpio->dev,
......
...@@ -111,9 +111,13 @@ extern int tc35892_set_bits(struct tc35892 *tc35892, u8 reg, u8 mask, u8 val); ...@@ -111,9 +111,13 @@ extern int tc35892_set_bits(struct tc35892 *tc35892, u8 reg, u8 mask, u8 val);
* struct tc35892_gpio_platform_data - TC35892 GPIO platform data * struct tc35892_gpio_platform_data - TC35892 GPIO platform data
* @gpio_base: first gpio number assigned to TC35892. A maximum of * @gpio_base: first gpio number assigned to TC35892. A maximum of
* %TC35892_NR_GPIOS GPIOs will be allocated. * %TC35892_NR_GPIOS GPIOs will be allocated.
* @setup: callback for board-specific initialization
* @remove: callback for board-specific teardown
*/ */
struct tc35892_gpio_platform_data { struct tc35892_gpio_platform_data {
int gpio_base; int gpio_base;
void (*setup)(struct tc35892 *tc35892, unsigned gpio_base);
void (*remove)(struct tc35892 *tc35892, unsigned gpio_base);
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment