Input: twl6040: Simplify vibra regsiter definitions
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Wed, 12 Oct 2011 08:57:53 +0000 (11:57 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 12 Oct 2011 10:48:35 +0000 (11:48 +0100)
The bits within the two control registers (for left and right channel)
are identical.
Use common names for the bits acros the two register.
Also add the missing definition for the path selection bit.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/input/misc/twl6040-vibra.c
include/linux/mfd/twl6040.h

index 154b7a324d671fa949bf49219b98c997cb3442d3..cb741858229a9d2fff2337fe910c2d61739f3c40 100644 (file)
@@ -74,12 +74,12 @@ static irqreturn_t twl6040_vib_irq_handler(int irq, void *data)
        if (status & TWL6040_VIBLOCDET) {
                dev_warn(info->dev, "Left Vibrator overcurrent detected\n");
                twl6040_clear_bits(twl6040, TWL6040_REG_VIBCTLL,
-                                  TWL6040_VIBENAL);
+                                  TWL6040_VIBENA);
        }
        if (status & TWL6040_VIBROCDET) {
                dev_warn(info->dev, "Right Vibrator overcurrent detected\n");
                twl6040_clear_bits(twl6040, TWL6040_REG_VIBCTLR,
-                                  TWL6040_VIBENAR);
+                                  TWL6040_VIBENA);
        }
 
        return IRQ_HANDLED;
@@ -104,16 +104,16 @@ static void twl6040_vibra_enable(struct vibra_info *info)
                 * overcurrent detection
                 */
                twl6040_reg_write(twl6040, TWL6040_REG_VIBCTLL,
-                                 TWL6040_VIBENAL | TWL6040_VIBCTRLL);
+                                 TWL6040_VIBENA | TWL6040_VIBCTRL);
                twl6040_reg_write(twl6040, TWL6040_REG_VIBCTLR,
-                                 TWL6040_VIBENAR | TWL6040_VIBCTRLR);
+                                 TWL6040_VIBENA | TWL6040_VIBCTRL);
                usleep_range(3000, 3500);
        }
 
        twl6040_reg_write(twl6040, TWL6040_REG_VIBCTLL,
-                         TWL6040_VIBENAL);
+                         TWL6040_VIBENA);
        twl6040_reg_write(twl6040, TWL6040_REG_VIBCTLR,
-                         TWL6040_VIBENAR);
+                         TWL6040_VIBENA);
 
        info->enabled = true;
 }
index d9e05eabef33a2104f9f268406a5843d3df8d16e..e6c755db456061d358f224599eb22118717951ca 100644 (file)
 #define TWL6040_HSDACMODE              (1 << 1)
 #define TWL6040_HSDRVMODE              (1 << 3)
 
-/* VIBCTLL (0x18) fields */
+/* VIBCTLL/R (0x18/0x1A) fields */
 
-#define TWL6040_VIBENAL                        0x01
-#define TWL6040_VIBCTRLL               0x04
-#define TWL6040_VIBCTRLLP              0x08
-#define TWL6040_VIBCTRLLN              0x10
+#define TWL6040_VIBENA                 (1 << 0)
+#define TWL6040_VIBSEL                 (1 << 1)
+#define TWL6040_VIBCTRL                        (1 << 2)
+#define TWL6040_VIBCTRL_P              (1 << 3)
+#define TWL6040_VIBCTRL_N              (1 << 4)
 
-/* VIBDATL (0x19) fields */
+/* VIBDATL/R (0x19/0x1B) fields */
 
 #define TWL6040_VIBDAT_MAX             0x64
 
-/* VIBCTLR (0x1A) fields */
-
-#define TWL6040_VIBENAR                        0x01
-#define TWL6040_VIBCTRLR               0x04
-#define TWL6040_VIBCTRLRP              0x08
-#define TWL6040_VIBCTRLRN              0x10
-
 /* GPOCTL (0x1E) fields */
 
 #define TWL6040_GPO1                   0x01