Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp987952pxu; Fri, 11 Dec 2020 21:35:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqIfjerENXHZuxRQAAjeGtCFxeZR1Uc4jzsFceAWCHHaTpM5VtByYUfsfUeS5QPNrHUkkv X-Received: by 2002:a50:bacb:: with SMTP id x69mr15085434ede.39.1607751306955; Fri, 11 Dec 2020 21:35:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607751306; cv=none; d=google.com; s=arc-20160816; b=kEGXAgUrZjWIHlUnGOVz6FEHhcUlJ4CfUBFmVpWlZhdLDDBU24kT5i/yrPiVuidKbo 4iZX6l/VrDsrHb7YztUQ0T4g99VRVglGS2HMCMr+Q4qGFuC6dvjYZlnn4uITKqbp4L+s uITUbIwKzvJid+oEHbdf4GYKj8x9Pn1mOTqyXBglC52W8OWWZJugrt9pxCOjA6LYtkYb MUKiVN84tS51Eu0l6tmdUXRGgeF8EPWp/m4LBBWKPJnHGEW8KJ2BvEbbewZdmmhCbHsm LwSGCzOnkt6TAUIAopZDeJs7KasKofP5Fl5zi3I1ZPrHyojS7WDhpnpvHaZspg8Zukam kBLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :subject:from:references:in-reply-to:message-id:date:dkim-signature; bh=hFCfbRb1nd1hRYypYB9+IZg0RvO750DfEVXeTNqQpAY=; b=FWvTLS6jyJ4GrdA3lmrAXlrcWnkvhssVZGqnQbbt1Oka1S2gce7+5tktiREkDcCYHA 4zRaA+LqdaQ4KzGnuDKyqoGlIDpSM8JZiu2mJAJf1hII7b/aBaxNmshZCxnrvQOcbrUx ZI1cvKCpainQOoQSB+B6vG985KG+jAFyhSzupmtrTjcLbKmDgYW2uSNuxaC65MFoBfgA D0Dk3iGWaJx+6aBVMdEFaAG2d3yL1I3z8lETe116gu7FobX7m3sUM3h3GjzdL9IgLGkY j09x0O7L2Uk3bsh2dfcxO83DkAKkaiVEEvdcpPgX78H/eeE0sVPgXNCXwQBtL29ONy61 osXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=hoemYeGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a7si5811028ejc.733.2020.12.11.21.34.40; Fri, 11 Dec 2020 21:35:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=hoemYeGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436558AbgLKGym (ORCPT + 99 others); Fri, 11 Dec 2020 01:54:42 -0500 Received: from rere.qmqm.pl ([91.227.64.183]:17945 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391381AbgLKGye (ORCPT ); Fri, 11 Dec 2020 01:54:34 -0500 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4CshMj0QQHz5P; Fri, 11 Dec 2020 07:53:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1607669633; bh=3doK0FUutvkvWAsR9+JjynwPIbyNyVd+O7Di1WbQwyM=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=hoemYeGnp+UXeQWo88RYBUP1KYw11nHsm4nbbM2+dPxGWEAySS4NloP8VRlovuVxM Pxx4vizCmAKq5ZM5w68Ulr5KdQ7/D/iM/cpP/+7a1TpsgztoNxImEJ4ZorSdqz9rXK s6LCAffoVqMaA14FT7Ms+Uw+VVjayhk7CkBPiYSA8+EBBN1+sXa8yJBfwMnok9TEpz C5ljGW7aK47XTMYd1BSsKS3emBlQMmbZVCs9OrDm0XBp9P++xW+tcHiiv4jHSwERN5 OQ9Smr8ag/nX6rIBd6MjYTNgnQhLyfPI8j+JwTHLo6Ev3cek+PcXoAWDdnQVmTEJWr BMdr6WHVksOlw== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Fri, 11 Dec 2020 07:53:56 +0100 Message-Id: <728fff020bc92be10d84cc2a7ea8af6fd99af96c.1607669375.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH RESEND v8 1/4] input: elants: document some registers and values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: Dmitry Torokhov Cc: Dmitry Osipenko , Johnny Chuang , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add information found in downstream kernels, to make the code less magic. Signed-off-by: Michał Mirosław Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko --- drivers/input/touchscreen/elants_i2c.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index 50c348297e38..d51cb910fba1 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -82,7 +82,7 @@ #define HEADER_REPORT_10_FINGER 0x62 -/* Header (4 bytes) plus 3 fill 10-finger packets */ +/* Header (4 bytes) plus 3 full 10-finger packets */ #define MAX_PACKET_SIZE 169 #define BOOT_TIME_DELAY_MS 50 @@ -97,6 +97,10 @@ #define E_INFO_PHY_SCAN 0xD7 #define E_INFO_PHY_DRIVER 0xD8 +/* FW write command, 0x54 0x?? 0x0, 0x01 */ +#define E_POWER_STATE_SLEEP 0x50 +#define E_POWER_STATE_RESUME 0x58 + #define MAX_RETRIES 3 #define MAX_FW_UPDATE_RETRIES 30 @@ -269,8 +273,8 @@ static int elants_i2c_calibrate(struct elants_data *ts) { struct i2c_client *client = ts->client; int ret, error; - static const u8 w_flashkey[] = { 0x54, 0xC0, 0xE1, 0x5A }; - static const u8 rek[] = { 0x54, 0x29, 0x00, 0x01 }; + static const u8 w_flashkey[] = { CMD_HEADER_WRITE, 0xC0, 0xE1, 0x5A }; + static const u8 rek[] = { CMD_HEADER_WRITE, 0x29, 0x00, 0x01 }; static const u8 rek_resp[] = { CMD_HEADER_REK, 0x66, 0x66, 0x66 }; disable_irq(client->irq); @@ -1388,7 +1392,9 @@ static int __maybe_unused elants_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct elants_data *ts = i2c_get_clientdata(client); - const u8 set_sleep_cmd[] = { 0x54, 0x50, 0x00, 0x01 }; + const u8 set_sleep_cmd[] = { + CMD_HEADER_WRITE, E_POWER_STATE_SLEEP, 0x00, 0x01 + }; int retry_cnt; int error; @@ -1425,7 +1431,9 @@ static int __maybe_unused elants_i2c_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct elants_data *ts = i2c_get_clientdata(client); - const u8 set_active_cmd[] = { 0x54, 0x58, 0x00, 0x01 }; + const u8 set_active_cmd[] = { + CMD_HEADER_WRITE, E_POWER_STATE_RESUME, 0x00, 0x01 + }; int retry_cnt; int error; -- 2.20.1