From patchwork Tue Oct 29 07:19:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Jiada" X-Patchwork-Id: 11217335 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 91D0B14E5 for ; Tue, 29 Oct 2019 07:20:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78F7520873 for ; Tue, 29 Oct 2019 07:20:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729311AbfJ2HUl (ORCPT ); Tue, 29 Oct 2019 03:20:41 -0400 Received: from esa1.mentor.iphmx.com ([68.232.129.153]:7764 "EHLO esa1.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729002AbfJ2HUl (ORCPT ); Tue, 29 Oct 2019 03:20:41 -0400 IronPort-SDR: 5/UF42y0brs2wjpZHCgqMWOUPtjPx0NIdOdVH8p0J63wxRSfN0/pylUQWSrjBXeq7Z6irLA7Vo R4HeBqZTM1pOKzOoIpi6YWwspw9LxAXoLVVWIU7wtjF8OD8pKWc7ffh1GkTK355n4qjlhppRLz nINHGdTK0ejs1vBZ0ID3ki7Al904PrmCKrle4wVMnl108xxRQ2Q3EKr5Z+I9wGEoye3pc99Vfn PABKa9oZ2S3xo+yEco6YifHRv0EwU9BlQPsacoYxeNIjr+eei2+eT+tK5EbjnKXrAI1XeGVaAA Zj0= X-IronPort-AV: E=Sophos;i="5.68,243,1569312000"; d="scan'208";a="44509369" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 28 Oct 2019 23:20:40 -0800 IronPort-SDR: Cy5wmo0Da81RxDxKAlFDhOTZabZnX0cte15c6YoXllmQvGjEDVw7TkkS2nXC0H91ckefns+t53 HDitZAcmtwvV2pgy5Om6xXxZJvZ8peQO15drAJupwQmUV/dWKZBugyJjGaZ9lQxw4UzdPmKQSt wd0DEt4vQWymzTZECGuDcGzuqJP6FaWxvUHtjvaSssFq1unEZWNwOtyYxRCuqP+PJ/8jIuYil5 FXzNFTYdXHssx4n8jpH66WyQrbQTPGmcs+dMGZVJQ0EIGvnYwVJQBlbKfYZ+jiUVPkH4Sg7IKV AJ4= From: Jiada Wang To: , , , CC: , , , , Subject: [PATCH v4 07/48] Input: atmel_mxt_ts - implement T9 vector/orientation support Date: Tue, 29 Oct 2019 16:19:29 +0900 Message-ID: <20191029072010.8492-8-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191029072010.8492-1-jiada_wang@mentor.com> References: <20191029072010.8492-1-jiada_wang@mentor.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Nick Dyer The atmel touch messages contain orientation information as a byte in a packed format which can be passed straight on to Android if the input device configuration is correct. This requires vector reports to be enabled in maXTouch config (zero DISVECT bit 3 in T9 CTRL field) Android converts the format in InputReader.cpp, search for ORIENTATION_CALIBRATION_VECTOR. Signed-off-by: Nick Dyer Acked-by: Benson Leung Acked-by: Yufeng Shen (cherry picked from ndyer/linux/for-upstream commit a6f0ee919d2631678169b23fb18f55b6dbabcd4c) Signed-off-by: George G. Davis Signed-off-by: Jiada Wang --- drivers/input/touchscreen/atmel_mxt_ts.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 4e0dae004927..405bff1c2055 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -817,6 +817,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) int y; int area; int amplitude; + u8 vector; id = message[0] - data->T9_reportid_min; status = message[1]; @@ -831,9 +832,10 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) area = message[5]; amplitude = message[6]; + vector = message[7]; dev_dbg(dev, - "[%u] %c%c%c%c%c%c%c%c x: %5u y: %5u area: %3u amp: %3u\n", + "[%u] %c%c%c%c%c%c%c%c x: %5u y: %5u area: %3u amp: %3u vector: %02X\n", id, (status & MXT_T9_DETECT) ? 'D' : '.', (status & MXT_T9_PRESS) ? 'P' : '.', @@ -843,7 +845,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) (status & MXT_T9_AMP) ? 'A' : '.', (status & MXT_T9_SUPPRESS) ? 'S' : '.', (status & MXT_T9_UNGRIP) ? 'U' : '.', - x, y, area, amplitude); + x, y, area, amplitude, vector); input_mt_slot(input_dev, id); @@ -868,6 +870,7 @@ static void mxt_proc_t9_message(struct mxt_data *data, u8 *message) input_report_abs(input_dev, ABS_MT_POSITION_Y, y); input_report_abs(input_dev, ABS_MT_PRESSURE, amplitude); input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area); + input_report_abs(input_dev, ABS_MT_ORIENTATION, vector); } else { /* Touch no longer active, close out slot */ input_mt_report_slot_inactive(input_dev); @@ -2180,8 +2183,9 @@ static int mxt_initialize_input_device(struct mxt_data *data) 0, 255, 0, 0); } - if (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && - data->t100_aux_vect) { + if (data->multitouch == MXT_TOUCH_MULTI_T9 || + (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && + data->t100_aux_vect)) { input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 255, 0, 0); }