From patchwork Tue Mar 31 10:50:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Jiada" X-Patchwork-Id: 11467403 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 68BA817EA for ; Tue, 31 Mar 2020 10:53:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 50E0620772 for ; Tue, 31 Mar 2020 10:53:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730598AbgCaKxZ (ORCPT ); Tue, 31 Mar 2020 06:53:25 -0400 Received: from esa4.mentor.iphmx.com ([68.232.137.252]:43597 "EHLO esa4.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730426AbgCaKxY (ORCPT ); Tue, 31 Mar 2020 06:53:24 -0400 IronPort-SDR: J8JX3sESXb7yNN3hda2C3tA4bpBqE/TK35rPiPHBtEYT3AFOKCKmbnqSeu8piSo2SIHPOnbLU4 avtGniSkqGFqtKSEwj7bumL4XQ2qtZUe4XyT85s15PY+Owv7gYnepOKK9/4aBXhg2gxRlPFqc7 +yDej5FKhC4u21Sb4b/kEaNM2mLKTUd/4CZTfxZYqqU2RsWGhhJ6YcaSQUlAKPvB8XekKjUFRu c8ZERE6p9KQaL0AXY1D+NhF1nGKfIIf4aX1sE3eoT39XX9zjYpDWXOibVjPuCfY8OSagx1Q2S6 CbM= X-IronPort-AV: E=Sophos;i="5.72,327,1580803200"; d="scan'208";a="47330822" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 31 Mar 2020 02:53:24 -0800 IronPort-SDR: 42v7p3t7yIVCpzJt2ENQU1YFWZjoKthTSWkiKSxUGxeyd2bptu6jscayHqlGk6WR409rzV2c9k k7n6RaJNTNHilXLfQjyRDxQnGXhhQvw+jRd8KmRo2xJY53DnsxvIYfSZr+OkCp/m4ZmbRPb+g3 Hv8GavJ2IbhtpkEIcmjFyWcoVz12qSCRGfV1KEN4vNcTZhI/qsWuEPzMabdBNdUkNUG8u4qu18 IGuRBe8lfUxxphNQMYx+3X7gaj84KafxdGLYxsQ9sJSQm4UAaNVVFzrRwrJzLmkGTE/cL2F2To emE= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v10 39/55] input: atmel_mxt_ts: export GPIO reset line via sysfs Date: Tue, 31 Mar 2020 03:50:35 -0700 Message-ID: <20200331105051.58896-40-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200331105051.58896-1-jiada_wang@mentor.com> References: <20200331105051.58896-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: "George G. Davis" N.B. Modifying the atmel_mxt_ts GPIO reset line during operation will cause problems with normal driver operation. This feature is provided as a diagnostic debug aid. It does not take into consideration any pending operations which may be in progress. Modifying the atmel_mxt_ts GPIO reset line at any time will inevitably cause the driver to fail. Signed-off-by: George G. Davis Signed-off-by: Rajeev Kumar Signed-off-by: Jiada Wang --- drivers/input/touchscreen/atmel_mxt_ts.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 11e65f32b1a2..cfeeacdd4084 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -4091,6 +4091,19 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) return error; } + if (data->reset_gpio) { + error = gpiod_export(data->reset_gpio, 0); + if (error) + return error; + + error = gpiod_export_link(&client->dev, "reset", + data->reset_gpio); + if (error) { + gpiod_unexport(data->reset_gpio); + return error; + } + } + if (data->suspend_mode == MXT_SUSPEND_REGULATOR) { error = mxt_acquire_irq(data); if (error) @@ -4123,6 +4136,10 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) err_free_object: mxt_free_input_device(data); mxt_free_object_table(data); + if (data->reset_gpio) { + sysfs_remove_link(&client->dev.kobj, "reset"); + gpiod_unexport(data->reset_gpio); + } return error; } @@ -4132,6 +4149,10 @@ static int mxt_remove(struct i2c_client *client) disable_irq(data->irq); sysfs_remove_group(&client->dev.kobj, &mxt_fw_attr_group); + if (data->reset_gpio) { + sysfs_remove_link(&client->dev.kobj, "reset"); + gpiod_unexport(data->reset_gpio); + } mxt_debug_msg_remove(data); mxt_sysfs_remove(data); mxt_free_input_device(data);