Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp624392ybb; Wed, 25 Mar 2020 06:36:11 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt70+0TIePUAT8hIng01tpJvCyxfIheW964PbUnlyTuwiBh8TOZcXjkhLC9sGWuwJq+kXzS X-Received: by 2002:a9d:1a4:: with SMTP id e33mr2354630ote.343.1585143371763; Wed, 25 Mar 2020 06:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585143371; cv=none; d=google.com; s=arc-20160816; b=e627eELFDznNi3XPTIoxjxFSCjdK+zvYOgR75n1yXd28V1IW7gXiU+5hwAhfVoM9dg +IcQfVRv7/aPIoKe4ELio3eWS2oT9NrzfWQf54EVEgzpNWT75JCdL0Fqplduk5hUe143 KJyFhudoFcWqmC7AbC6q/lPTAY9B+B6+i15RLxI5pePo1iP/QV5FJotST5AMWiHGcPyX S5pHC3u+QUNDfoGqIo5H2+OYi+JiK83wDjHedWXEnTpYTC9bkBjKKVgv0rO9qIlZH9Hf y/1HZVwYFJZxCx3BQ9AvqJWaOt9pdqfNpEWGUhk+MOinYRoazoEysWgmoJ34PJ8hOyPg S1LA== 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=crsR6oyAG/aJvNZOncKampeRgPK66hkQVI0CNjF3W/I=; b=m8WJQa7JuLHLhBd0jL+P6NbiagzWvVuzyIYSVSa5I5NNoupgak2rt9ZMG4RSceY/PK Ush36IZWhCMcUKYr+Bl5CtIA7zuYtDanscehYQ0FqpylFMNm2WBb7BUgFH+C0ZBXwkIT XZW7d6VcYYbjum0ZtxPFCVzUCyBBXpUllZ0Za6U4nSyjr2lmg2Gi3TLQa0Gsjr/n6b+N YyDoeFMa9CYSPCHDb7sHmMqmconJYt0vgUjpsZjXleKYXkcSMgwKmAel7DtJdZbsE/JD pUPmZlKwSN7Uih++hRGmiW1/n/MiaFF2EXwXeswFp1rq+nJbfi84OD/e6SR4TLoYklPg crQA== 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 z12si3204497otk.227.2020.03.25.06.35.57; Wed, 25 Mar 2020 06:36:11 -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 S1727720AbgCYNen (ORCPT + 99 others); Wed, 25 Mar 2020 09:34:43 -0400 Received: from esa3.mentor.iphmx.com ([68.232.137.180]:53145 "EHLO esa3.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727684AbgCYNel (ORCPT ); Wed, 25 Mar 2020 09:34:41 -0400 IronPort-SDR: Q1BBwObsBGs773IMK76LyWfe37a28OfMl3ZQYo4MqG8mvr255wxeAAa0VjrQwD1j2gUxXSiCMj 1PH1aWG3SHtrBzSNfnqP3R8pNwk7P+1Ryu/r1KAAkkNituACiRWVnlbnpcZU/QPFOal1+Q3B9i eUI+/DKftC5euZjWEzR1GgaPUSJIde1YFMKjg9ljAuvGG1XxgLGeyKLK3Z6XmgB6dM07CfjhxY +pHMPx6dbb8TbudS1Mq9ngbyz94Gdi/URgHgszKzjEySzSyIeQhxdzryYLJatBaiA/KzhTgwVy Sr4= X-IronPort-AV: E=Sophos;i="5.72,304,1580803200"; d="scan'208";a="47099685" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 25 Mar 2020 05:34:41 -0800 IronPort-SDR: crGbX3+h+zXyS30LlgskI3P5VSiXsg6IPZbCJNIhmQYhiOJlTBZlf9UaMr4cxyNU90ZqLLa5Gi U6kKvCFpIJQEdAThbZyrCpquqEy6w14ksEAYDZw3IhWcAHlXbIyy+K0VR8rahBy7a7u+TAmco/ H+5G6z1FwnrCbl54mXhGQFuQlsbClA6xX7d4rJqeFwbSMApfMQzPju7JwafmfVJKkkFN9lZCxk icqV30WrN5kbHXLENoQAzxU3dfv60bwlKYh/9q+N0fbkzC2W9MapRXE1QHnnkO74Lqnfk4VJTq uqM= From: Jiada Wang To: , , , , , CC: , , , , Subject: [PATCH v9 15/55] Input: atmel_mxt_ts - report failures in suspend/resume Date: Wed, 25 Mar 2020 06:32:54 -0700 Message-ID: <20200325133334.19346-16-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200325133334.19346-1-jiada_wang@mentor.com> References: <20200325133334.19346-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: Nick Dyer This patch reports failures in suspend/resume Signed-off-by: Nick Dyer (cherry picked from ndyer/linux/for-upstream commit 93a57575403d) [gdavis: Resolve forward port conflicts due to applying upstream commit 96a938aa214e ("Input: atmel_mxt_ts - remove platform data support").] Signed-off-by: George G. Davis [jiada: Fix compilation warning Add commit description] Signed-off-by: Jiada Wang --- drivers/input/touchscreen/atmel_mxt_ts.c | 51 ++++++++++++++++++------ 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index ef8baf64659e..f8783e37436f 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -3425,10 +3425,12 @@ static void mxt_reset_slots(struct mxt_data *data) mxt_input_sync(data); } -static void mxt_start(struct mxt_data *data) +static int mxt_start(struct mxt_data *data) { + int ret = 0; + if (!data->suspended || data->in_bootloader) - return; + return 0; switch (data->suspend_mode) { case MXT_SUSPEND_T9_CTRL: @@ -3453,28 +3455,42 @@ static void mxt_start(struct mxt_data *data) */ mxt_process_messages_until_invalid(data); - mxt_set_t7_power_cfg(data, MXT_POWER_CFG_RUN); + ret = mxt_set_t7_power_cfg(data, MXT_POWER_CFG_RUN); + if (ret) + return ret; /* Recalibrate since chip has been in deep sleep */ - mxt_t6_command(data, MXT_COMMAND_CALIBRATE, 1, false); + ret = mxt_t6_command(data, MXT_COMMAND_CALIBRATE, 1, false); + if (ret) + return ret; + + ret = mxt_acquire_irq(data); + if (ret) + return ret; - mxt_acquire_irq(data); break; } data->suspended = false; + + return 0; } -static void mxt_stop(struct mxt_data *data) +static int mxt_stop(struct mxt_data *data) { + int ret; + if (data->suspended || data->in_bootloader) - return; + return 0; switch (data->suspend_mode) { case MXT_SUSPEND_T9_CTRL: /* Touch disable */ - mxt_write_object(data, + ret = mxt_write_object(data, MXT_TOUCH_MULTI_T9, MXT_T9_CTRL, 0); + if (ret) + return ret; + break; case MXT_SUSPEND_REGULATOR: @@ -3487,29 +3503,40 @@ static void mxt_stop(struct mxt_data *data) default: disable_irq(data->irq); - mxt_set_t7_power_cfg(data, MXT_POWER_CFG_DEEPSLEEP); + ret = mxt_set_t7_power_cfg(data, MXT_POWER_CFG_DEEPSLEEP); + if (ret) + return ret; mxt_reset_slots(data); break; } data->suspended = true; + return 0; } static int mxt_input_open(struct input_dev *dev) { struct mxt_data *data = input_get_drvdata(dev); + int ret; - mxt_start(data); + ret = mxt_start(data); - return 0; + if (ret) + dev_err(&data->client->dev, "%s failed rc=%d\n", __func__, ret); + + return ret; } static void mxt_input_close(struct input_dev *dev) { struct mxt_data *data = input_get_drvdata(dev); + int ret; - mxt_stop(data); + ret = mxt_stop(data); + + if (ret) + dev_err(&data->client->dev, "%s failed rc=%d\n", __func__, ret); } static int mxt_parse_device_properties(struct mxt_data *data) -- 2.17.1