Input: omap-keypad - use bitfiled instead of hardcoded values
authorIllia Smyrnov <illia.smyrnov@ti.com>
Mon, 26 Aug 2013 06:25:18 +0000 (23:25 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 26 Aug 2013 07:15:43 +0000 (00:15 -0700)
Use bitfiled instead of hardcoded values to set KBD_CTRL, use BIT macro,
remove unused defines.

Signed-off-by: Illia Smyrnov <illia.smyrnov@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/keyboard/omap4-keypad.c

index f4aa53a1fd69bb70f0e680e95688e251f355f1e9..c7275481a74e93ffbcf5a323d0c24ae0d4fe2312 100644 (file)
 #define OMAP4_KBD_FULLCODE63_32                0x48
 
 /* OMAP4 bit definitions */
-#define OMAP4_DEF_IRQENABLE_EVENTEN    (1 << 0)
-#define OMAP4_DEF_IRQENABLE_LONGKEY    (1 << 1)
-#define OMAP4_DEF_IRQENABLE_TIMEOUTEN  (1 << 2)
-#define OMAP4_DEF_WUP_EVENT_ENA                (1 << 0)
-#define OMAP4_DEF_WUP_LONG_KEY_ENA     (1 << 1)
-#define OMAP4_DEF_CTRL_NOSOFTMODE      (1 << 1)
-#define OMAP4_DEF_CTRLPTVVALUE         (1 << 2)
-#define OMAP4_DEF_CTRLPTV              (1 << 1)
+#define OMAP4_DEF_IRQENABLE_EVENTEN    BIT(0)
+#define OMAP4_DEF_IRQENABLE_LONGKEY    BIT(1)
+#define OMAP4_DEF_WUP_EVENT_ENA                BIT(0)
+#define OMAP4_DEF_WUP_LONG_KEY_ENA     BIT(1)
+#define OMAP4_DEF_CTRL_NOSOFTMODE      BIT(1)
+#define OMAP4_DEF_CTRL_PTV_SHIFT       2
 
 /* OMAP4 values */
-#define OMAP4_VAL_IRQDISABLE           0x00
-#define OMAP4_VAL_DEBOUNCINGTIME       0x07
-#define OMAP4_VAL_FUNCTIONALCFG                0x1E
-
-#define OMAP4_MASK_IRQSTATUSDISABLE    0xFFFF
+#define OMAP4_VAL_IRQDISABLE           0x0
+#define OMAP4_VAL_DEBOUNCINGTIME       0x7
+#define OMAP4_VAL_PVT                  0x7
 
 enum {
        KBD_REVISION_OMAP4 = 0,
@@ -175,7 +171,8 @@ static int omap4_keypad_open(struct input_dev *input)
        disable_irq(keypad_data->irq);
 
        kbd_writel(keypad_data, OMAP4_KBD_CTRL,
-                       OMAP4_VAL_FUNCTIONALCFG);
+                       OMAP4_DEF_CTRL_NOSOFTMODE |
+                       (OMAP4_VAL_PVT << OMAP4_DEF_CTRL_PTV_SHIFT));
        kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,
                        OMAP4_VAL_DEBOUNCINGTIME);
        kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,