Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4314058ybc; Fri, 22 Nov 2019 00:26:59 -0800 (PST) X-Google-Smtp-Source: APXvYqyaXq41/hZVU3c7Fh7TaYISGwHhpzToh11nezeQK+qiC8IScBbK+XyITSDAbnfDIX9/V3WM X-Received: by 2002:a17:906:5c06:: with SMTP id e6mr20835922ejq.195.1574411219747; Fri, 22 Nov 2019 00:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574411219; cv=none; d=google.com; s=arc-20160816; b=jvRpAxwPPxZ/BySPZJGb3FCfXNJzUA6sYFaOCCHh5vIZeX8lwJs0iPkrnU3iDppqrj R7H9trvfqX7yVh+nsE95BI7gGPjhCIvUjAXmIppCZGS7BQ6zBa0276gywhIpG0Bksit0 K3gfMh4HiIJczDtsWPIccrnNsSlqbup8dHvmU+3mzykVyI8kawfGHz30falZScxOjr8x 2GwmCodEGvCLAxTgyULWxs7u8Ui7ZBjtPzYOnSqS8UXnSsMBkuez8E92mGI9Uok4KLPs 5u6kpkdRQDkFHD9CX+mRg4RTrtmL5HmIo4xhF1sS2SmqRbZZe1zkcgvOC+P4TAUaYCBz 6+IA== 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=qFbAYj+qrR+QBYvjxbpY+HmwUnOQi/vrzJIi8CThpyI=; b=nQsKFI/gmWYB2gjszg1u5CHaCUX4MiFMwM1GIsm42UfjieHvUZOQnZW3ZFhwbDDuTq SBG4ITq2SDldVUBhgyYn+tkX2bW/xvbGDnLiKdGiubEpJ87IVMjcAGvIijOzFeVamp2Q TsU+qhN0gEDUQJH90AWSX+2ERa6Bec0dM/ICj3qqYYX0IK/evk9YksuxrJgx7Gqpe9Zg dxCOl+X3JCNv45yYcNKPfVgQsQOxm8RxqbNoVU07Xc66+6N1u5QkzxyhghK42A3TDWh4 ZW+bu8QSN0NuwIzXJOGfOGZ2SeN7qtG/7HbtOuZpf6CdM3nG0Y3lP9dSEcxfcNJyAOmw PMDA== 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 gu26si3851168ejb.228.2019.11.22.00.26.36; Fri, 22 Nov 2019 00:26:59 -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 S1727322AbfKVIZA (ORCPT + 99 others); Fri, 22 Nov 2019 03:25:00 -0500 Received: from esa1.mentor.iphmx.com ([68.232.129.153]:60532 "EHLO esa1.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbfKVIY5 (ORCPT ); Fri, 22 Nov 2019 03:24:57 -0500 IronPort-SDR: JZN7us3t5pneTXfKaJZccCFFs/FfmwQDZRWjjThcGrcjtFJekDhqn5AQISz58H2na05skMHyv6 XNTYNQiCgU75+Sxt9ZB+ANF5X/XLtfdEFQUYciOp1EgVlRUnoYP+r6t2eEp3kaOQROR7hyHKa6 ws9cRJkDh5brc3Pti2xWbWRycc2P2B+rMiDYfxVfPa7E9Fkx4qgMNtAYzrPEnqxW/qrf9/aIkt yZLf6KO++T5le5i8MXkAyieCgWInH/A2HKAJg/W8f000kR0yUXE/BJHcLmq6+CwHGPzGaf03Kc bDM= X-IronPort-AV: E=Sophos;i="5.69,229,1571731200"; d="scan'208";a="45291110" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 22 Nov 2019 00:24:56 -0800 IronPort-SDR: kx440i/9WV89SDmCQGkqYPHvP6EDT/KyHEQAxRfbdOKscq/xfxC55AD5Dkd4U2I3Y83Kmsn/RI vG16hZCkq5rQh5qrhlX4EYrtYOV5jMfKWVLLVYDzqiNXZSIvD8cyn649mREc4/LIdpJpNkymkZ v0mO+qAD/f6AqiohDQNBgw7307EDhZ435rys3JFizQiS7gbQ8bEIMPAsnRMxQfx5mKbdb2H+gj /u83tQ3BglhyYxlnkfs3cTKayIxZLLRu+7FciJg1KNq2qGQJ1BJcPF9XCaZ6sMEUe4zIUNa3Zj o4Q= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v6 14/48] Input: atmel_mxt_ts - report failures in suspend/resume Date: Fri, 22 Nov 2019 17:23:28 +0900 Message-ID: <20191122082402.18173-15-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: 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) -- 2.17.1