From patchwork Fri Dec 7 14:28:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pawe=C5=82_Chmiel?= X-Patchwork-Id: 10718317 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 E6B821731 for ; Fri, 7 Dec 2018 14:29:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5F912DD44 for ; Fri, 7 Dec 2018 14:29:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C40542E294; Fri, 7 Dec 2018 14:29:44 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 78F642DD44 for ; Fri, 7 Dec 2018 14:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tTGt/FfIRYHY2bYXQXlsZ2X7WEAhc91eZO/pacersWU=; b=L6wKXPi73NEv/0 qv4yTu7zzuFLx3c1+bjcCzT9Y02brpFDKCDYqVxn6+iEOyedtuw/CbBJRdw3grN8yy5vP7u4mIcOg lcnpOEXBBEqp9Lsdv0QB4CPUL1YKIEhOHJky6q2ZU5VJUDo9f4Ba5kYFwlEYKF4rJYS9DSmivpdxb IDHLtuDAaCKfIOLXaRNmqgoMbHt+P/Uexlrm9eJWQdHDWpW+Mpqv5lZdhJjPqqnAqSMt9egYEj2O+ uDWLDT/29ipbkXeofrJKmM2c48pgkZPYGbK/hM2I7CU1tWcjbbflAGGYWc9wzHSARcZK8epBpFzF8 +7gRUs2ETeAOzZ92eNuA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gVH8P-0007v1-DP; Fri, 07 Dec 2018 14:29:41 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gVH80-0007Vj-Dm for linux-arm-kernel@lists.infradead.org; Fri, 07 Dec 2018 14:29:17 +0000 Received: by mail-lj1-x244.google.com with SMTP id k19-v6so3691238lji.11 for ; Fri, 07 Dec 2018 06:29:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vWNAi8KA5a8AOePm/F4rK7ibKNtgPheT1xDfWNYRieY=; b=e11A58l1OICddwBkd3QPB4OcLgtsliFd4zjJy+N9bQGigToT/1BMutBRd+QtlEq0pO 5LILs7A2Lq1IguK022EApnKfxclTwl6Lk0siOrwEnjOvMPWwhwnJMb7K4znBRl9PMqjY 7iFelOBgQN4qdgQ/Ccn71jD9m5ARPDAyzAvvTuwyZJdkdOqe4qqG2KbuO7F0zu4UqMCq Lbkf79c1fmzl0DIr3/R25r1Z4JJQvquvrsGcs29lV26z6fLl7+MasKIYjRGOeXXScP7k N2bKdnFvRiRdLSBowMW92NXuKlUeaLSqP30c9FPFmpiBbJ9DI5T9b7crQLPV/KH7geN0 ZxbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vWNAi8KA5a8AOePm/F4rK7ibKNtgPheT1xDfWNYRieY=; b=lrSci2010WCaiUYKj1G/2gPiwSgfiCg4fS4O8fjgIwwGiv5wGToUaz/YPRbO71ZdhV bYGQPsJHPwx8AuWY3vjU12GTQyDmcqevIbqoHerETCZfq8KqxkKMMuBtocZUrfOIrbTp SYKCdNXlK6Mo1NTbRHTSXhMjguCGGKePTO/J0wYIh39+Si8fz7Z3obtA+tDPBrjsQTpl EkBKuJ0JSumlaNGF7ghB8he4DJVI6CM42wSvTNIXkh01jB1TiFEJqF85evp5lWCww4JT 93dSVD/ycdtKWb9u8cydEYqsCkOgab3Mt/zAImOjo8IiIMFzA2SIupkKI2NcXFGMn65Y nPQA== X-Gm-Message-State: AA+aEWaI4Tw6D9R0/tHXNJF6uX7+wjjz2JHMndsGigkKqzvp8Ojr4HX6 xe2tMb+wCf0CtuzoSdmBwq0= X-Google-Smtp-Source: AFSGD/Up/wbof3FtQRCE3rUT1ZzDsRe88dk6wQP8OjxkQVHawaLT5xP91x8lz8V2gRHiotkgE7dz3g== X-Received: by 2002:a2e:994:: with SMTP id 142-v6mr1316978ljj.120.1544192944605; Fri, 07 Dec 2018 06:29:04 -0800 (PST) Received: from localhost.localdomain ([2a02:a315:5445:5300:74d5:51ba:2673:f3f4]) by smtp.googlemail.com with ESMTPSA id v64sm630504lfa.48.2018.12.07.06.29.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 06:29:04 -0800 (PST) From: =?utf-8?q?Pawe=C5=82_Chmiel?= To: nick@shmanahar.org Subject: [PATCH v4 2/3] Input: atmel_mxt_ts: Wait for device be ready for communication Date: Fri, 7 Dec 2018 15:28:56 +0100 Message-Id: <20181207142857.15818-3-pawel.mikolaj.chmiel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181207142857.15818-1-pawel.mikolaj.chmiel@gmail.com> References: <20181207142857.15818-1-pawel.mikolaj.chmiel@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181207_062916_460425_894B6573 X-CRM114-Status: GOOD ( 13.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, alexandre.belloni@bootlin.com, dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Pawe=C5=82_Chmiel?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP According to documentation, device isn't ready for communication, until firmware asserts the CHG line. Add missing wait for this. Signed-off-by: Paweł Chmiel --- Changes from v3: - Fix checkpatch issues --- drivers/input/touchscreen/atmel_mxt_ts.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 1dc8ad0da5af..3f956d07d09e 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -202,6 +202,7 @@ enum t100_type { #define MXT_CRC_TIMEOUT 1000 /* msec */ #define MXT_FW_RESET_TIME 3000 /* msec */ #define MXT_FW_CHG_TIMEOUT 300 /* msec */ +#define MXT_POWERON_DELAY 150 /* msec */ /* Command to unlock bootloader */ #define MXT_UNLOCK_CMD_MSB 0xaa @@ -3068,6 +3069,16 @@ static int mxt_regulator_enable(struct mxt_data *data) msleep(MXT_REGULATOR_DELAY); gpiod_set_value(data->reset_gpio, 1); msleep(MXT_RESET_INVALID_CHG); + +retry_wait: + reinit_completion(&data->bl_completion); + data->in_bootloader = true; + error = mxt_wait_for_completion(data, &data->bl_completion, + MXT_POWERON_DELAY); + if (error == -EINTR) + goto retry_wait; + + data->in_bootloader = false; } return 0;