summaryrefslogtreecommitdiffstats
path: root/drivers/input/misc/axp20x-pek.c
Commit message (Collapse)AuthorAgeFilesLines
* Input: axp20x-pek - fix module not auto-loading for axp221 pekHans de Goede2017-10-201-1/+1
| | | | | | | | | | | | Now that we have a platform_device_id table and multiple supported ids we should be using MODULE_DEVICE_TABLE instead of MODULE_ALIAS. This fixes a regression on Bay and Cherry Trail devices, where the power button is now enumerated as an "axp221-pek" and it was impossible to wakeup these devices from suspend since the module did not load. Fixes: c3cc94470bd3 ("Input: axp20x-pek - add support for AXP221 PEK") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: axp20x-pek - add support for AXP221 PEKQuentin Schulz2017-08-171-0/+18
| | | | | | | | The AXP221 has different values for startup time bits from the AXP20X. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Reviewed-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: axp20x-pek - use driver_data of platform_device_id instead of ↵Quentin Schulz2017-08-171-45/+90
| | | | | | | | | | | | | | | | | | | | | | extended attributes To prepare an upcoming patch adding support for another PMIC that has different startup and shutdown time, use driver_data of platform_device_id instead of a fixed extended device attribute. By doing so, we also remove a lot of nested structures that aren't useful. With this patch, a new PMIC can be easily supported by just filling correctly its ax20x_info structure and adding a platform_device_id. Moreover, since we get rid of extended attributes, rename axp20x_store_ext_attr to axp20x_store_attr and axp20x_show_ext_attr to axp20x_show_attr. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Merge branch 'bind_unbind' of ↵Dmitry Torokhov2017-07-251-24/+38
|\ | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core into next This brings in devm_device_add_group() and friends so that we can create driver-specific device attributes as managed resources.
| * Input: axp20x-pek - switch to using devm_device_add_group()Dmitry Torokhov2017-07-221-17/+1Star
| | | | | | | | | | | | | | | | | | Now that we have proper managed API to create device attributes, let's use it instead of installing a custom devm action. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * Input: axp20x-pek - switch to acpi_dev_present and check for ACPI0011 tooHans de Goede2017-06-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | acpi_dev_found checks that there is a matching ACPI node, but it may be disabled (_STA method returns 0) in which case the soc_button_array driver will not bind to it and axp20x-pek should handle the power-button. This commit switches from acpi_dev_found to acpi_dev_present to avoid not registering an input-dev for the powerbutton when there is a disabled PNP0C40 device. The ACPI-6.0 standard defines a standard gpio button device using the ACPI0011 HID replacing the custom PNP0C40 gpio device, many newer devices define both PNP0C40 and ACPI0011 devices enabling one or the other depending on whether the BIOS thinks it is going to boot Android or Windows. This commit adds a check for the ACPI0011 device, so that if either device is present *and* enabled we don't register an input-dev for the powerbutton. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
| * Input: axp20x-pek - only check for "INTCFD9" ACPI device on Cherry TrailHans de Goede2017-06-031-7/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 9b13a4ca8d2c ("Input: axp20x-pek - do not register input device on some systems") added a check for the INTCFD9 ACPI device which also handles the powerbutton as on some systems the powerbutton is connected to both the PMIC, handled by axp20x-pek, and to a gpio on the SoC, handled by soc_button_array which attaches itself to the INTCFD9 ACPI device. Testing + comparing DSDTs has shown that this only happens on Cherry Trail devices with an AXP288 PMIC, the AXP288 PMIC is also used on Bay Trail devices but there the power button is only connected to the PMIC and not handled by soc_button_array. This means that the INTCFD9 check has caused a regression on Bay Trail devices, causing power-button presses to no longer be seen. This commit fixes this by limiting the check to devices where the ACPI node for the AXP288 contains a _HRV (hardware revision) attribute with a value of 3 which indicates we are dealing with a Cherry Trail platform. Fixes: 9b13a4ca8d2c ("Input: axp20x-pek - do not register input ...") Reported-by: Сергей Трусов <t.rus76@ya.ru> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* | Input: axp20x-pek - add wakeup supportHans de Goede2017-06-031-0/+28
|/ | | | | | | | At least on devices with the AXP288 PMIC the device is expected to wakeup from suspend when the power-button gets pressed, add support for this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: axp20x-pek - do not register input device on some systemsHans de Goede2017-03-091-3/+12
| | | | | | | | | | | | | | | | | | | | On some systems (Intel tablets with axp288 pmic) the powerbutton is also connected to a gpio pin of the SoC, advertised through the "INTCFD9" / "PNP0C40" acpi device. This leads to double reporting of powerbutton events, which is undesirable, so one driver needs to not report input events in this case. Since the soc_button_array driver for the "PNP0C40" acpi device also handles wake from suspend on these tablets and since the axp20x-pel driver requires relative expensive i2c accrsses, it is best for the axp20x-pek driver to not register an input device in this case. Note that this commit leaves the axp20x-driver bound to the device, rather then returning -ENODEV, this is done so that the sysfs attributes it offers are kept around. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: axp20x_pek - add axp20x_pek_probe_input_device helperHans de Goede2017-03-091-18/+29
| | | | | | | | | | | | | | Move all input device related initialization into a new axp20x_pek_probe_input_device helper function. This introduces one functional change, the input device is now registered before the sysfs attr get registered. This is not a problem as the sysfs attr are to configure some long press settings (forced poweroff) in the hardware and do not interact with the input_device. This is a preparation patch for not always registering the input dev. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: axp20x-pek - use our own device for errorsHans de Goede2017-03-091-4/+4
| | | | | | | | | | | Before this commit axp20x-pek was mixing 2 style error reporting calls: dev_err(&pdev->dev, ...); dev_err(axp20x->dev, ...); But the second is our parent device, not our own device, so switch to using &pdev->dev everywhere. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: axp20x-pek - add module aliasChen-Yu Tsai2015-08-031-0/+1
| | | | | | | | Add a proper module alias so the driver can be autoloaded when the parent axp20x mfd driver registers its cells. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Carlo Caione <carlo@caione.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: axp20x-pek - fix reporting button state as invertedHans de Goede2015-06-241-2/+6
| | | | | | | | | | | | | | | | | | Currently we are reporting the button state as inverted on all boards with an axp209 pmic, tested on a ba10-tvbox, bananapi, bananapro, cubietruck and utoo-p66 tablet. The axp209 datasheet clearly states that the power button must be connected between the PWRON key and ground. Which means that on a press we will get a falling edge (dbf) irq not a rising one, and likewise on release we will get a rising edge (dbr) irq, not a falling one. This commit swaps the check for the 2 irqs fixing the inverted reporting of the power button state. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Carlo Caione <carlo@caione.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: axp20x-pek - switch over to using attribute groupDmitry Torokhov2015-01-081-28/+36
| | | | | | | | Instead of registering device attributes individually let's use attribute groups and also devm_* infrastructure to ease cleanup. Tested-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: add driver for AXP20x Power Enable KeyCarlo Caione2015-01-081-0/+282
This change adds support for the Power Enable Key found on MFD AXP202 and AXP209. Besides the basic support for the button, the driver adds two entries in sysfs to configure the time delay for power on/off. Signed-off-by: Carlo Caione <carlo@caione.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> [wens@csie.org: made axp20x_pek_remove() static; removed driver owner field; fixed path for sysfs entries] Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>