From patchwork Tue Oct 2 12:21:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Sax X-Patchwork-Id: 10623593 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2ACEB16B1 for ; Tue, 2 Oct 2018 12:23:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BBF128818 for ; Tue, 2 Oct 2018 12:23:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FAA02887F; Tue, 2 Oct 2018 12:23:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2AE728818 for ; Tue, 2 Oct 2018 12:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727528AbeJBTHA (ORCPT ); Tue, 2 Oct 2018 15:07:00 -0400 Received: from mout.gmx.net ([212.227.15.19]:45873 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727510AbeJBTHA (ORCPT ); Tue, 2 Oct 2018 15:07:00 -0400 Received: from chef.lew.wohnheim ([131.188.23.42]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MCLx3-1fyCuc1vof-0099Gj; Tue, 02 Oct 2018 14:23:51 +0200 Received: from chef.lew.wohnheim ([131.188.23.42]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MCLx3-1fyCuc1vof-0099Gj; Tue, 02 Oct 2018 14:23:51 +0200 From: Julian Sax To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Julian Sax , Hans de Goede Subject: [PATCH] Input: silead - try firmware reload after unsuccessful resume Date: Tue, 2 Oct 2018 14:21:27 +0200 Message-Id: <20181002122127.31568-1-jsbc@gmx.de> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:iAto+VwALMH3AoJQvm/FzihGGNH5HEmeAIz34ldpbmvOPI+FX8d NyuvdijNajehPzRJNvjqg6nKRVt83MuTALCX75dm6LguxL6RKqLRbuKZbOlItJSfk3NP1tr Ha0dEHXg53yqu4Ue5tXbVD0WKNRjcvxkR/7luMWIHW7BXtXXxY49Yb1VdWvIDmXHJLu/Mq4 EJ7Bd3Wc5FmNYVlfHP3uQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:ifPt+OHLPeo=:ev7ILzyCEPxrUX1QTd5hFl m5PLrT8/vGMp69Etey7dh9Z6UKX1EQS2s3mY4twKC/QCq935svQB8K/hlSf5Z1ThSnOqM5GBb +RKLtNVzelq4IFhYrlOqKeiNk14zUdMSo0OXVhikIrQRZ4f0By4pZM8TbYe0OYxlw2DGIW7nb SuIwIHoE9UpSuoOHci48Z68qZFuVB3upcxHZ7BrPD8slDfoq437q2nwkIVmGQN952a3FIhZre ThP9todyaMaFL3mVX1M+2CzgCvFbEPBmkAuS3a9ErFMywMxeSQwVeAgUTxQmFXsMnC/1VC6nr dsxko+kkJdQvfs/cPwx9ZJBYbTNLL1VoiZ5OVtVk3rEzoslfI6RZLDzLp0W09U6Ky9cwnN7wU JZw3qdoKbCG02mb9Hrp+2uzSp7qTLOQUWveO98PIy9FuP6rHbSqM9hhixkfgIE6cbH3f7/Ctw viTOXvkTkK5e5tFMa5G7g6dFw1rR06KTthupy0EsalwUEY4o8qgHZqSMvb84cVYGnI1xoIZJ9 sWikPsv/cGShXPDumtiXWMhVwTNjiHIIzkzc98YYjDAsbWanbRLSoIQORjvKi+qYwoOtIuYQa 6jZsuOjUNSUOXrrKwo+8z5wz3o1bNeIljwkbU1z5fLXRgih2c4zCr9MEYBv4FTbTaC8uvc3+J I/KVLknhVzyKY++5kHWwqGPO/ibzRgh8V5Ue7H54oTUBEP2LN3OxSBCD8jkxu0h2H/+/6di9n pvqWYHfKXrzTp74W1KW7joLxOWUaYkAfkF9TdDvEvj999fMJSquU0tpVoqjq2528Ie2EDEMBT JHe5JS1TiICV4xynRmv/sW2kXUi4Q== Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A certain silead controller (Chip ID: 0x56810000) loses its firmware after suspend, causing the resume to fail. This patch tries to load the firmware, should a resume error occur and retries the resuming. Cc: Hans de Goede Signed-off-by: Julian Sax Acked-by: Hans de Goede --- drivers/input/touchscreen/silead.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c index d196ac3d8b8c..09241d4cdebc 100644 --- a/drivers/input/touchscreen/silead.c +++ b/drivers/input/touchscreen/silead.c @@ -558,20 +558,33 @@ static int __maybe_unused silead_ts_suspend(struct device *dev) static int __maybe_unused silead_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); + bool second_try = false; int error, status; silead_ts_set_power(client, SILEAD_POWER_ON); + retry: error = silead_ts_reset(client); if (error) return error; + if (second_try) { + error = silead_ts_load_fw(client); + if (error) + return error; + } + error = silead_ts_startup(client); if (error) return error; status = silead_ts_get_status(client); if (status != SILEAD_STATUS_OK) { + if (!second_try) { + second_try = true; + dev_dbg(dev, "Reloading firmware after unsuccessful resume\n"); + goto retry; + } dev_err(dev, "Resume error, status: 0x%02x\n", status); return -ENODEV; }