From patchwork Wed Oct 4 19:35:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Renner Berthing X-Patchwork-Id: 9985427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24A6E602B8 for ; Wed, 4 Oct 2017 19:36:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14F8528B30 for ; Wed, 4 Oct 2017 19:36:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 091D828BE0; Wed, 4 Oct 2017 19:36:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID, URIBL_BLACK autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49F1428B30 for ; Wed, 4 Oct 2017 19:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750787AbdJDTgd (ORCPT ); Wed, 4 Oct 2017 15:36:33 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:50064 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750779AbdJDTgc (ORCPT ); Wed, 4 Oct 2017 15:36:32 -0400 Received: by mail-lf0-f66.google.com with SMTP id c82so10769483lfc.6; Wed, 04 Oct 2017 12:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=TKY0lp8U8bNzNnDqdNakRt5+LE3Do5RcKFFBsFs+ucc=; b=jtI30MXHe0tLbYGF46e8Ko7XhAcjVA9mBzqbtO5oN4sKviystUhQbT5n79kOmSz9FG xQ9MLoiTTXHXBXYM15y15NUZG3Uz7j+ZDZEHePoc0ntRbHapKvwlXeYLSye1ua8LZpNf +QHnf0+UeF/5daExWHctFmsjzJes/08y3F1y5yFaVZSFmn5WcoK1ytqfUAV8DjcD5uTu QgHYzheItAWL/wL5cHBN7/FstQ99ivsxI4mRtzlDo0qwnyGKricmYOmksBm1f/VnnKak 2jqKW5T/ObMZt8xZvH/K8EjrFAKTEzI1E4iQivl8hPBqLeYqtqQF6s5DKyVbwRtaCGHr lWrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=TKY0lp8U8bNzNnDqdNakRt5+LE3Do5RcKFFBsFs+ucc=; b=kMpMghUdmDGADYnUNRbYqDga9VGTOr0/KvdZtUAu5r2vtkmVRt5lL4twd8NA3YUgW0 My/9SR7sLG/Z3gZfdUrWeMFhAUCtI4qtWJx4+UWCDZXeetVArmOAsEpMG9+h8STVis2c BfoEGCg3Q5htI3dgCtkIPQj6Np6haq3LDGiBtLlfTM78bJPYKgq8Hw/ou6JEQMzHDAfP 55w3NzCiU+AvDRqifqjnqHGopDCNNAQnH85zPpvcpBLRo5Xht91EBiPbHAtnGbmz8Ew+ +j11PidevDkIhPzK/DPAhr3EOy2b+/q5JFGMqbSEFnOry3QuE/WwF3SwbfyJHnSQ7SrY dJqw== X-Gm-Message-State: AMCzsaVan9Y4T7N3ZuITNnY/wMlIgqxH21+UtM1Xruh/On3IdTwlihUR PwE1FPQHeVPbskJDRG22cAc= X-Google-Smtp-Source: AOwi7QAv5PrJVIsmH20YRu3W+BlJv9aH+0MIemrWytEX7EM3yQ7fl3f0vi277VmCZ+COo0FWQ52Jag== X-Received: by 10.25.23.165 with SMTP id 37mr2907068lfx.202.1507145790643; Wed, 04 Oct 2017 12:36:30 -0700 (PDT) Received: from localhost.localdomain (0173002341.0.fullrate.ninja. [90.184.117.6]) by smtp.gmail.com with ESMTPSA id 1sm3582703ljp.29.2017.10.04.12.36.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 12:36:29 -0700 (PDT) From: Emil Renner Berthing To: Nick Dyer Cc: Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Emil Renner Berthing Subject: [PATCH] input: atmel_mxt_ts: detect touchpad from devicetree Date: Wed, 4 Oct 2017 21:35:31 +0200 Message-Id: <20171004193531.9038-1-kernel@esmil.dk> X-Mailer: git-send-email 2.14.2 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The Samsung Chromebook Plus (rk3399-gru-kevin) has two of these controllers. One for the touchscreen and one for the touchpad. However the touchpad doesn't have any associated gpio buttons, so it shows up as another touchscreen. This patch fixes it by matching the "atmel,atmel_mxt_tp" compatibility string in the device tree. Signed-off-by: Emil Renner Berthing Reviewed-by: Nick Dyer --- drivers/input/touchscreen/atmel_mxt_ts.c | 8 ++++++-- include/linux/platform_data/atmel_mxt_ts.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 7659bc48f1db..4ea06f447d15 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -1945,8 +1945,7 @@ static int mxt_initialize_input_device(struct mxt_data *data) input_set_abs_params(input_dev, ABS_PRESSURE, 0, 255, 0, 0); } - /* If device has buttons we assume it is a touchpad */ - if (pdata->t19_num_keys) { + if (pdata->touchpad) { mxt_set_up_as_touchpad(input_dev, data); mt_flags |= INPUT_MT_POINTER; } else { @@ -2936,6 +2935,9 @@ static const struct mxt_platform_data *mxt_parse_dt(struct i2c_client *client) if (!pdata) return ERR_PTR(-ENOMEM); + if (of_device_is_compatible(np, "atmel,atmel_mxt_tp")) + pdata->touchpad = true; + if (of_find_property(np, "linux,gpio-keymap", &proplen)) { pdata->t19_num_keys = proplen / sizeof(u32); @@ -2986,6 +2988,7 @@ static struct mxt_acpi_platform_data samus_platform_data[] = { .pdata = { .t19_num_keys = ARRAY_SIZE(samus_touchpad_buttons), .t19_keymap = samus_touchpad_buttons, + .touchpad = true, }, }, { @@ -3011,6 +3014,7 @@ static struct mxt_acpi_platform_data chromebook_platform_data[] = { .pdata = { .t19_num_keys = ARRAY_SIZE(chromebook_tp_buttons), .t19_keymap = chromebook_tp_buttons, + .touchpad = true, }, }, { diff --git a/include/linux/platform_data/atmel_mxt_ts.h b/include/linux/platform_data/atmel_mxt_ts.h index 695035a8d7fb..acb595bba02d 100644 --- a/include/linux/platform_data/atmel_mxt_ts.h +++ b/include/linux/platform_data/atmel_mxt_ts.h @@ -24,6 +24,7 @@ enum mxt_suspend_mode { struct mxt_platform_data { unsigned long irqflags; u8 t19_num_keys; + u8 touchpad; const unsigned int *t19_keymap; enum mxt_suspend_mode suspend_mode; };