Input: cap11xx - support for irq-active-high option
authorMatt Ranostay <mranostay@gmail.com>
Sat, 1 Nov 2014 03:02:08 +0000 (20:02 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 2 Nov 2014 07:09:11 +0000 (00:09 -0700)
Some applications need to use the irq-active-high push-pull option.
This allows it be enabled in the device tree child node.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Reviewed-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Documentation/devicetree/bindings/input/cap11xx.txt
drivers/input/keyboard/cap11xx.c

index 61d20d8d97e2b4e67bb71095d277af2802e8747e..7d0a3009771b92c2e9e43c310d4f6140e78c02f6 100644 (file)
@@ -28,6 +28,10 @@ Optional properties:
                                Valid values are 1, 2, 4, and 8.
                                By default, a gain of 1 is set.
 
+       microchip,irq-active-high:      By default the interrupt pin is active low
+                               open drain. This property allows using the active
+                               high push-pull output.
+
        linux,keycodes:         Specifies an array of numeric keycode values to
                                be used for the channels. If this property is
                                omitted, KEY_A, KEY_B, etc are used as
index eeda1f9359cdc3d9aeb78bccd6dd428d4bb8656c..4f59f0bab28f922103cbdad85febee7b8a997992 100644 (file)
@@ -45,6 +45,7 @@
 #define CAP11XX_REG_STANDBY_SENSITIVITY        0x42
 #define CAP11XX_REG_STANDBY_THRESH     0x43
 #define CAP11XX_REG_CONFIG2            0x44
+#define CAP11XX_REG_CONFIG2_ALT_POL    BIT(6)
 #define CAP11XX_REG_SENSOR_BASE_CNT(X) (0x50 + (X))
 #define CAP11XX_REG_SENSOR_CALIB       (0xb1 + (X))
 #define CAP11XX_REG_SENSOR_CALIB_LSB1  0xb9
@@ -263,6 +264,13 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
                        dev_err(dev, "Invalid sensor-gain value %d\n", gain32);
        }
 
+       if (of_property_read_bool(node, "microchip,irq-active-high")) {
+               error = regmap_update_bits(priv->regmap, CAP11XX_REG_CONFIG2,
+                                          CAP11XX_REG_CONFIG2_ALT_POL, 0);
+               if (error)
+                       return error;
+       }
+
        /* Provide some useful defaults */
        for (i = 0; i < cap->num_channels; i++)
                priv->keycodes[i] = KEY_A + i;