summaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard/gpio_keys.c
Commit message (Collapse)AuthorAgeFilesLines
* Input: gpio_keys - remove redundant platform_set_drvdata()Sachin Kamat2013-05-081-1/+0
| | | | | | | | | Commit 0998d06310 (device-core: Ensure drvdata = NULL when no driver is bound) removes the need to set driver data field to NULL. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: gpio_keys - defer probing if GPIO probing is deferredDmitry Torokhov2012-12-241-1/+12
| | | | | | | | | | | If of_get_gpio_flags() returns an error (as in case when GPIO probe is deferred) the driver would attempt to claim invalid GPIO. It should propagate the error code up the stack instead so that the probe either fails or will be retried later (in case of -EPROBE_DEFER). Cc: stable@vger.kernel.org Reported-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: gpio_keys - switch to using gpio_request_one()Dmitry Torokhov2012-12-031-9/+1
| | | | | | This saves us a few lines of code. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: gpio_keys - disable hardware on suspendJonas Aaberg2012-11-271-5/+22
| | | | | | | | | | | | | Disable hardware if active when suspending if the hw can not wake the system from suspend. [Dmitry Torokhov: use input_dev->users instead of a separate flag] Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Philippe Langlais <philippe.langlais@linaro.org> Reviewed-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: gpio_keys - report initial state when opening the deviceDmitry Torokhov2012-11-271-13/+26
| | | | | | | Instead of reporting the initial stage when the device is registered we should do it when the device is opened (so there are users). Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: remove use of __devexitBill Pemberton2012-11-241-1/+1
| | | | | | | | | CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: remove use of __devinitBill Pemberton2012-11-241-6/+6
| | | | | | | | | | CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Javier Martinez Canillas <javier@dowhile0.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: remove use of __devexit_pBill Pemberton2012-11-241-1/+1
| | | | | | | | | CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: gpio_keys - report a wakeup_event for a button pressNeilBrown2012-08-211-0/+8
| | | | | | | | | | | | | | | | | In order to avoid races with suspend, a wakeup event must register as such by calling pm_wakeup_event() or pm_stay_awake(). This will ensure that the current suspend cycle aborts. When the user-space visible event is created in the interrupt handler (gpio_keys_irq_isr), a simple pm_wakeup_event() with no delay is sufficient as suspend will synchronise with all interrupt delivery. When the user-space visible event is created later (gpio_keys_gpio_isr), we need to bracket the event with pm_stay_awake() and pm_relax(). Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
* Input: gpio_keys - clean up device tree parserAlexandre Pereira da Silva2012-08-211-81/+80
| | | | | | | | | | | | | | - fix sizeof in memset; - clean up dt properties extraction; - use for_each_chil_of_node macro; - use of_get_child_count(); - use of_match_ptr macro. Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com> Acked-by: Rob Herring <rob.herring@calxeda.com> [Fabio Estevam <fabio.estevam@freescale.com>: fix fix NULL pointer dereference for dt case - pdata->buttons wasn't initialized] Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - remove useless reinitialization of pdata->nbuttonsTobias Klauser2012-06-121-1/+0
| | | | | | | | pdata is zeroed using memset just a few lines before, so there is no need to set the nbuttons member to 0 again. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - add support for interrupt only keysLaxman Dewangan2012-03-191-66/+148
| | | | | | | | | | | Some of buttons, like power-on key or onkey, may only generate interrupts when pressed and not actually be mapped as gpio in the system. Allow setting gpio to invalid value and specify IRQ instead to support such keys. The debounce timer is used not to debounce but to ignore new IRQs coming while button is kept pressed. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - consolidate key destructor codeDmitry Torokhov2012-03-191-16/+14
| | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: revert "gpio_keys - switch to using threaded IRQs"David Jander2012-03-191-1/+1
| | | | | | | | request_any_context_irq() should handle the case when using GPIO expanders that themselves use threaded IRQs, and so the premise of change 7e2ecdf438bb479e2b4667fc16b1a84d6348da04 is incorrect. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - constify platform dataDmitry Torokhov2012-03-191-16/+15
| | | | | | | The platform data should not be altered and therefore should be accessed through const pointers. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - use of_property_read_u32()Tobias Klauser2011-09-201-11/+13
| | | | | | | | | Use the of_property_read_u32() helper function to retrieve u32 values from the device tree. Also do not pass the len parameter to of_get_property if it isn't checked afterwards. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - return proper error code if memory allocation failsTobias Klauser2011-07-301-1/+1
| | | | | | | Return -ENOMEM if kzalloc fails in gpio_keys_get_devtree_pdata(). Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - switch to using SIMPLE_DEV_PM_OPSDmitry Torokhov2011-07-101-8/+3
| | | | | | This reduces amount #ifdeds in the code. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - add support for device-tree platform dataDavid Jander2011-07-101-16/+132
| | | | | | | | | | | | | This patch enables fetching configuration data, which is normally provided via platform_data, from the device-tree instead. If the device is configured from device-tree data, the platform_data struct is not used, and button data needs to be allocated dynamically. Big part of this patch deals with confining pdata usage to the probe function, to make this possible. Signed-off-by: David Jander <david@protonic.nl> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - fix a memory leakAxel Lin2011-06-291-0/+1
| | | | | Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - move to late_initcallDavid Jander2011-06-271-1/+1
| | | | | | | | | | | | | Initialize gpio_keys driver at late_initcall level, to give it a chance to work with GPIO expanders that might not be ready yet if we initialize the driver at module_init time. This is strictly a band-aid until there is a better way to specify inter-device dependencies. Signed-off-by: David Jander <david@protonic.nl> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - switch to using threaded IRQsDavid Jander2011-06-211-2/+2
| | | | | | | | | | Use a threaded interrupt handler in order to permit the handler to use a GPIO driver that causes things like I2C transactions being done inside the handler context. Signed-off-by: David Jander <david@protonic.nl> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio-keys - add support for setting device nameAlexander Stein2011-04-111-1/+1
| | | | | | | | This patch allows to set a device name which helps distinguishing several gpio-keys devices. Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - add support for EV_ABSAlexander Stein2011-04-111-2/+7
| | | | | | | | With this patch you can setup a group of GPIOs representing a specific position on an EV_ABS axis. Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - switch to using request_any_context_irqPhilippe Langlais2011-01-201-3/+3
| | | | | | | | | The driver does not require hardirq context and can work with threaded interrupts as well, so let's switch to request_any_context_irq which will select the context that is available for us. Signed-off-by: Philippe Langlais <philippe.langlais@stericsson.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - add hooks to enable/disable deviceShubhrajyoti D2010-08-031-0/+22
| | | | | | | | | Allow platform code to specify callbcks that will be invoked when input device is opened or closed, allowing, for example, to enable the device. Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio-keys - add gpiolib debounce supportGrazvydas Ignotas2010-06-281-5/+14
| | | | | | | | | | | gpiolib now has debounce support added in .35, so let's make use of it. This allows to use hardware GPIO debouncing on some platforms like OMAP. In case gpiolib debounce setup fails for some GPIO, the driver will fall back to timer based debouncing, which is what it used before. Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
* Input: gpio-keys - add support for disabling gpios through sysfsMika Westerberg2010-02-041-11/+307
| | | | | | | | | | | | | | | | | | | | | | | | | | Now gpio-keys input driver exports 4 new attributes to userland through sysfs: /sys/devices/platform/gpio-keys/keys [ro] /sys/devices/platform/gpio-keys/switches [ro] /sys/devices/platform/gpio-keys/disabled_keys [rw] /sys/devices/platform/gpio-keys/disables_switches [rw] With these attributes, userland program can read which keys and switches can be disabled and then disable/enable them as needed. Keys and switches are exported as stringified bitmap of codes (keycodes or switch codes). For example keys 15, 89, 100, 101, 102 are exported as: '15,89,100-102'. Description of the attributes: keys - bitmap of keys which can be disabled switches - bitmap of switches which can be disabled disabled_keys - bitmap of currently disabled keys (bit 1 means disabled, 0 enabled) disabled_switches - bitmap of currently disabled switches (bit 1 means disabled, 0 enabled) Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - scan gpio state at probe and resume timeDaniel Mack2009-11-301-11/+25
| | | | | | | | | | | We need to read and report gpio state when we bind the driver to the device and upon resume so that userspace has correct state of the switches (and keys but they are less important since, even if they are happened to be pressed, we'd expect them to be released fairly soon). Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - seperate individual button setup to make code neaterBen Dooks2009-11-201-40/+53
| | | | | | | | | | Move the code that deals with setting up each individual button out into a new function to reduce the indentation and allow us to common up some of the error recovery code. Signed-off-by: Ben Dooks <ben@simtec.co.uk> Signed-off-by: Simtec Linux Team <linux@simtec.co.uk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - use <linux/gpio.h> instead of <asm/gpio.h>Ben Dooks2009-11-201-2/+1
| | | | | | | | | The gpio keys driver should be using <linux/gpio.h> instead of <asm/gpio.h> Signed-off-by: Ben Dooks <ben@simtec.co.uk> Signed-off-by: Simtec Linux Team <linux@simtec.co.uk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - use dev_ macros to report informationBen Dooks2009-11-201-7/+9
| | | | | | | | | | The gpio_keys driver is binding to a platform device but using pr_err() to report errors. Change to using dev_err() so that all messages are prefixed by the device name. Signed-off-by: Ben Dooks <ben@simtec.co.uk> Signed-off-by: Simtec Linux Team <linux@simtec.co.uk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio-keys - use IRQF_SHAREDDmitry Eremin-Solenikov2009-11-021-0/+1
| | | | | | | | | | | There is nothing that disallows gpio-keys to share it's IRQ line w/ other drivers. Make it use IRQF_SHARED in request_irq(). An example of other driver with which I'd like to share IRQ line for GPIO buttons is ledtrig-gpio. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - swtich to dev_pm_opsMike Rapoport2009-07-241-7/+12
| | | | | Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio-keys - avoid possibility of sleeping in timer functionJani Nikula2009-06-281-5/+12
| | | | | | | | The gpio_get_value function may sleep, so it should not be called in a timer function. Move gpio_get_value calls to workqueue. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio-keys - revert 'change timer to workqueue'Jani Nikula2009-06-281-12/+20
| | | | | | | | | | | | This reverts commit 0b346838c5862bfe911432956a106d602535d030. This commit breaks GPIO debouncing by replacing the original mod_timer with schedule_delayed_work in the interrupt handler. The latter does not kick the timer further on GPIO line changes as it should to perform debouncing. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio-keys - change timer to workqueueAlek Du2009-06-111-20/+12
| | | | | | | | The gpio_get_value function of I2C/SPI GPIO expander may sleep thus this function call can not be called in a timer function. Signed-off-by: Alek Du <alek.du@intel.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio-keys - remove depreciated IRQF_SAMPLE_RANDOM flagDmitry Torokhov2009-04-181-2/+1
| | | | Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio-keys - add flag to allow auto repeatDominic Curran2008-10-271-0/+4
| | | | | | | | This patch adds a flag to gpio-key driver to turn on the input subsystems auto repeat feature if needed. Signed-off-by: Dominic Curran <dcurran@ti.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Merge branch 'next' into for-linusDmitry Torokhov2008-10-151-26/+16
|\
| * Input: gpio-keys - simplify argument list for report_eventUwe Kleine-König2008-08-081-4/+5
| | | | | | | | | | | | | | | | | | | | For now this only saves a few instructions (for gpio_keys_report_event, gpio_keys_isr and gpio_check_button one instraction each on ARM using arm-linux-gnu-gcc 4.2.3---I assume this is similar for other arch/compiler combinations). Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
| * Input: gpio-keys - optimize interrupt handlerUwe Kleine-König2008-08-081-23/+12
| | | | | | | | | | | | | | | | By passing a gpio_button_data structure to the handler instead of the whole platform_device the search for the right button can go away. Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* | Input: remove version.h from drivers that don't need itHuang Weiyi2008-08-181-1/+0
| | | | | | | | | | | | | | | | | | If a driver dies not use LINUX_VERSION_CODE nor KERNEL_VERSION then it does not need to include version.h Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* | Input: gpio-keys - make gpio_keys_device_driver staticUwe Kleine-König2008-07-301-1/+1
| | | | | | | | | | | | | | | | | | This fixes the sparse warning symbol 'gpio_keys_device_driver' was not declared. Should it be static? Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* | Input: gpio-keys - fix possible NULL pointer dereferenceUwe Kleine-König2008-07-301-0/+1
|/ | | | | | | | | bdata->button is used in gpio_check_button but never initialized. Having a device with debounce_interval != 0 without this patch resulted on an oops on my machine. Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio-keys debouncing supportDmitry Baryshkov2008-05-161-20/+69
| | | | | Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: add MODULE_ALIAS() to hotpluggable platform modulesKay Sievers2008-04-241-0/+2
| | | | | | | | | | | Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, the platform modalias is prefixed with "platform:". Add MODULE_ALIAS() to the hotpluggable "input" platform drivers, to re-enable auto loading. [dbrownell@users.sourceforge.net: more drivers, registration fixes] Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio_keys - irq handling cleanupDavid Brownell2008-04-151-1/+2
| | | | | | | | Cleanup IRQ handling in gpio_keys: bail after handling the IRQ, and report IRQ_NONE if we never handle it. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
* Input: gpio-keys - request and configure GPIOsHerbert Valerio Riedel2007-11-211-10/+28
| | | | | | | | | | | Currently, gpio_keys.c assumes the GPIOs to be already properly configured; this patch changes gpio-keys to perform explicit calls to gpio_request() and gpio_configure_input(). This matches the behaviour of leds-gpio. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>