Received: by 10.223.176.5 with SMTP id f5csp2330847wra; Mon, 5 Feb 2018 02:09:45 -0800 (PST) X-Google-Smtp-Source: AH8x224M/Pr1jz98bg3sQa1wYItrNwIwuLqJkcJfpBTAE3sP39uPM5X08jMuGHpB5lhEL3iQJ8Rk X-Received: by 10.98.35.14 with SMTP id j14mr48418095pfj.62.1517825385108; Mon, 05 Feb 2018 02:09:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517825385; cv=none; d=google.com; s=arc-20160816; b=lnEeVGbduId4faiB7QNwnasA+HgkmTmQZ35ELFYivb4clz7fBrGtFhmRbi3Tzzu5Yx oLi7+ZmfK4ChpaMkeqAMq6+lRqrNnKULD4VqFLiaDx9oDyZWXQXeohdJ+Ux+RPngNKxX eM0WFLIyZzfYkd/jQ+TAvIwne91cqwlfB42HKAU27qvAncq7MkWlcvE4Fl9oGDWAWWag LthyNs23r98FkPtbOSF/r09nYlXjae1SzIxJXWoq3WslTQGL4waJLYX2bsXYUQJwGRxM nnIiORqxJLrXrioedpRskGUhlwo3v69xhDOH6To4BqqyZocAWAQK9qc81hINO31HDKKp 18hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=zGL532JA+sc3OhviaxLt+JqhdKeOndBdlc3MCxWff2o=; b=cffY/kTf32MJm1TeX9UyfMLr+KfYOSv5ML2vx2QiYb6Su7HDk1arYpfaOAOrhjtD94 8A3qPKZeqa1uOGAsN8RUP48AKKoenB+MNDsHeJ+H/a8nWUPzCJJuIzRT2WvfPFHXbEOR S3XBSCF20bY+kNZBnxyeebHIgYp30w5YLhDiQwyO5Z9gIIrYRvF4S6lOJbxq/HClP23V Bpq8tluS9wFpDA/vBB8E43LztqMm4zxnyMykr2UUm8fabJeSSLRUUoawo0hWefvxxvNT dKK2tVNa12PCWW/EbeEuuezjA8R80YeOU70r3dbmW+UGFQwVs2wHOWSbVOJrByNmK/24 /tOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JJzutFZc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si3507457pfe.245.2018.02.05.02.09.30; Mon, 05 Feb 2018 02:09:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JJzutFZc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752816AbeBEKHp (ORCPT + 99 others); Mon, 5 Feb 2018 05:07:45 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:40704 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752696AbeBEKHc (ORCPT ); Mon, 5 Feb 2018 05:07:32 -0500 Received: by mail-wr0-f195.google.com with SMTP id i56so28932041wra.7; Mon, 05 Feb 2018 02:07:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=zGL532JA+sc3OhviaxLt+JqhdKeOndBdlc3MCxWff2o=; b=JJzutFZcRbFWCp+Xpr9Vc1bXYLMZ+6dLLmkt5SHZMXVPZ7zsEw1wqS/+6D6J8k11k1 6iRvvKKufdI3FrXTsbH8ZupTFr7LwqrPHvxRfCuQMJpbt7TIF7eJK7LaWlRx/yoYDcvm D+/rzzDrwkJD5xiiDYgYSJuBwnUJFtbbHcQ0dyTxnP87R7Wtqey3wUVc+qsban9ANmvo IMr7NqfUYsSZF0JujebG7f4NWPD/funDIRNHbXbK5ziAsmEKoAZhxfLEpX7qjIXoXkWI ViGqKUDOa2QB5Wl6dM4nwd5mRUlX/GVtEJBTjNysih6WbLWJmuMMx/GcljuSseuhrKgB uJuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=zGL532JA+sc3OhviaxLt+JqhdKeOndBdlc3MCxWff2o=; b=iPZbk1WtPkijJRXHpVb59/PJxLtM3kG/jA0FtXTww+ZA9trzDNI9X43LMM7hojbmq2 pJ5XJy84E/eixZSIPKBE79thk6vna9s8u4D3Z3GUx6N0E77Tj9KR6hSUeb7sMIoNZxJR FFVhqTJBeqEJ/LUElUKxmP4FuSiw1oCuYUGDWfpRxFiYO4qTg9izWDPE7vhrckrlvZQy xLcQKmqxvtlLrUcNsAiC7IivTye7+zA20UJgxCvPzf/LYmDMjpbM4cvyz/5lAWqWBwHy GKSC+T4F2EBZ2z+tCMvCyoxT8H/4Kil0Pv56vBomOICnwsWLe+7OWDh5dixXNOJ9BE38 fQyg== X-Gm-Message-State: AKwxytfn5MxHMii2C4Gysi9UQmWPGC1VwQEQ2fe8q0uOMYvKo+qqBn+c gSt2QEODxw6YRwQpJRgPFlFQQ3sKZrIgQGyYwPOMElHX X-Received: by 10.223.176.172 with SMTP id i41mr26967743wra.47.1517825249398; Mon, 05 Feb 2018 02:07:29 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.124.12 with HTTP; Mon, 5 Feb 2018 02:07:08 -0800 (PST) In-Reply-To: <1493295756-17812-1-git-send-email-martin.kepplinger@ginzinger.com> References: <1493295756-17812-1-git-send-email-martin.kepplinger@ginzinger.com> From: Christian Gmeiner Date: Mon, 5 Feb 2018 11:07:08 +0100 Message-ID: Subject: Re: [PATCH 1/2] input: touchscreen: ar1021_i2c: enable touch mode during open To: Martin Kepplinger Cc: Dmitry Torokhov , linux-input , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all. 2017-04-27 14:22 GMT+02:00 Martin Kepplinger : > The device could as well be in command mode, in which this driver cannot > handle the device. When opening the device, let's make sure the device > will be in the mode we expect it to be for this driver. > I run into issues caused by this change. It turns out that the device is non-functional after some warm-reboots and as a result I am not able to use xorg's evdev driver. So I have some questions about this change: * Should we enable irq before calling i2c_master_send(..) as the chip raises an irq if the command was processed? * Would it be enough to send this command only once during driver lifetime? I can see that on my system open gets called 3 times during boot-up. * What are the circumstances the touch device would be in an other state? In the official kernel driver the userspace can send commands via sysfs. Also the driver does set the touch enable mode as this patch does. > Signed-off-by: Martin Kepplinger > --- > drivers/input/touchscreen/ar1021_i2c.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/input/touchscreen/ar1021_i2c.c b/drivers/input/touchscreen/ar1021_i2c.c > index 1a94d8b..2a76231 100644 > --- a/drivers/input/touchscreen/ar1021_i2c.c > +++ b/drivers/input/touchscreen/ar1021_i2c.c > @@ -18,6 +18,12 @@ > #define AR1021_MAX_X 4095 > #define AR1021_MAX_Y 4095 > > +#define AR1021_CMD 0x55 > +#define AR1021_TOUCH 0x80 > + > +#define AR1021_CMD_ENABLE_TOUCH 0x12 > +#define AR1021_CMD_DISABLE_TOUCH 0x13 > + > struct ar1021_i2c { > struct i2c_client *client; > struct input_dev *input; > @@ -58,6 +64,15 @@ static int ar1021_i2c_open(struct input_dev *dev) > { > struct ar1021_i2c *ar1021 = input_get_drvdata(dev); > struct i2c_client *client = ar1021->client; > + int error; > + u8 cmd_enable_touch[3] = {AR1021_CMD, > + 0x01, /* number of bytes after this */ > + AR1021_CMD_ENABLE_TOUCH }; > + > + error = i2c_master_send(ar1021->client, cmd_enable_touch, > + sizeof(cmd_enable_touch)); > + if (error < 0) > + return error; > > enable_irq(client->irq); > > -- > 2.1.4 > -- greets -- Christian Gmeiner, MSc https://christian-gmeiner.info