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: 10550901 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 17DA213B8 for ; Tue, 31 Jul 2018 15:18:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 071842B0DF for ; Tue, 31 Jul 2018 15:18:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF5412B0E2; Tue, 31 Jul 2018 15:18:38 +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.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 A065B2B0DF for ; Tue, 31 Jul 2018 15:18:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732515AbeGaQ7O (ORCPT ); Tue, 31 Jul 2018 12:59:14 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:37309 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732330AbeGaQ7N (ORCPT ); Tue, 31 Jul 2018 12:59:13 -0400 Received: by mail-lj1-f196.google.com with SMTP id v9-v6so14070003ljk.4; 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=Fb+ysNLipk5+VzXmW7oxF+c8EE3SjJ1uIirifVk0ogfeoMbzEes6BhuegJ7hsvO1FG LqrhXLCJ6KgMrWp0BK9xhGRyGtJ/V50q6rlrPDjpD7r5V1edE/QOuwlTbK8lG0Zdo6lC 0mEmuNoqdGRi5y5tj99QWsiqBWtumr2JWWld4ySpmMVU2z/6J3u2WOswero6l9gq1Nmn ntHUiH8xIWReO0IlUkH4p/KQqqGwiL1IF/78CpKXnPBNXq7yMbk2pqvCoaJHKf0yckmC dF/uop2BLvuER1HaXBCouOLqSKYD4ndWboRdhMzQBgp2w7ab37C8YOBY3NzcCp81dJUV HbPw== X-Gm-Message-State: AOUpUlGk0ZPjCyM8OEvg2QDw48LQupymGFmLPMJ5T2qMfwb5VyUonT3F Lb6khMiRTi+GRXCT8pD+O6kh7SOTFck= 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 Cc: dmitry.torokhov@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Pawe=C5=82_Chmiel?= 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 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 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;