diff options
| author | Janusz Krzysztofik <jmkrzyszt@gmail.com> | 2018-06-21 18:41:27 -0400 |
|---|---|---|
| committer | Tony Lindgren <tony@atomide.com> | 2018-07-03 02:05:14 -0400 |
| commit | a617b36bbc0a1d175bbe98e009e903c1ea0e2be5 (patch) | |
| tree | a3867b0bdecdc28de0c9971ec35ea4a6d95733b5 /drivers/input | |
| parent | dc8fbeb0ffde1f2395449006019e2c89c177df50 (diff) | |
Input: ams_delta_serio: use IRQ resource
The driver still obtains IRQ number from a hardcoded GPIO. Use IRQ
resource instead.
For this to work on Amstrad Delta, add the IRQ resource to
ams-delta-serio platform device structure. Obtain the IRQ number
assigned to "keybrd_clk" GPIO pin from FIQ initialization routine.
As a benefit, the driver no longer needs to include
<mach/board-ams-delta.h>.
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/input')
| -rw-r--r-- | drivers/input/serio/ams_delta_serio.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c index 2602f7cff5ae..c1f8226f172e 100644 --- a/drivers/input/serio/ams_delta_serio.c +++ b/drivers/input/serio/ams_delta_serio.c | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | * However, when used with the E3 mailboard that producecs non-standard | 20 | * However, when used with the E3 mailboard that producecs non-standard |
| 21 | * scancodes, a custom key table must be prepared and loaded from userspace. | 21 | * scancodes, a custom key table must be prepared and loaded from userspace. |
| 22 | */ | 22 | */ |
| 23 | #include <linux/gpio.h> | ||
| 24 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
| 25 | #include <linux/platform_data/ams-delta-fiq.h> | 24 | #include <linux/platform_data/ams-delta-fiq.h> |
| 26 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
| @@ -29,8 +28,6 @@ | |||
| 29 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 30 | #include <linux/module.h> | 29 | #include <linux/module.h> |
| 31 | 30 | ||
| 32 | #include <mach/board-ams-delta.h> | ||
| 33 | |||
| 34 | #define DRIVER_NAME "ams-delta-serio" | 31 | #define DRIVER_NAME "ams-delta-serio" |
| 35 | 32 | ||
| 36 | MODULE_AUTHOR("Matt Callow"); | 33 | MODULE_AUTHOR("Matt Callow"); |
| @@ -113,7 +110,7 @@ static int ams_delta_serio_init(struct platform_device *pdev) | |||
| 113 | { | 110 | { |
| 114 | struct ams_delta_serio *priv; | 111 | struct ams_delta_serio *priv; |
| 115 | struct serio *serio; | 112 | struct serio *serio; |
| 116 | int err; | 113 | int irq, err; |
| 117 | 114 | ||
| 118 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); | 115 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
| 119 | if (!priv) | 116 | if (!priv) |
| @@ -139,26 +136,20 @@ static int ams_delta_serio_init(struct platform_device *pdev) | |||
| 139 | return err; | 136 | return err; |
| 140 | } | 137 | } |
| 141 | 138 | ||
| 142 | err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), | 139 | irq = platform_get_irq(pdev, 0); |
| 143 | ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING, | 140 | if (irq < 0) |
| 144 | DRIVER_NAME, priv); | 141 | return -ENXIO; |
| 142 | |||
| 143 | err = devm_request_irq(&pdev->dev, irq, ams_delta_serio_interrupt, | ||
| 144 | IRQ_TYPE_EDGE_RISING, DRIVER_NAME, priv); | ||
| 145 | if (err < 0) { | 145 | if (err < 0) { |
| 146 | dev_err(&pdev->dev, "IRQ request failed (%d)\n", err); | 146 | dev_err(&pdev->dev, "IRQ request failed (%d)\n", err); |
| 147 | return err; | 147 | return err; |
| 148 | } | 148 | } |
| 149 | /* | ||
| 150 | * Since GPIO register handling for keyboard clock pin is performed | ||
| 151 | * at FIQ level, switch back from edge to simple interrupt handler | ||
| 152 | * to avoid bad interaction. | ||
| 153 | */ | ||
| 154 | irq_set_handler(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), | ||
| 155 | handle_simple_irq); | ||
| 156 | 149 | ||
| 157 | serio = kzalloc(sizeof(*serio), GFP_KERNEL); | 150 | serio = kzalloc(sizeof(*serio), GFP_KERNEL); |
| 158 | if (!serio) { | 151 | if (!serio) |
| 159 | err = -ENOMEM; | 152 | return -ENOMEM; |
| 160 | goto irq; | ||
| 161 | } | ||
| 162 | 153 | ||
| 163 | priv->serio = serio; | 154 | priv->serio = serio; |
| 164 | 155 | ||
| @@ -177,10 +168,6 @@ static int ams_delta_serio_init(struct platform_device *pdev) | |||
| 177 | dev_info(&serio->dev, "%s\n", serio->name); | 168 | dev_info(&serio->dev, "%s\n", serio->name); |
| 178 | 169 | ||
| 179 | return 0; | 170 | return 0; |
| 180 | |||
| 181 | irq: | ||
| 182 | free_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), priv); | ||
| 183 | return err; | ||
| 184 | } | 171 | } |
| 185 | 172 | ||
| 186 | static int ams_delta_serio_exit(struct platform_device *pdev) | 173 | static int ams_delta_serio_exit(struct platform_device *pdev) |
| @@ -188,7 +175,6 @@ static int ams_delta_serio_exit(struct platform_device *pdev) | |||
| 188 | struct ams_delta_serio *priv = platform_get_drvdata(pdev); | 175 | struct ams_delta_serio *priv = platform_get_drvdata(pdev); |
| 189 | 176 | ||
| 190 | serio_unregister_port(priv->serio); | 177 | serio_unregister_port(priv->serio); |
| 191 | free_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0); | ||
| 192 | 178 | ||
| 193 | return 0; | 179 | return 0; |
| 194 | } | 180 | } |
