Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4315095ybc; Fri, 22 Nov 2019 00:28:22 -0800 (PST) X-Google-Smtp-Source: APXvYqyQTlG7Eo+UJx0SkuiS/1xHJVBFyHVfliYVwKVEVYumA0xcx0kaXd9MRUsPRbuaTvFudeyN X-Received: by 2002:a17:906:c41:: with SMTP id t1mr20330816ejf.282.1574411302461; Fri, 22 Nov 2019 00:28:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574411302; cv=none; d=google.com; s=arc-20160816; b=RZ1MTF/IulfeZ1K3BuyEYFoZ5D450TNejg/Jq3wBpPXaspsv3CRW+jLyoB/FSJJE// 07Y/e3p1Gop6gf1bnmMWSLIEeSeiECS30+o5otACP0pEpGU0I1gzVemB50JcAsk/+lhz sGcPTGN6Tb53AAD3O5UVhalczD1c1v4LyBQpswGMB8AwJzj36n2Hr8nQDuj4pb8Okzzv w27AA900zZXWM+fBQPdojLZoCmcTxiH5vamyFxe3mpJhkhL4JeI6UIKi5MsXHj6C5Hun BRP9EUkKa15uZ/crcwGcZAMgYVzlui1LDzBpvQi+EaltH5IffeM0L4JNiyj5lTlBvMLD w3ew== 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=e/VaylUM/4oaquiz2Y2/YAPeeAfMtS438MqyyOIy8H8=; b=CEE3B27XWE1O/qA9jckQHc1Uay7fMpBgtRDjxSTNURcc5vNB8KChcopo5dS7p/dvoY PnFY75UPPsCRaoYw4wTR9jvT1zHfNxK24/w47n4q1vrKgoVYiwVfxr8MUNinWNQNKcTS etLxJLgLr13pEYIxeFCdt7Q3ToOX6KeQ5SkobT/BHkYlT5gZXt3LwWjl5b9TViPQAQz1 +gklcPymNko2QPRnCZ6+9zBiTjY/1k/vQucaxGG/lqJQnfJOzcIq+U5smxkQ0znHycam JrH5CyjSUPFCPCjM3u9jxWVTbt0L3cdJGG/5ZdSx/2pJNTL7zEAOu78bwFrCUKGvS9uJ 3srQ== 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 s38si4066081edd.351.2019.11.22.00.27.53; Fri, 22 Nov 2019 00:28:22 -0800 (PST) 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 S1727638AbfKVI0I (ORCPT + 99 others); Fri, 22 Nov 2019 03:26:08 -0500 Received: from esa4.mentor.iphmx.com ([68.232.137.252]:62576 "EHLO esa4.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727007AbfKVI0G (ORCPT ); Fri, 22 Nov 2019 03:26:06 -0500 IronPort-SDR: mWpYpRVWBUQqtFNXBGa5e9AixcM/NZo4ZIEax3bHzvtL8IXKGlBKvWiyfvEfHZ9/NYGLnJdRqy XLNIWigDaHV8yKpthb6sAJTyM0FfU5/q2APLYrGkZTuVIw1Y7cEA2m8Jna18cRV7UcVieDZCqw avwSDBKJKFQkjHymQl+IFlqzjyi6lIF2jpU/7b+Yd7aygKiqnQGLPLO5DUlmXiAUKQJekRn1Rr eSqf/pDS/J/N6NY3QsMO8OgdZxHsYN1WrrFRSgjJ25F5FclnEXffLKBx66Dzl8oQyzaTqhi8wf 3cs= X-IronPort-AV: E=Sophos;i="5.69,229,1571731200"; d="scan'208";a="43457621" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 22 Nov 2019 00:26:06 -0800 IronPort-SDR: d9uHHP1QH23UTNue8XH0UmkzlCYjD/XiC3HyU8PpzRICQqy7CAi6iN7NxNl3BA0nCObtLd3M5I zbGxzYnYyLIraEyPwchcdJApmm/m854B7GENPOF2aymknBbHcN917l4p1grTuEffNNmXBy6hbZ B/5Ca6WxgpJVdWpvodnInEmrZF9aQ/6qS267UWL18QtUY5VDIEFFcNN3AkA34tSZqsvRFUrCtN pVp/8y8duXjyOlrCiBom4iO2unUY45UlSAHEgIXwPRoSgLu+/0wmTI+zmsD0pVbsZirnErN5SP Mxg= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v6 33/48] input: atmel_mxt_ts: export GPIO reset line via sysfs Date: Fri, 22 Nov 2019 17:23:47 +0900 Message-ID: <20191122082402.18173-34-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191122082402.18173-1-jiada_wang@mentor.com> References: <20191122082402.18173-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 3513413158c3..f357d353447f 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -4085,6 +4085,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) @@ -4117,6 +4130,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; } @@ -4126,6 +4143,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