From patchwork Mon May 22 09:44:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "jeffrey.lin" X-Patchwork-Id: 9739843 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BBF3C6034C for ; Mon, 22 May 2017 09:44:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9979286E1 for ; Mon, 22 May 2017 09:44:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DB15286EC; Mon, 22 May 2017 09:44:30 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 75238286E1 for ; Mon, 22 May 2017 09:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757715AbdEVJo1 (ORCPT ); Mon, 22 May 2017 05:44:27 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36245 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757688AbdEVJo0 (ORCPT ); Mon, 22 May 2017 05:44:26 -0400 Received: by mail-pf0-f193.google.com with SMTP id n23so18893877pfb.3; Mon, 22 May 2017 02:44:25 -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; bh=U4hzREiqcmQOmBpl/G+16EiC2oCdnZeHAzoaIdEwntI=; b=ufVLQPDrP89lxso0ar+95D+J3Tz720FkAyGm0i1OWQSCuto/1kFoaX9UomGY2pw17+ H/B0iOp0/bLpdAFPyLWIrQYGrN1tmfoyqVDgu2ZJVW/daYz2wZCrb0s77zj7/wOuu320 Bt3A+q/+YllSSEU9GApSfJFpZamPgwVAgLlq3R9xcY/+IkksOzLRYXxqySkGsVqpltxF +7BnrKehetnx0CbYTREiP0CxDZu9cgJAB2lDbuoda99slylO9I3zdosktT0uuwGbY4du 211jMowlO0pJDmj7EENAQFlnozH58FP4ZnzjC/6AfqjRGNYHsNxi/kbCOqA7c8TIhM4/ zDIg== 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; bh=U4hzREiqcmQOmBpl/G+16EiC2oCdnZeHAzoaIdEwntI=; b=YCJYnaiK+MMgfUXr59gipDTeBwI8nhAw0jTNpDYa7PO2VDZCgXEoc2axZXsNZ/EszZ Deo589FNtT9LsAYhCu+x96hqEAYoHUkiT8GyEznwzVTvUYIoTzn80svCyZYB+gFoZ5Z2 0NdzDh9OZ28Xf/YpSk9C3H/285th89g8Z08mAbxTxAyrZTl2P9M8rlAEl/teSodYNrQd cAqiPneeCg7MDXik5vz9xYwWrUhJqxIUQ2fudgBu1nWCiuPx45mnoP8jEv8sGakrrZKw Y2OBwDQgb2BqtLEGfA5xPmSOw/koKEuybj9GennJkpWd952jMx2PFE+YCD7MlULh7770 wzCw== X-Gm-Message-State: AODbwcCHmRnpz0+p1YY+dbKf6NlzLp17HVm6RkQjNE4xn9/PuwyfYM8O zr4K/DL0cN5D9w== X-Received: by 10.99.114.94 with SMTP id c30mr24340424pgn.6.1495446265275; Mon, 22 May 2017 02:44:25 -0700 (PDT) Received: from localhost.localdomain (39-9-139-32.adsl.fetnet.net. [39.9.139.32]) by smtp.gmail.com with ESMTPSA id o89sm30433591pfj.88.2017.05.22.02.44.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2017 02:44:23 -0700 (PDT) From: "jeffrey.lin" X-Google-Original-From: "jeffrey.lin" To: dmitry.torokhov@gmail.com, bleung@chromium.org, groeck@chromium.org, Katherine.Hsieh@quantatw.com Cc: jeffrey.lin@rad-ic.com, ealin.chiu@rad-ic.com, calvin.tseng@rad-ic.com, gorden.chang@rad-ic.com, KP.li@rad-ic.com, albert.shieh@rad-ic.com, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH] driver: input :touchscreen : Fix calibration area lost as firmware update Date: Mon, 22 May 2017 17:44:15 +0800 Message-Id: <20170522094415.15018-1-jeffrey.lin@raydium.corp-partner.google.com> X-Mailer: git-send-email 2.12.2 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 Touch calibration file will be lost as touch firmware version different from in device when doing firmware update Preious raydium_i2c touch driver. So this modification only select specific flash partition for firmware update to make sure all the function properly. Signed-off-by: jeffrey.lin --- drivers/input/touchscreen/raydium_i2c_ts.c | 34 ++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c index a99fb5cac5a0..3aa40cfa2334 100644 --- a/drivers/input/touchscreen/raydium_i2c_ts.c +++ b/drivers/input/touchscreen/raydium_i2c_ts.c @@ -441,21 +441,41 @@ static int raydium_i2c_write_object(struct i2c_client *client, return 0; } +static int raydium_i2c_flash_select(struct i2c_client *client) +{ + static const u8 cmd[2][2] = { + { 0x06, 0x01 }, + { 0x02, 0xA1 }, + }; + int i; + int error; + + for (i = 0; i < 2; i++) { + error = raydium_i2c_write_object(client, cmd[i], sizeof(cmd[i]), + RAYDIUM_WAIT_READY); + if (error) { + dev_err(&client->dev, + "flash select failed at step %d: %d\n", i, error); + return error; + } + } + + return 0; +} + static bool raydium_i2c_boot_trigger(struct i2c_client *client) { - static const u8 cmd[7][6] = { + static const u8 cmd[5][6] = { { 0x08, 0x0C, 0x09, 0x00, 0x50, 0xD7 }, { 0x08, 0x04, 0x09, 0x00, 0x50, 0xA5 }, { 0x08, 0x04, 0x09, 0x00, 0x50, 0x00 }, { 0x08, 0x04, 0x09, 0x00, 0x50, 0xA5 }, { 0x08, 0x0C, 0x09, 0x00, 0x50, 0x00 }, - { 0x06, 0x01, 0x00, 0x00, 0x00, 0x00 }, - { 0x02, 0xA2, 0x00, 0x00, 0x00, 0x00 }, }; int i; int error; - for (i = 0; i < 7; i++) { + for (i = 0; i < 5; i++) { error = raydium_i2c_write_object(client, cmd[i], sizeof(cmd[i]), RAYDIUM_WAIT_READY); if (error) { @@ -689,6 +709,12 @@ static int raydium_i2c_do_update_firmware(struct raydium_data *ts, return error; } + error = raydium_i2c_flash_select(client); + if (error) { + dev_err(&client->dev, "send flash select fail: %d\n", error); + return error; + } + msleep(RM_BOOT_DELAY_MS); data = fw->data;