From patchwork Mon Jul 20 15:45:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastien Nocera X-Patchwork-Id: 6829171 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 75CCA9F38B for ; Mon, 20 Jul 2015 16:10:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9EAAA2062A for ; Mon, 20 Jul 2015 16:10:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B97DD20626 for ; Mon, 20 Jul 2015 16:10:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754032AbbGTQKn (ORCPT ); Mon, 20 Jul 2015 12:10:43 -0400 Received: from slow1-d.mail.gandi.net ([217.70.178.86]:56058 "EHLO slow1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751052AbbGTQKn (ORCPT ); Mon, 20 Jul 2015 12:10:43 -0400 X-Greylist: delayed 1103 seconds by postgrey-1.27 at vger.kernel.org; Mon, 20 Jul 2015 12:10:43 EDT Received: from mrelay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by slow1-d.mail.gandi.net (Postfix) with ESMTP id 6633947AD58 for ; Mon, 20 Jul 2015 17:47:00 +0200 (CEST) Received: from mfilter17-d.gandi.net (mfilter17-d.gandi.net [217.70.178.145]) by mrelay2-d.mail.gandi.net (Postfix) with ESMTP id D766BC5A43; Mon, 20 Jul 2015 17:46:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter17-d.gandi.net Received: from mrelay2-d.mail.gandi.net ([217.70.183.194]) by mfilter17-d.gandi.net (mfilter17-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id DBuWY8ldygPn; Mon, 20 Jul 2015 17:46:56 +0200 (CEST) X-Originating-IP: 83.155.44.161 Received: from nuvo (mon69-7-83-155-44-161.fbx.proxad.net [83.155.44.161]) (Authenticated sender: hadess@hadess.net) by mrelay2-d.mail.gandi.net (Postfix) with ESMTPSA id 60CEDC5A50; Mon, 20 Jul 2015 17:46:54 +0200 (CEST) Message-ID: <1437407136.30706.21.camel@hadess.net> Subject: [PATCH] Input: goodix - Fix touch coords on WinBook TW100 From: Bastien Nocera To: Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 20 Jul 2015 17:45:36 +0200 X-Mailer: Evolution 3.16.3 (3.16.3-2.fc22) Mime-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The touchscreen on the WinBook TW100 doesn't match the default display, with 0,0 touches being reported when touching at the bottom right of the screen. 1280,800 0,800 +-------------+ | | | | | | +-------------+ 1280,0 0,0 It's unfortunately impossible to detect this problem with data from the DSDT, or other auxiliary metadata, so fallback to quirking this specific model of tablet instead. Signed-off-by: Bastien Nocera Reviewed-by: Benjamin Tissoires --- drivers/input/touchscreen/goodix.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index b4d12e2..6f56ef9 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -34,6 +35,7 @@ struct goodix_ts_data { int abs_y_max; unsigned int max_touch_num; unsigned int int_trigger_type; + bool rotated_screen; }; #define GOODIX_MAX_HEIGHT 4096 @@ -60,6 +62,19 @@ static const unsigned long goodix_irq_flags[] = { IRQ_TYPE_LEVEL_HIGH, }; +/* Those tablets have their coords origin at the bottom right + * of the tablet, as if rotated 180 degrees */ +static const struct dmi_system_id rotated_screen[] = { + { + .ident = "Winbook TW100", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "WinBook"), + DMI_MATCH(DMI_PRODUCT_NAME, "TW100") + }, + }, + {} +}; + /** * goodix_i2c_read - read data from a register of the i2c slave device. * @@ -129,6 +144,11 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) int input_y = get_unaligned_le16(&coor_data[3]); int input_w = get_unaligned_le16(&coor_data[5]); + if (ts->rotated_screen) { + input_x = ts->abs_x_max - input_x; + input_y = ts->abs_y_max - input_y; + } + input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); @@ -223,6 +243,12 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->abs_y_max = GOODIX_MAX_HEIGHT; ts->max_touch_num = GOODIX_MAX_CONTACTS; } + + ts->rotated_screen = dmi_check_system(rotated_screen); + if (ts->rotated_screen) { + dev_dbg(&ts->client->dev, + "Applying '180 degrees rotated screen' quirk\n"); + } } /**