Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: omap4-keypad - react on keypresses if device is runtime-suspended

According to SWPU235AB, table 26-6, fclk is required to generate events
at least on OMAP4460, so keep fclk enabled all the time the device
is opened.

Suggested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20231211221757.517427-1-andreas@kemnade.info
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Andreas Kemnade and committed by
Dmitry Torokhov
02db1749 90948416

+14 -1
+14 -1
drivers/input/keyboard/omap4-keypad.c
··· 11 11 #include <linux/module.h> 12 12 #include <linux/interrupt.h> 13 13 #include <linux/platform_device.h> 14 + #include <linux/clk.h> 14 15 #include <linux/errno.h> 15 16 #include <linux/io.h> 16 17 #include <linux/of.h> ··· 84 83 bool no_autorepeat; 85 84 u64 keys; 86 85 unsigned short *keymap; 86 + struct clk *fck; 87 87 }; 88 88 89 89 static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset) ··· 211 209 if (error) 212 210 return error; 213 211 212 + error = clk_prepare_enable(keypad_data->fck); 213 + if (error) 214 + goto out; 215 + 214 216 disable_irq(keypad_data->irq); 215 217 216 218 kbd_writel(keypad_data, OMAP4_KBD_CTRL, ··· 232 226 233 227 enable_irq(keypad_data->irq); 234 228 229 + out: 235 230 pm_runtime_mark_last_busy(dev); 236 231 pm_runtime_put_autosuspend(dev); 237 232 238 - return 0; 233 + return error; 239 234 } 240 235 241 236 static void omap4_keypad_stop(struct omap4_keypad *keypad_data) ··· 265 258 disable_irq(keypad_data->irq); 266 259 omap4_keypad_stop(keypad_data); 267 260 enable_irq(keypad_data->irq); 261 + clk_disable_unprepare(keypad_data->fck); 268 262 269 263 pm_runtime_mark_last_busy(dev); 270 264 pm_runtime_put_autosuspend(dev); ··· 364 356 } 365 357 366 358 keypad_data->irq = irq; 359 + keypad_data->fck = devm_clk_get(&pdev->dev, "fck"); 360 + if (IS_ERR(keypad_data->fck)) 361 + return dev_err_probe(&pdev->dev, PTR_ERR(keypad_data->fck), 362 + "unable to get fck"); 363 + 367 364 mutex_init(&keypad_data->lock); 368 365 platform_set_drvdata(pdev, keypad_data); 369 366