diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-03 12:38:20 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-03 12:38:20 -0700 |
commit | 16a12fa9aed176444fc795b09e796be41902bb08 (patch) | |
tree | bd158def3263a8b0d0f0886fd0fcd32728242dc4 /drivers/input/misc/axp20x-pek.c | |
parent | d25e436c4b68db2895185b24ad1f22499c2f87b0 (diff) | |
parent | 0337966d121ebebf73a1c346123e8112796e684e (diff) | |
download | linux-16a12fa9aed176444fc795b09e796be41902bb08.tar.bz2 |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input subsystem updates from Dmitry Torokhov:
- a big update from Mauro converting input documentation to ReST format
- Synaptics PS/2 is now aware of SMBus companion devices, which means
that we can now use native RMI4 protocol to handle touchpads, instead
of relying on legacy PS/2 mode.
- we removed support from BMA180 accelerometer from input devices as it
is now handled properly by IIO
- update to TSC2007 to corretcly report pressure
- other miscellaneous driver fixes.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (152 commits)
Input: ar1021_i2c - use BIT to check for a bit
Input: twl4030-pwrbutton - use input_set_capability() helper
Input: twl4030-pwrbutton - use correct device for irq request
Input: ar1021_i2c - enable touch mode during open
Input: add uinput documentation
dt-bindings: input: add bindings document for ar1021_i2c driver
dt-bindings: input: rotary-encoder: fix typo
Input: xen-kbdfront - add module parameter for setting resolution
ARM: pxa/raumfeld: fix compile error in rotary controller resources
Input: xpad - do not suggest writing to Dominic
Input: xpad - don't use literal blocks inside footnotes
Input: xpad - note that usb/devices is now at /sys/kernel/debug/
Input: docs - freshen up introduction
Input: docs - split input docs into kernel- and user-facing
Input: docs - note that MT-A protocol is obsolete
Input: docs - update joystick documentation a bit
Input: docs - remove disclaimer/GPL notice
Input: fix "Game console" heading level in joystick documentation
Input: rotary-encoder - remove references to platform data from docs
Input: move documentation for Amiga CD32
...
Diffstat (limited to 'drivers/input/misc/axp20x-pek.c')
-rw-r--r-- | drivers/input/misc/axp20x-pek.c | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c index 1ac898db303a..f11807db6979 100644 --- a/drivers/input/misc/axp20x-pek.c +++ b/drivers/input/misc/axp20x-pek.c @@ -13,6 +13,7 @@ * GNU General Public License for more details. */ +#include <linux/acpi.h> #include <linux/errno.h> #include <linux/irq.h> #include <linux/init.h> @@ -188,21 +189,13 @@ static void axp20x_remove_sysfs_group(void *_data) sysfs_remove_group(&dev->kobj, &axp20x_attribute_group); } -static int axp20x_pek_probe(struct platform_device *pdev) +static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek, + struct platform_device *pdev) { - struct axp20x_pek *axp20x_pek; - struct axp20x_dev *axp20x; + struct axp20x_dev *axp20x = axp20x_pek->axp20x; struct input_dev *idev; int error; - axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek), - GFP_KERNEL); - if (!axp20x_pek) - return -ENOMEM; - - axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent); - axp20x = axp20x_pek->axp20x; - axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR"); if (axp20x_pek->irq_dbr < 0) { dev_err(&pdev->dev, "No IRQ for PEK_DBR, error=%d\n", @@ -239,7 +232,7 @@ static int axp20x_pek_probe(struct platform_device *pdev) axp20x_pek_irq, 0, "axp20x-pek-dbr", idev); if (error < 0) { - dev_err(axp20x->dev, "Failed to request dbr IRQ#%d: %d\n", + dev_err(&pdev->dev, "Failed to request dbr IRQ#%d: %d\n", axp20x_pek->irq_dbr, error); return error; } @@ -248,30 +241,57 @@ static int axp20x_pek_probe(struct platform_device *pdev) axp20x_pek_irq, 0, "axp20x-pek-dbf", idev); if (error < 0) { - dev_err(axp20x->dev, "Failed to request dbf IRQ#%d: %d\n", + dev_err(&pdev->dev, "Failed to request dbf IRQ#%d: %d\n", axp20x_pek->irq_dbf, error); return error; } - error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group); + error = input_register_device(idev); if (error) { - dev_err(axp20x->dev, "Failed to create sysfs attributes: %d\n", + dev_err(&pdev->dev, "Can't register input device: %d\n", error); return error; } - error = devm_add_action(&pdev->dev, - axp20x_remove_sysfs_group, &pdev->dev); + return 0; +} + +static int axp20x_pek_probe(struct platform_device *pdev) +{ + struct axp20x_pek *axp20x_pek; + int error; + + axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek), + GFP_KERNEL); + if (!axp20x_pek) + return -ENOMEM; + + axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent); + + /* + * Do not register the input device if there is an "INTCFD9" + * gpio button ACPI device, that handles the power button too, + * and otherwise we end up reporting all presses twice. + */ + if (!acpi_dev_found("INTCFD9") || + !IS_ENABLED(CONFIG_INPUT_SOC_BUTTON_ARRAY)) { + error = axp20x_pek_probe_input_device(axp20x_pek, pdev); + if (error) + return error; + } + + error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group); if (error) { - axp20x_remove_sysfs_group(&pdev->dev); - dev_err(&pdev->dev, "Failed to add sysfs cleanup action: %d\n", + dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n", error); return error; } - error = input_register_device(idev); + error = devm_add_action(&pdev->dev, + axp20x_remove_sysfs_group, &pdev->dev); if (error) { - dev_err(axp20x->dev, "Can't register input device: %d\n", + axp20x_remove_sysfs_group(&pdev->dev); + dev_err(&pdev->dev, "Failed to add sysfs cleanup action: %d\n", error); return error; } |