Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1370164ybj; Thu, 7 May 2020 23:04:10 -0700 (PDT) X-Google-Smtp-Source: APiQypLC+8JHv8W9bY2m5FFtx9K0X80P3h2XhGqbyvsOORTi3cGoa1mM10QT1rqDiczkjJnR3Woz X-Received: by 2002:a05:6402:22f0:: with SMTP id dn16mr825692edb.201.1588917849880; Thu, 07 May 2020 23:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588917849; cv=none; d=google.com; s=arc-20160816; b=x9Y26v0uQggF3IagGxoR0KpTZS6DxLpWrlRN9j07u5ojeiInjQ+2VeUynWbamoFEfl cydu7UB7T+J9YKE1qA9wlea/r3FCPAfFodV0YlhHcjAckOG4pHjSxs/OvcO6IK7TJce7 ga8xYRa1TYUVDoxGRog2R00Pu19a9TzxXzFP4fSsBkGkvmDJ4pL0qvnCrQHUXPVt9ADC wFPuyXFhdh5iZFbCPrdacPSUlZoJ/NYoxkwQPeC+qC+XaYQj5HV0Yoa8Wrm1OMcqTeQB oROxqvNkR9BePVRDS4P541qiq/osHWfz3CwD5QBBpOViOIEP1FBA3Xu1JbYE007xKUyk w78g== 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=uDKlbR1/BF2xm9NFjqlmMiTH/xHriXwvVqbrTCO2mIo=; b=pDBZoHF0dFu8/TzH0Kz/i6cpnFBoJ/aCirbSykSfOZkpe6TuAV8p9A8rTzSOuMhPZO xy71tC5dlOeOTyVBxzGk3KLoCjT6FoFG0eTsqKY2Ngiu4A/V4Zp4KkBSWz8ooNTepfah zf+73NsPE2hSnHHgl22SQHivTd+tC3o5zx3Gw/14HFgDzjdx+Ckq86heBHO80d7MQRhT huzKj4SSG+N/pu08Fl0/Zgrfv3o1poXadbged4HW6mTqdbNWSvCV5pZsTu+AQXNytsaL 5Ki7Ycye+hmJI4Geit+aQhOUliSR8qWCvnG1ovMT0dviyvRIfyD5qtznbKjNjny8LOF4 a5Dw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u17si376032edd.195.2020.05.07.23.03.47; Thu, 07 May 2020 23:04:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728229AbgEHF7j (ORCPT + 99 others); Fri, 8 May 2020 01:59:39 -0400 Received: from esa2.mentor.iphmx.com ([68.232.141.98]:22062 "EHLO esa2.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728219AbgEHF7h (ORCPT ); Fri, 8 May 2020 01:59:37 -0400 IronPort-SDR: UAaKYMRmA706/bg+73rSkheG70dmXQmFw99jC7+QDpHPhAypEBa3Sbg+0J5ovSax3ypr0bJl84 IdQDfIQ3lDrgo2XH/grH/I+ui1Mi2b/R0kZGCGwesA7iqtxYGbfVeE7ysC36rNBd8y2ISMn5yD sg+WpEhBv9pklM40LGVWyHlvzkpjZCer3xPaioucQi0hp7PVWDSBfwSl+6RlREfd5JXomjUGOl hGkgIL9aIaovgocPeI4yORwsbbNvUCt6fZva5zzFQsl/U9zlKvZhHgckiICTwm2U9p/Juel0k0 k/Y= X-IronPort-AV: E=Sophos;i="5.73,366,1583222400"; d="scan'208";a="48589133" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 07 May 2020 21:59:36 -0800 IronPort-SDR: G1BwukNXBxJLSkZMP2b9tF5jA2N/7RgTPIEnXtEjWjtuY7hXTE5wX7XZ1US6NHkFbdkftdxR0d aEmqUA8qWdKfJ7Kv9531H/hcrLGtj+R/eX0zYC/gdpugXvNbJlPejhhXzCPKqiQ2gcOrKOwx9q Vf7wLQIX3fljcP0AP/laVqrIrbryYvBbwkde2pag/h3ksUrCTBumGKCq+//w2nyjfNxwYiL9H+ 4UWc60ncp761XebFVLCJLG1QzpPuQZglXgFdtex0QkTLc0iMJr2RGgtL6xLlZPnXN1n8MNPJ7t JXE= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v11 41/56] input: atmel_mxt_ts: export GPIO reset line via sysfs Date: Thu, 7 May 2020 22:56:41 -0700 Message-ID: <20200508055656.96389-42-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200508055656.96389-1-jiada_wang@mentor.com> References: <20200508055656.96389-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 75329f87927b..ceb14b4a8d4d 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -4080,6 +4080,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) { enable_irq(data->irq); @@ -4110,6 +4123,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; } @@ -4119,6 +4136,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