From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97697C3B186 for ; Wed, 12 Feb 2020 08:46:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77AA321569 for ; Wed, 12 Feb 2020 08:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728802AbgBLIq0 (ORCPT ); Wed, 12 Feb 2020 03:46:26 -0500 Received: from esa2.mentor.iphmx.com ([68.232.141.98]:34506 "EHLO esa2.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728650AbgBLIqZ (ORCPT ); Wed, 12 Feb 2020 03:46:25 -0500 IronPort-SDR: j6jrWTeEKbtG2Va7gI/oGHbhGnQWvlMrBjE+lMxUUs9OGIxSqbRCbF0TaiLTJjehpm48EMl46C qZS9es9CRghUh1NFrD00nCKcDHjyr12taN5TzddPh+YZZTPJNsQMQH3LG/r0+4TEb0Y1fJcUqT wE6w/0RxfXzhbbgVC5KDAEsc2kGrWu/kS7D03O4SquhG5DUwNvWF9dZ77gnNSYflOTsSsrPKL7 99mYSqvN+lzq46qI0PDWxAApz6aRrc0OkLOUUnKTrXzdnVnQHE2xL2Cc6DStr7ytn91KnXxxgd 0zo= X-IronPort-AV: E=Sophos;i="5.70,428,1574150400"; d="scan'208";a="45686269" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 12 Feb 2020 00:46:24 -0800 IronPort-SDR: Gh9d+LeU9PTJdoL+WaV+JAtF9KUDF2XVJwZmY1Dn+P8ANG1jCmB2Tb+XxU000Sku8XQS4MVnF4 rxzsjVlBD6R/vVzZ2phDgaI+crXVrFziJFanNRvdHuQb6eQq8Ckf3+IHu1z6pIMFmkaQFPXtmO CTLiNItau9oFNeVNHIkHsQFAhay38/XBbWr0IXIfxbbgWmyaPoyVA3UznGUa4gg7qx0fNC4fXe ljg4IC1whJ1yMTBqnkKQMT4SQEMFaFGA2RJlaBHy0Yzq1d21FkYb0vmjQnx6ianDLfX+dS7si3 5q4= From: Jiada Wang To: , , , , , CC: , , , , Subject: [PATCH v7 33/48] input: atmel_mxt_ts: export GPIO reset line via sysfs Date: Wed, 12 Feb 2020 00:42:03 -0800 Message-ID: <20200212084218.32344-34-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212084218.32344-1-jiada_wang@mentor.com> References: <20200212084218.32344-1-jiada_wang@mentor.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 3c15ce499e34..b4ec565ee7dd 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -4082,6 +4082,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) @@ -4114,6 +4127,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; } @@ -4123,6 +4140,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); -- 2.17.1