Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1367282ybj; Thu, 7 May 2020 23:00:14 -0700 (PDT) X-Google-Smtp-Source: APiQypKliT94xuj9alfQ0D7/XhfxX17cpNY2F/4mfKa7PVOiFx3HK8Ve3qAg58Dl/A/Y6ED6J+Io X-Received: by 2002:a17:906:ad9a:: with SMTP id la26mr507718ejb.128.1588917614348; Thu, 07 May 2020 23:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588917614; cv=none; d=google.com; s=arc-20160816; b=kD0bWyThQXCLnAmi671+1Q2KDIVh88xKSp8IFzXBB4i/A16GiQy6YcFtKaHUZYcEep gc/i3a4lbjGN+v8uPVvRFvxf5btUd+jr5XlPVQAjBMKR26edpAirt15YZ+hlB8WqInt5 oLyuV2qE+GigXD7p54utW31Q87UPYJRNBKq+S6CPyDDg6S3EOOXls7rEiCnxdhnKZ7wp PszaowXbqXg1atD9X8NJVvusRJp/Y6uNGrlJ23oC0Yq+oOK3M4hS+wNSohdYY+1jOZZP 1BdHxBI9pV04nJ/AIaEzw4jzu8Bwf5iWe9XcppgzSYb2oZGYJPiwDQ038tabAt2kgdhT R7WA== 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=i0/6lV0VUR4JowLF7r8E3X2HYWA0TBsl2w93onfmvC+xOr/6FJDxMwXpDZbhbLbNWx JpSxeebyWkDcswWKw1xORtYarNgcH1YiFmwlUgkVyCYkbyBmAzL8QN1B3Jl4eHXcjOEs jiYkj8OEt0/e9pH83WL+8EL0VeW3tHGxJ3XaPTJHaHHClb7xXDXJDOfdlERt4LDIISKr PJ03pzeI36WEaMsVq4IUo82jBTZRBuAgDOUpfhKsXJMpYkd4ySl6yKqLN8P22kiKwpEB OoBMAMGSKjE80BRqOvnrmCf8N7DlTUnbCQZ1R4Oo0eMNPZUpFhpXDMH3jILlXGMFVr9b nR6A== 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.22.59.51; Thu, 07 May 2020 23:00:14 -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 S1727851AbgEHF6F (ORCPT + 99 others); Fri, 8 May 2020 01:58:05 -0400 Received: from esa3.mentor.iphmx.com ([68.232.137.180]:21990 "EHLO esa3.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727839AbgEHF6A (ORCPT ); Fri, 8 May 2020 01:58:00 -0400 IronPort-SDR: EwqJHOYEdIgJp32Yng3fSYbS5/eFrxUpJ74Kkz6I33iuagZhjuq7icrMu9cnkV9+RAdp7ZcBLu CrRH7qiviiy57XZY7b7BNcq/8ayDnmpgvPKYtkbMvoRwc53pQ9KJEIYd8Z6KolkwJm/SMsQ6u8 JllGTCuq74z1xa4vT0MtSrK6LuoaRyM1zN0xJpW5TiFyc8vo4mc6dxJ4ERppaZee7KMGEueQjw Id47rCFPMJTI6rcVQ52WNRKzKxx/JW9Km4gSAl2hfLhNJKQ0h57CPnnb2450LkdStx3SUbkzzC 1zo= X-IronPort-AV: E=Sophos;i="5.73,366,1583222400"; d="scan'208";a="48651930" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 07 May 2020 21:57:59 -0800 IronPort-SDR: nyt2cu25uZPUs35qMdmj6XtMX7aUKxnFcXzBvMI+wzgi/SjlPmYrBgwciOe0kr59MJp9QQVQxZ U+jFNqq9WUQ+I00YbNYLtHX7cFzhtlcbAfA/eDVbgs5zylFEC2ELrB7AP012Oi/FE5jerAqm/E tLWKw9yWRLwKMZjMjryLYOZDEzV+y//ftuKUTdW0qUajpV/I7eHmEz9it7W/jHDxaZ8//0PLwk pwYQ58noXCJday2YeSn1Hx79ktDLm8jH8n8+LOkROK5s7XWf/Qk8KBPnqWwChJNdH2X1iRvoo4 vdg= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v11 15/56] Input: atmel_mxt_ts - report failures in suspend/resume Date: Thu, 7 May 2020 22:56:15 -0700 Message-ID: <20200508055656.96389-16-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: 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