summaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard/imx_keypad.c
AgeCommit message (Collapse)AuthorFilesLines
2022-09-26Input: imx_keypad - add missing linux/input.h includeDmitry Torokhov1-0/+1
We are going to clean up matrix_keymap.h from unnecessary includes, so the driver needs to include API that it uses directly. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220923194738.927408-4-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2021-03-27Input: imx_keypad - convert to a DT-only driverFabio Estevam1-11/+2
i.MX has been converted to a DT-only platform, so make the adjustments to the driver to convert it to a DT-only driver. Signed-off-by: Fabio Estevam <festevam@gmail.com> Link: https://lore.kernel.org/r/20210327194307.541248-1-festevam@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2020-12-02Input: use input_device_enabled()Andrzej Pietrasiewicz1-2/+2
Use the newly added helper in relevant input drivers. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Link: https://lore.kernel.org/r/20200608112211.12125-3-andrzej.p@collabora.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-08-14Input: remove dev_err() usage after platform_get_irq()Stephen Boyd1-3/+1
We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-07-15Merge tag 'v5.2' into nextDmitry Torokhov1-4/+14
Sync up with mainline to resolve conflicts in iforce driver.
2019-06-11Input: imx_keypad - make sure keyboard can always wake up systemAnson Huang1-4/+14
There are several scenarios that keyboard can NOT wake up system from suspend, e.g., if a keyboard is depressed between system device suspend phase and device noirq suspend phase, the keyboard ISR will be called and both keyboard depress and release interrupts will be disabled, then keyboard will no longer be able to wake up system. Another scenario would be, if a keyboard is kept depressed, and then system goes into suspend, the expected behavior would be when keyboard is released, system will be waked up, but current implementation can NOT achieve that, because both depress and release interrupts are disabled in ISR, and the event check is still in progress. To fix these issues, need to make sure keyboard's depress or release interrupt is enabled after noirq device suspend phase, this patch moves the suspend/resume callback to noirq suspend/resume phase, and enable the corresponding interrupt according to current keyboard status. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2019-05-20Input: imx_keypad - use devm_platform_ioremap_resource() to simplify codeAnson Huang1-3/+1
Use the new helper devm_platform_ioremap_resource() which wraps the platform_get_resource() and devm_ioremap_resource() together, to simplify the code. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2018-06-21Input: imx_keypad - switch to SPDX identifierFabio Estevam1-8/+4
Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2017-10-24Input: keyboard - convert timers to use timer_setup()Kees Cook1-4/+4
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-09-05Input: imx_keypad - remove obsolete commentFabio Estevam1-2/+0
Since commit 81e8f2bc (Input: imx_keypad - add pm suspend and resume support) the imx_keypad driver supports power management, so let's remove the obsolete comment. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-06-22Input: imx_keypad - check for clk_prepare_enable() errorFabio Estevam1-1/+3
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-01-15Merge tag 'v3.19-rc4' into nextDmitry Torokhov1-1/+0
Merge with mainline to bring in the latest thermal and other changes.
2015-01-07Input: imx_keypad - use the preferred form for passing a size of a structFabio Estevam1-2/+1
According to Documentation/CodingStyle - Chapter 14: "The preferred form for passing a size of a struct is the following: p = kmalloc(sizeof(*p), ...); The alternative form where struct name is spelled out hurts readability and introduces an opportunity for a bug when the pointer variable type is changed but the corresponding sizeof that is passed to a memory allocator is not." So do it as recommended. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-10-20input: keyboard: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-07-31Input: imx_keypad - remove ifdef round PM methodsFabio Estevam1-4/+2
We can annotate the suspend/resume functions with '__maybe_unused' and get rid of the ifdef, which makes the code smaller and simpler. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-05-14Input: imx_keypad - make of_device_id array constJingoo Han1-1/+1
Make of_device_id array const, because all OF functions handle it as const. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-02-17Input: imx_keypad - Propagate the real error code on platform_get_irq() failureFabio Estevam1-2/+2
No need to return a 'fake' return value on platform_get_irq() failure. Just return the error code itself instead. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-01-06Input: delete non-required instances of include <linux/init.h>Paul Gortmaker1-1/+0
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-12-06Input: use dev_get_platdata()Jingoo Han1-1/+2
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. This is a cosmetic change to make the code simpler and enhance the readability. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-08-15Input: keyboard, serio - simplify use of devm_ioremap_resourceJulia Lawall1-6/+1
Remove unneeded error handling on the result of a call to platform_get_resource when the value is passed to devm_ioremap_resource. Move the call to platform_get_resource adjacent to the call to devm_ioremap_resource to make the connection between them more clear. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression pdev,res,n,e,e1; expression ret != 0; identifier l; @@ - res = platform_get_resource(pdev, IORESOURCE_MEM, n); ... when != res - if (res == NULL) { ... \(goto l;\|return ret;\) } ... when != res + res = platform_get_resource(pdev, IORESOURCE_MEM, n); e = devm_ioremap_resource(e1, res); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-03-31Input: imx_keypad - switch to using managed resourcesFabio Estevam1-63/+14
Using devm_ functions can make the code cleaner and simpler. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-01-03Input: imx_keypad - add device tree supportLiu Ying1-18/+25
This patch adds device tree support for imx keypad driver. Signed-off-by: Liu Ying <Ying.Liu@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-11-25Input: imx_keypad - only set enabled columns to open-drainAndreas Pretzsch1-1/+2
In imx_keypad_inhibit(), all 8 columns were set to open-drain, in contrast to the rest of the driver, where only the enabled columns are modified/used. Contrary to the normal expectation, this also affects column I/Os not even mapped via IOMUX to the KPP hardware module but used as a GPIO. Therefore only init enabled columns to open-drain and leave all others with their default reset value of 0, i.e. totem-pole. Signed-off-by: Andreas Pretzsch <apr@cn-eng.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-11-24Input: remove use of __devexitBill Pemberton1-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>
2012-11-24Input: remove use of __devinitBill Pemberton1-1/+1
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>
2012-11-24Input: remove use of __devexit_pBill Pemberton1-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>
2012-09-04Input: imx_keypad - fix missing clk conversionsFabio Estevam1-2/+2
commit a1e636e6d3 (Input: imx_keypad - use clk_prepare_enable/ clk_disable_unprepare()) missed to update clk_enable/clk_disable in imx_keypad_probe(). Fix it so that we do not get clk warnings at boot. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-08-21Input: imx_keypad - reset the hardware before enablingMichael Grzeschik1-0/+3
Ensure the hardware is correctly initialized before requesting the interrupt, otherwise if a key was already touched since power-on the kernel enters an interrupt loop. To fix this issue we clear pending interrupt sources. We also have to make sure clk is enabled while changing the keypad registers. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-07-06Input: imx_keypad - check error returned by clk_prepare_enable()Fabio Estevam1-5/+14
Check error returned by clk_prepare_enable(). Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-07-06Input: imx_keypad - adapt the new kpp clock nameFabio Estevam1-1/+1
With the new i.mx clock framework we should pass NULL as the keypad clock name. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-07-06Input: imx_keypad - use clk_prepare_enable/clk_disable_unprepare()Fabio Estevam1-4/+4
Adapt clock handling to the new i.mx clock framework and fix the following warning: input: imx-keypad as /devices/platform/imx-keypad/input/input0 ------------[ cut here ]------------ WARNING: at drivers/clk/clk.c:511 __clk_enable+0x98/0xa8() Modules linked in: [<c001a680>] (unwind_backtrace+0x0/0xf4) from [<c002452c>] (warn_slowpath_commo) [<c002452c>] (warn_slowpath_common+0x48/0x60) from [<c0024560>] (warn_slowpath_) [<c0024560>] (warn_slowpath_null+0x1c/0x24) from [<c02c4ec4>] (__clk_enable+0x9) [<c02c4ec4>] (__clk_enable+0x98/0xa8) from [<c02c4ef8>] (clk_enable+0x24/0x5c) [<c02c4ef8>] (clk_enable+0x24/0x5c) from [<c027ac6c>] (imx_keypad_open+0x28/0xc) [<c027ac6c>] (imx_keypad_open+0x28/0xc8) from [<c0274b14>] (input_open_device+0) [<c0274b14>] (input_open_device+0x78/0xa8) from [<c01ec884>] (kbd_connect+0x60/) [<c01ec884>] (kbd_connect+0x60/0x80) from [<c0273b94>] (input_attach_handler+0x) [<c0273b94>] (input_attach_handler+0x220/0x258) from [<c02755d4>] (input_regist) [<c02755d4>] (input_register_device+0x31c/0x390) from [<c038da1c>] (imx_keypad_) [<c038da1c>] (imx_keypad_probe+0x2e4/0x3b8) from [<c020326c>] (platform_drv_pro) [<c020326c>] (platform_drv_probe+0x18/0x1c) from [<c0201f64>] (driver_probe_dev) [<c0201f64>] (driver_probe_device+0x84/0x210) from [<c020217c>] (__driver_attac) [<c020217c>] (__driver_attach+0x8c/0x90) from [<c02008f8>] (bus_for_each_dev+0x) [<c02008f8>] (bus_for_each_dev+0x68/0x90) from [<c0201064>] (bus_add_driver+0xa) [<c0201064>] (bus_add_driver+0xa4/0x23c) from [<c020275c>] (driver_register+0x7) [<c020275c>] (driver_register+0x78/0x12c) from [<c00087c0>] (do_one_initcall+0x) [<c00087c0>] (do_one_initcall+0x34/0x188) from [<c04b9310>] (kernel_init+0xe4/0) [<c04b9310>] (kernel_init+0xe4/0x1a8) from [<c0015bd8>] (kernel_thread_exit+0x0) ---[ end trace 1d550e891d03d7ce ]--- Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-05-10Input: matrix-keymap - uninline and prepare for device tree supportDmitry Torokhov1-7/+10
Change matrix-keymap helper to be out-of-line, like sparse keymap, allow the helper perform basic keymap validation and return errors, and prepare for device tree support. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-11-30Input: keyboard - use macro module_platform_driver()JJ Ding1-13/+1
Commit 940ab88962bc1aff3273a8356d64577a6e386736 introduced a new macro to save some platform_driver boilerplate code. Use it. Signed-off-by: JJ Ding <dgdunix@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-10-12Input: imx_keypad - add pm suspend and resume supportHui Wang1-0/+44
The imx_keypad driver was indicating that it was wakeup capable in imx_keypad_probe(), but it didn't implement suspend or resume methods. According to the i.MX series MCU Reference Manual, the kpp (keypad port) is a major wake up source which can detect any key press even in low power mode and even when there is no clock. Signed-off-by: Hui Wang <jason77.wang@gmail.com> Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-09-07Input: remove IRQF_DISABLED from driversYong Zhang1-1/+1
This flag is a NOOP and can be removed now. Signed-off-by: Yong Zhang <yong.zhang0@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo1-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>
2010-01-31Input: add imx-keypad driver to support the IMX Keypad PortAlberto Panizzo1-0/+594
The IMX family of Application Processors is shipped with a Keypad Port supported by this driver. The peripheral can control up to an 8x8 matrix key pad where all the scanning is done via software. The hardware provides two interrupts: one for key presses (KDI) and one for all key releases (KRI). There is also a simple circuit for glitch reduction (said for synchronization) made by two series of 3 D-latches clocked by the keypad-clock that stabilize the interrupts sources. KDI and KRI are fired only if the respective conditions are maintained for at last 4 keypad-clock cycle. Since those circuits are poor for a correct debounce process (the keypad-clock frequency is 32K and bounces longer than 94us are not masked) the driver, when an interrupt arrives, samples the matrix with a period of 10ms until the readins are stable for IMX_KEYPAD_SCANS_FOR_STABILITY times (currently set at 3). After getting stable result appropriate events are sent through the input stack. If some keys are maintained pressed, the driver continues to scan the matrix with a longer period (60ms) to catch possible multiple key presses without overloading the cpu. This process ends when all keys are released. This driver is tested to build in kernel or as a module and follow the specification of Freescale Application processors: i.MX25 i.MX27 i.MX31 i.MX35 i.MX51 especially tested on i.MX31. Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>