diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-04-20 10:42:15 +0530 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 15:15:10 +0200 |
commit | 58746eed1d6fb0274fe51c5c7cefc122527869fa (patch) | |
tree | 5de234e99035a046fe1e6f1c847b96817008016a /drivers/input | |
parent | 844365a9efad10fccca7a92dd0106a14b11a30b8 (diff) |
input: ab8500-ponkey: make generic
Don't reference the AB8500 structure (which is anyway unused), and use an id
table to support different variants.
ST-Ericsson Linux next: -
ST-Ericsson ID: WP257121
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I3afc1f534c6f5c2b8aa2450eaef18cd0f638206c
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/21179
Reviewed-by: QATEST
Reviewed-by: Vijaya Kumar K-1 <vijay.kilari@stericsson.com>
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/misc/ab8500-ponkey.c | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c index 1cef5e670ca..445a9ad3eab 100644 --- a/drivers/input/misc/ab8500-ponkey.c +++ b/drivers/input/misc/ab8500-ponkey.c @@ -11,19 +11,26 @@ #include <linux/platform_device.h> #include <linux/input.h> #include <linux/interrupt.h> -#include <linux/mfd/ab8500.h> #include <linux/slab.h> +struct ab8500_ponkey_variant { + const char *irq_falling; + const char *irq_rising; +}; + +static const struct ab8500_ponkey_variant ab8500_ponkey = { + .irq_falling = "ONKEY_DBF", + .irq_rising = "ONKEY_DBR", +}; + /** * struct ab8500_ponkey_info - ab8500 ponkey information * @input_dev: pointer to input device - * @ab8500: ab8500 parent * @irq_dbf: irq number for falling transition * @irq_dbr: irq number for rising transition */ struct ab8500_ponkey_info { struct input_dev *idev; - struct ab8500 *ab8500; int irq_dbf; int irq_dbr; }; @@ -45,19 +52,24 @@ static irqreturn_t ab8500_ponkey_handler(int irq, void *data) static int __devinit ab8500_ponkey_probe(struct platform_device *pdev) { - struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); + const struct ab8500_ponkey_variant *variant; struct ab8500_ponkey_info *info; int irq_dbf, irq_dbr, ret; - irq_dbf = platform_get_irq_byname(pdev, "ONKEY_DBF"); + variant = (const struct ab8500_ponkey_variant *) + pdev->id_entry->driver_data; + + irq_dbf = platform_get_irq_byname(pdev, variant->irq_falling); if (irq_dbf < 0) { - dev_err(&pdev->dev, "No IRQ for ONKEY_DBF,error=%d\n", irq_dbf); + dev_err(&pdev->dev, "No IRQ for %s: %d\n", + variant->irq_falling, irq_dbf); return irq_dbf; } - irq_dbr = platform_get_irq_byname(pdev, "ONKEY_DBR"); + irq_dbr = platform_get_irq_byname(pdev, variant->irq_rising); if (irq_dbr < 0) { - dev_err(&pdev->dev, "No IRQ for ONKEY_DBR,error=%d\n", irq_dbr); + dev_err(&pdev->dev, "No IRQ for %s: %d\n", + variant->irq_rising, irq_dbr); return irq_dbr; } @@ -65,13 +77,12 @@ static int __devinit ab8500_ponkey_probe(struct platform_device *pdev) if (!info) return -ENOMEM; - info->ab8500 = ab8500; info->irq_dbf = irq_dbf; info->irq_dbr = irq_dbr; info->idev = input_allocate_device(); if (!info->idev) { - dev_err(ab8500->dev, "Failed to allocate input dev\n"); + dev_err(&pdev->dev, "Failed to allocate input dev\n"); ret = -ENOMEM; goto out; } @@ -83,7 +94,7 @@ static int __devinit ab8500_ponkey_probe(struct platform_device *pdev) ret = input_register_device(info->idev); if (ret) { - dev_err(ab8500->dev, "Can't register input device: %d\n", ret); + dev_err(&pdev->dev, "Can't register input device: %d\n", ret); goto out_unfreedevice; } @@ -91,7 +102,7 @@ static int __devinit ab8500_ponkey_probe(struct platform_device *pdev) IRQF_NO_SUSPEND, "ab8500-ponkey-dbf", info); if (ret < 0) { - dev_err(ab8500->dev, "Failed to request dbf IRQ#%d: %d\n", + dev_err(&pdev->dev, "Failed to request dbf IRQ#%d: %d\n", info->irq_dbf, ret); goto out_unregisterdevice; } @@ -100,7 +111,7 @@ static int __devinit ab8500_ponkey_probe(struct platform_device *pdev) IRQF_NO_SUSPEND, "ab8500-ponkey-dbr", info); if (ret < 0) { - dev_err(ab8500->dev, "Failed to request dbr IRQ#%d: %d\n", + dev_err(&pdev->dev, "Failed to request dbr IRQ#%d: %d\n", info->irq_dbr, ret); goto out_irq_dbf; } @@ -132,11 +143,18 @@ static int __devexit ab8500_ponkey_remove(struct platform_device *pdev) return 0; } +static struct platform_device_id ab8500_ponkey_id_table[] = { + { "ab8500-poweron-key", (kernel_ulong_t)&ab8500_ponkey, }, + { }, +}; +MODULE_DEVICE_TABLE(platform, ab8500_ponkey_id_table); + static struct platform_driver ab8500_ponkey_driver = { .driver = { .name = "ab8500-poweron-key", .owner = THIS_MODULE, }, + .id_table = ab8500_ponkey_id_table, .probe = ab8500_ponkey_probe, .remove = __devexit_p(ab8500_ponkey_remove), }; |