From patchwork Tue Jul 31 15:18:10 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: 10550911 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 DB6E913B8 for ; Tue, 31 Jul 2018 15:19:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7FD52B062 for ; Tue, 31 Jul 2018 15:19:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEF022B0E1; Tue, 31 Jul 2018 15:19:19 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI 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 621452B062 for ; Tue, 31 Jul 2018 15:19:19 +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=6a0B5fwNSWDoGiEPbRMCyIrgidCKqyx2gXErUFXv7h4=; b=rWKfWMQuJhtTkx X3v9DrmI49BteQTSu1c7DXAI3ncZUdY0fFYXdcYCr7HnDXq0ICcxxrf+pbj9HbJ5BG/BiH7oWMRAI sxwgPJLfgMwhQMy/jM+yfEOBcF+hetqE7JQKIDkHImdZq0H1ti7A7tvtXJMEvbUDGQvnYiRi7/+Cc szOJpOrw+I/x7l7DI+M2AiA2hoQtDhqYLHImS6BqpzRWMO5AYHkUMCPxdeJOrN7QTyzwxbOXRMER5 ooxPiqbX9B319xj2HhvJT1hLzOmlfwHC5xZ+jym5rMIOZoZZl/xGvbsTCd0BFn0fwzZnLwfq/eSTz Lh+T4M+ifpmo+ey3Ji0A==; 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 1fkWQe-0000f2-H0; Tue, 31 Jul 2018 15:19:16 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkWPz-0008Ff-9k for linux-arm-kernel@lists.infradead.org; Tue, 31 Jul 2018 15:18:36 +0000 Received: by mail-lj1-x241.google.com with SMTP id v9-v6so14070002ljk.4 for ; Tue, 31 Jul 2018 08:18:24 -0700 (PDT) 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=oDFpD0XD10AgLdPz8ese+ZwKGg/jgVOPdmYGBME+5IY=; b=E9XHWvhN5FI7YmYY0EdAm/mUUcuzhDrJRJDgxFXh89blslJEGE54hCxGHen4KODisp iJXv1cppINm0Bb/ZBpO83Nx2ecfBAsb+vsXc8ip7kjBSNVNlGRY2D7BoJUJFchaH4/AY JpAjqUmG7x3qr5WqO7+lINTFCxWdat6WAAqQ02SLnxYRN9jrHu2V8nTbKcffeyhBKj8o 6L0ryIitoq0SXNpG/1/CjuOF8JQKGK5Dkc83nqjwjJ+X8A9uUfXpH/ZeGWPltm9Dwe8X VCt0lsk116YSZYOIxYT7QAOmFiXGhSj+xq+lA/nIxjssZPA5lO4rze7kcPG4EB9QzsVm ShqQ== 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=oDFpD0XD10AgLdPz8ese+ZwKGg/jgVOPdmYGBME+5IY=; b=JDPKZhTZejVUKW7Ofwq/9/4YBC/Cazkho3IEDdKIu6pWra7KSzDIirEcsfuzeMZ1DX DoHJLRnsmz22/VPg3W+VUndetZXWY5jnI5igdDPeRe4tXl6Ux684f0ZDKU4gd4EvOQfK UyFmYVhPBQp5nvbzPFfZHJP1srRlGmRzTDm4HNttRztaLu8A3jnad+eh+sI36uTkRorg +/PmZiZRyNVfFQ/KXwemQSHqgar4a6IaxVqjrXe9HqPq7d6amaj9A3yNCZz/oAbePhuW vtJL5M1xW49tDiCimrdhuZ9Ohabir9YBF/QkGmAmjvgJfT3AEIVIOK3ts2GrYAhVaes8 /2bw== X-Gm-Message-State: AOUpUlFYl+WrXSotSLTD3+RDL7reN/cHF0Ku2jotYz8jTFoqtUMEg3iO vVrqdyvWAQ7+KFp2k/6ECMA= X-Google-Smtp-Source: AAOMgpd5vAZQ4cR3dc+7QPzWJsQzsqW1Uibyl9sL/eIa76qFyGInDJUztPW27RS/EW+naM+neDXscQ== X-Received: by 2002:a2e:6d0a:: with SMTP id i10-v6mr17416037ljc.145.1533050303364; Tue, 31 Jul 2018 08:18:23 -0700 (PDT) Received: from localhost.localdomain (user-94-254-173-71.play-internet.pl. [94.254.173.71]) by smtp.googlemail.com with ESMTPSA id p88-v6sm2606209ljp.90.2018.07.31.08.18.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 Jul 2018 08:18:22 -0700 (PDT) From: =?utf-8?q?Pawe=C5=82_Chmiel?= To: nick@shmanahar.org Subject: [PATCH v3 2/3] Input: atmel_mxt_ts: Wait for device be ready for communication Date: Tue, 31 Jul 2018 17:18:10 +0200 Message-Id: <1533050291-11502-3-git-send-email-pawel.mikolaj.chmiel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533050291-11502-1-git-send-email-pawel.mikolaj.chmiel@gmail.com> References: <1533050291-11502-1-git-send-email-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-20180731_081835_339291_D3359156 X-CRM114-Status: GOOD ( 13.95 ) 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 --- 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 2cd7f6db6ba9..79e08916359f 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 @@ -3046,6 +3047,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;