Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp596758pja; Thu, 19 Mar 2020 08:04:43 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsu2GZs/UqK2VSWxf2gFcBSPyjkTqhrUcNdDiFkiAm8MndL9AV5wu8lTQyyfLrZjoX8+CN1 X-Received: by 2002:a05:6830:1e06:: with SMTP id s6mr2790102otr.28.1584630283542; Thu, 19 Mar 2020 08:04:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584630283; cv=none; d=google.com; s=arc-20160816; b=QgQ5tcUz8R+Eov9a3m3jFnReIGElFw7K+ATY8O/7s1Sm5jdo6tRQyBSjRKJvaJYmaL /tW8aQhXwRlF4mh1N9FDJpDrY0SoURGK0eIe4CAPqYa0c0z/5RW0lxSpXKJGvSHTmGd6 wXOK/L0umgc/A2O3vEMnHSIb/K2+apLqYzkWk85hdsav+9Cm/P7PXYJOwbQzBcHUpuud DIga/fD9FqDMI1eC9wKIUbEZso68TZGmcrJ8gceMWCpzPqri19wya/AfsttDbGIwcxLN zFHN2SzidFYfWd+z29XrtPWXOaTcbThqqCG5R/QjWa5S4ysqGvWmqRP7b0KBszdK+0dx CkYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=r2CXDapgMUvD4ixEYj9R39UaqCYxxE0En/cw6bsg/Oo=; b=e+EKnkSdbNPDFBjAQvd2lTOLDeLwIGyQaFkTAbQOYuH1uzPdDewj/J5z7VIgxqLomr cEwWKHAGLgmNRKeYLJnBuj5HWBXSch0so5+3//EKMoKzJVa9h6VECzROpMNLpqOhNfSu mRebnFaOFvQQdk56GK1SV3hPKmzXIjsbhi44ryED2sNxJ68YXauZxDcQ+tOaj2y7aIuw Q6zRlInGWhqPAoOD+1xJLWOhPUnwqskRH7AwzDKa8YR0jSnpXnMPLHBCeiN4UbtA3eAS +7nIFQFWRDRmlED5au7YkTVOU/R7a/xqwoe6NrHEdJDvLVtPatKAftvxW92JjqyNND6r OIwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b204si1141441oif.69.2020.03.19.08.04.22; Thu, 19 Mar 2020 08:04:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728297AbgCSPCp (ORCPT + 99 others); Thu, 19 Mar 2020 11:02:45 -0400 Received: from esa2.mentor.iphmx.com ([68.232.141.98]:5502 "EHLO esa2.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728287AbgCSPCn (ORCPT ); Thu, 19 Mar 2020 11:02:43 -0400 IronPort-SDR: vlsjRHpcXiLoa3gqLqNLp/lDS8T+cj+P/9dzLE+M9v5SFZZUW1a5a2p6SaLa1Bcz84QdYqQPBY 2PWRHGrLGjtoX/ONQa7e3aOUFAAhYoXItRVjVz6XdgEvbJUUli9rqCWub9mgLmvhX1SRpbVakM NIFEFzG94QoxrMfSPkaQCiAMtUiry09iEMyuh0fj5Kh/XAeyYedFEZ1Pv6ca/YEPrttOYVKEgD vFiv5c3AN/lgVxmsA4soIYrVBEZJg1R3aK5Sg9/NOcnMKTHbTepTfyfYPa3XYo6RNXQ2EfMBYM 7L8= X-IronPort-AV: E=Sophos;i="5.70,572,1574150400"; d="scan'208";a="46818860" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 19 Mar 2020 07:02:43 -0800 IronPort-SDR: CKCIL9tpA0XvZJErtxAM/Y2cQM+DlSH5z4UWVmX/DRvwv0KMdlF+J2Ais3BczfXUIUVrZBhYJj 0Jr0VGPgyIkxuJ/mwPBK4GWjT+ufMXga7jRoHCERclxlG/kUM0eZKCzr6x2ZA8h/EhvK6cl34l sK6+EgHRLpKbYsKgvVRu0OH/r1esUX/ygoJsec3lSeL6j5L0EjJmtM/1dhqnW8aGdAJXP0hAaj TGvdIMspGANEWyWkQb/77GmIlFCL+bvnjF4Ayc7ayCtPenykgQMSEr4JpqPvXoHa9rov+rIdYT 9hk= From: Jiada Wang To: , , , , , CC: , , , , Subject: [PATCH v8 36/52] input: atmel_mxt_ts: export GPIO reset line via sysfs Date: Thu, 19 Mar 2020 08:00:00 -0700 Message-ID: <20200319150016.61398-37-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200319150016.61398-1-jiada_wang@mentor.com> References: <20200319150016.61398-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 18372e8d1ef2..fd3db4f8d55d 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -4083,6 +4083,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) @@ -4115,6 +4128,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; } @@ -4124,6 +4141,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