Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5825658ybv; Wed, 12 Feb 2020 00:44:54 -0800 (PST) X-Google-Smtp-Source: APXvYqznvz4SuRErpbAvnAjQr7CYNDIqZDj4etRkTGdCaXL3MW2tONypxLB1D4DhY+7R4sTlEiXZ X-Received: by 2002:aca:c68f:: with SMTP id w137mr5621282oif.179.1581497094608; Wed, 12 Feb 2020 00:44:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581497094; cv=none; d=google.com; s=arc-20160816; b=Nb0V0pTID9oD6RKOQBMy1OxgMbm8I0mu/LYx1yVgkgSK+Ck8P7TGz5Ip+4+47Bj4MT 0KXGFlpISU+MBM70oNCC3nHAdrPUmo/ExzOU1Q3IHtA/KUqX29rLlIMgNVb0Z3nTaaSy iEAcsJNeMzARSgpouiMHigC7CLE1WFo1NdKUks3sT+Zdg+q50Jrcq0n76iCdz2MeTvUY kztlRKRTR298h9yH3RMYMOoYzeZZ5Cq31jgsPYdGL2VnCRsNI+7xfx8+iqGxLj0NToyA ob2QaOAy7z/M12D0dLqyGbb7LJCJkzi1DtBC4DLoeT7jBnNb72hhrmP8Ec+2iqI0+C+o r+kg== 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=tD1XD70uRgNQKOZ6P+hdEW1FWaG1bubLLMDm7X9W3dY=; b=BJiLavCg+v7WjdY1TFr/jXqTsZPKLtKwMEpDwSsA58W8/Y8xPH3k6YO781RyUZ06Nu 1Qzli+P6G1ZSIUdO8xbmyb1Y72yNY0fGJdgRo7EaNVFwb7tjk6J2Ts54lm9E82dx9RkM ORQLcLGfFTMIrl028WJnSrTcMox4/d1S6VT9rXJ4/X7XsUDOqKvIyJ36aI3SrnJKCNkM kjoC3r+kJWTkfD3PjpQJlfmgp6O/ZrLrjAJB+5x5QwoP4FSJBhq2i1KD4myqLe04far6 o8k83atuGHq/tsRYFEFFQR9jbSY4jrWiuAkXgJdF8XRDNQt0OvDzVA1xS3TeOI0UlW2v UJDQ== 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 a28si3947678otd.257.2020.02.12.00.44.42; Wed, 12 Feb 2020 00:44:54 -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 S1728538AbgBLIoW (ORCPT + 99 others); Wed, 12 Feb 2020 03:44:22 -0500 Received: from esa3.mentor.iphmx.com ([68.232.137.180]:18894 "EHLO esa3.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728435AbgBLIoW (ORCPT ); Wed, 12 Feb 2020 03:44:22 -0500 IronPort-SDR: EOt7E0tLBd2uYMpugb7uP/qYtF3FZPAB6ZMihgVZwUMOqVUh2/j1XQeBVwwH/l90y73CbHc0Io +6YS70rzBH4wVS/CHK+RwfM5D4Jm5hLHDEr4BNj4AanOEoXnnVB8Dro1HvhUWL8Rnn/D5lY0Pd 7MHnDPE1s26nokWCtsSr8uCzIWc1z4Ch3o9wzCub1g1ouDbFUddJM+QbIm3SNkGC8NeaRJjvll xBvgwLYSt5s0c8EaG4kQai6CTW0Wy+QkbQf80wNx9ySIBRTrsvVB5GuCC2+GpE/8jIe4xVMAlB rnc= X-IronPort-AV: E=Sophos;i="5.70,428,1574150400"; d="scan'208";a="45742531" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 12 Feb 2020 00:44:21 -0800 IronPort-SDR: R4QeEbk/juN4Di0T2tCaI1fLAS/KKstm3+eLlqiTf00WJGhtuQk2PDMeLYU3Q/4diuK7bQXest 1Aifi5FaIckUagnESz0gwDFoKixoaLG4vuGuhHh1pbXgssR5nH4aS+3/sqwydUNojs3rUh7k7F x9UbS546irWxUG3kSBbCc2xoefYny799EJEFlfdvHh9xK9E0UqnbtYURoKZq/IkidjrXR3v4A/ bwrPPSgcBR5ilnvo0tA9sz3nyU7WoEam4HmHTNYCyMycXNYar8WgOBH3ca4IzxY+7/YosFvc33 PJ0= From: Jiada Wang To: , , , , , CC: , , , , Subject: [PATCH v7 14/48] Input: atmel_mxt_ts - report failures in suspend/resume Date: Wed, 12 Feb 2020 00:41:44 -0800 Message-ID: <20200212084218.32344-15-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212084218.32344-1-jiada_wang@mentor.com> References: <20200212084218.32344-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 7b2c62d46ef8..8cac4debb505 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