Merge branches 'for-4.4/upstream-fixes', 'for-4.5/async-suspend', 'for-4.5/container...
[cascardo/linux.git] / drivers / hid / hid-multitouch.c
index 96cf751..296d499 100644 (file)
@@ -357,8 +357,19 @@ static void mt_feature_mapping(struct hid_device *hdev,
                        break;
                }
 
-               td->inputmode = field->report->id;
-               td->inputmode_index = usage->usage_index;
+               if (td->inputmode < 0) {
+                       td->inputmode = field->report->id;
+                       td->inputmode_index = usage->usage_index;
+               } else {
+                       /*
+                        * Some elan panels wrongly declare 2 input mode
+                        * features, and silently ignore when we set the
+                        * value in the second field. Skip the second feature
+                        * and hope for the best.
+                        */
+                       dev_info(&hdev->dev,
+                                "Ignoring the extra HID_DG_INPUTMODE\n");
+               }
 
                break;
        case HID_DG_CONTACTMAX:
@@ -486,6 +497,11 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
                        mt_store_field(usage, td, hi);
                        return 1;
                case HID_DG_CONFIDENCE:
+                       if (cls->name == MT_CLS_WIN_8 &&
+                               field->application == HID_DG_TOUCHPAD) {
+                               cls->quirks &= ~MT_QUIRK_ALWAYS_VALID;
+                               cls->quirks |= MT_QUIRK_VALID_IS_CONFIDENCE;
+                       }
                        mt_store_field(usage, td, hi);
                        return 1;
                case HID_DG_TIPSWITCH: