From patchwork Tue Nov 12 16:44:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Van Asbroeck X-Patchwork-Id: 11239793 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 CED0E15AB for ; Tue, 12 Nov 2019 16:44:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF72921872 for ; Tue, 12 Nov 2019 16:44:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YOQJdU9i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726388AbfKLQo4 (ORCPT ); Tue, 12 Nov 2019 11:44:56 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:37393 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbfKLQoz (ORCPT ); Tue, 12 Nov 2019 11:44:55 -0500 Received: by mail-qt1-f196.google.com with SMTP id g50so20433284qtb.4; Tue, 12 Nov 2019 08:44:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9PK6Iii1ai1LkK82Hw9G+h5BnDsZJNDqHEqNoavTYJE=; b=YOQJdU9iXybjiq3jIolIh7vTdXvXe/anYmAa+/ybVJZSjPkE82QsdSi4kQVW3B2Vhg iaZ1/NvJ0Df/ahFgkWFzkCakOCwn1IQdqa7Q88Dq/csFy98fKNFaWz4VFayUWk+H735O HqiJ8mYX6WrL4wWhvqB+IaxyX3iW7p/ZSlMEWGr8DJz1ccswWTtskP1FQWCyOsaRrmun gnPcY7UABfS1BWL3sT2Tn5X/ATGJ2/ZqExRQ0bbxR+Tvwq/zDo99r2GmDYY7sRk+1gGR BGCnhFFNQt0WdjljqXiEZJ8o/CLeSJEK0Qq/Y2XU5xg96xGnLtWzvy/kyHg4dd/SBpDH r3Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9PK6Iii1ai1LkK82Hw9G+h5BnDsZJNDqHEqNoavTYJE=; b=Sf+0wEZsIJZQ6u673Tze4tTdW/fMmvJiuEN6ffRILO+081bunYqMaAe+L9jnJYJ+5S 1md+YiH7sUJrKDKwt+QDU7OQ3bNhDJgqSThGA2W0/k2CsEtHltzHSTuDP+3eBfmkjFnD EtGiBKEdxjxKqx59YCbu7WDkM0839WGbe8tWfbJutfcia1qK6X/zS5va6j9jtF/LN27D 9RZ1gTcoOkOXloZvOhxlpGwde7VMFjAHpVu5T2/haJoRcA8hC2YuaTieuQ1LvhJWza8g TSeelkZ4nTJC/kUIN/PZ6L0sWE2qFetaxAlM7m/KNvoR8qKbsTd2XrLoRwCemq18UpuI M7QA== X-Gm-Message-State: APjAAAVK5/CwGDID5XgkgnNo74q2XY3e2pdyZDON6cAhbMSKCqXcT08K lO1O8Ek37n0C16p42rphvTC9EBel X-Google-Smtp-Source: APXvYqwZyENd2jI5gfYm5zky8sOs4MWD5PkctjtBlh6crwLiUXu2OGCqF749lMzPIlQEEQxdwponLQ== X-Received: by 2002:ac8:3168:: with SMTP id h37mr31958767qtb.311.1573577094635; Tue, 12 Nov 2019 08:44:54 -0800 (PST) Received: from localhost.localdomain ([72.53.229.209]) by smtp.gmail.com with ESMTPSA id z5sm10543552qtm.9.2019.11.12.08.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 08:44:54 -0800 (PST) From: Sven Van Asbroeck X-Google-Original-From: Sven Van Asbroeck To: Dmitry Torokhov Cc: Marek Vasut , Adam Ford , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH v1 1/3] Input: ili210x - do not retrieve/print chip firmware version Date: Tue, 12 Nov 2019 11:44:27 -0500 Message-Id: <20191112164429.11225-1-TheSven73@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The driver's method to retrieve the firmware version on ili2117/ ili2118 chip flavours is incorrect. The firmware version register address and layout are wrong. The firmware version is not actually used anywhere inside or outside this driver. There is a dev_dbg() print, but that is only visible when the developer explicitly compiles in debug support. Don't make the code more complicated to preserve a feature that no-one is using. Remove all code associated with chip firmware version. Link: https://lore.kernel.org/lkml/20191111181657.GA57214@dtor-ws/ Cc: Marek Vasut Cc: Adam Ford Cc: Cc: linux-input@vger.kernel.org Tree: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/log/?h=next Signed-off-by: Sven Van Asbroeck --- drivers/input/touchscreen/ili210x.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c index 0ed6014af6d7..a6feae5ce887 100644 --- a/drivers/input/touchscreen/ili210x.c +++ b/drivers/input/touchscreen/ili210x.c @@ -21,15 +21,8 @@ /* Touchscreen commands */ #define REG_TOUCHDATA 0x10 #define REG_PANEL_INFO 0x20 -#define REG_FIRMWARE_VERSION 0x40 #define REG_CALIBRATE 0xcc -struct firmware_version { - u8 id; - u8 major; - u8 minor; -} __packed; - struct ili2xxx_chip { int (*read_reg)(struct i2c_client *client, u8 reg, void *buf, size_t len); @@ -342,7 +335,6 @@ static int ili210x_i2c_probe(struct i2c_client *client, struct ili210x *priv; struct gpio_desc *reset_gpio; struct input_dev *input; - struct firmware_version firmware; int error; dev_dbg(dev, "Probing for ILI210X I2C Touschreen driver"); @@ -389,15 +381,6 @@ static int ili210x_i2c_probe(struct i2c_client *client, priv->chip = chip; i2c_set_clientdata(client, priv); - /* Get firmware version */ - error = chip->read_reg(client, REG_FIRMWARE_VERSION, - &firmware, sizeof(firmware)); - if (error) { - dev_err(dev, "Failed to get firmware version, err: %d\n", - error); - return error; - } - /* Setup input device */ input->name = "ILI210x Touchscreen"; input->id.bustype = BUS_I2C; @@ -439,10 +422,6 @@ static int ili210x_i2c_probe(struct i2c_client *client, return error; } - dev_dbg(dev, - "ILI210x initialized (IRQ: %d), firmware version %d.%d.%d", - client->irq, firmware.id, firmware.major, firmware.minor); - return 0; } From patchwork Tue Nov 12 16:44:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Van Asbroeck X-Patchwork-Id: 11239797 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 CE2821515 for ; Tue, 12 Nov 2019 16:45:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AD66E222BD for ; Tue, 12 Nov 2019 16:45:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ayJbdqQO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727185AbfKLQo5 (ORCPT ); Tue, 12 Nov 2019 11:44:57 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:38993 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbfKLQo4 (ORCPT ); Tue, 12 Nov 2019 11:44:56 -0500 Received: by mail-qt1-f195.google.com with SMTP id t8so20462954qtc.6; Tue, 12 Nov 2019 08:44:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=19EjmRUyqj0e5HAJbsNkVIG9nAhQU55k6g6gflHpzw0=; b=ayJbdqQOs3oVSpfOCN5tFUGspMNiIWcX679UKi3/p979+aG63Fis24QySEs+Ht9IZ8 iLJTviltEJReXD7jNFN+zvflKYpVkWQFkM+RAJ7RIUrwYSY7gX9R5HzWDUlQbi8cJ/f1 KjCjcOyvCCQSVt+SW3/ca9DZrJasxxKO+rgoghRkEIaeVumLk/GkOLF61Mg0AgUjkRx7 X/6/BlbxBI7+cIqJgzrUyJzCbIK58/9h6po2KXfipiuB/ppEquIR1ug7T3kJxLhTpwvj DbKi74VDSOmnLu50pqc4qqpPJjmNdCP+7togX4O8ty/1WZoGhD3W8HXTPT0j8Ni5KmeI gFcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=19EjmRUyqj0e5HAJbsNkVIG9nAhQU55k6g6gflHpzw0=; b=aemoUfYUkXB6rj5c4Fek7iWK4CkMJ43mc/FMSaZollGiBCTrPWW/v6pq1w7lQ+vJVU j+SFVMX9uip/+W5FuMx2uhJGa9FR5/7BF+xid7o0LV2iBGekH/Tjd4Pv+IB9LCW4L5JJ pOksEbqvdtu9SBPP3ngdXXspew1fwAbRXl1nI1y5xnLZLIm/03/NujFfAriwY2UXIRHP zF7BSVohmDiwld9XJ9/6J45vNJ5eCVYxi4Gt05bYggJn31MKdQWmwnCcjBvT0qY6S3SG fR/BMCGVOLoxyrkgdG5EJaZsKcvZhGQ171t5npgrH26B2767FOzODgyoyzM/JmPALhuk VAtA== X-Gm-Message-State: APjAAAVuacBI+tGEThlTRSt463klzmp6VKPcTO75R1TggPXTXotvXwXv 1NOJcDD0+oSkFBuWLmXwefM= X-Google-Smtp-Source: APXvYqwv0d8l3Q4WlXIW7Bn4+TLLGQAH7wwu7xHx8LvHynwVBXhQ2PL1/8Nn4NrwOSzEDSCKcDsy/g== X-Received: by 2002:ac8:92a:: with SMTP id t39mr32634622qth.170.1573577095759; Tue, 12 Nov 2019 08:44:55 -0800 (PST) Received: from localhost.localdomain ([72.53.229.209]) by smtp.gmail.com with ESMTPSA id z5sm10543552qtm.9.2019.11.12.08.44.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 08:44:55 -0800 (PST) From: Sven Van Asbroeck X-Google-Original-From: Sven Van Asbroeck To: Dmitry Torokhov Cc: Marek Vasut , Adam Ford , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH v1 2/3] Input: ili210x - add resolution to chip operations structure Date: Tue, 12 Nov 2019 11:44:28 -0500 Message-Id: <20191112164429.11225-2-TheSven73@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191112164429.11225-1-TheSven73@gmail.com> References: <20191112164429.11225-1-TheSven73@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Optionally allow the touch screen resolution to be set by adding it to the chip operations structure. If it is omitted (left zero), the resolution defaults to 64K. Which is the previously hard-coded value. Set the ili2117 resolution to 2048, as indicated in its datasheet. Link: https://lore.kernel.org/lkml/20191111181657.GA57214@dtor-ws/ Cc: Marek Vasut Cc: Adam Ford Cc: Cc: linux-input@vger.kernel.org Tree: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/log/?h=next Signed-off-by: Sven Van Asbroeck --- drivers/input/touchscreen/ili210x.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c index a6feae5ce887..4321f0d676cc 100644 --- a/drivers/input/touchscreen/ili210x.c +++ b/drivers/input/touchscreen/ili210x.c @@ -31,6 +31,7 @@ struct ili2xxx_chip { unsigned int *x, unsigned int *y); bool (*continue_polling)(const u8 *data, bool touch); unsigned int max_touches; + unsigned int resolution; }; struct ili210x { @@ -160,6 +161,7 @@ static const struct ili2xxx_chip ili211x_chip = { .parse_touch_data = ili211x_touchdata_to_coords, .continue_polling = ili211x_decline_polling, .max_touches = 10, + .resolution = 2048, }; static int ili251x_read_reg(struct i2c_client *client, @@ -336,6 +338,7 @@ static int ili210x_i2c_probe(struct i2c_client *client, struct gpio_desc *reset_gpio; struct input_dev *input; int error; + unsigned int max_xy; dev_dbg(dev, "Probing for ILI210X I2C Touschreen driver"); @@ -386,8 +389,12 @@ static int ili210x_i2c_probe(struct i2c_client *client, input->id.bustype = BUS_I2C; /* Multi touch */ - input_set_abs_params(input, ABS_MT_POSITION_X, 0, 0xffff, 0, 0); - input_set_abs_params(input, ABS_MT_POSITION_Y, 0, 0xffff, 0, 0); + if (chip->resolution) + max_xy = chip->resolution - 1; + else + max_xy = 0xffff; + input_set_abs_params(input, ABS_MT_POSITION_X, 0, max_xy, 0, 0); + input_set_abs_params(input, ABS_MT_POSITION_Y, 0, max_xy, 0, 0); touchscreen_parse_properties(input, true, &priv->prop); error = input_mt_init_slots(input, priv->chip->max_touches, From patchwork Tue Nov 12 16:44:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Van Asbroeck X-Patchwork-Id: 11239795 X-Patchwork-Delegate: dmitry.torokhov@gmail.com 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 B028C15AB for ; Tue, 12 Nov 2019 16:45:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EEA121872 for ; Tue, 12 Nov 2019 16:45:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DoEUhr3/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726008AbfKLQo7 (ORCPT ); Tue, 12 Nov 2019 11:44:59 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:35786 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727178AbfKLQo6 (ORCPT ); Tue, 12 Nov 2019 11:44:58 -0500 Received: by mail-qt1-f194.google.com with SMTP id n4so15823007qte.2; Tue, 12 Nov 2019 08:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X3O+CX+8oR3Mx1ZogYLNvvXIK4m82y5KO5CqU8RBF4U=; b=DoEUhr3/ghcjvDYW41+0FOmODU1uYROVseuPbsZnJB9Ox6kbzH4YaV8T49mHWyV9pO 4vEdmH8Zi4fyCh5ZcXuwWgogXtDttYgP5DOnm2ZF2WusbcgLbZqyu6V0I9K/PET9eKOF 1VDmQFQGRzS7VgrRTXH0z3UBkmGbMGHDPBoxwMxtVTCU/zpkvrBrqC4K15netk8J1lfm fpEE4CwAGEM5AR/q4F24PetsYIpW4wuK8qP7FDm4FWUE9Jb5VpGHz5teE+kCBWN+52+9 VlhAhw+k90ZCF0yJCjukJAq4pMgpqYr4AGAuUsUDcgPWH93iQf2IGI8u/6/RoTTriOfq 2cjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X3O+CX+8oR3Mx1ZogYLNvvXIK4m82y5KO5CqU8RBF4U=; b=WixpsPM0m6ChLIiT6dqtfVRPbEai72x2S9qY8vEBWZZnnO6kV/Pssx825t6r9uywYw /FxW2uD6rJmFdeYnhAOoeZa5Qmnu3dWIwu/1Qbs9vxhTstSZvuEXZ4/lkfRr+IUVvlvb +SQ68TiO7gB5imE115ANIAH9ZRn9Z6hDJLzHa+uR3SnucjScnL4yb4b6Syx+sGF1nNVU YooqXcnG/jYjthlX98AYlSwpfUMNLMBncr1ukF0N9YeDEUxYHT1e27/gHP1vuLZWcoSI S1uv5ASH0YnbhdmR7ICKxJlP3KWV2oBzk7aXBj1RWNz3M3cEFJ5mUcB4SMdAvA+zfWyq wRkA== X-Gm-Message-State: APjAAAU7N7eNXM01wjNfTERRNbLBJngUMYb/xNZ2jKZYXkDf1jJCPwwi DtyaX9gFndU8n/5JKpBoQ/Y= X-Google-Smtp-Source: APXvYqyU9nbUbsYKawQAJe709f5xUIZGQ5mOkiq59a1upa4JBd2aNnqZrfKF5gEbyRO1IyTKXEoMCg== X-Received: by 2002:ac8:2441:: with SMTP id d1mr22992778qtd.386.1573577096790; Tue, 12 Nov 2019 08:44:56 -0800 (PST) Received: from localhost.localdomain ([72.53.229.209]) by smtp.gmail.com with ESMTPSA id z5sm10543552qtm.9.2019.11.12.08.44.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 08:44:56 -0800 (PST) From: Sven Van Asbroeck X-Google-Original-From: Sven Van Asbroeck To: Dmitry Torokhov Cc: Marek Vasut , Adam Ford , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH v1 3/3] Input: ili210x - optionally hide calibrate sysfs attribute Date: Tue, 12 Nov 2019 11:44:29 -0500 Message-Id: <20191112164429.11225-3-TheSven73@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191112164429.11225-1-TheSven73@gmail.com> References: <20191112164429.11225-1-TheSven73@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Only show the 'calibrate' sysfs attribute on chip flavours which support calibration by writing to a calibration register. Do this by adding a flag to the chip operations structure. Link: https://lore.kernel.org/lkml/20191111181657.GA57214@dtor-ws/ Cc: Marek Vasut Cc: Adam Ford Cc: Cc: linux-input@vger.kernel.org Tree: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/log/?h=next Signed-off-by: Sven Van Asbroeck --- drivers/input/touchscreen/ili210x.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c index 4321f0d676cc..810770ad02e2 100644 --- a/drivers/input/touchscreen/ili210x.c +++ b/drivers/input/touchscreen/ili210x.c @@ -32,6 +32,7 @@ struct ili2xxx_chip { bool (*continue_polling)(const u8 *data, bool touch); unsigned int max_touches; unsigned int resolution; + bool no_calibrate_reg; }; struct ili210x { @@ -162,6 +163,7 @@ static const struct ili2xxx_chip ili211x_chip = { .continue_polling = ili211x_decline_polling, .max_touches = 10, .resolution = 2048, + .no_calibrate_reg = true, }; static int ili251x_read_reg(struct i2c_client *client, @@ -310,8 +312,19 @@ static struct attribute *ili210x_attributes[] = { NULL, }; +static umode_t ili210x_calibrate_visible(struct kobject *kobj, + struct attribute *attr, int index) +{ + struct device *dev = kobj_to_dev(kobj); + struct i2c_client *client = to_i2c_client(dev); + struct ili210x *priv = i2c_get_clientdata(client); + + return !priv->chip->no_calibrate_reg; +} + static const struct attribute_group ili210x_attr_group = { .attrs = ili210x_attributes, + .is_visible = ili210x_calibrate_visible, }; static void ili210x_power_down(void *data)