From patchwork Fri Feb 1 08:11:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kurtz X-Patchwork-Id: 2077651 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 96E06E00E6 for ; Fri, 1 Feb 2013 08:13:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755839Ab3BAIMg (ORCPT ); Fri, 1 Feb 2013 03:12:36 -0500 Received: from mail-da0-f53.google.com ([209.85.210.53]:33652 "EHLO mail-da0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756145Ab3BAIMd (ORCPT ); Fri, 1 Feb 2013 03:12:33 -0500 Received: by mail-da0-f53.google.com with SMTP id x6so1646977dac.40 for ; Fri, 01 Feb 2013 00:12:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=le958osnSQrY1na3dOc5txUZKuFKIKdBO49nZ73g7tA=; b=KEnR0wW3fKqQ8tqeV99RwzevFr96gvVdlLGZ1qzdm5VquxtoF1sxT/qKEagzyqaAq3 RHEh+66JQtI7hXfzEJjPtHrsERBtpkRrm3xAlBGULfN1/WCKDM6MZmqt3+Vivmd2ukD+ SD8U92sKHTU22So+m5FdxCF2QhIxmrUB2qjBU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=le958osnSQrY1na3dOc5txUZKuFKIKdBO49nZ73g7tA=; b=exJQAapZtyxBgvG/OWyJE5vVimOzOhqmSV3qLxzdojEdlIyonZWTnwCM5XAVcnfflF YKHg5k34J1bbr0tW7v8CnjRqE4PcRo90C5ahyDo2e4y6IT2hgtSF3TljeEU3K9YdMkIJ QjzkbaFIM98nnY/3dErOTT7LFsbwGIibqG5438X3SFM6NYLJuSeqOBFmK5QcGSWvaFXl 1Pr0fi9E2xCsSTqMYvnQLy5XKbGeVig2PUe2y+z7ez031wFDQAwlo71kWGDhByRIL713 mnrYlJvbPiCljRHMES9slcMKXQBhVodoMf+luMU/YZVW3jytn1Fk9CAr4pnvxVnMqY/G hvIA== X-Received: by 10.68.189.66 with SMTP id gg2mr29666828pbc.111.1359706352337; Fri, 01 Feb 2013 00:12:32 -0800 (PST) Received: from djkurtz-z620.tpe.corp.google.com (djkurtz-z620.tpe.corp.google.com [172.30.210.61]) by mx.google.com with ESMTPS id bi8sm8398002pab.15.2013.02.01.00.12.29 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 01 Feb 2013 00:12:31 -0800 (PST) From: Daniel Kurtz To: Dmitry Torokhov , Henrik Rydberg , Benson Leung , Yufeng Shen , Nick Dyer Cc: Joonyoung Shim , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, olofj@chromium.org Subject: [PATCH 09/10] Input: atmel_mxt_ts - wait for CHG after bootloader resets Date: Fri, 1 Feb 2013 16:11:51 +0800 Message-Id: <1359706312-24642-10-git-send-email-djkurtz@chromium.org> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1359706312-24642-1-git-send-email-djkurtz@chromium.org> References: <1359706312-24642-1-git-send-email-djkurtz@chromium.org> X-Gm-Message-State: ALoCoQnSJdWdEZep139TaLDynqcrz+iBjRSMJulfE7uMTMPjijgnj1XfxenDeQa9K4NKUzwg1vHr Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Benson Leung Rather than msleep for MXT_RESET_TIME and MXT_FWRESET_TIME during the transition to bootloader mode and the transition back from app, wait for the CHG assert to indicate that the transition is done. This change replaces the msleep with a wait for completion that the mxt_interrupt handler signals. This improves firmware update time by 300 ms as we no longer wait longer than necessary for each reset. Signed-off-by: Benson Leung --- drivers/input/touchscreen/atmel_mxt_ts.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index d0f91ff..ef867d3 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -634,6 +634,7 @@ static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg) static int mxt_enter_bl(struct mxt_data *data) { struct i2c_client *client = data->client; + struct device *dev = &client->dev; int ret; if (mxt_in_bootloader(data)) @@ -662,8 +663,19 @@ static int mxt_enter_bl(struct mxt_data *data) data->input_dev = NULL; } + INIT_COMPLETION(data->bl_completion); enable_irq(data->irq); - msleep(MXT_RESET_TIME); + + /* Wait for CHG assert to indicate successful reset into bootloader */ + ret = mxt_wait_for_chg(data, MXT_RESET_TIME); + if (ret) { + dev_err(dev, "Failed waiting for reset to bootloader.\n"); + if (client->addr == MXT_BOOT_LOW) + client->addr = MXT_APP_LOW; + else + client->addr = MXT_APP_HIGH; + return ret; + } return 0; } @@ -676,10 +688,10 @@ static void mxt_exit_bl(struct mxt_data *data) if (!mxt_in_bootloader(data)) return; - disable_irq(data->irq); /* Wait for reset */ - msleep(MXT_FWRESET_TIME); + mxt_wait_for_chg(data, MXT_FWRESET_TIME); + disable_irq(data->irq); if (client->addr == MXT_BOOT_LOW) client->addr = MXT_APP_LOW; else @@ -1122,7 +1134,6 @@ static int mxt_load_fw(struct device *dev, const char *fn) if (ret) goto out; - INIT_COMPLETION(data->bl_completion); /* Unlock bootloader */ ret = mxt_unlock_bootloader(client); if (ret)