From patchwork Fri Dec 9 10:35:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9467823 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 B66E460586 for ; Fri, 9 Dec 2016 10:35:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD2872855B for ; Fri, 9 Dec 2016 10:35:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A205A28577; Fri, 9 Dec 2016 10:35:31 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 49F492855B for ; Fri, 9 Dec 2016 10:35:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753306AbcLIKfa (ORCPT ); Fri, 9 Dec 2016 05:35:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33522 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932349AbcLIKf3 (ORCPT ); Fri, 9 Dec 2016 05:35:29 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92ECCC054908; Fri, 9 Dec 2016 10:35:29 +0000 (UTC) Received: from shalem.localdomain.com (vpn1-6-165.ams2.redhat.com [10.36.6.165]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB9AZNei008389; Fri, 9 Dec 2016 05:35:28 -0500 From: Hans de Goede To: Dmitry Torokhov Cc: "russianneuromancer @ ya . ru" , Gregor Riepl , linux-input@vger.kernel.org, Hans de Goede Subject: [PATCH 4/4] Input: silead_gsl1680: Add support for setting resolution based on dmi data Date: Fri, 9 Dec 2016 11:35:22 +0100 Message-Id: <20161209103522.3833-4-hdegoede@redhat.com> In-Reply-To: <20161209103522.3833-1-hdegoede@redhat.com> References: <20161209103522.3833-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 09 Dec 2016 10:35:29 +0000 (UTC) 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 On ACPI based tablets, the ACPI touchscreen node only contains info on the gpio and the irq, and is missing any info on the axis. This info is expected to be built into the tablet model specific version of the driver shipped with the os-image for the device. Add support for getting the missing info from a table built into the driver, using dmi data to identify which entry of the table to use and add info for the CUBE iwork8 Air tablet on which this code was tested / developed. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=187531 Signed-off-by: Hans de Goede --- drivers/input/touchscreen/silead.c | 51 +++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c index d6593bb..f32b029 100644 --- a/drivers/input/touchscreen/silead.c +++ b/drivers/input/touchscreen/silead.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -87,6 +88,38 @@ struct silead_fw_data { u32 val; }; +#ifdef CONFIG_DMI +struct silead_driver_data { + struct touchscreen_properties prop; + const char *fw_name; + u32 max_fingers; +}; + +static struct silead_driver_data cube_iwork8_air_driver_data = { + .prop = { + .max_x = 1659, + .max_y = 899, + .swap_x_y = true, + }, + .fw_name = "gsl3670-cube-iwork8-air.fw", + .max_fingers = 5, +}; + +static const struct dmi_system_id silead_ts_dmi_table[] = { + { + .ident = "CUBE iwork8 Air", + .driver_data = &cube_iwork8_air_driver_data, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "cube"), + DMI_MATCH(DMI_PRODUCT_NAME, "i1-TF"), + DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), + }, + }, + + { }, +}; +#endif + static int silead_ts_request_input_dev(struct silead_ts_data *data) { struct device *dev = &data->client->dev; @@ -385,11 +418,27 @@ static void silead_ts_read_props(struct i2c_client *client) const char *str; int error; +#ifdef CONFIG_DMI + const struct dmi_system_id *dmi_id; + + dmi_id = dmi_first_match(silead_ts_dmi_table); + if (dmi_id) { + struct silead_driver_data *driver_data = dmi_id->driver_data; + + data->prop = driver_data->prop; + snprintf(data->fw_name, sizeof(data->fw_name), + "silead/%s", driver_data->fw_name); + data->max_fingers = driver_data->max_fingers; + } +#endif + error = device_property_read_u32(dev, "silead,max-fingers", &data->max_fingers); if (error) { dev_dbg(dev, "Max fingers read error %d\n", error); - data->max_fingers = 5; /* Most devices handle up-to 5 fingers */ + /* Most devices handle up-to 5 fingers */ + if (data->max_fingers == 0) + data->max_fingers = 5; } error = device_property_read_string(dev, "firmware-name", &str);