Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp947400ybb; Wed, 25 Mar 2020 12:36:02 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv02lpkVlW/HEICRbP9wxN1kfxU1ylI4Z8nUJiRgzOYQjzUiOUIhmoY5yJjrG+SmDDBbEae X-Received: by 2002:aca:7213:: with SMTP id p19mr3786457oic.159.1585164962090; Wed, 25 Mar 2020 12:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585164962; cv=none; d=google.com; s=arc-20160816; b=eWnOZnVLfqlk195htt3EMu9lOa4tD34N/di0vQFwEIzUF611mgAz8AK1MFMCWVoXSC wKyTLlNXkznjXl2ZpBM1O56pbapOFtYer2iFpqW1rMIpkZLlDWa6d26uJLFmK7q2qTwO y4r5rZ3P/NAvWtyZgFVcus09W39lC1ZJkwktMZ/8jnA3SDAhjrz0DLiyPaWxeTtbN2pR fUrHzRaFnC0Af7bnxri5Az34ivTdJCyGqhn17kUgQ8hUgKCGeOVn+GixXBRHFv9t38EG uPUXKC0No+M7i7/OttDH5Cn7pq/Q2X7BKwNtgW9X/Dp6aXFZnxS9zIcgKxzULdVGXTxg 7IAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=7fZLDf+lfcWl33b+ZMq73HRJnpE12IsxFS0P2yb1f7A=; b=obXZXZwhl0HQ47CA6KNsF5m+Zng9MRK8ORIcDwgMBwCdDe0yroRHE3szMbF3LnPUWV PFkg3PjhNJn1MMvhWUp1iGxz4EfE84Iv0iv2K8SWcQECUJ8xJ7vrikRPe8ebnXntaNdr Pxcg7HiCq7fHTa9zFIZN7E0BIq3JOD5c8JBS6NV3j+pEjgAgkQVLcp/tVpUt23BmB64q +eapjHLz28eQwNzpufA8zdQwXFf/Qsy3SK9Pie68NHGrY9nJ6Qp8eaKtNTwAGYCp92vQ aiCm9v4EvZAASlg9jJRLFhuMq3d4GGe3VMIgrsUHRUSOmyal9cA0jk/zcRjaysrQJ3YI cOvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ukSUhl8X; 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=QUARANTINE 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 94si31299otc.25.2020.03.25.12.35.48; Wed, 25 Mar 2020 12:36:02 -0700 (PDT) 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=ukSUhl8X; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727650AbgCYTf2 (ORCPT + 99 others); Wed, 25 Mar 2020 15:35:28 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45798 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727281AbgCYTf1 (ORCPT ); Wed, 25 Mar 2020 15:35:27 -0400 Received: by mail-lj1-f196.google.com with SMTP id t17so3805405ljc.12; Wed, 25 Mar 2020 12:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7fZLDf+lfcWl33b+ZMq73HRJnpE12IsxFS0P2yb1f7A=; b=ukSUhl8XWlf3YoH6GMjHzHoXhR5WjZaILKHopaRbz+T/TSY9o9sFcQCPb97iRVxJ6p x6mQwoajicCwY1tLxzLeWHJQSXbVcOIQLym9pJDJW7QgylQQiD1WCQWqvNj9jHcNrJ+Q eeDQPi2hdzhW0AyCXmSlAEnN0KzxVqZ2aAC90bvTCU7As1u1SlMtxVBv3H21pzMi6K/3 +P8u6v8rksbpJ8lYouGUDNmf+txKX83W49VQlYsP6y+e40Z1Fq0aW1LbsqqmvdQPgxO3 IuTbt41p4kEe4AoUzr1Rvy8ValFuBB8eHEfC80mvWc8kilJWaj1+CuIECivRbnOiWtiZ o/vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7fZLDf+lfcWl33b+ZMq73HRJnpE12IsxFS0P2yb1f7A=; b=o15tj5MX/m1XpzAbnxX3nfyqg+5U8eKsRwDy5sjit0t0uJB+ULfvmYTfoludNPwSyg LZm6+pcC0V4DyMQ7YTKYhQEuVR8B7w/ve1t3a8Lrn7flPqJ8gcAsSvMcnhGkf8TQtiGD APowQtR3PC8uCqfnaM9nN1loOBoRkXXp38ThKlM4a69uE/9w7URdd9loyB9ByNhzvRyW ZOfe9hPnA46xkjRMgthJw7MXd5fWxRnNWmgjpn7Qdf+mhgbK5Lyu0Ge2n/aLSJwtmrqw GX2oyZPkpbjYpcjwAyc6W7a9FO/caYhxHkgjWUQF+Z/hhIsh4PvxM/RtY8/y/MjCQgp5 eXQQ== X-Gm-Message-State: ANhLgQ0Y1w+o1CGDStcxcoLGS13rqdC1EIXCw6EupUR0AKRjqDRJ+HoG PaRTGoCnokG5wlSnXFLkvcI= X-Received: by 2002:a2e:b88b:: with SMTP id r11mr2953059ljp.116.1585164924279; Wed, 25 Mar 2020 12:35:24 -0700 (PDT) Received: from [192.168.2.145] (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.googlemail.com with ESMTPSA id i30sm3302532lfp.36.2020.03.25.12.35.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Mar 2020 12:35:23 -0700 (PDT) Subject: Re: [PATCH v9 52/55] input: touchscreen: atmel_mxt_ts: Added sysfs entry for touchscreen status To: Jiada Wang , nick@shmanahar.org, dmitry.torokhov@gmail.com, jikos@kernel.org, benjamin.tissoires@redhat.com, bsz@semihalf.com, rydberg@bitmath.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, erosca@de.adit-jv.com, Andrew_Gabbasov@mentor.com References: <20200325133334.19346-1-jiada_wang@mentor.com> <20200325133334.19346-53-jiada_wang@mentor.com> From: Dmitry Osipenko Message-ID: <4aeda6f1-25d8-9437-5cd0-560e43dbe081@gmail.com> Date: Wed, 25 Mar 2020 22:35:22 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200325133334.19346-53-jiada_wang@mentor.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 25.03.2020 16:33, Jiada Wang пишет: > From: Naveen Chakka > > To know the current communication status of the touch controller during > runtime, sysfs interface is added > > sysfs interface: /sys/class/i2c-dev/i2c-*/device/*/touch_dev_stat > Executing the above sysfs interface provides two output values > > 1)Status of the touch device > value 0 represents device is inactive > value 1 represents device is active > 2)Error counter > value represents the number of times device in inactive since last read ... > /* Each client has this additional data */ > struct mxt_data { > struct i2c_client *client; > @@ -372,6 +380,9 @@ struct mxt_data { > const char *pcfg_name; > const char *input_name; > struct mxt_flash *flash; > + struct work_struct watchdog_work; > + struct timer_list watchdog_timer; This should be replaced with a delayed_work. > + struct mxt_statusinfo mxt_status; > > /* Cached parameters from object table */ > u16 T5_address; ... > +static void mxt_watchdog_work(struct work_struct *work) > +{ > + struct mxt_data *data = > + container_of(work, struct mxt_data, watchdog_work); > + u16 info_buf; > + int ret = 0; > + u8 size = 2; > + if (data->suspended || data->in_bootloader) > + return; > + > + ret = __mxt_read_reg(data->client, 0, size, &info_buf); Looks like this need to be protected with a lock to not race with the suspending / bootloader states. > + if (ret) { > + data->mxt_status.error_count++; > + data->mxt_status.dev_status = false; > + } else { > + data->mxt_status.dev_status = true; > + } > +} ...> @@ -4329,6 +4414,13 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) > msleep(MXT_RESET_TIME); > } > > + INIT_WORK(&data->watchdog_work, mxt_watchdog_work); > + > + /* setup watchdog timer */ > + timer_setup(&data->watchdog_timer, mxt_watchdog_timer, 0); > + > + mxt_start_wd_timer(data); I'd expect it to be optional and opt-in by either using #ifdef TOUCHSCREEN_ATMEL_MXT_DEBUG or having a new debugfs option to explicitly enable the "watchdog".