Merge tag 'for-linus-4.3' of git://git.code.sf.net/p/openipmi/linux-ipmi
[firefly-linux-kernel-4.4.55.git] / drivers / input / touchscreen / atmel_mxt_ts.c
index cf66ba1bbf0ca08cc479f2ef9544905066927079..c5622058c22bba77b14ed336b764dc7b1ac6c617 100644 (file)
@@ -938,16 +938,15 @@ static irqreturn_t mxt_process_messages_t44(struct mxt_data *data)
 
        count = data->msg_buf[0];
 
-       if (count == 0) {
-               /*
-                * This condition is caused by the CHG line being configured
-                * in Mode 0. It results in unnecessary I2C operations but it
-                * is benign.
-                */
-               dev_dbg(dev, "Interrupt triggered but zero messages\n");
+       /*
+        * This condition may be caused by the CHG line being configured in
+        * Mode 0. It results in unnecessary I2C operations but it is benign.
+        */
+       if (count == 0)
                return IRQ_NONE;
-       } else if (count > data->max_reportid) {
-               dev_err(dev, "T44 count %d exceeded max report id\n", count);
+
+       if (count > data->max_reportid) {
+               dev_warn(dev, "T44 count %d exceeded max report id\n", count);
                count = data->max_reportid;
        }
 
@@ -1098,7 +1097,9 @@ static int mxt_soft_reset(struct mxt_data *data)
        struct device *dev = &data->client->dev;
        int ret = 0;
 
-       dev_info(dev, "Resetting chip\n");
+       dev_info(dev, "Resetting device\n");
+
+       disable_irq(data->irq);
 
        reinit_completion(&data->reset_completion);
 
@@ -1106,6 +1107,11 @@ static int mxt_soft_reset(struct mxt_data *data)
        if (ret)
                return ret;
 
+       /* Ignore CHG line for 100ms after reset */
+       msleep(100);
+
+       enable_irq(data->irq);
+
        ret = mxt_wait_for_completion(data, &data->reset_completion,
                                      MXT_RESET_TIMEOUT);
        if (ret)
@@ -1851,6 +1857,8 @@ static int mxt_initialize_input_device(struct mxt_data *data)
        if (pdata->t19_num_keys) {
                mxt_set_up_as_touchpad(input_dev, data);
                mt_flags |= INPUT_MT_POINTER;
+       } else {
+               mt_flags |= INPUT_MT_DIRECT;
        }
 
        /* For multi touch */
@@ -2409,19 +2417,18 @@ static void mxt_input_close(struct input_dev *dev)
 static const struct mxt_platform_data *mxt_parse_dt(struct i2c_client *client)
 {
        struct mxt_platform_data *pdata;
+       struct device_node *np = client->dev.of_node;
        u32 *keymap;
-       u32 keycode;
-       int proplen, i, ret;
+       int proplen, ret;
 
-       if (!client->dev.of_node)
+       if (!np)
                return ERR_PTR(-ENOENT);
 
        pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
        if (!pdata)
                return ERR_PTR(-ENOMEM);
 
-       if (of_find_property(client->dev.of_node, "linux,gpio-keymap",
-                            &proplen)) {
+       if (of_find_property(np, "linux,gpio-keymap", &proplen)) {
                pdata->t19_num_keys = proplen / sizeof(u32);
 
                keymap = devm_kzalloc(&client->dev,
@@ -2430,14 +2437,11 @@ static const struct mxt_platform_data *mxt_parse_dt(struct i2c_client *client)
                if (!keymap)
                        return ERR_PTR(-ENOMEM);
 
-               for (i = 0; i < pdata->t19_num_keys; i++) {
-                       ret = of_property_read_u32_index(client->dev.of_node,
-                                       "linux,gpio-keymap", i, &keycode);
-                       if (ret)
-                               keycode = KEY_RESERVED;
-
-                       keymap[i] = keycode;
-               }
+               ret = of_property_read_u32_array(np, "linux,gpio-keymap",
+                                                keymap, pdata->t19_num_keys);
+               if (ret)
+                       dev_warn(&client->dev,
+                                "Couldn't read linux,gpio-keymap: %d\n", ret);
 
                pdata->t19_keymap = keymap;
        }