]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
CHROMIUM: Input: atmel_mxt_ts: Use correct max touch_major in mxt_release_all_fingers()
authorYufeng Shen <miletus@chromium.org>
Thu, 10 Jan 2013 20:00:42 +0000 (15:00 -0500)
committerYufeng Shen <miletus@chromium.org>
Thu, 17 Jan 2013 21:54:29 +0000 (13:54 -0800)
We hard-coded the maximal touch_major value to be 255 in mxt_release_all_fingers().
Fixing this by using the queried actual maximal touch_major value.

Signed-off-by: Yufeng Shen <miletus@chromium.org>
BUG=chrome-os-partner:17176
TEST=1. Run evtest on the touch device
     2. Keep touching the device while closing the lid.
     3. Release the touch after the system suspends.
     4. Open the lid to resume the system
     5. Check evtest result and see that there is release events with correct
        touch major value.

Change-Id: I4c3bbb37c25c0df67c752a8b6943f6c127f01aa7
Reviewed-on: https://gerrit.chromium.org/gerrit/41031
Reviewed-by: Benson Leung <bleung@chromium.org>
Commit-Queue: Yufeng Shen <miletus@chromium.org>
Tested-by: Yufeng Shen <miletus@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41567
Reviewed-by: Yufeng Shen <miletus@chromium.org>
drivers/input/touchscreen/atmel_mxt_ts.c

index 365f20ab14cb19c3b68b8d001d86b78f64725a8a..9362bd39fce0383571ce2a2d3f96c2c519eb006c 100644 (file)
@@ -384,6 +384,7 @@ static struct dentry *mxt_debugfs_root;
 
 static int mxt_initialize(struct mxt_data *data);
 static int mxt_input_dev_create(struct mxt_data *data);
+static int get_touch_major_pixels(struct mxt_data *data, int touch_channels);
 
 static bool mxt_object_readable(unsigned int type)
 {
@@ -482,6 +483,8 @@ static void mxt_release_all_fingers(struct mxt_data *data)
        struct device *dev = &data->client->dev;
        struct input_dev *input_dev = data->input_dev;
        int id;
+       int max_area_channels = min(255U, data->max_area_channels);
+       int max_touch_major = get_touch_major_pixels(data, max_area_channels);
        bool need_update = false;
        for (id = 0; id < MXT_MAX_FINGER; id++) {
                if (data->current_id[id]) {
@@ -492,7 +495,8 @@ static void mxt_release_all_fingers(struct mxt_data *data)
                        input_report_abs(input_dev, ABS_MT_POSITION_X, 0);
                        input_report_abs(input_dev, ABS_MT_POSITION_Y, 0);
                        input_report_abs(input_dev, ABS_MT_PRESSURE, 255);
-                       input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, 255);
+                       input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR,
+                                        max_touch_major);
                        need_update = true;
                }
        }