From patchwork Wed Nov 6 07:01:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Jiada" X-Patchwork-Id: 11229425 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D754015AB for ; Wed, 6 Nov 2019 07:02:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4A4F217D7 for ; Wed, 6 Nov 2019 07:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731453AbfKFHCt (ORCPT ); Wed, 6 Nov 2019 02:02:49 -0500 Received: from esa1.mentor.iphmx.com ([68.232.129.153]:18550 "EHLO esa1.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730804AbfKFHCt (ORCPT ); Wed, 6 Nov 2019 02:02:49 -0500 IronPort-SDR: fO/CcyLLM1FOYW8mRx8wy5W11dY/lzOpBaGOl0abSVcIrWpZVWeI3xd/iMFwWuI2C0PflkzXYT 9Ig0w4mGnH5fZDeuC4zMCtP94d+kpr7AGJIV2m7VOHQx6uxtb/3oUkaqRrSPmyF/C2kb1jAL+Q /itbI9P41f9rb0lzZUl29XgmapmMeoRixiKhlI9LUnbyUmZn06ozIrlggsoeUzUWRbD12EPz6c cZJRH65n2B2l2muQ8H6YxYGmT+XmjRxK72/Vgxw4ZJpR37H+6hjabAAhPw7VuhCMGBuB2vvdSF 5I0= X-IronPort-AV: E=Sophos;i="5.68,272,1569312000"; d="scan'208";a="44759237" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 05 Nov 2019 23:02:48 -0800 IronPort-SDR: iYYJBD8iPbsZTWyZ9KTPtKVtzEFSHglVWm9Jw/bpTmn7Gxe5MzzDrsS8DuU3dSdmGCyQXoMChb Xit6gqKd70hdsKKC120AXsVHdPEVgiqF8Dw19L8t48weNhTCHJNrJShp2LNKKqzjYYDWQFYsND mYQNTmwZFsOtdFFdMBM04O8AqfW4/z56rdZvF23t1UAmNHfk67WTK7QG4VBrNeazHN1zRCHU+i VTNgjw/MpFWJMDY0FXiBEQMzvVC5Cl4U77nxqONeJeypbRYZEobI48DctyK3FiClLivgjKWMa6 u8Q= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v5 14/48] Input: atmel_mxt_ts - report failures in suspend/resume Date: Wed, 6 Nov 2019 16:01:12 +0900 Message-ID: <20191106070146.18759-15-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191106070146.18759-1-jiada_wang@mentor.com> References: <20191106070146.18759-1-jiada_wang@mentor.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Nick Dyer (cherry picked from ndyer/linux/for-upstream commit 93a57575403de4dd07cd64807d3c2ed7f2cca262) [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] 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 031ba48b6e71..c551ec93ca54 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)