aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc/soc_button_array.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-07 21:26:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-07 21:26:52 -0400
commit1e345ac6869cd2f2d5d4b780fc5d5332dd1e8905 (patch)
treeeeb7d4faa5fdc5e27fd024c65384f11d515fe90f /drivers/input/misc/soc_button_array.c
parent39520eea198a7fbba35f4c7cffb4323f78455716 (diff)
parent447a8b858e4bda41c394b1bc7fdbc9dc0bdf44f6 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov: "A few new haptic/button drivers, a rudimentary support for laptops using FocalTech touchpads; xpad driver will bind to more devices, and a few other driver fixes." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: soc_button_array - convert to platform bus Input: palmas-pwrbutton - fix typo in the license string Input: palmas-pwrbutton - use IRQF_ONESHOT Input: psmouse - add support for detecting FocalTech PS/2 touchpads Input: psmouse - add psmouse_matches_pnp_id helper function Input: joystick - use ktime for measuring timing Input: add haptic driver on max77693 Input: introduce palmas-pwrbutton Input: add support for the DRV2667 haptic driver Input: xpad - sync device IDs with xboxdrv Input: xpad - add VID/PID for Razer Sabertooth Input: cros_ec_keyb - optimize ghosting algorithm Input: drv260x - fix binding document Input: drv260x - add check for ERM mode and LRA Libraries Input: drv260x - remove unused defines Input: drv260x - add TI drv260x haptics driver
Diffstat (limited to 'drivers/input/misc/soc_button_array.c')
-rw-r--r--drivers/input/misc/soc_button_array.c60
1 files changed, 31 insertions, 29 deletions
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index e34dfc29beb3..735604753568 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -18,7 +18,7 @@
18#include <linux/gpio/consumer.h> 18#include <linux/gpio/consumer.h>
19#include <linux/gpio_keys.h> 19#include <linux/gpio_keys.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/pnp.h> 21#include <linux/acpi.h>
22 22
23/* 23/*
24 * Definition of buttons on the tablet. The ACPI index of each button 24 * Definition of buttons on the tablet. The ACPI index of each button
@@ -67,7 +67,7 @@ static int soc_button_lookup_gpio(struct device *dev, int acpi_index)
67} 67}
68 68
69static struct platform_device * 69static struct platform_device *
70soc_button_device_create(struct pnp_dev *pdev, 70soc_button_device_create(struct platform_device *pdev,
71 const struct soc_button_info *button_info, 71 const struct soc_button_info *button_info,
72 bool autorepeat) 72 bool autorepeat)
73{ 73{
@@ -138,30 +138,40 @@ err_free_mem:
138 return ERR_PTR(error); 138 return ERR_PTR(error);
139} 139}
140 140
141static void soc_button_remove(struct pnp_dev *pdev) 141static int soc_button_remove(struct platform_device *pdev)
142{ 142{
143 struct soc_button_data *priv = pnp_get_drvdata(pdev); 143 struct soc_button_data *priv = platform_get_drvdata(pdev);
144
144 int i; 145 int i;
145 146
146 for (i = 0; i < BUTTON_TYPES; i++) 147 for (i = 0; i < BUTTON_TYPES; i++)
147 if (priv->children[i]) 148 if (priv->children[i])
148 platform_device_unregister(priv->children[i]); 149 platform_device_unregister(priv->children[i]);
150
151 return 0;
149} 152}
150 153
151static int soc_button_pnp_probe(struct pnp_dev *pdev, 154static int soc_button_probe(struct platform_device *pdev)
152 const struct pnp_device_id *id)
153{ 155{
154 const struct soc_button_info *button_info = (void *)id->driver_data; 156 struct device *dev = &pdev->dev;
157 const struct acpi_device_id *id;
158 struct soc_button_info *button_info;
155 struct soc_button_data *priv; 159 struct soc_button_data *priv;
156 struct platform_device *pd; 160 struct platform_device *pd;
157 int i; 161 int i;
158 int error; 162 int error;
159 163
164 id = acpi_match_device(dev->driver->acpi_match_table, dev);
165 if (!id)
166 return -ENODEV;
167
168 button_info = (struct soc_button_info *)id->driver_data;
169
160 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 170 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
161 if (!priv) 171 if (!priv)
162 return -ENOMEM; 172 return -ENOMEM;
163 173
164 pnp_set_drvdata(pdev, priv); 174 platform_set_drvdata(pdev, priv);
165 175
166 for (i = 0; i < BUTTON_TYPES; i++) { 176 for (i = 0; i < BUTTON_TYPES; i++) {
167 pd = soc_button_device_create(pdev, button_info, i == 0); 177 pd = soc_button_device_create(pdev, button_info, i == 0);
@@ -192,30 +202,22 @@ static struct soc_button_info soc_button_PNP0C40[] = {
192 { } 202 { }
193}; 203};
194 204
195static const struct pnp_device_id soc_button_pnp_match[] = { 205static const struct acpi_device_id soc_button_acpi_match[] = {
196 { .id = "PNP0C40", .driver_data = (long)soc_button_PNP0C40 }, 206 { "PNP0C40", (unsigned long)soc_button_PNP0C40 },
197 { .id = "" } 207 { }
198}; 208};
199MODULE_DEVICE_TABLE(pnp, soc_button_pnp_match);
200 209
201static struct pnp_driver soc_button_pnp_driver = { 210MODULE_DEVICE_TABLE(acpi, soc_button_acpi_match);
202 .name = KBUILD_MODNAME, 211
203 .id_table = soc_button_pnp_match, 212static struct platform_driver soc_button_driver = {
204 .probe = soc_button_pnp_probe, 213 .probe = soc_button_probe,
205 .remove = soc_button_remove, 214 .remove = soc_button_remove,
215 .driver = {
216 .name = KBUILD_MODNAME,
217 .owner = THIS_MODULE,
218 .acpi_match_table = ACPI_PTR(soc_button_acpi_match),
219 },
206}; 220};
207 221module_platform_driver(soc_button_driver);
208static int __init soc_button_init(void)
209{
210 return pnp_register_driver(&soc_button_pnp_driver);
211}
212
213static void __exit soc_button_exit(void)
214{
215 pnp_unregister_driver(&soc_button_pnp_driver);
216}
217
218module_init(soc_button_init);
219module_exit(soc_button_exit);
220 222
221MODULE_LICENSE("GPL"); 223MODULE_LICENSE("GPL");